diff options
author | Sergio Durigan Junior <sergiodj@redhat.com> | 2016-09-11 23:45:31 -0400 |
---|---|---|
committer | Sergio Durigan Junior <sergiodj@redhat.com> | 2016-09-19 00:17:29 -0400 |
commit | bc1e6c81d5b77d78282c47f6fd7f697e564a6eb6 (patch) | |
tree | 5ea22142c6941b0310eafb381d9e14d2f32a4bcf /gdb/target.c | |
parent | 73cca75e7b187800d473ef2dc5115dd509901536 (diff) | |
download | gdb-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/target.c')
-rw-r--r-- | gdb/target.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/target.c b/gdb/target.c index b93244d..b6a7e64 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2377,8 +2377,9 @@ default_mourn_inferior (struct target_ops *self) } void -target_mourn_inferior (void) +target_mourn_inferior (ptid_t ptid) { + gdb_assert (ptid_equal (ptid, inferior_ptid)); current_target.to_mourn_inferior (¤t_target); /* We no longer need to keep handles on any of the object files. |