aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-06-29 23:34:38 +0000
committerFred Fish <fnf@specifix.com>1992-06-29 23:34:38 +0000
commit51b57ded888cbdacb5ad126363f8ae6adc9541b6 (patch)
tree2e4f19add96d95001bd828328f309ca1b4a6b0a7 /gdb/solib.c
parent22fd4704bccdd29ab742445e9a4017e457ef449f (diff)
downloadgdb-51b57ded888cbdacb5ad126363f8ae6adc9541b6.zip
gdb-51b57ded888cbdacb5ad126363f8ae6adc9541b6.tar.gz
gdb-51b57ded888cbdacb5ad126363f8ae6adc9541b6.tar.bz2
* dbxread.c, i386-pinsn.c, i386-tdep.c, regex.c, solib.c, symmisc.c,
symtab.h, tm-i386v4.h, valprint.c, values.c: Lint. * breakpoint.c, c-exp.y, coffread.c, command.c, environ.c, eval.c, findvar.c, infcmd.c, infptrace.c, infrun.c, m2-exp.y, parse.c, putenv.c, solib.c, sparc-xdep.c, symtab.c, tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c, values.c: Replace bcopy() use with memcpy(), which is more standard and can take advantage of gcc's builtin functions for increased performance. * breakpoint.c, buildsym.c, coffread.c, dbxread.c, i386-tdep.c, ieee-float.c, infcmd.c, sparc-tdep.c, stack.c, symtab.c, symtab.h, target.c, values.c: Replace bzero() use with memset(), which is more standard and can take advantage of gcc's builtin functions for increased performance. * i386-tdep.c, main.c, valprint.c: Replace bcmp() use with memcmp(), which is more standard and can take advantage of gcc's builtin functions for increased performance.
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index 6dc6572..d9ec318 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -94,12 +94,16 @@ struct so_list {
struct objfile *objfile; /* objfile for loaded lib */
struct section_table *sections;
struct section_table *sections_end;
+ struct section_table *textsection;
};
static struct so_list *so_list_head; /* List of known shared objects */
static CORE_ADDR debug_base; /* Base of dynamic linker structures */
static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */
+extern int
+fdmatch PARAMS ((int, int)); /* In libiberty */
+
/* Local function prototypes */
static void
@@ -115,7 +119,7 @@ static int
disable_break PARAMS ((void));
static void
-info_sharedlibrary_command PARAMS ((void));
+info_sharedlibrary_command PARAMS ((char *, int));
static int
symbol_add_stub PARAMS ((char *));
@@ -223,6 +227,10 @@ solib_map_sections (so)
p -> addr += (CORE_ADDR) LM_ADDR (so);
p -> endaddr += (CORE_ADDR) LM_ADDR (so);
so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend);
+ if (strcmp (p -> sec_ptr -> name, ".text") == 0)
+ {
+ so -> textsection = p;
+ }
}
}
@@ -664,7 +672,8 @@ symbol_add_stub (arg)
register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
so -> objfile = symbol_file_add (so -> so_name, so -> from_tty,
- (unsigned int) LM_ADDR (so), 0, 0, 0);
+ (unsigned int) so -> textsection -> addr,
+ 0, 0, 0);
return (1);
}
@@ -765,8 +774,9 @@ solib_add (arg_string, from_tty, target)
if (so -> so_name[0])
{
count = so -> sections_end - so -> sections;
- bcopy (so -> sections, (char *)(target -> to_sections + old),
- (sizeof (struct section_table)) * count);
+ (void) memcpy ((char *) (target -> to_sections + old),
+ so -> sections,
+ (sizeof (struct section_table)) * count);
old += count;
}
}
@@ -791,7 +801,9 @@ DESCRIPTION
*/
static void
-info_sharedlibrary_command ()
+info_sharedlibrary_command (ignore, from_tty)
+ char *ignore;
+ int from_tty;
{
register struct so_list *so = NULL; /* link map state variable */
int header_done = 0;
@@ -1003,12 +1015,11 @@ static int
enable_break ()
{
- int j;
-
#ifndef SVR4_SHARED_LIBS
+ int j;
int in_debugger;
-
+
/* Get link_dynamic structure */
j = target_read_memory (debug_base, (char *) &dynamic_copy,
@@ -1193,11 +1204,34 @@ special_symbol_handling (so)
struct so_list *so;
{
#ifndef SVR4_SHARED_LIBS
+ int j;
+
+ if (debug_addr == 0)
+ {
+ /* Get link_dynamic structure */
+
+ j = target_read_memory (debug_base, (char *) &dynamic_copy,
+ sizeof (dynamic_copy));
+ if (j)
+ {
+ /* unreadable */
+ return;
+ }
+
+ /* Calc address of debugger interface structure */
+ /* FIXME, this needs work for cross-debugging of core files
+ (byteorder, size, alignment, etc). */
+
+ debug_addr = (CORE_ADDR) dynamic_copy.ldd;
+ }
/* Read the debugger structure from the inferior, just to make sure
we have a current copy. */
- read_memory (debug_addr, (char *) &debug_copy, sizeof (debug_copy));
+ j = target_read_memory (debug_addr, (char *) &debug_copy,
+ sizeof (debug_copy));
+ if (j)
+ return; /* unreadable */
/* Get common symbol definitions for the loaded object. */