This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Ignore data minimal symbols for breakpoint linespecs


> Give that the target in question is 64-bit PowerPC, my bet is that by
> discarding data minimal symbols, you're also discarding function
> descriptors.  That's probably not a good idea.

Thanks for the tip, Mark. After having looked at the logs, I think
you are right on the money. What do you think of the attached patch?

Edjunior, can you test it for me?

Thanks,
-- 
Joel
>From af87a92e11cf40dc2f2fcc358cf405e3cb2905ec Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Wed, 28 Dec 2011 09:35:35 +0400
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 different
on platforms where these descriptors are used and live in a data
section.

gdb/ChangeLog:

        * linespec.c (add_minsym): Preserve function descriptors.
---
 gdb/linespec.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/gdb/linespec.c b/gdb/linespec.c
index 9d753e5..1266418 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2812,7 +2812,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;
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]