public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Arnez <arnez@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 25/26] Linux targets: drop fall back to target method for 'make_corefile_notes'
Date: Fri, 12 Sep 2014 18:31:00 -0000	[thread overview]
Message-ID: <1410536396-25524-26-git-send-email-arnez@linux.vnet.ibm.com> (raw)
In-Reply-To: <1410536396-25524-1-git-send-email-arnez@linux.vnet.ibm.com>

Now that all Linux targets use the regset iterator, the fall back to
the deprecated target method is dropped.

gdb/ChangeLog:

	* linux-nat.c (linux_nat_collect_thread_registers): Remove.
	(linux_nat_make_corefile_notes): Remove.
	(linux_target_install_ops): Do not set target method
	'make_corefile_notes'.
	* linux-tdep.c (struct linux_corefile_thread_data)<collect>:
	Remove field.
	(linux_corefile_thread_callback): Instead of args->collect, call
	linux_collect_thread_registers.
	(linux_make_corefile_notes): Remove 'collect' parameter.  Return
	NULL unless there is a regset iterator.
	(linux_make_corefile_notes_1): Remove.
	(linux_init_abi): Replace reference to linux_make_corefile_notes_1
	by linux_make_corefile_notes.
	* linux-tdep.h (linux_make_corefile_notes): Remove prototype.
---
 gdb/linux-nat.c  | 57 --------------------------------------------------------
 gdb/linux-tdep.c | 36 +++++++++++------------------------
 gdb/linux-tdep.h |  3 ---
 3 files changed, 11 insertions(+), 85 deletions(-)

diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 0898442..643e9ab 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -4059,62 +4059,6 @@ linux_child_pid_to_exec_file (struct target_ops *self, int pid)
   return buf;
 }
 
-/* Records the thread's register state for the corefile note
-   section.  */
-
-static char *
-linux_nat_collect_thread_registers (const struct regcache *regcache,
-				    ptid_t ptid, bfd *obfd,
-				    char *note_data, int *note_size,
-				    enum gdb_signal stop_signal)
-{
-  struct gdbarch *gdbarch = get_regcache_arch (regcache);
-  const struct regset *regset;
-  int core_regset_p;
-  gdb_gregset_t gregs;
-  gdb_fpregset_t fpregs;
-
-  core_regset_p = gdbarch_regset_from_core_section_p (gdbarch);
-
-  if (core_regset_p
-      && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg",
-						     sizeof (gregs)))
-	 != NULL && regset->collect_regset != NULL)
-    regset->collect_regset (regset, regcache, -1, &gregs, sizeof (gregs));
-  else
-    fill_gregset (regcache, &gregs, -1);
-
-  note_data = (char *) elfcore_write_prstatus
-			 (obfd, note_data, note_size, ptid_get_lwp (ptid),
-			  gdb_signal_to_host (stop_signal), &gregs);
-
-  if (core_regset_p
-      && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg2",
-						     sizeof (fpregs)))
-	  != NULL && regset->collect_regset != NULL)
-    regset->collect_regset (regset, regcache, -1, &fpregs, sizeof (fpregs));
-  else
-    fill_fpregset (regcache, &fpregs, -1);
-
-  note_data = (char *) elfcore_write_prfpreg (obfd, note_data, note_size,
-					      &fpregs, sizeof (fpregs));
-
-  return note_data;
-}
-
-/* Fills the "to_make_corefile_note" target vector.  Builds the note
-   section for a corefile, and returns it in a malloc buffer.  */
-
-static char *
-linux_nat_make_corefile_notes (struct target_ops *self,
-			       bfd *obfd, int *note_size)
-{
-  /* FIXME: uweigand/2011-10-06: Once all GNU/Linux architectures have been
-     converted to gdbarch_core_regset_sections, this function can go away.  */
-  return linux_make_corefile_notes (target_gdbarch (), obfd, note_size,
-				    linux_nat_collect_thread_registers);
-}
-
 /* Implement the to_xfer_partial interface for memory reads using the /proc
    filesystem.  Because we can use a single read() call for /proc, this
    can be much more efficient than banging away at PTRACE_PEEKTEXT,
@@ -4511,7 +4455,6 @@ linux_target_install_ops (struct target_ops *t)
   t->to_post_startup_inferior = linux_child_post_startup_inferior;
   t->to_post_attach = linux_child_post_attach;
   t->to_follow_fork = linux_child_follow_fork;
-  t->to_make_corefile_notes = linux_nat_make_corefile_notes;
 
   super_xfer_partial = t->to_xfer_partial;
   t->to_xfer_partial = linux_xfer_partial;
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index fcba93b..7a76670 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1211,7 +1211,6 @@ struct linux_corefile_thread_data
   char *note_data;
   int *note_size;
   enum gdb_signal stop_signal;
-  linux_collect_thread_registers_ftype collect;
 };
 
 /* Called by gdbthread.c once per thread.  Records the thread's
@@ -1244,9 +1243,9 @@ linux_corefile_thread_callback (struct thread_info *info, void *data)
 
       old_chain = make_cleanup (xfree, siginfo_data);
 
-      args->note_data = args->collect (regcache, info->ptid, args->obfd,
-				       args->note_data, args->note_size,
-				       args->stop_signal);
+      args->note_data = linux_collect_thread_registers
+	(regcache, info->ptid, args->obfd, args->note_data,
+	 args->note_size, args->stop_signal);
 
       /* Don't return anything if we got no register information above,
          such a core file is useless.  */
