This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH v5 09/15] vla: resolve dynamic bounds if value contents is a constant byte-sequence
- From: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- To: 'Joel Brobecker' <brobecker at adacore dot com>
- Cc: "tromey at redhat dot com" <tromey at redhat dot com>, "Boell, Keven" <keven dot boell at intel dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 12 Mar 2014 13:40:08 +0000
- Subject: RE: [PATCH v5 09/15] vla: resolve dynamic bounds if value contents is a constant byte-sequence
- Authentication-results: sourceware.org; auth=none
- References: <1391704056-25246-1-git-send-email-sanimir dot agovic at intel dot com> <1391704056-25246-10-git-send-email-sanimir dot agovic at intel dot com> <20140228170941 dot GB16479 at adacore dot com>
Thanks for your review.
-Sanimir
> Would you mind explaining this change a little more; perhaps using
> some example code would help me understand why we want to resolve
> dynamic types in this case (and also only in this case)?
>
I added a test[1] for DW_AT_count attribute with the help of the
dwarf assembler. I used const_value to embed the actual array data
into the debug information itself rather than having a location
in the inferior.
+ DW_TAG_variable {
+ {name array}
+ {type :$array_label}
+ {const_value hello DW_FORM_block1}
+ }
The test[1] initially failed because we ended up handling the
case LOC_CONST_BYTES which does not use value_at & friends and simply
copies the raw data into the value and thus the bounds never get
resolved.
case LOC_CONST_BYTES:
+ if (is_dynamic_type (type))
+ /* Value is a constant byte-sequence and needs no memory access. */
+ type = resolve_dynamic_type (type, /* Unused address. */ 0);
v = allocate_value (type);
In all other cases so far we call value_at (...) to construct a value
and therefore get the correct type/bounds.
[1] https://sourceware.org/ml/gdb-patches/2014-02/msg00100.html
-Sanimir
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052