From e6094b54009ac52cd0c9b5d019490da8b0442523 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Sat, 25 Jun 2005 15:22:10 +0000 Subject: [PATCH] Do not print backtraces in assertion failures. This is an as-yet unsuccessful attempt to remove m_libcassert from the huge cycle which most of the modules currently live in. VG_(get_StackTrace2) can now be privatised, but I haven't done so yet. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4018 --- coregrind/m_libcassert.c | 89 +++++++++++++++++---------------- coregrind/pub_core_stacktrace.h | 8 +-- 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c index 20d359ae9..09cef0604 100644 --- a/coregrind/m_libcassert.c +++ b/coregrind/m_libcassert.c @@ -33,8 +33,8 @@ #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_libcprint.h" -#include "pub_core_libcproc.h" // For VG_(gettid)() -#include "pub_core_stacktrace.h" +//zz hash inklood "pub_cor_libcproc.h" // For VG_(gettid)() +//zz hash inklood "pub_cor_stacktrace.h" #include "pub_core_syscall.h" #include "pub_core_tooliface.h" // For VG_(details).{name,bug_reports_to} #include "vki_unistd.h" @@ -43,29 +43,29 @@ Assertery. ------------------------------------------------------------------ */ -#if defined(VGP_x86_linux) -# define GET_REAL_SP_AND_FP(sp, fp) \ - asm("movl %%esp, %0;" \ - "movl %%ebp, %1;" \ - : "=r" (sp),\ - "=r" (fp)); -#elif defined(VGP_amd64_linux) -# define GET_REAL_SP_AND_FP(sp, fp) \ - asm("movq %%rsp, %0;" \ - "movq %%rbp, %1;" \ - : "=r" (sp),\ - "=r" (fp)); -#elif defined(VGP_ppc32_linux) -# define GET_REAL_SP_AND_FP(sp, fp) \ - asm("mr %0,1;" \ - "mr %1,1;" \ - : "=r" (sp),\ - "=r" (fp)); -#else -# error Unknown platform -#endif - -#define BACKTRACE_DEPTH 100 // nice and deep! +//zz #if defined(VGP_x86_linux) +//zz # define GET_REAL_SP_AND_FP(sp, fp) \ +//zz asm("movl %%esp, %0;" \ +//zz "movl %%ebp, %1;" \ +//zz : "=r" (sp),\ +//zz "=r" (fp)); +//zz #elif defined(VGP_amd64_linux) +//zz # define GET_REAL_SP_AND_FP(sp, fp) \ +//zz asm("movq %%rsp, %0;" \ +//zz "movq %%rbp, %1;" \ +//zz : "=r" (sp),\ +//zz "=r" (fp)); +//zz #elif defined(VGP_ppc32_linux) +//zz # define GET_REAL_SP_AND_FP(sp, fp) \ +//zz asm("mr %0,1;" \ +//zz "mr %1,1;" \ +//zz : "=r" (sp),\ +//zz "=r" (fp)); +//zz #else +//zz # error Unknown platform +//zz #endif +//zz +//zz #define BACKTRACE_DEPTH 100 // nice and deep! /* Pull down the entire world */ void VG_(exit)( Int status ) @@ -88,7 +88,7 @@ static void pp_sched_status ( void ) if (VG_(threads)[i].status == VgTs_Empty) continue; VG_(printf)( "\nThread %d: status = %s\n", i, VG_(name_of_ThreadStatus)(VG_(threads)[i].status) ); - VG_(get_and_pp_StackTrace)( i, BACKTRACE_DEPTH ); +//zz VG_(get_and_pp_StackTrace)( i, BACKTRACE_DEPTH ); } VG_(printf)("\n"); } @@ -96,24 +96,25 @@ static void pp_sched_status ( void ) __attribute__ ((noreturn)) static void report_and_quit ( const Char* report, Addr ip, Addr sp, Addr fp ) { - Addr stacktop, ips[BACKTRACE_DEPTH]; - ThreadState *tst; - - tst = VG_(get_ThreadState)( VG_(get_lwp_tid)(VG_(gettid)()) ); - - // If necessary, fake up an ExeContext which is of our actual real CPU - // state. Could cause problems if we got the panic/exception within the - // execontext/stack dump/symtab code. But it's better than nothing. - if (0 == ip && 0 == sp && 0 == fp) { - ip = (Addr)__builtin_return_address(0); - GET_REAL_SP_AND_FP(sp, fp); - } - - stacktop = tst->os_state.valgrind_stack_base + - tst->os_state.valgrind_stack_szB; - - VG_(get_StackTrace2)(ips, BACKTRACE_DEPTH, ip, sp, fp, sp, stacktop); - VG_(pp_StackTrace) (ips, BACKTRACE_DEPTH); +//zz Addr stacktop; +//zz Addr ips[BACKTRACE_DEPTH]; +//zz ThreadState *tst; +//zz +//zz tst = VG_(get_ThreadState)( VG_(get_lwp_tid)(VG_(gettid)()) ); +//zz +//zz // If necessary, fake up an ExeContext which is of our actual real CPU +//zz // state. Could cause problems if we got the panic/exception within the +//zz // execontext/stack dump/symtab code. But it's better than nothing. +//zz if (0 == ip && 0 == sp && 0 == fp) { +//zz ip = (Addr)__builtin_return_address(0); +//zz GET_REAL_SP_AND_FP(sp, fp); +//zz } +//zz +//zz stacktop = tst->os_state.valgrind_stack_base + +//zz tst->os_state.valgrind_stack_szB; +//zz +//zz VG_(get_StackTrace2)(ips, BACKTRACE_DEPTH, ip, sp, fp, sp, stacktop); +//zz VG_(pp_StackTrace) (ips, BACKTRACE_DEPTH); // Don't print this, as it's not terribly interesting and avoids a // dependence on m_scheduler/, which would be crazy. diff --git a/coregrind/pub_core_stacktrace.h b/coregrind/pub_core_stacktrace.h index 2f306a447..fb06821fc 100644 --- a/coregrind/pub_core_stacktrace.h +++ b/coregrind/pub_core_stacktrace.h @@ -38,10 +38,10 @@ #include "pub_tool_stacktrace.h" -// Variant that gives a little more control over the stack-walking. -extern UInt VG_(get_StackTrace2) ( StackTrace ips, UInt n_ips, - Addr ip, Addr sp, Addr fp, - Addr fp_min, Addr fp_max ); +//zz // Variant that gives a little more control over the stack-walking. +//zz extern UInt VG_(get_StackTrace2) ( StackTrace ips, UInt n_ips, +//zz Addr ip, Addr sp, Addr fp, +//zz Addr fp_min, Addr fp_max ); #endif // __PUB_CORE_STACKTRACE_H