From 26abfe1e2ebd440c63337ba12d6504624b50add9 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 17 Feb 2024 08:23:57 +0100 Subject: [PATCH] debug options: add more description for sanity-level And make usage more consistent. There was a mix of > and >=, now it is all >=. --- coregrind/m_aspacemgr/aspacemgr-linux.c | 1 - coregrind/m_main.c | 4 ++++ coregrind/m_scheduler/scheduler.c | 6 +++--- coregrind/m_signals.c | 2 +- none/tests/cmdline2.stdout.exp | 4 ++++ none/tests/cmdline2.stdout.exp-non-linux | 4 ++++ 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index d9d1512b5..22eefd30d 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -332,7 +332,6 @@ static Addr aspacem_cStart = 0; // Where aspacem will start looking for Valgrind space static Addr aspacem_vStart = 0; - #define AM_SANITY_CHECK \ do { \ if (VG_(clo_sanity_level) >= 3) \ diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 3015a533c..042b2787c 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -255,6 +255,10 @@ static void usage_NORETURN ( int need_help ) " -d show verbose debugging output\n" " --stats=no|yes show tool and core statistics [no]\n" " --sanity-level= level of sanity checking to do [1]\n" +" 1 - does occasional stack checking\n" +" 2 - more stack checks and malloc checks\n" +" 3 - as 2 and mmap checks\n" +" 4 - as 3 and translation sector checks\n" " --trace-flags= show generated code? (X = 0|1) [00000000]\n" " --profile-flags= ditto, but for profiling (X = 0|1) [00000000]\n" " --profile-interval= show profile every event checks\n" diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index f8b3b46c1..6456eb1ac 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -1550,7 +1550,7 @@ VgSchedReturnCode VG_(scheduler) ( ThreadId tid ) /* amd64-linux, ppc32-linux, amd64-darwin, amd64-solaris */ case VEX_TRC_JMP_SYS_SYSCALL: handle_syscall(tid, trc[0]); - if (VG_(clo_sanity_level) > 2) + if (VG_(clo_sanity_level) >= 3) VG_(sanity_check_general)(True); /* sanity-check every syscall */ break; @@ -2370,7 +2370,7 @@ void VG_(sanity_check_general) ( Bool force_expensive ) Gradually increase the interval between such checks so as not to burden long-running programs too much. */ if ( force_expensive - || VG_(clo_sanity_level) > 1 + || VG_(clo_sanity_level) >= 2 || (VG_(clo_sanity_level) == 1 && sanity_fast_count == next_slow_check_at)) { @@ -2410,7 +2410,7 @@ void VG_(sanity_check_general) ( Bool force_expensive ) } } - if (VG_(clo_sanity_level) > 1) { + if (VG_(clo_sanity_level) >= 2) { /* Check sanity of the low-level memory manager. Note that bugs in the client's code can cause this to fail, so we don't do this check unless specially asked for. And because it's diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index b3c94fcc9..5977e3857 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -2698,7 +2698,7 @@ Bool VG_(extend_stack)(ThreadId tid, Addr addr) code know about it. */ VG_(change_stack)(VG_(clstk_id), new_stack_base, VG_(clstk_end)); - if (VG_(clo_sanity_level) > 2) + if (VG_(clo_sanity_level) >= 3) VG_(sanity_check_general)(False); return True; diff --git a/none/tests/cmdline2.stdout.exp b/none/tests/cmdline2.stdout.exp index 28323ab06..e46504338 100644 --- a/none/tests/cmdline2.stdout.exp +++ b/none/tests/cmdline2.stdout.exp @@ -166,6 +166,10 @@ usage: valgrind [options] prog-and-args -d show verbose debugging output --stats=no|yes show tool and core statistics [no] --sanity-level= level of sanity checking to do [1] + 1 - does occasional stack checking + 2 - more stack checks and malloc checks + 3 - as 2 and mmap checks + 4 - as 3 and translation sector checks --trace-flags= show generated code? (X = 0|1) [00000000] --profile-flags= ditto, but for profiling (X = 0|1) [00000000] --profile-interval= show profile every event checks diff --git a/none/tests/cmdline2.stdout.exp-non-linux b/none/tests/cmdline2.stdout.exp-non-linux index 0b6ad0cfa..c4c8bde5a 100644 --- a/none/tests/cmdline2.stdout.exp-non-linux +++ b/none/tests/cmdline2.stdout.exp-non-linux @@ -164,6 +164,10 @@ usage: valgrind [options] prog-and-args -d show verbose debugging output --stats=no|yes show tool and core statistics [no] --sanity-level= level of sanity checking to do [1] + 1 - does occasional stack checking + 2 - more stack checks and malloc checks + 3 - as 2 and mmap checks + 4 - as 3 and translation sector checks --trace-flags= show generated code? (X = 0|1) [00000000] --profile-flags= ditto, but for profiling (X = 0|1) [00000000] --profile-interval= show profile every event checks -- 2.11.4.GIT