binutils-gdb/gdbsupport
Pedro Alves 171fba11ab Make GDBserver abort on internal error in development mode
Currently, if GDBserver hits some internal assertion, it exits with
error status, instead of aborting.  This makes it harder to debug
GDBserver, as you can't just debug a core file if GDBserver fails an
assertion.  I've had to hack the code to make GDBserver abort to debug
something several times before.

I believe the reason it exits instead of aborting, is to prevent
potentially littering the filesystem of smaller embedded targets with
core files.  I think I recall Daniel Jacobowitz once saying that many
years ago, but I can't be sure.  Anyhow, that seems reasonable to me.

Since we nowadays have a distinction between development and release
modes, I propose to make GDBserver abort on internal error if in
development mode, while keeping the status quo when in release mode.

Thus, after this patch, in development mode, you get:

 $ ../gdbserver/gdbserver
 ../../src/gdbserver/server.cc:3711: A problem internal to GDBserver has been detected.
 captured_main: Assertion `0' failed.
 Aborted (core dumped)
 $

while in release mode, you'll continue to get:

 $ ../gdbserver/gdbserver
 ../../src/gdbserver/server.cc:3711: A problem internal to GDBserver has been detected.
 captured_main: Assertion `0' failed.
 $ echo $?
 1

I do not think that this requires a separate configure switch.

A "--target_board=native-extended-gdbserver" run on Ubuntu 20.04 ends
up with:

		 === gdb Summary ===

 # of unexpected core files      29
 ...

for me, of which 8 are GDBserver core dumps, 7 more than without this
patch.

