Commit Graph

117106 Commits

Author SHA1 Message Date
Mike Frysinger
5f347a1106 sim: bfin: fix -Wshadow=local warnings
Rename the shadowed var to avoid confusion with the function argument
as to which address this code is using.
2023-12-22 23:29:19 -05:00
Mike Frysinger
8ce49cf102 sim: arm: fix -Wshadow=local warnings
Remove duplicate nested variable declarations, rename some to avoid
confusion when the type is different or the original value should be
retained, and fix some weirdness with nested enums in structs.
2023-12-22 23:29:19 -05:00
Mike Frysinger
2bf4edd2ea sim: aarch64: fix -Wshadow=local warnings
These functions have local vars named "val" of type float, and
then create nested vars named "val" of type double.  This is a
bit confusing and causes build time warnings.
2023-12-22 23:29:19 -05:00
GDB Administrator
68bd2358ea Automatic date update in version.in 2023-12-23 00:00:21 +00:00
Tom Tromey
2129106d20 Check for rogue DAP exceptions in test suite
This changes the test suite to look for rogue DAP exceptions in the
log file, and issue a "fail" if one is found.

Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>
2023-12-22 09:57:49 -07:00
Tom Tromey
0b32d22581 Avoid exception from attach in DAP
I noticed that the DAP attach test case (and similarly
remoted-dap.exp) had a rogue exception stack trace in the log.  It
turns out that an attach will generate a stop that does not have a
reason.

This patch fixes the problem in the _on_stop event listener by making
it a bit more careful when examining the event reason.  It also adds
some machinery so that attach stops can be suppressed, which I think
is the right thing to do.

Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>
2023-12-22 09:57:49 -07:00
Tom Tromey
dfc4bd461b Add DAP log level parameter
This adds a new parameter to control the DAP logging level.  By
default, "expected" exceptions are not logged, but the parameter lets
the user change this when more logging is desired.

This also changes a couple of spots to avoid logging the stack trace
for a DAPException.

This patch also documents the existing DAP logging parameter.  I
forgot to document this before.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>
2023-12-22 09:57:48 -07:00
Tom Tromey
2a89c9508e Introduce and use DAPException
This introduces a new DAPException class, and then changes various
spots in the DAP implementation to wrap "expected" exceptions in this.
This class will help detect rogue exceptions caused by bugs in the
implementation.

Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>
2023-12-22 09:57:30 -07:00
Tom Tromey
9b9e5c09b1 Fix build with clang 16
clang 16 reports a missing declaration in new-op.cc.  We believed
these operators to be declared starting with C++14, but apparently
that is not the case.

This patch reverts the earlier change and then updates the comment to
reflect the current state.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31141
2023-12-22 09:35:11 -07:00
Kévin Le Gouguec
54ede87e19 gdb: fix refactoring hiccup in rs6000_register_to_value
In 2023-12-14 "gdb: make get_frame_register_bytes take the next frame"
(9fc79b4236), *_register_to_value functions were made to (a) call
get_next_frame_sentinel_okay (frame) (b) pass that next frame to
get_frame_register_bytes.

Step (b) was omitted for rs6000-tdep.c; this manifests as a regression on
PPC platforms for e.g. O2_float_param: instead of seeing…

  Temporary breakpoint 1, callee.increment (val=val@entry=99.0, msg=...) at callee.adb:19

… we get "optimized_out" for val.  Passing next_frame to
get_frame_register_bytes fixes the issue.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-12-22 17:19:29 +01:00
Tom Tromey
eb6476e2db Add 'program' to DAP 'attach' request
In many cases, it's not possible for gdb to discover the executable
when a DAP 'attach' request is used.  This patch lets the IDE supply
this information.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2023-12-22 09:05:17 -07:00
Mike Frysinger
401b5b00ec sim: cgen: regenerate decode tables to avoid shadow warnings
Use latest cgen to regenerate the decode tables which has some shadow
warning fixes with "val" variables.
2023-12-22 10:53:49 -05:00
Mike Frysinger
4a517293bb sim: cris: regen cgen decoders to fix build warnings [PR sim/31181]
Bug: https://sourceware.org/PR31181
2023-12-22 10:44:39 -05:00
Guinevere Larsen
316e74cec3 gdb: add git trailer information on gdb/MAINTAINERS
The project has been using Tested-By (tb), Reviewed-By (rb) and
Approved-By (ab) for some time, but there has been no information to be
found in the actual repository. This commit changes that by adding
information about all git trailers to the MAINTAINERS file, so that it
can be easily double-checked. Simply put, the trailers in use work as
follows:

