mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
9e7f3bbbbf
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.
11 lines
172 B
C
11 lines
172 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
char *exec_args[] = { "/bin/ls", "ppp", NULL };
|
|
execve (exec_args[0], exec_args, NULL);
|
|
}
|