vries at gcc dot gnu.org
2018-07-03 19:07:27 UTC
https://sourceware.org/bugzilla/show_bug.cgi?id=23366
Bug ID: 23366
Summary: segfault during info prog at exec catchpoint with
follow-exec-mode new
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: breakpoints
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
Consider this test-case:
...
$ cat t.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);
}
...
compiled for debug:
...
$ gcc -g t.c -o t
...
we run into a segfault with trunk gdb:
...
$ ./install/bin/gdb t \
-batch \
-ex "catch exec" \
-ex "set follow-exec-mode new" \
-ex "run" \
-ex "info prog"
Catchpoint 1 (exec)
process 22490 is executing new program: /usr/bin/ls
[New inferior 2 (process 0)]
[New process 22490]
Thread 2.1 "ls" hit Catchpoint 1 (exec'd /usr/bin/ls), 0x00007ffff7dd7ea0 in
_start () from /lib64/ld-linux-x86-64.so.2
Segmentation fault (core dumped)
...
Runnig with gdb, we see:
...
Program received signal SIGSEGV, Segmentation fault.
info_program_command (args=<optimized out>, from_tty=0)
at src/gdb/infcmd.c:2099
2099 if (tp->state == THREAD_EXITED)
(gdb) p tp
$1 = (thread_info *) 0x0
...
and tp is NULL, because find_thread_ptid (ptid) can't find a thread pointer for
ptid 'minus_one_ptid':
...
(gdb) p ptid
$2 = {m_pid = -1, m_lwp = 0, m_tid = 0}
...
Bug ID: 23366
Summary: segfault during info prog at exec catchpoint with
follow-exec-mode new
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: breakpoints
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
Consider this test-case:
...
$ cat t.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);
}
...
compiled for debug:
...
$ gcc -g t.c -o t
...
we run into a segfault with trunk gdb:
...
$ ./install/bin/gdb t \
-batch \
-ex "catch exec" \
-ex "set follow-exec-mode new" \
-ex "run" \
-ex "info prog"
Catchpoint 1 (exec)
process 22490 is executing new program: /usr/bin/ls
[New inferior 2 (process 0)]
[New process 22490]
Thread 2.1 "ls" hit Catchpoint 1 (exec'd /usr/bin/ls), 0x00007ffff7dd7ea0 in
_start () from /lib64/ld-linux-x86-64.so.2
Segmentation fault (core dumped)
...
Runnig with gdb, we see:
...
Program received signal SIGSEGV, Segmentation fault.
info_program_command (args=<optimized out>, from_tty=0)
at src/gdb/infcmd.c:2099
2099 if (tp->state == THREAD_EXITED)
(gdb) p tp
$1 = (thread_info *) 0x0
...
and tp is NULL, because find_thread_ptid (ptid) can't find a thread pointer for
ptid 'minus_one_ptid':
...
(gdb) p ptid
$2 = {m_pid = -1, m_lwp = 0, m_tid = 0}
...
--
You are receiving this mail because:
You are on the CC list for the bug.
You are receiving this mail because:
You are on the CC list for the bug.