Bug 1751253

Summary: gdb gets segtment fault when parse the coredump of rr
Product: Red Hat Enterprise Linux 8 Reporter: Han Han <hhan>
Component: gdbAssignee: Keith Seitz <keiths>
gdb sub component: system-version QA Contact: qe-baseos-tools-bugs
Status: CLOSED DUPLICATE Docs Contact:
Severity: unspecified    
Priority: unspecified CC: dsmith, gdb-bugs, mcermak, ohudlick, sergiodj
Version: 8.1Keywords: Triaged
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-09 18:51:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
attachment part 1
none
attachment part 2 none

Description Han Han 2019-09-11 14:01:03 UTC
Description of problem:
As subject

Version-Release number of selected component (if applicable):
gdb-8.2-6.el8

How reproducible:
100%

Steps to Reproduce:
1. Download the attachment and uncompress it
2. Change dir to the uncompressed attachment
3. Execute the gdbinit via gdb to parse the info from rr coredump file
➜  rr gdb -q
(gdb) source gdbinit 
Missing separate debuginfo for /tmp/rr/usr/bin/rr
[New LWP 279622]
Core was generated by `rr record libvirtd'.
Program terminated with signal SIGSEGV, Segmentation fault.
[1]    31513 segmentation fault (core dumped)  gdb -q


Actual results:
As above

Expected results:
No segment fault

Additional info:
Backtrace of gdb:
(gdb) bt
#0  0x0000564c6ebc4560 in parse_macro_definition (body=<optimized out>, line=<optimized out>, file=<optimized out>) at ../../gdb/dwarf2read.c:24499
#1  dwarf_decode_macro_bytes (dwarf2_per_objfile=dwarf2_per_objfile@entry=0x564c70813a30, abfd=abfd@entry=0x564c707f3360, mac_ptr=0x564c72a9f4d2 "\005", mac_ptr@entry=0x564c72a9ed85 "\004", 
    mac_end=mac_end@entry=0x564c72b083d1 "", current_file=current_file@entry=0x564c72a65d20, lh=lh@entry=0x564c707f40d0, section=0x564c70813b20, section_is_gnu=1, section_is_dwz=0, offset_size=<optimized out>, 
    include_hash=0x564c7214c5f0) at ../../gdb/dwarf2read.c:24359
#2  0x0000564c6ebc4650 in dwarf_decode_macro_bytes (dwarf2_per_objfile=dwarf2_per_objfile@entry=0x564c70813a30, abfd=abfd@entry=0x564c707f3360, mac_ptr=0x564c72af37e6 "\003", 
    mac_ptr@entry=0x564c72af37da "\004", mac_end=mac_end@entry=0x564c72b083d1 "", current_file=current_file@entry=0x564c72a65d20, lh=lh@entry=0x564c707f40d0, section=0x564c70813b20, section_is_gnu=1, 
    section_is_dwz=0, offset_size=<optimized out>, include_hash=0x564c7214c5f0) at ../../gdb/dwarf2read.c:24475
#3  0x0000564c6ebc4d6d in dwarf_decode_macros (cu=<optimized out>, offset=351290, section_is_gnu=1) at ../../gdb/dwarf2read.c:24703
#4  0x0000564c6ebd8854 in read_file_scope (cu=0x564c70788de0, die=0x564c71707720) at ../../gdb/dwarf2read.c:11509
#5  process_die (die=0x564c71707720, cu=0x564c70788de0) at ../../gdb/dwarf2read.c:10514
#6  0x0000564c6ebddbd8 in process_full_comp_unit (pretend_language=<optimized out>, per_cu=<optimized out>) at ../../gdb/dwarf2read.c:10274
#7  process_queue (dwarf2_per_objfile=<optimized out>, dwarf2_per_objfile=<optimized out>) at ../../gdb/dwarf2read.c:9499
#8  dw2_do_instantiate_symtab (per_cu=<optimized out>, skip_partial=<optimized out>) at ../../gdb/dwarf2read.c:2885
#9  0x0000564c6ebdf25f in dwarf2_read_symtab (self=0x564c718da2c0, objfile=0x564c707faf30) at ../../gdb/dwarf2read.c:9365
#10 0x0000564c6ec7c297 in psymtab_to_symtab (objfile=0x564c707faf30, pst=0x564c718da2c0) at ../../gdb/psymtab.c:792
#11 0x0000564c6ec7f345 in psym_find_pc_sect_compunit_symtab (objfile=0x564c707faf30, msymbol=..., pc=<optimized out>, section=<optimized out>, warn_if_readin=1) at ../../gdb/psymtab.c:399
#12 0x0000564c6ecdcee8 in find_pc_sect_compunit_symtab (pc=94719964062065, section=0x0) at ../../gdb/symtab.c:2973
#13 0x0000564c6ecdcf19 in find_pc_compunit_symtab (pc=<optimized out>) at ../../gdb/symtab.c:2991
#14 0x0000564c6ebf5e29 in select_frame (fi=<optimized out>) at ../../gdb/frame.c:1715
#15 0x0000564c6ebf72f3 in select_frame (fi=<optimized out>) at ../../gdb/frame.c:1702
#16 get_selected_frame (message=message@entry=0x0) at ../../gdb/frame.c:1655
#17 0x0000564c6eb82a77 in core_target_open (arg=<optimized out>, from_tty=0) at ../../gdb/corelow.c:582
#18 0x0000564c6ea6b43a in cmd_func (cmd=<optimized out>, args=<optimized out>, from_tty=<optimized out>) at ../../gdb/cli/cli-decode.c:1857
#19 0x0000564c6ed0f05a in execute_command (p=<optimized out>, p@entry=0x564c706f46b0 "core-file rr-coredump", from_tty=0) at ../../gdb/top.c:630
#20 0x0000564c6ebeaf04 in command_handler (command=0x564c706f46b0 "core-file rr-coredump") at ../../gdb/event-top.c:586
#21 0x0000564c6ed0fc8f in read_command_file (stream=stream@entry=0x564c706edff0) at ../../gdb/top.c:424
#22 0x0000564c6ea70582 in script_from_file (stream=stream@entry=0x564c706edff0, file=file@entry=0x7fff83e27e80 "gdbinit") at ../../gdb/cli/cli-script.c:1551
#23 0x0000564c6ea6818b in source_script_from_stream (file_to_open=0x7fff83e27e80 "gdbinit", file=0x7fff83e27e80 "gdbinit", stream=0x564c706edff0) at ../../gdb/cli/cli-cmds.c:568
#24 source_script_with_search (file=0x7fff83e27e80 "gdbinit", from_tty=<optimized out>, search_path=<optimized out>) at ../../gdb/cli/cli-cmds.c:604
#25 0x0000564c6ea68310 in source_command (args=<optimized out>, from_tty=1) at ../../gdb/cli/cli-cmds.c:663
#26 0x0000564c6ea6b43a in cmd_func (cmd=<optimized out>, args=<optimized out>, from_tty=<optimized out>) at ../../gdb/cli/cli-decode.c:1857
#27 0x0000564c6ed0f05a in execute_command (p=<optimized out>, p@entry=0x564c6fd84e60 "source gdbinit ", from_tty=1) at ../../gdb/top.c:630
#28 0x0000564c6ebeaf04 in command_handler (command=0x564c6fd84e60 "source gdbinit ") at ../../gdb/event-top.c:586
#29 0x0000564c6ebebe2e in command_line_handler (rl=<optimized out>) at ../../gdb/event-top.c:777
#30 0x0000564c6ebea610 in gdb_rl_callback_handler (rl=0x564c70229340 "") at ../../gdb/event-top.c:214
#31 0x00007f8cf2164e7e in rl_callback_read_char () from /lib64/libreadline.so.7
#32 0x0000564c6ebea526 in gdb_rl_callback_read_char_wrapper_noexcept () at ../../gdb/event-top.c:176
#33 0x0000564c6ebea5ad in gdb_rl_callback_read_char_wrapper (client_data=<optimized out>) at ../../gdb/event-top.c:192
#34 0x0000564c6ebeaad8 in stdin_event_handler (error=<optimized out>, client_data=0x564c6fda6ff0) at ../../gdb/event-top.c:514
#35 0x0000564c6ebe991d in gdb_wait_for_event (block=<optimized out>) at ../../gdb/event-loop.c:859
#36 0x0000564c6ebe9ac8 in gdb_do_one_event () at ../../gdb/event-loop.c:347
#37 0x0000564c6ebe9bde in gdb_do_one_event () at ../../gdb/event-loop.c:371
#38 start_event_loop () at ../../gdb/event-loop.c:371
#39 0x0000564c6ec4e03b in captured_command_loop () at ../../gdb/main.c:331
#40 0x0000564c6ec4f70d in captured_main (data=0x7fff83e28270) at ../../gdb/main.c:1267
#41 gdb_main (args=0x7fff83e28270) at ../../gdb/main.c:1284
#42 0x0000564c6e9924ff in main (argc=<optimized out>, argv=<optimized out>) at ../../gdb/gdb.c:40

See the full backtrace logfile gdb.txt in attachment.
Since the attachment is to large. I split it to two 7z part compressed files.

It can be reproduced on gdb-8.3 in gentoo

Comment 1 Han Han 2019-09-11 14:03:03 UTC
Created attachment 1614104 [details]
attachment part 1

Comment 2 Han Han 2019-09-11 14:04:50 UTC
Created attachment 1614106 [details]
attachment part 2

Comment 4 Keith Seitz 2019-09-24 18:52:46 UTC
Confirmed that this is 1708192. Verified that gdb-8.3-6 "works"
(it cannot grok the corrupt debuginfo, but it doesn't segfault).

Comment 5 Keith Seitz 2019-10-09 18:51:34 UTC

*** This bug has been marked as a duplicate of bug 1684303 ***