This is the mail archive of the gdb-patches@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]

[PATCH 0/2] Demangler crash handler


Hi all,

A number of bugs have been filed recently because of segmentation
faults in the demangler.  While such crashes are a problem for all
demangler consumers, they are particularly nasty for GDB because they
prevent the user from debugging their program at all.

This patch series arranges for GDB to catch segmentation faults in the
demangler and recover from them gracefully.  A warning is printed the
first time a fault occurs.  Example sessions with and without these
patches are included below.

None of the wrapped code uses cleanups, so each caught failure will
leak a small amount of memory.  This is undesirable but I think the
benefits here outweigh this drawback.

Ok to commit?

Thanks,
Gary

-- 
http://gbenson.net/


The current situation:

  GNU gdb (GDB) 7.7.50.20140507-cvs
  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"...
  (gdb) file test
  Reading symbols from test...Segmentation fault (core dumped)

With these patches:

  GNU gdb (GDB) 7.7.50.20140508-cvs
  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"...
  (gdb) file test
  Reading symbols from test...
  warning: internal error: demangler failed with signal 11
  Unable to demangle '_QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z'
  This is a bug, please report it to the GDB maintainers.
  done.
  (gdb) b puts
  Breakpoint 1 at 0x400488
  (gdb) r
  Starting program: /home/gary/work/archer/demangle-crashcatcher/src/test
  warning: Skipping deprecated .gdb_index section in /usr/lib/debug/lib64/ld-2.12.so.debug.
  Do "set use-deprecated-index-sections on" before the file is read
  to use the section anyway.

  Breakpoint 1, _IO_puts (str=0x4006d8 "hello") at ioputs.c:35
  35	{
  (gdb) bt
  #0  _IO_puts (str=0x4006d8 "hello") at ioputs.c:35
  #1  0x00000000004005b2 in hello () at test.cc:6
  #2  0x00000000004005bd in _QueueNotification_QueueController__$4PPPPPPPM_A_INotice___Z () at test.cc:12
  #3  0x00000000004005d3 in main (argc=1, argv=0x7fffffffe618) at test.cc:18


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