gdb: revert "gdb: unify parts of the Linux and FreeBSD core dumping code"

This reverts commit 82a1fd3a4935fe665cf08bc6820942c4a091184c.

It was pointed out:

  https://sourceware.org/pipermail/gdb-patches/2021-February/175750.html

that commit 82a1fd3a4935 caused GDB to have an unconditional
dependency on ELF specific parts of BFD.  What this means is that if
GDB and BFD are built for a non-elf target then there will be
undefined symbol references within GDB.

The right solution isn't immediately obvious.  So rather than rush a
fix in I'm reverting this commit for now, and will bring it back once
I have a good solution.

gdb/ChangeLog:

	* gcore.c (struct gcore_collect_regset_section_cb_data): Delete.
	(gcore_collect_regset_section_cb): Delete.
	(gcore_collect_thread_registers): Delete.
	(gcore_build_thread_register_notes): Delete.
	(gcore_find_signalled_thread): Delete.
	* gcore.h: Remove 'gdbsupport/gdb_signals.h' include and delete
	'gdbarch' and 'thread_info' declarations.
	(gcore_build_thread_register_notes): Delete declaration.
	(gcore_find_signalled_thread): Likewise.
	* fbsd-tdep.c: Remove 'gcore.h' include.
	(struct fbsd_collect_regset_section_cb_data): New struct.
	(fbsd_collect_regset_section_cb): New function.
	(fbsd_collect_thread_registers): New function.
	(struct fbsd_corefile_thread_data): New struct.
	(fbsd_corefile_thread): New function.
	(fbsd_make_corefile_notes): Call FreeBSD specific code.
	* linux-tdep.c: Remove 'gcore.h' include.
	(struct linux_collect_regset_section_cb_data): New struct.
	(linux_collect_regset_section_cb): New function.
	(linux_collect_thread_registers): New function.
	(linux_corefile_thread): Call Linux specific code.
	(find_signalled_thread): New function.
	(linux_make_corefile_notes): Call find_signalled_thread.
This commit is contained in:
Andrew Burgess
2021-02-09 21:41:30 +00:00
parent b61f78118a
commit 03642b7189
5 changed files with 288 additions and 170 deletions

View File

@ -21,10 +21,6 @@
#define GCORE_H 1
#include "gdb_bfd.h"
#include "gdbsupport/gdb_signals.h"
struct gdbarch;
struct thread_info;
extern gdb_bfd_ref_ptr create_gcore_bfd (const char *filename);
extern void write_gcore_file (bfd *obfd);
@ -32,20 +28,4 @@ extern int objfile_find_memory_regions (struct target_ops *self,
find_memory_region_ftype func,
void *obfd);
/* Add content to *NOTE_DATA (and update *NOTE_SIZE) to describe the
registers of thread INFO. Report the thread as having stopped with
STOP_SIGNAL. The core file is being written to OFD, and GDBARCH is the
architecture for which the core file is being generated. */
extern void gcore_build_thread_register_notes
(struct gdbarch *gdbarch, struct thread_info *info, gdb_signal stop_signal,
bfd *obfd, gdb::unique_xmalloc_ptr<char> *note_data, int *note_size);
/* Find the signalled thread. In case there's more than one signalled
thread, prefer the current thread, if it is signalled. If no thread was
signalled, default to the current thread, unless it has exited, in which
case return NULL. */
extern thread_info *gcore_find_signalled_thread ();
#endif /* GCORE_H */