[llvm-commits] Change DwarfUsesAbsoluteLabelForStmtList to false for X86ELFMCAsmInfo.
Jan Sjodin
jan_sjodin at yahoo.com
Sat Feb 26 06:40:31 PST 2011
----- Original Message ----
> From: Anton Korobeynikov <anton at korobeynikov.info>
> To: Jan Sjodin <jan_sjodin at yahoo.com>
> Cc: llvm-commits at cs.uiuc.edu
> Sent: Sat, February 26, 2011 7:36:00 AM
> Subject: Re: [llvm-commits] Change DwarfUsesAbsoluteLabelForStmtList to false
>for X86ELFMCAsmInfo.
>
> Hello Jan,
>
> > Dwarfdump gives an error and gdb fails when generating code in memory (but
> > happens to accept it in a .o file) in Linux when
> > DwarfUsesAbsoluteLabelForStmtList = true, this patch sets it to false to
fix
> > this issue. I don't know if this is true for other targets, but the change
>is
> > limited to X86ELFMCAsmInfo.
> How the patch was tested? How we might be sure this won't break non JIT case?
>
> --
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
The question you are really asking is if there is a bug in dwarfdump or a bug in
llvm, because dwarfdump always complains. I tried this on Linux 64-bit with
clang and llvm trunk:
file empty.c:
---------------------------------------------------------------
int main()
{
return 42;
}
---------------------------------------------------------------
Compile and run dwarfdump:
---------------------------------------------------------------
> clang -c -g -emit-llvm -o empty.bc empty.c
> llc -filetype=obj empty.bc
> dwarfdump empty.o
.debug_info
COMPILE_UNIT<header overall offset = 0>:
<0>< 11> DW_TAG_compile_unit
DW_AT_producer clang version 2.9 (trunk 126545)
DW_AT_language DW_LANG_C99
DW_AT_name empty.c
DW_AT_entry_pc 0x0
DW_AT_stmt_list 0x0
DW_AT_comp_dir /home/jsjodin/Work/LLVM/Sandboxes/TOT/test
LOCAL_SYMBOLS:
<1>< 114> DW_TAG_base_type
DW_AT_encoding DW_ATE_signed
DW_AT_name int
DW_AT_byte_size 4
<1>< 121> DW_TAG_subprogram
DW_AT_name main
DW_AT_decl_file 1
DW_AT_decl_line 2
DW_AT_type <114>
DW_AT_external yes(1)
DW_AT_low_pc 0x0
DW_AT_high_pc 0xe
DW_AT_frame_base DW_OP_reg7
AT of 16359 (0x3fe7) is unknown to dwarfdump. Continuing.
<Unknown AT value 0x3fe7> yes(1)
.debug_line: line number info for a single cu
dwarfdump ERROR: dwarf_srclines: DW_DLE_ATTR_FORM_BAD (114)
---------------------------------------------------------------
dwarfdump cleary doesn't like what llc has produced. With the patch applied we
try again:
---------------------------------------------------------------
.debug_info
COMPILE_UNIT<header overall offset = 0>:
<0>< 11> DW_TAG_compile_unit
DW_AT_producer clang version 2.9 (trunk 126545)
DW_AT_language DW_LANG_C99
DW_AT_name empty.c
DW_AT_entry_pc 0x0
DW_AT_stmt_list 0
DW_AT_comp_dir /home/jsjodin/Work/LLVM/Sandboxes/TOT/test
LOCAL_SYMBOLS:
<1>< 110> DW_TAG_base_type
DW_AT_encoding DW_ATE_signed
DW_AT_name int
DW_AT_byte_size 4
<1>< 117> DW_TAG_subprogram
DW_AT_name main
DW_AT_decl_file 1
/home/jsjodin/Work/LLVM/Sandboxes/TOT/test/empty.c
DW_AT_decl_line 2
DW_AT_type <110>
DW_AT_external yes(1)
DW_AT_low_pc 0x0
DW_AT_high_pc 0xe
DW_AT_frame_base DW_OP_reg7
AT of 16359 (0x3fe7) is unknown to dwarfdump. Continuing.
<Unknown AT value 0x3fe7> yes(1)
.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/jsjodin/Work/LLVM/Sandboxes/TOT/test/empty.c: [ 2,-1] 0x0 // new
statement
/home/jsjodin/Work/LLVM/Sandboxes/TOT/test/empty.c: [ 3, 3] 0xd // new
statement
/home/jsjodin/Work/LLVM/Sandboxes/TOT/test/empty.c: [ 3, 3] 0xe // new
statement // end of text sequence
.debug_pubnames
global main die-in-sect 117, cu-in-sect 11, die-in-cu 117,
cu-header-in-sect 0
.debug_macinfo
.debug_loc format <i o b e l> means index section-offset begin-addr end-addr
length-of-block-entry
.debug_abbrev
< 1>< 0><code: 1> DW_TAG_compile_unit DW_children_yes
< 3> DW_AT_producer DW_FORM_string
< 5> DW_AT_language DW_FORM_data2
< 7> DW_AT_name DW_FORM_string
< 9> DW_AT_entry_pc DW_FORM_addr
< 11> DW_AT_stmt_list DW_FORM_data4
< 13> DW_AT_comp_dir DW_FORM_string
< 2>< 17><code: 2> DW_TAG_base_type DW_children_no
< 20> DW_AT_encoding DW_FORM_data1
< 22> DW_AT_name DW_FORM_string
< 24> DW_AT_byte_size DW_FORM_data1
< 3>< 28><code: 3> DW_TAG_subprogram DW_children_no
< 31> DW_AT_name DW_FORM_string
< 33> DW_AT_decl_file DW_FORM_data1
< 35> DW_AT_decl_line DW_FORM_data1
< 37> DW_AT_type DW_FORM_ref4
< 39> DW_AT_external DW_FORM_flag
< 41> DW_AT_low_pc DW_FORM_addr
< 43> DW_AT_high_pc DW_FORM_addr
< 45> DW_AT_frame_base DW_FORM_block1
< 47> AT of 16359 (0x3fe7) is unknown to dwarfdump. Continuing.
<Unknown AT value 0x3fe7> DW_FORM_flag
< 4>< 52><code: 0> null .debug_abbrev entry
.debug_string
.debug_aranges
.debug_frame
fde:
< 0><0x0:0xe><main><fde offset 0x14 length: 0x14><eh offset none>
0x00000000: <off cfa=08(r7) > <off r16=-8(cfa) >
.debug_static_func
.debug_static_vars
.debug_pubtypes
.debug_weaknames
---------------------------------------------------------------
More information about the llvm-commits
mailing list