From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org, gdb-patches@sourceware.org
Subject: Use elfcore_write_linux_prstatus in gdb
Date: Thu, 21 Jan 2016 09:29:00 -0000 [thread overview]
Message-ID: <20160121092855.GJ17028@bubble.grove.modra.org> (raw)
The gdb side. Nothing fancy here, and no support for targets that
need gdbarch_elfcore_write_linux_prstatus, mips n32, sparc64 if
writing any of pr_{u,s,cu,cs}time, and probably x86-64 x32.
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 4ac6b90..981f8db 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -704,6 +704,9 @@ M:char *:make_corefile_notes:bfd *obfd, int *note_size:obfd, note_size
# default.
F:char *:elfcore_write_linux_prpsinfo:bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prpsinfo *info:obfd, note_data, note_size, info
+# prstatus, as for prpsinfo
+F:char *:elfcore_write_linux_prstatus:bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prstatus *info:obfd, note_data, note_size, info
+
# Find core file memory regions
M:int:find_memory_regions:find_memory_region_ftype func, void *data:func, data
@@ -1248,6 +1251,7 @@ struct stap_parse_info;
struct parser_state;
struct ravenscar_arch_ops;
struct elf_internal_linux_prpsinfo;
+struct elf_internal_linux_prstatus;
struct mem_range;
struct syscalls_info;
struct thread_info;
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 29f5f3c..03a273e 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1564,9 +1564,31 @@ linux_collect_regset_section_cb (const char *sect_name, int size,
/* PRSTATUS still needs to be treated specially. */
if (strcmp (sect_name, ".reg") == 0)
- data->note_data = (char *) elfcore_write_prstatus
- (data->obfd, data->note_data, data->note_size, data->lwp,
- gdb_signal_to_host (data->stop_signal), buf);
+ {
+ struct elf_internal_linux_prstatus prstatus;
+
+ memset (&prstatus, 0, sizeof (prstatus));
+ prstatus.pr_reg = buf;
+ prstatus.pr_reg_size = size;
+ prstatus.pr_pid = data->lwp;
+ prstatus.pr_cursig = gdb_signal_to_host (data->stop_signal);
+ if (gdbarch_elfcore_write_linux_prstatus_p (data->gdbarch))
+ data->note_data = gdbarch_elfcore_write_linux_prstatus (data->gdbarch,
+ data->obfd,
+ data->note_data,
+ data->note_size,
+ &prstatus);
+ else if (gdbarch_ptr_bit (data->gdbarch) == 64)
+ data->note_data = elfcore_write_linux_prstatus64 (data->obfd,
+ data->note_data,
+ data->note_size,
+ &prstatus);
+ else
+ data->note_data = elfcore_write_linux_prstatus32 (data->obfd,
+ data->note_data,
+ data->note_size,
+ &prstatus);
+ }
else
data->note_data = (char *) elfcore_write_register_note
(data->obfd, data->note_data, data->note_size,
--
Alan Modra
Australia Development Lab, IBM
next reply other threads:[~2016-01-21 9:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-21 9:29 Alan Modra [this message]
2016-01-21 12:25 ` Pedro Alves
2016-01-21 13:11 ` Pedro Alves
2016-01-21 13:24 ` H.J. Lu
2016-01-21 14:05 ` Pedro Alves
2016-01-21 14:17 ` H.J. Lu
2016-01-21 14:26 ` Pedro Alves
2016-01-21 14:33 ` H.J. Lu
2016-01-21 14:44 ` Alan Modra
2016-01-21 15:59 ` H.J. Lu
2016-01-21 16:02 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160121092855.GJ17028@bubble.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox