Merge six easy pieces from the BUF_REMOVAL branch:
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 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c
index 9746b75..5ba3338 100644
--- a/cachegrind/cg_main.c
+++ b/cachegrind/cg_main.c
@@ -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
diff --git a/cachegrind/cg_sim.c b/cachegrind/cg_sim.c
index 31494f6..1b33fcf 100644
--- a/cachegrind/cg_sim.c
+++ b/cachegrind/cg_sim.c
@@ -46,7 +46,7 @@
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;
diff --git a/callgrind/callstack.c b/callgrind/callstack.c
index 97ecb5a..19846af 100644
--- a/callgrind/callstack.c
+++ b/callgrind/callstack.c
@@ -130,7 +130,7 @@
#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 @@
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);
}
diff --git a/callgrind/dump.c b/callgrind/dump.c
index 5297d01..f7edc41 100644
--- a/callgrind/dump.c
+++ b/callgrind/dump.c
@@ -1479,7 +1479,6 @@
/* Helper for print_bbccs */
-static Int print_fd;
static const HChar* print_trigger;
static HChar print_buf[BUF_LEN];
@@ -1491,7 +1490,7 @@
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 @@
init_dump_array();
init_debug_cache();
- print_fd = -1;
print_trigger = trigger;
if (!CLG_(clo).separate_threads) {
diff --git a/drd/drd_clientreq.c b/drd/drd_clientreq.c
index a3d485f..413ed3b 100644
--- a/drd/drd_clientreq.c
+++ b/drd/drd_clientreq.c
@@ -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)()
diff --git a/drd/drd_main.c b/drd/drd_main.c
index 1063012..a24588b 100644
--- a/drd/drd_main.c
+++ b/drd/drd_main.c
@@ -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)
diff --git a/exp-dhat/dh_main.c b/exp-dhat/dh_main.c
index 78465ee..2730385 100644
--- a/exp-dhat/dh_main.c
+++ b/exp-dhat/dh_main.c
@@ -1094,7 +1094,7 @@
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 @@
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 @@
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) {