diff --git a/coregrind/core.h b/coregrind/core.h index e14519cd7..4514269e0 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -292,8 +292,10 @@ extern Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES]; /* PROFILE: collect bb profiling data? default: NO */ extern Bool VG_(clo_bbprofile); -/* DEBUG: print generated code? default: 00000 ( == NO ) */ +/* DEBUG: print generated code? default: 00000000 ( == NO ) */ extern Bool VG_(clo_trace_codegen); +/* DEBUG: if tracing codegen, be quiet until after this bb ( 0 ) */ +extern Int VG_(clo_trace_notbelow); /* DEBUG: print system calls? default: NO */ extern Bool VG_(clo_trace_syscalls); /* DEBUG: print signal details? default: NO */ diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 598b64254..c98df510a 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -1480,6 +1480,7 @@ Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES]; Bool VG_(clo_profile) = False; Bool VG_(clo_bbprofile) = False; UChar VG_(clo_trace_codegen) = 0; // 00000000b +Int VG_(clo_trace_notbelow) = 0; Bool VG_(clo_trace_syscalls) = False; Bool VG_(clo_trace_signals) = False; Bool VG_(clo_trace_symtab) = False; @@ -1555,6 +1556,7 @@ void usage ( Bool debug_help ) " --bbprofile=no|yes profile bbs? [no]\n" " --branchpred=yes|no generate branch prediction hints [no]\n" " --trace-codegen= show generated code? (X = 0|1) [00000000]\n" +" --trace-notbelow= only show BBs above [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" @@ -1841,6 +1843,8 @@ static void process_cmd_line_options( UInt* client_auxv, const char* toolname ) } } + else VG_NUM_CLO ("--trace-notbelow", VG_(clo_trace_notbelow)) + else if (VG_CLO_STREQ(arg, "--trace-pthread=none")) VG_(clo_trace_pthread_level) = 0; else if (VG_CLO_STREQ(arg, "--trace-pthread=some")) diff --git a/coregrind/vg_translate.c b/coregrind/vg_translate.c index 84e7bb427..dfc965521 100644 --- a/coregrind/vg_translate.c +++ b/coregrind/vg_translate.c @@ -346,12 +346,11 @@ static Bool need_to_handle_SP_assignment(void) Bool VG_(translate) ( ThreadId tid, Addr orig_addr, Bool debugging_translation ) { - Addr redir, orig_addr0 = orig_addr; - Int orig_size, tmpbuf_used; - Bool notrace_until_done; - UInt notrace_until_limit = 0; - //UInt FULLTRACE_LIMIT = 1; //21068; - Segment *seg; + Addr redir, orig_addr0 = orig_addr; + Int orig_size, tmpbuf_used, verbosity; + Bool notrace_until_done; + UInt notrace_until_limit = 0; + Segment* seg; /* Make sure Vex is initialised right. */ TranslateResult tres; @@ -377,6 +376,7 @@ Bool VG_(translate) ( ThreadId tid, Addr orig_addr, Char name2[64] = ""; VG_(get_fnname_w_offset)(orig_addr, name1, 64); VG_(get_fnname_w_offset)(redir, name2, 64); + name1[63] = name2[63] = 0; VG_(message)(Vg_UserMsg, "TRANSLATE: %p (%s) redirected to %p (%s)", orig_addr, name1, @@ -424,17 +424,11 @@ Bool VG_(translate) ( ThreadId tid, Addr orig_addr, } /* True if a debug trans., or if bit N set in VG_(clo_trace_codegen). */ -#if 0 -# define DECIDE_IF_PRINTING_CODEGEN_FOR_PHASE(n) \ - ( debugging_translation \ - || (notrace_until_done \ - && (VG_(clo_trace_codegen) & (1 << (n-1))) )) -#else -# define DECIDE_IF_PRINTING_CODEGEN \ - ( debugging_translation \ - || (VG_(clo_trace_codegen) > 0 \ - && VG_(get_bbs_translated)() >= FULLTRACE_LIMIT)) -#endif + verbosity = 0; + if ( debugging_translation + || (VG_(clo_trace_codegen) > 0 + && VG_(get_bbs_translated)() >= VG_(clo_trace_notbelow) )) + verbosity = VG_(clo_trace_codegen); /* Actually do the translation. */ tres = LibVEX_Translate ( @@ -449,14 +443,14 @@ Bool VG_(translate) ( ThreadId tid, Addr orig_addr, : NULL, True, /* cleanup after instrumentation */ NULL, - VG_(clo_trace_codegen) + verbosity ); vg_assert(tres == TransOK); vg_assert(tmpbuf_used <= N_TMPBUF); vg_assert(tmpbuf_used > 0); -#undef DECIDE_IF_PRINTING_CODEGEN_FOR_PHASE +#undef DECIDE_IF_PRINTING_CODEGEN /* Copy data at trans_addr into the translation cache. */ /* Since the .orig_size and .trans_size fields are UShort, be paranoid. */