Remove minsym termination
I was curious what used the terminating "null" minimal symbol; and after looking I could not find anything. This patch removes terminate_minimal_symbol_table and the extra minimal symbol that is allocated for it. gdb/ChangeLog 2019-03-15 Tom Tromey <tom@tromey.com> * symfile.c (reread_symbols): Update. * objfiles.c (objfile::objfile): Update. * minsyms.h (terminate_minimal_symbol_table): Don't declare. * minsyms.c (lookup_minimal_symbol_by_pc_section): Update comment. (minimal_symbol_reader::install): Update. (terminate_minimal_symbol_table): Remove. * jit.c (jit_object_close_impl): Update.
This commit is contained in:
parent
788c80d1af
commit
741d7538b7
|
@ -1,3 +1,14 @@
|
||||||
|
2019-03-15 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* symfile.c (reread_symbols): Update.
|
||||||
|
* objfiles.c (objfile::objfile): Update.
|
||||||
|
* minsyms.h (terminate_minimal_symbol_table): Don't declare.
|
||||||
|
* minsyms.c (lookup_minimal_symbol_by_pc_section): Update
|
||||||
|
comment.
|
||||||
|
(minimal_symbol_reader::install): Update.
|
||||||
|
(terminate_minimal_symbol_table): Remove.
|
||||||
|
* jit.c (jit_object_close_impl): Update.
|
||||||
|
|
||||||
2019-03-15 Tom Tromey <tom@tromey.com>
|
2019-03-15 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* minsyms.c (minimal_symbol_reader::record_full): Remove some
|
* minsyms.c (minimal_symbol_reader::record_full): Remove some
|
||||||
|
|
|
@ -805,8 +805,6 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
|
||||||
OBJF_NOT_FILENAME);
|
OBJF_NOT_FILENAME);
|
||||||
objfile->per_bfd->gdbarch = target_gdbarch ();
|
objfile->per_bfd->gdbarch = target_gdbarch ();
|
||||||
|
|
||||||
terminate_minimal_symbol_table (objfile);
|
|
||||||
|
|
||||||
j = NULL;
|
j = NULL;
|
||||||
for (i = obj->symtabs; i; i = j)
|
for (i = obj->symtabs; i; i = j)
|
||||||
{
|
{
|
||||||
|
|
|
@ -735,11 +735,8 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc_in, struct obj_section *sectio
|
||||||
{
|
{
|
||||||
CORE_ADDR pc = pc_in;
|
CORE_ADDR pc = pc_in;
|
||||||
|
|
||||||
/* If this objfile has a minimal symbol table, go search it using
|
/* If this objfile has a minimal symbol table, go search it
|
||||||
a binary search. Note that a minimal symbol table always consists
|
using a binary search. */
|
||||||
of at least two symbols, a "real" symbol and the terminating
|
|
||||||
"null symbol". If there are no real symbols, then there is no
|
|
||||||
minimal symbol table at all. */
|
|
||||||
|
|
||||||
if (objfile->per_bfd->minimal_symbol_count > 0)
|
if (objfile->per_bfd->minimal_symbol_count > 0)
|
||||||
{
|
{
|
||||||
|
@ -1363,7 +1360,7 @@ minimal_symbol_reader::install ()
|
||||||
compact out the duplicate entries. Once we have a final table,
|
compact out the duplicate entries. Once we have a final table,
|
||||||
we will give back the excess space. */
|
we will give back the excess space. */
|
||||||
|
|
||||||
alloc_count = m_msym_count + m_objfile->per_bfd->minimal_symbol_count + 1;
|
alloc_count = m_msym_count + m_objfile->per_bfd->minimal_symbol_count;
|
||||||
obstack_blank (&m_objfile->per_bfd->storage_obstack,
|
obstack_blank (&m_objfile->per_bfd->storage_obstack,
|
||||||
alloc_count * sizeof (struct minimal_symbol));
|
alloc_count * sizeof (struct minimal_symbol));
|
||||||
msymbols = (struct minimal_symbol *)
|
msymbols = (struct minimal_symbol *)
|
||||||
|
@ -1406,16 +1403,6 @@ minimal_symbol_reader::install ()
|
||||||
msymbols = (struct minimal_symbol *)
|
msymbols = (struct minimal_symbol *)
|
||||||
obstack_finish (&m_objfile->per_bfd->storage_obstack);
|
obstack_finish (&m_objfile->per_bfd->storage_obstack);
|
||||||
|
|
||||||
/* We also terminate the minimal symbol table with a "null symbol",
|
|
||||||
which is *not* included in the size of the table. This makes it
|
|
||||||
easier to find the end of the table when we are handed a pointer
|
|
||||||
to some symbol in the middle of it. Zero out the fields in the
|
|
||||||
"null symbol" allocated at the end of the array. Note that the
|
|
||||||
symbol count does *not* include this null symbol, which is why it
|
|
||||||
is indexed by mcount and not mcount-1. */
|
|
||||||
|
|
||||||
memset (&msymbols[mcount], 0, sizeof (struct minimal_symbol));
|
|
||||||
|
|
||||||
/* Attach the minimal symbol table to the specified objfile.
|
/* Attach the minimal symbol table to the specified objfile.
|
||||||
The strings themselves are also located in the storage_obstack
|
The strings themselves are also located in the storage_obstack
|
||||||
of this objfile. */
|
of this objfile. */
|
||||||
|
@ -1431,27 +1418,6 @@ minimal_symbol_reader::install ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See minsyms.h. */
|
|
||||||
|
|
||||||
void
|
|
||||||
terminate_minimal_symbol_table (struct objfile *objfile)
|
|
||||||
{
|
|
||||||
if (! objfile->per_bfd->msymbols)
|
|
||||||
objfile->per_bfd->msymbols = XOBNEW (&objfile->per_bfd->storage_obstack,
|
|
||||||
minimal_symbol);
|
|
||||||
|
|
||||||
{
|
|
||||||
struct minimal_symbol *m
|
|
||||||
= &objfile->per_bfd->msymbols[objfile->per_bfd->minimal_symbol_count];
|
|
||||||
|
|
||||||
memset (m, 0, sizeof (*m));
|
|
||||||
/* Don't rely on these enumeration values being 0's. */
|
|
||||||
MSYMBOL_TYPE (m) = mst_unknown;
|
|
||||||
MSYMBOL_SET_LANGUAGE (m, language_unknown,
|
|
||||||
&objfile->per_bfd->storage_obstack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if PC is in a shared library trampoline code stub.
|
/* Check if PC is in a shared library trampoline code stub.
|
||||||
Return minimal symbol for the trampoline entry or NULL if PC is not
|
Return minimal symbol for the trampoline entry or NULL if PC is not
|
||||||
in a trampoline code stub. */
|
in a trampoline code stub. */
|
||||||
|
|
|
@ -148,13 +148,6 @@ class minimal_symbol_reader
|
||||||
int m_msym_count;
|
int m_msym_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Create the terminating entry of OBJFILE's minimal symbol table.
|
|
||||||
If OBJFILE->msymbols is zero, allocate a single entry from
|
|
||||||
OBJFILE->objfile_obstack; otherwise, just initialize
|
|
||||||
OBJFILE->msymbols[OBJFILE->minimal_symbol_count]. */
|
|
||||||
|
|
||||||
void terminate_minimal_symbol_table (struct objfile *objfile);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Return whether MSYMBOL is a function/method. If FUNC_ADDRESS_P is
|
/* Return whether MSYMBOL is a function/method. If FUNC_ADDRESS_P is
|
||||||
|
|
|
@ -411,8 +411,6 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_)
|
||||||
|
|
||||||
per_bfd = get_objfile_bfd_data (this, abfd);
|
per_bfd = get_objfile_bfd_data (this, abfd);
|
||||||
|
|
||||||
terminate_minimal_symbol_table (this);
|
|
||||||
|
|
||||||
/* Add this file onto the tail of the linked list of other such files. */
|
/* Add this file onto the tail of the linked list of other such files. */
|
||||||
|
|
||||||
if (object_files == NULL)
|
if (object_files == NULL)
|
||||||
|
|
|
@ -2580,7 +2580,6 @@ reread_symbols (void)
|
||||||
objfile_set_sym_fns (objfile, find_sym_fns (objfile->obfd));
|
objfile_set_sym_fns (objfile, find_sym_fns (objfile->obfd));
|
||||||
|
|
||||||
build_objfile_section_table (objfile);
|
build_objfile_section_table (objfile);
|
||||||
terminate_minimal_symbol_table (objfile);
|
|
||||||
|
|
||||||
/* We use the same section offsets as from last time. I'm not
|
/* We use the same section offsets as from last time. I'm not
|
||||||
sure whether that is always correct for shared libraries. */
|
sure whether that is always correct for shared libraries. */
|
||||||
|
|
Loading…
Reference in New Issue