[PATCH 0/6] Display GDB backtrace for internal errors

Andrew Burgess andrew.burgess@embecosm.com
Thu Aug 19 09:49:25 GMT 2021


This series does two things:

     1. Imports libbacktrace from gcc to present better backtraces of
     GDB when we hit a fatal signal, and

     2. Prints the backtrace when GDB hits an internal-error (e.g. an
     assert).

The hope here is to try an improve the quality of bug reports, instead
of just getting a report that GDB hit some assert in frame.c, or
value.c, we will (hopefully) have a backtrace included with the bug
report, which _might_ give developers a fighting chance at figuring
out what went wrong.

All feedback welcome,

Thanks,
Andrew

---

Andrew Burgess (6):
  gdb: use bool instead of int in struct internal_problem
  gdb: make use of std::string in utils.c
  gdb: Add a dependency between gdb and libbacktrace
  Copy in libbacktrace from gcc
  gdb: use libbacktrace to create a better backtrace for fatal signals
  gdb: print backtrace for internal error/warning

 Makefile.def                                  |     1 +
 Makefile.in                                   |     1 +
 gdb/Makefile.in                               |    16 +-
 gdb/NEWS                                      |     8 +
 gdb/bt-utils.c                                |   170 +
 gdb/bt-utils.h                                |    69 +
 gdb/config.in                                 |     3 +
 gdb/configure                                 |    32 +
 gdb/configure.ac                              |    23 +
 gdb/doc/gdb.texinfo                           |    13 +
 gdb/event-top.c                               |    47 +-
 .../gdb.base/bt-on-error-and-warning.exp      |   118 +
 gdb/testsuite/gdb.base/bt-on-fatal-signal.exp |    36 -
 gdb/utils.c                                   |   121 +-
 libbacktrace/ChangeLog                        |  1759 ++
 libbacktrace/ChangeLog.jit                    |    14 +
 libbacktrace/Makefile.am                      |   586 +
 libbacktrace/Makefile.in                      |  2528 +++
 libbacktrace/README                           |    23 +
 libbacktrace/aclocal.m4                       |   867 +
 libbacktrace/alloc.c                          |   167 +
 libbacktrace/allocfail.c                      |   136 +
 libbacktrace/allocfail.sh                     |   104 +
 libbacktrace/atomic.c                         |   113 +
 libbacktrace/backtrace-supported.h.in         |    66 +
 libbacktrace/backtrace.c                      |   129 +
 libbacktrace/backtrace.h                      |   206 +
 libbacktrace/btest.c                          |   501 +
 libbacktrace/config.h.in                      |   184 +
 libbacktrace/configure                        | 16893 ++++++++++++++++
 libbacktrace/configure.ac                     |   581 +
 libbacktrace/dwarf.c                          |  4056 ++++
 libbacktrace/edtest.c                         |   120 +
 libbacktrace/edtest2.c                        |    43 +
 libbacktrace/elf.c                            |  4919 +++++
 libbacktrace/fileline.c                       |   346 +
 libbacktrace/filetype.awk                     |    13 +
 .../install-debuginfo-for-buildid.sh.in       |    65 +
 libbacktrace/instrumented_alloc.c             |   114 +
 libbacktrace/internal.h                       |   380 +
 libbacktrace/macho.c                          |  1355 ++
 libbacktrace/mmap.c                           |   331 +
 libbacktrace/mmapio.c                         |   110 +
 libbacktrace/mtest.c                          |   410 +
 libbacktrace/nounwind.c                       |    66 +
 libbacktrace/pecoff.c                         |   935 +
 libbacktrace/posix.c                          |   104 +
 libbacktrace/print.c                          |    92 +
 libbacktrace/read.c                           |   110 +
 libbacktrace/simple.c                         |   108 +
 libbacktrace/sort.c                           |   108 +
 libbacktrace/state.c                          |    72 +
 libbacktrace/stest.c                          |   137 +
 libbacktrace/test_format.c                    |    55 +
 libbacktrace/testlib.c                        |   234 +
 libbacktrace/testlib.h                        |   110 +
 libbacktrace/ttest.c                          |   161 +
 libbacktrace/unittest.c                       |    92 +
 libbacktrace/unknown.c                        |    65 +
 libbacktrace/xcoff.c                          |  1606 ++
 libbacktrace/xztest.c                         |   508 +
 libbacktrace/ztest.c                          |   541 +
 62 files changed, 42760 insertions(+), 121 deletions(-)
 create mode 100644 gdb/bt-utils.c
 create mode 100644 gdb/bt-utils.h
 create mode 100644 gdb/testsuite/gdb.base/bt-on-error-and-warning.exp
 create mode 100644 libbacktrace/ChangeLog
 create mode 100644 libbacktrace/ChangeLog.jit
 create mode 100644 libbacktrace/Makefile.am
 create mode 100644 libbacktrace/Makefile.in
 create mode 100644 libbacktrace/README
 create mode 100644 libbacktrace/aclocal.m4
 create mode 100644 libbacktrace/alloc.c
 create mode 100644 libbacktrace/allocfail.c
 create mode 100755 libbacktrace/allocfail.sh
 create mode 100644 libbacktrace/atomic.c
 create mode 100644 libbacktrace/backtrace-supported.h.in
 create mode 100644 libbacktrace/backtrace.c
 create mode 100644 libbacktrace/backtrace.h
 create mode 100644 libbacktrace/btest.c
 create mode 100644 libbacktrace/config.h.in
 create mode 100755 libbacktrace/configure
 create mode 100644 libbacktrace/configure.ac
 create mode 100644 libbacktrace/dwarf.c
 create mode 100644 libbacktrace/edtest.c
 create mode 100644 libbacktrace/edtest2.c
 create mode 100644 libbacktrace/elf.c
 create mode 100644 libbacktrace/fileline.c
 create mode 100644 libbacktrace/filetype.awk
 create mode 100644 libbacktrace/install-debuginfo-for-buildid.sh.in
 create mode 100644 libbacktrace/instrumented_alloc.c
 create mode 100644 libbacktrace/internal.h
 create mode 100644 libbacktrace/macho.c
 create mode 100644 libbacktrace/mmap.c
 create mode 100644 libbacktrace/mmapio.c
 create mode 100644 libbacktrace/mtest.c
 create mode 100644 libbacktrace/nounwind.c
 create mode 100644 libbacktrace/pecoff.c
 create mode 100644 libbacktrace/posix.c
 create mode 100644 libbacktrace/print.c
 create mode 100644 libbacktrace/read.c
 create mode 100644 libbacktrace/simple.c
 create mode 100644 libbacktrace/sort.c
 create mode 100644 libbacktrace/state.c
 create mode 100644 libbacktrace/stest.c
 create mode 100644 libbacktrace/test_format.c
 create mode 100644 libbacktrace/testlib.c
 create mode 100644 libbacktrace/testlib.h
 create mode 100644 libbacktrace/ttest.c
 create mode 100644 libbacktrace/unittest.c
 create mode 100644 libbacktrace/unknown.c
 create mode 100644 libbacktrace/xcoff.c
 create mode 100644 libbacktrace/xztest.c
 create mode 100644 libbacktrace/ztest.c

-- 
2.25.4



More information about the Gdb-patches mailing list