aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1996-07-08 09:05:18 +0000
committerFred Fish <fnf@specifix.com>1996-07-08 09:05:18 +0000
commitace4b8d75a3bd81cdaf61a0fec307d631388470d (patch)
treea58747a97825773044bd6aed6c2c6e650062d8f3 /gdb
parentb7cc3e753094407b5dbb1f4d6c70e679f4fe2172 (diff)
downloadgdb-ace4b8d75a3bd81cdaf61a0fec307d631388470d.zip
gdb-ace4b8d75a3bd81cdaf61a0fec307d631388470d.tar.gz
gdb-ace4b8d75a3bd81cdaf61a0fec307d631388470d.tar.bz2
(laying some groundwork for a fix for PR 8443)
* coffread.c (record_minimal_symbol): Don't presave name string on symbol_obstack before passing to prim_record_minimal_symbol. It now handles saving the string itself. * dbxread.c (read_dbx_dynamic_symtab): Ditto. * mipsread.c (read_alphacoff_dynamic_symtab): Ditto. * os9kread.c (record_minimal_symbol): Ditto. * solib.c (solib_add_common_symbols): Ditto. * coffread.c (coff_symtab_read): Don't presave name string on symbol_obstack before passing to prim_record_minimal_symbol_and_info. It now handles saving the string itself. * dbxread.c (record_minimal_symbol): Ditto. * elfread.c (record_minimal_symbol_and_info): Ditto. * dstread.c (record_minimal_symbol): Remove static function that just called prim_record_minimal_symbol with the same args (after change to prim_record_minimal_symbol to do it's own name string saves). * nlmread.c (record_minimal_symbol): Ditto. * somread.c (record_minimal_symbol): Ditto. * hpread.c (hpread_read_enum_type): Save symbol name on symbol obstack. (hpread_read_function_type): Ditto. (hpread_process_one_debug_symbol): Ditto. * mdebugread.c (parse_symbol): Ditto. (new_symbol): Ditto. * minsyms.c (prim_record_minimal_symbol_and_info): Ditto. * coffread.c (process_coff_symbol): Use obsavestring to save SYMBOL_NAME, rather than obstack_copy0. * dstread.c (create_new_symbol): Ditto * symfile.c (obconcat): Ditto. * stabsread.c (patch_block_stabs): Ditto. * xcoffread.c (SYMNAME_ALLOC): Ditto. * symfile.c (obsavestring): Update comments * solib.c (solib_add_common_symbols): Remove local var origname.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog39
-rw-r--r--gdb/dbxread.c14
-rw-r--r--gdb/dstread.c27
-rw-r--r--gdb/elfread.c1
-rw-r--r--gdb/hpread.c8
-rw-r--r--gdb/mdebugread.c7
-rw-r--r--gdb/minsyms.c4
-rw-r--r--gdb/nlmread.c21
-rw-r--r--gdb/os9kread.c4
-rw-r--r--gdb/solib.c30
-rw-r--r--gdb/somread.c21
-rw-r--r--gdb/stabsread.c3
-rw-r--r--gdb/symfile.c16
-rw-r--r--gdb/xcoffread.c2
14 files changed, 97 insertions, 100 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fe115f1..d4f2aa9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,42 @@
+Sun Jul 7 14:57:34 1996 Fred Fish <fnf@cygnus.com>
+
+ * coffread.c (record_minimal_symbol): Don't presave name string
+ on symbol_obstack before passing to prim_record_minimal_symbol.
+ It now handles saving the string itself.
+ * dbxread.c (read_dbx_dynamic_symtab): Ditto.
+ * mipsread.c (read_alphacoff_dynamic_symtab): Ditto.
+ * os9kread.c (record_minimal_symbol): Ditto.
+ * solib.c (solib_add_common_symbols): Ditto.
+
+ * coffread.c (coff_symtab_read): Don't presave name string on
+ symbol_obstack before passing to prim_record_minimal_symbol_and_info.
+ It now handles saving the string itself.
+ * dbxread.c (record_minimal_symbol): Ditto.
+ * elfread.c (record_minimal_symbol_and_info): Ditto.
+
+ * dstread.c (record_minimal_symbol): Remove static function that just
+ called prim_record_minimal_symbol with the same args (after change to
+ prim_record_minimal_symbol to do it's own name string saves).
+ * nlmread.c (record_minimal_symbol): Ditto.
+ * somread.c (record_minimal_symbol): Ditto.
+
+ * hpread.c (hpread_read_enum_type): Save symbol name on symbol obstack.
+ (hpread_read_function_type): Ditto.
+ (hpread_process_one_debug_symbol): Ditto.
+ * mdebugread.c (parse_symbol): Ditto.
+ (new_symbol): Ditto.
+ * minsyms.c (prim_record_minimal_symbol_and_info): Ditto.
+
+ * coffread.c (process_coff_symbol): Use obsavestring to save
+ SYMBOL_NAME, rather than obstack_copy0.
+ * dstread.c (create_new_symbol): Ditto
+ * symfile.c (obconcat): Ditto.
+ * stabsread.c (patch_block_stabs): Ditto.
+ * xcoffread.c (SYMNAME_ALLOC): Ditto.
+
+ * symfile.c (obsavestring): Update comments
+ * solib.c (solib_add_common_symbols): Remove local var origname.
+
Wed Jul 3 15:56:08 1996 Stu Grossman (grossman@critters.cygnus.com)
* configure: Re-build with autoconf-2.10.
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index e7091c0..de31d46 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -499,12 +499,7 @@ record_minimal_symbol (name, address, type, objfile)
lowest_text_address = address;
prim_record_minimal_symbol_and_info
- (obsavestring (name, strlen (name), &objfile -> symbol_obstack),
- address,
- ms_type,
- NULL,
- section,
- objfile);
+ (name, address, ms_type, NULL, section, objfile);
}
/* Scan and build partial symbols for a symbol file.
@@ -1107,11 +1102,8 @@ read_dbx_dynamic_symtab (section_offsets, objfile)
}
name = (char *) bfd_asymbol_name (*rel->sym_ptr_ptr);
- prim_record_minimal_symbol
- (obsavestring (name, strlen (name), &objfile -> symbol_obstack),
- address,
- mst_solib_trampoline,
- objfile);
+ prim_record_minimal_symbol (name, address, mst_solib_trampoline,
+ objfile);
}
do_cleanups (back_to);
diff --git a/gdb/dstread.c b/gdb/dstread.c
index 16b02f5..c5a79b8 100644
--- a/gdb/dstread.c
+++ b/gdb/dstread.c
@@ -76,10 +76,6 @@ static void
dst_symfile_finish PARAMS ((struct objfile *));
static void
-record_minimal_symbol PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type,
- struct objfile *));
-
-static void
dst_end_symtab PARAMS ((struct objfile *));
static void
@@ -234,19 +230,6 @@ dst_end_symtab (objfile)
last_source_file = NULL;
}
-static void
-record_minimal_symbol (name, address, type, objfile)
- char *name;
- CORE_ADDR address;
- enum minimal_symbol_type type;
- struct objfile *objfile;
-{
- prim_record_minimal_symbol (savestring (name, strlen (name)),
- address,
- type,
- objfile);
-}
-
/* dst_symfile_init ()
is the dst-specific initialization routine for reading symbols.
@@ -812,8 +795,8 @@ create_new_symbol(objfile, name)
struct symbol *sym = (struct symbol *)
obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
- SYMBOL_NAME (sym) = obstack_copy0 (&objfile->symbol_obstack,
- name, strlen (name));
+ SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
+ &objfile->symbol_obstack);
SYMBOL_VALUE (sym) = 0;
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
@@ -1476,7 +1459,7 @@ process_dst_block(objfile, entry)
case dst_block_function:
case dst_block_subroutine:
case dst_block_program:
- record_minimal_symbol(name, address, mst_text, objfile);
+ prim_record_minimal_symbol(name, address, mst_text, objfile);
function = process_dst_function(
objfile,
symbol_entry,
@@ -1637,7 +1620,7 @@ read_dst_symtab (objfile)
}
}
if (module_num)
- record_minimal_symbol("<end_of_program>",
+ prim_record_minimal_symbol("<end_of_program>",
BLOCK_END(block), mst_text, objfile);
/* One more faked symbol to make sure nothing can ever run off the
* end of the symbol table. This one represents the end of the
@@ -1647,7 +1630,7 @@ read_dst_symtab (objfile)
* but no functions are ever mapped to an address higher than
* 40000000
*/
- record_minimal_symbol("<end_of_text>",
+ prim_record_minimal_symbol("<end_of_text>",
(CORE_ADDR) 0x40000000,
mst_text, objfile);
while (struct_list)
diff --git a/gdb/elfread.c b/gdb/elfread.c
index a38a5f4..8a757e4 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -202,7 +202,6 @@ record_minimal_symbol_and_info (name, address, ms_type, info, objfile)
break;
}
- name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
return prim_record_minimal_symbol_and_info
(name, address, ms_type, info, section, objfile);
}
diff --git a/gdb/hpread.c b/gdb/hpread.c
index e902169..63ce77c 100644
--- a/gdb/hpread.c
+++ b/gdb/hpread.c
@@ -1287,7 +1287,8 @@ hpread_read_enum_type (hp_type, dn_bufp, objfile)
sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
- SYMBOL_NAME (sym) = name;
+ SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
+ &objfile->symbol_obstack);
SYMBOL_CLASS (sym) = LOC_CONST;
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
SYMBOL_VALUE (sym) = memp->dmember.value;
@@ -1378,7 +1379,8 @@ hpread_read_function_type (hp_type, dn_bufp, objfile)
sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
sizeof (struct symbol));
(void) memset (sym, 0, sizeof (struct symbol));
- SYMBOL_NAME (sym) = name;
+ SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
+ &objfile->symbol_obstack);
/* Figure out where it lives. */
if (paramp->dfparam.regparam)
@@ -1790,7 +1792,7 @@ hpread_process_one_debug_symbol (dn_bufp, name, section_offsets, objfile,
sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
- SYMBOL_NAME (sym) = name;
+ SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack);
SYMBOL_LANGUAGE (sym) = language_auto;
SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 89015ba..927c796 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -1114,7 +1114,9 @@ parse_symbol (sh, ax, ext_sh, bigend, section_offsets)
obstack_alloc (&current_objfile->symbol_obstack,
sizeof (struct symbol)));
memset ((PTR) enum_sym, 0, sizeof (struct symbol));
- SYMBOL_NAME (enum_sym) = f->name;
+ SYMBOL_NAME (enum_sym) =
+ obsavestring (f->name, strlen (f->name),
+ &current_objfile->symbol_obstack);
SYMBOL_CLASS (enum_sym) = LOC_CONST;
SYMBOL_TYPE (enum_sym) = t;
SYMBOL_NAMESPACE (enum_sym) = VAR_NAMESPACE;
@@ -4099,7 +4101,8 @@ new_symbol (name)
sizeof (struct symbol)));
memset ((PTR) s, 0, sizeof (*s));
- SYMBOL_NAME (s) = name;
+ SYMBOL_NAME (s) = obsavestring (name, strlen (name),
+ &current_objfile->symbol_obstack);
SYMBOL_LANGUAGE (s) = psymtab_language;
SYMBOL_INIT_DEMANGLED_NAME (s, &current_objfile->symbol_obstack);
return s;
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 11cb88f..608ae70 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -505,6 +505,7 @@ prim_record_minimal_symbol (name, address, ms_type, objfile)
/* Record a minimal symbol in the msym bunches. Returns the symbol
newly created. */
+
struct minimal_symbol *
prim_record_minimal_symbol_and_info (name, address, ms_type, info, section,
objfile)
@@ -547,7 +548,8 @@ prim_record_minimal_symbol_and_info (name, address, ms_type, info, section,
msym_bunch = new;
}
msymbol = &msym_bunch -> contents[msym_bunch_index];
- SYMBOL_NAME (msymbol) = (char *) name;
+ SYMBOL_NAME (msymbol) = obsavestring ((char *) name, strlen (name),
+ &objfile->symbol_obstack);
SYMBOL_INIT_LANGUAGE_SPECIFIC (msymbol, language_unknown);
SYMBOL_VALUE_ADDRESS (msymbol) = address;
SYMBOL_SECTION (msymbol) = section;
diff --git a/gdb/nlmread.c b/gdb/nlmread.c
index bc16d00..fa588df 100644
--- a/gdb/nlmread.c
+++ b/gdb/nlmread.c
@@ -43,11 +43,6 @@ nlm_symfile_finish PARAMS ((struct objfile *));
static void
nlm_symtab_read PARAMS ((bfd *, CORE_ADDR, struct objfile *));
-static void
-record_minimal_symbol PARAMS ((char *, CORE_ADDR, enum minimal_symbol_type,
- struct objfile *));
-
-
/* Initialize anything that needs initializing when a completely new symbol
file is specified (not just adding some symbols from another file, e.g. a
shared library).
@@ -79,18 +74,6 @@ nlm_symfile_init (ignore)
{
}
-static void
-record_minimal_symbol (name, address, ms_type, objfile)
- char *name;
- CORE_ADDR address;
- enum minimal_symbol_type ms_type;
- struct objfile *objfile;
-{
- name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
- prim_record_minimal_symbol (name, address, ms_type, objfile);
-}
-
-
/*
LOCAL FUNCTION
@@ -159,8 +142,8 @@ nlm_symtab_read (abfd, addr, objfile)
else
ms_type = mst_unknown;
- record_minimal_symbol ((char *) sym -> name, symaddr, ms_type,
- objfile);
+ prim_record_minimal_symbol (sym -> name, symaddr, ms_type,
+ objfile);
}
}
do_cleanups (back_to);
diff --git a/gdb/os9kread.c b/gdb/os9kread.c
index 44ae0be..8d01a8e 100644
--- a/gdb/os9kread.c
+++ b/gdb/os9kread.c
@@ -228,9 +228,7 @@ record_minimal_symbol (name, address, type, objfile, section_offsets)
ms_type = mst_unknown; break;
}
- prim_record_minimal_symbol
- (obsavestring (name, strlen(name), &objfile->symbol_obstack),
- address, ms_type, objfile);
+ prim_record_minimal_symbol (name, address, ms_type, objfile);
}
/* read and process .stb file and store in minimal symbol table */
diff --git a/gdb/solib.c b/gdb/solib.c
index 6f8c376..9e50c16 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -21,6 +21,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h"
+/* This file is only compilable if link.h is available. */
+
+#ifdef HAVE_LINK_H
+
#include <sys/types.h>
#include <signal.h>
#include "gdb_string.h"
@@ -158,9 +162,6 @@ sharedlibrary_command PARAMS ((char *, int));
static int
enable_break PARAMS ((void));
-static int
-disable_break PARAMS ((void));
-
static void
info_sharedlibrary_command PARAMS ((char *, int));
@@ -186,6 +187,9 @@ elf_locate_base PARAMS ((void));
#else
+static int
+disable_break PARAMS ((void));
+
static void
allocate_rt_common_objfile PARAMS ((void));
@@ -346,7 +350,6 @@ solib_add_common_symbols (rtc_symp)
struct nlist inferior_rtc_nlist;
int len;
char *name;
- char *origname;
/* Remove any runtime common symbols from previous runs. */
@@ -377,18 +380,16 @@ solib_add_common_symbols (rtc_symp)
behind the name of the symbol. */
len = inferior_rtc_nlist.n_value - inferior_rtc_nlist.n_un.n_strx;
- origname = name = xmalloc (len);
+ name = xmalloc (len);
read_memory ((CORE_ADDR) inferior_rtc_nlist.n_un.n_name, name, len);
/* Allocate the runtime common objfile if necessary. */
if (rt_common_objfile == NULL)
allocate_rt_common_objfile ();
- name = obsavestring (name, strlen (name),
- &rt_common_objfile -> symbol_obstack);
prim_record_minimal_symbol (name, inferior_rtc_nlist.n_value,
mst_bss, rt_common_objfile);
- free (origname);
+ free (name);
}
rtc_symp = inferior_rtc_symb.rtc_next;
}
@@ -756,7 +757,7 @@ locate_base ()
debug_base = elf_locate_base ();
#ifdef HANDLE_SVR4_EXEC_EMULATORS
/* Try it the hard way for emulated executables. */
- else if (inferior_pid != 0)
+ else if (inferior_pid != 0 && target_has_execution)
proc_iterate_over_mappings (look_for_base);
#endif
}
@@ -1241,6 +1242,8 @@ DESCRIPTION
*/
+#ifndef SVR4_SHARED_LIBS
+
static int
disable_break ()
{
@@ -1289,6 +1292,8 @@ disable_break ()
return (status);
}
+#endif /* #ifdef SVR4_SHARED_LIBS */
+
/*
LOCAL FUNCTION
@@ -1679,10 +1684,13 @@ int from_tty;
solib_add (args, from_tty, (struct target_ops *) 0);
}
+#endif /* HAVE_LINK_H */
+
void
_initialize_solib()
{
-
+#ifdef HAVE_LINK_H
+
add_com ("sharedlibrary", class_files, sharedlibrary_command,
"Load shared object library symbols for files matching REGEXP.");
add_info ("sharedlibrary", info_sharedlibrary_command,
@@ -1698,4 +1706,6 @@ informs gdb that a new library has been loaded. Otherwise, symbols\n\
must be loaded manually, using `sharedlibrary'.",
&setlist),
&showlist);
+
+#endif /* HAVE_LINK_H */
}
diff --git a/gdb/somread.c b/gdb/somread.c
index 4951f10..4223d71 100644
--- a/gdb/somread.c
+++ b/gdb/somread.c
@@ -55,22 +55,6 @@ som_symtab_read PARAMS ((bfd *, struct objfile *,
static struct section_offsets *
som_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
-static void
-record_minimal_symbol PARAMS ((char *, CORE_ADDR,
- enum minimal_symbol_type,
- struct objfile *));
-
-static void
-record_minimal_symbol (name, address, ms_type, objfile)
- char *name;
- CORE_ADDR address;
- enum minimal_symbol_type ms_type;
- struct objfile *objfile;
-{
- name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
- prim_record_minimal_symbol (name, address, ms_type, objfile);
-}
-
/*
LOCAL FUNCTION
@@ -311,9 +295,8 @@ som_symtab_read (abfd, objfile, section_offsets)
error ("Invalid symbol data; bad HP string table offset: %d",
bufp->name.n_strx);
- record_minimal_symbol (symname,
- bufp->symbol_value, ms_type,
- objfile);
+ prim_record_minimal_symbol (symname, bufp->symbol_value, ms_type,
+ objfile);
}
}
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 30a8efe..67b39f9 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -455,7 +455,7 @@ patch_block_stabs (symbols, stabs, objfile)
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
SYMBOL_NAME (sym) =
- obstack_copy0 (&objfile->symbol_obstack, name, pp - name);
+ obsavestring (name, pp - name, &objfile->symbol_obstack);
pp += 2;
if (*(pp-1) == 'F' || *(pp-1) == 'f')
{
@@ -4328,6 +4328,7 @@ common_block_end (objfile)
sym = (struct symbol *)
obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
memset (sym, 0, sizeof (struct symbol));
+ /* Note: common_block_name already saved on symbol_obstack */
SYMBOL_NAME (sym) = common_block_name;
SYMBOL_CLASS (sym) = LOC_BLOCK;
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 2850af3..cdf12a6 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -224,9 +224,10 @@ sort_symtab_syms (s)
}
}
-/* Make a copy of the string at PTR with SIZE characters in the symbol obstack
- (and add a null character at the end in the copy).
- Returns the address of the copy. */
+/* Make a null terminated copy of the string at PTR with SIZE characters in
+ the obstack pointed to by OBSTACKP . Returns the address of the copy.
+ Note that the string at PTR does not have to be null terminated, I.E. it
+ may be part of a larger string and we are only saving a substring. */
char *
obsavestring (ptr, size, obstackp)
@@ -235,8 +236,9 @@ obsavestring (ptr, size, obstackp)
struct obstack *obstackp;
{
register char *p = (char *) obstack_alloc (obstackp, size + 1);
- /* Open-coded memcpy--saves function call time.
- These strings are usually short. */
+ /* Open-coded memcpy--saves function call time. These strings are usually
+ short. FIXME: Is this really still true with a compiler that can
+ inline memcpy? */
{
register char *p1 = ptr;
register char *p2 = p;
@@ -248,8 +250,8 @@ obsavestring (ptr, size, obstackp)
return p;
}
-/* Concatenate strings S1, S2 and S3; return the new string.
- Space is found in the symbol_obstack. */
+/* Concatenate strings S1, S2 and S3; return the new string. Space is found
+ in the obstack pointed to by OBSTACKP. */
char *
obconcat (obstackp, s1, s2, s3)
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index c2e7905..727d558 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1415,7 +1415,7 @@ read_xcoff_symtab (pst)
#define SYMNAME_ALLOC(NAME, ALLOCED) \
- (ALLOCED) ? (NAME) : obstack_copy0 (&objfile->symbol_obstack, (NAME), strlen (NAME));
+ (ALLOCED) ? (NAME) : obsavestring ((NAME), strlen (NAME), &objfile->symbol_obstack);
static struct type *func_symbol_type;