From 7465f3c2f07c165e69736b5b7001eba6d89bb9d0 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Sat, 27 Jan 2007 09:03:40 -0200 Subject: [PATCH] [CTRACER]: Check if the specified class exists Signed-off-by: Arnaldo Carvalho de Melo --- ctracer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ctracer.c b/ctracer.c index 0bbcde1..c6b0eb4 100644 --- a/ctracer.c +++ b/ctracer.c @@ -469,6 +469,8 @@ int main(int argc, char *argv[]) const char *filename = NULL, *dirname = NULL, *glob = NULL, *kprobes_filename = NULL; char *class_name = NULL; + struct tag *class; + struct cu *cu; while ((option = getopt_long(argc, argv, "D:g:k:rh", long_options, &option_index)) >= 0) @@ -561,6 +563,15 @@ out_dwarf_err: return EXIT_FAILURE; } + /* + * See if the specified struct exists: + */ + class = cus__find_struct_by_name(methods_cus, &cu, class_name); + if (class == NULL) { + fprintf(stderr, "ctracer: struct %s not found!\n", class_name); + return EXIT_FAILURE; + } + emit_module_preamble(); cus__for_each_cu(methods_cus, cu_find_methods_iterator, class_name, NULL);