Commit Graph

119535 Commits

Author SHA1 Message Date
Roland McGrath
9cc911e559 ld: Don't disable -shared / -pie support for riscv*-elf
Other *-elf targets support -shared and -pie modes.  There is no
reason to presuppose that riscv64-elf is used for "embedded", nor
for that matter that "embedded" is mutually exclusive with
wanting -shared and -pie functionality available in the linker.
2024-08-15 19:09:14 -07:00
GDB Administrator
81e9e54636 Automatic date update in version.in 2024-08-16 00:00:17 +00:00
H.J. Lu
5e3c96bded Revert "Arm: correct macro use in gas testsuite"
This reverts commit cfa18744d4.

commit 6ae8a30d44
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Aug 9 11:59:31 2024 +0200

    gas: have scrubber retain more whitespace

has been reverted to fix PR gas/32073.
2024-08-15 09:49:33 -07:00
H.J. Lu
a1299dc71e Revert "bfin: correct macro use in gas testsuite"
This reverts commit a1b7023447.

commit 6ae8a30d44
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Aug 9 11:59:31 2024 +0200

    gas: have scrubber retain more whitespace

has been reverted to fix PR gas/32073.
2024-08-15 09:49:33 -07:00
H.J. Lu
5835278179 Revert "ia64: correct macro use in gas testsuite"
This reverts commit 2231ac9b9e.

commit 6ae8a30d44
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Aug 9 11:59:31 2024 +0200

    gas: have scrubber retain more whitespace

has been reverted to fix PR gas/32073.
2024-08-15 09:49:33 -07:00
H.J. Lu
4184396d58 Revert "MIPS: correct macro use in gas and ld testsuites"
This reverts commit c0e9aca554.

commit 6ae8a30d44
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri Aug 9 11:59:31 2024 +0200

    gas: have scrubber retain more whitespace

has been reverted to fix PR gas/32073.
2024-08-15 09:49:33 -07:00
Tom Tromey
d47600c85d Add another constructor to scoped_restore_current_language
While working on something else, I noticed that this is relatively
common:

  scoped_restore_current_language save;
  set_language (something);

This patch adds a second constructor to
scoped_restore_current_language to simplify this idiom.

Reviewed-By: Tom de Vries <tdevries@suse.de>
2024-08-15 10:14:37 -06:00
Dimitar Dimitrov
5c8f918639 gas: pru: Fix trailing whitespace handling
With commit 6ae8a30d44, arguments followed
by a C-style comment ended up with a trailing space.  That extra space
character confused the PRU register name matching, leading to spurious
errors about unrecognized registers.  This affected existing code like
newlib's setjmp.s for pru.

Fix by stripping the trailing whitespace for any argument.

Even with 6ae8a30d44 reverted, this patch
is safe to be applied.

Successfully regression-tested with GCC and newlib testsuites for pru-unknown-elf.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-08-15 18:14:42 +03:00
H.J. Lu
a6f8fe0a9e lto: Don't include unused LTO archive members in output
When plugin_object_p is called by elf_link_is_defined_archive_symbol to
check if a symbol in archive is a real definition, set archive member
plugin_format to bfd_plugin_yes_unused to avoid including the unused LTO
archive members in linker output.  When plugin_object_p is called as
known used, call plugin claim_file if plugin_format is bfd_plugin_unknown
or bfd_plugin_yes_unused.

To get the proper support for archives with LTO common symbols with GCC,
the GCC fix for

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116361

is needed.

bfd/

	PR ld/32083
	* archures.c (bfd_arch_get_compatible): Treat bfd_plugin_yes_unused
	the same as bfd_plugin_yes.
	* elflink.c (elf_link_is_defined_archive_symbol): Likewise.
	* bfd.c (bfd_plugin_format): Add bfd_plugin_yes_unused.
	* plugin.c (try_claim): Try claim_file_v2 first.
	* bfd-in2.h: Regenerated.

ld/

	PR ld/32083
	* plugin.c (plugin_call_claim_file): Add an argument to return
	if LDPT_REGISTER_CLAIM_FILE_HOOK_V2 is used.
	(plugin_object_p): When KNOWN_USED is false, we call plugin
	claim_file if plugin_format is bfd_plugin_unknown and set
	plugin_format to bfd_plugin_yes_unused on LTO object.  When
	KNOWN_USED is true, we call plugin claim_file if plugin_format
	is bfd_plugin_unknown or bfd_plugin_yes_unused.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-08-15 03:54:11 -07:00
