Dwarf 3 and string/array types
Original Reporter info from Mantis: Martin @martin_frb
-
Reporter name: Martin Friebe
Original Reporter info from Mantis: Martin @martin_frb
- Reporter name: Martin Friebe
Description:
using dwarf 3, and the special patched gdb by Joost there are some errors when trying to access debug info about arrays and strings.
mainly when doing "ptype SomeType" instead of "ptype SomeVar"
The info below is gathered about arrays, but similiar issues habben with stings (e.g "ptype AnsiString")
The following types/vars are used in the example
(Variable names are postfixed with an "A", if they have an inline/anonymous type, rather than a named/declared type)
All types and variables can be found in the lazarus gdbmi test-case
type
TDynIntArray = Array of Integer;
PDynIntArray = ^TDynIntArray;
TStatIntArray = Array [5..9] of Integer;
PStatIntArray = ^TStatIntArray;
var
VarDynIntArray: TDynIntArray;
VarStatIntArray: TStatIntArray;
VarPDynIntArray: PDynIntArray;
VarPStatIntArray: PStatIntArray;
VarDynIntArrayA: Array of Integer;
VarStatIntArrayA: Array [5..9] of Integer;
TFoo = class
public
ValueInt: Integer;
ValueFoo: TFoo;
ValueRec: TRec;
FooText: string[20]; // about this line
property PropInt: Integer read ValueInt write ValueInt;
end;
Steps to reproduce:
run all of the following.
run them with ptype, whatis and -data-evaluate-expression
break on line 113 of WatchesPrg.pas in the lazarus gdbmi test case
ptype VarDynIntArray
ptype VarStatIntArray
ptype VarPDynIntArray
ptype VarPStatIntArray
ptype VarDynIntArrayA
ptype VarStatIntArrayA
ptype @VarDynIntArray
ptype @VarStatIntArray
ptype @VarPDynIntArray
ptype @VarPStatIntArray
ptype @VarDynIntArrayA
ptype @VarStatIntArrayA
// should ^ fail for static arrays?
ptype VarDynIntArray^
ptype VarStatIntArray^
ptype VarPDynIntArray^
ptype VarPDynIntArray^^
ptype VarPStatIntArray^
ptype VarPStatIntArray^^
ptype VarDynIntArrayA^
ptype VarStatIntArrayA^
ptype VarDynIntArray[0]
ptype VarStatIntArray[5]
ptype VarPDynIntArray[0]
ptype VarPDynIntArray^[0]
ptype VarPStatIntArray[5]
ptype VarPStatIntArray^[5]
ptype VarDynIntArrayA[0]
ptype VarStatIntArrayA[5]
ptype TDynIntArray
ptype TStatIntArray
ptype PDynIntArray
ptype PStatIntArray
Additional information:
* "ptype" and "whatis" for variables, seems to work.
However the last whatis shows a different range. This may be ok, because with "whatis" gdb resolves only one step in the type chain. So that may just be the info found
<ptype VarDynIntArray> ~"type = array [0..1] of LongInt\n" #GOOD
<ptype VarDynIntArrayA> ~"type = array [0..1] of LongInt\n"
<whatis VarDynIntArray> ~"type = TDynIntArray\n" #GOOD
<whatis VarDynIntArrayA> ~"type = array [0..-4220246888] of LongInt\n"
* ptype on the types (dyn-array) itself fails (same for "ptype AnsiString"
<ptype TDynIntArray> ^error,msg="Cannot resolve DW_OP_push_object_address for a missing object"
<whatis TDynIntArray> ^error,msg="Cannot resolve DW_OP_push_object_address for a missing object"
* Resolving pointer to variables fails sometimes
&LtPos;ptype @VarDynIntArray>
~"type = ^"
^error,msg="Cannot resolve DW_OP_push_object_address for a missing object"
* same for declared pointer types (dyn-array) (but types failed above anyway)
&LtPos;ptype PDynIntArray> ^error,msg="Cannot resolve DW_OP_push_object_address for a missing object"
**** static arrays
&LtPos;ptype VarStatIntArray> ~"type = array [5..9] of LongInt\n" #GOOD
&LtPos;ptype @VarStatIntArray> ~"type = ^LongInt\n"
&LtPos;ptype PStatIntArray> ~"type = ^LongInt\n"
*** strings:
This works if ArgTFoo is not dereferenced (^)
&LtPos;ptype ArgTFoo^>
&"ptype ArgTFoo^\n"
~"type = TFoo = class : public TObject \n"
~" public\n"
~" ValueInt : LongInt;\n"
~" ValueFoo : TFoo;\n"
~" ValueRec : TRec;\n"
~" FooText : array of "
&"Cannot resolve DW_OP_push_object_address for a missing object\n"
^error,msg="Cannot resolve DW_OP_push_object_address for a missing object"
(gdb)
Mantis conversion info:
- Mantis ID: 18508
- OS: win
- OS Build: vista
- Platform: w32
- Version: 2.5.1