public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Bruno Larsen <blarsen@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 2/3] [RFC][gdb/symtab] Add maint set symbol-read-order
Date: Fri, 24 Feb 2023 13:42:26 +0100	[thread overview]
Message-ID: <78f34ddc-acd7-2e1c-9961-bead283d11bf@suse.de> (raw)
In-Reply-To: <fa3c35aa-55e4-fa0e-67da-88270f4681ab@redhat.com>

On 9/26/22 12:43, Bruno Larsen wrote:
> 
> Cheers,
> Bruno
> 
> On 22/09/2022 17:20, Tom de Vries via Gdb-patches wrote:
>> With the test-case included in this patch, we run into:
>> ...
>> (gdb) print var_dwarf^M
>> $1 = 1^M
>> (gdb) PASS: gdb.ctf/dwarf2-and-ctf.exp: print var_dwarf
>> print var_ctf^M
>> 'var_ctf' has unknown type; cast it to its declared type^M
>> (gdb) FAIL: gdb.ctf/dwarf2-and-ctf.exp: print var_ctf
>> ...
>>
>> The problem is that the executable contains both ctf and dwarf2, so 
>> the ctf
>> info is ignored.
>>
>> GDB has support for handling multiple debug formats, but the common 
>> use case
>> for ctf is to be used when dwarf2 is not present, and gdb reflects that,
>> assuming that by reading ctf in addition there won't be any extra 
>> information,
>> so it's not worth the additional cycles and memory.
>>
>> Add a new maintenance command "maint set symbol-read-order <string>", 
>> where
>> the argument string "mdebug+stabs+dwarf2/ctf" represent the current 
>> default,
>> in other words:
>> - first mdebug is read
>> - then stabs is read
>> - then dwarf2 is read,
>> - then ctf is read, but only if dwarf2 info was missing.
>>
>> A bit of background on the relevance of reading order: the formats 
>> that create
>> partial symtabs (all but dwarf2) have a priority relationship between 
>> them,
>> where reading earlier means lower priority.  By reading the format 
>> with the
>> most detail last, we ensure it has the highest priority, which makes 
>> sure that
>> in case there is overlapping info, the most detailed info is found.  This
>> explains the ordering of mdebug, stabs and dwarf2 (because it used to 
>> have
>> partial symtabs).
>>
>> By using "maint set symbol-read-order ctf+dwarf2 or dwarf2+ctf, we can 
>> make the
>> test-case pass.
>>
>> This is an RFC at this point, so no documentation yet.
>>
>> Points I'd like to have feedback on:
>> - I chose this to be a maintenance command, because I suspect the reading
>>    order implications are a bit hard to understand.
>> - was it a good idea to use strtok ?
>> - I went for genericity, but could haved used instead a simple
>>    "set read-ctf-symtab <no|no-dwarf2|yes>".  If that is better, should
>>    it be a maintenance command or not?
>> - I initially went for the priority first order in the argument 
>> string, so
>>    reflecting the current default would be "dwarf2/ctf+stabs+mdebug", 
>> thinking
>>    it would be easier to understand the priority scheme this way, but 
>> abandoned
>>    that approach midway.  Which is easier to grasp?
> 
> A point against genericity, it isn't clear if we are supposed to read 
> mdebug+stabs+(dwarf2)/ctf or (mdebug+stabs+dwarf2)/ctf.  The option to 
> change how ctf specifically is read would not create this.
> 
> About the ordering, I feel like priority order would be less confusing, 
> if you decide to go with the generic option.
> 

Hi,

thanks for the feedback.

I've decided to go with a less generic option, submitted here (
https://sourceware.org/pipermail/gdb-patches/2023-February/197356.html ).

Thanks,
- Tom

  reply	other threads:[~2023-02-24 12:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 15:20 [PATCH 1/3] [gdb/symtab] Factor out elf_symfile_read_dwarf2 Tom de Vries
2022-09-22 15:20 ` [PATCH 2/3] [RFC][gdb/symtab] Add maint set symbol-read-order Tom de Vries
2022-09-26 10:43   ` Bruno Larsen
2023-02-24 12:42     ` Tom de Vries [this message]
2022-09-22 15:20 ` [PATCH 3/3] [gdb/testsuite] Fix ctf test-cases on openSUSE Tumbleweed Tom de Vries
2022-10-12 15:11   ` Tom de Vries
2022-10-12 15:08 ` [commited][PATCH 1/3] [gdb/symtab] Factor out elf_symfile_read_dwarf2 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=78f34ddc-acd7-2e1c-9961-bead283d11bf@suse.de \
    --to=tdevries@suse.de \
    --cc=blarsen@redhat.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).