diff options
author | Joel Brobecker <brobecker@adacore.com> | 2018-06-04 15:03:32 -0500 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2018-06-04 16:07:33 -0400 |
commit | 178d6a638693d1a7a66b0553f16b1df95b4f27ee (patch) | |
tree | c95fe3a396adb32c5438b7685c62fadebb8fb44c /elfcpp | |
parent | 4b8e28c79356265b2c111e044142fb6d6d2db44e (diff) | |
download | gdb-178d6a638693d1a7a66b0553f16b1df95b4f27ee.zip gdb-178d6a638693d1a7a66b0553f16b1df95b4f27ee.tar.gz gdb-178d6a638693d1a7a66b0553f16b1df95b4f27ee.tar.bz2 |
(windows) GDB/MI crash when using "-list-thread-groups --available"
On Windows, using the "-list-thread-groups --available" GDB/MI command
before an inferior is being debugged:
% gdb -q -i=mi
=thread-group-added,id="i1"
=cmd-param-changed,param="auto-load safe-path",value="/"
(gdb)
-list-thread-groups --available
Segmentation fault
Ooops!
The SEGV happens because the -list-thread-groups --available command
triggers a windows_nat_target::xfer_partial call for a TARGET_OBJECT_OSDATA
object. Until a program is being debugged, the target_ops layer that
gets the call is the Windows "native" layer. Except for a couple of
specific objects (TARGET_OBJECT_MEMORY and TARGET_OBJECT_LIBRARIES),
this layer's xfer_partial method delegates the xfer of other objects
to the target beneath:
default:
return beneath->xfer_partial (object, annex,
readbuf, writebuf, offset, len,
xfered_len);
Unfortunately, there is no "beneath layer" in this case, so
beneath is NULL and dereferencing it leads to the SEGV.
This patch fixes the issue by checking beneath before trying
to delegate the request.
gdb/ChangeLog:
* windows-nat.c (windows_nat_target::xfer_partial): Return
TARGET_XFER_E_IO if we need to delegate to the target beneath
but BENEATH is NULL.
gdb/testsuite/ChangeLog:
* gdb.mi/list-thread-groups-no-inferior.exp: New testcase.
Diffstat (limited to 'elfcpp')
0 files changed, 0 insertions, 0 deletions