aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>1998-03-19 19:35:18 +0000
committerMichael Snyder <msnyder@vmware.com>1998-03-19 19:35:18 +0000
commitf4f7d59421e5a6de5e06f7d170d517998a250f30 (patch)
tree9f2e66ae230ec7863a65e647322d1e5c6848094b /gdb
parent578491a2b1b05bcdb2e52a3e9e2f73e3cdcdbee9 (diff)
downloadgdb-f4f7d59421e5a6de5e06f7d170d517998a250f30.zip
gdb-f4f7d59421e5a6de5e06f7d170d517998a250f30.tar.gz
gdb-f4f7d59421e5a6de5e06f7d170d517998a250f30.tar.bz2
Thu Mar 19 11:32:15 1998 Michael Snyder (msnyder@cleaver.cygnus.com)
* minsyms.c (compare_minimal_symbols): If addresses are identical, then compare on names. Sorted list should have symbols with identical addresses AND names adjacent, so dups can be discarded.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/minsyms.c21
2 files changed, 22 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ba132cc..36e0d08 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+Thu Mar 19 11:32:15 1998 Michael Snyder (msnyder@cleaver.cygnus.com)
+
+ * minsyms.c (compare_minimal_symbols): If addresses are identical,
+ then compare on names. Sorted list should have symbols with
+ identical addresses AND names adjacent, so dups can be discarded.
+
Wed Mar 18 12:50:17 1998 Jeff Law (law@cygnus.com)
* stabsread.c (define_symbol): Don't look for ',' as a LRS
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 9d6fd04..04257c6 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -585,7 +585,8 @@ prim_record_minimal_symbol_and_info (name, address, ms_type, info, section,
}
/* Compare two minimal symbols by address and return a signed result based
- on unsigned comparisons, so that we sort into unsigned numeric order. */
+ on unsigned comparisons, so that we sort into unsigned numeric order.
+ Within groups with the same address, sort by name. */
static int
compare_minimal_symbols (fn1p, fn2p)
@@ -600,15 +601,25 @@ compare_minimal_symbols (fn1p, fn2p)
if (SYMBOL_VALUE_ADDRESS (fn1) < SYMBOL_VALUE_ADDRESS (fn2))
{
- return (-1);
+ return (-1); /* addr 1 is less than addr 2 */
}
else if (SYMBOL_VALUE_ADDRESS (fn1) > SYMBOL_VALUE_ADDRESS (fn2))
{
- return (1);
+ return (1); /* addr 1 is greater than addr 2 */
}
- else
+ else /* addrs are equal: sort by name */
{
- return (0);
+ char *name1 = SYMBOL_NAME (fn1);
+ char *name2 = SYMBOL_NAME (fn2);
+
+ if (name1 && name2) /* both have names */
+ return strcmp (name1, name2);
+ else if (name2)
+ return 1; /* fn1 has no name, so it is "less" */
+ else if (name1) /* fn2 has no name, so it is "less" */
+ return -1;
+ else
+ return (0); /* neither has a name, so they're equal. */
}
}