This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[rfc/linux?] Avoid inftarg_set_find_memory_regions et.al.
- From: Andrew Cagney <cagney at gnu dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 16 Sep 2004 18:02:20 -0400
- Subject: [rfc/linux?] Avoid inftarg_set_find_memory_regions et.al.
Hello,
This, er hack, is to break the direct dependency that linux-proc.c has
on inftarg.c. Without this inftarg.c has to always be linked in, and
that gets in the way of constructing an inferior using inf-ptrace /
inf-child.
I'd like to hear from at least one arch specific GNU/Linux maintainer.
Mark, I can hack up similar for FreeBSD if you want:
config/nm-fbsd.h containing macros
config/*/nm-fbsd.h #including config/nm-fbsd.h
That would let me kill of those set methods, and I suspect make your
life easier.
comments?
Andrew
2004-09-16 Andrew Cagney <cagney@gnu.org>
* inftarg.c (init_child_ops): Set to_find_memory_regions and
to_make_corefile_notes when the corresponding macro is defined.
* linux-proc.c (linux_find_memory_regions)
(linux_make_note_section): Make non-static.
* config/nm-linux.h (DEPRECATED_CHILD_FIND_MEMORY_REGIONS)
(DEPRECATED_CHILD_MAKE_COREFILE_NOTES): Define.
(linux_find_memory_regions, linux_make_note_section): Declare.
Index: inftarg.c
===================================================================
RCS file: /cvs/src/src/gdb/inftarg.c,v
retrieving revision 1.27
diff -p -u -r1.27 inftarg.c
--- inftarg.c 14 Aug 2004 23:14:34 -0000 1.27
+++ inftarg.c 16 Sep 2004 21:55:43 -0000
@@ -649,6 +649,13 @@ init_child_ops (void)
child_ops.to_has_stack = 1;
child_ops.to_has_registers = 1;
child_ops.to_has_execution = 1;
+#ifdef DEPRECATED_CHILD_FIND_MEMORY_REGIONS
+ child_ops.to_find_memory_regions = DEPRECATED_CHILD_FIND_MEMORY_REGIONS;
+#endif
+#ifdef DEPRECATED_CHILD_MAKE_COREFILE_NOTES
+ child_ops.to_make_corefile_notes = DEPRECATED_CHILD_MAKE_COREFILE_NOTES;
+#endif
+
child_ops.to_magic = OPS_MAGIC;
}
Index: linux-proc.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-proc.c,v
retrieving revision 1.21
diff -p -u -r1.21 linux-proc.c
--- linux-proc.c 1 Feb 2004 22:35:15 -0000 1.21
+++ linux-proc.c 16 Sep 2004 21:55:43 -0000
@@ -109,7 +109,7 @@ read_mapping (FILE *mapfile,
* Lists the memory regions in the inferior for a corefile.
*/
-static int
+int
linux_find_memory_regions (int (*func) (CORE_ADDR,
unsigned long,
int, int, int, void *), void *obfd)
@@ -262,7 +262,7 @@ linux_do_registers (bfd *obfd, ptid_t pt
* in a malloc buffer.
*/
-static char *
+char *
linux_make_note_section (bfd *obfd, int *note_size)
{
struct linux_corefile_thread_data thread_args;
Index: config/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
retrieving revision 1.23
diff -p -u -r1.23 nm-linux.h
--- config/nm-linux.h 3 Sep 2004 17:13:47 -0000 1.23
+++ config/nm-linux.h 16 Sep 2004 21:55:43 -0000
@@ -70,5 +70,13 @@ extern void lin_thread_get_thread_signal
#define CHILD_FOLLOW_FORK
#define KILL_INFERIOR
+extern int linux_find_memory_regions (int (*func) (CORE_ADDR,
+ unsigned long,
+ int, int, int, void *),
+ void *obfd);
+#define DEPRECATED_CHILD_FIND_MEMORY_REGIONS linux_find_memory_regions
+extern char *linux_make_note_section (bfd *obfd, int *note_size);
+#define DEPRECATED_CHILD_MAKE_COREFILE_NOTES linux_make_note_section
+
#define NATIVE_XFER_AUXV procfs_xfer_auxv
#include "auxv.h" /* Declares it. */