aboutsummaryrefslogtreecommitdiff
path: root/gprof
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2012-03-06 13:54:59 +0000
committerTristan Gingold <gingold@adacore.com>2012-03-06 13:54:59 +0000
commitca25b5babc60f6284cd4a8c79f66abe2ec5bba21 (patch)
tree3ecb34d3e6966bab2e13546e69e2b004c567a185 /gprof
parentabe49676e91dd6abeb219ee6a1e94b05094d7a9b (diff)
downloadgdb-ca25b5babc60f6284cd4a8c79f66abe2ec5bba21.zip
gdb-ca25b5babc60f6284cd4a8c79f66abe2ec5bba21.tar.gz
gdb-ca25b5babc60f6284cd4a8c79f66abe2ec5bba21.tar.bz2
2012-03-06 Tristan Gingold <gingold@adacore.com>
* corefile.c (core_create_function_syms): Do not call bsearch if symbol_map_count is 0.
Diffstat (limited to 'gprof')
-rw-r--r--gprof/ChangeLog5
-rw-r--r--gprof/corefile.c25
2 files changed, 22 insertions, 8 deletions
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index 2eba327..ac9c35c 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-06 Tristan Gingold <gingold@adacore.com>
+
+ * corefile.c (core_create_function_syms): Do not call bsearch if
+ symbol_map_count is 0.
+
2012-02-06 Nick Clifton <nickc@redhat.com>
* po/sr.po: New Serbian translation.
diff --git a/gprof/corefile.c b/gprof/corefile.c
index e25d19b..9f93cee 100644
--- a/gprof/corefile.c
+++ b/gprof/corefile.c
@@ -582,7 +582,7 @@ core_create_function_syms (void)
bfd_vma max_vma = 0;
int cxxclass;
long i;
- struct function_map * found;
+ struct function_map * found = NULL;
int core_has_func_syms = 0;
switch (core_bfd->xvec->flavour)
@@ -609,10 +609,14 @@ core_create_function_syms (void)
/* Don't create a symtab entry for a function that has
a mapping to a file, unless it's the first function
in the file. */
- found = (struct function_map *) bsearch (core_syms[i]->name, symbol_map,
- symbol_map_count,
- sizeof (struct function_map),
- search_mapped_symbol);
+ if (symbol_map_count != 0)
+ {
+ /* Note: some systems (SunOS 5.8) crash if bsearch base argument
+ is NULL. */
+ found = (struct function_map *) bsearch
+ (core_syms[i]->name, symbol_map, symbol_map_count,
+ sizeof (struct function_map), search_mapped_symbol);
+ }
if (found == NULL || found->is_first)
++symtab.len;
}
@@ -643,9 +647,14 @@ core_create_function_syms (void)
continue;
}
- found = (struct function_map *) bsearch (core_syms[i]->name, symbol_map,
- symbol_map_count,
- sizeof (struct function_map), search_mapped_symbol);
+ if (symbol_map_count != 0)
+ {
+ /* Note: some systems (SunOS 5.8) crash if bsearch base argument
+ is NULL. */
+ found = (struct function_map *) bsearch
+ (core_syms[i]->name, symbol_map, symbol_map_count,
+ sizeof (struct function_map), search_mapped_symbol);
+ }
if (found && ! found->is_first)
continue;