Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/symtab] Make gold index workaround more precise
Date: Thu, 28 May 2020 15:02:05 +0200	[thread overview]
Message-ID: <4f159c12-a394-a8f1-5db8-caee6e9c5b46@suse.de> (raw)
In-Reply-To: <87k10xpflh.fsf@tromey.com>

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

On 27-05-2020 17:22, Tom Tromey wrote:
>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
> 
> Tom> I tested this further in combination with the ada .gdb_index enabling,
> Tom> and ran into failures in gdb.ada/bp_inlined_func.exp, which I managed to
> Tom> fix by skipping the workaround when symbol_kind == function.
> 
> Tom> At this point, I wonder, should we just enable this workaround for
> Tom> symbol_kind == type?
> 
> I think that would make sense.
> 

I'll commit this patch then, once retesting has finished.

Thanks,
- Tom



[-- Attachment #2: 0002-gdb-symtab-Make-gold-index-workaround-more-precise.patch --]
[-- Type: text/x-patch, Size: 2279 bytes --]

[gdb/symtab] Make gold index workaround more precise

There's a PR gold/15646 - "gold-generated .gdb_index has duplicated
symbols that gdb-generated index doesn't", that causes gold to generate
duplicate symbols in the index.

F.i., a namespace N1 declared in a header file can be listed for two CUs that
include the header file:
...
[759] N1:
        2 [global type]
        3 [global type]
...

This causes a gdb performance problem: f.i. when attempting to set a
breakpoint on a non-existing function N1::misspelled, the symtab for both CUs
will be expanded.

Gdb contains a workaround for this, added in commit 8943b87476 "Work around
gold/15646", that skips duplicate global symbols in the index.

However, the workaround does not check for the symbol kind ("type" in the
example above).

Make the workaround more precise by limiting it to symbol kind "type".

Tested on x86_64-linux, with native and target board gold-gdb-index.

gdb/ChangeLog:

2020-05-26  Tom de Vries  <tdevries@suse.de>

	* dwarf2/read.c	(dw2_symtab_iter_next, dw2_expand_marked_cus): Limit
	PR gold/15646 workaround to symbol kind "type".

---
 gdb/dwarf2/read.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index a62224c0be..25f05fb993 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -3522,10 +3522,14 @@ dw2_symtab_iter_next (struct dw2_symtab_iterator *iter)
 	    }
 
 	  /* Work around gold/15646.  */
-	  if (!is_static && iter->global_seen)
-	    continue;
-	  if (!is_static)
-	    iter->global_seen = 1;
+	  if (!is_static
+	      && symbol_kind == GDB_INDEX_SYMBOL_KIND_TYPE)
+	    {
+	      if (iter->global_seen)
+		continue;
+
+	      iter->global_seen = 1;
+	    }
 	}
 
       /* Only check the symbol's kind if it has one.  */
@@ -4627,12 +4631,14 @@ dw2_expand_marked_cus
 	 && symbol_kind != GDB_INDEX_SYMBOL_KIND_NONE);
 
       /* Work around gold/15646.  */
-      if (attrs_valid)
+      if (attrs_valid
+	  && !is_static
+	  && symbol_kind == GDB_INDEX_SYMBOL_KIND_TYPE)
 	{
-	  if (!is_static && global_seen)
+	  if (global_seen)
 	    continue;
-	  if (!is_static)
-	    global_seen = true;
+
+	  global_seen = true;
 	}
 
       /* Only check the symbol's kind if it has one.  */

  reply	other threads:[~2020-05-28 13:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13  9:41 [PATCH][gdb/symtab] Handle .gdb_index in ada language mode Tom de Vries
2020-05-19 20:32 ` Tom Tromey
2020-05-20  9:40   ` Tom de Vries
2020-05-22 20:31     ` Tom Tromey
2020-05-26 13:01       ` [PATCH][gdb/symtab] Make gold index workaround more precise Tom de Vries
2020-05-26 14:03         ` Tom de Vries
2020-05-27 15:22           ` Tom Tromey
2020-05-28 13:02             ` Tom de Vries [this message]
2020-05-27 15:21         ` Tom Tromey
2020-06-02 10:47       ` [PATCH][gdb/symtab] Handle .gdb_index in ada language mode Tom de Vries
2020-06-10 12:49         ` Tom de Vries

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=4f159c12-a394-a8f1-5db8-caee6e9c5b46@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /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