GDB Administrator [Thu, 6 May 2021 00:00:37 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Wed, 5 May 2021 13:13:17 +0000 (15:13 +0200)]
[gdb/testsuite] Fix timeout in gdb.threads/detach-step-over.exp with readnow
When running test-case gdb.threads/detach-step-over.exp with target board
readnow, I run into:
...
Reading symbols from /lib64/libc.so.6...^M
Reading symbols from \
/usr/lib/debug/lib64/libc-2.26.so-2.26-lp152.26.6.1.x86_64.debug...^M
Expanding full symbols from \
/usr/lib/debug/lib64/libc-2.26.so-2.26-lp152.26.6.1.x86_64.debug...^M
FAIL: gdb.threads/detach-step-over.exp: \
breakpoint-condition-evaluation=host: target-non-stop=on: non-stop=on: \
displaced=off: iter 2: attach (timeout)
...
Fix this by doing exp_continue when encountering the "Reading symbols" or
"Expanding full symbols" lines.
This is still fragile and times out with a higher load, similated f.i. by
stress -c 5. Fix that by using a timeout factor of 2.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-05-05 Tom de Vries <tdevries@suse.de>
* gdb.threads/detach-step-over.exp: Do exp_continue when encountering
"Reading symbols" or "Expanding full symbols" lines. Using timeout
factor of 2 for attach.
Tom de Vries [Wed, 5 May 2021 07:07:27 +0000 (09:07 +0200)]
[gdb/testsuite] Fix gdb.threads/fork-plus-threads.exp with readnow
When running test-case gdb.threads/fork-plus-threads.exp with target board
readnow, I run into:
...
[LWP 9362 exited]^M
[New LWP 9365]^M
[New LWP 9363]^M
[New LWP 9364]^M
FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: \
inferior 1 exited (timeout)
...
There is code in the test-case to prevent timeouts with readnow:
...
-re "Thread \[^\r\n\]+ exited" {
# Avoid timeout with check-read1
exp_continue
}
-re "New Thread \[^\r\n\]+" {
# Avoid timeout with check-read1
exp_continue
}
...
but this doesn't trigger because we get LWP rather than Thread.
Fix this by making these regexps accept LWP as well.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-05-05 Tom de Vries <tdevries@suse.de>
* gdb.threads/fork-plus-threads.exp: Handle "New LWP <n>" and
"LWP <n> exited" messages.
Alan Modra [Wed, 5 May 2021 04:03:00 +0000 (13:33 +0930)]
asan: stack-buffer-overflow vms-lib.c:367
* vms-lib.c (vms_traverse_index): Account for vms_kbn size when
sanity checking keylen.
Mike Frysinger [Wed, 5 May 2021 02:56:31 +0000 (22:56 -0400)]
sim: rl78: clean up various warnings
A random grab bag of minor fixes to enable -Werror for this port.
Fix local prototypes for a bunch of functions (e.g. adding static).
Add missing includes for missing prototypes.
Move local variable decls from the middle of functions to the top
of the scope.
Fix a logic error when processing commands where p was reassigned
to cmd and then has its leading whitespace scanned a 2nd time.
Handle short reads with fread().
Simon Marchi [Wed, 5 May 2021 02:19:05 +0000 (22:19 -0400)]
gdb: update Type.fields doc based on actual GDB behavior
I noticed two errors in the Type.fields documentation:
1. It is possible to call `fields` on an array type, in which case it
returns one field representing the array's range. It is not
mentioned.
2. When calling `fields` on a type that doesn't have fields (by nature,
like an int), GDB raises a TypeError. It does not return an empty
sequence, as currently documented.
Fix these, and change the text into a bullet list. I find it easier to
read than one big paragraph.
The first issue is already tested in gdb.python/py-type.exp, but the
second one doesn't seem tested. Add a test in gdb.python/py-type.exp
for it.
gdb/doc/ChangeLog:
* python.texi (Types In Python): Re-organize Type.fields doc.
Mention handling of array types. Correct doc for when calling
the method on another type.
gdb/testsuite/ChangeLog:
* gdb.python/py-type.exp (test_fields): Test calling fields on
an int type.
Change-Id: I11c688177504cb070b81a4446ac91dec50b56a22
Mike Frysinger [Sun, 2 May 2021 02:37:49 +0000 (22:37 -0400)]
sim: m68hc11: tweak types to fix warnings
The hw attach API wants unsigned addresses.
The write API wants signed chars.
Mike Frysinger [Wed, 5 May 2021 02:03:37 +0000 (22:03 -0400)]
sim: mips: include stdlib.h for memory prototypes
This file uses free() and friends, so include it to fix missing
prototype warnings.
Mike Frysinger [Tue, 4 May 2021 12:39:17 +0000 (08:39 -0400)]
sim: mips: always enable device models
There's no need to restrict these to only specific targets as the user
can select them at runtime if they want them. Always build them so we
can improve build coverage too.
Mike Frysinger [Tue, 4 May 2021 12:38:29 +0000 (08:38 -0400)]
sim: mips: delete unused constant variables
Since these never change, inline and delete them.
Mike Frysinger [Tue, 4 May 2021 12:35:40 +0000 (08:35 -0400)]
sim: mcore: fix build time warnings
Once we fix a minor const warning we can enable -Werror in here.
Mike Frysinger [Tue, 4 May 2021 12:33:24 +0000 (08:33 -0400)]
sim: remove sys/times.h in most places
The v850 port used this, and then it got copied to other ports even
though it wasn't needed. Clean it up to avoid portability issues on
platforms not providing this (e.g. mingw64 for Windows).
Mike Frysinger [Sun, 2 May 2021 01:17:12 +0000 (21:17 -0400)]
sim: mips: fix qh_acc table
The AccAddLQH func was unused, and looking at this table, it looks
like it's due to a typo.
Mike Frysinger [Sun, 2 May 2021 03:37:35 +0000 (23:37 -0400)]
sim: hw: localize init callback
Now that we don't need to hardcode the module init list in a single
place, move the hw init logic out to the sim-hw file.
Mike Frysinger [Tue, 27 Apr 2021 03:17:15 +0000 (23:17 -0400)]
sim: microblaze: enable some basic trace points
This isn't super complete, but it's useful enough as-is.
Mike Frysinger [Tue, 27 Apr 2021 03:14:11 +0000 (23:14 -0400)]
sim: microblaze: hook up libgloss syscalls
When in the virtual environment, have brki 8 trigger libgloss syscalls
like other ports. This also matches the ABI that Linux uses for its
syscalls (ignoring the syscall table differences).
Alan Modra [Wed, 5 May 2021 01:05:31 +0000 (10:35 +0930)]
PowerPC undefweak testcase
Test for commit
4916030821bb and
b293661219c3.
* testsuite/ld-powerpc/empty.s: New file.
* testsuite/ld-powerpc/undefweak.d,
* testsuite/ld-powerpc/undefweak.s: New testcase.
* testsuite/ld-powerpc/powerpc.exp: Run it.
GDB Administrator [Wed, 5 May 2021 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 4 May 2021 14:56:12 +0000 (08:56 -0600)]
Add missing stdlib.h includes to sim
This updates the various "mloop.in" files to emit an include of
stdlib.h, to avoid warnings about 'abort' being undeclared.
One such warning now remains, in mn10300.igen. I don't know offhand
the best way to fix this one.
2021-05-04 Tom Tromey <tromey@adacore.com>
* mloop.in: Include <stdlib.h>.
sim/iq2000/ChangeLog
2021-05-04 Tom Tromey <tromey@adacore.com>
* mloop.in: Include <stdlib.h>.
sim/lm32/ChangeLog
2021-05-04 Tom Tromey <tromey@adacore.com>
* mloop.in: Include <stdlib.h>.
sim/m32r/ChangeLog
2021-05-04 Tom Tromey <tromey@adacore.com>
* mloop.in: Include <stdlib.h>.
sim/or1k/ChangeLog
2021-05-04 Tom Tromey <tromey@adacore.com>
* mloop.in: Include <stdlib.h>.
Tom Tromey [Tue, 4 May 2021 14:45:46 +0000 (08:45 -0600)]
Fix igen build
The igen build fails for me like:
gcc -g -O2 -c ../../binutils-gdb/sim/igen/igen.c -o igen/igen.o
In file included from ../../binutils-gdb/sim/igen/igen.c:26:
../../binutils-gdb/sim/igen/lf.h:22:10: fatal error: ansidecl.h: No such file or directory
This patch fixes the problem by arranging for igen to find the
libiberty includes.
This seems slightly hacky to me, because libiberty is not a "build"
library, so it can't be linked against. However, since igen currently
only includes the header, it seems relatively safe.
2021-05-04 Tom Tromey <tromey@adacore.com>
* Makefile.in: Rebuild.
* Makefile.am (AM_CPPFLAGS): New variable.
Tom Tromey [Tue, 4 May 2021 14:37:13 +0000 (08:37 -0600)]
Add config.h to generated_files for sim
I noticed that config.h isn't in 'generated_files' in the sim
subdirectories. This causes it to sometimes be rebuilt too late.
2021-05-04 Tom Tromey <tromey@adacore.com>
* Make-common.in (generated_files): Add config.h.
Mike Frysinger [Sun, 2 May 2021 16:05:44 +0000 (12:05 -0400)]
gnulib: import gendocs
This will be used to generate more complete docs for the binutils site.
Mike Frysinger [Sat, 1 May 2021 22:00:27 +0000 (18:00 -0400)]
gnulib: import getline
We use getline in sim today which breaks on older systems that are
not compliant with the latest POSIX standard. For example, mingw64
for Windows omits getline so we fail to build there.
Simon Marchi [Tue, 4 May 2021 15:20:09 +0000 (11:20 -0400)]
gdb/testsuite: adjust gdb.python/flexible-array-member.exp expected pattern
The `Type.range ()` tests in gdb.python/flexible-array-member.exp pass
when the test is compiled with gcc 9 or later, but not with gcc 8 or
earlier:
$ make check TESTS="gdb.python/flexible-array-member.exp" RUNTESTFLAGS="CC_FOR_TARGET='gcc-8'"
python print(zs['items'].type.range())^M
(0, 0)^M
(gdb) FAIL: gdb.python/flexible-array-member.exp: python print(zs['items'].type.range())
python print(zso['items'].type.range())^M
(0, 0)^M
(gdb) FAIL: gdb.python/flexible-array-member.exp: python print(zso['items'].type.range())
The value that we get for the upper bound of a flexible array member
declared with a "0" size is 0 with gcc <= 8 and is -1 for gcc >= 9.
This is due to different debug info. For this member, gcc 8 does:
0x000000d5: DW_TAG_array_type
DW_AT_type [DW_FORM_ref4] (0x00000034 "int")
DW_AT_sibling [DW_FORM_ref4] (0x000000e4)
0x000000de: DW_TAG_subrange_type
DW_AT_type [DW_FORM_ref4] (0x0000002d "long unsigned int")
For the same type, gcc 9 does:
0x000000d5: DW_TAG_array_type
DW_AT_type [DW_FORM_ref4] (0x00000034 "int")
DW_AT_sibling [DW_FORM_ref4] (0x000000e5)
0x000000de: DW_TAG_subrange_type
DW_AT_type [DW_FORM_ref4] (0x0000002d "long unsigned int")
DW_AT_count [DW_FORM_data1] (0x00)
Ideally, GDB would present a consistent and documented value for an
array member declared with size 0, regardless of how the debug info
looks like. But for now, just change the test to accept the two
values, to get rid of the failure and make the test in sync
I also realized (by looking at the py-type.exp test) that calling the
fields method on an array type yields one field representing the "index"
of the array. The type of that field is of type range
(gdb.TYPE_CODE_RANGE). When calling `.range()` on that range type, it
yields the same range tuple as when calling `.range()` on the array type
itself. For completeness, add some tests to access the range tuple
through that range type as well.
gdb/testsuite/ChangeLog:
* gdb.python/flexible-array-member.exp: Adjust expected range
value for member declared with 0 size. Test accessing range
tuple through range type.
Change-Id: Ie4e06d99fe9315527f04577888f48284d649ca4c
Nick Clifton [Tue, 4 May 2021 13:29:04 +0000 (14:29 +0100)]
Define bfd_realloc(ptr,0) to return allocated memory, whilst bfd_realloc_or_free(ptr,0) frees ptr.
* libbfd.c (bfd_malloc): Provide some documenation. Treat a size
of 0 as 1.
(bfd_realloc): Likewise.
(bfd_zmalloc): Likewise.
(bfd_realloc_or_free): Provide some documentation. Treat a size
of 0 as a request to free.
* libbfd-in.h (bfd_realloc): Remove prototype.
(bfd_realloc_or_free): Remove prototype.
(bfd_zmalloc): Remove prototype.
* libbfd.h: Regenerate.
Nick Clifton [Tue, 4 May 2021 12:40:34 +0000 (13:40 +0100)]
Replace AC_PROG_CC with AC_PROG_CC_C99 in top level configure file.
2021-05-04 Nick Clifton <nickc@redhat.com>
* configure.ac (AC_PROG_CC): Replace with AC_PROG_CC_C99.
* configure: Regenerate.
Mike Frysinger [Sat, 1 May 2021 21:16:23 +0000 (17:16 -0400)]
sim: add support for build-time ar & ranlib
This is needed when building for a target whose ar & ranlib are
incompatible with the current build system. For example, building
for Windows on a Linux system.
Then manually import the automake rule for libigen.a, but tweak the
tool variables to use the FOR_BUILD variants.
Mike Frysinger [Tue, 4 May 2021 03:27:16 +0000 (23:27 -0400)]
sim: clean up bfd_vma printing
A lot of this code predates the bfd_vma format define, so we have a
random mix of casts to known types so we can printf the value. Use
the BFD_VMA_FMT that now exists to simplify and reliability output
across different build configs.
Tom de Vries [Tue, 4 May 2021 08:26:16 +0000 (10:26 +0200)]
[gdb/guile] Don't allow libguile to change libgmp mem fns
Since gdb commit
880ae75a2b7 "gdb delay guile initialization until
gdbscm_finish_initialization" I'm running into:
...
(gdb) print My_Var > 10.0^M
free(): invalid pointer^M
ERROR: GDB process no longer exists
GDB process exited with wait status 5995 exp9 0 0 CHILDKILLED SIGABRT SIGABRT
UNRESOLVED: gdb.ada/fixed_cmp.exp: gnat_encodings=all: print My_Var > 10.0
...
The problem is that both gdb and libguile try to set the libgmp memory functions,
and since the gdb commit the ones from libguile are effective, which results
in gdb freeing some memory in a way that is not compatible with the way that
memory was actually allocated.
The fact that libguile tries to set the libgmp memory functions is a bug which
should be fixed starting version v3.0.6.
Meanwhile, work around this in gdb by not allowing libguile to set the libgomp
memory functions.
Tested on x86_64-linux.
gdb/ChangeLog:
2021-05-04 Tom de Vries <tdevries@suse.de>
PR guile/27806
* guile/guile.c (gdbscm_initialize): Don't let guile change libgmp
memory functions.
GDB Administrator [Tue, 4 May 2021 00:00:34 +0000 (00:00 +0000)]
Automatic date update in version.in
Jim Wilson [Mon, 3 May 2021 23:19:17 +0000 (16:19 -0700)]
RISC-V: PR27764, Add tests for A extension
ChangeLog entry for last patch.
Christoph Muellner [Wed, 21 Apr 2021 22:28:27 +0000 (00:28 +0200)]
RISC-V: PR27764, Add tests for A extension
gas/
PR 27764
* testsuite/gas/riscv/a-ext-64.d: New testcase.
* testsuite/gas/riscv/a-ext-64.s: Likewise.
* testsuite/gas/riscv/a-ext.d: Likewise.
* testsuite/gas/riscv/a-ext.s: Likewise.
Signed-off-by: Christoph Muellner <cmuellner@gcc.gnu.org>
Tom Tromey [Mon, 3 May 2021 14:57:46 +0000 (08:57 -0600)]
Fix x86_64 mingw build
PR build/27807 points out that my recent changes to the Windows port
missed a spot in win32-i386-low.cc -- a call to
win32_Wow64GetThreadContext remained, causing link errors in
gdbserver. This happened because I tested an i686 build, but this
code is only used on an x86_64 build.
This patch fixes the bug. I am checking it in.
gdbserver/ChangeLog
2021-05-03 Tom Tromey <tromey@adacore.com>
PR build/27807:
* win32-i386-low.cc (i386_get_thread_context): Call
Wow64GetThreadContext, not win32_Wow64GetThreadContext.
Simon Marchi [Mon, 3 May 2021 14:54:08 +0000 (10:54 -0400)]
sim: add ATTRIBUTE_PRINTF / ATTRIBUTE_NULL_PRINTF where necessary
I finally got the all-targets sim building with Clang, these are all the
instances where an ATTRIBUTE_PRINTF or ATTRIBUTE_NULL_PRINTF attribute
needed to be added to avoid errors like:
/home/simark/src/binutils-gdb/sim/aarch64/../common/sim-profile.c:464:19: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
vfprintf (fp, fmt, ap);
^~~
There are more fixes needed to get everything building, but adding these
attributes is trivial enough, so I send them all in a single patch.
Adding the format attributes introduces some format string errors when
building with GCC (because now format strings are checked), so
corresponding changes are needed to avoid breaking the build. Other
than simple format string specified changes, there is this one:
/home/simark/src/binutils-gdb/sim/aarch64/../common/hw-events.c: In function 'hw_event_queue_schedule':
/home/simark/src/binutils-gdb/sim/aarch64/../common/hw-events.c:95:15: error: too many arguments for format [-Werror=format-extra-args]
95 | NULL, dummy);
| ^~~~~
We can fix it and avoid using a dummy variable by simply calling
hw_event_queue_schedule_tracef instead of
hw_event_queue_schedule_vtracef.
sim/arm/ChangeLog:
* armdefs.h (ARMul_ConsolePrint): Use format attribute.
* wrapper.c (op_printf): Likewise.
sim/bfin/ChangeLog:
* interp.c (sim_open): Adjust format string specifier.
sim/common/ChangeLog:
* hw-events.h (hw_event_queue_schedule_tracef): Use format attribute.
(hw_event_queue_schedule_vtracef): Likewise.
* hw-tree.h (hw_tree_vparse): Likewise.
* sim-profile.c (profile_vprintf): Likewise.
* sim-trace.c (dis_printf): Likewise.
* sim-trace.h (trace_printf): Likewise.
(trace_vprintf): Likewise.
* sim-utils.h (sim_do_commandf): Likewise.
* hw-events.c (hw_event_queue_schedule): Use
hw_event_queue_schedule_tracef.
sim/rx/ChangeLog:
* trace.c (op_printf): Likewise.
sim/v850/ChangeLog:
* interp.c (sim_open): Adjust format string specifier.
Change-Id: I1445115ce57db15bb8e35dca93014555e7555794
Jan Beulich [Mon, 3 May 2021 11:28:30 +0000 (13:28 +0200)]
x86: allow @secrel32 also in data definitions
Now that lex_got() is uniform for all targets using it, permit COFF
targets to also use @secrel32 with, in particular, .long. This is more
natural than the custom .secrel32 directive, and also allows more
flexibility (the "+six" form of the two added test lines doesn't work
with a .secrel32 equivalent, in that it silently produces an unintended
relocation type).
As an extra benefit this also makes sure that data definitions in Intel
syntax mode would get treated like they do for e.g. ELF targets.
Jan Beulich [Mon, 3 May 2021 11:27:47 +0000 (13:27 +0200)]
x86: use UNIX EOL in secrel testcase
For some reason these were using Windows EOL.
Jan Beulich [Mon, 3 May 2021 11:26:41 +0000 (13:26 +0200)]
x86: fold both instances of lex_got()
I see no reason at all for us to carry two copies of almost identical
code. The differences, apart from the table entries, are benign. And
the #ifdef-ary doesn't really get any worse.
Jan Beulich [Mon, 3 May 2021 11:25:12 +0000 (13:25 +0200)]
x86: don't request useless overflow checking
Relocations with a bitsize matching the architecture's address width
can't usefully use an overflow checking approach other than "dont" or
"signed": All others involve perhaps complex calculations in
_bfd_relocate_contents() (or, not as severe, in bfd_check_overflow())
without ever finding anything to complain about - because of the address
width masking applied. Avoid this unnecessary overhead and switch all
such reloc types to "dont".
Note that "signed" checking with rela relocations (i.e. x86-64 here) is
only going to be useful if the addend actually got passed to
_bfd_relocate_contents() (and maybe others) instead of bogusly adding in
prior section contents (which apparently is assumed to be zero, and
hence again no overflow would ever be detected). See
https://sourceware.org/pipermail/binutils/2021-April/116164.html.
Andrew Burgess [Thu, 29 Apr 2021 09:11:35 +0000 (10:11 +0100)]
gdb/testsuite: update expected results in gdb.python/py-startup-opt.exp
The test gdb.python/py-startup-opt.exp checks the behaviour of GDB's:
set python dont-write-bytecode on
This flag (when on) stops Python creating .pyc files. The test first
checks that .pyc files will be created, then turns this option on and
checks .pyc files will not be created.
However, if the user has PYTHONDONTWRITEBYTECODE set in their
environment then this will prevent Python from creating .pyc files, as
such the first test, that .pyc files are being created, currently
fails.
We could unset PYTHONDONTWRITEBYTECODE, however, until Python 3.8
there is no way to control where Python writes the .pyc files. As the
GDB developer clearly doesn't want .pyc files created in their
file-system it feels wrong to silently unset this environment
variable.
My proposal then, is that we just spot when this environment variable
is set and adjust the expected results. My hope is that across all
GDB developers some will be running with PYTHONDONTWRITEBYTECODE
unset, so this feature will be fully tested at least some of the time.
gdb/testsuite/ChangeLog:
PR testsuite/27788
* gdb.python/py-startup-opt.exp (test_python_settings): Change the
expected results when environment variable PYTHONDONTWRITEBYTECODE
is set.
Alan Modra [Mon, 3 May 2021 02:58:46 +0000 (12:28 +0930)]
PPC: undefweak dynamic relocs
This makes the default for ppc to keep dynamic relocs on undefweak
symbols when the code won't cause DT_TEXTREL (for instance when -fPIE
or -fPIC). If ld is given -z dynamic-undefined-weak then dynamic
relocations will be created for non-PIC at the expense of possibly
causing DT_TEXTREL to be set on ppc32. Note that DT_TEXTREL and GNU
indirect functions are incompatible.
* elf32-ppc.c (allocate_dynrelocs): Keep dyn_relocs for undefweak
symbols when -z dynamic-undefined-weak or when there are no
dynamic relocs in read-only sections and -z nodynamic-undefined-weak
is not given.
* elf64-ppc.c (allocate_dynrelocs): Likewise.
Alan Modra [Mon, 3 May 2021 00:33:06 +0000 (10:03 +0930)]
PPC: ensure_undef_dynamic on weak undef only in plt
It's slightly weird to have a call to a weak function not protected by
a test of that function being non-NULL, but the non-NULL test might be
covered by a test of another function. For example:
if (func1)
{
func1 ();
func2 ();
}
where func2 is known to exist if func1 exists.
* elf32-ppc.c (allocate_dynrelocs): Call ensure_undef_dynamic for
weak undefined symols that only appear on PLT relocs.
* elf64-ppc.c (allocate_dynrelocs): Likewise.
Alan Modra [Mon, 3 May 2021 04:07:00 +0000 (13:37 +0930)]
PR27755, powerpc-ld infinite loop
PR 27755
* elf32-ppc.c (ppc_elf_inline_plt): Do increment rel in loop.
Alan Modra [Sun, 2 May 2021 22:27:39 +0000 (07:57 +0930)]
csky: fix annobin test fails
* elf32-csky.c (is_mapping_symbol_name): New function.
(csky_elf_is_target_special_symbol): Likewise.
(csky_elf_maybe_function_sym): Likewise.
(bfd_elf32_bfd_is_target_special_symbol): Define.
(elf_backend_maybe_function_sym): Define.
Alan Modra [Sun, 2 May 2021 22:20:03 +0000 (07:50 +0930)]
testsuite: Don't start directives in first column
Fixes fails on hppa64-hp-hpux11.23
* testsuite/gas/elf/section25.s: Don't start directives in first
column.
* testsuite/gas/elf/section26.s: Likewise.
Alan Modra [Sun, 2 May 2021 22:14:23 +0000 (07:44 +0930)]
Re: section symbols without a name
commit
23356397449 changed this file but missed one place.
* testsuite/ld-s390/tlspic_64.rd: Adjust expected output for
named section symbols.
GDB Administrator [Mon, 3 May 2021 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sun, 2 May 2021 15:04:58 +0000 (11:04 -0400)]
sim: add default cases to two switches in sim-options.c
This is the next compilation error I hit when I build all targets with
Clang:
/home/simark/src/binutils-gdb/sim/aarch64/../common/sim-options.c:234:12: error: no case matching constant switch condition '0' [-Werror] switch (WITH_ENVIRONMENT)
^~~~~~~~~~~~~~~~ ./config.h:215:26: note: expanded from macro 'WITH_ENVIRONMENT'
#define WITH_ENVIRONMENT ALL_ENVIRONMENT ^~~~~~~~~~~~~~~
/home/simark/src/binutils-gdb/sim/aarch64/../common/sim-options.c:276:15: error: no case matching constant switch condition '0' [-Werror] switch (WITH_ALIGNMENT)
^~~~~~~~~~~~~~ /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-config.h:220:24: note: expanded from macro 'WITH_ALIGNMENT'
#define WITH_ALIGNMENT 0
^
This is a little bit special because these are switches on compile-time
value. But regardless, the idea is that we logically can't reach the
switches if WITH_ENVIRONMENT == 0 or WITH_ALIGNMENT == 0, so the code is
correct.
In addition to getting rid of the compiler warning, adding default cases
to these switches ensure that if we do get in an unexpected situation,
it is caught. In GDB, I'd use gdb_assert_not_reached, I don't know if
there is something similar in sim so I went with abort.
sim/common/ChangeLog:
* sim-options.c (standard_option_handler): Add default cases to
switches.
Change-Id: Ie237d67a201caa6b72de0d17cc815193417156b6
Mike Frysinger [Sun, 2 May 2021 04:07:21 +0000 (00:07 -0400)]
sim: replace custom attributes with ansidecl.h
A lot of this code predates the common attributes. We had already
started migrating over piece by piece, so just do a pass across all
the attributes and replace most of them.
Mike Frysinger [Sat, 2 Jan 2016 15:54:42 +0000 (10:54 -0500)]
sim: bfin: move option inits to respective modules
Now that modules can self declare their own init funcs, change the mmu
and mach logic to use it. We don't need to export the option symbols
or specifically call this logic from the sim_open function anymore.
Mike Frysinger [Sun, 2 May 2021 03:04:01 +0000 (23:04 -0400)]
sim: options: fix --help output
The hash table rewrite broke --help output due to subtle behavior:
calling dup_arg_p(NULL) will create & clear the table, not just
create it. The --help output relies on this to clear the table
before it shows things.
Mike Frysinger [Sat, 2 Jan 2016 15:53:03 +0000 (10:53 -0500)]
sim: dv-sockser: localize init callback
Now that we don't need to hardcode the module init list in a single
place, move the dv-sockser logic to the place to the one file.
Mike Frysinger [Sun, 2 May 2021 01:16:17 +0000 (21:16 -0400)]
sim: mips: mark local func static
Mike Frysinger [Sat, 2 Jan 2016 15:50:46 +0000 (10:50 -0500)]
sim: add framework for declaring init callbacks locally
To facilitate decentralized module initialization/registration with an
eye towards multi-target support, add a framework to detect init calls
declared in the source and automatically call them. This is akin to
gdb's _initialize_xxx framework for letting modules autodiscover.
GDB Administrator [Sun, 2 May 2021 00:00:30 +0000 (00:00 +0000)]
Automatic date update in version.in
Mike Frysinger [Sat, 1 May 2021 20:30:59 +0000 (16:30 -0400)]
sim: nrun: add local strsignal prototype
While libiberty provides a definition for this for systems that lack
the function (e.g. Windows), it doesn't provide a prototype. So add
our own local copy in the one file that uses the func.
Mike Frysinger [Sat, 1 May 2021 20:03:10 +0000 (16:03 -0400)]
sim: rx: cast bfd_vma when printing
A bit of a hack, but it's what we've been doing so far when printing
bfd_vma's since bfd doesn't provide PRI helper types for us to use.
Mike Frysinger [Sat, 1 May 2021 19:58:09 +0000 (15:58 -0400)]
sim: riscv: fix building on 32-bit hosts w/out int128
Check for __SIZEOF_INT128__ before trying to use the builtin type.
This fixes building on some 32-bit systems like x86.
Mike Frysinger [Sat, 1 May 2021 19:54:33 +0000 (15:54 -0400)]
sim: aarch64: use PRIx64 for formatting 64-bit types
We can't assume that %lx is big enough for 64-bit types as it isn't on
most 32-bit builds. Use the standard format define for this instead.
Mike Frysinger [Sat, 1 May 2021 19:51:37 +0000 (15:51 -0400)]
sim: aarch64: fix 64-bit immediate shifts
Trying to shift immediates 63 bits fails on 32-bit systems since UL
is only 32-bits, not 64-bits. Switch to ULL to guarantee at least
64-bits here.
Mike Frysinger [Sat, 24 Apr 2021 16:51:46 +0000 (12:51 -0400)]
sim: arm: move build logic to source files
This simplifies the build logic a bit by just having source file
inputs. It also simplifies code that assumes there's a source
file for each object.
Mike Frysinger [Sat, 24 Apr 2021 18:28:17 +0000 (14:28 -0400)]
sim: callback: inline wrap helper
This is annoying as it requires inlining boiler plate, but we don't
have much choice: the wrap helper assumes the return value is always
an int, but that's already not the case with some of the callbacks
which use long. GCC has extensions to define macros-as-functions,
but we can't assume GCC.
Max Filippov [Sat, 1 May 2021 09:22:19 +0000 (02:22 -0700)]
opcodes: xtensa: support branch visualization
2021-05-01 Max Filippov <jcmvbkbc@gmail.com>
opcodes/
* xtensa-dis.c (print_insn_xtensa): Fill in info->insn_type and
info->insn_info_valid.
GDB Administrator [Sat, 1 May 2021 00:00:31 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Fri, 30 Apr 2021 20:07:58 +0000 (14:07 -0600)]
Do not separately read type units
Currently, the DWARF reader has a separate pass to read type units --
create_all_type_units. While working on other patches, I discovered
that this caused DWARF 5 type units to be read twice, once by
create_all_comp_units and once by create_all_type_units.
There's no need any more (if there ever was) to treat type units
differently from CUs. So, this patch removes create_all_type_units
and unifies the code paths.
Note that the DWO code still has a second pass. I haven't looked into
this code yet; perhaps it can also be simplified.
Regression tested using the debug-types board file on x86-64 Fedora 32.
gdb/ChangeLog
2021-04-30 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (dwarf2_initialize_objfile): Update.
(add_signatured_type_cu_to_table): Remove.
(create_debug_type_hash_table): Assume dwo_file is non-null.
(create_debug_types_hash_table): Update comment.
(create_all_type_units): Remove.
(sort_tu_by_abbrev_offset): Update comment.
(build_type_psymtabs): Rename from build_type_psymtabs_1.
(build_type_psymtabs): Remove.
(process_skeletonless_type_unit, dwarf2_build_psymtabs_hard):
Update.
(read_comp_units_from_section): Add types_htab, section_kind
parameters.
(create_all_comp_units): Read type units.
Tom Tromey [Fri, 30 Apr 2021 20:07:58 +0000 (14:07 -0600)]
Remove dwarf2_per_bfd::all_type_units
I don't think there is any deep reason to separate CUs and TUs in
dwarf2_per_bfd. This patch removes all_type_units and unifies these
two containers. Some minor tweaks are needed to the index writers,
because both forms of index keep CUs and TUs separate;
Regression tested on x86-63 Fedora 32.
gdb/ChangeLog
2021-04-30 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct tu_stats) <nr_tus>: New member.
(struct dwarf2_per_bfd) <get_cutu, get_tu>: Remove
<get_cu>: Now inline.
<all_type_units>: Remove.
* dwarf2/read.c (dwarf2_per_bfd::~dwarf2_per_bfd): Update.
(dwarf2_per_bfd::get_cutu, dwarf2_per_bfd::get_cu)
(dwarf2_per_bfd::get_tu): Remove.
(dwarf2_per_bfd::allocate_signatured_type): Update nr_tus.
(create_signatured_type_table_from_index)
(create_signatured_type_table_from_debug_names)
(dw2_symtab_iter_next, dwarf2_base_index_functions::print_stats)
(dwarf2_base_index_functions::expand_all_symtabs)
(dw2_expand_marked_cus, dw_expand_symtabs_matching_file_matcher)
(dwarf2_base_index_functions::map_symbol_filenames)
(dw2_debug_names_iterator::next, dwarf2_initialize_objfile)
(add_signatured_type_cu_to_table, create_all_type_units)
(add_type_unit, build_type_psymtabs_1, print_tu_stats)
(create_all_comp_units): Update.
* dwarf2/index-write.c (check_dwarf64_offsets, write_gdbindex)
(write_debug_names): Update.
Tom Tromey [Fri, 30 Apr 2021 20:07:58 +0000 (14:07 -0600)]
Allocate dwarf2_per_cu_data with 'new'
In a patch series I am working on, I'd like to have a non-POD member
in dwarf2_per_cu_data. This currently can't be done because
dwarf2_per_cu_data is allocated on an obstack and initialized with
memset.
This patch changes the DWARF reader to allocate objects of this type
with 'new'. The various "subclasses" of this type (signatured_type in
particular) are now changed to derive from dwarf2_per_cu_data, and
also use 'new' for allocation.
Regression tested on x86-64 Fedora 32.
gdb/ChangeLog
2021-04-30 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_bfd) <allocate_per_cu,
allocate_signatured_type>: Change return type.
<all_comp_units, all_type_units>: Hold unique pointers.
(struct dwarf2_per_cu_data): Add constructor and initializers.
(struct signatured_type): Derive from dwarf2_per_cu_data.
* dwarf2/read.c (type_unit_group): Derive from
dwarf2_per_cu_data.
(dwarf2_per_bfd::get_cutu, dwarf2_per_bfd::get_cu)
(dwarf2_per_bfd::get_tu)
(dwarf2_per_bfd::allocate_signatured_type)
(dwarf2_per_bfd::allocate_signatured_type)
(create_cu_from_index_list, create_cus_from_index_list)
(create_signatured_type_table_from_index)
(create_signatured_type_table_from_debug_names)
(create_addrmap_from_aranges)
(dwarf2_base_index_functions::find_last_source_symtab)
(dw_expand_symtabs_matching_file_matcher)
(dwarf2_gdb_index::expand_symtabs_matching)
(dwarf2_base_index_functions::map_symbol_filenames)
(create_cus_from_debug_names_list)
(dw2_debug_names_iterator::next)
(dwarf2_debug_names_index::expand_symtabs_matching)
(create_debug_type_hash_table, add_type_unit)
(fill_in_sig_entry_from_dwo_entry, lookup_dwo_signatured_type):
Update.
(allocate_type_unit_groups_table): Use delete.
(create_type_unit_group): Change return type. Use new.
(get_type_unit_group, build_type_psymtabs_1)
(build_type_psymtab_dependencies)
(process_skeletonless_type_unit, set_partial_user)
(dwarf2_build_psymtabs_hard, read_comp_units_from_section)
(create_cus_hash_table, queue_and_load_dwo_tu, follow_die_sig_1)
(read_signatured_type): Update.
(dwarf2_find_containing_comp_unit): Change type of
'all_comp_units'.
(run_test): Update.
(dwarf2_per_bfd::allocate_per_cu)
(dwarf2_per_bfd::allocate_signatured_type): Change return type.
Use new.
(add_signatured_type_cu_to_table): Update.
* dwarf2/index-write.c (write_one_signatured_type)
(check_dwarf64_offsets, psyms_seen_size, write_gdbindex)
(write_debug_names): Update.
Tom Tromey [Fri, 30 Apr 2021 16:22:23 +0000 (10:22 -0600)]
Make get_image_name static
The only callers of get_image_name are nat/windows-nat.c, so make it
static.
gdb/ChangeLog
2021-04-30 Tom Tromey <tromey@adacore.com>
* nat/windows-nat.h (get_image_name): Don't declare.
* nat/windows-nat.c (get_image_name): Now static.
Tom Tromey [Fri, 30 Apr 2021 16:22:23 +0000 (10:22 -0600)]
Share DLL code between gdb and gdbserver
This moves the new DLL-loading code into nat/windows-nat.c, and
changes both gdb and gdbserver to use the shared code. One
client-provided callback, handle_load_dll, is changed to allow the
code to be shared. This callback was actually never called from
nat/windows-nat.c; maybe I had planned to share more here and then
didn't finish... I'm not sure.
gdb/ChangeLog
2021-04-30 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_nat::handle_load_dll): Update.
(windows_nat_target::get_windows_debug_event): Call
dll_loaded_event.
(windows_add_all_dlls, windows_add_dll): Move to
nat/windows-nat.c.
* nat/windows-nat.h (handle_load_dll): Change parameters.
(dll_loaded_event, windows_add_all_dlls): Declare.
* nat/windows-nat.c (windows_add_dll, windows_add_all_dlls): Move
from windows-nat.c.
(dll_loaded_event): New function.
gdbserver/ChangeLog
2021-04-30 Tom Tromey <tromey@adacore.com>
* win32-low.cc (do_initial_child_stuff): Update.
(windows_nat::handle_load_dll): Rename from win32_add_one_solib.
Change parameter type.
(win32_add_dll, win32_add_all_dlls)
(windows_nat::handle_load_dll): Remove.
(get_child_debug_event): Call dll_loaded_event.
Tom Tromey [Fri, 30 Apr 2021 16:22:23 +0000 (10:22 -0600)]
Use nat/windows-nat function indirection code
This changes gdbserver to use the function indirection code that was
just moved into nat/windows-nat.[ch]. One additional function is used
by gdbserver that was not used by gdb.
gdb/ChangeLog
2021-04-30 Tom Tromey <tromey@adacore.com>
* nat/windows-nat.h (GenerateConsoleCtrlEvent): New define.
(GenerateConsoleCtrlEvent_ftype, GenerateConsoleCtrlEvent):
Declare.
* nat/windows-nat.c (GenerateConsoleCtrlEvent): Define.
(initialize_loadable): Initialize GenerateConsoleCtrlEvent.
gdbserver/ChangeLog
2021-04-30 Tom Tromey <tromey@adacore.com>
* win32-low.cc (GETPROCADDRESS): Remove.
(winapi_DebugActiveProcessStop, winapi_DebugSetProcessKillOnExit)
(winapi_DebugBreakProcess, winapi_GenerateConsoleCtrlEvent)
(winapi_Wow64SetThreadContext, win32_Wow64GetThreadContext)
(win32_Wow64SetThreadContext): Remove.
(win32_set_thread_context, do_initial_child_stuff)
(win32_process_target::attach, win32_process_target::detach):
Update.
(winapi_EnumProcessModules, winapi_EnumProcessModulesEx)
(winapi_GetModuleInformation, winapi_GetModuleInformationA):
Remove.
(win32_EnumProcessModules, win32_EnumProcessModulesEx)
(win32_GetModuleInformation, win32_GetModuleInformationA):
Remove.
(load_psapi): Remove.
(win32_add_dll, win32_process_target::request_interrupt): Update.
(initialize_low): Call initialize_loadable.
Tom Tromey [Fri, 30 Apr 2021 16:22:23 +0000 (10:22 -0600)]
Move function indirection code to nat/windows-nat
gdb and gdbserver both look for functions in some Windows DLLs at
runtime. This patch moves this code out of gdb and into
nat/windows-nat, so it can be shared by both programs.
gdb/ChangeLog
2021-04-30 Tom Tromey <tromey@adacore.com>
* windows-nat.c: Move code to nat/windows-nat.[ch].
(_initialize_windows_nat): Call initialize_loadable.
* nat/windows-nat.h (AdjustTokenPrivileges)
(DebugActiveProcessStop, DebugBreakProcess)
(DebugSetProcessKillOnExit, EnumProcessModules)
(EnumProcessModulesEx, GetModuleInformation)
(GetModuleFileNameExA, GetModuleFileNameExW)
(LookupPrivilegeValueA, OpenProcessToken, GetConsoleFontSize)
(GetCurrentConsoleFont, Wow64SuspendThread)
(Wow64GetThreadContext, Wow64SetThreadContext)
(Wow64GetThreadSelectorEntry): Move from windows-nat.c.
(AdjustTokenPrivileges_ftype)
(DebugActiveProcessStop_ftype, DebugBreakProcess_ftype)
(DebugSetProcessKillOnExit_ftype, EnumProcessModules_ftype)
(EnumProcessModulesEx_ftype, GetModuleInformation_ftype)
(GetModuleFileNameExA_ftype, GetModuleFileNameExW_ftype)
(LookupPrivilegeValueA_ftype, OpenProcessToken_ftype)
(GetConsoleFontSize_ftype)
(GetCurrentConsoleFont_ftype, Wow64SuspendThread_ftype)
(Wow64GetThreadContext_ftype, Wow64SetThreadContext_ftype)
(Wow64GetThreadSelectorEntry_ftype): Likewise.
(initialize_loadable): Declare.
* nat/windows-nat.c (AdjustTokenPrivileges)
(DebugActiveProcessStop, DebugBreakProcess)
(DebugSetProcessKillOnExit, EnumProcessModules)
(EnumProcessModulesEx, GetModuleInformation, GetModuleFileNameExA)
(GetModuleFileNameExW, LookupPrivilegeValueA, OpenProcessToken)
(GetCurrentConsoleFont, GetConsoleFontSize, Wow64SuspendThread)
(Wow64GetThreadContext, Wow64SetThreadContext)
(Wow64GetThreadSelectorEntry): Define.
(bad, bad_GetCurrentConsoleFont, bad_GetConsoleFontSize): Move
from windows-nat.c.
(initialize_loadable): Likewise, and rename.
Tom Tromey [Fri, 30 Apr 2021 16:22:23 +0000 (10:22 -0600)]
Use template functions in windows-nat.c
windows-nat.c defines a number of replacement functions that simply
return zero. This patch removes these in favor of a couple of
template functions.
gdb/ChangeLog
2021-04-30 Tom Tromey <tromey@adacore.com>
* windows-nat.c (bad_GetModuleFileNameEx): Remove define.
(bad_DebugActiveProcessStop, bad_DebugBreakProcess)
(bad_DebugSetProcessKillOnExit, bad_EnumProcessModules)
(bad_GetModuleFileNameExW, bad_GetModuleFileNameExA)
(bad_GetModuleInformation, bad_OpenProcessToken): Remove.
(bad): New template functions.
(_initialize_loadable): Update.
Tom Tromey [Fri, 30 Apr 2021 16:04:56 +0000 (10:04 -0600)]
Use rvalue reference in thread_pool::post_task
Tankut's recent patches made me realize that thread_pool::post_task
should have used an rvalue reference for its parameter. This patch
makes this change.
gdbsupport/ChangeLog
2021-04-30 Tom Tromey <tromey@adacore.com>
* thread-pool.cc (thread_pool::post_task): Update.
* thread-pool.h (class thread_pool) <post_task>: Take rvalue
reference to function.
Tom Tromey [Thu, 15 Apr 2021 14:54:06 +0000 (08:54 -0600)]
Fix crash with GNAT minimal encodings
Running the AdaCore internal test suite with -fgnat-encodings=minimal
found a gdb crash. The bug is that GDB ends up with a typedef in
ada_index_type, resulting in a NULL dereference.
This crash can be reproduced using GCC 11 with the included test case.
Tested on x86-64 Fedora 32. Because this is Ada-specific, and was
already reviewed by Joel, I am going to check it in.
2021-04-30 Tom Tromey <tromey@adacore.com>
* ada-lang.c (ada_index_type): Use ada_check_typedef.
gdb/testsuite/ChangeLog
2021-04-30 Tom Tromey <tromey@adacore.com>
* gdb.ada/enum_idx_packed/pck.ads (My_Enum, My_Array_Type)
(Confused_Array): New types.
* gdb.ada/enum_idx_packed/foo.adb (Confused_Array): New variable.
* gdb.ada/enum_idx_packed.exp: Add new tests.
Nick Clifton [Fri, 30 Apr 2021 13:31:03 +0000 (14:31 +0100)]
Fix illegal memory access parsing a corrupt MACH-O format file.
PR 27801
* mach-o.c (bfd_mach_o_core_fetch_environment): Use bfd_get_32 to
read 32-bit value.
Nick Clifton [Fri, 30 Apr 2021 13:19:24 +0000 (14:19 +0100)]
Fix an illegal memory access when parsing a corrupt core note.
PR 27799
* elf32-xtensa.c (elf_xtensa_grok_prstatus): Check for core notes
that are too small.
Nick Clifton [Fri, 30 Apr 2021 13:04:08 +0000 (14:04 +0100)]
Fix a double free when re-allocating a buffer to size 0.
PR 27797
* libbfd.c (bfd_realloc_or_free): Do not free a pointer than has
been realloc'ed to size 0.
Nick Clifton [Fri, 30 Apr 2021 11:28:39 +0000 (12:28 +0100)]
Fix attempt to free non-allocated pointer when parsing .debug_sup sections.
PR 27796
* dwarf.c (load_debug_sup_file): Allocate memory for filename in
.debug_sup section.
Nick Clifton [Fri, 30 Apr 2021 11:11:35 +0000 (12:11 +0100)]
Fix illegal memory access when parsing a corrupt PE format file.
PR 27795
* coff-rs6000.c (_bfd_xcoff_read_ar_hdr): Check for invalid name
lengths.
Tom de Vries [Fri, 30 Apr 2021 09:25:47 +0000 (11:25 +0200)]
[gdb/testsuite] Make gdb.mi/mi-sym-info.exp more robust against timeouts
Once in a while, I run into this timeout:
...
FAIL: gdb.mi/mi-sym-info.exp: List all variables from debug information \
only (timeout)
...
I can make the timeout reproducible by setting timeout to 8s (instead of the
default 10s) for the duration of that test.
Make the test-case more stable by fixing all timeouts caused by setting
timeout to 5, either by adding with_timeout_factor, or increasing its factor.
Tested on x86_64-linux. Also tested in parallel with stress -c 5, to simulate
a busy system in another way.
gdb/testsuite/ChangeLog:
2021-04-30 Tom de Vries <tdevries@suse.de>
* gdb.mi/mi-sym-info.exp: Add with_timeout_factor, and increase
existing timeout factors.
Tom de Vries [Fri, 30 Apr 2021 09:25:47 +0000 (11:25 +0200)]
[gdb/testsuite] Fix duplicate test name in gdb.mi/mi-sym-info.exp
Since commit
2d61316c32a "[gdb/testsuite] Fix buffer full errors in
gdb.mi/mi-sym-info.exp", we have a duplicate test name:
...
Running src/gdb/testsuite/gdb.mi/mi-sym-info.exp ...
DUPLICATE: gdb.mi/mi-sym-info.exp: List all variables
...
This is caused by a copy-paste accident: the idea was to copy the test, edit
it, and then remove the old test, but I forgot to remove the old one.
Remove it now.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-04-30 Tom de Vries <tdevries@suse.de>
* gdb.mi/mi-sym-info.exp: Remove duplicate test.
GDB Administrator [Fri, 30 Apr 2021 00:00:29 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom de Vries [Thu, 29 Apr 2021 21:32:20 +0000 (23:32 +0200)]
[gdb/testsuite] Fix timeout in gdb.base/valgrind-infcall-2.exp
Since commit
6d5702a5eb3 "Fix test case gdb.base/valgrind-bt.exp" I run into:
...
FAIL: gdb.base/valgrind-infcall-2.exp: target remote for vgdb (timeout)
FAIL: gdb.base/valgrind-infcall-2.exp: monitor v.set gdb_output (timeout)
...
The commit adds this line in proc vgdb_start:
...
set vgdbcmd "set remotetimeout 3"
...
which has no effect given that the value of var vgdbcmd is not used before
it's overwritten. We can fix this by doing instead:
...
set_remotetimeout 3
...
The FAIL I'm observing is fixed by increasing the remotetimeout value to 4.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-04-29 Tom de Vries <tdevries@suse.de>
PR testsuite/27786
* lib/valgrind.exp (vgdb_start): Use set_remotetimeout. Increase
remotetimeout to 4.
Simon Marchi [Thu, 29 Apr 2021 20:24:19 +0000 (16:24 -0400)]
gdb: don't use C++17 namespace declaration style
In a review, I suggested to use "namespace gdb::observers" instead of
two separate namespace declarations. I didn't realize that this was a
C++17 feature, which breaks compilers that default to an earlier version
of the language, like g++ 4.8. Change it back to two separate
declarations.
gdb/ChangeLog:
* auto-load.h: Split namespace declaration.
Change-Id: I701537161967fbd9fcc298ff600bd072aab1251d
Nick Clifton [Thu, 29 Apr 2021 16:55:43 +0000 (17:55 +0100)]
Fix an access through a null pointer when parsing a corrupt SOM format fle.
PR 27793
* som.c (som_slurp_symbol_table): Assign symbols without any scope
to the undefined section.
(som_decode_symclass): Check for a missing symbol section.
* syms.c (bfd_decode_symclass): Likewise.
Nick Clifton [Thu, 29 Apr 2021 16:41:43 +0000 (17:41 +0100)]
Fix illegal memory accesses when parsing a corrupt SOM format file.
PR 27792
* som.c (som_slurp_string_table): Place a terminating NUL byte at
the end of the table.
(som_slurp_symbol_table): Check for an over-large offset into the
string string table.
Simon Marchi [Thu, 29 Apr 2021 14:16:28 +0000 (10:16 -0400)]
gdb: move some variables to an inner scope in save_waitstatus
These two variables:
struct regcache *regcache = get_thread_regcache (tp);
const address_space *aspace = regcache->aspace ();
are only needed inside the "if". Getting a thread's regcache is a
somewhat expensive operation, so it's good to avoid it if not necessary.
Move the variable declarations and their initialization to the "if"
scope.
gdb/ChangeLog:
* infrun.c (save_waitstatus): Move variables to inner scope.
Change-Id: Ief1463728755b4dcc142c0a0a76896e9d594ae84
Jan Beulich [Thu, 29 Apr 2021 13:02:25 +0000 (15:02 +0200)]
x86-64: adjust recently added tests
Five of them fail for Cygwin and MingW. Adjust four and move one to the
ELF-only section.
Nick Clifton [Thu, 29 Apr 2021 12:11:29 +0000 (13:11 +0100)]
Correct the text describing windres's --processor option.
PR 27594
* doc/binutils.texi (windres): Correct the description of the
default value of the --preprocessor argument.
Jan Beulich [Thu, 29 Apr 2021 09:45:10 +0000 (11:45 +0200)]
x86: relax when/how @size can be used
Allow a few more expression forms when the entire expression can be
resolved at assembly time. For this, i386_validate_fix() needs to
arrange for all processing of the relocation to be deferred to
tc_gen_reloc().
Jan Beulich [Thu, 29 Apr 2021 09:43:53 +0000 (11:43 +0200)]
x86: allow @size to also (sensibly) apply to sections
So far this (counter-intuitively) produced the size as recorded in the
(section) symbol. Obtain the section's size instead for section symbols.
(I wonder whether STT_SECTION symbols couldn't properly hold the
section's size in their st_size field, which in turn would likely mean
the internal symbol would also have its size properly updated.)
Note that this is not the same as the .sizeof.() pseudo-operator: @size
yields the local file's contribution to a section, while .sizeof.() gets
resolved by the linker to produce the final full section's size.
As to the 3rd each of the expected output lines in the changed testcase:
I can't find justification for zzz to come after yyy despite them being
defined in the opposite order in source. Therefore I think it's better
to permit both possible outcomes.
Andrew Burgess [Thu, 29 Apr 2021 09:29:41 +0000 (10:29 +0100)]
gdb/NEWS: Fix typo and stray full stop
Some errors introduced in commit:
commit
edeaceda7b2f33b2c3bf78c732e67f3188e7f0b9
Date: Thu Aug 27 16:53:13 2020 +0100
gdb: startup commands to control Python extension language
gdb/ChangeLog:
* NEWS: Fix typo and stray full stop.
GDB Administrator [Thu, 29 Apr 2021 00:00:33 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 27 Apr 2021 13:35:23 +0000 (07:35 -0600)]
Fix Ada overloading with 'null'
Currently, the Ada expression parser treats 'null' as an integer 0.
However, this causes overloading to fail in certain cases.
This patch changes the Ada expression parser to use a special type for
'null'. I chose pointer-to-int0, because I think that's not likely to
be needed for any other Ada expression. Note this works because a
"mod 1" type has an underlying non-zero byte size; the test includes a
check for this.
The output is changed so that "print null", by default, shows "null".
And, ada_type_match is changed both to recognize the special null type
and to remove a bit of weird code related to how pointers are treated
for overload type matching.
Tested on x86-64 Fedora 32. Because this only touches Ada, and Joel
already approved it internally at AdaCore, I am checking it in.
gdb/ChangeLog
2021-04-28 Tom Tromey <tromey@adacore.com>
* ada-exp.y (primary): Use new type for null pointer.
* ada-lang.c (ada_type_match): Remove "may_deref"
parameter. Handle null pointer.
(ada_args_match): Update.
* ada-valprint.c (ada_value_print_ptr, ada_value_print):
Handle null pointer.
gdb/testsuite/ChangeLog
2021-04-28 Tom Tromey <tromey@adacore.com>
* gdb.ada/null_overload.exp: New file.
* gdb.ada/null_overload/foo.adb: New file.
Andrew Burgess [Wed, 28 Apr 2021 09:16:48 +0000 (10:16 +0100)]
gdb/doc: use @env to reference environment variables
Clean up a few places where we are not using @env{...} to reference
environment variables.
gdb/doc/ChangeLog:
* gdb.texinfo (Initialization Files): Use @env when referencing
environment variables.
(Shell Commands): Likewise.
(Starting): Likewise.
(Arguments): Likewise.
(Environment): Likewise.
(Edit): Likewise.
(Compiling and Injecting Code): Likewise.
(Files): Likewise.
(Command History): Likewise.
(Screen Size): Likewise.
(Emacs): Likewise.
Nick Clifton [Wed, 28 Apr 2021 10:49:09 +0000 (11:49 +0100)]
Stop the BFD library from treating annobin symbols as potential function symbols.
bfd * elf.c (_bfd_elf_maybe_function_sym): Do not accept annobin
symbols as potential function symbols.
* elfnn-aarch64.c (elfNN_aarch64_maybe_function_sym): Likewise.
* elf64-ppc.c (ppc64_elf_maybe_function_sym): Likewise.
* elf32-arm.c (elf32_arm_maybe_function_sym): Likewise.
ld * testsuite/ld-elf/anno-sym.s: New test source file.
* testsuite/ld-elf/anno-sym.d: New test driver.
* testsuite/ld-elf/anno-sym.l: New test error output.
Andrew Burgess [Thu, 27 Aug 2020 15:53:13 +0000 (16:53 +0100)]
gdb: startup commands to control Python extension language
Add two new commands to GDB that can be placed into the early
initialization to control how Python starts up. The new options are:
set python ignore-environment on|off
set python dont-write-bytecode auto|on|off
show python ignore-environment
show python dont-write-bytecode
These can be used from GDB's startup file to control how the Python
extension language behaves. These options are equivalent to the -E
and -B flags to python respectively, their descriptions from the
Python man page:
-E Ignore environment variables like PYTHONPATH and PYTHONHOME
that modify the behavior of the interpreter.
-B Don't write .pyc files on import.
gdb/ChangeLog:
* NEWS: Mention new commands.
* python/python.c (python_ignore_environment): New static global.
(show_python_ignore_environment): New function.
(set_python_ignore_environment): New function.
(python_dont_write_bytecode): New static global.
(show_python_dont_write_bytecode): New function.
(set_python_dont_write_bytecode): New function.
(_initialize_python): Register new commands.
gdb/doc/ChangeLog:
* python.texinfo (Python Commands): Mention new commands.
gdb/testsuite/ChangeLog:
* gdb.python/py-startup-opt.exp: New file.
Andrew Burgess [Thu, 22 Apr 2021 17:26:15 +0000 (18:26 +0100)]
gdb: extension languages finish_initialization to initialize
Now that both Python and Guile are fully initialized from their
respective finish_initialization methods, the "finish" in the method
name doesn't really make sense; initialization starts _and_ finishes
with that method.
As such, this commit renames finish_initialization to just initialize.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* extension-priv.h (struct extension_language_ops): Rename
'finish_initialization' to 'initialize'.
* extension.c (finish_ext_lang_initialization): Renamed to...
(ext_lang_initialization): ...this, update comment, and updated
the calls to reflect the change in struct extension_language_ops.
* extension.h (finish_ext_lang_initialization): Renamed to...
(ext_lang_initialization): ...this.
* guile/guile.c (gdbscm_finish_initialization): Renamed to...
(gdbscm_initialize): ...this, update comment at definition.
(guile_extension_ops): Update.
* main.c (captured_main_1): Update call to
finish_ext_lang_initialization.
* python/python.c (gdbpy_finish_initialization): Rename to...
(gdbpy_initialize): ...this, update comment at definition, and
update call to do_finish_initialization.
(python_extension_ops): Update.
(do_finish_initialization): Rename to...
(do_initialize): ...this, and update comment.
Andrew Burgess [Wed, 26 Aug 2020 16:31:12 +0000 (17:31 +0100)]
gdb: initialise extension languages after processing early startup files
Now (thanks to the last few commits) all extension languages are
fully initialised in their finish_initialization method, this commit
delays the call to this method until after the early initialization
files have been processed.
Right now there's no benefit from doing this, but in a later commit I
plan to add new options for Python that will control how Python is
initialized.
With this commit in place, my next commits will allow the user to add
options to their early initialization file and alter how Python starts
up.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* main.c (captured_main_1): Add a call to
finish_ext_lang_initialization.
* top.c (gdb_init): Remove call to finish_ext_lang_initialization.
Andrew Burgess [Thu, 22 Apr 2021 17:17:01 +0000 (18:17 +0100)]
gdb delay guile initialization until gdbscm_finish_initialization
Like with the previous commit, this commit delays the initialisation
of the guile extension language until gdbscm_finish_initialization.
This is mostly about splitting the existing gdbscm_initialize_*
functions in two, all the calls to register_objfile_data_with_cleanup,
gdbarch_data_register_post_init, etc are moved into new _initialize_*
functions, but everything else is left in the gdbscm_initialize_*
functions.
Then the call to code previously in _initialize_guile is moved into
gdbscm_finish_initialization.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* guile/guile.c (gdbscm_set_backtrace): Add declaration.
(gdbscm_finish_initialization): Add code moved from
_initialize_guile.
(_initialize_guile): Move code to gdbscm_finish_initialization.
* guile/scm-arch.c (gdbscm_initialize_arches): Move some code into
_initialize_scm_arch.
(_initialize_scm_arch): New function.
* guile/scm-block.c (gdbscm_initialize_blocks): Move some code
into _initialize_scm_block.
(_initialize_scm_block): New function.
* guile/scm-frame.c (gdbscm_initialize_frames): Move some code
into _initialize_scm_frame.
(_initialize_scm_frame): New function.
* guile/scm-objfile.c (gdbscm_initialize_objfiles): Move some code
into _initialize_scm_objfile.
(_initialize_scm_objfile): New function.
* guile/scm-progspace.c (gdbscm_initialize_pspaces): Move some
code into _initialize_scm_progspace.
(_initialize_scm_progspace): New function.
* guile/scm-symbol.c (gdbscm_initialize_symbols): Move some code
into _initialize_scm_symbol.
(_initialize_scm_symbol): New function.
* guile/scm-symtab.c (gdbscm_initialize_symtabs): Move some code
into _initialize_scm_symtab.
(_initialize_scm_symtab): New function.
* guile/scm-type.c (gdbscm_initialize_types): Move some code into
_initialize_scm_type.
(_initialize_scm_type): New function.
Andrew Burgess [Thu, 22 Apr 2021 16:11:25 +0000 (17:11 +0100)]
gdb: delay python initialisation until gdbpy_finish_initialization
Delay Python initialisation until gdbpy_finish_initialization.
This is mostly about splitting the existing gdbpy_initialize_*
functions in two, all the calls to register_objfile_data_with_cleanup,
gdbarch_data_register_post_init, etc are moved into new _initialize_*
functions, but everything else is left in the gdbpy_initialize_*
functions.
Then the call to do_start_initialization (in python/python.c) is moved
from the _initialize_python function into gdbpy_finish_initialization.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* python/py-arch.c (_initialize_py_arch): New function.
(gdbpy_initialize_arch): Move code to _initialize_py_arch.
* python/py-block.c (_initialize_py_block): New function.
(gdbpy_initialize_blocks): Move code to _initialize_py_block.
* python/py-inferior.c (_initialize_py_inferior): New function.
(gdbpy_initialize_inferior): Move code to _initialize_py_inferior.
* python/py-objfile.c (_initialize_py_objfile): New function.
(gdbpy_initialize_objfile): Move code to _initialize_py_objfile.
* python/py-progspace.c (_initialize_py_progspace): New function.
(gdbpy_initialize_pspace): Move code to _initialize_py_progspace.
* python/py-registers.c (_initialize_py_registers): New function.
(gdbpy_initialize_registers): Move code to
_initialize_py_registers.
* python/py-symbol.c (_initialize_py_symbol): New function.
(gdbpy_initialize_symbols): Move code to _initialize_py_symbol.
* python/py-symtab.c (_initialize_py_symtab): New function.
(gdbpy_initialize_symtabs): Move code to _initialize_py_symtab.
* python/py-type.c (_initialize_py_type): New function.
(gdbpy_initialize_types): Move code to _initialize_py_type.
* python/py-unwind.c (_initialize_py_unwind): New function.
(gdbpy_initialize_unwind): Move code to _initialize_py_unwind.
* python/python.c (_initialize_python): Move call to
do_start_initialization to gdbpy_finish_initialization.
(gdbpy_finish_initialization): Add call to
do_start_initialization.
This page took 0.047785 seconds and 4 git commands to generate.