From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org, Simon Marchi <simon.marchi@polymtl.ca>
Subject: Re: [RFC][gdb/symtab] Lazy expansion of full symbol table
Date: Sat, 19 Jun 2021 21:36:40 +0200 [thread overview]
Message-ID: <b546d3be-47b9-77f4-2ac5-e8d81e649777@suse.de> (raw)
In-Reply-To: <87bl83ykd9.fsf@tromey.com>
[-- Attachment #1: Type: text/plain, Size: 1490 bytes --]
On 6/18/21 4:30 AM, Tom Tromey wrote:
> Tom> I did an overnight build and test with the updated branch (5bc56d745fd)
> Tom> and ran into some trouble. The first internal-error I investigated
> Tom> happens when parsing the libstdc++ .debug package (so, it was not
> Tom> specific to the test-case). It seems the branch has some trouble with
> Tom> the dwz layout where an abbrev entry is shared between different CUs:
>
> Thank you for trying this, it uncovered several bugs.
> As you can see I haven't gotten to the dwz testing yet... one of the
> issues with DWARF, btw, is that there are just so many modes.
> I.e., I haven't tried DWO or .debug_types yet either.
>
Yeah, very true.
> I pushed some patches to fix the crashes but the result is so fast that
> I suspect it is incorrect:
>
> (gdb) file libstdc++.so.6.0.28-10.2.1+git583-lp152.4.1.x86_64.debug
> 2021-06-17 20:25:34.361 - command started
> Reading symbols from libstdc++.so.6.0.28-10.2.1+git583-lp152.4.1.x86_64.debug...
> 2021-06-17 20:25:34.406 - command finished
> Command execution time: 0.075291 (cpu), 0.045521 (wall)
>
> (Though /bin/gdb is also pretty fast here, maybe I'm doing something
> else wrong.)
>
> So, at least it doesn't crash, but more investigation is needed.
> I'll probably add some code to make it easy to dump the index so it's
> easier to see what the scanner recorded.
Tried the updated branch and ran into a race condition, fixed in
attached patch.
Thanks,
- Tom
[-- Attachment #2: 0001-Fix-race-condition-in-dwarf2_section_info-read.patch --]
[-- Type: text/x-patch, Size: 1108 bytes --]
Fix race condition in dwarf2_section_info::read
It can occur in dwarf2_section_info::read that:
- thread A sets readin to true, and buffer to nullptr, and then
- thread B reads readin as true, returns and finds that buffer is nullptr
and concludes that there no such such section. Which is not true, it's
just that thread A hasn't finished reading it yet, which would make
buffer != nullptr.
---
gdb/dwarf2/section.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gdb/dwarf2/section.c b/gdb/dwarf2/section.c
index 8e1c0197c85..e6940103d77 100644
--- a/gdb/dwarf2/section.c
+++ b/gdb/dwarf2/section.c
@@ -30,6 +30,8 @@
#include "objfiles.h"
#include "complaints.h"
+#include <mutex>
+
void
dwarf2_section_info::overflow_complaint () const
{
@@ -118,10 +120,12 @@ dwarf2_section_info::empty () const
void
dwarf2_section_info::read (struct objfile *objfile)
{
+ static std::mutex mutex;
asection *sectp;
bfd *abfd;
gdb_byte *buf, *retbuf;
+ std::lock_guard<std::mutex> guard (mutex);
if (readin)
return;
buffer = NULL;
next prev parent reply other threads:[~2021-06-19 19:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 9:39 Tom de Vries
2021-06-14 20:54 ` Tom Tromey
2021-06-14 23:36 ` Tom de Vries
2021-06-15 13:26 ` Tom Tromey
2021-06-16 10:20 ` Tom de Vries
2021-06-18 2:30 ` Tom Tromey
2021-06-19 19:36 ` Tom de Vries [this message]
2021-06-20 9:41 ` Tom de Vries
2021-06-20 18:17 ` Tom Tromey
2021-06-22 9:16 ` Tom de Vries
2021-06-20 23:44 ` Tom Tromey
2021-06-21 9:18 ` Tom de Vries
2021-06-27 22:24 ` Tom Tromey
2021-06-28 0:48 ` Tom Tromey
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=b546d3be-47b9-77f4-2ac5-e8d81e649777@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).