linespec: keep function descriptors during minimal symbol search
authorJoel Brobecker <brobecker@gnat.com>
Wed, 4 Jan 2012 13:15:20 +0000 (13:15 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Wed, 4 Jan 2012 13:15:20 +0000 (13:15 +0000)
When discarding data (minimal) symbols, we need to be careful to
not throw away the function descriptors.  This makes a difference
on platforms where these descriptors are used and live in a data
section.

gdb/ChangeLog:

        * linespec.c (add_minsym): Preserve function descriptors.

gdb/ChangeLog
gdb/linespec.c

index 374a445..f610db2 100644 (file)
@@ -1,3 +1,7 @@
+2012-01-04  Joel Brobecker  <brobecker@adacore.com>
+
+       * linespec.c (add_minsym): Preserve function descriptors.
+
 2012-01-04  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * breakpoint.c (all_locations_are_pending): Consider locations
index 3505af9..6276a3a 100644 (file)
@@ -2799,7 +2799,17 @@ add_minsym (struct minimal_symbol *minsym, void *d)
        case mst_abs:
        case mst_file_data:
        case mst_file_bss:
-       return;
+         {
+           /* Make sure this minsym is not a function descriptor
+              before we decide to discard it.  */
+           struct gdbarch *gdbarch = info->objfile->gdbarch;
+           CORE_ADDR addr = gdbarch_convert_from_func_ptr_addr
+                              (gdbarch, SYMBOL_VALUE_ADDRESS (minsym),
+                               &current_target);
+
+           if (addr == SYMBOL_VALUE_ADDRESS (minsym))
+             return;
+         }
       }
 
   mo.minsym = minsym;