* Tested-by: The person tested the patch and it fixes the problem, or
  introduces no regressions (or both).
* Acked-by: The general outline looks good, but the maintainer hasn't
  looked at the code
* Reviewed-by: The code looks good, but the reviewer has not approved
  the patch to go upstream
* Approved-by: The patch is ready to be pushed to master

These last 3 trailers can also be restricted to one or more areas of GDB
by adding the areas in a comma separated list in parenthesis after the
trailers.

Finally, for completeness sake, the trailers Co-Authored-By and Bug
were added, even though they have been in use for a long time already

Reviewed-By: Kevin Buettner <kevinb@redhat.com>
Reviewed-By: Luis Machado <luis.machado@arm.com>
Approved-By: John Baldwin <jhb@FreeBSD.org>
2023-12-22 09:58:32 +01:00
Jan Beulich
f91e91d85e nios2: fix .text/.data interaction with .previous
Just like obj_elf_section() is called for .section, obj_elf_{text,data}()
need calling for .text/.data.
2023-12-22 09:36:13 +01:00
Jan Beulich
1124f3d536 hppa/ELF: fix .text/.data interaction with .previous
For some ELF targets .text/.data are overridden. In that case
obj_elf_{text,data}() need calling, just like .code vectors to that
function for the remaining ELF targets.

While there also hand on the function arguments, even if right now
they're meaningless. This matches what other targets' code does.
2023-12-22 09:35:52 +01:00
Jan Beulich
0495b25221 RISC-V: drop .bss override
It doesn't look to be a good idea to override the custom handler that
ELF has; afaict doing so broke .previous, and a sub-section specifier
wasn't accepted either.
2023-12-22 09:35:02 +01:00
Jan Beulich
3e4a511bee x86-64: refuse "high" 8-bit regs with .insn and VEX/XOP/EVEX encodings
Much like REX, those encodings - if permitting 8-bit regs at all, i.e.
only starting with APX - permit use of "new" 8-bit registers only. %ah,
%ch, %dh, and %bh cannot be encoded and hence should be rejected.

Permit their use outside of 64-bit code though, as "new" registers
simply don't exist there.
2023-12-22 09:34:10 +01:00
Jan Beulich
ce7056886a x86: properly respect rex/{rex}
This addresses two issues: For one, a user specified "rex" did not cause
the diagnostic to trigger when there was no other need for a REX prefix;
instead, another than the specified insn+operands was encoded. And then
(which is what this started from) .insn didn't respect {rex} (and was
otherwise similarly flawed as ordinary insns).

The latter requires splitting out code from md_assemble(), for it to
become re-usable. Besides the addition to address the first issue, that
code then also needs generalizing to account for immediate operands, as
with .insn we can't make assumptions anymore on all respective templates
having at most two operands (we still can build upon there being at most
two non-immediate operands, though). While moving the code also simplify
the first if(), by folding redundant checks.

In the new testcase also test a few more things which afaics weren't
tested till now.
2023-12-22 09:33:12 +01:00
mengqinggang
c3d507aba3 LoongArch: Add support for the third expression of .align for R_LARCH_ALIGN
If the symbol index is not zero, the addend is used to represent
the first and the third expressions of the .align.

The lowest 8 bits are used to represent the first expression.
Other bits are used to represent the third expression.

The addend of R_LARCH_ALIGN for ".align 5, ,4" is 0x405.
The addend of R_LARCH_ALIGN for ".balign 32, ,4" is 0x405.
2023-12-22 14:20:18 +08:00
Mike Frysinger
866a2ad35b sim: ppc: igen: fix -G handling
We weren't using the enable_p flag to see whether the option should
be enabled or disabled, and we weren't breaking out when done parsing.
2023-12-21 21:04:44 -05:00
Mike Frysinger
3744b73e3b sim: warnings: enable -Wreturn-type
Older versions of gcc support this warning flag.  We're already clean.
2023-12-21 20:59:16 -05:00
Mike Frysinger
fa113bd940 sim: warnings: fix -Wreturn-mismatch typo 2023-12-21 20:58:51 -05:00
Mike Frysinger
06bc778c13 sim: m32c: fix initial #line number in generated code
This emits #line 2 for the first line in the output when it should be 1.
2023-12-21 20:17:38 -05:00
Mike Frysinger
6003fe166d sim: mloop: add #line pragmas everywhere
This will make compiler diagnostics much better with generated code
so people can understand the original source file.
2023-12-21 20:16:26 -05:00
Mike Frysinger
c0e97c8525 sim: common: add $LINENO rewriting support to genmloop scripts
The generated mloop files can trigger compile time warnings.  It can
be difficult to see/understand where the original code is coming from
as all the diagnostics point to the generated output.  Using #line
pragmas, we can point people to the original source files.

