This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/20020] New: GDB segfault on printing objects


https://sourceware.org/bugzilla/show_bug.cgi?id=20020

            Bug ID: 20020
           Summary: GDB segfault on printing objects
           Product: gdb
           Version: 7.11.1
            Status: NEW
          Severity: critical
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: thilo.voertler@coseda-tech.com
  Target Milestone: ---

Created attachment 9223
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9223&action=edit
sca_port_base

When printing an object of the type sca_port_base - part of the Open Source
SystemC AMS Simulator - gdb versions newer than > 7.6.1 crash (Linux and
MinGW64  versions). Below you find the backtrace when debugging gdb 7.11. The
error occurs in value.c of gdb

We can provide also an executable to reproduce the crash, however it is quite
large, due to the libraries required. Attached you find the source code of the
object which is tried to be printed. GDB commands executed in the session are
just: 

b my_first_sch_simple_tb.cpp:128
r
print i_conv_1.tdf_i
---
Breakpoint 1, sc_main (argc=<optimized out>, argv=<optimized out>) at
hier_modules/my_first_sch_simple_tb.cpp:139
139         dut = new my_first_sch("dut", p_dut);
(gdb) print i_conv_1.tdf_i
$1 =
{<sca_tdf::sca_implementation::sca_tdf_port_impl<sca_tdf::sca_signal_if<double>,
double>> = {<sca_core::sca_port<sca_tdf::sca_signal_if<double> >> =
{<sca_core::sca_implementation::sca_port_impl<sca_tdf::sca_signal_if<double> >>
= {<sc_core::sc_port<sc                                                        
  a_tdf::sca_signal_if<double>, 1, (sc_core::sc_port_policy)0>> =
{<sc_core::sc_port_b<sca_tdf::sca_signal_if<double> >> =
{<sc_core::sc_port_base> = {<sc_core::sc_object> = {_vptr.sc_object = 0x7e5310
<vtable for sca_tdf::sca_in<double>+16>, 
                m_attr_cltn_p = 0x0, m_child_events =
{<std::_Vector_base<sc_core::sc_event*, std::allocator<sc_core::sc_event*> >> =
{
                    _M_impl = {<std::allocator<sc_core::sc_event*>> =
{<__gnu_cxx::new_allocator<sc_core::sc_event*>> = {<No data fields>}, <No data
fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data
fields>}, 
                m_child_objects = {<std::_Vector_base<sc_core::sc_object*,
std::allocator<sc_core::sc_object*> >> = {
                    _M_impl = {<std::allocator<sc_core::sc_object*>> =
{<__gnu_cxx::new_allocator<sc_core::sc_object*>> = {<No data fields>}, <No data
fields>}, _M_start = 0x0, _M_finish = 0x0, _M_end_of_storage = 0x0}}, <No data
fields>}, m_name = {
                  static npos = <optimized out>, _M_dataplus =
{<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data
fields>}, <No data fields>}, _M_p = 0x825808 "i_conv_1.tdf_i"}}, m_parent =
0x7fffffffb3f0, m_simc = 0x7f9090}, 
              m_bind_info = 0x8258b0}, m_interface = 0x7fffffffabe0,
m_interface_vec = {<std::_Vector_base<sca_tdf::sca_signal_if<double>*,
std::allocator<sca_tdf::sca_signal_if<double>*> >> = {
                _M_impl = {<std::allocator<sca_tdf::sca_signal_if<double>*>> =
{<__gnu_cxx::new_allocator<sca_tdf::sca_signal_if<double>*>> = {<No data
fields>}, <No data fields>}, _M_start = 0x825a30, _M_finish = 0x825a38, 
                  _M_end_of_storage = 0x825a38}}, <No data fields>}}, <No data
fields>}, <sca_core::sca_implementation::sca_port_base> =
{<sca_util::sca_traceable_object> = {_vptr.sca_traceable_object = 0x7e5448
<vtable for sca_tdf::sca_in<double>+328>, 
            empty_string = {static npos = <optimized out>, _M_dataplus =
{<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data
fields>}, <No data fields>}, _M_p = 0x7ffff7fec6b8
<std::string::_Rep::_S_empty_rep_storage+24> ""}}, unit = {
              static npos = <optimized out>, _M_dataplus =
{<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data
fields>}, <No data fields>}, _M_p = 0x7ffff7fec6b8
<std::string::_Rep::_S_empty_rep_storage+24> ""}}, unit_prefix = {
              static npos = <optimized out>, _M_dataplus =
{<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data
fields>}, <No data fields>}, _M_p = 0x7ffff7fec6b8
<std::string::_Rep::_S_empty_rep_storage+24> ""}}, domain = {
              static npos = <optimized out>, _M_dataplus =
{<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data
fields>}, <No data fields>}, _M_p = 0x7ffff7fec6b8
<std::string::_Rep::_S_empty_rep_storage+24> ""}}}, 
          elaboration_finished = false, sca_port_type =
