This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH v5 09/15] vla: resolve dynamic bounds if value contents is a constant byte-sequence


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]