]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge six easy pieces from the BUF_REMOVAL branch:
authorFlorian Krohm <florian@eich-krohm.de>
Tue, 30 Sep 2014 22:15:05 +0000 (22:15 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Tue, 30 Sep 2014 22:15:05 +0000 (22:15 +0000)
r14271  Audit a few buffer sizes, increase one.
r14280  Audit buffer size.
r14296  Remove a few unneeded header files.
r14310  Replace fixed size buffers with a large enough buffers.
r14338  Remove a dead assignment in print_bbcs and make global variable
        print_fd a local variable.
r14359  Remove a benign macro redefinition in cachegrind.

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

cachegrind/cg_main.c
cachegrind/cg_sim.c
callgrind/callstack.c
callgrind/dump.c
drd/drd_clientreq.c
drd/drd_main.c
exp-dhat/dh_main.c

index 9746b75806b3a3899d09d98ac51f27d585d2e109..5ba33388b5b8ab7f3d539d03441c404e71037696 100644 (file)
@@ -57,7 +57,6 @@
 /* Set to 1 for very verbose debugging */
 #define DEBUG_CG 0
 
-#define MIN_LINE_SIZE         16
 #define FILE_LEN              VKI_PATH_MAX
 #define FN_LEN                256
 
index 31494f6daa420a0d665088bde18445df839743e0..1b33fcf822fa62cac3cffc661b88da215151d6f5 100644 (file)
@@ -46,7 +46,7 @@ typedef struct {
    Int          sets_min_1;
    Int          line_size_bits;
    Int          tag_shift;
-   HChar        desc_line[128];
+   HChar        desc_line[128];         /* large enough */
    UWord*       tags;
 } cache_t2;
 
index 97ecb5a23be6a50cb6258afb1b58eccf476b6712..19846af437a4fe1ee7388f9e7a182f2e647b9dd9 100644 (file)
@@ -130,7 +130,7 @@ static void function_entered(fn_node* fn)
 #endif         
            
   if (fn->dump_before) {
-    HChar trigger[FN_NAME_LEN];
+    HChar trigger[VG_(strlen)(fn->name) + 20];
     VG_(sprintf)(trigger, "--dump-before=%s", fn->name);
     CLG_(dump_profile)(trigger, True);
   }
@@ -152,7 +152,7 @@ static void function_left(fn_node* fn)
   CLG_ASSERT(fn != 0);
 
   if (fn->dump_after) {
-    HChar trigger[FN_NAME_LEN];
+    HChar trigger[VG_(strlen)(fn->name) + 20];
     VG_(sprintf)(trigger, "--dump-after=%s", fn->name);
     CLG_(dump_profile)(trigger, True);
   }
index 5297d01ebe7fb885aefea5583234ec805da76f9d..f7edc413e06e50768227be4593d8d0dc15f44c7f 100644 (file)
@@ -1479,7 +1479,6 @@ static void close_dumpfile(int fd)
 
 /* Helper for print_bbccs */
 
-static Int   print_fd;
 static const HChar* print_trigger;
 static HChar print_buf[BUF_LEN];
 
@@ -1491,7 +1490,7 @@ static void print_bbccs_of_thread(thread_info* ti)
 
   CLG_DEBUG(1, "+ print_bbccs(tid %d)\n", CLG_(current_tid));
 
-  print_fd = new_dumpfile(print_buf, CLG_(current_tid), print_trigger);
+  Int print_fd = new_dumpfile(print_buf, CLG_(current_tid), print_trigger);
   if (print_fd <0) {
     CLG_DEBUG(1, "- print_bbccs(tid %d): No output...\n", CLG_(current_tid));
     return;
@@ -1572,7 +1571,6 @@ static void print_bbccs(const HChar* trigger, Bool only_current_thread)
   init_dump_array();
   init_debug_cache();
 
-  print_fd = -1;
   print_trigger = trigger;
 
   if (!CLG_(clo).separate_threads) {
index a3d485f5f13a5f982968c52ebef32256334354a9..413ed3b757cf518d82353634a97144744f62be5a 100644 (file)
@@ -35,7 +35,6 @@
 #include "drd_suppression.h"      // drd_start_suppression()
 #include "drd_thread.h"
 #include "pub_tool_basics.h"      // Bool
-#include "pub_tool_debuginfo.h"   // VG_(describe_IP)()
 #include "pub_tool_libcassert.h"
 #include "pub_tool_libcassert.h"  // tl_assert()
 #include "pub_tool_libcprint.h"   // VG_(message)()
index 10630127a12ca6b18bd213b9de3310dc841d792d..a24588be446be25b32371373c6105276b92b1f49 100644 (file)
@@ -40,7 +40,6 @@
 #include "pub_drd_bitmap.h"
 #include "pub_tool_vki.h"         // Must be included before pub_tool_libcproc
 #include "pub_tool_basics.h"
-#include "pub_tool_debuginfo.h"   // VG_(describe_IP)()
 #include "pub_tool_libcassert.h"  // tl_assert()
 #include "pub_tool_libcbase.h"    // VG_(strcmp)
 #include "pub_tool_libcprint.h"   // VG_(printf)
index 78465ee0cda6b8166291b66d05f7a775e558a59c..2730385581ee24b210bf32905f25fc06815fd750 100644 (file)
@@ -1094,7 +1094,7 @@ static void show_N_div_100( /*OUT*/HChar* buf, ULong n )
 
 static void show_APInfo ( APInfo* api )
 {
-   HChar bufA[80];
+   HChar bufA[80];   // large enough
    VG_(memset)(bufA, 0, sizeof(bufA));
    if (api->tot_blocks > 0) {
       show_N_div_100( bufA, ((ULong)api->tot_bytes * 100ULL)
@@ -1121,7 +1121,7 @@ static void show_APInfo ( APInfo* api )
       ULong aad_frac_10k
          = g_guest_instrs_executed == 0
            ? 0 : (10000ULL * aad) / g_guest_instrs_executed;
-      HChar buf[16];
+      HChar buf[80];  // large enough
       show_N_div_100(buf, aad_frac_10k);
       VG_(umsg)("deaths:      %'llu, at avg age %'llu "
                 "(%s%% of prog lifetime)\n",
@@ -1130,7 +1130,7 @@ static void show_APInfo ( APInfo* api )
       VG_(umsg)("deaths:      none (none of these blocks were freed)\n");
    }
 
-   HChar bufR[80], bufW[80];
+   HChar bufR[80], bufW[80];   // large enough
    VG_(memset)(bufR, 0, sizeof(bufR));
    VG_(memset)(bufW, 0, sizeof(bufW));
    if (api->tot_bytes > 0) {