sca_core::sca_implementation::sca_port_base::SCA_IN_PORT, port_number = 0,
port_if_id = 0, parent_module = 0x7fffffffb3f0, m_if = 0x0, m_sca_if = 0x0,
port_elaborated = false}, 

Program received signal SIGSEGV, Segmentation fault.
0x000000000052910c in value_entirely_covered_by_range_vector (value=0x0,
ranges=0x80) at ../../gdb/value.c:398
398       if (value->lazy)
(gdb) bt
#0  0x000000000052910c in value_entirely_covered_by_range_vector (value=0x0,
ranges=0x80) at ../../gdb/value.c:398
#1  0x00000000005291e0 in value_entirely_optimized_out (value=0x0) at
../../gdb/value.c:423
#2  0x00000000006ab132 in cp_print_static_field (type=0x2091f20, val=0x0,
stream=0xde3930, recurse=4, options=0x7fffffffb520) at
../../gdb/cp-valprint.c:641
#3  0x00000000006aa211 in cp_print_value_fields (type=0x21b0de0,
real_type=0x21e49e0, valaddr=0x409c670 "\020S~", offset=0,
address=140737488336456, stream=0xde3930, recurse=3, val=0x1dd2f00,
options=0x7fffffffb520, dont_print_vb=0xdc12c0, 
    dont_print_statmem=0) at ../../gdb/cp-valprint.c:331
#4  0x00000000006aaf9d in cp_print_value (type=0x21b8c50, real_type=0x21e49e0,
valaddr=0x409c670 "\020S~", offset=0, address=140737488336456, stream=0xde3930,
recurse=3, val=0x1dd2f00, options=0x7fffffffb520, dont_print_vb=0xdc12c0)
    at ../../gdb/cp-valprint.c:599
#5  0x00000000006a9a9c in cp_print_value_fields (type=0x21b8c50,
real_type=0x21e49e0, valaddr=0x409c670 "\020S~", offset=0,
address=140737488336456, stream=0xde3930, recurse=2, val=0x1dd2f00,
options=0x7fffffffb520, dont_print_vb=0xdc12c0, 
    dont_print_statmem=0) at ../../gdb/cp-valprint.c:197
#6  0x00000000006aaf9d in cp_print_value (type=0x21dcbf0, real_type=0x21e49e0,
valaddr=0x409c670 "\020S~", offset=0, address=140737488336456, stream=0xde3930,
recurse=2, val=0x1dd2f00, options=0x7fffffffb520, dont_print_vb=0xdc12c0)
    at ../../gdb/cp-valprint.c:599
#7  0x00000000006a9a9c in cp_print_value_fields (type=0x21dcbf0,
real_type=0x21e49e0, valaddr=0x409c670 "\020S~", offset=0,
address=140737488336456, stream=0xde3930, recurse=1, val=0x1dd2f00,
options=0x7fffffffb520, dont_print_vb=0xdc12c0, 
    dont_print_statmem=0) at ../../gdb/cp-valprint.c:197
#8  0x00000000006aaf9d in cp_print_value (type=0x21e49e0, real_type=0x21e49e0,
valaddr=0x409c670 "\020S~", offset=0, address=140737488336456, stream=0xde3930,
recurse=1, val=0x1dd2f00, options=0x7fffffffb520, dont_print_vb=0x0)
    at ../../gdb/cp-valprint.c:599
#9  0x00000000006a9a9c in cp_print_value_fields (type=0x21e49e0,
real_type=0x21e49e0, valaddr=0x409c670 "\020S~", offset=0,
address=140737488336456, stream=0xde3930, recurse=0, val=0x1dd2f00,
options=0x7fffffffb520, dont_print_vb=0x0, 
    dont_print_statmem=0) at ../../gdb/cp-valprint.c:197
#10 0x00000000006aa766 in cp_print_value_fields_rtti (type=0x21e49e0,
valaddr=0x409c670 "\020S~", offset=0, address=140737488336456, stream=0xde3930,
recurse=0, val=0x1dd2f00, options=0x7fffffffb520, dont_print_vb=0x0,
dont_print_statmem=0)
    at ../../gdb/cp-valprint.c:452
