aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1992-12-17 09:15:10 +0000
committerJohn Gilmore <gnu@cygnus>1992-12-17 09:15:10 +0000
commitde9bef49be9432334e7806405b33cd0d0a69d754 (patch)
treef808a8de6709a41ca1a6d7c0f8fe51f991c7c1a9 /gdb/solib.c
parent8cedeccaa84f502883f22f613fee7bf814db8af3 (diff)
downloadgdb-de9bef49be9432334e7806405b33cd0d0a69d754.zip
gdb-de9bef49be9432334e7806405b33cd0d0a69d754.tar.gz
gdb-de9bef49be9432334e7806405b33cd0d0a69d754.tar.bz2
Eliminate uses of NAMES_HAVE_UNDERSCORE, using
bfd_get_symbol_leading_char instead. * coffread.c (EXTERNAL_NAME): New macro for removing possible leading character from names. (read_coff_symtab): Use BFD's FILE *, don't open a second one. (read_coff_symtab): Complain() about .bb/.eb mismatch, don't error(). (process_coff_symbol, coff_read_struct_type, coff_read_enum_type): Replace NAMES_HAVE_UNDERSCORE with EXTERNAL_NAME. * kdb-start.c (main): Remove NAMES_HAVE_UNDERSCORE. * minsyms.c (install_minimal_symbols): Replace NAMES_HAVE_UNDERSCORE. Remove SOME_NAMES_HAVE_DOT support (apparently unused). * partial-stab.h: Replace NAMES_HAVE_UNDERSCORE. * solib.c: Replace NAMES_HAVE_UNDERSCORE. * stabsread.h: Remove NAMES_HAVE_UNDERSCORE and HASH_OFFSET. * symfile.c (syms_from_objfile): Insert debugging check to test NAMES_HAVE_UNDERSCORE setting against the BFD support. FIXME, remove this (and all tm-*.h NAMES_HAVE_UNDERSCORE) soon. * doc/gdbint.texinfo (Host Conditionals): Remove NAMES_HAVE_UNDERSCORE, SOME_NAMES_HAVE_DOT, document MEM_FNS_DECLARED. (Target Conditionals): Remove all of the above.
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index d9ec318..4b050de 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -90,7 +90,6 @@ struct so_list {
char so_name[MAX_PATH_SIZE]; /* shared object lib name (FIXME) */
char symbols_loaded; /* flag: symbols read in yet? */
char from_tty; /* flag: print msgs? */
- bfd *so_bfd; /* bfd for so_name */
struct objfile *objfile; /* objfile for loaded lib */
struct section_table *sections;
struct section_table *sections_end;
@@ -186,9 +185,11 @@ solib_map_sections (so)
char *scratch_pathname;
int scratch_chan;
struct section_table *p;
+ struct cleanup *old_chain;
+ bfd *abfd;
filename = tilde_expand (so -> so_name);
- make_cleanup (free, filename);
+ old_chain = make_cleanup (free, filename);
scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
&scratch_pathname);
@@ -201,19 +202,24 @@ solib_map_sections (so)
{
perror_with_name (filename);
}
+ make_cleanup (free, scratch_pathname);
- so -> so_bfd = bfd_fdopenr (scratch_pathname, NULL, scratch_chan);
- if (!so -> so_bfd)
+ abfd = bfd_fdopenr (scratch_pathname, NULL, scratch_chan);
+ if (!abfd)
{
+ close (scratch_chan);
error ("Could not open `%s' as an executable file: %s",
scratch_pathname, bfd_errmsg (bfd_error));
}
- if (!bfd_check_format (so -> so_bfd, bfd_object))
+
+ make_cleanup (bfd_close, abfd); /* Zap bfd, close scratch_chan. */
+
+ if (!bfd_check_format (abfd, bfd_object))
{
error ("\"%s\": not in executable format: %s.",
scratch_pathname, bfd_errmsg (bfd_error));
}
- if (build_section_table (so -> so_bfd, &so -> sections, &so -> sections_end))
+ if (build_section_table (abfd, &so -> sections, &so -> sections_end))
{
error ("Can't find the file sections in `%s': %s",
exec_bfd -> filename, bfd_errmsg (bfd_error));
@@ -232,6 +238,9 @@ solib_map_sections (so)
so -> textsection = p;
}
}
+
+ /* Free the file names, close the file now. */
+ do_cleanups (old_chain);
}
/* Read all dynamically loaded common symbol definitions from the inferior
@@ -273,12 +282,11 @@ solib_add_common_symbols (rtc_symp, objfile)
/* Don't enter the symbol twice if the target is re-run. */
-#ifdef NAMES_HAVE_UNDERSCORE
- if (*name == '_')
+ if (name[0] == bfd_get_symbol_leading_char (objfile->obfd))
{
name++;
}
-#endif
+
/* FIXME: Do we really want to exclude symbols which happen
to match symbols for other locations in the inferior's
address space, even when they are in different linkage units? */
@@ -634,7 +642,7 @@ find_solib (so_list_ptr)
/* Get next link map structure from inferior image and build a local
abbreviated load_map structure */
new = (struct so_list *) xmalloc (sizeof (struct so_list));
- (void) memset ((char *) new, 0, sizeof (struct so_list));
+ memset ((char *) new, 0, sizeof (struct so_list));
new -> lmaddr = lm;
/* Add the new node as the next node in the list, or as the root
node if this is the first one. */
@@ -774,9 +782,9 @@ solib_add (arg_string, from_tty, target)
if (so -> so_name[0])
{
count = so -> sections_end - so -> sections;
- (void) memcpy ((char *) (target -> to_sections + old),
- so -> sections,
- (sizeof (struct section_table)) * count);
+ memcpy ((char *) (target -> to_sections + old),
+ so -> sections,
+ (sizeof (struct section_table)) * count);
old += count;
}
}
@@ -892,10 +900,6 @@ clear_solib()
{
free ((PTR)so_list_head -> sections);
}
- if (so_list_head -> so_bfd)
- {
- bfd_close (so_list_head -> so_bfd);
- }
next = so_list_head -> next;
free((PTR)so_list_head);
so_list_head = next;