binutils-gdb/gdbsupport
Tom de Vries 735dfe028c [gdbsupport] Fix UB in print-utils.cc:int_string
When building gdb with -fsanitize=undefined, I run into:
...
(gdb) PASS: gdb.ada/access_to_packed_array.exp: set logging enabled on
maint print symbols^M
print-utils.cc:281:29:runtime error: negation of -9223372036854775808 cannot \
  be represented in type 'long int'; cast to an unsigned type to negate this \
  value to itself
(gdb) FAIL: gdb.ada/access_to_packed_array.exp: maint print symbols
...

By running in a debug session, we find that this happens during printing of:
...
   typedef system.storage_elements.storage_offset: \
     range -9223372036854775808 .. 9223372036854775807;
...
Possibly, an ada test-case could be created that exercises this in isolation.

The problem is here in int_string, where we negate a val with type LONGEST:
...
         return decimal2str ("-", -val, width);
...

Fix this by, as recommend, using "-(ULONGEST)val" instead.

Tested on x86_64-linux.
2022-05-23 14:50:02 +02:00
..
.dir-locals.el Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
.gitattributes
acinclude.m4 gdb: don't use -Wmissing-prototypes with g++ 2022-01-13 10:25:45 +00:00
aclocal.m4
agent.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
agent.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
alt-stack.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-view.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
ax.def Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
block-signals.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
break-common.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
btrace-common.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
btrace-common.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
buffer.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
buffer.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
buildargv.h Move gdb_argv to gdbsupport 2022-01-18 10:14:42 -07:00
byte-vector.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
ChangeLog-2020-2021
check-defines.el Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
cleanups.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
cleanups.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-debug.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-debug.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-defs.h Consolidate definition of current_directory 2022-03-30 09:08:48 -06:00
common-exceptions.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-exceptions.h Specialize std::hash for gdb_exception 2022-04-12 09:31:16 -06:00
common-gdbthread.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-inferior.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-inferior.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-regcache.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-regcache.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-types.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-utils.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-utils.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
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 Fix build on rhES5 2021-11-09 08:21:18 -07:00
configure Let std::thread check pass even without pthreads 2022-04-14 09:28:56 -06:00
configure.ac gdbsupport: Add an event-pipe class. 2022-02-22 11:22:14 -08:00
create-version.sh Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
def-vector.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
default-init-alloc.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
eintr.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
enum-flags.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
environ.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
environ.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
errors.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
errors.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
event-loop.cc Reindent gdbsupport/event-loop.cc:handle_file_event 2022-05-16 19:58:08 +01:00
event-loop.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
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 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
fileio.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
filestuff.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
filestuff.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
filtered-iterator.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
format.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
format.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
forward-scope-exit.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
function-view.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_assert.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_binary_search.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_file.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_locale.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
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 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_proc_service.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_ref_ptr.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
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 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_setjmp.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_signals.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_splay_tree.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_string_view.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_string_view.tcc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_sys_time.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
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 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_vecs.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_vecs.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_wait.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb_wait.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb-dlfcn.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb-dlfcn.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
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 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb-sigmask.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
gdb-xfree.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
hash_enum.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
host-defs.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
intrusive_list.h Make intrusive_list_node's next/prev private 2022-04-13 10:24:38 +01:00
iterator-range.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
job-control.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
job-control.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
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 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
netstuff.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
new-op.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
next-iterator.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
observable.h Move non-dependent gdb::observers::observable::visit_state outside template 2022-05-10 13:40:57 +01:00
offset-type.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
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 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
preprocessor.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
print-utils.cc [gdbsupport] Fix UB in print-utils.cc:int_string 2022-05-23 14:50:02 +02:00
print-utils.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
ptid.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
ptid.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
ptrace.m4 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
README
refcounted-object.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
reference-to-pointer-iterator.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
rsp-low.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
rsp-low.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
run-time-clock.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
run-time-clock.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
safe-iterator.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
safe-strerror.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
scope-exit.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
scoped_fd.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
scoped_ignore_signal.h gdb: don't pass nullptr to sigwait 2022-01-04 10:28:19 +00:00
scoped_ignore_sigttou.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
scoped_mmap.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
scoped_mmap.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
scoped_restore.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
search.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
search.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
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 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
signals-state-save-restore.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
signals-state-save-restore.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
signals.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
symbol.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
tdesc.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
tdesc.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
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 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
underlying.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
valid-expr.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
version.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
warning.m4 gdb: don't use -Wmissing-prototypes with g++ 2022-01-13 10:25:45 +00:00
x86-xstate.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
xml-utils.cc Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
xml-utils.h Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00

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.