Hi,
When debugging ARC with an ELF file compiled with the Metaware Compiler, I found
that TCF considers the DWARF information invalid in this ELF file.
The invalid combo is the attribute DW_AT_stmt_list with the form DW_FORM_addr.
It seems like TCF expects attribute DW_AT_stmt_list to have DW_FORM_data* forms.
This is checked in dwarfcache.c:read_object_info(), see line 848 below where dio_ChkData() is called.
Below dwarfcache.c is an extract of ‘readelf –w’ for the ELF file that shows two examples of
DW_AT_stmt_list.
So my question is if the DWARF standard strictly forbids non-data FORMS in DW_AT_stmt_list
attributes or if the TCF Dwarf parsing is too restrictive?
Thanks,
Claes
dwarfcache.c (see line 848):
837 if (Tag == TAG_compile_unit || Tag == TAG_partial_unit || Tag == TAG
837 _type_unit) {
838 CompUnit * Unit = Info->mCompUnit;
839 switch (Attr) {
840 case AT_low_pc:
841 Unit->mTextSection = dio_gFormSection;
842 break;
843 case AT_comp_dir:
844 dio_ChkString(Form);
845 Unit->mDir = (char *)dio_gFormDataAddr;
846 break;
847 case AT_stmt_list:
848 dio_ChkData(Form);
849 Unit->mLineInfoOffs = dio_gFormData;
850 break;
851 case AT_base_types:
852 Unit->mBaseTypes = add_comp_unit((ContextAddress)dio_gFormDa 852 ta);
853 break;
854 case AT_language:
855 dio_ChkData(Form);
856 Unit->mLanguage = (U2_T)dio_gFormData;
857 break;
858 }
859 }
readelf –w (see line 9 and line 25):
1 Contents of the .debug_abbrev section:
2
3 Number TAG (0x0)
4 1 DW_TAG_compile_unit [has children]
5 DW_AT_name DW_FORM_string
6 DW_AT_comp_dir DW_FORM_string
7 DW_AT_producer DW_FORM_string
8 DW_AT_language DW_FORM_data2
9 DW_AT_stmt_list DW_FORM_data4
10 DW_AT_low_pc DW_FORM_addr
11 DW_AT_high_pc DW_FORM_addr
12 DW_AT_sibling DW_FORM_ref4
13 2 DW_TAG_subprogram [no children]
14 DW_AT_external DW_FORM_flag
15 DW_AT_name DW_FORM_string
16 DW_AT_low_pc DW_FORM_addr
17 DW_AT_high_pc DW_FORM_addr
18 3 DW_TAG_label [no children]
19 DW_AT_name DW_FORM_string
20 DW_AT_low_pc DW_FORM_addr
21 Number TAG (0x2c)
22 1 DW_TAG_compile_unit [has children]
23 DW_AT_sibling DW_FORM_ref4
24 DW_AT_name DW_FORM_string
25 DW_AT_stmt_list DW_FORM_addr
26 DW_AT_low_pc DW_FORM_addr
27 DW_AT_high_pc DW_FORM_addr
28 DW_AT_language DW_FORM_data1
29 DW_AT_comp_dir DW_FORM_string
30 DW_AT_producer DW_FORM_string
31 2 DW_TAG_base_type [no children]
32 DW_AT_name DW_FORM_string
33 DW_AT_byte_size DW_FORM_data1
34 DW_AT_encoding DW_FORM_data1