Mike Frysinger [Mon, 1 Nov 2021 04:56:08 +0000 (00:56 -0400)]
sim: m32r: reduce -Wno-error scope
Only two files in here still generates warnings, so reduce the -Werror
disable to that now that we require GNU make and can set variables on
a per-object basis.
Mike Frysinger [Mon, 1 Nov 2021 04:55:27 +0000 (00:55 -0400)]
sim: mips: reduce -Wno-error scope
Fix a few printf warnings in sim-main.c, and then we're left with only
one file in here still generating warnings, so reduce the -Werror
disable to that alone now that we require GNU make and can set variables
on a per-object basis.
Mike Frysinger [Mon, 1 Nov 2021 04:55:02 +0000 (00:55 -0400)]
sim: erc32: reduce -Wno-error scope
Only one file in here still generates warnings, so reduce the -Werror
disable to that alone now that we require GNU make and can set variables
on a per-object basis.
Mike Frysinger [Mon, 1 Nov 2021 04:54:36 +0000 (00:54 -0400)]
sim: cris: reduce -Wno-error scope
Only two files in here still generates warnings, so reduce the -Werror
disable to that now that we require GNU make and can set variables on
a per-object basis.
Mike Frysinger [Mon, 1 Nov 2021 04:53:38 +0000 (00:53 -0400)]
sim: sh: reduce -Wno-error scope
Only one file in here still generates warnings, so reduce the -Werror
disable to that alone now that we require GNU make and can set variables
on a per-object basis.
Mike Frysinger [Mon, 1 Nov 2021 04:52:52 +0000 (00:52 -0400)]
sim: or1k: build with -Werror
The only warnings left in this port are a few maybe-uninitialized,
but we don't abort the build for them, so turn on -Werror everywhere.
Mike Frysinger [Mon, 1 Nov 2021 04:27:49 +0000 (00:27 -0400)]
sim: igen: minor build output alignment fix
The custom echo was off by one space relative to all the others.
Mike Frysinger [Mon, 1 Nov 2021 04:25:13 +0000 (00:25 -0400)]
sim: ppc: fix the printf fix for 32-bit systems
The time delta is a 64-bit value too.
Mike Frysinger [Mon, 1 Nov 2021 04:07:15 +0000 (00:07 -0400)]
sim: m68hc11: clean up pointer casts
The void *data field is used to past arbitrary data between event
handlers, and these are using it to pass an integer. Fix up the
casts to avoid using (long) to cast to/from pointers since there
is no guarantee that's the right size.
Mike Frysinger [Mon, 1 Nov 2021 04:05:15 +0000 (00:05 -0400)]
sim: d10v: clean up pointer casts
Use %p to print pointers instead of trying to cast them to longs.
Mike Frysinger [Mon, 1 Nov 2021 03:55:51 +0000 (23:55 -0400)]
sim: bfin: cast pointers using uintptr_t
We can't assume that sizeof(long) == sizeof(void*), so change all
these casts over to uintptr_t.
Mike Frysinger [Mon, 1 Nov 2021 03:32:26 +0000 (23:32 -0400)]
sim: ppc: clean up printf format handling
Don't blindly cast every possible type to (long). Change to the right
printf format specifier whether it be a 64-bit type or a pointer.
Mike Frysinger [Mon, 1 Nov 2021 03:48:16 +0000 (23:48 -0400)]
sim: ppc: switch core types to stdint.h types
There's no need to define these ourselves anymore, so switch to the
stdint.h types. This will be important when we start using PRI*
defines with printf formats.
Mike Frysinger [Mon, 1 Nov 2021 03:21:36 +0000 (23:21 -0400)]
sim: mn10300: clean up pointer casts
The void *data field is used to past arbitrary data between event
handlers, and these are using it to pass an enum. Fix up the casts
to avoid using (long) to cast to/from pointers since there is no
guarantee that's the right size.
Mike Frysinger [Mon, 1 Nov 2021 02:57:42 +0000 (22:57 -0400)]
sim: events: clean up trace casts
Don't blindly cast every possible type to (long). Change to the right
printf format specifier whether it be a 64-bit type or a pointer.
Mike Frysinger [Mon, 1 Nov 2021 02:35:41 +0000 (22:35 -0400)]
sim: ppc: handle \r in igen inputs [PR sim/28476]
Make sure we consume & ignore \r bytes in inputs in case the file
encodings are from a non-LF systems (e.g. Windows).
Mike Frysinger [Mon, 1 Nov 2021 00:40:01 +0000 (20:40 -0400)]
sim: ppc: constify strings in igen tooling
GDB Administrator [Mon, 1 Nov 2021 00:00:19 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Fri, 29 Oct 2021 23:04:09 +0000 (17:04 -0600)]
Fix latent bug in DWARF test case
On my branch that replaces the DWARF psymtab reader,
dw2-stack-boundary.exp started failing. However, when I look at the
output in gdb.log, it is correct:
file /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-stack-boundary/dw2-stack-boundary
Reading symbols from /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-stack-boundary/dw2-stack-boundary...
During symbol reading: location description stack overflow
During symbol reading: location description stack underflow
What happens to cause the failure is that the two branches in
gdb_test_multiple appear in this order:
-re "\r\nDuring symbol reading: location description stack underflow" {
[...]
-re "\r\nDuring symbol reading: location description stack overflow" {
The first one will match the above, without causing the second one to
ever match -- leading to a spurious failure.
Anchoring the regexps seems to fix the problem, and works for the
current gdb as well.
Tom Tromey [Sun, 31 Oct 2021 17:34:06 +0000 (11:34 -0600)]
Fix unittest.exp failure due to 'set debuginfod' addition
The 'set debuginfod' change caused a regression in unittest.exp:
Running selftest help_doc_invariants.
help doc broken invariant: command 'info set debuginfod' help doc first line is not terminated with a '.' character
help doc broken invariant: command 'set debuginfod' help doc first line is not terminated with a '.' character
help doc broken invariant: command 'show debuginfod' help doc first line is not terminated with a '.' character
Self test failed: self-test failed at ../../binutils-gdb/gdb/unittests/command-def-selftests.c:100
This patch fixes the problem. I'm checking it in.
Mike Frysinger [Sun, 31 Oct 2021 09:25:22 +0000 (05:25 -0400)]
sim: ppc: use silent build rules here too
The ppc codebase is unique and doesn't leverage common/, so have to
add silent rules to it specifically.
Mike Frysinger [Sun, 31 Oct 2021 09:05:49 +0000 (05:05 -0400)]
sim: rl78: drop obsolete manual dependency rules
We have GNU make generate these for us automatically now, so there's
no need to manually specify any deps.
Mike Frysinger [Wed, 7 Jul 2021 03:56:13 +0000 (23:56 -0400)]
sim: drop unused targ-vals.h includes
This is used in a few places where it's not needed. Drop the include
to avoid the build-time generated header file as we move to drop it.
Mike Frysinger [Wed, 7 Jul 2021 03:44:38 +0000 (23:44 -0400)]
sim: unify callback.o building
Now that the use of TARGET_xxx defines have been removed, we can move
this to the common logic so we only build it once for multi-targets.
Mike Frysinger [Wed, 7 Jul 2021 03:37:56 +0000 (23:37 -0400)]
sim: nltvals: pull target open flags out into a dedicated source file
Like we just did for pulling out the errno & signal maps, pull out the
open flag map into a dedicated common file. All newlib ports are using
the same map which makes it easy.
Mike Frysinger [Wed, 7 Jul 2021 03:21:20 +0000 (23:21 -0400)]
sim: nltvals: localize TARGET_<open> defines
Code should not be using these directly, instead they should be
resolving these dynamically via the open_map. Rework the common
callback code that was using the defines to use symbolic names
instead, and localize some of the defines in the ARM code (since
it's a bit unclear how many different APIs it supports currently),
then remove the defines out of the header so no new code can rely on
them.
Mike Frysinger [Wed, 7 Jul 2021 02:43:10 +0000 (22:43 -0400)]
sim: nltvals: pull target signal out into a dedicated source file
Like we just did for pulling out the errno map, pull out the signal
map into a dedicated common file. All newlib ports are using the
same signal map which makes it easy.
Mike Frysinger [Wed, 7 Jul 2021 02:10:53 +0000 (22:10 -0400)]
sim: nltvals: pull target errno out into a dedicated source file
The current system maintains a list of target errno constants in the
nltvals.def file, then runs a build-time tool to turn that into a C
file. This list of errno values is the same for all arches, so we
don't need the arch-specific flexibility. Further, these are only
for newlib/libgloss environments, which makes it confusing to support
other userland runtimes (like Linux). Let's simplify to make this
easier to understand & build. We don't namespace the variables yet,
but sets up the framework for it.
Create a new target-newlib-errno.c template file. The template file
is hand written, but the inline map is still automatically generated.
This allows us to move it to the common set of objects so it's only
built once in a multi-target build.
Now we can remove the output from the gentmap build-time tool since
it's checked into the tree.
Then we stop including the errno lists in nltvals.def since nothing
uses it.
Mike Frysinger [Sun, 31 Oct 2021 08:19:41 +0000 (04:19 -0400)]
sim: erc32: use silent build rules with sis linkage
Mike Frysinger [Sun, 31 Oct 2021 08:17:28 +0000 (04:17 -0400)]
sim: erc32: fix a few more build warnings
Tweak the if indentation & brace style to avoid ambiguous warnings.
Add ATTRIBUTE_UNUSED to UART functions that aren't used when FAST_UART
is defined (which is the default).
Orgad Shaneh [Fri, 29 Oct 2021 06:42:15 +0000 (06:42 +0000)]
sim: erc32: fix signedness compatibility and redefinition warnings
Mike Frysinger [Sun, 31 Oct 2021 06:03:16 +0000 (02:03 -0400)]
sim: add arch-specific conditional logic
This will make it easy to include arch-specific logic (build files)
as we migrate ports to the common top level build.
Mike Frysinger [Sun, 31 Oct 2021 05:49:17 +0000 (01:49 -0400)]
sim: v850: delete old gencode logic
The v850 port used to have a gencode helper, but it was deleted long
ago. Clean up the settings that no longer make sense w/out it.
Mike Frysinger [Sun, 31 Oct 2021 05:17:10 +0000 (01:17 -0400)]
sim: common: merge multiple clean commands
This provides a minor speedup when cleaning in a multi-target build.
Mike Frysinger [Sun, 31 Oct 2021 05:11:41 +0000 (01:11 -0400)]
sim: m32c: tighten up opc2c build output
Drop the single debugging line that repeats the command line option,
and use the silent build helpers to tighten up output.
Mike Frysinger [Sun, 31 Oct 2021 05:08:05 +0000 (01:08 -0400)]
sim: tighten up build regen rules
Update the makefile & configure related rules to use the silent
build helpers.
Mike Frysinger [Sun, 31 Oct 2021 05:05:27 +0000 (01:05 -0400)]
sim: tighten up gencode output
Update the gencode rules to use the silent build helpers.
Mike Frysinger [Sun, 31 Oct 2021 04:55:50 +0000 (00:55 -0400)]
sim: igen: tighten up build output
Add a new stamp helper for quiet builds, and don't dump the command
line options when it runs. That isn't standard tool behavior, and
doesn't really seem necessary in any way.
Mike Frysinger [Sun, 31 Oct 2021 04:49:39 +0000 (00:49 -0400)]
sim: tighten up stamp rules
Add a new ECHO_STAMP helper and convert existing stamp code over
to it. This is mostly common rules and cgen mloop rules.
Mike Frysinger [Sun, 31 Oct 2021 04:42:35 +0000 (00:42 -0400)]
sim: silence stamp touch rules
We pretty much never care about these stamp touches, so silence them.
Also switch to using $@ when it makes sense.
Mike Frysinger [Sun, 31 Oct 2021 04:28:44 +0000 (00:28 -0400)]
sim: standardize move-if-change rules
Use the srcroot path and make them all silent.
Mike Frysinger [Sun, 31 Oct 2021 04:23:36 +0000 (00:23 -0400)]
sim: mips/v850: remove redundant variable setup
The common/Make-common.in fragment already provides these variables.
Orgad Shaneh [Thu, 28 Oct 2021 09:07:46 +0000 (09:07 +0000)]
sim: fix compilation on mingw64 [PR sim/28476]
...by reordering includes.
1. sim-utils.c
sim/mips/sim-main.h defines UserMode, while there is a struct in winnt.h
which has UserMode as a member. So if sim-main.h is included before winnt.h,
compilation fails.
2. ppc
registers.h defines CR, which is used as a member in winnt.h.
winsock2.h is included by sys/time.h, so sys/time.h has to be included
before registers.h.
Bug: https://sourceware.org/PR28476
Alan Modra [Sat, 30 Oct 2021 23:38:15 +0000 (10:08 +1030)]
Don't include coff/pe.h in coff-x86_64.c
This (and other) code from coffcode.h is broken for x86_64_coff_vec,
and has been ever since support was added in 2006 commit
99ad839030c1
Here, bfd_coff_aoutsz must match coff_swap_aouthdr_out otherwise we
end up writing garbage.
/* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
include/coff/pe.h sets AOUTSZ == sizeof (PEAOUTHDR)). */
char * buff;
bfd_size_type amount = bfd_coff_aoutsz (abfd);
buff = (char *) bfd_malloc (amount);
if (buff == NULL)
return false;
coff_swap_aouthdr_out (abfd, & internal_a, buff);
amount = bfd_bwrite (buff, amount, abfd);
We have removed support for --target=x86_64-coff, likely because it
never worked properly, but still produce coff-x86_64.o with
--enable-targets=all. This means objcopy can recognize x86_64 COFF
files but will write garbage to the output file, a fact found by
fuzzers. I suspect x86_64 COFF is still broken after this fix, and
mention of coff-x86_64.* should be removed from bfd/Makefile.am.
* coff-x86_64.c: Don't include coff/pe.h.
(COFF_WITH_pex64): Don't define here.
* pe-x86_64.c: Include coff/pe.h and other headers.
(PEI_HEADERS): Define.
Alan Modra [Sat, 30 Oct 2021 08:49:13 +0000 (19:19 +1030)]
Re: PR28420, ecoff fuzzing failures
sym_ptr_ptr NULL results in segfaults.
PR 28420
* ecoff.c (ecoff_slurp_reloc_table): Don't leave sym_ptr_ptr NULL.
Alan Modra [Sat, 30 Oct 2021 08:24:53 +0000 (18:54 +1030)]
ubsan: alpha-vms: undefined shift
* vms-alpha.c (evax_bfd_print_image): Shift left 1u.
Alan Modra [Sat, 30 Oct 2021 08:12:00 +0000 (18:42 +1030)]
PR28518: signed integer overflow & free on unmalloced address
PR 28518
* vms-alpha.c (build_module_list): Don't lose malloc buffer address.
Use unsigned variables.
GDB Administrator [Sun, 31 Oct 2021 00:00:09 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Sat, 30 Oct 2021 02:15:55 +0000 (22:15 -0400)]
gdb: fix gdb.gdb/unittest.exp with C++17 compiler
On a machine with gcc 11, I get:
FAIL: gdb.gdb/unittest.exp: test_completion: tab complete "maintenance selftest string_v" (second tab) (timeout)
FAIL: gdb.gdb/unittest.exp: test_completion: tab complete "maintenance selftest string_vie" (timeout)
That's because when compiling with C++ >= 17, we use the standard
version of string_view, and don't have a selftest for it. So the list
of selftests shown by the tab completion when completing "string_v"
differs.
Change the test to use the copy_* tests instead.
Change-Id: I85f6aa44ee5fc9652b9bd4451e0506b89773526b
Aaron Merey [Sat, 30 Oct 2021 00:49:29 +0000 (20:49 -0400)]
gdb.texinfo: Expand documentation for debuginfod
Add section describing GDB's usage of debuginfod.
Refer to this new section in the description of the '--with-debuginfod'
configure option.
Mention debuginfod in the 'Separate Debug Files' section.
Aaron Merey [Fri, 29 Oct 2021 23:55:57 +0000 (19:55 -0400)]
gdb: add set/show commands for managing debuginfod
Add 'set debuginfod' command. Accepts 'on', 'off' or 'ask' as an
argument. 'on' enables debuginfod for the current session. 'off'
disables debuginfod for the current session. 'ask' will prompt
the user to either enable or disable debuginfod when the next query
is about to be performed:
This GDB supports auto-downloading debuginfo from the following URLs:
<URL1> <URL2> ...
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod on' to .gdbinit.
For interactive sessions, 'ask' is the default. For non-interactive
sessions, 'off' is the default.
Add 'show debuginfod status' command. Displays whether debuginfod
is set to 'on', 'off' or 'ask'.
Add 'set/show debuginfod urls' commands. Accepts a string of
space-separated debuginfod server URLs to be queried. The default
value is copied from the DEBUGINFOD_URLS environment variable.
Finally add 'set/show debuginfod verbose' commands to control whether
debuginfod-related output is displayed. Verbose output is enabled
by default.
(gdb) run
Starting program: /bin/sleep 5
Download failed: No route to host. Continuing without debug info for /lib64/libc.so.6.
If GDB is not built with debuginfod then these commands will just display
Support for debuginfod is not compiled into GDB.
GDB Administrator [Sat, 30 Oct 2021 00:00:26 +0000 (00:00 +0000)]
Automatic date update in version.in
Simon Marchi [Mon, 27 Sep 2021 01:08:36 +0000 (21:08 -0400)]
gdb: remove TYPE_FIELD_DWARF_BLOCK
Remove TYPE_FIELD_DWARF_BLOCK, replace with type::field +
field::loc_dwarf_block.
Change-Id: I10af9410bb5f46d342b8358a7956998c7e804b64
Simon Marchi [Mon, 27 Sep 2021 01:07:04 +0000 (21:07 -0400)]
gdb: remove TYPE_FIELD_STATIC_PHYSADDR
Remove TYPE_FIELD_STATIC_PHYSADDR replace with type::field +
field::loc_physaddr.
Change-Id: Ica9bc4a48f34750ec82ec86c298d3ecece81bcbd
Simon Marchi [Mon, 27 Sep 2021 01:06:12 +0000 (21:06 -0400)]
gdb: remove TYPE_FIELD_STATIC_PHYSNAME
Remove TYPE_FIELD_STATIC_PHYSNAME, replace with type::field +
field::loc_physname.
Change-Id: Ie35d446b67dd1d02f39998b406001bdb7e6d5abb
Simon Marchi [Sun, 26 Sep 2021 20:38:02 +0000 (16:38 -0400)]
gdb: remove TYPE_FIELD_ENUMVAL
Remove TYPE_FIELD_ENUMVAL, replace with type::field +
field::loc_enumval.
Change-Id: I2ada73e4635aad3363ce2eb22c1dc52698ee2072
Simon Marchi [Sun, 26 Sep 2021 20:36:15 +0000 (16:36 -0400)]
gdb: remove TYPE_FIELD_BITPOS
Remove TYPE_FIELD_BITPOS, replace its uses with type::field +
field::loc_bitpos.
Change-Id: Iccd8d5a77e5352843a837babaa6bd284162e0320
Simon Marchi [Sun, 26 Sep 2021 20:34:28 +0000 (16:34 -0400)]
gdb: remove TYPE_FIELD_LOC_KIND
Remove TYPE_FIELD_LOC_KIND, replace its uses with type::field +
field::loc_kind.
Change-Id: Ib124a26365df82ac1d23df7962d954192913bd90
Simon Marchi [Fri, 24 Sep 2021 03:51:40 +0000 (23:51 -0400)]
gdb: remove FIELD_DWARF_BLOCK macro
Remove FIELD_DWARF_BLOCK, replace its uses with field::loc_dwarf_block.
Change-Id: I66b7d6a960cb5e341e61e21bd3cc9a6ac26de6a8
Simon Marchi [Fri, 24 Sep 2021 03:50:02 +0000 (23:50 -0400)]
gdb: remove FIELD_STATIC_PHYSADDR macro
Remove FIELD_LOC_KIND_PHYSADDR, replace its uses with
field::loc_physaddr.
Change-Id: Ifd8b2bdaad75f42bfb1404ef8c396ffe7e10ac55
Simon Marchi [Fri, 24 Sep 2021 03:47:42 +0000 (23:47 -0400)]
gdb: remove FIELD_STATIC_PHYSNAME macro
Remove FIELD_STATIC_PHYSNAME, replace its uses with field::loc_physname.
Change-Id: Iaa8952410403b4eb5bbd68411feea27e2405d657
Simon Marchi [Fri, 24 Sep 2021 03:47:08 +0000 (23:47 -0400)]
gdb: remove FIELD_ENUMVAL macro
Remove FIELD_ENUMVAL, replace its uses with field::loc_enumval.
Change-Id: Id4861cee91a8bb583a9836f1aa5da0a320fbf4d9
Simon Marchi [Fri, 24 Sep 2021 03:43:13 +0000 (23:43 -0400)]
gdb: remove FIELD_BITPOS macro
Remove FIELD_BITPOD, replace its uses with field::loc_bitpos.
Change-Id: Idb99297e0170661254276c206383a7e9bf1a935a
Simon Marchi [Fri, 24 Sep 2021 03:35:24 +0000 (23:35 -0400)]
gdb: remove FIELD_LOC_KIND macro
Remove FIELD_LOC_KIND, replace its uses with field::loc_kind or
call_site_target::loc_kind.
Change-Id: I0368d8c3ea269d491bb215aa70e32edbdf55f389
Tom Tromey [Fri, 22 Oct 2021 16:49:19 +0000 (10:49 -0600)]
Add gdb.Architecture.integer_type Python function
This adds a new Python function, gdb.Architecture.integer_type, which
can be used to look up an integer type of a given size and
signed-ness. This is useful to avoid dependency on debuginfo when a
particular integer type would be useful.
v2 moves this to be a method on gdb.Architecture and addresses other
review comments.
Tom Tromey [Wed, 20 Oct 2021 20:25:21 +0000 (14:25 -0600)]
Remove ada_value_print_inner
I noticed that the only caller of ada_value_print_inner is
valprint.c:do_val_print (via ada_language::value_print_inner), meaning
that the try/catch logic in this function is redundant. This patch
removes the wrapper function.
Regression tested on x86-64 Fedora 34.
Tom Tromey [Tue, 19 Oct 2021 20:42:04 +0000 (14:42 -0600)]
Document resolve_dynamic_type oddity
Today I re-learned that resolve_dynamic_type can return a type for
which is_dynamic_type returns true. This can happen for an array
whose elements have dynamic type -- the array is reported as dynamic,
but resolving the elements would be incorrect, because each element
might have a different type after resolution.
You can see the special case in resolve_dynamic_array_or_string:
if (ary_dim != NULL && ary_dim->code () == TYPE_CODE_ARRAY)
...
else
...
I looked into having the TYPE_CODE_ARRAY case in
is_dynamic_type_internal follow this same logic, but that breaks down
on the gdb.fortran/dynamic-ptype-whatis.exp test case. In particular
this code in fortran_undetermined::evaluate:
value *callee = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
if (noside == EVAL_AVOID_SIDE_EFFECTS
&& is_dynamic_type (value_type (callee)))
callee = std::get<0> (m_storage)->evaluate (nullptr, exp, EVAL_NORMAL);
... relies on is_dynamic_type returning true for such an array.
I wasn't really sure of the best way to fix this, so in the meantime I
wrote this patch, which documents the oddity so that I might have a
chance of remembering this in the future.
Tom Tromey [Wed, 29 Sep 2021 16:14:52 +0000 (10:14 -0600)]
Avoid self-test failures on x86-linux
The disassembly tests in "maint selftest" will fail on x86-linux.
This happens because opcodes rejects an attempt to disassemble for an
arch with a 64-bit address size when bfd_vma is 32-bit.
This patch avoids this problem by avoiding the test in this case. I
chose to do it this way because this seems to be the only situation
where opcodes checks the size of bfd_vma.
For v2 of this patch, I've also updated memory_error_test to do the
same thing. This is needed due to the "improve error reporting from
the disassembler" patch.
Tom de Vries [Fri, 29 Oct 2021 12:11:08 +0000 (14:11 +0200)]
[gdb/build] Fix build with --disable-unit-tests
A build with --disable-unit-tests currently run into:
...
ld: maint.o: in function \
`maintenance_selftest_completer(cmd_list_element*, completion_tracker&,
char const*, char const*)':
src/gdb/maint.c:1183: undefined reference to \
`selftests::for_each_selftest(
gdb::function_view<
void (std::__cxx11::basic_string<char,std::char_traits<char>,
std::allocator<char> > const&)>)'
...
Fix this by guarding the call to selftests::for_each_selftest in
maintenance_selftest_completer with GDB_SELF_TEST, such that the "-verbose"
completion still works.
Rebuild on x86_64-linux and ran gdb.gdb/unittest.exp.
Enze Li [Fri, 22 Oct 2021 14:30:30 +0000 (14:30 +0000)]
Document "memory-tag-violations".
* gdb/doc/gdb.texinfo: (Data): Document '-memory-tag-violations'.
(Command Options): Update the example.
Tejas Belagod [Tue, 5 Oct 2021 08:43:12 +0000 (08:43 +0000)]
Support for a new pacbti unwind opcode.
This patch adds readelf support for decoding the exception table
opcode for restoring the RA_AUTH_CODE pseudo register defined by the
EHABI
(https://github.com/ARM-software/abi-aa/releases/download/2021Q1/ehabi32.pdf
Section 10.3).
* readelf.c (decode_arm_unwind_bytecode): Add support to decode
restoring RA_AUTH_CODE pseudo register.
Alan Modra [Fri, 29 Oct 2021 09:14:40 +0000 (19:44 +1030)]
Re: arm: add unwinder encoding support for PACBTI
Move the gas testsuite files to where they belong.
Alan Modra [Fri, 29 Oct 2021 04:39:52 +0000 (15:09 +1030)]
ELF core file size checks
Catch fuzzed segments where p_offset + p_filesz wraps, and limit error
output.
* elfcore.h (elf_core_file_p): Rewrite segment checks using
bfd_get_file_size. Set read_only on file size errors.
* elfcode.h (elf_swap_shdr_in): Don't repeat error message.
Alan Modra [Fri, 29 Oct 2021 02:43:17 +0000 (13:13 +1030)]
obcopy vs. files with silly section alignment
We already ignore stupid segment alignment when rewriting headers,
ignore section alignment too.
* elf.c (rewrite_elf_program_header): Ignore section alignment
power greater than 62.
GDB Administrator [Fri, 29 Oct 2021 00:00:18 +0000 (00:00 +0000)]
Automatic date update in version.in
Stafford Horne [Thu, 28 Oct 2021 20:52:28 +0000 (05:52 +0900)]
gdb: Add OpenRISC gdbserver and native config news
The previous patches added gdbserver and native debugging support
for OpenRISC targets. This patch documents that in the news.
Stafford Horne [Fri, 23 Oct 2020 04:39:53 +0000 (13:39 +0900)]
gdb: or1k: add single step for linux native debugging
Needed for single stepping in Linux, this adds the or1k implementation
of or1k_software_single_step. Most of the implementation is borrowed
from the bare metal single step code from or1k_single_step_through_delay
which has been extracted and shared in helper function
or1k_delay_slot_p.
Stafford Horne [Thu, 8 Oct 2020 21:26:30 +0000 (06:26 +0900)]
gdb: or1k: add native linux support
This patch adds support for running gdb natively on OpenRISC linux.
Debugging support is provided via the linux PTRACE interface which is
mostly handled by GDB genric code. This patch provides the logic of how
to read and write the ptrace registers between linux and GDB.
Single stepping is privided in a separate patch.
Stafford Horne [Thu, 8 Oct 2020 21:25:39 +0000 (06:25 +0900)]
gdb: or1k: add generated linux descriptor file
Stafford Horne [Thu, 8 Oct 2020 21:24:50 +0000 (06:24 +0900)]
gdb: or1k: fixup linux regcache comment
The old comment was not properly updated from the RISC-V example used.
Update it to match OpenRISC.
Stafford Horne [Sat, 15 Aug 2020 21:04:05 +0000 (06:04 +0900)]
gdb: or1k: implement gdb server
This patch adds gdbserver support for OpenRISC. This has been used for
debugging the glibc port that in being worked on here:
https://github.com/openrisc/or1k-glibc/tree/or1k-port-2
Hence the comment about registers definitions being inline with glibc.
Christian Biesinger [Thu, 28 Oct 2021 19:09:00 +0000 (15:09 -0400)]
[sim] Include defs.h in ppc/hw_memory.c
To fix this error (seen on cygwin):
/../../sim/ppc/../common ../../../sim/ppc/hw_memory.c
In file included from ../../gnulib/import/stdlib.h:100,
from ../../../sim/ppc/hw_memory.c:28:
../../gnulib/import/unistd.h:663:3: error: #error "Please include config.h first."
663 | #error "Please include config.h first."
| ^~~~~
../../gnulib/import/unistd.h:665:24: error: expected ';' before 'extern'
665 | _GL_INLINE_HEADER_BEGIN
| ^
| ;
../../gnulib/import/unistd.h:2806:22: error: expected ';' before 'extern'
2806 | _GL_INLINE_HEADER_END
| ^
| ;
Markus Klein [Thu, 28 Oct 2021 16:17:25 +0000 (17:17 +0100)]
ARM assembler: Allow up to 32 single precision registers in the VPUSH and VPOP instructions.
PR 28436
* config/tc-arm.c (do_vfp_nsyn_push_pop_check): New function.
(do_vfp_nsyn_pop): Use the new function.
(do_vfp_nsyn_push): Use the new function.
* testsuite/gas/arm/v8_1m-mve.s: Add new instructions.
* testsuite/gas/arm/v8_1m-mve.d: Updated expected disassembly.
Simon Marchi [Thu, 28 Oct 2021 15:25:45 +0000 (11:25 -0400)]
gdb: use ptid_t::to_string in infrun debug messages
In debug messages, I think it would be more helpful to print ptid using
the simple "pid.lwp.tid" notation in infrun debug messages. I am
currently debugging some fork issues, and find the pid_to_str output not
so useful, as it doesn't tell which process a thread belongs to.
It currently shows up like this:
[infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=0, current thread [Thread 0x7ffff7d95740 (LWP 892942)] at 0x55555555521f
With the patch, it shows up like this:
[infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=1, current thread [894072.894077.0] at 0x5555555551d9
Change-Id: I130796d7dfb0d8e763b8358d8a6002701d80c4ea
Simon Marchi [Thu, 23 Sep 2021 13:56:51 +0000 (09:56 -0400)]
gdb: add selftest name completion
After the previous commit, it is easy to add completion for selftest
names. Again, this is not particularly high value, but I rarely touched
completion, so it served as a simple example to get some practice.
Change the for_each_selftest_ftype parameter to gdb::function_view, so
that we can pass a lambda that captures things.
Change-Id: I87cac299ddca9ca7eb0ffab78342e850a98d954c
Tejas Belagod [Thu, 28 Oct 2021 14:44:42 +0000 (15:44 +0100)]
arm: add unwinder encoding support for PACBTI
This patch adds support for encoding the Return Address Authentication pseudo
register - '.save {ra_auth_code}' as defined by the DWARF ABI - in the
exception tables where the opcode is defined by the EHABI
gas/Changelog:
* config/tc-arm.c (arm_reg_type): Add new type REG_TYPE_PSEUDO.
(reg_expected_msgs): Add message for pseudo reg type.
(reg_list_els): Add new reg list type REGLIST_PSEUDO.
(parse_reg_list): Handle new REGLIST_PSEUDO type.
(s_arm_unwind_save_pseudo): Encode pseudo reg list save in exception
tables.
(s_arm_unwind_save): Handle new REG_TYPE_PSEUDO.
(reg_names): Add ra_auth_code pseudo register.
* testsuite/gas/arm/unwind-pacbti-m.s: New test.
* testsuite/gas/arm/unwind-pacbti-m.d: New test.
* testsuite/gas/arm/unwind-pacbti-m-readelf.d: New test.
Simon Marchi [Wed, 22 Sep 2021 14:38:16 +0000 (10:38 -0400)]
gdb: add "maint set/show selftest verbose" commands and use process_options
I saw the new -verbose switch to "maint selftests" and thought it would
be nice for it to use the option framework. For example, that makes
having completion easy. It's not that high value, given this is a
maintenance command, but I had never used the framework myself, so it
was a good way to practice.
This patch also adds the "maint set/show selftest verbose" setting. It
would be possible to use option framework without adding the setting,
but using the framework makes adding the option almost trivial, so I
thought why not.
Change-Id: I6687faa0713ff3da60b398253211777100094144
Tom de Vries [Thu, 28 Oct 2021 14:47:07 +0000 (16:47 +0200)]
[gdb/testsuite] Update some test-cases to GPLv3
I noticed some files in the test-suite have GPLv2 notices.
Update these to GPLv3.
Simon Marchi [Wed, 22 Sep 2021 17:43:25 +0000 (13:43 -0400)]
gdb: add add_setshow_prefix_cmd
There's a common pattern to call add_basic_prefix_cmd and
add_show_prefix_cmd to add matching set and show commands. Add the
add_setshow_prefix_cmd function to factor that out and use it at a few
places.
Change-Id: I6e9e90a30e9efb7b255bf839cac27b85d7069cfd
Tom de Vries [Thu, 28 Oct 2021 12:18:15 +0000 (14:18 +0200)]
[gdb/testsuite] Require python in gdb.server/server-kill-python.exp
I came across this when running test-case gdb.server/server-kill-python.exp
with a gdb configured without python:
...
builtin_spawn gdb -nw -nx -data-directory data-directory -iex set height 0 \
-iex set width 0 -quiet -iex set height 0 -iex set width 0 \
-ex source outputs/gdb.server/server-kill-python/file1.py^M
FAIL: gdb.server/server-kill-python.exp: ensure inferior is running
Executing on target: kill -9 28535 (timeout = 300)
builtin_spawn -ignore SIGHUP kill -9 28535^M
file1.py:1: Error in sourced command file:^M
Undefined command: "import". Try "help".^M
...
Fix this by testing for python support in the test-case.
Tested on aarch64-linux (with python support disabled) and x86_64-linux (with
python support enabled).
Tom de Vries [Thu, 28 Oct 2021 12:18:15 +0000 (14:18 +0200)]
[gdb/testsuite] Fix assembly comments in gdb.dwarf2/clang-debug-names.exp.tcl
On openSUSE Leap 15.2 aarch64 I ran into:
...
clang-debug-names-debug.S:72: \
Error: junk at end of line, first unrecognized character is `#'
...
due to:
...
71 .Ldebug_names_start:
72 .short 5 # Header: version
...
Fix this by using the /* ... */ comment style instead:
...
$ sed -i 's% #\([^"]*\)%/*\1 */%' clang-debug-names.exp.tcl
...
Tested on aarch64-linux and x86_64-linux.
Tom de Vries [Thu, 28 Oct 2021 08:43:34 +0000 (10:43 +0200)]
[gdb/symtab] Handle DW_AT_string_length with location list
Consider a fortran routine where a string variable s is modified:
...
subroutine f(s)
character*(*) s
print *, s
s(1:3) = 'oof'
print *, s
end subroutine f
...
When compiling with optimization level -O1 and printing the type of
variable s we get:
...
$ gdb -q -batch outputs/gdb.opt/fortran-string/fortran-string \
-ex "b f" \
-ex run \
-ex "ptype s"
Breakpoint 1 at 0x4006f7: file fortran-string.f90, line 21.
Breakpoint 1, f (s=..., _s=_s@entry=3) at fortran-string.f90:21
21 subroutine f(s)
type = character*1
...
while with -O0 we have instead:
...
type = character (3)
...
The problem is that the type of s is:
...
<1><2d6>: Abbrev Number: 21 (DW_TAG_string_type)
<2d7> DW_AT_string_length: 0xbf (location list)
<2db> DW_AT_byte_size : 4
...
where the DW_AT_string_length is a location list, a case that is not handled
by attr_to_dynamic_prop.
Fix this by handling attr->form_is_section_offset () in attr_to_dynamic_prop.
Tested on x86_64-linux.
The test-case is based on gdb.opt/fortran-string.exp from
https://src.fedoraproject.org/rpms/gdb/raw/f32/f/gdb-archer-vla-tests.patch .
I've updated the copyrights to stretch to 2021.
[ I've tried to create a dwarf assembly test-case for this, but didn't
manage. ]
Co-Authored-By: Jan Kratochvil <jan.kratochvil@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=26910
Kavitha Natarajan [Thu, 28 Oct 2021 05:21:32 +0000 (10:51 +0530)]
[gdb/testsuite] Initialize anonymous union in gdb.cp/koenig.cc
GDB test fails while running the test case gdb.cp/koenig.exp using
clang compiler:
[...]
p foo (p_union)
No symbol "p_union" in current context.
(gdb) FAIL: gdb.cp/koenig.exp: p foo (p_union)
[...]
In the testcase, "p_union" is an unused/uninitialized variable of
anonymous union type. Clang does not emit symbol for unused anonymous
union/struct variables at any optimization level. Since the compiler
itself is not emitting the symbol for "p_union", debug info is also
not emitted when built with debug option. If the anonymous union is
initialized (or used), then clang emits the symbol "p_union" which
enables emitting debug info for "p_union".
[...]
p foo (p_union)
Cannot resolve function foo to any overloaded instance
(gdb) PASS: gdb.cp/koenig.exp: p foo (p_union)
[...]
Alan Modra [Thu, 28 Oct 2021 02:46:04 +0000 (13:16 +1030)]
asan: mmo: NULL dereferenc in mmo_xore_32
mmo_get_loc can return NULL. It's commented even, and that the caller
then must handle a split field. mmo_xore_* don't handle split fields,
instead just segfault. Stop that happening, and refuse to recognise
fuzzed mmo files that trigger this problem.
* mmo.c (mmo_get_loc): Don't declare inline.
(mmo_xore_64, mmo_xore_32, mmo_xore_16): Remove forward decls.
Return pointer, don't dereference NULL.
(mmo_scan): Return error on mmo_get_loc returning NULL.
Alan Modra [Thu, 28 Oct 2021 02:17:26 +0000 (12:47 +1030)]
bfd: remove use of INLINE
No need to use anything fancy, plain inline works just as well.
* bfd-in.h (INLINE): Don't define.
* bfd-in2.h: Regenerate.
* aoutx.h: Replace use of INLINE with inline.
* elf-eh-frame.c: Likewise.
* elf32-score7.c: Likewise.
* elfxx-mips.c: Likewise.
* ihex.c: Likewise.
* mach-o.c: Likewise.
* mmo.c: Likewise.
Alan Modra [Wed, 27 Oct 2021 22:33:00 +0000 (09:03 +1030)]
ASSERT in empty output section with address
* ldlang.c (lang_do_assignments_1): Correct "dot" inside ignored
sections.
* testsuite/ld-scripts/empty-address-4.d,
* testsuite/ld-scripts/empty-address-4.s,
* testsuite/ld-scripts/empty-address-4.t: New test.
* testsuite/ld-scripts/empty-address.exp: Run it.
GDB Administrator [Thu, 28 Oct 2021 00:00:16 +0000 (00:00 +0000)]
Automatic date update in version.in
Alan Modra [Wed, 27 Oct 2021 04:55:34 +0000 (15:25 +1030)]
asan: alpha-vms: buffer overflows
Yet more anti-fuzzer sanity checking
* vms-alpha.c (evax_bfd_print_egsd): Sanity check record and
name lengths before access.
(evax_bfd_print_etir_stc_ir, evax_bfd_print_etir): Likewise.
Alan Modra [Tue, 26 Oct 2021 09:09:12 +0000 (19:39 +1030)]
ubsan: arm: undefined shift
left shift of 2 by 31 places cannot be represented in type 'int'
* arm-dis.c (print_insn_thumb16): Avoid undefined behaviour.
Tom Tromey [Mon, 4 Oct 2021 18:38:23 +0000 (14:38 -0400)]
Fix watchpoints with multiple threads on Windows
A recent internal change pointed out that watchpoints were not working
on Windows when the inferior was multi-threaded. This happened
because the debug registers were only updated for certain threads --
in particular, those that were being resumed and that were not marked
as suspended. In the case of single-stepping, the need to update the
debug registers in other threads could also be "forgotten".
This patch changes windows-nat.c to mark all threads needing a debug
register update. This brings the code closer to what gdbserver does
(though, unfortunately, it still seems more complicated than needed).