This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Use elfcore_write_linux_prstatus in gdb
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org, gdb-patches at sourceware dot org
- Date: Thu, 21 Jan 2016 19:58:55 +1030
- Subject: Use elfcore_write_linux_prstatus in gdb
- Authentication-results: sourceware.org; auth=none
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