This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH RFC] IN_SOLIB_DYNSYM_RESOLVE_CODE related changes
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH RFC] IN_SOLIB_DYNSYM_RESOLVE_CODE related changes
- From: Kevin Buettner <kevinb at cygnus dot com>
- Date: Tue, 20 Feb 2001 18:48:54 -0700
The patch below resolves the potential name collision regarding
in_svr4_dynsym_resolve_code() introduced by one of my earlier patches:
http://sources.redhat.com/ml/gdb-patches/2001-02/msg00402.html
J.T. Conklin brought this collision to my attention in his review:
http://sources.redhat.com/ml/gdb-patches/2001-02/msg00403.html
Anyway... as a result of this patch, solib.h is now ifdef free. This
is a good thing, though I will note that solib.h is still not quite
right. E.g, defines like SOLIB_REMOVE_INFERIOR_HOOK need to be turned
into calls to new functions in solib.c which will in turn call the
appropriate target backend function defined in one of the solib-*.c
files. (This is essentially what the patch below does for
IN_SOLIB_DYNSYM_RESOLVE_CODE.)
I'll wait a day or so for comments before committing these changes.
* solib.h (in_svr4_dynsym_resolve_code): Delete declaration.
(in_solib_dynsym_resolve_code): Add declaration.
(IN_SOLIB_DYNSYM_RESOLVE_CODE): Changed define to invoke
in_solib_dynsym_resolve_code() rather than
in_svr4_dynsym_resolve_code(). Also, removed the ifdefs
which caused this macro to only be defined when
SVR4_SHARED_LIBS is defined.
* solib.c (in_solib_dynsym_resolve_code): New function.
* solist.h (struct target_so_ops): Add new member
in_dynsym_resolve_code.
* solib-aix5.c (aix5_in_dynsym_resolve_code): Renamed from
in_svr4_dynsym_resolve_code. Also, made static.
(_initialize_aix5_solib): Initialize in_dynsym_resolve_code
member in aix5_so_ops.
* solib-svr4.c (svr4_in_dynsym_resolve_code): Renamed from
in_svr4_dynsym_resolve_code. Also, added second version
of this function which will be used when SVR4_SHARED_LIBS
is not defined.
(_initialize_svr4_solib): Initialize In_dynsym_resolve_code
member in svr4_so_ops.
Index: solib-aix5.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-aix5.c,v
retrieving revision 1.2
diff -u -p -r1.2 solib-aix5.c
--- solib-aix5.c 2001/02/20 23:42:23 1.2
+++ solib-aix5.c 2001/02/21 01:10:29
@@ -409,9 +409,8 @@ static CORE_ADDR interp_text_sect_high;
static CORE_ADDR interp_plt_sect_low;
static CORE_ADDR interp_plt_sect_high;
-/* FIXME: Does this belong here? (If it does, it ought to be renamed.) */
-int
-in_svr4_dynsym_resolve_code (CORE_ADDR pc)
+static int
+aix5_in_dynsym_resolve_code (CORE_ADDR pc)
{
return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
|| (pc >= interp_plt_sect_low && pc < interp_plt_sect_high)
@@ -496,7 +495,7 @@ enable_break (void)
load_addr = read_pc () - tmp_bfd->start_address;
/* Record the relocated start and end address of the dynamic linker
- text and plt section for in_aix5_dynsym_resolve_code. */
+ text and plt section for aix5_in_dynsym_resolve_code. */
interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
if (interp_sect)
{
@@ -792,6 +791,7 @@ _initialize_aix5_solib (void)
aix5_so_ops.special_symbol_handling = aix5_special_symbol_handling;
aix5_so_ops.current_sos = aix5_current_sos;
aix5_so_ops.open_symbol_file_object = open_symbol_file_object;
+ aix5_so_ops.in_dynsym_resolve_code = aix5_in_dynsym_resolve_code;
native_find_global_pointer = aix5_find_global_pointer;
aix5_find_gate_addresses_hook = aix5_find_gate_addresses;
@@ -799,4 +799,3 @@ _initialize_aix5_solib (void)
/* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */
current_target_so_ops = &aix5_so_ops;
}
-
Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.9
diff -u -p -r1.9 solib-svr4.c
--- solib-svr4.c 2001/02/20 18:05:19 1.9
+++ solib-svr4.c 2001/02/21 01:10:31
@@ -1085,24 +1085,28 @@ match_main (char *soname)
}
-#ifdef SVR4_SHARED_LIBS
-
/* Return 1 if PC lies in the dynamic symbol resolution code of the
SVR4 run time loader. */
-
+#ifdef SVR4_SHARED_LIBS
static CORE_ADDR interp_text_sect_low;
static CORE_ADDR interp_text_sect_high;
static CORE_ADDR interp_plt_sect_low;
static CORE_ADDR interp_plt_sect_high;
-int
-in_svr4_dynsym_resolve_code (CORE_ADDR pc)
+static int
+svr4_in_dynsym_resolve_code (CORE_ADDR pc)
{
return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
|| (pc >= interp_plt_sect_low && pc < interp_plt_sect_high)
|| in_plt_section (pc, NULL));
}
-#endif
+#else /* !SVR4_SHARED_LIBS */
+static int
+svr4_in_dynsym_resolve_code (CORE_ADDR pc)
+{
+ return 0;
+}
+#endif /* SVR4_SHARED_LIBS */
/*
@@ -1303,7 +1307,7 @@ enable_break (void)
load_addr = read_pc () - tmp_bfd->start_address;
/* Record the relocated start and end address of the dynamic linker
- text and plt section for in_svr4_dynsym_resolve_code. */
+ text and plt section for svr4_in_dynsym_resolve_code. */
interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
if (interp_sect)
{
@@ -1694,6 +1698,8 @@ _initialize_svr4_solib (void)
svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
svr4_so_ops.current_sos = svr4_current_sos;
svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
+ svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
+ svr4_so_ops.in_dynsym_resolve_code = svr4_in_dynsym_resolve_code;
/* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */
current_target_so_ops = &svr4_so_ops;
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.35
diff -u -p -r1.35 solib.c
--- solib.c 2001/02/20 18:07:17 1.35
+++ solib.c 2001/02/21 01:10:32
@@ -765,6 +765,27 @@ solib_create_inferior_hook (void)
TARGET_SO_SOLIB_CREATE_INFERIOR_HOOK ();
}
+/* GLOBAL FUNCTION
+
+ in_solib_dynsym_resolve_code -- check to see if an address is in
+ dynamic loader's dynamic symbol
+ resolution code
+
+ SYNOPSIS
+
+ int in_solib_dynsym_resolve_code (CORE_ADDR pc)
+
+ DESCRIPTION
+
+ Determine if PC is in the dynamic linker's symbol resolution
+ code. Return 1 if so, 0 otherwise.
+*/
+
+int
+in_solib_dynsym_resolve_code (CORE_ADDR pc)
+{
+ return TARGET_SO_IN_DYNSYM_RESOLVE_CODE (pc);
+}
/*
Index: solib.h
===================================================================
RCS file: /cvs/src/src/gdb/solib.h,v
retrieving revision 1.2
diff -u -p -r1.2 solib.h
--- solib.h 2000/05/28 01:12:29 1.2
+++ solib.h 2001/02/21 01:10:32
@@ -186,13 +186,9 @@ extern char *solib_address (CORE_ADDR);
#define PC_SOLIB(addr) solib_address (addr)
-#ifdef SVR4_SHARED_LIBS
-
/* Return 1 if PC lies in the dynamic symbol resolution code of the
- SVR4 run time loader. */
-
-#define IN_SOLIB_DYNSYM_RESOLVE_CODE(pc) in_svr4_dynsym_resolve_code (pc)
+ run time loader. */
-extern int in_svr4_dynsym_resolve_code (CORE_ADDR);
+#define IN_SOLIB_DYNSYM_RESOLVE_CODE(pc) in_solib_dynsym_resolve_code (pc)
-#endif
+extern int in_solib_dynsym_resolve_code (CORE_ADDR); /* solib.c */
Index: solist.h
===================================================================
RCS file: /cvs/src/src/gdb/solist.h,v
retrieving revision 1.3
diff -u -p -r1.3 solist.h
--- solist.h 2000/11/21 01:09:54 1.3
+++ solist.h 2001/02/21 01:10:32
@@ -89,6 +89,10 @@ struct target_so_ops
/* Find, open, and read the symbols for the main executable. */
int (*open_symbol_file_object) (void *from_ttyp);
+
+ /* Determine if PC lies in the dynamic symbol resolution code of
+ the run time loader */
+ int (*in_dynsym_resolve_code) (CORE_ADDR pc);
};
void free_so (struct so_list *so);
@@ -110,3 +114,5 @@ extern struct target_so_ops *current_tar
#define TARGET_SO_CURRENT_SOS (current_target_so_ops->current_sos)
#define TARGET_SO_OPEN_SYMBOL_FILE_OBJECT \
(current_target_so_ops->open_symbol_file_object)
+#define TARGET_SO_IN_DYNSYM_RESOLVE_CODE \
+ (current_target_so_ops->in_dynsym_resolve_code)