Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>, Pedro Alves <palves@redhat.com>,
	Simon Marchi <simon.marchi@polymtl.ca>
Subject: Re: [RFC] How to fix gdb.dwarf2/main-subprogram.exp with cc-with-gdb-index/cc-with-debug-names
Date: Mon, 13 May 2019 14:20:00 -0000	[thread overview]
Message-ID: <9eaa327a-c62d-236c-a3a5-29d48f202fc9@suse.de> (raw)
In-Reply-To: <86dc886a-8ad8-e8dc-5550-b3235a71389b@suse.de>

On 10-05-19 09:57, Tom de Vries wrote:
> On 05-05-19 13:42, Tom de Vries wrote:
>> [ was: Re: [PATCH][gdb/symtab] Support DW_AT_main_subprogram with
>> -readnow. ]
>>
>> Hi,
>>
>> DW_AT_main_subprogram is supported in normal mode (in
>> read_partial_die),and tested by test-case gdb.dwarf2/main-subprogram.exp.
>>
>> DW_AT_main_subprogram is currently not supported in -readnow mode, but
>> I've submitted a fix for that (in read_func_scope).
>>
>> Still, the test-case gdb.dwarf2/main-subprogram.exp fails with
>> executables that contain an index, either .gdb_index or .debug_names
>> (which is exercised by target boards cc-with-gdb-index and
>> cc-with-debug-names).
>>
>> I wonder whether and if so, how this should be fixed.
>>
>> ISTM that we want gdb to behave the same, functionality-wise, in normal
>> mode, -readnow mode, and with an index.
>>
>> AFAIU, to fix this, then when loading an executable with index into gdb
>> and issuing the start command, we'll need to read the debug info until
>> finding the DW_AT_main_subprogram, but reading the debug info scanning
>> just for one attribute seems rather inefficient to me.
>>
>> Any comments or advice here?
> 
> I just found in the DWARF-4 standard:
> ...
> 3.1.1 Normal and Partial Compilation Unit Entries
> 11. A DW_AT_main_subprogram attribute, which is a flag whose presence
> indicates that the compilation unit contains a subprogram that has been
> identified as the starting function of the program.
> ...
> 
> The test-case gdb.dwarf2/main-subprogram.exp doesn't contain this
> attribute on the containing CU.
> 
> Also, gcc doesn't emit it, I just filed PR90422 - "DW_AT_main_subprogram
> not added to CU DIE" (
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90422 ) about that.
> 
> I imagine that scanning the CUs for this attribute shouldn't be too slow.
> 

Tracking this at Bug 24549 - "DW_AT_main_subprogram ignored with
cc-with-gdb-index/cc-with-debug-names" (
https://sourceware.org/bugzilla/show_bug.cgi?id=24549 ).

Thanks,
- Tom


  reply	other threads:[~2019-05-13 14:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-05 10:25 [PATCH][gdb/symtab] Support DW_AT_main_subprogram with -readnow Tom de Vries
2019-05-05 11:42 ` [RFC] How to fix gdb.dwarf2/main-subprogram.exp with cc-with-gdb-index/cc-with-debug-names Tom de Vries
2019-05-10  7:57   ` Tom de Vries
2019-05-13 14:20     ` Tom de Vries [this message]
2019-05-17 15:08 ` [PING][PATCH][gdb/symtab] Support DW_AT_main_subprogram with -readnow Tom de Vries
2019-05-29 13:37 ` [PATCH][gdb/symtab] " 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=9eaa327a-c62d-236c-a3a5-29d48f202fc9@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --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