Vladimir Mezentsev
72e96189d8 gprofng: fix typo in src/collctrl.cc
gprofng/ChangeLog
2024-08-13  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* src/collctrl.cc (read_cpuinfo): Fix typo.
2024-08-14 19:30:29 -07:00
GDB Administrator
6dac711fa2 Automatic date update in version.in 2024-08-15 00:00:35 +00:00
Tom Tromey
7e2d5218ff Log gdb version and configuration in DAP
I think it would be useful for gdb's DAP logs to come with the version
and configuration information.  This might make debugging some bug
reports a little simpler.
2024-08-14 10:11:29 -06:00
Tom Tromey
d1b72c2649 Notify Python when breakpoint symbol changes
A DAP user noticed that breakpoints set by address were never updated
to show their location after the DAP launch request.  It turns out
that gdb does not emit the breakpoint-modified event when this sort of
breakpoint is updated.

This patch changes gdb to notify the breakpoint-modified observer when
a breakpoint location's symbol changes.  This in turn causes the DAP
event to be emitted.

Reviewed-by: Keith Seitz <keiths@redhat.com>
2024-08-14 10:08:58 -06:00
Tom Tromey
f238737757 Fix failure with C++ exceptions in DAP
While working on earlier patches, I noticed that the DAP C++ exception
test had some strange results in the log.  Digging into this, I found
that while the Ada catchpoints emit a "bkptno" field in the MI result,
the C++ ones do not -- but the DAP code was relying on this.

This patch fixes the problem by changing which field is examined, and
then updates the tests to verify this.

Reviewed-by: Keith Seitz <keiths@redhat.com>
2024-08-14 10:08:58 -06:00
Tom Tromey
0c3bfda0ac Make DAP instruction breakpoints unverified
Currently, when a DAP client uses setInstructionBreakpoints, the
resulting breakpoints are created as "verified", even though there is
no symbol file and thus the breakpoint can't possibly have a source
location.

This patch changes the DAP code to assume that all breakpoints are
unverified before launch.

Reviewed-by: Keith Seitz <keiths@redhat.com>
2024-08-14 10:08:58 -06:00
Tom Tromey
0341f2767a Introduce exec_mi_and_log for DAP
This adds a new exec_mi_and_log function that wraps gdb.execute_mi and
logs the command.  This can be handy when debugging DAP.

Reviewed-by: Keith Seitz <keiths@redhat.com>
2024-08-14 10:08:58 -06:00
H.J. Lu
8be33827cd ld: Add an LTO test for common symbol override
Linker checks if a symbol in an archive member is a real definition, not
common, before including the archive member in the link output so that
only a real definition in archive will override the common symbol in
object file.  Add an LTO test to verify that a real definition in archive
overrides the common symbol in object file.

	* testsuite/ld-plugin/common-1.c: New file.
	* testsuite/ld-plugin/definition-1.c: Likewise.
	* testsuite/ld-plugin/lto.exp: Run common tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-08-14 08:40:18 -07:00
Tom Tromey
b5e0214aad Remove unnecessary default argument from initialize_block_iterator
I noticed that initialize_block_iterator has a default value for one
of its arguments, but this is not needed as this function has a single
caller that always passes all arguments.  This patch removes the
default.  Tested by rebuilding.
2024-08-14 06:54:00 -06:00
Xi Ruoyao
d15180ebed LoongArch: Fix DT_RELR and relaxation interaction
Due to the way BFD implements DT_RELR as a part of relaxation, if in a
relax trip size_relative_relocs has changed the layout, when
relax_section runs only the vma of the section being relaxed is
guaranteed to be updated.  Then bad thing can happen.  For example, when
linking an auxilary program _freeze_module in the Python 3.12.4 building
system (with PGO + LTO), before sizing the .relr.dyn section, the vma of
.text is 30560 and the vma of .rodata is 2350944; in the final
executable the vma of .text is 36704 and the vma of .rodata is 2357024.
The vma increase is expected because .relr.dyn is squashed somewhere
before .text.  But size_relative_relocs may see the state in which .text
is at 36704 but .rodata "is" still at 2350944.  Thus the distance
between .text and .rodata can be under-estimated and overflowing
R_LARCH_PCREL20_S2 reloc can be created.

