New debugging flag --trace-notbelow=<number>, to stop --trace-codegen=
spewing out tons of unwanted stuff before some desired point.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3169 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/core.h b/coregrind/core.h
index e14519c..4514269 100644
--- a/coregrind/core.h
+++ b/coregrind/core.h
@@ -292,8 +292,10 @@
/* 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 598b642..c98df51 100644
--- a/coregrind/vg_main.c
+++ b/coregrind/vg_main.c
@@ -1480,6 +1480,7 @@
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 @@
" --bbprofile=no|yes profile bbs? [no]\n"
" --branchpred=yes|no generate branch prediction hints [no]\n"
" --trace-codegen=<XXXXXXXX> show generated code? (X = 0|1) [00000000]\n"
+" --trace-notbelow=<number> only show BBs above <number> [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 @@
}
}
+ 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 84e7bb4..dfc9655 100644
--- a/coregrind/vg_translate.c
+++ b/coregrind/vg_translate.c
@@ -346,12 +346,11 @@
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 @@
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 @@
}
/* 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 @@
: 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. */