From 1d6a416ed8fdb759a4f4ce8df3023623cba4c74d Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 2 Jul 2012 21:13:34 +0000 Subject: [PATCH] Add command line flag --trace-notabove which I've found handy. There are 4 cases now: (1) Neither --trace-notbelow nor --trace-notabove are given No superblocks are traced (same behaviour as before) (2) --trace-notbelow=YY is given Superblocks in interval [YY ... ] are traced. (same behaviour as before) (3) --trace-notabove=XX is given Superblocks in interval [0 ... XX] are traced. (4) Both --trace-notbelow=YY and --trace-notabove=XX are given Superblocks in the interval [XX..YY] are traced git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12701 --- coregrind/m_main.c | 23 ++++++++++++++++++++++- coregrind/m_options.c | 3 ++- coregrind/m_translate.c | 1 + coregrind/pub_core_options.h | 4 +++- 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/coregrind/m_main.c b/coregrind/m_main.c index d02e5a4b36..33df5f30bb 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -205,6 +205,7 @@ static void usage_NORETURN ( Bool debug_help ) " --trace-flags= show generated code? (X = 0|1) [00000000]\n" " --profile-flags= ditto, but for profiling (X = 0|1) [00000000]\n" " --trace-notbelow= only show BBs above [999999999]\n" +" --trace-notabove= only show BBs below [0]\n" " --trace-syscalls=no|yes show all system calls? [no]\n" " --trace-signals=no|yes show signal handling details? [no]\n" " --trace-symtab=no|yes show symbol table details? [no]\n" @@ -237,7 +238,7 @@ static void usage_NORETURN ( Bool debug_help ) " 0000 0100 show selecting insns\n" " 0000 0010 show after reg-alloc\n" " 0000 0001 show final assembly\n" -" (Nb: you need --trace-notbelow with --trace-flags for full details)\n" +" (Nb: you need --trace-notbelow and/or --trace-notabove with --trace-flags for full details)\n" "\n" " debugging options for Valgrind tools that report errors\n" " --dump-error= show translation for basic block associated\n" @@ -686,6 +687,8 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd, else if VG_INT_CLO (arg, "--trace-notbelow", VG_(clo_trace_notbelow)) {} + else if VG_INT_CLO (arg, "--trace-notabove", VG_(clo_trace_notabove)) {} + else if VG_XACT_CLO(arg, "--gen-suppressions=no", VG_(clo_gen_suppressions), 0) {} else if VG_XACT_CLO(arg, "--gen-suppressions=yes", @@ -720,6 +723,24 @@ void main_process_cmd_line_options ( /*OUT*/Bool* logging_to_fd, if (VG_(clo_verbosity) < 0) VG_(clo_verbosity) = 0; + if (VG_(clo_trace_notbelow) == -1) { + if (VG_(clo_trace_notabove) == -1) { + /* [] */ + VG_(clo_trace_notbelow) = 2147483647; + VG_(clo_trace_notabove) = 0; + } else { + /* [0 .. notabove] */ + VG_(clo_trace_notbelow) = 0; + } + } else { + if (VG_(clo_trace_notabove) == -1) { + /* [notbelow .. ] */ + VG_(clo_trace_notabove) = 2147483647; + } else { + /* [notbelow .. notabove] */ + } + } + VG_(dyn_vgdb_error) = VG_(clo_vgdb_error); if (VG_(clo_gen_suppressions) > 0 && diff --git a/coregrind/m_options.c b/coregrind/m_options.c index ca186c01d4..ab38d080e8 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -81,7 +81,8 @@ Int VG_(clo_n_fullpath_after) = 0; Char* VG_(clo_fullpath_after)[VG_CLO_MAX_FULLPATH_AFTER]; UChar VG_(clo_trace_flags) = 0; // 00000000b UChar VG_(clo_profile_flags) = 0; // 00000000b -Int VG_(clo_trace_notbelow) = 999999999; +Int VG_(clo_trace_notbelow) = -1; // unspecified +Int VG_(clo_trace_notabove) = -1; // unspecified Bool VG_(clo_trace_syscalls) = False; Bool VG_(clo_trace_signals) = False; Bool VG_(clo_trace_symtab) = False; diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index fc6fa6287c..2c2f41f865 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -1420,6 +1420,7 @@ Bool VG_(translate) ( ThreadId tid, } else if ( (VG_(clo_trace_flags) > 0 + && VG_(get_bbs_translated)() <= VG_(clo_trace_notabove) && VG_(get_bbs_translated)() >= VG_(clo_trace_notbelow) )) { verbosity = VG_(clo_trace_flags); } diff --git a/coregrind/pub_core_options.h b/coregrind/pub_core_options.h index 5e81b768d7..60978e1241 100644 --- a/coregrind/pub_core_options.h +++ b/coregrind/pub_core_options.h @@ -130,8 +130,10 @@ extern Char* VG_(clo_fullpath_after)[VG_CLO_MAX_FULLPATH_AFTER]; extern UChar VG_(clo_trace_flags); /* DEBUG: do bb profiling? default: 00000000 ( == NO ) */ extern UChar VG_(clo_profile_flags); -/* DEBUG: if tracing codegen, be quiet until after this bb ( 0 ) */ +/* DEBUG: if tracing codegen, be quiet until after this bb */ extern Int VG_(clo_trace_notbelow); +/* DEBUG: if tracing codegen, be quiet after this bb */ +extern Int VG_(clo_trace_notabove); /* DEBUG: print system calls? default: NO */ extern Bool VG_(clo_trace_syscalls); /* DEBUG: print signal details? default: NO */ -- 2.47.2