]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/procfs.c
Consolidate target_mourn_inferior between GDB and gdbserver
authorSergio Durigan Junior <sergiodj@redhat.com>
Mon, 12 Sep 2016 03:45:31 +0000 (23:45 -0400)
committerSergio Durigan Junior <sergiodj@redhat.com>
Mon, 19 Sep 2016 04:17:29 +0000 (00:17 -0400)
commitbc1e6c81d5b77d78282c47f6fd7f697e564a6eb6
tree5ea22142c6941b0310eafb381d9e14d2f32a4bcf
parent73cca75e7b187800d473ef2dc5115dd509901536
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.
20 files changed:
gdb/ChangeLog
gdb/darwin-nat.c
gdb/fork-child.c
gdb/gdbserver/ChangeLog
gdb/gdbserver/server.c
gdb/gdbserver/target.c
gdb/gdbserver/target.h
gdb/gnu-nat.c
gdb/inf-ptrace.c
gdb/infrun.c
gdb/linux-nat.c
gdb/nto-procfs.c
gdb/procfs.c
gdb/record.c
gdb/remote-sim.c
gdb/remote.c
gdb/target.c
gdb/target.h
gdb/target/target.h
gdb/windows-nat.c