From: Julian Seward Date: Tue, 28 Aug 2007 17:03:01 +0000 (+0000) Subject: Make the --max-stackframe machinery 64-bit clean. X-Git-Tag: svn/VALGRIND_3_3_0~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f00b6d36d25956fb2066c8cee0cebc9ee8efd90;p=thirdparty%2Fvalgrind.git Make the --max-stackframe machinery 64-bit clean. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6788 --- diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 319753d803..6e69e88cf8 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -364,7 +364,7 @@ static Bool process_cmd_line_options( UInt* client_auxv, const char* toolname ) else VG_BOOL_CLO(arg, "--error-limit", VG_(clo_error_limit)) else VG_NUM_CLO (arg, "--error-exitcode", VG_(clo_error_exitcode)) else VG_BOOL_CLO(arg, "--show-emwarns", VG_(clo_show_emwarns)) - else VG_NUM_CLO (arg, "--max-stackframe", VG_(clo_max_stackframe)) + else VG_NUMW_CLO(arg, "--max-stackframe", VG_(clo_max_stackframe)) else VG_BOOL_CLO(arg, "--run-libc-freeres", VG_(clo_run_libc_freeres)) else VG_BOOL_CLO(arg, "--show-below-main", VG_(clo_show_below_main)) else VG_BOOL_CLO(arg, "--time-stamp", VG_(clo_time_stamp)) diff --git a/coregrind/m_options.c b/coregrind/m_options.c index 030f78c70d..f5ed2846b2 100644 --- a/coregrind/m_options.c +++ b/coregrind/m_options.c @@ -79,7 +79,7 @@ Bool VG_(clo_run_libc_freeres) = True; Bool VG_(clo_track_fds) = False; Bool VG_(clo_show_below_main)= False; Bool VG_(clo_show_emwarns) = False; -Int VG_(clo_max_stackframe) = 2000000; +Word VG_(clo_max_stackframe) = 2000000; Bool VG_(clo_wait_for_gdb) = False; VgSmc VG_(clo_smc_check) = Vg_SmcStack; HChar* VG_(clo_kernel_variant) = NULL; diff --git a/coregrind/m_stacks.c b/coregrind/m_stacks.c index cf78e4d466..8400a6c8d6 100644 --- a/coregrind/m_stacks.c +++ b/coregrind/m_stacks.c @@ -233,7 +233,7 @@ void VG_(unknown_SP_update)( Addr old_SP, Addr new_SP ) "Warning: client switching stacks? " "SP change: %p --> %p", old_SP, new_SP); VG_(message)(Vg_UserMsg, - " to suppress, use: --max-stackframe=%d or greater", + " to suppress, use: --max-stackframe=%ld or greater", (delta < 0 ? -delta : delta)); if (moans == 0) VG_(message)(Vg_UserMsg, diff --git a/coregrind/pub_core_options.h b/coregrind/pub_core_options.h index 0d0cb5a863..09b97fcd1f 100644 --- a/coregrind/pub_core_options.h +++ b/coregrind/pub_core_options.h @@ -154,8 +154,9 @@ extern Bool VG_(clo_show_below_main); extern Bool VG_(clo_show_emwarns); /* How much does the stack pointer have to change before tools - consider a stack switch to have happened? Default: 2000000 bytes */ -extern Int VG_(clo_max_stackframe); + consider a stack switch to have happened? Default: 2000000 bytes + NB: must be host-word-sized to be correct (hence Word). */ +extern Word VG_(clo_max_stackframe); /* Delay startup to allow GDB to be attached? Default: NO */ extern Bool VG_(clo_wait_for_gdb); diff --git a/include/pub_tool_options.h b/include/pub_tool_options.h index 00c7bcba89..3c50ce69df 100644 --- a/include/pub_tool_options.h +++ b/include/pub_tool_options.h @@ -55,6 +55,13 @@ (qq_var) = (Int)VG_(atoll)( &qq_arg[ VG_(strlen)(qq_option)+1 ] ); \ } +/* Same as VG_NUM_CLO but does not coerce the result value to 32 bits + on 64-bit platforms. */ +#define VG_NUMW_CLO(qq_arg, qq_option, qq_var) \ + if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \ + (qq_var) = (Word)VG_(atoll)( &qq_arg[ VG_(strlen)(qq_option)+1 ] ); \ + } + /* Bounded integer arg */ #define VG_BNUM_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \ if (VG_CLO_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) { \