From: Nicholas Nethercote Date: Sun, 1 Feb 2004 17:29:59 +0000 (+0000) Subject: Killed the terminally wounded --stop-after option. X-Git-Tag: svn/VALGRIND_2_1_1~70 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ec5ade4c253fac9d608ad2bec6fe625435d05a5;p=thirdparty%2Fvalgrind.git Killed the terminally wounded --stop-after option. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2238 --- diff --git a/FAQ.txt b/FAQ.txt index 61df533f3b..818ae6fb0b 100644 --- a/FAQ.txt +++ b/FAQ.txt @@ -199,9 +199,8 @@ A12. One possible cause is that your program modifies its VG_ARGS variables. Zeroing them will break things. As of 1.9.6, Valgrind only uses these variables with - --trace-children=no, when executing execve() or using the - --stop-after=yes flag. This should reduce the potential for - problems. + --trace-children=no or when executing execve(). This should + reduce the potential for problems. ----------------------------------------------------------------- diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index 4a3ecf8363..f865eeed3b 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -63,7 +63,6 @@ stage2_SOURCES = \ vg_proxylwp.c \ vg_dummy_profile.c \ vg_signals.c \ - vg_startup.S \ vg_symtab2.c \ vg_dwarf.c \ vg_stabs.c \ diff --git a/coregrind/docs/coregrind_core.html b/coregrind/docs/coregrind_core.html index a0aaa33a79..24deff8390 100644 --- a/coregrind/docs/coregrind_core.html +++ b/coregrind/docs/coregrind_core.html @@ -924,13 +924,6 @@ shouldn't need to use them in the normal run of things. Nevertheless:

-

  • --stop-after=<number> - [default: infinity, more or less] -

    After <number> basic blocks have been executed, shut down - Valgrind and switch back to running the client on the real CPU. -


  • -

    -

  • --dump-error=<number> [default: inactive]

    After the program has exited, show gory details of the translation of the basic block containing the <number>'th diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h index ba5a36471e..c2d46b4d81 100644 --- a/coregrind/vg_include.h +++ b/coregrind/vg_include.h @@ -243,8 +243,6 @@ extern Bool VG_(clo_trace_sched); /* DEBUG: print pthread (mutex etc) events? default: 0 (none), 1 (some), 2 (all) */ extern Int VG_(clo_trace_pthread_level); -/* Stop after this many basic blocks. default: Infinity. */ -extern ULong VG_(clo_stop_after); /* Display gory details for the k'th most popular error. default: Infinity. */ extern Int VG_(clo_dump_error); @@ -822,7 +820,7 @@ typedef registers are not shadowed. Although the segment registers are 16 bits long, storage - management here, in VG_(baseBlock) and in VG_(m_state_static) is + management here and in VG_(baseBlock) is simplified if we pretend they are 32 bits. */ UInt m_cs; UInt m_ss; @@ -910,8 +908,6 @@ typedef even if we wait for a long time */ VgSrc_ExitSyscall, /* client called exit(). This is the normal route out. */ - VgSrc_BbsDone, /* In a debugging run, the specified number of - bbs has been completed. */ VgSrc_FatalSig /* Killed by the default action of a fatal signal */ } @@ -1336,7 +1332,7 @@ extern Addr VG_(code_redirect) (Addr orig); /* Is this a SSE/SSE2-capable CPU? If so, we had better save/restore the SSE state all over the place. This is set up very early, in - vg_startup.S. We have to determine it early since we can't even + main(). We have to determine it early since we can't even correctly snapshot the startup machine state without it. */ extern Bool VG_(have_ssestate); @@ -1372,25 +1368,6 @@ extern Int VG_(clexecfd); /* Path to all our library/aux files */ extern const Char *VG_(libdir); -/* A structure used as an intermediary when passing the simulated - CPU's state to VG_(switch_to_real_CPU)(), for --stop-after=yes. - Stuff is copied from baseBlock to here, because it's much easier - to copy the state into the real registers from this structure than - the baseBlock, because it's layout is simpler. - Alignment: the SSE state must be 16-byte aligned. We ask for the whole - struct to be 16-byte aligned, and the SSE state starts at the 6+8+1+1th - == 16th word, so it too must be 16-byte aligned. Consequence: change - this struct only _very carefully_ ! See also above comment re masking - MXCSR. -*/ -__attribute__ ((aligned (16))) -extern UInt VG_(m_state_static) [6 /* segment regs, Intel order */ - + 8 /* int regs, in Intel order */ - + 1 /* %eflags */ - + 1 /* %eip */ - + VG_SIZE_OF_SSESTATE_W /* SSE state */ - ]; - /* Determine if %esp adjustment must be noted */ extern Bool VG_(need_to_handle_esp_assignment) ( void ); @@ -1642,12 +1619,6 @@ extern Int VG_(do_syscall) ( UInt, ... ); extern Int VG_(clone) ( Int (*fn)(void *), void *stack, Int flags, void *arg, Int *child_tid, Int *parent_tid); -/* --------------------------------------------------------------------- - Exports of vg_startup.S - ------------------------------------------------------------------ */ - -extern void VG_(switch_to_real_CPU) ( void ); - /* --------------------------------------------------------------------- Exports of vg_dispatch.S ------------------------------------------------------------------ */ diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index ebbb33a0e8..08a6fe4575 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -163,8 +163,6 @@ UInt VG_(dispatch_ctr); /* 64-bit counter for the number of basic blocks done. */ ULong VG_(bbs_done); -/* 64-bit counter for the number of bbs to go before a debug exit. */ -ULong VG_(bbs_to_go); /* This is the ThreadId of the last thread the scheduler ran. */ ThreadId VG_(last_run_tid) = 0; @@ -1425,7 +1423,6 @@ Bool VG_(clo_trace_signals) = False; Bool VG_(clo_trace_symtab) = False; Bool VG_(clo_trace_sched) = False; Int VG_(clo_trace_pthread_level) = 0; -ULong VG_(clo_stop_after) = 1000000000000000LL; Int VG_(clo_dump_error) = 0; Int VG_(clo_backtrace_size) = 4; Char* VG_(clo_weird_hacks) = NULL; @@ -1528,8 +1525,6 @@ void usage ( Bool debug_help ) " --trace-symtab=no|yes show symbol table details? [no]\n" " --trace-sched=no|yes show thread scheduler details? [no]\n" " --trace-pthread=none|some|all show pthread event details? [none]\n" -" --stop-after= switch to real CPU after executing\n" -" basic blocks [infinity]\n" " --wait-for-gdb=yes|no pause on startup to wait for gdb attach\n" "\n" " debugging options for Valgrind tools that report errors\n" @@ -1860,9 +1855,6 @@ static void process_cmd_line_options else if (VG_CLO_STREQ(arg, "--lowlat-syscalls=no")) VG_(clo_lowlat_syscalls) = False; - else if (VG_CLO_STREQN(13, arg, "--stop-after=")) - VG_(clo_stop_after) = VG_(atoll)(&arg[13]); - else if (VG_CLO_STREQN(13, arg, "--dump-error=")) VG_(clo_dump_error) = (Int)VG_(atoll)(&arg[13]); @@ -2058,8 +2050,6 @@ static void process_cmd_line_options config_error("Can't use --gen-suppressions=yes with this skin,\n" " as it doesn't generate errors."); } - - VG_(bbs_to_go) = VG_(clo_stop_after); } @@ -2098,7 +2088,7 @@ static void setup_file_descriptors(void) /*====================================================================*/ -/*=== m_state_static + baseBlock: definition, setup, copying ===*/ +/*=== baseBlock: definition + setup ===*/ /*====================================================================*/ /* The variables storing offsets. */ @@ -2188,15 +2178,6 @@ Int VG_(noncompact_helper_offsets)[MAX_NONCOMPACT_HELPERS]; /* This is the actual defn of baseblock. */ UInt VG_(baseBlock)[VG_BASEBLOCK_WORDS]; -/* See comment about this in vg_include.h. Change only with great care. */ -__attribute__ ((aligned (16))) -UInt VG_(m_state_static) [6 /* segment regs, Intel order */ - + 8 /* int regs, in Intel order */ - + 1 /* %eflags */ - + 1 /* %eip */ - + VG_SIZE_OF_SSESTATE_W /* FPU state */ - ]; - /* Words. */ static Int baB_off = 0; @@ -2224,36 +2205,6 @@ Int VG_(extractDflag)(UInt eflags) return ret; } -static void copy_baseBlock_to_m_state_static( void ) -{ - Int i; - VG_(m_state_static)[ 0/4] = VG_(baseBlock)[VGOFF_(m_cs)]; - VG_(m_state_static)[ 4/4] = VG_(baseBlock)[VGOFF_(m_ss)]; - VG_(m_state_static)[ 8/4] = VG_(baseBlock)[VGOFF_(m_ds)]; - VG_(m_state_static)[12/4] = VG_(baseBlock)[VGOFF_(m_es)]; - VG_(m_state_static)[16/4] = VG_(baseBlock)[VGOFF_(m_fs)]; - VG_(m_state_static)[20/4] = VG_(baseBlock)[VGOFF_(m_gs)]; - - VG_(m_state_static)[24/4] = VG_(baseBlock)[VGOFF_(m_eax)]; - VG_(m_state_static)[28/4] = VG_(baseBlock)[VGOFF_(m_ecx)]; - VG_(m_state_static)[32/4] = VG_(baseBlock)[VGOFF_(m_edx)]; - VG_(m_state_static)[36/4] = VG_(baseBlock)[VGOFF_(m_ebx)]; - VG_(m_state_static)[40/4] = VG_(baseBlock)[VGOFF_(m_esp)]; - VG_(m_state_static)[44/4] = VG_(baseBlock)[VGOFF_(m_ebp)]; - VG_(m_state_static)[48/4] = VG_(baseBlock)[VGOFF_(m_esi)]; - VG_(m_state_static)[52/4] = VG_(baseBlock)[VGOFF_(m_edi)]; - - VG_(m_state_static)[56/4] - = VG_(insertDflag)(VG_(baseBlock)[VGOFF_(m_eflags)], - VG_(baseBlock)[VGOFF_(m_dflag)]); - VG_(m_state_static)[60/4] = VG_(baseBlock)[VGOFF_(m_eip)]; - - for (i = 0; i < VG_SIZE_OF_SSESTATE_W; i++) - VG_(m_state_static)[64/4 + i] - = VG_(baseBlock)[VGOFF_(m_ssestate) + i]; -} - - /* Returns the offset, in words. */ static Int alloc_BaB ( Int words ) { @@ -2872,7 +2823,7 @@ int main(int argc, char **argv) SK_(post_clo_init)(); //-------------------------------------------------------------- - // Set up baseBlock, copy machine state (m_state_static) + // Set up baseBlock // p: {pre,post}_clo_init() [for tool helper registration] // load_client() [for 'client_eip'] // setup_client_stack() [for 'esp_at_startup'] @@ -3104,25 +3055,6 @@ int main(int argc, char **argv) VG_(core_panic)("entered the afterlife in main() -- Deadlock"); break; - case VgSrc_BbsDone: - /* Tricky; we have to try and switch back to the real CPU. - This is all very dodgy and won't work at all in the - presence of threads, or if the client happened to be - running a signal handler. */ - /* Prepare to restore state to the real CPU. */ - VG_(sigshutdown_actions)(); - VG_(load_thread_state)(1 /* root thread */ ); - copy_baseBlock_to_m_state_static(); - - VG_(proxy_shutdown)(); - - /* This pushes a return address on the simulator's stack, - which is abandoned. We call vg_sigshutdown_actions() at - the end of vg_switch_to_real_CPU(), so as to ensure that - the original stack and machine state is restored before - the real signal mechanism is restored. */ - VG_(switch_to_real_CPU)(); - case VgSrc_FatalSig: /* We were killed by a fatal signal, so replicate the effect */ vg_assert(VG_(fatal_sigNo) != -1); diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index 8e9a677261..75ad420278 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -517,7 +517,6 @@ UInt run_thread_for_a_while ( ThreadId tid ) volatile UInt trc = 0; vg_assert(VG_(is_valid_tid)(tid)); vg_assert(VG_(threads)[tid].status == VgTs_Runnable); - vg_assert(VG_(bbs_to_go) > 0); vg_assert(!VG_(scheduler_jmpbuf_valid)); VGP_PUSHCC(VgpRun); @@ -901,10 +900,6 @@ VgSchedReturnCode VG_(scheduler) ( void ) or declare deadlock, or sleep if there are no runnable threads but some are blocked on I/O. */ - /* Was a debug-stop requested? */ - if (VG_(bbs_to_go) == 0) - goto debug_stop; - /* Do the following loop until a runnable thread is found, or deadlock is detected. */ while (True) { @@ -996,10 +991,7 @@ VgSchedReturnCode VG_(scheduler) ( void ) decrement is done before the bb is actually run, so you always get at least one decrement even if nothing happens. */ - if (VG_(bbs_to_go) >= VG_SCHEDULING_QUANTUM) - VG_(dispatch_ctr) = VG_SCHEDULING_QUANTUM + 1; - else - VG_(dispatch_ctr) = (UInt)VG_(bbs_to_go) + 1; + VG_(dispatch_ctr) = VG_SCHEDULING_QUANTUM + 1; /* ... and remember what we asked for. */ dispatch_ctr_SAVED = VG_(dispatch_ctr); @@ -1186,7 +1178,6 @@ VgSchedReturnCode VG_(scheduler) ( void ) done_this_time = (Int)dispatch_ctr_SAVED - (Int)VG_(dispatch_ctr) - 1; vg_assert(done_this_time >= 0); - VG_(bbs_to_go) -= (ULong)done_this_time; VG_(bbs_done) += (ULong)done_this_time; if (0 && trc != VG_TRC_INNER_FASTMISS) @@ -1207,18 +1198,12 @@ VgSchedReturnCode VG_(scheduler) ( void ) /* Explicit yield. Let a new thread be scheduled, simply by doing nothing, causing us to arrive back at Phase 1. */ - if (VG_(bbs_to_go) == 0) { - goto debug_stop; - } break; case VG_TRC_INNER_COUNTERZERO: /* Timeslice is out. Let a new thread be scheduled, simply by doing nothing, causing us to arrive back at Phase 1. */ - if (VG_(bbs_to_go) == 0) { - goto debug_stop; - } vg_assert(VG_(dispatch_ctr) == 0); break; @@ -1256,20 +1241,6 @@ VgSchedReturnCode VG_(scheduler) ( void ) /* NOTREACHED */ VG_(core_panic)("scheduler: post-main-loop ?!"); /* NOTREACHED */ - - debug_stop: - /* If we exited because of a debug stop, print the translation - of the last block executed -- by translating it again, and - throwing away the result. */ - VG_(printf)( - "======vvvvvvvv====== LAST TRANSLATION ======vvvvvvvv======\n"); - VG_(translate)( tid, - VG_(threads)[tid].m_eip, NULL, NULL, NULL, NULL ); - VG_(printf)("\n"); - VG_(printf)( - "======^^^^^^^^====== LAST TRANSLATION ======^^^^^^^^======\n"); - - return VgSrc_BbsDone; } void VG_(need_resched) ( ThreadId prefer ) diff --git a/coregrind/vg_startup.S b/coregrind/vg_startup.S deleted file mode 100644 index c2d60f6313..0000000000 --- a/coregrind/vg_startup.S +++ /dev/null @@ -1,85 +0,0 @@ - -##--------------------------------------------------------------------## -##--- Startup and shutdown code for Valgrind. ---## -##--- vg_startup.S ---## -##--------------------------------------------------------------------## - -/* - This file is part of Valgrind, an extensible x86 protected-mode - emulator for monitoring program execution on x86-Unixes. - - Copyright (C) 2000-2004 Julian Seward - jseward@acm.org - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307, USA. - - The GNU General Public License is contained in the file COPYING. -*/ - -#include "vg_constants.h" -#include "config.h" - -.section .text - - - -.global VG_(switch_to_real_CPU) -VG_(switch_to_real_CPU): - # Once Valgrind has decided it needs to exit, - # because the specified number of insns have been completed - # during a debugging run, it jumps here, which copies the - # simulators state into the real machine state. Execution - # of the rest of the program continues on the real CPU, - # and there is no way for the simulator to regain control - # after this point. - - pushfl - cmpb $0, VG_(have_ssestate) - jz qq4nosse - andl $0x0000FFBF, VG_(m_state_static)+64+24 - fxrstor VG_(m_state_static)+64 - jmp qq4merge -qq4nosse: - frstor VG_(m_state_static)+64 -qq4merge: - popfl - - movl VG_(m_state_static)+56, %eax - pushl %eax - popfl - /* some of these are apparently illegal */ - /* movw VG_(m_state_static)+0, %cs */ - movw VG_(m_state_static)+4, %ss - movw VG_(m_state_static)+8, %ds - movw VG_(m_state_static)+12, %es - movw VG_(m_state_static)+16, %fs - movw VG_(m_state_static)+20, %gs - movl VG_(m_state_static)+24, %eax - movl VG_(m_state_static)+28, %ecx - movl VG_(m_state_static)+32, %edx - movl VG_(m_state_static)+36, %ebx - movl VG_(m_state_static)+40, %esp - movl VG_(m_state_static)+44, %ebp - movl VG_(m_state_static)+48, %esi - movl VG_(m_state_static)+52, %edi - - jmp *VG_(m_state_static)+60 - - - -##--------------------------------------------------------------------## -##--- end vg_startup.S ---## -##--------------------------------------------------------------------## diff --git a/coregrind/vg_translate.c b/coregrind/vg_translate.c index b0f9d70fb6..58e70def34 100644 --- a/coregrind/vg_translate.c +++ b/coregrind/vg_translate.c @@ -1509,28 +1509,6 @@ static void vg_improve ( UCodeBlock* cb ) Int* last_live_before; FlagSet future_dead_flags; -# if 0 - /* DEBUGGING HOOK */ - { - static int n_done=0; - if (VG_(clo_stop_after) > 1000000000) { - if (n_done > (VG_(clo_stop_after) - 1000000000)) { - dis=False; - VG_(clo_trace_codegen) = 0; - return; - } - if (n_done == (VG_(clo_stop_after) - 1000000000)) { - VG_(printf)("\n"); - VG_(pp_UCodeBlock) ( cb, "Incoming:" ); - dis = True; - VG_(clo_trace_codegen) = 31; - } - n_done++; - } - } - /* end DEBUGGING HOOK */ -# endif /* 0 */ - if (dis) VG_(printf) ("Improvements:\n");