aboutsummaryrefslogtreecommitdiff
path: root/gdb/fork-child.c
diff options
context:
space:
mode:
authorSergio Durigan Junior <sergiodj@redhat.com>2016-09-11 23:45:31 -0400
committerSergio Durigan Junior <sergiodj@redhat.com>2016-09-19 00:17:29 -0400
commitbc1e6c81d5b77d78282c47f6fd7f697e564a6eb6 (patch)
tree5ea22142c6941b0310eafb381d9e14d2f32a4bcf /gdb/fork-child.c
parent73cca75e7b187800d473ef2dc5115dd509901536 (diff)
downloadgdb-bc1e6c81d5b77d78282c47f6fd7f697e564a6eb6.zip
gdb-bc1e6c81d5b77d78282c47f6fd7f697e564a6eb6.tar.gz
gdb-bc1e6c81d5b77d78282c47f6fd7f697e564a6eb6.tar.bz2
Consolidate target_mourn_inferior between GDB and gdbserver
This patch consolidates the API of target_mourn_inferior between GDB and gdbserver, in my continuing efforts to make sharing the fork_inferior function possible between both. GDB's version of the function did not care about the inferior's ptid being mourned, but gdbserver's needed to know this information. Since it actually makes sense to pass the ptid as an argument, instead of depending on a global value directly (which GDB's version did), I decided to make the generic API to accept it. I then went on and extended all calls being made on GDB to include a ptid argument (which ended up being inferior_ptid most of the times, anyway), and now we have a more sane interface. On GDB's side, after talking to Pedro a bit about it, we decided that just an assertion to make sure that the ptid being passed is equal to inferior_ptid would be enough for now, on the GDB side. We can remove the assertion and perform more operations later if we ever pass anything different than inferior_ptid. Regression tested on our BuildBot, everything OK. I'd appreciate a special look at gdb/windows-nat.c's modification because I wasn't really sure what to do there. It seemed to me that maybe I should build a ptid out of the process information there, but then I am almost sure the assertion on GDB's side would trigger. gdb/ChangeLog: 2016-09-19 Sergio Durigan Junior <sergiodj@redhat.com> * darwin-nat.c (darwin_kill_inferior): Adjusting call to target_mourn_inferior to include ptid_t argument. * fork-child.c (startup_inferior): Likewise. * gnu-nat.c (gnu_kill_inferior): Likewise. * inf-ptrace.c (inf_ptrace_kill): Likewise. * infrun.c (handle_inferior_event_1): Likewise. * linux-nat.c (linux_nat_attach): Likewise. (linux_nat_kill): Likewise. * nto-procfs.c (interrupt_query): Likewise. (procfs_interrupt): Likewise. (procfs_kill_inferior): Likewise. * procfs.c (procfs_kill_inferior): Likewise. * record.c (record_mourn_inferior): Likewise. * remote-sim.c (gdbsim_kill): Likewise. * remote.c (remote_detach_1): Likewise. (remote_kill): Likewise. * target.c (target_mourn_inferior): Change declaration to accept new ptid_t argument; use gdb_assert on it. * target.h (target_mourn_inferior): Move function prototype from here... * target/target.h (target_mourn_inferior): ... to here. Adjust it to accept new ptid_t argument. * windows-nat.c (get_windows_debug_event): Adjusting call to target_mourn_inferior to include ptid_t argument. gdb/gdbserver/ChangeLog: 2016-09-19 Sergio Durigan Junior <sergiodj@redhat.com> * server.c (start_inferior): Call target_mourn_inferior instead of mourn_inferior; pass ptid_t argument to it. (resume): Likewise. (handle_target_event): Likewise. * target.c (target_mourn_inferior): New function. * target.h (mourn_inferior): Delete macro.
Diffstat (limited to 'gdb/fork-child.c')
-rw-r--r--gdb/fork-child.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 3e29a1f..f367507 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -482,7 +482,7 @@ startup_inferior (int ntraps)
case TARGET_WAITKIND_SIGNALLED:
target_terminal_ours ();
- target_mourn_inferior ();
+ target_mourn_inferior (resume_ptid);
error (_("During startup program terminated with signal %s, %s."),
gdb_signal_to_name (ws.value.sig),
gdb_signal_to_string (ws.value.sig));
@@ -490,7 +490,7 @@ startup_inferior (int ntraps)
case TARGET_WAITKIND_EXITED:
target_terminal_ours ();
- target_mourn_inferior ();
+ target_mourn_inferior (resume_ptid);
if (ws.value.integer)
error (_("During startup program exited with code %d."),
ws.value.integer);