Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>,
	Gary Benson via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] KFAIL variable-length array tests which fail with Clang
Date: Thu, 19 Nov 2020 23:53:15 +0100	[thread overview]
Message-ID: <0a3f590c-2a76-e470-136f-e8f88aef1d17@suse.de> (raw)
In-Reply-To: <87mtzek5fv.fsf@tromey.com>

On 11/18/20 5:14 PM, Tom Tromey wrote:
>>>>>> "Gary" == Gary Benson via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Gary> Clang describes the upper bounds of variable length arrays using
> Gary> a DW_AT_count attribute which references the DIE of a synthetic
> Gary> variable whose value is specified using a DW_AT_location.  In
> Gary> some cases GDB correctly handles these, but in other cases GDB
> Gary> adds an extra dereference causing the test to fail.  This commit
> Gary> marks these failing tests as caused by PR gdb/26905 when the
> Gary> test executable was built using Clang.
> 
> Shouldn't we just fix the gdb bug instead?

This adhoc patch:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 3c598262913..d27e8613d1c 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -18644,7 +18644,9 @@ attr_to_dynamic_prop (const struct attribute
*attr, struct die
_info *die,
                struct dwarf_block *block = target_attr->as_block ();
                baton->locexpr.size = block->size;
                baton->locexpr.data = block->data;
-               baton->locexpr.is_reference = true;
+               gdb_byte last = block->data[block->size - 1];
+               baton->locexpr.is_reference
+                 = !(last == DW_OP_stack_value || last ==
DW_OP_implicit_value);
                prop->set_locexpr (baton);
                gdb_assert (prop->baton () != NULL);
              }
...
fixes gdb.base/vla-optimized-out.exp with clang-10 for me.

Thanks,
- Tom

> Or is there something preventing that?  I feel like I may not fully
> appreciate the problem.
> 
> Tom
> 

  reply	other threads:[~2020-11-19 22:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 17:17 Gary Benson via Gdb-patches
2020-11-18 16:14 ` Tom Tromey
2020-11-19 22:53   ` Tom de Vries [this message]
2020-11-20 15:15     ` [PATCH][gdb/symtab] Fix gdb.base/vla-optimized-out.exp with clang Tom de Vries
2020-11-21 17:16       ` [gdb/testsuite] Add clang xfail in gdb.base/vla-ptr.exp Tom de Vries
2020-11-20 15:50     ` [PATCH] KFAIL variable-length array tests which fail with Clang Tom Tromey
2020-11-20 16:30       ` Tom de Vries
2020-11-20 16:51         ` Tom Tromey
2020-11-23 10:34           ` [PATCH][gdb/symtab] Fix gdb.base/vla-optimized-out.exp with clang Tom de Vries
2020-11-25 14:50             ` Gary Benson via Gdb-patches
2020-11-25 15:25               ` Gary Benson via Gdb-patches
2020-11-25 20:05                 ` Tom de Vries
2020-11-26 10:10                   ` Gary Benson via Gdb-patches
2020-11-30 12:51             ` [committed][PATCH][gdb/symtab] " 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=0a3f590c-2a76-e470-136f-e8f88aef1d17@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