[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.
This commit is contained in:
parent
4a1b91eabb
commit
9e7f3bbbbf
5 changed files with 80 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue