[LLVMdev] llvm dwarf debug info for locals with llvm.dbg.define
Carlo Kok
ck at remobjects.com
Fri Jul 27 02:35:41 PDT 2012
Hi,
I had a problem with LLVM not emitting local variable info, even though
I had calls to llvm.dbg.define. After some tracking I found that the
llvm.dbg.declare (and probably value too) have to have a !dbg !nr after
them to get emitted at all. maybe someone can adjust
http://llvm.org/docs/SourceLevelDebugging.html#format_common_declare
that the two llvm.dbg. functions need a !dbg line info associated with them?
Code i used that does not work (but does if !dbg !14 is added):
; ModuleID = 'meh'
@.str0 = linker_private constant [7 x i8] c"heh %b\00", align 1
@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16],
section "__DATA, __objc_imageinfo, regular, no_dead_strip"
@llvm.used = appending global [1 x i8*] [i8* bitcast ([2 x i32]*
@"\01L_OBJC_IMAGE_INFO" to i8*)], section "llvm.metadata"
define i32 @main() uwtable {
%b = alloca i32
%Result = alloca i32
call void @llvm.dbg.declare(metadata !{i32* %b}, metadata !10)
call void @llvm.dbg.declare(metadata !{i32* %Result}, metadata !13)
store i32 15, i32* %b, !dbg !14
%1 = load i32* %b, !dbg !15
%2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([7 x
i8]* @.str0, i32 0, i32 0), i32 %1), !dbg !15
%3 = load i32* %Result, !dbg !16
ret i32 %3, !dbg !16
; No predecessors!
unreachable, !dbg !16
}
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
declare i32 @printf(i8*, ...)
!llvm.dbg.cu = !{!0}
!0 = metadata !{i32 786449, i32 0, i32 16, metadata !"meh.c", metadata
!"/path/", metadata !"5.0.0.142", i1 true, i1 false, metadata !"", i32
2, metadata !1, metadata !1, metadata !3, metadata !1} ; [
DW_TAG_compile_unit ]
!1 = metadata !{metadata !2}
!2 = metadata !{i32 0}
!3 = metadata !{metadata !4}
!4 = metadata !{metadata !5}
!5 = metadata !{i32 786478, i32 0, metadata !6, metadata !"Main",
metadata !"Main", metadata !"", metadata !6, i32 10, metadata !7, i1
true, i1 true, i32 0, i32 0, null, i32 0, i1 false, i32 ()* @main, null,
null, metadata !1, i32 10} ; [ DW_TAG_subprogram ]
!6 = metadata !{i32 786473, metadata !"meh.c", metadata !"/path/", null}
; [ DW_TAG_file_type ]
!7 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0,
i64 0, i64 0, i32 0, null, metadata !8, i32 0, i32 0} ; [
DW_TAG_subroutine_type ]
!8 = metadata !{metadata !9}
!9 = metadata !{i32 786468, null, metadata !"int", null, i32 0, i64 32,
i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
!10 = metadata !{i32 786688, metadata !11, metadata !"b", metadata !6,
i32 10, metadata !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
!11 = metadata !{i32 786443, metadata !12, i32 10, i32 1, metadata !6,
i32 1} ; [ DW_TAG_lexical_block ]
!12 = metadata !{i32 786443, metadata !5, i32 10, i32 1, metadata !6,
i32 0} ; [ DW_TAG_lexical_block ]
!13 = metadata !{i32 786688, metadata !11, metadata !"Result", metadata
!6, i32 10, metadata !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ]
!14 = metadata !{i32 11, i32 7, metadata !11, null}
!15 = metadata !{i32 12, i32 3, metadata !11, null}
!16 = metadata !{i32 13, i32 1, metadata !11, null}
--
Carlo Kok
More information about the llvm-dev
mailing list