summaryrefslogtreecommitdiff
path: root/memcheck/mc_main.c
diff options
context:
space:
mode:
authorsewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9>2007-11-30 21:41:40 +0000
committersewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9>2007-11-30 21:41:40 +0000
commiteb0fa9345010077e1e4852b238dde303b8f271b3 (patch)
tree717fa34254f18dfa244cdd0d89b1f826d4a7245e /memcheck/mc_main.c
parenta8162b21279cf61a262fe6cabd9e437811b1abae (diff)
New options for Memcheck, --malloc-fill=<hexnumber> and
--fill-free=<hexnumber>, which cause malloc'd(etc) and free'd(etc) blocks to be filled with the specified value. This can apparently be useful for shaking out hard-to-track-down memory corruption. The definedness/addressability of said areas is not affected -- only the contents. Documentation to follow. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7259 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'memcheck/mc_main.c')
-rw-r--r--memcheck/mc_main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c
index b24039c9..b7e70061 100644
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -4373,6 +4373,8 @@ VgRes MC_(clo_leak_resolution) = Vg_LowRes;
Bool MC_(clo_show_reachable) = False;
Bool MC_(clo_workaround_gcc296_bugs) = False;
Bool MC_(clo_undef_value_errors) = True;
+Int MC_(clo_malloc_fill) = -1;
+Int MC_(clo_free_fill) = -1;
static Bool mc_process_cmd_line_options(Char* arg)
{
@@ -4429,6 +4431,9 @@ static Bool mc_process_cmd_line_options(Char* arg)
}
}
+ else VG_BHEX_CLO(arg, "--malloc-fill", MC_(clo_malloc_fill), 0x00, 0xFF)
+ else VG_BHEX_CLO(arg, "--free-fill", MC_(clo_free_fill), 0x00, 0xFF)
+
else
return VG_(replacement_malloc_process_cmd_line_option)(arg);
@@ -4446,6 +4451,8 @@ static void mc_print_usage(void)
" --freelist-vol=<number> volume of freed blocks queue [10000000]\n"
" --workaround-gcc296-bugs=no|yes self explanatory [no]\n"
" --ignore-ranges=0xPP-0xQQ[,0xRR-0xSS] assume given addresses are OK\n"
+" --malloc-fill=<hexnumber> fill malloc'd areas with given value\n"
+" --free-fill=<hexnumber> fill free'd areas with given value\n"
);
VG_(replacement_malloc_print_usage)();
}