This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fetch all registers before writing the core register notes.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3ce5b6e25ca2389c545282204b96064c00a13fab

commit 3ce5b6e25ca2389c545282204b96064c00a13fab
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Sat Mar 14 13:47:20 2015 -0400

    Fetch all registers before writing the core register notes.
    
    Without this, not all registers were present in the core generated by
    gcore.  For example, running 'gcore' on a program without examining
    the vector registers (SSE or AVX) would store all the vector registers
    as zeros because they were not pulled into the regcache.  Running
    'info vector' before 'gcore' would store the correct values in the
    core since it populated the regcache.  For Linux processes, a similar
    operation is achieved by having the thread iterator callback invoke
    target_fetch_registers on each thread before its corresponding
    register notes are dumped.
    
    gdb/ChangeLog:
    
    	* fbsd-tdep.c (fbsd_make_corefile_notes): Fetch all target registers
    	before writing core register notes.

Diff:
---
 gdb/ChangeLog   | 5 +++++
 gdb/fbsd-tdep.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eb8ef87..d984565 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-16  John Baldwin  <jhb@FreeBSD.org>
+
+	* fbsd-tdep.c (fbsd_make_corefile_notes): Fetch all target registers
+	before writing core register notes.
+
 2015-03-16  Yuanhui Zhang  <asmwarrior@gmail.com>
 	    Pedro Alves  <palves@redhat.com>
 
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 5d17f03..9609cd8 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -89,7 +89,7 @@ fbsd_collect_regset_section_cb (const char *sect_name, int size,
 static char *
 fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
 {
-  const struct regcache *regcache = get_current_regcache ();
+  struct regcache *regcache = get_current_regcache ();
   char *note_data;
   Elf_Internal_Ehdr *i_ehdrp;
   struct fbsd_collect_regset_section_cb_data data;
@@ -104,6 +104,7 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
   data.obfd = obfd;
   data.note_data = NULL;
   data.note_size = note_size;
+  target_fetch_registers (regcache, -1);
   gdbarch_iterate_over_regset_sections (gdbarch,
 					fbsd_collect_regset_section_cb,
 					&data, regcache);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]