Bug 20607 (coredump, object, print, protobuff) - gdb printing google's protobuf object will crash
Summary: gdb printing google's protobuf object will crash
Status: RESOLVED DUPLICATE of bug 17685
Alias: coredump, object, print, protobuff
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.11.1
: P2 normal
Target Milestone: 7.11.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-14 07:13 UTC by egmkang
Modified: 2018-11-30 16:56 UTC (History)
4 users (show)

See Also:
Host: Ubuntu 4.4.0-36-generic
Target: 64bit
Build: gcc 5.4.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description egmkang 2016-09-14 07:13:05 UTC
when i print a protobuf object, the gdb(itself) will crash.

this is backtrace when i print a google::protobuf::RepeatedField<google::protobuf::int32> instance.


```
#0  value_entirely_covered_by_range_vector (value=0x0, ranges=0x80) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/value.c:398
398     /build/gdb-cXfXJ3/gdb-7.11.1/gdb/value.c: No such file or directory.
(gdb) bt
#0  value_entirely_covered_by_range_vector (value=0x0, ranges=0x80) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/value.c:398
#1  0x0000000000691d91 in cp_print_static_field (options=0x7ffc853963d0, recurse=1, stream=0x22d99d0, val=<optimized out>, type=0x58ca1e0)
    at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/cp-valprint.c:641
#2  cp_print_value_fields (type=<optimized out>, real_type=real_type@entry=0x6f42bd0, valaddr=valaddr@entry=0x7ddad40 "\200^", offset=offset@entry=0, 
    address=address@entry=106927506549960, stream=0x22d99d0, recurse=0, val=0x6716750, options=0x7ffc853963d0, dont_print_vb=0x0, dont_print_statmem=0)
    at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/cp-valprint.c:331
#3  0x0000000000692832 in cp_print_value_fields_rtti (type=<optimized out>, type@entry=0x6f42bd0, valaddr=0x7ddad40 "\200^", offset=0, address=106927506549960, stream=0x22d99d0, 
    recurse=<optimized out>, val=0x6716750, options=0x7ffc853963d0, dont_print_vb=0x0, dont_print_statmem=0) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/cp-valprint.c:452
#4  0x0000000000690282 in c_val_print_struct (type=0x6f42bd0, valaddr=<optimized out>, embedded_offset=<optimized out>, address=<optimized out>, stream=<optimized out>, 
    recurse=<optimized out>, original_value=0x6716750, options=0x7ffc853963d0) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/c-valprint.c:406
#5  0x0000000000690770 in c_val_print (type=0x6f42bd0, valaddr=0x7ddad40 "\200^", embedded_offset=0, address=106927506549960, stream=0x22d99d0, recurse=0, original_value=0x6716750, 
    options=0x7ffc853963d0) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/c-valprint.c:526
#6  0x0000000000584253 in val_print (type=type@entry=0x6f42b40, valaddr=0x7ddad40 "\200^", embedded_offset=embedded_offset@entry=0, address=address@entry=106927506549960, 
    stream=stream@entry=0x22d99d0, recurse=recurse@entry=0, val=0x6716750, options=0x7ffc85396480, language=0x846f40 <cplus_language_defn>)
    at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/valprint.c:1009
#7  0x0000000000690f30 in c_value_print (val=0x6716750, stream=0x22d99d0, options=<optimized out>) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/c-valprint.c:689
#8  0x000000000058bdc7 in print_value (val=val@entry=0x6716750, fmtp=fmtp@entry=0x7ffc853965b0) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/printcmd.c:976
#9  0x000000000058be91 in print_command_1 (exp=0x20ebe72 "carrier_attr", voidprint=1) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/printcmd.c:1009
#10 0x000000000069db16 in execute_command (p=<optimized out>, p@entry=0x20ebe70 "p carrier_attr", from_tty=1) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/top.c:475
#11 0x00000000005d487c in command_handler (command=0x20ebe70 "p carrier_attr") at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/event-top.c:491
#12 0x00000000005d4f5f in command_line_handler (rl=<optimized out>) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/event-top.c:690
#13 0x00007fee6c54b6f5 in rl_callback_read_char () from /lib/x86_64-linux-gnu/libreadline.so.6
#14 0x00000000005d48d9 in rl_callback_read_char_wrapper (client_data=<optimized out>) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/event-top.c:171
#15 0x00000000005d4923 in stdin_event_handler (error=<optimized out>, client_data=0x0) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/event-top.c:430
#16 0x00000000005d3705 in gdb_wait_for_event (block=block@entry=1) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/event-loop.c:834
#17 0x00000000005d38a9 in gdb_do_one_event () at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/event-loop.c:323
#18 0x00000000005d39ee in start_event_loop () at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/event-loop.c:347
#19 0x00000000005cd3b3 in captured_command_loop (data=data@entry=0x0) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/main.c:318
#20 0x00000000005ca1cd in catch_errors (func=func@entry=0x5cd3a0 <captured_command_loop>, func_args=func_args@entry=0x0, errstring=errstring@entry=0x7ac0eb "", 
    mask=mask@entry=RETURN_MASK_ALL) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/exceptions.c:240
#21 0x00000000005cdfa6 in captured_main (data=data@entry=0x7ffc853969d0) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/main.c:1157
#22 0x00000000005ca1cd in catch_errors (func=func@entry=0x5cd900 <captured_main>, func_args=func_args@entry=0x7ffc853969d0, errstring=errstring@entry=0x7ac0eb "", 
    mask=mask@entry=RETURN_MASK_ALL) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/exceptions.c:240
#23 0x00000000005ce87b in gdb_main (args=args@entry=0x7ffc853969d0) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/main.c:1165
#24 0x000000000045eca5 in main (argc=<optimized out>, argv=<optimized out>) at /build/gdb-cXfXJ3/gdb-7.11.1/gdb/gdb.c:32
```
Comment 1 weimin.pan 2018-11-08 00:55:41 UTC
This is a duplicate of PR 17685, which depends on whether or not
the compiler generated a DWARF declaration DIE for the static data
member. Programs with such debug info will crash gdb when printing
class objects.
Comment 2 Tom Tromey 2018-11-30 16:56:45 UTC
Duplicate.

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