+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.
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);
}
\f
/* Scan and build partial symbols for a symbol file.
}
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);
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 *));
last_source_file = NULL;
}
\f
-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);
-}
-\f
/* dst_symfile_init ()
is the dst-specific initialization routine for reading symbols.
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;
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,
}
}
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
* 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)
break;
}
- name = obsavestring (name, strlen (name), &objfile -> symbol_obstack);
return prim_record_minimal_symbol_and_info
(name, address, ms_type, info, section, 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;
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)
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;
obstack_alloc (¤t_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),
+ ¤t_objfile->symbol_obstack);
SYMBOL_CLASS (enum_sym) = LOC_CONST;
SYMBOL_TYPE (enum_sym) = t;
SYMBOL_NAMESPACE (enum_sym) = VAR_NAMESPACE;
sizeof (struct symbol)));
memset ((PTR) s, 0, sizeof (*s));
- SYMBOL_NAME (s) = name;
+ SYMBOL_NAME (s) = obsavestring (name, strlen (name),
+ ¤t_objfile->symbol_obstack);
SYMBOL_LANGUAGE (s) = psymtab_language;
SYMBOL_INIT_DEMANGLED_NAME (s, ¤t_objfile->symbol_obstack);
return s;
/* 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)
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;
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).
{
}
-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
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);
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 */
#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"
static int
enable_break PARAMS ((void));
-static int
-disable_break PARAMS ((void));
-
static void
info_sharedlibrary_command PARAMS ((char *, int));
#else
+static int
+disable_break PARAMS ((void));
+
static void
allocate_rt_common_objfile PARAMS ((void));
struct nlist inferior_rtc_nlist;
int len;
char *name;
- char *origname;
/* Remove any runtime common symbols from previous runs. */
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;
}
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
}
*/
+#ifndef SVR4_SHARED_LIBS
+
static int
disable_break ()
{
return (status);
}
+#endif /* #ifdef SVR4_SHARED_LIBS */
+
/*
LOCAL FUNCTION
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,
must be loaded manually, using `sharedlibrary'.",
&setlist),
&showlist);
+
+#endif /* HAVE_LINK_H */
}
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
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);
}
}
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')
{
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;
}
}
-/* 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)
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;
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)
#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;