[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-dev
Subject:    [LLVMdev] DWARF not being generated for local variable,
From:       Matt Pharr <matt.pharr () gmail ! com>
Date:       2011-04-30 0:49:57
Message-ID: CD43EC34-0B86-4934-B24F-B1D118EBC03F () gmail ! com
[Download RAW message or body]

I'm running into a problem with generating debugging information that I'm not sure \
how to debug; I'd be happy to have some suggestions about where to start digging in.

In short, I believe that I'm correctly generating debug info (with DIBuilder, which \
has so far been quite nice!), and a scan of the meta-data in the IR looks generally \
right.  However, if I run dwarfdump on my object file, I'm not seeing any DIE \
information for the local variables.  I'm wondering what might be going wrong along \
the way.

More specifically, given a program that is equivalent to the following in C:

float foo() {
	float y = 1234;
	return y;
}

My compiler generates the following IR (pay no attention to the ___ at the end of \
"foo"..):

define i32 @foo___(<4 x i32>) nounwind readnone alwaysinline {
entry:
  tail call void @llvm.dbg.value(metadata !6, i64 0, metadata !4), !dbg !7
  ret i32 1234
}

declare void @llvm.dbg.value(metadata, i64, metadata) nounwind readnone

!llvm.dbg.sp = !{!0}
!llvm.dbg.lv.foo___ = !{!4}

!0 = metadata !{i32 589870, i32 0, metadata !1, metadata !"foo", metadata !"foo", \
metadata !"foo___", metadata !1, i32 4, metadata !3, i1 false, i1 true, i32 0, i32 0, \
                i32 0, i32 0, i1 true, i32 (<4 x i32>)* @foo___, null, null} ; [ \
                DW_TAG_subprogram ]
!1 = metadata !{i32 589865, metadata !"a.c", metadata !"/Users/mmp/foo/", metadata \
                !2} ; [ DW_TAG_file_type ]
!2 = metadata !{i32 589841, i32 0, i32 12, metadata !"a.c", metadata \
!"/Users/mmp/foo", metadata !"foo", i1 true, i1 true, metadata !"-g", i32 0} ; [ \
                DW_TAG_compile_unit ]
!3 = metadata !{i32 589860, metadata !2, metadata !"int32", null, i32 0, i64 32, i64 \
                32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!4 = metadata !{i32 590080, metadata !5, metadata !"y", metadata !1, i32 5, metadata \
                !3, i32 0} ; [ DW_TAG_auto_variable ]
!5 = metadata !{i32 589835, metadata !0, i32 4, i32 0, metadata !1, i32 0} ; [ \
                DW_TAG_lexical_block ]
!6 = metadata !{i32 1234}
!7 = metadata !{i32 5, i32 0, metadata !5, null}

However, if I run dwarfdump on the object file, there's nothing there for the \
variable 'y' (see below).  Note that I am able to get correct DWARF output for global \
variables, so presumably the rest of my infrastructure isn't totally broken.

Any guidance about how best to proceed would be greatly appreciated!

Thanks,
-matt


----------------------------------------------------------------------
 File: a.o (x86_64)
----------------------------------------------------------------------
.debug_info contents:

0x00000000: Compile Unit: length = 0x00000043  version = 0x0002  abbr_offset = \
0x00000000  addr_size = 0x08  (next CU at 0x00000047)

0x0000000b: TAG_compile_unit [1] *
             AT_producer( "volta" )
             AT_language( DW_LANG_C99 )
             AT_name( "a.c" )
             AT_entry_pc( 0x0000000000000000 )
             AT_stmt_list( 0x00000000 )
             AT_comp_dir( "/Users/mmp/foo" )
             AT_APPLE_optimized( 0x01 )
             AT_APPLE_flags( "-g" )

0x00000039:     TAG_subprogram [2]  
                 AT_name( "foo" )
                 AT_MIPS_linkage_name( "foo___" )
                 AT_external( 0x01 )

0x00000046:     NULL



_______________________________________________
LLVM Developers mailing list
LLVMdev@cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic