public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17685] New: segmentation fault when trying to print a templated type
@ 2014-12-07 20:47 thomas at loockx dot be
  2014-12-07 20:47 ` [Bug c++/17685] " thomas at loockx dot be
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: thomas at loockx dot be @ 2014-12-07 20:47 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 17685
           Summary: segmentation fault when trying to print a templated
                    type
           Product: gdb
           Version: 7.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: thomas at loockx dot be

Created attachment 8001
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8001&action=edit
test file to reproduce the segmentation fault

Attached is an example program. Set a breakpoint in main and try to print out
test (p test). gdb will segfault.

I cleared my .gdbinit file so no weird settings.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/17685] segmentation fault when trying to print a templated type
  2014-12-07 20:47 [Bug c++/17685] New: segmentation fault when trying to print a templated type thomas at loockx dot be
@ 2014-12-07 20:47 ` thomas at loockx dot be
  2014-12-12 21:06 ` keiths at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: thomas at loockx dot be @ 2014-12-07 20:47 UTC (permalink / raw)
  To: gdb-prs

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

thomas at loockx dot be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thomas at loockx dot be

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/17685] segmentation fault when trying to print a templated type
  2014-12-07 20:47 [Bug c++/17685] New: segmentation fault when trying to print a templated type thomas at loockx dot be
  2014-12-07 20:47 ` [Bug c++/17685] " thomas at loockx dot be
@ 2014-12-12 21:06 ` keiths at redhat dot com
  2014-12-15  0:51 ` thomas at loockx dot be
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: keiths at redhat dot com @ 2014-12-12 21:06 UTC (permalink / raw)
  To: gdb-prs

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

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |keiths at redhat dot com

