Avoid another inferior_ptid reference in gdb/remote.c
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Fri, 10 Jan 2020 20:05:52 +0000 (20:05 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 10 Jan 2020 20:05:52 +0000 (20:05 +0000)
commite7af6c702da7a77529afdeffbbe6e13639beb441
tree0347439761a903062dc94fddb8f33833053a2277
parent31ba933ec6a14b1f7fdbd9ba51f759e2c0537b9d
Avoid another inferior_ptid reference in gdb/remote.c

The multi-target patch makes inferior_ptid point to null_ptid before
calling into target_wait, which catches bad uses of inferior_ptid,
since the current selected thread in gdb shouldn't have much relation
to the thread that reports an event.

One such bad use is found in remote_target::remote_parse_stop_reply,
where we handle the 'W' or 'X' packets (process exit), and the remote
target does not support the multi-process extensions, i.e., it does
not report the PID of the process that exited.

With the multi-target patch, that would result in a failed assertion,
trying to find the inferior for process pid 0.

gdb/ChangeLog:
2020-01-10  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
    Pedro Alves  <palves@redhat.com>

* remote.c (remote_target::remote_parse_stop_reply) <W/X packets>:
If no process is specified, return null_ptid instead of
inferior_ptid.
(remote_target::wait_as): Handle TARGET_WAITKIND_EXITED /
TARGET_WAITKIND_SIGNALLED with no pid.

gdb/testsuite/ChangeLog:
2020-01-10  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>
    Pedro Alves  <palves@redhat.com>

* gdb.server/connect-without-multi-process.exp: Also test
continuing to end.
gdb/ChangeLog
gdb/remote.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.server/connect-without-multi-process.exp
This page took 0.026868 seconds and 4 git commands to generate.