mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
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:
@@ -594,8 +594,8 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
|
||||
/* Implement the "core_xfer_siginfo" gdbarch method. */
|
||||
|
||||
static LONGEST
|
||||
fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
|
||||
ULONGEST offset, ULONGEST len)
|
||||
fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, struct bfd &cbfd,
|
||||
gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
|
||||
{
|
||||
size_t siginfo_size;
|
||||
|
||||
@@ -607,13 +607,12 @@ fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
|
||||
return -1;
|
||||
|
||||
thread_section_name section_name (".note.freebsdcore.lwpinfo", inferior_ptid);
|
||||
bfd *cbfd = current_program_space->core_bfd ();
|
||||
asection *section = bfd_get_section_by_name (cbfd, section_name.c_str ());
|
||||
asection *section = bfd_get_section_by_name (&cbfd, section_name.c_str ());
|
||||
if (section == NULL)
|
||||
return -1;
|
||||
|
||||
gdb_byte buf[4];
|
||||
if (!bfd_get_section_contents (cbfd, section, buf,
|
||||
if (!bfd_get_section_contents (&cbfd, section, buf,
|
||||
LWPINFO_OFFSET + LWPINFO_PL_FLAGS, 4))
|
||||
return -1;
|
||||
|
||||
@@ -630,7 +629,7 @@ fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
|
||||
else
|
||||
siginfo_offset = LWPINFO_OFFSET + LWPINFO64_PL_SIGINFO;
|
||||
|
||||
if (!bfd_get_section_contents (cbfd, section, readbuf,
|
||||
if (!bfd_get_section_contents (&cbfd, section, readbuf,
|
||||
siginfo_offset + offset, len))
|
||||
return -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user