[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/11802] New: DWARF .debug_line entry has incorrect address if di
From: |
richard dot stuckey at virgin dot net |
Subject: |
[Bug gas/11802] New: DWARF .debug_line entry has incorrect address if directives used for code |
Date: |
9 Jul 2010 17:30:38 -0000 |
If a .s file is created which uses .long, .short or .byte directives to specify
the object code, instead of instruction mnenomics, the assembler gets the
address in the first entry in the table incorrect by several bytes.
E.g. using a test source
void foo()
{
}
and compiling this with gcc (-S option) to get an assembly file,the text section
in this file is
.text
.Ltext0:
.globl foo
.type foo, @function
foo:
.LFB2:
.file 1 "code.c"
.loc 1 2 0
pushl %ebp
.LCFI0:
movl %esp, %ebp
.LCFI1:
.loc 1 3 0
popl %ebp
ret
.LFE2:
.size foo, .-foo
This can then be assembled with gas to give an object file with correct DWARF
information - dwarfdump shows the .debug_line section as
.debug_line: line number info for a single cu
Source lines (from CU-DIE at .debug_info offset 11):
<source> [row,column] <pc> //<new statement or basic block
/home/richard/Ucode/code.c: [ 2,-1] 0x0 // new statement
/home/richard/Ucode/code.c: [ 3,-1] 0x3 // new statement
/home/richard/Ucode/code.c: [ 3,-1] 0x5 // new statement
// end of text sequence
However, if the instructions in the .s file are replaced by directives with the
hex values of the required instructions, i.e.
.LFB2:
.file 1 "code.c"
.loc 1 2 0
.byte 0x55
.LCFI0:
.short 0xe589
.LCFI1:
.loc 1 3 0
.byte 0x5d
.byte 0xc3
.LFE2:
then the .debug_line section in the assembled file is
Source lines (from CU-DIE at .debug_info offset 11):
<source> [row,column] <pc> //<new statement or basic block
/home/richard/Ucode/code.c: [ 2,-1] 0x3 // new statement
/home/richard/Ucode/code.c: [ 2,-1] 0x5 // new statement
// end of text sequence
i.e. the addresses in the table no longer start at offset 0 from the start of
the text section. The object code produced in the .text section of the output
file is the same, as is to be expected.
Debugging of gas shows that the problem occurs when outputting the first entry
in the table, using a DWARF set_address opcode: the address is off by several
bytes, causing the addresses in the following entries in the table to be
incorrect as well (as they are encoded in the table as deltas).
--
Summary: DWARF .debug_line entry has incorrect address if
directives used for code
Product: binutils
Version: 2.20
Status: NEW
Severity: normal
Priority: P2
Component: gas
AssignedTo: unassigned at sources dot redhat dot com
ReportedBy: richard dot stuckey at virgin dot net
CC: bug-binutils at gnu dot org
GCC host triplet: X86
GCC target triplet: x86
http://sourceware.org/bugzilla/show_bug.cgi?id=11802
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
- [Bug gas/11802] New: DWARF .debug_line entry has incorrect address if directives used for code,
richard dot stuckey at virgin dot net <=