Uploaded image for project: 'Embedded Software & Tools'
  1. Embedded Software & Tools
  2. EXT_EP-11147

Dwarf version 4 DW_TAG_type_unit entries contain file location attributes that are incorrect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low

      The attachment hdr.h has these lines ...

      struct tag_name
      {
         int member_one;          /* comment */
         int member_two;          /* comment */
         int member_three;        /* comment */
      };
      

      The attachment file.c has these lines ...

      #include "hdr.h"
      
      #pragma RETAIN(instance);
      struct tag_name instance;
      
      int main()
      {
          return 56;
      }
      

      Build it for EABI, which defaults to Dwarf version 4. Use ofd2000 to write the object file and Dwarf details to a text file. Search to see that the string hdr.h never appears.

      % cl2000 --abi=eabi file.c -z -o dwarf4.out
      <Linking>
      % ofd2000 -g dwarf4.out > dwarf4.txt
      % findstr/c:"hdr.h" dwarf4.txt
      (no system response here)
      

      Inspect dwarf4.txt and search for "member_one". Here are the related lines ...

          ----------------------------
          DIE Table at Offset 000002d9
          ----------------------------
      
          Length:                              0x80
          Version:                                4
          .debug_abbrev Offset:                   0
          Address Size:                           4
          Type Signature:        0xb7c95744d52669ee
          Type Offset:                           32
      
      
          000002f0  30 DW_TAG_type_unit
          000002f1        DW_AT_stmt_list .debug_line(11) + 0x4da
          000002f5        DW_AT_producer  TI TMS320C2000 Linker PC v22.6
                                          .0 Copyright (c) 1996-2018 Tex
                                          as Instruments Incorporated
          000002f9  12    DW_TAG_structure_type
          000002fa           DW_AT_sibling     (null)
          000002fe           DW_AT_name        tag_name
          00000307           DW_AT_byte_size   3
          00000308           DW_AT_decl_column 8
          00000309           DW_AT_decl_file   2
          0000030a           DW_AT_decl_line   1
          0000030b   6       DW_TAG_member
          0000030c              DW_AT_name          member_one
          00000317              DW_AT_accessibility 1
          00000318              DW_AT_decl_column   8
          00000319              DW_AT_decl_file     2
          0000031a              DW_AT_decl_line     3
          0000031b              DW_AT_type          0x57b05a2b038bf599
      

      Focus on lines for bytes 0x308-0x30a. DW_AT_decl_column and DW_AT_decl_line are correct for the location of "tag_name" in hdr.h. It is not clear how DW_AT_decl_file, with value 2, associates with hdr.h, given that the string "hdr.h" never appears. A similar situation is the case for the attribute DW_AT_stmt_list (byte 0x2f1).

            syncuser TI User
            syncuser TI User
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: