aboutsummaryrefslogtreecommitdiff
path: root/gdb/infrun.c
diff options
context:
space:
mode:
authornobody <>2008-12-26 19:11:54 +0000
committernobody <>2008-12-26 19:11:54 +0000
commit6f581415c153fc050f7c12ba17016825506a719e (patch)
tree2f131de6a34477a2f519336bb343459d9c25ec2b /gdb/infrun.c
parentb4812cfe4dc394392e47e0489f38521da4a0b7ce (diff)
downloadgdb-6f581415c153fc050f7c12ba17016825506a719e.zip
gdb-6f581415c153fc050f7c12ba17016825506a719e.tar.gz
gdb-6f581415c153fc050f7c12ba17016825506a719e.tar.bz2
This commit was manufactured by cvs2svn to create branchreverse-20081226-branchpoint
'reverse-20081226-branch'. Sprout from multiprocess-20081120-branch 2008-11-20 00:35:24 UTC nobody 'This commit was manufactured by cvs2svn to create branch' Cherrypick from master 2008-12-26 19:11:53 UTC Sandra Loosemore <sandra@codesourcery.com> '2008-12-26 Sandra Loosemore <sandra@codesourcery.com>': COPYING.LIBGLOSS COPYING.NEWLIB ChangeLog Makefile.def Makefile.in Makefile.tpl bfd/ChangeLog bfd/Makefile.am bfd/Makefile.in bfd/aoutx.h bfd/archures.c bfd/bfd-in.h bfd/bfd-in2.h bfd/bfd.c bfd/bfdwin.c bfd/coffcode.h bfd/config.bfd bfd/configure bfd/configure.in bfd/cpu-avr.c bfd/cpu-lm32.c bfd/cpu-mips.c bfd/elf-bfd.h bfd/elf-m10300.c bfd/elf.c bfd/elf32-arm.c bfd/elf32-bfin.c bfd/elf32-cr16.c bfd/elf32-cris.c bfd/elf32-hppa.c bfd/elf32-i370.c bfd/elf32-i386.c bfd/elf32-lm32.c bfd/elf32-m32r.c bfd/elf32-m68k.c bfd/elf32-ppc.c bfd/elf32-s390.c bfd/elf32-sh.c bfd/elf32-spu.c bfd/elf32-spu.h bfd/elf32-v850.c bfd/elf32-vax.c bfd/elf64-alpha.c bfd/elf64-ppc.c bfd/elf64-s390.c bfd/elf64-sh64.c bfd/elf64-x86-64.c bfd/elfcode.h bfd/elflink.c bfd/elfxx-ia64.c bfd/elfxx-mips.c bfd/elfxx-sparc.c bfd/elfxx-target.h bfd/hpux-core.c bfd/libbfd.h bfd/mach-o.c bfd/mach-o.h bfd/pef.c bfd/reloc.c bfd/syms.c bfd/targets.c bfd/version.h bfd/xtensa-isa.c config-ml.in config.guess config.sub config/ChangeLog config/mh-mingw config/unwind_ipinfo.m4 configure configure.ac cpu/ChangeLog cpu/lm32.cpu cpu/lm32.opc gdb/ChangeLog gdb/MAINTAINERS gdb/Makefile.in gdb/NEWS gdb/acinclude.m4 gdb/ada-lang.c gdb/ada-lang.h gdb/alpha-mdebug-tdep.c gdb/breakpoint.c gdb/breakpoint.h gdb/c-exp.y gdb/c-lang.c gdb/c-lang.h gdb/cli/cli-decode.c gdb/cli/cli-decode.h gdb/command.h gdb/completer.c gdb/config.in gdb/config/i386/darwin.mh gdb/configure gdb/configure.ac gdb/configure.host gdb/configure.tgt gdb/darwin-nat-info.c gdb/darwin-nat.c gdb/darwin-nat.h gdb/darwin.defs gdb/dbxread.c gdb/defs.h gdb/doc/ChangeLog gdb/doc/gdb.texinfo gdb/doc/gdbint.texinfo gdb/dwarf2expr.c gdb/environ.c gdb/f-valprint.c gdb/features/osdata.dtd gdb/findvar.c gdb/frame.c gdb/gdbserver/ChangeLog gdb/gdbserver/Makefile.in gdb/gdbserver/hostio.c gdb/gdbserver/inferiors.c gdb/gdbserver/linux-low.c gdb/gdbserver/linux-low.h gdb/gdbserver/mem-break.c gdb/gdbserver/regcache.c gdb/gdbserver/remote-utils.c gdb/gdbserver/server.c gdb/gdbserver/server.h gdb/gdbserver/target.c gdb/gdbserver/target.h gdb/gdbserver/thread-db.c gdb/gdbserver/utils.c gdb/gdbserver/win32-low.c gdb/gnu-v3-abi.c gdb/i386-darwin-nat.c gdb/i386-darwin-tdep.c gdb/i386-darwin-tdep.h gdb/ia64-tdep.c gdb/inf-ptrace.c gdb/inf-ttrace.c gdb/infcall.c gdb/infcmd.c gdb/inferior.h gdb/inflow.c gdb/infrun.c gdb/linux-fork.c gdb/linux-nat.c gdb/linux-thread-db.c gdb/m32c-tdep.c gdb/machoread.c gdb/macrocmd.c gdb/macroexp.c gdb/mi/mi-main.c gdb/osabi.c gdb/osdata.c gdb/osdata.h gdb/parse.c gdb/printcmd.c gdb/python/python-internal.h gdb/python/python-utils.c gdb/python/python-value.c gdb/python/python.c gdb/remote.c gdb/rs6000-nat.c gdb/spu-linux-nat.c gdb/stack.c gdb/target.c gdb/target.h gdb/testsuite/ChangeLog gdb/testsuite/gdb.ada/formatted_ref.exp gdb/testsuite/gdb.ada/int_deref.exp gdb/testsuite/gdb.arch/ppc-fp.exp gdb/testsuite/gdb.arch/vsx-regs.exp gdb/testsuite/gdb.base/breakpoint-shadow.c gdb/testsuite/gdb.base/breakpoint-shadow.exp gdb/testsuite/gdb.base/commands.exp gdb/testsuite/gdb.base/completion.exp gdb/testsuite/gdb.base/consecutive.exp gdb/testsuite/gdb.base/expand-psymtabs.c gdb/testsuite/gdb.base/foll-fork.exp gdb/testsuite/gdb.base/foll-vfork.exp gdb/testsuite/gdb.base/macscp.exp gdb/testsuite/gdb.base/macscp1.c gdb/testsuite/gdb.base/sepsymtab.exp gdb/testsuite/gdb.base/start.exp gdb/testsuite/gdb.base/watchpoint-hw.c gdb/testsuite/gdb.base/watchpoint-hw.exp gdb/testsuite/gdb.cp/formatted-ref.exp gdb/testsuite/gdb.cp/punctuator.exp gdb/testsuite/gdb.server/ext-run.exp gdb/testsuite/gdb.threads/tls.c gdb/testsuite/gdb.threads/tls.exp gdb/testsuite/gdb.threads/tls2.c gdb/valops.c gdb/valprint.c gdb/value.c gdb/value.h gdb/version.in gdb/xml-support.c gdb/xml-support.h include/ChangeLog include/bfdlink.h include/coff/ChangeLog include/coff/ti.h include/demangle.h include/dis-asm.h include/elf/ChangeLog include/elf/common.h include/elf/cr16.h include/elf/cris.h include/elf/lm32.h include/opcode/ChangeLog include/opcode/mips.h include/plugin-api.h include/xtensa-isa-internal.h include/xtensa-isa.h libiberty/ChangeLog libiberty/config.h-vms libiberty/cp-demangle.c libiberty/makefile.vms libtool.m4 opcodes/ChangeLog opcodes/Makefile.am opcodes/Makefile.in opcodes/arm-dis.c opcodes/cgen-asm.in opcodes/cgen-dis.in opcodes/cgen-ibld.in opcodes/configure opcodes/configure.in opcodes/cr16-dis.c opcodes/disassemble.c opcodes/i386-dis.c opcodes/i386-gen.c opcodes/i386-opc.h opcodes/i386-opc.tbl opcodes/i386-tbl.h opcodes/lm32-asm.c opcodes/lm32-desc.c opcodes/lm32-desc.h opcodes/lm32-dis.c opcodes/lm32-ibld.c opcodes/lm32-opc.c opcodes/lm32-opc.h opcodes/lm32-opinst.c opcodes/m68k-dis.c opcodes/mips-dis.c opcodes/po/ga.po opcodes/ppc-dis.c opcodes/ppc-opc.c sim/arm/ChangeLog sim/arm/arminit.c sim/arm/iwmmxt.c sim/frv/ChangeLog sim/frv/arch.c sim/frv/arch.h sim/frv/cpu.c sim/frv/cpu.h sim/frv/cpuall.h sim/frv/decode.c sim/frv/decode.h sim/frv/model.c sim/frv/sem.c sim/h8300/ChangeLog sim/h8300/compile.c sim/ppc/ChangeLog sim/ppc/ppc-instructions sim/ppc/ppc-spr-table Cherrypick from reverse-20080717-branch 2008-09-19 21:17:10 UTC Michael Snyder <msnyder@vmware.com> 'don't need globals hex and decimal': gdb/testsuite/gdb.twreverse/Makefile.in gdb/testsuite/gdb.twreverse/break-reverse.c gdb/testsuite/gdb.twreverse/break-reverse.exp gdb/testsuite/gdb.twreverse/consecutive-reverse.c gdb/testsuite/gdb.twreverse/consecutive-reverse.exp gdb/testsuite/gdb.twreverse/finish-reverse.c gdb/testsuite/gdb.twreverse/finish-reverse.exp gdb/testsuite/gdb.twreverse/machinestate.c gdb/testsuite/gdb.twreverse/machinestate.exp gdb/testsuite/gdb.twreverse/machinestate1.c gdb/testsuite/gdb.twreverse/step-reverse.c gdb/testsuite/gdb.twreverse/step-reverse.exp gdb/testsuite/gdb.twreverse/until-reverse.c gdb/testsuite/gdb.twreverse/until-reverse.exp gdb/testsuite/gdb.twreverse/until-reverse1.c gdb/testsuite/gdb.twreverse/watch-reverse.c gdb/testsuite/gdb.twreverse/watch-reverse.exp
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r--gdb/infrun.c66
1 files changed, 42 insertions, 24 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index f218fa0..eb2528c 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -965,10 +965,13 @@ resume (int step, enum target_signal sig)
{
int should_resume = 1;
struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
+
+ /* Note that these must be reset if we follow a fork below. */
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct thread_info *tp = inferior_thread ();
CORE_ADDR pc = regcache_read_pc (regcache);
+
QUIT;
if (debug_infrun)
@@ -1053,6 +1056,13 @@ a command like `return' or `jump' to continue execution."));
pending_follow.kind = TARGET_WAITKIND_SPURIOUS;
if (follow_fork ())
should_resume = 0;
+
+ /* Following a child fork will change our notion of current
+ thread. */
+ tp = inferior_thread ();
+ regcache = get_current_regcache ();
+ gdbarch = get_regcache_arch (regcache);
+ pc = regcache_read_pc (regcache);
break;
case TARGET_WAITKIND_EXECD:
@@ -1148,11 +1158,11 @@ a command like `return' or `jump' to continue execution."));
displaced_step_dump_bytes (gdb_stdlog, buf, sizeof (buf));
}
- target_resume (resume_ptid, step, sig);
-
/* Avoid confusing the next resume, if the next stop/resume
happens to apply to another thread. */
tp->stop_signal = TARGET_SIGNAL_0;
+
+ target_resume (resume_ptid, step, sig);
}
discard_cleanups (old_cleanups);
@@ -1293,7 +1303,6 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
struct thread_info *tp;
CORE_ADDR pc = regcache_read_pc (regcache);
int oneproc = 0;
- enum target_signal stop_signal;
if (step > 0)
step_start_function = find_pc_function (pc);
@@ -2132,13 +2141,17 @@ handle_inferior_event (struct execution_control_state *ecs)
{
breakpoint_retire_moribund ();
- /* Mark the non-executing threads accordingly. */
- if (!non_stop
- || ecs->ws.kind == TARGET_WAITKIND_EXITED
- || ecs->ws.kind == TARGET_WAITKIND_SIGNALLED)
- set_executing (pid_to_ptid (-1), 0);
- else
- set_executing (ecs->ptid, 0);
+ /* Mark the non-executing threads accordingly. In all-stop, all
+ threads of all processes are stopped when we get any event
+ reported. In non-stop mode, only the event thread stops. If
+ we're handling a process exit in non-stop mode, there's
+ nothing to do, as threads of the dead process are gone, and
+ threads of any other process were left running. */
+ if (!non_stop)
+ set_executing (minus_one_ptid, 0);
+ else if (ecs->ws.kind != TARGET_WAITKIND_SIGNALLED
+ && ecs->ws.kind != TARGET_WAITKIND_EXITED)
+ set_executing (inferior_ptid, 0);
}
switch (infwait_state)
@@ -2262,6 +2275,7 @@ handle_inferior_event (struct execution_control_state *ecs)
case TARGET_WAITKIND_EXITED:
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_EXITED\n");
+ inferior_ptid = ecs->ptid;
target_terminal_ours (); /* Must do this before mourn anyway */
print_stop_reason (EXITED, ecs->ws.value.integer);
@@ -2280,6 +2294,7 @@ handle_inferior_event (struct execution_control_state *ecs)
case TARGET_WAITKIND_SIGNALLED:
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: TARGET_WAITKIND_SIGNALLED\n");
+ inferior_ptid = ecs->ptid;
stop_print_frame = 0;
target_terminal_ours (); /* Must do this before mourn anyway */
@@ -2501,8 +2516,6 @@ targets should add new threads to the thread list themselves in non-stop mode.")
}
}
- stepping_past_singlestep_breakpoint = 0;
-
if (!ptid_equal (deferred_step_ptid, null_ptid))
{
/* In non-stop mode, there's never a deferred_step_ptid set. */
@@ -2512,8 +2525,6 @@ targets should add new threads to the thread list themselves in non-stop mode.")
the fact that we were supposed to switch back. */
if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP)
{
- struct thread_info *tp;
-
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: handling deferred step\n");
@@ -3151,7 +3162,6 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
break;
case BPSTAT_WHAT_CHECK_SHLIBS:
- case BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK:
{
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_CHECK_SHLIBS\n");
@@ -4366,17 +4376,25 @@ done:
else
observer_notify_normal_stop (NULL);
}
- if (target_has_execution
- && last.kind != TARGET_WAITKIND_SIGNALLED
- && last.kind != TARGET_WAITKIND_EXITED)
- {
- /* Delete the breakpoint we stopped at, if it wants to be deleted.
- Delete any breakpoint that is to be deleted at the next stop. */
- breakpoint_auto_delete (inferior_thread ()->stop_bpstat);
+ if (target_has_execution)
+ {
+ if (last.kind != TARGET_WAITKIND_SIGNALLED
+ && last.kind != TARGET_WAITKIND_EXITED)
+ /* Delete the breakpoint we stopped at, if it wants to be deleted.
+ Delete any breakpoint that is to be deleted at the next stop. */
+ breakpoint_auto_delete (inferior_thread ()->stop_bpstat);
+
+ /* Mark the stopped threads accordingly. In all-stop, all
+ threads of all processes are stopped when we get any event
+ reported. In non-stop mode, only the event thread stops. If
+ we're handling a process exit in non-stop mode, there's
+ nothing to do, as threads of the dead process are gone, and
+ threads of any other process were left running. */
if (!non_stop)
- set_running (pid_to_ptid (-1), 0);
- else
+ set_running (minus_one_ptid, 0);
+ else if (last.kind != TARGET_WAITKIND_SIGNALLED
+ && last.kind != TARGET_WAITKIND_EXITED)
set_running (inferior_ptid, 0);
}