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
This commit is contained in:
Florian Krohm 2014-09-30 22:15:05 +00:00
parent b641262cb8
commit cd357d71b4
7 changed files with 7 additions and 12 deletions

View 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

View 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;

View 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);
}

View 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) {

View 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)()

View 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)

View 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) {