Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: emachado@linux.vnet.ibm.com, gdb-patches@sourceware.org
Subject: Re: [RFA] Ignore data minimal symbols for breakpoint linespecs
Date: Wed, 28 Dec 2011 07:07:00 -0000	[thread overview]
Message-ID: <20111228060200.GL23376@adacore.com> (raw)
In-Reply-To: <201112271708.pBRH8K1X019780@glazunov.sibelius.xs4all.nl>

[-- Attachment #1: Type: text/plain, Size: 378 bytes --]

> 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

[-- Attachment #2: 0001-linespec-keep-function-descriptors-during-minimal-sy.patch --]
[-- Type: text/x-diff, Size: 1295 bytes --]

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


  reply	other threads:[~2011-12-28  6:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-22 10:17 Joel Brobecker
2011-12-23 11:03 ` Joel Brobecker
2011-12-23 14:53   ` Jan Kratochvil
2011-12-27  4:17 ` Joel Brobecker
2011-12-27 16:49   ` Edjunior Barbosa Machado
2011-12-27 17:09     ` Joel Brobecker
2011-12-27 19:58       ` Mark Kettenis
2011-12-28  7:07         ` Joel Brobecker [this message]
2011-12-28 13:02           ` Edjunior Barbosa Machado
2011-12-28 15:30             ` Joel Brobecker
2012-01-03 18:44               ` Ulrich Weigand
2012-01-03 20:20                 ` Tom Tromey
2012-01-04 13:38                   ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111228060200.GL23376@adacore.com \
    --to=brobecker@adacore.com \
    --cc=emachado@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox