Commit Graph

117277 Commits

Author SHA1 Message Date
Mike Frysinger
59b6dbff95 sim: cris: rvdummy: delete unused variable 2023-12-24 05:26:49 -05:00
Mike Frysinger
9e6855c7cb sim: cgen: mark cgen_rtx_error noreturn
Since this function never returns, mark it as such to fix some unused
variable warnings in error code paths.

For example, cris triggers:
sim/cris/semcrisv10f-switch.c:3558:11: error:
	variable 'tmp_newval' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]

Even though it has an "else" path that calls this error function.
2023-12-24 05:09:28 -05:00
Mike Frysinger
aea0b94653 sim: cgen: regenerate decode tables
Integrate some changes from upstream cgen that tightened up the
generated output.  Shouldn't be any functional changes here.
2023-12-24 04:07:32 -05:00
Mike Frysinger
43fbcdcd03 sim: sh: refine pwsb & pwad nops
Since these insns don't do anything and are effectively ignored,
return early to avoid doing any common processing at the end as
that requires initializing variables like "res" with something.
2023-12-24 04:00:04 -05:00
Mike Frysinger
fed277fe15 sim: sh: fix plds Dz,MACL implementation
The plds Dz,MACL insn stores the Dz bit into MACL.  The current code
was storing the "res" variable into Dz and then into MACL, but not
setting "res" to anything.  Delete that logic and make it match the
existing plds Dz,MACH insn.
2023-12-24 03:56:00 -05:00
GDB Administrator
1bdba1b773 Automatic date update in version.in 2023-12-24 00:00:11 +00:00
Mike Frysinger
4da6be3f1a sim: warnings: rework individual flag disable into dedicated vars
The -Wshadow=local is too new for some compilers, so move it to a var
that we test at configure time.
2023-12-23 01:21:23 -05:00
Vladimir Mezentsev
576d2c97d8 gprofng: fix build problems on linux-musl
ino64_t, off64_t, fpos64_t, stat64, __u64 are not defined on linux-musl.
Fixed by declaring these types for linux-musl.

2023-12-21  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/30779
	PR gprofng/29593
	* common/gp-defs.h: Define ino64_t, off64_t, fpos64_t for linux-musl.
	* libcollector/unwind.c: Define __u64 for linux-musl.
	* src/util.h: Define dbe_stat_t.
	* src/ClassFile.cc: Use dbe_stat_t instead of "struct stat64".
	* src/Dbe.cc: Likewise.
	* src/DbeFile.cc: Likewise.
	* src/DbeFile.h: Likewise.
	* src/DbeSession.cc: Likewise.
	* src/Experiment.cc: Likewise.
	* src/checks.cc: Likewise.
	* src/util.cc: Likewise.
2023-12-22 21:10:36 -08:00
Mike Frysinger
62544b0cf1 sim: sh: fix -Wshadow=local warnings
Rename the var to avoid shadowing & clobbering the higher context.
2023-12-22 23:29:19 -05:00
Mike Frysinger
f0fcc327e3 sim: riscv: fix -Wshadow=local warnings
Inline the one usage of sd in these macros to avoid possible shadowing.
2023-12-22 23:29:19 -05:00
Mike Frysinger
5cc45e2384 sim: ppc: fix -Wshadow=local warnings
Use a local name in the macro to avoid shadowing wherever it's used.
2023-12-22 23:29:19 -05:00
Mike Frysinger
d31fd3f617 sim: mips: fix -Wshadow=local warnings
Delete redundant decls when the existing scope has the same var and
type available for use.
2023-12-22 23:29:19 -05:00
Mike Frysinger
c6f30b8791 sim: m68hc11: fix -Wshadow=local warnings
Delete redundant decls when the existing scope has the same var and
type available for use.
2023-12-22 23:29:19 -05:00
Mike Frysinger
e4e3a80911 sim: m32c: fix -Wshadow=local warnings
These decoders declare a lot of common variables for use by substeps,
and then shadows a few because of how the opc generator is implemented.
Easiest way around it is to rename the per-substep vars as needed as
anything more would require substantial changes to the opc logic.
2023-12-22 23:29:19 -05:00
Mike Frysinger
2d351bda2f sim: iq2000: fix -Wshadow=local warnings
Delete redundant decls.
2023-12-22 23:29:19 -05:00
Mike Frysinger
a42661395e sim: h8300: fix -Wshadow=local warnings
Delete conflicting decls when the existing scope has vars of the same
name & type for this exact use.
2023-12-22 23:29:19 -05:00
Mike Frysinger
9b5e6c1e48 sim: frv: fix -Wshadow=local warnings
Delete redundant decls, and rename conflicting vars.
2023-12-22 23:29:19 -05:00
Mike Frysinger
a4531a4010 sim: erc32: fix -Wshadow=local warnings
Rename shadowed vars with different types to avoid confusion.
2023-12-22 23:29:19 -05:00
Mike Frysinger
87271996ea sim: cris: disable -Wshadow=local in generated mloop files
The mloop files include CGEN generated switch files which have some
nested assignments that expand into repeated shadowed variables.
Fixing this looks fairly non-trivial as it appears to be interplay
between the common CGEN code and how this particular set of cris
insns are defined.  Disable the warning instead.

In file included from sim/cris/mloop.in:286:
sim/cris/semcrisv10f-switch.c: In function ‘crisv10f_engine_run_full’:
sim/cris/semcrisv10f-switch.c:12383:8: error: declaration of ‘opval’ shadows a previous local [-Werror=shadow=local]
12383 |     SI opval = tmp_addr;
      |        ^~~~~
sim/cris/semcrisv10f-switch.c:12371:9: note: shadowed declaration is here
12371 |     USI opval = ({   SI tmp_addr;
      |         ^~~~~

And the code looks like:
	USI opval = ({
		...
			{
				SI opval = tmp_addr;
				...
			}
		...
	});

Since the CGEN code treats "opval" as an internal variable that the cpu
definitions don't have direct access to, the likelihood of this being a
real bug is low, so leave it be.  The warning is suppressed for more code
that is hand written (e.g. the mloop logic), but disabling for the entire
file is the easiest way to suppress while keeping it on everywhere else in
the sim.
2023-12-22 23:29:19 -05:00
Mike Frysinger
c99faa9291 sim: cris: fix -Wshadow=local warnings
Delete redundant local decls.
2023-12-22 23:29:19 -05:00
Mike Frysinger
ef382e84b7 sim: common: fix -Wshadow=local warnings
Rename shadowed vars with different types, and delete redundant decls.
2023-12-22 23:29:19 -05:00
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