To avoid this issue, if size_relative_relocs is updating the size of
.relr.dyn, just supress the normal relaxation in this relax trip.  In
this situation size_relative_relocs should have been demending the next
relax trip, so the normal relaxation can happen in the next trip.

I tried to make a reduced test case but failed.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-08-14 17:45:02 +08:00
Xi Ruoyao
91e0b46551 LoongArch: Fix assertion failure with DT_RELR
In the DT_RELR implementation I missed a code path emiting relative
reloc entries.  Then the already packed relative reloc entries will be
(unnecessarily) pushed into .rela.dyn but we've not allocated the space
for them, triggering an assertion failure.

Unfortunately I failed to notice the issue until profiled bootstrapping
GCC with LTO and -Wl,-z,pack-relative-relocs.  The failure can be easily
triggered by linking a "hello world" program with -fprofile-generate and
LTO:

    $ PATH=$HOME/ld-test:$PATH gcc hw.c -fprofile-generate -Wl,-z,pack-relative-relocs -flto
    /home/xry111/git-repos/binutils-build/TEST/ld: BFD (GNU Binutils) 2.43.50.20240802 assertion fail ../../binutils-gdb/bfd/elfnn-loongarch.c:2628
    /home/xry111/git-repos/binutils-build/TEST/ld: BFD (GNU Binutils) 2.43.50.20240802 assertion fail ../../binutils-gdb/bfd/elfnn-loongarch.c:2628
    collect2: error: ld returned 1 exit status