Unfortunately, this code is written in POSIX shell, and that lacks
support for line number tracking.  The $LINENO variable, even when
available, can just be plain wrong.  For example, when using dash
and subshells, $LINENO can end up having negative values.  Add a
wrapper script that will uses awk to rewrite the $LINENO variable
to the right value to avoid all that.

Basically lineno.sh takes an input script, rewrites all uses of
$LINENO into the actual line number (and $0 into the original file
name), and then executes the temporary script.

This commit doesn't actually add #line pragmas to any files.  That
comes next.
2023-12-21 20:16:26 -05:00
GDB Administrator
10df3b929c Automatic date update in version.in 2023-12-22 00:00:19 +00:00
Tom Tromey
e0dd0e4d94 Rename TUI locator window -> status
The TUI status window is called the "locator" in the source, but
"status" in the documentation.  Whenever I've needed to find the code,
I've had to search to "locate" it (ha, ha).  This patch renames the
window to match the public name of the window.
2023-12-21 16:43:02 -07:00
Tom Tromey
cf2ef009cd Rename tui-stack -> tui-status
The TUI status line is called the "status" window in the
documentation, but not in the source.  There, the relevant files are
named "tui-stack", which to me makes it sound like they have something
to do with backtraces.  This patch renames them to "tui-status".
2023-12-21 16:43:02 -07:00
Rainer Orth
333a6b1a63 ld: Add lib32 directories for 32-bit emulation on FreeBSD/amd64
GNU ld currently fails to link 32-bit executables on FreeBSD/amd64 when
the linked libraries have dependencies on shared objects themselves:

