Hi Claes,
Allowed forms depends on DWARF version, but no version allows DW_FORM_addr in DW_AT_stmt_list. So this must be compiler bug.
We can implement workaround. For that, I suggest to file a Bugzilla with such ELF file attached as test case.
Thanks,
Eugene
From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx]
On Behalf Of Lillieskold, Claes
Sent: Friday, August 21, 2015 1:23 AM
To: tcf-dev@xxxxxxxxxxx
Subject: [tcf-dev] Unusual DWARF Information DW_AT_stmt_list + DW_FORM_addr
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
----------------------------------------------------------------------
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.