#11 0x00000000006a8c06 in c_val_print_struct (type=0x21e49e0, valaddr=0x409c670
"\020S~", embedded_offset=0, address=140737488336456, stream=0xde3930,
recurse=0, original_value=0x1dd2f00, options=0x7fffffffb520) at
../../gdb/c-valprint.c:406
#12 0x00000000006a9012 in c_val_print (type=0x21e49e0, valaddr=0x409c670
"\020S~", embedded_offset=0, address=140737488336456, stream=0xde3930,
recurse=0, original_value=0x1dd2f00, options=0x7fffffffb520) at
../../gdb/c-valprint.c:526
#13 0x00000000005464fa in val_print (type=0x21e49e0, valaddr=0x409c670
"\020S~", embedded_offset=0, address=140737488336456, stream=0xde3930,
recurse=0, val=0x1dd2f00, options=0x7fffffffb5e0, language=0x8f4e00
<cplus_language_defn>)
    at ../../gdb/valprint.c:1009
#14 0x00000000006a966a in c_value_print (val=0x1dd2f00, stream=0xde3930,
options=0x7fffffffb760) at ../../gdb/c-valprint.c:689
#15 0x00000000005468b9 in value_print (val=0x1dd2f00, stream=0xde3930,
options=0x7fffffffb760) at ../../gdb/valprint.c:1125
#16 0x000000000054b0cc in print_formatted (val=0x1dd2f00, size=0,
options=0x7fffffffb760, stream=0xde3930) at ../../gdb/printcmd.c:315
#17 0x000000000054c5dd in print_value (val=0x1dd2f00, fmtp=0x7fffffffb7d0) at
../../gdb/printcmd.c:976
#18 0x000000000054c6c7 in print_command_1 (exp=0xd0d276 "i_conv_1.tdf_i",
voidprint=1) at ../../gdb/printcmd.c:1007
#19 0x000000000054c6f5 in print_command (exp=0xd0d276 "i_conv_1.tdf_i",
from_tty=1) at ../../gdb/printcmd.c:1015
#20 0x00000000004a3e0d in do_cfunc (c=0xd8eb80, args=0xd0d276 "i_conv_1.tdf_i",
from_tty=1) at ../../gdb/cli/cli-decode.c:105
#21 0x00000000004a6d88 in cmd_func (cmd=0xd8eb80, args=0xd0d276
"i_conv_1.tdf_i", from_tty=1) at ../../gdb/cli/cli-decode.c:1885
#22 0x00000000006bb251 in execute_command (p=0xd0d283 "i", from_tty=1) at
../../gdb/top.c:475
#23 0x00000000005a9027 in command_handler (command=0xd0d270 "print
i_conv_1.tdf_i") at ../../gdb/event-top.c:491
#24 0x00000000005a95e4 in command_line_handler (rl=0xf46320 "") at
../../gdb/event-top.c:690
#25 0x000000000072362f in rl_callback_read_char () at
../../readline/callback.c:220
#26 0x00000000005a8af8 in rl_callback_read_char_wrapper (client_data=0x0) at
../../gdb/event-top.c:171
#27 0x00000000005a8f57 in stdin_event_handler (error=0, client_data=0x0) at
../../gdb/event-top.c:430
#28 0x00000000005a7ba5 in handle_file_event (file_ptr=0xf4ee10, ready_mask=1)
at ../../gdb/event-loop.c:708
#29 0x00000000005a8143 in gdb_wait_for_event (block=1) at
../../gdb/event-loop.c:834
#30 0x00000000005a70b4 in gdb_do_one_event () at ../../gdb/event-loop.c:323
#31 0x00000000005a70f8 in start_event_loop () at ../../gdb/event-loop.c:347
#32 0x00000000005a8b2a in cli_command_loop (data=0x0) at
../../gdb/event-top.c:186
#33 0x000000000059fc28 in current_interp_command_loop () at
../../gdb/interps.c:317
#34 0x00000000005a073e in captured_command_loop (data=0x0) at
../../gdb/main.c:318
#35 0x000000000059ca44 in catch_errors (func=0x5a0723 <captured_command_loop>,
func_args=0x0, errstring=0x8bb1ba "", mask=RETURN_MASK_ALL) at
../../gdb/exceptions.c:240
#36 0x00000000005a1be0 in captured_main (data=0x7fffffffbd80) at
../../gdb/main.c:1157
#37 0x000000000059ca44 in catch_errors (func=0x5a0b58 <captured_main>,
func_args=0x7fffffffbd80, errstring=0x8bb1ba "", mask=RETURN_MASK_ALL) at
../../gdb/exceptions.c:240
#38 0x00000000005a1c09 in gdb_main (args=0x7fffffffbd80) at
../../gdb/main.c:1165
#39 0x0000000000405c0d in main (argc=2, argv=0x7fffffffbe88) at
../../gdb/gdb.c:32
(gdb)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]