This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/MSP432P401R: DWARF info and abbrev sections do not match

Part Number: MSP432P401R


Tool/software: TI C/C++ Compiler

I have an object file built with TI Arm compiler 16.9.4 LTS. I am using armofd from the same release to extract .debug_info and .debug_abbrev sections. DIE for a variable is missing the attribute DW_AT_type, which should be there according to the abbreviations table. DIE for a variable ti_posix_tirtos_Settings is as follows:

    ----------------------------
    DIE Table at Offset 0004983d
    ----------------------------

    Length:                0x12e
    Version:                   3
    .debug_abbrev Offset:  36817
    Address Size:              4

    ...

    0004992d   2    DW_TAG_variable (.data)
    0004992e           DW_AT_location       DW_OP_addr 0x2000af3c
    00049934           DW_AT_name           ti_posix_tirtos_Settings
    0004994d           DW_AT_decl_column    41
    0004994e           DW_AT_decl_file      1
    0004994f           DW_AT_decl_line      74
    00049950           DW_AT_external       true
    00049951           DW_AT_TI_symbol_name ti_posix_tirtos_Settings

The offset in the abbreviation table is 36817 (0x8FD1). The abbreviation table entry for that offset and the code is:

    --------------------------------------
    Abbreviations Table at Offset 0x8fd1
    --------------------------------------

    ...

    0x8fe3      2 no    DW_TAG_variable                         
    0x8fe6                 DW_AT_location       DW_FORM_block1 
    0x8fe8                 DW_AT_name           DW_FORM_string 
    0x8fea                 DW_AT_decl_column    DW_FORM_data1  
    0x8fec                 DW_AT_decl_file      DW_FORM_data1  
    0x8fee                 DW_AT_decl_line      DW_FORM_data1  
    0x8ff0                 DW_AT_external       DW_FORM_flag   
    0x8ff2                 DW_AT_type           DW_FORM_ref_addr
    0x8ff4                 DW_AT_TI_symbol_name DW_FORM_string

I am parsing the DIE for that variable using the abbreviations table, and I am getting a type value that doesn't correspond to any DIE. I have attached the object file. Is there anything else needed to debug the problem?

sem01.xem4f.txt

  • I can't reproduce this problem. When I use "armofd" from 16.9.4.LTS, I get the correct dump for that variable. What are the exact options you are using to invoke armofd?

        0004992c        DW_AT_TI_version 1
        0004992d   2    DW_TAG_variable (.data)
        0004992e           DW_AT_location       DW_OP_addr 0x2000af3c
        00049934           DW_AT_name           ti_posix_tirtos_Settings
        0004994d           DW_AT_decl_column    41
        0004994e           DW_AT_decl_file      1
        0004994f           DW_AT_decl_line      74
        00049950           DW_AT_external       true
        00049951           DW_AT_type           .debug_info(18) + 0x4a5c1
        00049955           DW_AT_TI_symbol_name ti_posix_tirtos_Settings
    
  • I am using the Linux installation. Here are the command lines:
    ../ti/arm/16.9.4.LTS/Linux/bin/armofd -g --dwarf_display=none,dinfo sem01.xem4f > sem.info
    ../ti/arm/16.9.4.LTS/Linux/bin/armofd -g --dwarf_display=none,dabbrev sem01.xem4f > sem.abbrev

    Also, ti_posix_tirtos_Settings and its type are defined as
    struct ti_posix_tirtos_Settings__Struct {
    bool enableMutexPriority;
    };

    struct ti_posix_tirtos_Settings__Struct ti_posix_tirtos_Settings = {
    .enableMutexPriority = true
    };

    My armofd output for .debug_info does not contain any info about the type.
  • Neato!  You're getting wrong output because you are narrowing the output with --dwarf_display.  If you change the command to the following, it will work as you expect.  I doubt this behavior is the way it's supposed to work.  Let me have a look at it.

    ../ti/arm/16.9.4.LTS/Linux/bin/armofd -g --dwarf_display=none,dinfo,types sem01.xem4f > sem.info

  • Okay, I've looked at the source code. This is indeed how OFD was designed to work. If you use --dwarf_display=none, you don't get DW_AT_type attributes even if you view dinfo. Thus, this is not a bug. However, OFD is displaying the wrong attribute offset for the next attribute, the DW_AT_TI_symbol_name; that is a bug, and I've submitted CODEGEN-3858 to track this issue.