From: Simon Marchi <simon.marchi@polymtl.ca>
To: Ali Tamur <tamur@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] DWARF 5 support: Handle line table and file indexes
Date: Mon, 21 Oct 2019 05:55:00 -0000 [thread overview]
Message-ID: <0570f296-a2ca-c250-7e95-060014d76a97@polymtl.ca> (raw)
In-Reply-To: <20191018193116.57020-1-tamur@google.com>
On 2019-10-18 3:31 p.m., Ali Tamur wrote:
> I've done everything asked, except this bit:
>> I'd still suggest adding a gdb_assert to verify that in the case of
> DWARF <= 4, index should be > 0.
>
> This caused failure in multiple tests, I think the correct behaviour is to
> return nullptr when DWARF <= 4 and index = 0 (done).
Oh, right, requesting the entry 0 isn't invalid, it's just that it represents the
compilation directory, which is not explicitly represented. We indeed return
NULL at the moment when requesting index 0 (it underflows the unsigned variable),
so you are right that we should continue doing that.
> @@ -20651,12 +20689,11 @@ dwarf_decode_line_header (sect_offset sect_off, struct dwarf2_cu *cu)
> Returns NULL if FILE_INDEX should be ignored, i.e., it is pst->filename. */
>
> static const char *
> -psymtab_include_file_name (const struct line_header *lh, int file_index,
> +psymtab_include_file_name (const struct line_header *lh, const file_entry &fe,
> const struct partial_symtab *pst,
> const char *comp_dir,
> gdb::unique_xmalloc_ptr<char> *name_holder)
The comment above this function says:
Return the file name of the psymtab for included file FILE_INDEX
It would need to be updated.
> @@ -24190,6 +24221,14 @@ dwarf_alloc_die (struct dwarf2_cu *cu, int num_attrs)
> \f
> /* Macro support. */
>
> +static bool
> +is_valid_file_index (int file_index, struct line_header *lh)
> +{
> + if (lh->version >= 5)
> + return 0 <= file_index && file_index < lh->file_names_size ();
> + return 1 <= file_index && file_index <= lh->file_names_size ();
> +}
I think it would make sense if this was a method of line_header, since it's related to
the line_header::file_name_at method.
Simon
next prev parent reply other threads:[~2019-10-21 5:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-01 4:53 Ali Tamur via gdb-patches
2019-10-02 1:52 ` Ali Tamur via gdb-patches
2019-10-08 1:05 ` Ali Tamur via gdb-patches
2019-10-10 3:14 ` Simon Marchi
2019-10-15 20:19 ` Ali Tamur via gdb-patches
2019-10-16 3:04 ` Simon Marchi
2019-10-18 19:31 ` Ali Tamur via gdb-patches
2019-10-21 5:55 ` Simon Marchi [this message]
2019-10-21 19:47 ` Ali Tamur via gdb-patches
2019-10-21 20:07 ` Simon Marchi
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=0570f296-a2ca-c250-7e95-060014d76a97@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=tamur@google.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