From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC][gdb/symtab] Add DW_IDX_GNU_main_subprogram
Date: Tue, 2 Mar 2021 07:49:53 +0100 [thread overview]
Message-ID: <b1e1f07b-97c8-7eec-cd23-38768043d2b4@suse.de> (raw)
In-Reply-To: <87r1kyfhwz.fsf@tromey.com>
On 3/2/21 2:44 AM, Tom Tromey wrote:
> Tom> Fix this by adding a GNU extension DW_IDX_GNU_main_subprogram to the name
> Tom> index attributes, encoded using a number in the DW_IDX_lo_user-DW_IDX_hi_user
> Tom> range.
>
> I had a hilarious idea for this tonight, which is to stuff the main name
> into the augmentation string. Right now the augmentation string is just
> "GDB", but we could do something like "GDB:name_of_main"; then extract
> that when reading.
That's a fun idea indeed.
I wonder though about backward compatibility.
We have:
...
/* DWARF-5 augmentation string for GDB's DW_IDX_GNU_* extension. */
static const gdb_byte dwarf5_augmentation[] = { 'G', 'D', 'B', 0 };
...
/* augmentation_string_size - The size in bytes of the augmentation
string. This value is rounded up to a multiple of 4. */
uint32_t augmentation_string_size = read_4_bytes (abfd, addr);
addr += 4;
map.augmentation_is_gdb
= ((augmentation_string_size
== sizeof (dwarf5_augmentation))
&& memcmp (addr, dwarf5_augmentation,
sizeof (dwarf5_augmentation)) == 0);
...
So as soon as we use this idea, the augmentation_string_size will be
bigger, and the index will no longer be recognized by older gdb as being
a gdb index, so DW_IDX_GNU_internal/external will be ignored. [ There's
also a use in create_cus_from_debug_names_list, but that doesn't look
like any functionality will be broken. ]
One might say though that this is an actual gdb bug. The dwarf standard
says that the "string _begins_ with a 4-character vendor ID". So the
code should not check for augmentation_string_size == sizeof
(dwarf5_augmentation).
Anyway, to support any older reader that does the right thing, we'd need
to use "GDB\0name_of_main" or some such.
For future extensibility, we might consider encoding the type of data
using a char, like so "GDB\0M:name_of_main".
Thanks,
- Tom
next prev parent reply other threads:[~2021-03-02 6:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 15:47 [PATCH][gdb/testsuite] Add KFAILs for PR symtab/24549 Tom de Vries
2021-02-05 15:25 ` Tom Tromey
2021-02-05 17:28 ` Tom de Vries
2021-02-08 11:46 ` [RFC][gdb/symtab] Add DW_IDX_GNU_main_subprogram Tom de Vries
2021-02-24 20:46 ` Tom Tromey
2021-02-24 20:51 ` Tom Tromey
2021-03-02 1:44 ` Tom Tromey
2021-03-02 6:49 ` Tom de Vries [this message]
2021-03-02 15:01 ` 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=b1e1f07b-97c8-7eec-cd23-38768043d2b4@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