And the reduced test case is just incredibly simple (included in the
patch) so it seems I'm just stupid enough to fail to detect it before.
Let's fix it now anyway.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-08-14 17:45:02 +08:00
Jan Beulich
8c1cd86034 gas: correct .irpc handling with empty string
Following 69cab370cf ("gas: adjust handling of quotes for .irpc") the
closing quote was mistakenly treated as the first quoted character.
2024-08-14 11:25:34 +02:00
Jan Beulich
c0177034c9 x86: correct .insn with opcode extension and VEX/XOP/EVEX encoding
When VexVVVV handling was re-worked, .insn broke: When an opcode
extension is in use, VexVVVV_DST needs using now, as ModR/M.reg is
already occupied, matching what c8866e3ec5 ("x86: Drop using
extension_opcode to encode vvvv register") did.

While adding (bad) POP2 forms, also slightly adjust existing ones:
No need to use XMM registers, and no need to specify %r8 when really
%rax is meant twice (EVEX.vvvv not really being the culprit there, or
else EVEX.V' would also have needed mentioning).
2024-08-14 11:25:12 +02:00
Felix Willgerodt
3bf62223f0 btrace: Extend ptwrite event decoding.
Call the ptwrite filter function whenever a ptwrite event is decoded.
The returned string is written to the aux_data string table and a
corresponding auxiliary instruction is appended to the function segment.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-08-14 11:20:57 +02:00
Felix Willgerodt
6be9971c93 btrace, python: Enable ptwrite filter registration.
By default GDB will be printing the hex payload of the ptwrite package as
auxiliary information.  To customize this, the user can register a ptwrite
filter function in python, that takes the payload and the PC as arguments and
returns a string which will be printed instead.  Registering the filter
function is done using a factory pattern to make per-thread filtering easier.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
2024-08-14 11:20:57 +02:00
Felix Willgerodt
77a33bb024 btrace, linux: Enable ptwrite packets.
Enable ptwrite in the PT config, if it is supported by the kernel.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
2024-08-14 11:20:56 +02:00
Felix Willgerodt
ccc480801b btrace, gdbserver: Add ptwrite to btrace_config_pt.
This enables gdb and gdbserver to communicate about ptwrite support.  If
ptwrite support would be enabled unconditionally, GDBs with older libipt
versions would break.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-08-14 11:20:56 +02:00
Felix Willgerodt
8958aefd34 python: Add clear() to gdb.Record.
This function allows to clear the trace data from python, forcing to
re-decode the trace for successive commands.
This will be used in future ptwrite patches, to trigger re-decoding when
the ptwrite filter changes.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Markus Metzger <markus.t.metzger@intel.com>
2024-08-14 11:20:56 +02:00
Felix Willgerodt
bea4f6fac4 python: Introduce gdb.RecordAuxiliary class.
Auxiliary instructions are no real instructions and get their own object
class, similar to gaps. gdb.Record.instruction_history is now possibly a
list of gdb.RecordInstruction, gdb.RecordGap or gdb.RecordAuxiliary
objects.

This patch is in preparation for the new ptwrite feature, which is based on
auxiliary instructions.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-08-14 11:20:56 +02:00
Felix Willgerodt
d5e1495d99 btrace: Handle stepping and goto for auxiliary instructions.
Print the auxiliary data when stepping. Don't allow to goto an auxiliary
instruction.

This patch is in preparation for the new ptwrite feature, which is based on
auxiliary instructions.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
2024-08-14 11:20:56 +02:00
Felix Willgerodt
4195751c5c btrace: Enable auxiliary instructions in record function-call-history.
Print the auxiliary data when a btrace_insn of type BTRACE_INSN_AUX
is encountered in the function-call-history.  Printing is
active by default, it can be silenced with the /a modifier.

This patch is in preparation for the new ptwrite feature, which is based on
auxiliary instructions.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-08-14 11:20:56 +02:00
Felix Willgerodt
72bb34e655 btrace: Enable auxiliary instructions in record instruction-history.
Print the auxiliary data when a btrace_insn of type BTRACE_INSN_AUX
is encountered in the instruction-history.  Printing is active by default,
it can be silenced with the /a modifier.

This patch is in preparation for the new ptwrite feature, which is based on
auxiliary instructions.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-08-14 11:20:55 +02:00
Felix Willgerodt
d894edfcc4 btrace: Introduce auxiliary instructions.
Auxiliary instructions are pseudo instructions pointing to auxiliary data.
This auxiliary data can be printed in all commands displaying (record
function-call-history, record instruction-history) or stepping through
(stepi etc.) the execution history, which will be introduced in the next
commits.

This patch is in preparation for the new ptwrite feature, which is based on
auxiliary instructions.

Approved-By: Markus Metzger <markus.t.metzger@intel.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2024-08-14 11:20:55 +02:00
Andrew Burgess
a4c88987f0 gdb: remove unnecessary code relating to limited-length arrays
While reviewing this commit:

  commit 8fdd2b2bcd
  Date:   Tue Aug 6 19:34:18 2024 +0200

      Mark unavailable bytes of limited-length arrays when allocating contents

I spotted that there was some code in value::record_latest relating to
limited-length arrays which appeared redundant.  The code was added
with the first introduction on limited-length arrays in commit:

  commit a0c0791577
  Date:   Fri Feb 10 23:49:19 2023 +0000

      GDB: Introduce limited array lengths while printing values

The code in question is in value::record_latest.  When the value being
recorded is lazy we need to fetch its value before adding it to the
history list.  The code I spotted checks to see if the value is lazy,
if we currently have array limiting in effect, and if we do sets
m_limited_length to max_value_size before finally calling fetch_lazy.

The first thing fetch_lazy does is call allocate_contents to setup the
value's buffer, and in allocate_contents we perform the same set of
checks: if the value is an array, and array length limiting is in
effect then only allocate max_value_size buffer for the contents.

In ::allocate_contents the `if` condition check is spread out between
::allocate_contents and ::set_limited_array_length, but I'm certain
it's checking the same condition.

As such the checks and m_limited_length adjustment in ::record_latest
is redundant and can be removed.

Out of curiosity I went back to the original a0c0791577 commit
and removed the same block of code from record_latest_value (as
value::record_latest was called back then) and non of the tests added
by commit a0c0791577 failed.  I think this block of code was
never needed.

Anyway, I removed the unnecessary code and retested and there are no
regressions.

There should be no user visible changes after this commit.

Approved-By: John Baldwin <jhb@FreeBSD.org>
2024-08-14 09:52:35 +01:00
GDB Administrator
ca25db0641 Automatic date update in version.in 2024-08-14 00:00:42 +00:00
H.J. Lu
549bc65f05 elf: Never set non_ir_ref_regular for debug reference
Never set non_ir_ref_regular for debug reference since references in
debug sections shouldn't impact LTO output.

	* elflink.c (elf_link_add_object_symbols): Don't check strip for
	references in debug sections when setting non_ir_ref_regular.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-08-13 15:43:05 -07:00
Gerlicher, Klaus
722232dafd gdb/gdbarch: fix a dot-space-space in generated files
This is a very small patch to straighten out dot-space-space in these
comments in the gdbarch generated files:

-  /* Skip verify of short_bit, invalid_p == 0 */
+  /* Skip verify of short_bit, invalid_p == 0.  */

There is no functional change after this commit.

Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-13 09:38:23 +01:00
Alan Modra
429ac18107 gas macro arg1 test
A number of targets pad out the data section, and there are targets
that have 2 or 4 octets per byte.  And some even that don't have '#'
as a line comment char.  tic6x-elf fails the test with "Error: too
many positional arguments".

	* testsuite/gas/macros/arg1.s: Pad out data section.  Use C style
	comments.
	* testsuite/gas/macros/arg1.d: Adjust to suit.  Don't run on
	multi-octet per byte targes.  xfail tic6x.
2024-08-13 12:50:46 +09:30
Alan Modra
cfe96ff03a PR32072 dlltool.c initializer-string is too long
PR 32072
	* dlltool.c: Delete unneeded forward function declaraions.
	Make buffers used by dlltmp static.
	(prefix_encode): Avoid warning.  Use stpcpy.
2024-08-13 12:50:17 +09:30
GDB Administrator
b935898fd1 Automatic date update in version.in 2024-08-13 00:00:35 +00:00
Vladimir Mezentsev
6a60060d3e gprofng: specify the heap data collection range
Extend the -H option:
 -H {off|on|N1[-N2]}  disable , or enable heap tracing, or
                      specify the heap data collection range.
                      The default is "-H off".

gprofng/ChangeLog
2024-08-08  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	* libcollector/heaptrace.c: Read the range in the -H option.
	Do not collect data if the allocated memory is out of range.
	* src/collctrl.h (heaptrace_mode): Define as char * value.
	* src/envsets.cc: Updated since heaptrace_mode is changed.
	* src/collctrl.cc: Accept the extended -H option.
	* src/gp-collect-app.cc: Accept the extended -H option.
	Remove unused code.
2024-08-12 15:54:59 -07:00
Dimitar Dimitrov
c412d3f5d9 sim: pru: Fix test case assembly with latest GAS
After the recent change in GAS [1], macro arguments must be quoted or
grouped with parenthesis.  Add the necessary parenthesis in order to fix
assembly errors like:
    mul.s:31: Error: too many positional arguments

[1] https://sourceware.org/pipermail/binutils/2024-July/136053.html

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-08-12 23:33:59 +03:00
Tom Tromey
219036b4fa Simplify typename_concat
This patch simplifies typename_concat, changing the return type and
removing the obstack allocation code.  The latter is possible because
the only caller using this mode uses the name when creating a new
type, and 'new_type' copies the string to the appropriate obstack
anyway.  It also changes typename_concat to use 'concat'.  This change
lets us remove a mildly fragile macro as well.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2024-08-12 12:16:15 -06:00
H.J. Lu
a86cec1a6f gas: Add macro tests for PR gas/32073
1. Add a macro test for expression argument with inner white spaces and
a white space before argument added by C preprocessor.
2. Add a x86-64 specific macro test.

	PR gas/32073
	* testsuite/gas/i386/x86-64-macro-1.d: New file.
	* testsuite/gas/i386/x86-64-macro-1.s: Likewise.
	* testsuite/gas/i386/x86-64.exp: Run x86-64-macro-1.
	* testsuite/gas/macros/arg1.d: New file.
	* testsuite/gas/macros/arg1.s: Likewise.
	* testsuite/gas/macros/macros.exp: Run arg1.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-08-12 10:42:02 -07:00
H.J. Lu
87582defe7 Revert "gas: have scrubber retain more whitespace"
This reverts commit 6ae8a30d44.

This fixes PR gas/32073.
2024-08-12 10:42:02 -07:00
H.J. Lu
65d41fb015 Revert "gas: drop scrubber states 14 and 15"
This reverts commit 7dd0dfbde7.

This is a prerequisite for the PR gas/32073 fix.
2024-08-12 10:42:02 -07:00
Simon Marchi
3fc9d4e2e5 pre-commit: autoupdate
Run `pre-commit autoupdate`.

Change-Id: I6623a61b7d1e827360854e825d84c5608a68e07b
2024-08-12 13:07:59 -04:00
Bernd Edlinger
250f1bbaf3 [gdb/testsuite] Fix gdb.tui/wrap-line.exp with wrapping disabled
There are a couple of ways that readline wrapping can be disabled:
- using "set horizontal-scroll-mode on" in INPUTRC,
- using a TERM setting like TERM=dumb, and
- building gdb with stub-termcap.

Using a trigger patch in default_gdb_init that adds
"set horizontal-scroll-mode on" to INPUTRC:
...
-    setenv INPUTRC [cached_file inputrc "set enable-bracketed-paste off"]
+    setenv INPUTRC [cached_file inputrc "set enable-bracketed-paste off\nset horizontal-scroll-mode on"]
...
we can easily reproduce a failure in gdb.tui/wrap-line.exp mentioned in
PR testsuite/31201 (which was reported for the stub-termcap case):
...
WARNING: timeout in accept_gdb_output
Screen Dump (size 50 columns x 24 rows, cursor at column 34, row 1):
    0 Quit
    1 <89012345678901234567890123456789W
    2
    ...
    23
FAIL: gdb.tui/wrap-line.exp: width-hard-coded: cli: wrap
...

Fix this by accepting the horizontal-scroll-mode style output.  We do
this only when in CLI mode though, when in TUI wrapping works as before
because it doesn't rely on readline.

Tested on x86_64-linux.

Co-Authored-By: Tom de Vries <tdevries@suse.de>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31201
2024-08-12 17:32:44 +02:00
Simon Marchi
37ef6d976a gdb/amd-dbgapi-target: adjust to amd-dbgapi 0.75.0
amd-dbgapi 0.75 (from ROCm release 6.2.0) brings a few backwards
incompatible changes.  Adjust the amd-dbgapi target code accordingly.
Given that the AMD GPU port in upstream GDB today is of limited use
(it's still missing important  pieces), we don't really care about
supporting amd-dbgapi versions other than the latest stable one, so no
effort is made to keep compatibility with versions 6.1.2 and older.

The changes are:

 - AMD_DBGAPI_EXCEPTION_WAVE_APERTURE_VIOLATION was renamed to
   AMD_DBGAPI_EXCEPTION_WAVE_ADDRESS_ERROR (the old name still exists
   but is deprecated), use the latter.

 - In the callbacks structure, the get_os_pid callback was replaced with
   client_process_get_info, which is more general and extensible.
   Convert our get_os_pid to a new, equivalent, client_process_get_info
   callback.  Handle the new AMD_DBGAPI_CLIENT_PROCESS_INFO_CORE_STATE
   query, but just return "not available".

 - The xfer_global_memory callback was added to the callbacks structure,
   add that new callback.

 - Update configure.ac to check for amd-dbgapi >= 0.75.0.

Change-Id: If012398cf55ebf6146b007f6b4e8395dd48ef981
Approved-By: Lancelot Six <lancelot.six@amd.com>
Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
2024-08-12 11:30:44 -04:00
Simon Marchi
91f378ddd0 gdb: pass inferior to gdbarch_update_p
Make the current inferior reference bubble up one level.  I think this
makes it clearer what gdbarch_update_p, which is update the passed
inferior's architecture (although the function name could probably be
better).

When gdbarch_find_by_info, it is possible for the new architecture's
init callback to be called.  I have not audited all of them (there are
just too many), it's possible that some of them do care about the
current inferior, for some reason (for instance, if one of them makes a
target call).  If so, they should be changed too.

Change-Id: I89f012188d7fdca395a830f4b013743565f26847
2024-08-12 11:10:02 -04:00
Simon Marchi
74e39223b5 gdb: pass inferior to target_current_description
Make the current inferior reference bubble up one level.

Change-Id: I441f954877749dc5a861ab03e881b529dafc2efd
2024-08-12 11:10:01 -04:00