--- Comment #1 from Keith Seitz <keiths at redhat dot com> ---
(In reply to thomas from comment #0)
> Attached is an example program. Set a breakpoint in main and try to print
> out test (p test). gdb will segfault.

I've tried this on 7.8/HEAD here, and it works. However, there are a number of
possible issues that could be causing your problems.

Are you using python STL pretty-printers? Are they up to date?

The next thing to try is printing after the vector is initialized. If memory
serves, uninitialized STL containers sometimes cause problems for the
pretty-printers. Please add, e.g., a (cough, missing) "return 0;" at the end of
main. Stop on this line and try to print the vector again. What's the result?

Please fill in the host and target bugzilla fields (or provide output of "show
version" in a comment), that would help also narrow the focus of further
investigations.

Finally, if possible, please provide a stack backtrace of the segfault, it
would undoubtedly prove most enlightening.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/17685] segmentation fault when trying to print a templated type
  2014-12-07 20:47 [Bug c++/17685] New: segmentation fault when trying to print a templated type thomas at loockx dot be
  2014-12-07 20:47 ` [Bug c++/17685] " thomas at loockx dot be
  2014-12-12 21:06 ` keiths at redhat dot com
@ 2014-12-15  0:51 ` thomas at loockx dot be
  2014-12-15  0:52 ` thomas at loockx dot be
  2014-12-15  0:53 ` thomas at loockx dot be
  4 siblings, 0 replies; 6+ messages in thread
From: thomas at loockx dot be @ 2014-12-15  0:51 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from thomas at loockx dot be ---
Here's a less sloppy report.

GDB version used to reproduces the crash (downloaded and build from the
website):

thomas@thomas-work-pc:~/Downloads/gdb-7.8.1/gdb$ ./gdb --version
GNU gdb (GDB) 7.8.1
Copyright (C) 2014 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-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".

Here's a backtrace I captured by running the compiled gdb in the gdb on my
system (GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1):

Breakpoint 1, main (argc=1, argv=0x7fffffffde58) at gdb-crash.cpp:16
16          return 0;
(gdb) p test

Program received signal SIGSEGV, Segmentation fault.
0x00000000004f59c6 in value_entirely_optimized_out (value=0x0) at value.c:1261
1261      if (!value->optimized_out)
(gdb) bt
#0  0x00000000004f59c6 in value_entirely_optimized_out (value=0x0) at
value.c:1261
#1  0x000000000060a1fe in cp_print_static_field (options=<optimized out>,
recurse=<optimized out>, stream=<optimized out>, val=<optimized out>, type=0x0)
at cp-valprint.c:643
#2  cp_print_value_fields (type=<optimized out>, real_type=<optimized out>,
valaddr=<optimized out>, offset=<optimized out>, address=<optimized out>,
stream=<optimized out>, recurse=0, val=0xdd0000, 
    options=0x7fffffffd830, dont_print_vb=0x0, dont_print_statmem=0) at
cp-valprint.c:336
#3  0x000000000060a7e2 in cp_print_value_fields_rtti (type=0xc57480,
valaddr=0xd13a00 "", offset=0, address=140737488346464, stream=<optimized out>,
recurse=0, val=0xdd0000, options=0x7fffffffd830, 
    dont_print_vb=0x0, dont_print_statmem=0) at cp-valprint.c:456
#4  0x0000000000608cf7 in c_val_print (type=0xc57480, valaddr=<optimized out>,
embedded_offset=0, address=<optimized out>, stream=0xc40cc0, recurse=<optimized
out>, original_value=0xdd0000, 
    options=0x7fffffffd830) at c-valprint.c:394
#5  0x000000000050e66b in val_print (type=<optimized out>, valaddr=<optimized
out>, embedded_offset=<optimized out>, address=<optimized out>,
stream=<optimized out>, recurse=<optimized out>, val=0xdd0000, 
    options=0x7fffffffd8e0, language=0x7b1040 <cplus_language_defn>) at
valprint.c:790
#6  0x0000000000608870 in c_value_print (val=0xdd0000, stream=0xc40cc0,
options=<optimized out>) at c-valprint.c:585
#7  0x000000000051208e in print_command_1 (exp=0xb63192 "test",
voidprint=<optimized out>) at ./printcmd.c:997
#8  0x0000000000617dc0 in execute_command (p=0xb63190 "p test", from_tty=1) at
top.c:479
#9  0x00000000005573f5 in command_handler (command=0xb63190 "p test") at
event-top.c:484
#10 0x0000000000557ffc in command_line_handler (rl=<optimized out>) at
event-top.c:681
#11 0x0000000000664feb in rl_callback_read_char () at callback.c:220
#12 0x0000000000557469 in rl_callback_read_char_wrapper (client_data=0x0) at
event-top.c:167
#13 0x0000000000556264 in process_event () at event-loop.c:343
#14 0x00000000005571f4 in gdb_do_one_event () at event-loop.c:407
#15 0x0000000000557255 in start_event_loop () at event-loop.c:432
#16 0x000000000054fe93 in captured_command_loop (data=0x0) at main.c:303
#17 0x000000000054cb4b in catch_errors (func=<optimized out>,
func_args=<optimized out>, errstring=<optimized out>, mask=<optimized out>) at
exceptions.c:506
#18 0x0000000000550bc6 in captured_main (data=<optimized out>) at main.c:1164
#19 0x000000000054cb4b in catch_errors (func=<optimized out>,
func_args=<optimized out>, errstring=<optimized out>, mask=<optimized out>) at
exceptions.c:506
#20 0x000000000054fcfb in gdb_main (args=0xffffffff) at main.c:1172
#21 0x0000000000406d65 in main (argc=<optimized out>, argv=0xffffffff) at
gdb.c:33
(gdb) 

Looks to me that value is a NULL ptr.

I've attached the updated test program with a proper return statement.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/17685] segmentation fault when trying to print a templated type
  2014-12-07 20:47 [Bug c++/17685] New: segmentation fault when trying to print a templated type thomas at loockx dot be
                   ` (2 preceding siblings ...)
  2014-12-15  0:51 ` thomas at loockx dot be
@ 2014-12-15  0:52 ` thomas at loockx dot be
  2014-12-15  0:53 ` thomas at loockx dot be
  4 siblings, 0 replies; 6+ messages in thread
From: thomas at loockx dot be @ 2014-12-15  0:52 UTC (permalink / raw)
  To: gdb-prs

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

thomas at loockx dot be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #8001|0                           |1
        is obsolete|                            |

--- Comment #3 from thomas at loockx dot be ---
Created attachment 8012
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8012&action=edit
updated test file

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/17685] segmentation fault when trying to print a templated type
  2014-12-07 20:47 [Bug c++/17685] New: segmentation fault when trying to print a templated type thomas at loockx dot be
                   ` (3 preceding siblings ...)
  2014-12-15  0:52 ` thomas at loockx dot be
@ 2014-12-15  0:53 ` thomas at loockx dot be
  4 siblings, 0 replies; 6+ messages in thread
From: thomas at loockx dot be @ 2014-12-15  0:53 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from thomas at loockx dot be ---
Created attachment 8013
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8013&action=edit
full gdb session

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-15  0:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-07 20:47 [Bug c++/17685] New: segmentation fault when trying to print a templated type thomas at loockx dot be
2014-12-07 20:47 ` [Bug c++/17685] " thomas at loockx dot be
2014-12-12 21:06 ` keiths at redhat dot com
2014-12-15  0:51 ` thomas at loockx dot be
2014-12-15  0:52 ` thomas at loockx dot be
2014-12-15  0:53 ` thomas at loockx dot be

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).