From 1a2da5eef019728312010d41acce8551de21c175 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 4 Jan 2012 13:15:20 +0000 Subject: [PATCH] linespec: keep function descriptors during minimal symbol search 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 | 4 ++++ gdb/linespec.c | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 374a4450206..f610db2ada4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2012-01-04 Joel Brobecker + + * linespec.c (add_minsym): Preserve function descriptors. + 2012-01-04 Ulrich Weigand * breakpoint.c (all_locations_are_pending): Consider locations diff --git a/gdb/linespec.c b/gdb/linespec.c index 3505af966c4..6276a3ae8be 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -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), + ¤t_target); + + if (addr == SYMBOL_VALUE_ADDRESS (minsym)) + return; + } } mo.minsym = minsym; -- 2.30.2