public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] [PR symtab/17591] Better fix
Date: Thu, 27 Nov 2014 00:50:00 -0000	[thread overview]
Message-ID: <yjt2oart79hd.fsf@ruffy.mtv.corp.google.com> (raw)

Hi.

PR 17591 is about handling stripping parameters from the name
to be looked up when the string also contains "(anonymous namespace)".
[btw, I think an audit of gdb is in order: I'm finding more of these.]

This patch does this using the same mechanism psymtab.c does:
cp_remove_params.

Regression tested on amd64-linux, with gdb_index.

2014-11-26  Doug Evans  <dje@google.com>

	PR symtab/17591
	* dwarf2read.c (find_slot_in_mapped_hash): Use cp_remove_params
	to strip parameters.

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 0790388..2b7f8ff 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2918,22 +2918,16 @@ find_slot_in_mapped_hash (struct mapped_index *index, const char *name,
     {
       /* NAME is already canonical.  Drop any qualifiers as .gdb_index does
 	 not contain any.  */
-      const char *paren = NULL;
 
-      /* Need to handle "(anonymous namespace)".  */
-      if (*name != '(')
-	paren = strchr (name, '(');
-
-      if (paren)
+      if (strchr (name, '(') != NULL)
 	{
-	  char *dup;
-
-	  dup = xmalloc (paren - name + 1);
-	  memcpy (dup, name, paren - name);
-	  dup[paren - name] = 0;
+	  char *without_params = cp_remove_params (name);
 
-	  make_cleanup (xfree, dup);
-	  name = dup;
+	  if (without_params != NULL)
+	    {
+	      make_cleanup (xfree, without_params);
+	      name = without_params;
+	    }
 	}
     }
 

             reply	other threads:[~2014-11-27  0:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27  0:50 Doug Evans [this message]
2014-12-03  2:36 ` Doug Evans

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=yjt2oart79hd.fsf@ruffy.mtv.corp.google.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).