gdb: pass core file to gdbarch_core_xfer_siginfo

Another patch that aims to remove 'current_program_space->core_bfd ()'
from GDB.  This time I'm passing the core file BFD as an argument to
the gdbarch method gdbarch_core_xfer_siginfo.

In corelow.c the core file is being passed, this does introduce a new
instance of 'current_program_space->core_bfd ()', but this is OK.  My
long term plan is to move the core bfd into core_target, in which case
the call to gdbarch_core_xfer_siginfo will have access to the core bfd
as a member variable.

For now though, this patch moves the accesses via global state up the
call stack, and consolidates the two calls from fbsd-tdep.c and
linux-tdep.c into the one call in corelow.c.

There should be no user visible changes after this commit.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Andrew Burgess
2025-08-27 11:49:24 +01:00
parent a839a42bcd
commit a45b16f16e
6 changed files with 26 additions and 23 deletions

View File

@@ -1777,12 +1777,17 @@ How the core target extracts the name of a thread from a core file.
Method(
comment="""
Read offset OFFSET of TARGET_OBJECT_SIGNAL_INFO signal information
from core file into buffer READBUF with length LEN. Return the number
from core file CBFD into buffer READBUF with length LEN. Return the number
of bytes read (zero indicates EOF, a negative value indicates failure).
""",
type="LONGEST",
name="core_xfer_siginfo",
params=[("gdb_byte *", "readbuf"), ("ULONGEST", "offset"), ("ULONGEST", "len")],
params=[
("struct bfd &", "cbfd"),
("gdb_byte *", "readbuf"),
("ULONGEST", "offset"),
("ULONGEST", "len")
],
predicate=True,
)