]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
New debugging flag --trace-notbelow=<number>, to stop --trace-codegen=
authorJulian Seward <jseward@acm.org>
Tue, 30 Nov 2004 18:55:21 +0000 (18:55 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 30 Nov 2004 18:55:21 +0000 (18:55 +0000)
spewing out tons of unwanted stuff before some desired point.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3169

coregrind/core.h
coregrind/vg_main.c
coregrind/vg_translate.c

index e14519cd7793f95896c1c68bc145d7f9e567c6f5..4514269e0973fbc3530774f837c91faef4b698ff 100644 (file)
@@ -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 */
index 598b642543d6136f360487d2081822101e5e69fc..c98df510ab363379a4a8b8335aae3d8c563dcceb 100644 (file)
@@ -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=<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 @@ 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"))
index 84e7bb427f61894bc1ca2b3d62aa5958337eabf5..dfc965521377c44514cdd5fe3e7d5b5ab6fc6bdd 100644 (file)
@@ -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. */