+2014-09-30 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * 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.
+
2014-09-30 Andreas Arnez <arnez@linux.vnet.ibm.com>
* fbsd-nat.c (find_signalled_thread, find_stop_signal)
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,
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;
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
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. */
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;
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))
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)
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. */
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,
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,