gdb: more current_program_space->core_bfd() removal

This commit changes the signature of the gdbarch_core_info_proc method
so that it takes a 'struct bfd *' as an extra argument.  This argument
is used to pass through the core file bfd pointer.

Now, in corelow.c, when calling gdbarch_core_info_proc, we can pass
through current_program_space->core_bfd() as the argument.  Within the
implementations, (Linux and FreeBSD) we can use this argument rather
than having to access the core file through current_program_space.

This reduces the use of global state, which I think is a good thing.

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-21 13:13:59 +01:00
parent 2bd87cef85
commit 43ed67a290
6 changed files with 24 additions and 20 deletions

View File

@@ -2554,11 +2554,15 @@ Method(
comment="""
Implement the "info proc" command for core files. Note that there
are two "info_proc"-like methods on gdbarch -- one for core files,
one for live targets.
one for live targets. CBFD is the core file being read from.
""",
type="void",
name="core_info_proc",
params=[("const char *", "args"), ("enum info_proc_what", "what")],
params=[
("struct bfd *", "cbfd"),
("const char *", "args"),
("enum info_proc_what", "what")
],
predicate=True,
)