diff options
author | Tom de Vries <tdevries@suse.de> | 2018-07-03 17:08:42 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2018-07-26 00:56:41 +0200 |
commit | 9e7f3bbbbf5a13e879a4cc3cfa958412ffac0d9d (patch) | |
tree | 1ec1b56f2d5f3784a42a4bcbaaaf0409abe11126 /gdb/infcmd.c | |
parent | 4a1b91eabbe77f4d906a0895121d76a0653c3cf3 (diff) | |
download | gdb-9e7f3bbbbf5a13e879a4cc3cfa958412ffac0d9d.zip gdb-9e7f3bbbbf5a13e879a4cc3cfa958412ffac0d9d.tar.gz gdb-9e7f3bbbbf5a13e879a4cc3cfa958412ffac0d9d.tar.bz2 |
[gdb/breakpoints] Fix sigsegv in info prog at exec catchpoint
With the test-case contained in this patch and compiled for debug we run into
a segfault with trunk gdb:
...
$ gdb catch-follow-exec -batch -ex "catch exec" \
-ex "set follow-exec-mode new" -ex "run" -ex "info prog"
Catchpoint 1 (exec)
process xxx is executing new program: /usr/bin/ls
[New inferior 2 (process 0)]
[New process xxx]
Thread 2.1 "ls" hit Catchpoint 1 (exec'd /usr/bin/ls), in _start () from
/lib64/ld-linux-x86-64.so.2
Segmentation fault (core dumped)
...
The patch fixes the segfault by returning an error in info_program_command
if get_last_target_status returns minus_one_ptid.
The test-case is non-standard, because the standard approach runs into
PR23368, a problem with gdb going to the background.
Build and reg-tested on x86_64-linux.
2018-07-26 Tom de Vries <tdevries@suse.de>
PR breakpoints/23366
* infcmd.c (info_program_command): Handle ptid == minus_one_ptid.
* gdb.base/catch-follow-exec.c: New test.
* gdb.base/catch-follow-exec.exp: New file.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r-- | gdb/infcmd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 821bcc6..74d5956 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2091,7 +2091,7 @@ info_program_command (const char *args, int from_tty) get_last_target_status (&ptid, &ws); } - if (ptid == null_ptid) + if (ptid == null_ptid || ptid == minus_one_ptid) error (_("No selected thread.")); thread_info *tp = find_thread_ptid (ptid); |