This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Wrong mappin of registers in location lists


Hi again,
as far as I can see gcc outputs wrong information to .debug_loc on x86-64. This is the assembler output:

main:
.LVL22:
pushq %rbx
movl %edi, %ebx
.LVL23:
leal 1(%rbx), %edi
subq $416, %rsp
[...]

This is DIE of argc:
.uleb128 0x3 # (DIE (0xef) DW_TAG_formal_parameter)
.long .LASF4 # DW_AT_name: "argc"
.byte 0x1 # DW_AT_decl_file
.byte 0x17 # DW_AT_decl_line
.long 0x8f # DW_AT_type
.long .LLST3-.Ldebug_loc0 # DW_AT_location

And finally location list of argc:
.LLST3:
.quad .LVL22-.text # Location list begin address (*.LLST3)
.quad .LVL23-.text # Location list end address (*.LLST3)
.value 0x1 # Location expression size
.byte 0x55 # DW_OP_reg5
.quad .LVL23-.text # Location list begin address (*.LLST3)
.quad .LFE7-.text # Location list end address (*.LLST3)
.value 0x1 # Location expression size
.byte 0x53 # DW_OP_reg3
.quad 0x0 # Location list terminator begin (*.LLST3)
.quad 0x0 # Location list terminator end (*.LLST3)

At the entry of the function (.LVL22), argc is dwarf2 register 5 (DW_OP_reg5), ie %rdi on x86-64. From .LVL23 on it is saved in %rbx, ie. DW_OP_reg1. However debug information says it's in DW_OP_reg3, ie. %rdx.

Something is apparantly wrong - just don't know if it's wrong on Josef's or Daniel's side. Or perhaps somewhere else...

Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]