@@ -1466,12 +1465,11 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
   return 1;
 }
 
-/* Fills the "to_make_corefile_note" target vector.  Builds the note
-   section for a corefile, and returns it in a malloc buffer.  */
+/* Build the note section for a corefile, and return it in a malloc
+   buffer.  */
 
-char *
-linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size,
-			   linux_collect_thread_registers_ftype collect)
+static char *
+linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
 {
   struct linux_corefile_thread_data thread_args;
   struct elf_internal_linux_prpsinfo prpsinfo;
@@ -1480,6 +1478,9 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size,
   int auxv_len;
   volatile struct gdb_exception e;
 
+  if (! gdbarch_iterate_over_regset_sections_p (gdbarch))
+    return NULL;
+
   if (linux_fill_prpsinfo (&prpsinfo))
     {
       if (gdbarch_elfcore_write_linux_prpsinfo_p (gdbarch))
@@ -1514,7 +1515,6 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size,
   thread_args.note_data = note_data;
   thread_args.note_size = note_size;
   thread_args.stop_signal = find_stop_signal ();
-  thread_args.collect = collect;
   iterate_over_threads (linux_corefile_thread_callback, &thread_args);
   note_data = thread_args.note_data;
   if (!note_data)
@@ -1545,20 +1545,6 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size,
   return note_data;
 }
 
-static char *
-linux_make_corefile_notes_1 (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
-{
-  /* FIXME: uweigand/2011-10-06: Once all GNU/Linux architectures have been
-     converted to gdbarch_core_regset_sections, we no longer need to fall back
-     to the target method at this point.  */
-
-  if (!gdbarch_iterate_over_regset_sections_p (gdbarch))
-    return target_make_corefile_notes (obfd, note_size);
-  else
-    return linux_make_corefile_notes (gdbarch, obfd, note_size,
-				      linux_collect_thread_registers);
-}
-
 /* Implementation of `gdbarch_gdb_signal_from_target', as defined in
    gdbarch.h.  This function is not static because it is exported to
    other -tdep files.  */
@@ -1820,7 +1806,7 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_gdbarch_info_proc (gdbarch, linux_info_proc);
   set_gdbarch_core_info_proc (gdbarch, linux_core_info_proc);
   set_gdbarch_find_memory_regions (gdbarch, linux_find_memory_regions);
-  set_gdbarch_make_corefile_notes (gdbarch, linux_make_corefile_notes_1);
+  set_gdbarch_make_corefile_notes (gdbarch, linux_make_corefile_notes);
   set_gdbarch_has_shared_address_space (gdbarch,
 					linux_has_shared_address_space);
   set_gdbarch_gdb_signal_from_target (gdbarch,
diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h
index 610e2f0..2354603 100644
--- a/gdb/linux-tdep.h
+++ b/gdb/linux-tdep.h
@@ -29,9 +29,6 @@ typedef char *(*linux_collect_thread_registers_ftype) (const struct regcache *,
 						       bfd *, char *, int *,
 						       enum gdb_signal);
 
-char *linux_make_corefile_notes (struct gdbarch *, bfd *, int *,
-                                 linux_collect_thread_registers_ftype);
-
 struct type *linux_get_siginfo_type (struct gdbarch *);
 
 extern enum gdb_signal linux_gdb_signal_from_target (struct gdbarch *gdbarch,
-- 
1.8.4.2

  parent reply	other threads:[~2014-09-12 18:31 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-12 15:40 [PATCH 00/26] Regset rework Andreas Arnez
2014-09-12 15:40 ` [PATCH 09/26] X86: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Andreas Arnez
2014-09-12 15:40 ` [PATCH 06/26] ARM: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 03/26] Add multi-arch capable 'fbsd_make_corefile_notes' variant Andreas Arnez
2014-09-12 15:40 ` [PATCH 20/26] SPARC: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Andreas Arnez
2014-09-12 15:40 ` [PATCH 08/26] HPPA: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 19/26] SH: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 05/26] ALPHA: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 01/26] Replace 'core_regset_sections' by iterator method Andreas Arnez
2014-09-12 15:40 ` [PATCH 26/26] Drop 'regset_from_core_section' gdbarch method Andreas Arnez
2014-09-12 15:40 ` [PATCH 07/26] FRV: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Andreas Arnez
2014-09-12 15:40 ` [PATCH 23/26] XTENSA: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 14/26] MIPS: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 22/26] VAX: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 12/26] IA64: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 21/26] TILEGX: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 16/26] NIOS2: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 04/26] AARCH64: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 13/26] M88K: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 17/26] PPC: " Andreas Arnez
2014-09-12 15:40 ` [PATCH 11/26] M68K: " Andreas Arnez
2014-09-12 16:14 ` [PATCH 02/26] Add 'regset' parameter to 'iterate_over_regset_sections_cb' Andreas Arnez
2014-09-12 16:15 ` [PATCH 10/26] M32R: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Andreas Arnez
2014-09-12 16:17 ` [PATCH 15/26] MN10300: " Andreas Arnez
2014-09-12 16:18 ` [PATCH 25/26] Linux targets: drop fall back to target method for 'make_corefile_notes' Andreas Arnez
2014-09-12 16:18 ` [PATCH 24/26] Drop target method 'fbsd_make_corefile_notes' Andreas Arnez
2014-09-12 16:18 ` [PATCH 18/26] SCORE: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Andreas Arnez
2014-09-12 18:31 ` Andreas Arnez [this message]
2014-09-12 18:31 ` [PATCH 15/26] MN10300: " Andreas Arnez
2014-09-12 18:31 ` [PATCH 24/26] Drop target method 'fbsd_make_corefile_notes' Andreas Arnez
2014-09-12 18:32 ` [PATCH 10/26] M32R: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Andreas Arnez
2014-09-12 18:32 ` [PATCH 02/26] Add 'regset' parameter to 'iterate_over_regset_sections_cb' Andreas Arnez
2014-09-12 18:32 ` [PATCH 18/26] SCORE: Migrate from 'regset_from_core_section' to 'iterate_over_regset_sections' Andreas Arnez
2014-09-22 17:15 ` [PATCH 00/26] Regset rework Ulrich Weigand
2014-09-26 16:20   ` Pedro Alves
2014-09-29 11:22     ` Ulrich Weigand
2014-09-30  7:59       ` Andreas Krebbel

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=1410536396-25524-26-git-send-email-arnez@linux.vnet.ibm.com \
    --to=arnez@linux.vnet.ibm.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).