Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: gdb/minsyms.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/minsyms.h ('k') | gdb/mips-linux-nat.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/minsyms.c
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 2aec6324d061a55825607946f698fd7878c655fb..1070fff644e8a08446632895ac642a25c8d743e6 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -76,7 +76,7 @@ static int msym_bunch_index;
static int msym_count;
-/* Compute a hash code based using the same criteria as `strcmp_iw'. */
+/* See minsyms.h. */
unsigned int
msymbol_hash_iw (const char *string)
@@ -96,7 +96,7 @@ msymbol_hash_iw (const char *string)
return hash;
}
-/* Compute a hash code for a string. */
+/* See minsyms.h. */
unsigned int
msymbol_hash (const char *string)
@@ -109,7 +109,7 @@ msymbol_hash (const char *string)
}
/* Add the minimal symbol SYM to an objfile's minsym hash table, TABLE. */
-void
+static void
add_minsym_to_hash_table (struct minimal_symbol *sym,
struct minimal_symbol **table)
{
@@ -139,8 +139,8 @@ add_minsym_to_demangled_hash_table (struct minimal_symbol *sym,
}
}
+/* See minsyms.h. */
-/* Return OBJFILE where minimal symbol SYM is defined. */
struct objfile *
msymbol_objfile (struct minimal_symbol *sym)
{
@@ -308,13 +308,7 @@ lookup_minimal_symbol (const char *name, const char *sfile,
return NULL;
}
-/* Iterate over all the minimal symbols in the objfile OBJF which
- match NAME. Both the ordinary and demangled names of each symbol
- are considered. The caller is responsible for canonicalizing NAME,
- should that need to be done.
-
- For each matching symbol, CALLBACK is called with the symbol and
- USER_DATA as arguments. */
+/* See minsyms.h. */
void
iterate_over_minimal_symbols (struct objfile *objf, const char *name,
@@ -348,12 +342,7 @@ iterate_over_minimal_symbols (struct objfile *objf, const char *name,
}
}
-/* Look through all the current minimal symbol tables and find the
- first minimal symbol that matches NAME and has text type. If OBJF
- is non-NULL, limit the search to that objfile. Returns a pointer
- to the minimal symbol that matches, or NULL if no match is found.
-
- This function only searches the mangled (linkage) names. */
+/* See minsyms.h. */
struct minimal_symbol *
lookup_minimal_symbol_text (const char *name, struct objfile *objf)
@@ -405,10 +394,7 @@ lookup_minimal_symbol_text (const char *name, struct objfile *objf)
return NULL;
}
-/* Look through all the current minimal symbol tables and find the
- first minimal symbol that matches NAME and PC. If OBJF is non-NULL,
- limit the search to that objfile. Returns a pointer to the minimal
- symbol that matches, or NULL if no match is found. */
+/* See minsyms.h. */
struct minimal_symbol *
lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name,
@@ -440,13 +426,7 @@ lookup_minimal_symbol_by_pc_name (CORE_ADDR pc, const char *name,
return NULL;
}
-/* Look through all the current minimal symbol tables and find the
- first minimal symbol that matches NAME and is a solib trampoline.
- If OBJF is non-NULL, limit the search to that objfile. Returns a
- pointer to the minimal symbol that matches, or NULL if no match is
- found.
-
- This function only searches the mangled (linkage) names. */
+/* See minsyms.h. */
struct minimal_symbol *
lookup_minimal_symbol_solib_trampoline (const char *name,
@@ -732,8 +712,7 @@ lookup_minimal_symbol_by_pc_section (CORE_ADDR pc, struct obj_section *section)
return lookup_minimal_symbol_by_pc_section_1 (pc, section, 0);
}
-/* Backward compatibility: search through the minimal symbol table
- for a matching PC (no section given). */
+/* See minsyms.h. */
struct minimal_symbol *
lookup_minimal_symbol_by_pc (CORE_ADDR pc)
@@ -804,10 +783,7 @@ static const struct gnu_ifunc_fns stub_gnu_ifunc_fns =
const struct gnu_ifunc_fns *gnu_ifunc_fns_p = &stub_gnu_ifunc_fns;
-/* Find the minimal symbol named NAME, and return both the minsym
- struct and its objfile. This only checks the linkage name. Sets
- *OBJFILE_P and returns the minimal symbol, if it is found. If it
- is not found, returns NULL. */
+/* See minsyms.h. */
struct minimal_symbol *
lookup_minimal_symbol_and_objfile (const char *name,
@@ -851,18 +827,21 @@ get_symbol_leading_char (bfd *abfd)
return 0;
}
-/* Prepare to start collecting minimal symbols. Note that presetting
- msym_bunch_index to BUNCH_SIZE causes the first call to save a minimal
- symbol to allocate the memory for the first bunch. */
+/* See minsyms.h. */
void
init_minimal_symbol_collection (void)
{
msym_count = 0;
msym_bunch = NULL;
+ /* Note that presetting msym_bunch_index to BUNCH_SIZE causes the
+ first call to save a minimal symbol to allocate the memory for
+ the first bunch. */
msym_bunch_index = BUNCH_SIZE;
}
+/* See minsyms.h. */
+
void
prim_record_minimal_symbol (const char *name, CORE_ADDR address,
enum minimal_symbol_type ms_type,
@@ -894,8 +873,7 @@ prim_record_minimal_symbol (const char *name, CORE_ADDR address,
section, NULL, objfile);
}
-/* Record a minimal symbol in the msym bunches. Returns the symbol
- newly created. */
+/* See minsyms.h. */
struct minimal_symbol *
prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
@@ -972,8 +950,7 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name,
return msymbol;
}
-/* Record a minimal symbol in the msym bunches. Returns the symbol
- newly created. */
+/* See minsyms.h. */
struct minimal_symbol *
prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address,
@@ -1011,8 +988,8 @@ compare_minimal_symbols (const void *fn1p, const void *fn2p)
else
/* addrs are equal: sort by name */
{
- char *name1 = SYMBOL_LINKAGE_NAME (fn1);
- char *name2 = SYMBOL_LINKAGE_NAME (fn2);
+ const char *name1 = SYMBOL_LINKAGE_NAME (fn1);
+ const char *name2 = SYMBOL_LINKAGE_NAME (fn2);
if (name1 && name2) /* both have names */
return strcmp (name1, name2);
@@ -1046,6 +1023,8 @@ do_discard_minimal_symbols_cleanup (void *arg)
}
}
+/* See minsyms.h. */
+
struct cleanup *
make_cleanup_discard_minimal_symbols (void)
{
@@ -1188,6 +1167,13 @@ install_minimal_symbols (struct objfile *objfile)
if (msym_count > 0)
{
+ if (symtab_create_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "Installing %d minimal symbols of objfile %s.\n",
+ msym_count, objfile->name);
+ }
+
/* Allocate enough space in the obstack, into which we will gather the
bunches of new and existing minimal symbols, sort them, and then
compact out the duplicate entries. Once we have a final table,
@@ -1289,6 +1275,27 @@ install_minimal_symbols (struct objfile *objfile)
}
}
+/* See minsyms.h. */
+
+void
+terminate_minimal_symbol_table (struct objfile *objfile)
+{
+ if (! objfile->msymbols)
+ objfile->msymbols = ((struct minimal_symbol *)
+ obstack_alloc (&objfile->objfile_obstack,
+ sizeof (objfile->msymbols[0])));
+
+ {
+ struct minimal_symbol *m
+ = &objfile->msymbols[objfile->minimal_symbol_count];
+
+ memset (m, 0, sizeof (*m));
+ /* Don't rely on these enumeration values being 0's. */
+ MSYMBOL_TYPE (m) = mst_unknown;
+ SYMBOL_SET_LANGUAGE (m, language_unknown);
+ }
+}
+
/* Sort all the minimal symbols in OBJFILE. */
void
@@ -1299,9 +1306,7 @@ msymbols_sort (struct objfile *objfile)
build_minimal_symbol_hash_tables (objfile);
}
-/* Check if PC is in a shared library trampoline code stub.
- Return minimal symbol for the trampoline entry or NULL if PC is not
- in a trampoline code stub. */
+/* See minsyms.h. */
struct minimal_symbol *
lookup_solib_trampoline_symbol_by_pc (CORE_ADDR pc)
« no previous file with comments | « gdb/minsyms.h ('k') | gdb/mips-linux-nat.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698