[CTRACER]: Check if the specified class exists

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-01-27 09:03:40 -02:00
parent 8b8166f0a8
commit 7465f3c2f0
1 changed files with 11 additions and 0 deletions

View File

@ -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);