$ gcc -m32 -o ei ei.c -lexecinfo
/var/gcc/binutils/amd64/lib/gcc/amd64-pc-freebsd14.0/13.2.0/../../../../amd64-pc-freebsd14.0/bin/ld:
warning: libelf.so.2, needed by /usr/lib/../lib32/libexecinfo.so, not found
(try using -rpath or -rpath-link)
/var/gcc/binutils/amd64/lib/gcc/amd64-pc-freebsd14.0/13.2.0/../../../../amd64-pc-freebsd14.0/bin/ld:
/usr/lib/../lib32/libexecinfo.so: undefined reference to `elf_begin@R1.0'
[...]

Fixed by handling FreeBSD/amd64 like Linux/x86.

Tested on amd64-pc-freebsd14.0.
2023-12-21 12:51:26 +01:00
Pedro Alves
bfcfa995f9 Fix Clang build issue with flexible array member and non-trivial dtor
Commit d5cebea18e ("Make cached_reg_t own its data") added a
destructor to cached_reg_t.

That caused a build problem with Clang, which errors out like so:

 > CXX    python/py-unwind.o
 > gdb/python/py-unwind.c:126:16: error: flexible array member 'reg' of type 'cached_reg_t[]' with non-trivial destruction
 >   126 |   cached_reg_t reg[];
 >       |                ^

This is is not really a problem for our code, which allocates the
whole structure with xmalloc, and then initializes the array elements
with in-place new, and then takes care to call the destructor
manually.  Like, commit d5cebea18e did:

 @@ -928,7 +927,7 @@ pyuw_dealloc_cache (frame_info *this_frame, void *cache)
    cached_frame_info *cached_frame = (cached_frame_info *) cache;

    for (int i = 0; i < cached_frame->reg_count; i++)
 -    xfree (cached_frame->reg[i].data);
 +    cached_frame->reg[i].~cached_reg_t ();

Maybe we should get rid of the flexible array member and use a bog
standard std::vector.  I doubt this would cause any visible
performance issue.

Meanwhile, to unbreak the build, this commit switches from C99-style
flexible array member to 0-length array.  It behaves the same, and
Clang doesn't complain.  I got the idea from here:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70932#c11

GCC 9, our oldest support version, already supported this:

  https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Zero-Length.html

but the extension is actually much older than that.  Note that
C99-style flexible array members are not standard C++ either.

Change-Id: I37dda18f367e238a41d610619935b2a0f2acacce
2023-12-21 11:07:32 +00:00
Mike Frysinger
3a4ee62868 sim: warnings: enable -Wimplicit-fallthrough=5
It caught some legitimate bugs, so clearly it's helpful.
2023-12-21 01:59:23 -05:00
Mike Frysinger
849bdf4ead sim: sh: fix -Wimplicit-fallthrough warnings
These generate conditional insns where it tests, then fallsthru.
2023-12-21 01:59:23 -05:00
Mike Frysinger
85433eb331 sim: rx: fix -Wimplicit-fallthrough warnings
Replace some fall through comments with the attribute.
2023-12-21 01:59:23 -05:00
Mike Frysinger
e8aaac5fe6 sim: rl78: fix -Wimplicit-fallthrough warnings
Seems like this code was meant to fallthru.
2023-12-21 01:59:23 -05:00
Mike Frysinger
05b9feffff sim: riscv: fix -Wimplicit-fallthrough warnings 2023-12-21 01:59:23 -05:00
Mike Frysinger
92a9d946da sim: ppc: fix -Wimplicit-fallthrough warnings
Replace some fall through comments with the attribute.
2023-12-21 01:59:23 -05:00
Mike Frysinger
77b3c4f666 sim: or1k: fix -Wimplicit-fallthrough warnings
Replace some fall through comments with the attribute.
2023-12-21 01:59:23 -05:00
Mike Frysinger
28c06ff1a1 sim: mips: fix -Wimplicit-fallthrough warnings
Seems like these cases were meant to fallthru.
2023-12-21 01:59:23 -05:00
Mike Frysinger
80200ef6b4 sim: mcore: fix Wimplicit-fallthrough warnings
Seems like these decodes were intended to fallthru.
2023-12-21 01:59:23 -05:00
Mike Frysinger
452bfb00b5 sim: m68hc11: fix -Wimplicit-fallthrough warnings
Seems like these register operations intended on falling thru.
2023-12-21 01:59:22 -05:00
Mike Frysinger
aab7152186 sim: frv: fix -Wimplicit-fallthrough warnings
Replace some fall through comments with the attribute.
2023-12-21 01:59:22 -05:00
Mike Frysinger
fcad8e6ba7 sim: erc32: fix -Wimplicit-fallthrough warnings
Add the attribute where it seems to make sense.
2023-12-21 01:59:22 -05:00
Mike Frysinger
b356d0c5a0 sim: cris: fix -Wimplicit-fallthrough warnings
Replace some fall through comments with the attribute.
2023-12-21 01:59:22 -05:00
Mike Frysinger
f0e2dc75ce sim: bfin: fix -Wimplicit-fallthrough warnings
Add the attribute to places where we want to fall thru.
2023-12-21 01:59:22 -05:00
Mike Frysinger
639bab3ca6 sim: avr: fix -Wimplicit-fallthrough warnings
Replace some fall through comments with the attribute.
2023-12-21 01:59:22 -05:00
Mike Frysinger
beb9aecf12 sim: arm: fix -Wimplicit-fallthrough warnings
Replace some fall through comments with the attribute.
2023-12-21 01:59:22 -05:00
Mike Frysinger
5e6951299a sim: aarch64: fix -Wimplicit-fallthrough warnings
Replace some fall through comments with the attribute, and add some
default abort calls when the compiler can't figure out that the set
of values were already fully enumerated in the switch statement.
2023-12-21 01:59:22 -05:00
Mike Frysinger
9362022e95 sim: common: fix -Wimplicit-fallthrough warnings
Replace some fall through comments with the attribute.
2023-12-21 01:59:22 -05:00
Mike Frysinger
29f1ffea25 sim: add ATTRIBUTE_FALLTHROUGH for local code
We'll replace various /* fall through */ comments so compilers can
actually understand what the code is doing.
2023-12-21 01:59:22 -05:00