|
From: Åke R. <ake...@gm...> - 2017-02-08 20:29:49
|
Hello all,
I'm writing a new stm8 target for gdb and so I stumbled into a couple of
issues with SDCC.
It seems there are no DW_AT_frame_base attributes in the subprogram tags
so gdb is not able to figure out where to look for arguments. The same
seem to apply for locals as well.
objdump from my test code:
Compilation Unit @ offset 0x0:
Length: 0x10e (32-bit)
Version: 2
Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
<c> DW_AT_name : led.c
<12> DW_AT_stmt_list : 0x0
<16> DW_AT_language : 1 (ANSI C)
<17> DW_AT_producer : SDCC version 3.6.5 #9837
<1><30>: Abbrev Number: 2 (DW_TAG_base_type)
<31> DW_AT_name : unsigned int
<3e> DW_AT_byte_size : 2
<3f> DW_AT_encoding : 7 (unsigned)
<1><40>: Abbrev Number: 3 (DW_TAG_subprogram)
<41> DW_AT_sibling : <0x9c>
<45> DW_AT_name : clock
<4b> DW_AT_low_pc : 0x8024
<4f> DW_AT_high_pc : 0x8055
<53> DW_AT_external : 1
<54> DW_AT_type : <0x30>
<2><58>: Abbrev Number: 4 (DW_TAG_formal_parameter)
<59> DW_AT_location : 2 byte block: 91 2 (DW_OP_fbreg: 2)
[without DW_AT_frame_base]
<5c> DW_AT_name : ullabella
<66> DW_AT_type : <0x9c>
<2><6a>: Abbrev Number: 4 (DW_TAG_formal_parameter)
<6b> DW_AT_location : 2 byte block: 91 4 (DW_OP_fbreg: 4)
[without DW_AT_frame_base]
<6e> DW_AT_name : nisseberra
<79> DW_AT_type : <0xa3>
<2><7d>: Abbrev Number: 5 (DW_TAG_variable)
<7e> DW_AT_name : h
<80> DW_AT_type : <0xac>
<2><84>: Abbrev Number: 6 (DW_TAG_variable)
<85> DW_AT_location : 1 byte block: 51 (DW_OP_reg1 (r1))
<87> DW_AT_name : l
<89> DW_AT_type : <0xac>
<2><8d>: Abbrev Number: 6 (DW_TAG_variable)
<8e> DW_AT_location : 2 byte block: 91 0 (DW_OP_fbreg: 0)
[without DW_AT_frame_base]
<91> DW_AT_name : kalle
<97> DW_AT_type : <0x30>
I have also noticed bool args/locals are not encoded correctly:
In SDCCdwarf2.c:
case V_BOOL:
tp = dwNewTag (DW_TAG_base_type);
dwAddTagAttr (tp, dwNewAttrConst (DW_AT_encoding,
DW_ATE_float));
dwAddTagAttr (tp, dwNewAttrString (DW_AT_name, "_Bool"));
dwAddTagAttr (tp, dwNewAttrConst (DW_AT_byte_size,
getSize (type)));
dwAddTagChild (dwRootTag, tp);
break;
<1><99>: Abbrev Number: 2 (DW_TAG_base_type)
<9a> DW_AT_name : _Bool
<a0> DW_AT_byte_size : 1
<a1> DW_AT_encoding : 4 (float)
The main question is how the frame base is going to be implemented so I
can move forward with my gdb target.
/Ake
|