Discussion:
[Bug record/21195] New: Record immediately crashes with multiple inferiors
spencerbaugh at gmail dot com
2017-02-22 16:27:53 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21195

Bug ID: 21195
Summary: Record immediately crashes with multiple inferiors
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: record
Assignee: unassigned at sourceware dot org
Reporter: spencerbaugh at gmail dot com
Target Milestone: ---

While recording a program, if you add another inferior, GDB will crash:

Current directory is /home/sbaugh/
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) file hello
Reading symbols from /home/sbaugh/hello...(no debugging symbols found)...done.
(gdb) start
Temporary breakpoint 1 at 0x4007ba
Starting program: /home/sbaugh/hello
warning: no loadable sections found in added symbol-file system-supplied DSO at
0x7ffff7ffa000

Temporary breakpoint 1, 0x00000000004007ba in main ()
(gdb) record
(gdb) add-inferior -exec hello
Added inferior 2
Reading symbols from /home/sbaugh/hello...(no debugging symbols found)...done.
(gdb) infe 2
[Switching to inferior 2 [process 0] (/home/sbaugh/hello)]
(gdb) start
Temporary breakpoint 2 at 0x4007ba (2 locations)
Starting program: /home/sbaugh/hello
/tmp/buildd/gdb-7.4.1+dfsg/gdb/record.c:1176: internal-error: record_wait_1:
Assertion `(options & TARGET_WNOHANG) != 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)


I've confirmed this on HEAD as well. (I presume this bug is present in all
versions of gdb with record)

Snippet of backtrace:

#3 0x000000000065a8c9 in internal_vproblem(internal_problem *, const char *,
int, const char *, typedef __va_list_tag __va_list_tag *)
(problem=***@entry=0xc3b740 <internal_error_problem>, file=<optimized out>,
line=<optimized out>, fmt=<optimized out>, ap=***@entry=0x7ffcd0fbf1c8) at
utils.c:772
#4 0x000000000065aa39 in internal_verror (file=<optimized out>,
line=<optimized out>, fmt=<optimized out>, ap=***@entry=0x7ffcd0fbf1c8) at
utils.c:798
#5 0x0000000000695822 in internal_error (file=***@entry=0x861739
"record-full.c", line=***@entry=1066, fmt=<optimized out>) at
./common/errors.c:55
#6 0x0000000000683a3b in record_full_wait_1 (options=<optimized out>,
status=0x7ffcd0fbf4a0, ptid=..., ops=0xc64620 <record_full_ops>) at
record-full.c:1066
#7 record_full_wait (ops=0xc64620 <record_full_ops>, ptid=...,
status=0x7ffcd0fbf4a0, options=<optimized out>) at record-full.c:1346
#8 0x00000000005aa20e in delegate_wait (self=<optimized out>, arg1=...,
arg2=<optimized out>, arg3=<optimized out>) at target-delegates.c:116
#9 0x00000000005b9815 in target_wait (ptid=...,
status=***@entry=0x7ffcd0fbf4a0, options=***@entry=0) at target.c:2289
#10 0x000000000044feca in startup_inferior (ntraps=***@entry=1) at
fork-child.c:465

The culprit seems to be that startup_inferior passes options=0 to wait, while
record_full_wait_1 asserts (options & TARGET_WNOHANG) != 0.
--
You are receiving this mail because:
You are on the CC list for the bug.
spencerbaugh at gmail dot com
2017-02-22 16:28:30 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21195

Spencer Baugh <spencerbaugh at gmail dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Version|HEAD |7.12.1
--
You are receiving this mail because:
You are on the CC list for the bug.
daniel at linux dot ibm.com
2018-04-19 00:53:43 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=21195

Daniel Black <daniel at linux dot ibm.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel at linux dot ibm.com

--- Comment #1 from Daniel Black <daniel at linux dot ibm.com> ---

/usr/local/bin/gdb --args /usr/local/mariadb-10.3_libc_memcpy/bin/mysqld
--datadir=/tmp/datadir
GNU gdb (GDB) 8.1.50.20180418-git
..
(gdb) break network_init
(gdb) run
Thread 1 "mysqld" hit Breakpoint 1, mysqld_main (argc=<optimized out>,
argv=<optimized out>) at /home/dan/mariadb-server/sql/mysqld.cc:5964
5964 network_init();
(gdb) record full
(gdb) s
network_init () at /home/dan/mariadb-server/sql/mysqld.cc:2718
2718 if (MYSQL_CALLBACK_ELSE(thread_scheduler, init, (), 0))
(gdb) n
record-full.c:1046: internal-error: ptid_t record_full_wait_1(target_ops*,
ptid_t, target_waitstatus*, int): Assertion `(options & TARGET_WNOHANG) != 0'
failed.




/usr/local/bin/gdb /usr/local/bin/gdb core.171192

[New LWP 171192]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/opt/at11.0/lib64/power9/libthread_db.so.1".
Core was generated by `/usr/local/bin/gdb --args
/usr/local/mariadb-10.3_libc_memcpy/bin/mysqld --data'.
Program terminated with signal SIGABRT, Aborted.
#0 0x00007638aaf78550 in __libc_signal_restore_set (set=0x7fffc15070e0) at
../sysdeps/unix/sysv/linux/nptl-signals.h:80
80 ../sysdeps/unix/sysv/linux/nptl-signals.h: No such file or directory.
(gdb) bt
#0 0x00007638aaf78550 in __libc_signal_restore_set (set=0x7fffc15070e0) at
../sysdeps/unix/sysv/linux/nptl-signals.h:80
#1 __GI_raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:48
#2 0x00007638aaf7ad68 in __GI_abort () at abort.c:90
#3 0x000000001046b28c in dump_core () at utils.c:255
#4 0x000000001046ecc0 in internal_vproblem (problem=0x10b8f3d8
<internal_error_problem>, file=<optimized out>, line=<optimized out>,
fmt=<optimized out>,
ap=<optimized out>) at utils.c:464
#5 0x000000001046ee90 in internal_verror (file=<optimized out>,
line=<optimized out>, fmt=<optimized out>, ap=<optimized out>) at utils.c:489
#6 0x0000000010208160 in internal_error (file=<optimized out>, line=<optimized
out>, fmt=<optimized out>) at common/errors.c:55
#7 0x0000000010395134 in record_full_wait_1 (options=0, status=0x7fffc1507710,
ptid=..., ops=0x10bdf728 <record_full_ops>) at record-full.c:1046
#8 record_full_wait (ops=0x10bdf728 <record_full_ops>, ptid=...,
status=0x7fffc1507710, options=<optimized out>) at record-full.c:1325
#9 0x000000001041176c in delegate_wait (self=<optimized out>, arg1=...,
arg2=<optimized out>, arg3=<optimized out>) at target-delegates.c:138
#10 0x000000001042afc0 in target_wait (ptid=..., status=<optimized out>,
options=<optimized out>) at target.c:2258
#11 0x00000000103071f0 in wait_one (ws=<optimized out>) at infrun.c:4339
#12 stop_all_threads () at infrun.c:4551
#13 0x000000001030733c in stop_waiting (ecs=<optimized out>) at infrun.c:7664
#14 0x000000001030bf08 in handle_signal_stop (ecs=0x7fffc1507b30) at
infrun.c:6084
#15 0x00000000103107b4 in handle_inferior_event_1 (ecs=0x7fffc1507b30) at
infrun.c:5371
#16 handle_inferior_event (ecs=0x7fffc1507b30) at infrun.c:5406
#17 0x0000000010311c8c in fetch_inferior_event (client_data=<optimized out>) at
infrun.c:3920
#18 0x00000000102f2388 in inferior_event_handler (event_type=<optimized out>,
client_data=<optimized out>) at inf-loop.c:43
#19 0x000000001007df20 in handle_target_event (error=<optimized out>,
client_data=<optimized out>) at linux-nat.c:4465
#20 0x00000000102abc7c in handle_file_event (file_ptr=0x11f4e620,
ready_mask=<optimized out>) at event-loop.c:733
#21 0x00000000102ac4b4 in gdb_wait_for_event (block=0) at event-loop.c:859
#22 0x00000000102ac7d8 in gdb_do_one_event () at event-loop.c:322
#23 0x00000000102ac93c in gdb_do_one_event () at event-loop.c:304
#24 start_event_loop () at event-loop.c:371
#25 0x000000001033b3bc in captured_command_loop () at main.c:330
#26 0x000000001033cbe0 in captured_main (data=<optimized out>) at main.c:1157
#27 gdb_main (args=<optimized out>) at main.c:1173
#28 0x0000000010014158 in main (argc=<error reading variable: value has been
optimized out>, argv=<optimized out>) at gdb.c:32
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...