Change-Id: I6861e08ad71f65a0332c91ec95ca001d130b0e9d
2022-06-27 13:55:36 +01:00
..
.dir-locals.el
.gitattributes
acinclude.m4 gdb: don't use -Wmissing-prototypes with g++ 2022-01-13 10:25:45 +00:00
aclocal.m4
agent.cc
agent.h
alt-stack.h
array-view.h
ax.def
block-signals.h
break-common.h
btrace-common.cc
btrace-common.h
buffer.cc
buffer.h
buildargv.h Move gdb_argv to gdbsupport 2022-01-18 10:14:42 -07:00
byte-vector.h
ChangeLog-2020-2021
check-defines.el
cleanups.cc
cleanups.h
common-debug.cc
common-debug.h
common-defs.h Consolidate definition of current_directory 2022-03-30 09:08:48 -06:00
common-exceptions.cc
common-exceptions.h Specialize std::hash for gdb_exception 2022-04-12 09:31:16 -06:00
common-gdbthread.h
common-inferior.cc
common-inferior.h
common-regcache.cc
common-regcache.h
common-types.h
common-utils.cc
common-utils.h
common.m4 Let std::thread check pass even without pthreads 2022-04-14 09:28:56 -06:00
compiler-type.m4 gdb: don't use -Wmissing-prototypes with g++ 2022-01-13 10:25:45 +00:00
config.in Make GDBserver abort on internal error in development mode 2022-06-27 13:55:36 +01:00
configure Make GDBserver abort on internal error in development mode 2022-06-27 13:55:36 +01:00
configure.ac Make GDBserver abort on internal error in development mode 2022-06-27 13:55:36 +01:00
create-version.sh
def-vector.h
default-init-alloc.h
eintr.h
enum-flags.h
environ.cc
environ.h
errors.cc
errors.h
event-loop.cc Reindent gdbsupport/event-loop.cc:handle_file_event 2022-05-16 19:58:08 +01:00
event-loop.h
event-pipe.cc Fix typo in last change. 2022-03-03 13:06:50 -08:00
event-pipe.h Avoid conflict with gnulib open/close macros. 2022-03-03 11:21:36 -08:00
fileio.cc
fileio.h
filestuff.cc
filestuff.h
filtered-iterator.h
format.cc
format.h
forward-scope-exit.h
function-view.h
gdb_assert.h
gdb_binary_search.h
gdb_file.h
gdb_locale.h
gdb_obstack.cc Move gdb obstack code to gdbsupport 2022-01-18 10:14:42 -07:00
gdb_obstack.h Move gdb obstack code to gdbsupport 2022-01-18 10:14:42 -07:00
gdb_optional.h
gdb_proc_service.h
gdb_ref_ptr.h
gdb_regex.cc gdbsupport/gdb_regex.cc: replace defs.h include with common-defs.h 2022-01-20 22:58:21 -05:00
gdb_regex.h Move gdb_regex to gdbsupport 2022-01-18 10:14:43 -07:00
gdb_select.h
gdb_setjmp.h
gdb_signals.h
gdb_splay_tree.h
gdb_string_view.h
gdb_string_view.tcc
gdb_sys_time.h
gdb_tilde_expand.cc gdb: use gdb_tilde_expand instead of gdb_tilde_expand_up in source_script_with_search 2022-04-18 15:48:03 -04:00
gdb_tilde_expand.h gdb: use gdb_tilde_expand instead of gdb_tilde_expand_up in source_script_with_search 2022-04-18 15:48:03 -04:00
gdb_unique_ptr.h gdb: add operator+= and operator+ overload for std::string 2022-02-25 17:50:22 +00:00
gdb_unlinker.h
gdb_vecs.cc
gdb_vecs.h
gdb_wait.cc
gdb_wait.h
gdb-dlfcn.cc
gdb-dlfcn.h
gdb-hashtab.cc Introduce gdb-hashtab module in gdbsupport 2022-01-18 10:14:43 -07:00
gdb-hashtab.h Introduce gdb-hashtab module in gdbsupport 2022-01-18 10:14:43 -07:00
gdb-safe-ctype.h
gdb-sigmask.h
gdb-xfree.h
hash_enum.h
host-defs.h
intrusive_list.h Make intrusive_list_node's next/prev private 2022-04-13 10:24:38 +01:00
iterator-range.h
job-control.cc
job-control.h
Makefile.am gdbsupport: Add an event-pipe class. 2022-02-22 11:22:14 -08:00
Makefile.in gdbsupport: Add an event-pipe class. 2022-02-22 11:22:14 -08:00
netstuff.cc
netstuff.h
new-op.cc
next-iterator.h
observable.h Move non-dependent gdb::observers::observable::visit_state outside template 2022-05-10 13:40:57 +01:00
offset-type.h
parallel-for.h Fix --disable-threading build 2022-05-10 08:15:40 -06:00
pathstuff.cc gdbsupport: fix path_join crash with -std=c++17 and -D_GLIBCXX_DEBUG 2022-05-19 08:04:13 -04:00
pathstuff.h gdbsupport/pathstuff.h: #include <array> explicitly for std::array<> 2022-04-25 17:06:09 -07:00
poison.h
preprocessor.h
print-utils.cc [gdbsupport] Fix UB in print-utils.cc:int_string 2022-05-23 14:50:02 +02:00
print-utils.h
ptid.cc
ptid.h
ptrace.m4
range-chain.h Finalize each cooked index separately 2022-05-26 07:35:30 -06:00
README
refcounted-object.h
reference-to-pointer-iterator.h
rsp-low.cc
rsp-low.h
run-time-clock.cc
run-time-clock.h
safe-iterator.h
safe-strerror.cc
scope-exit.h
scoped_fd.h
scoped_ignore_signal.h
scoped_ignore_sigttou.h
scoped_mmap.cc
scoped_mmap.h
scoped_restore.h
search.cc
search.h
selftest.cc gdbsupport/selftest: Allow lazy registration 2022-04-19 09:12:42 +01:00
selftest.h gdbsupport/selftest: Allow lazy registration 2022-04-19 09:12:42 +01:00
selftest.m4
signals-state-save-restore.cc
signals-state-save-restore.h
signals.cc
symbol.h
tdesc.cc
tdesc.h
thread-pool.cc Fix --disable-threading build 2022-05-10 08:15:40 -06:00
thread-pool.h Fix --disable-threading build 2022-05-10 08:15:40 -06:00
traits.h
underlying.h
valid-expr.h
version.h
warning.m4 gdb: don't use -Wmissing-prototypes with g++ 2022-01-13 10:25:45 +00:00
x86-xstate.h
xml-utils.cc
xml-utils.h

This is a helper library that is used by gdb and gdbserver.

To send patches, follow the gdb patch submission instructions in
../gdb/CONTRIBUTE.  For maintainers, see ../gdb/MAINTAINERS.