[lldb-dev] SBThread numframes/frameatindex question
Carlo Kok
ck at remobjects.com
Tue Oct 30 01:57:36 PDT 2012
In my llvm emitted code (see IR attached) when I debug I get odd stack
frame listings.
If I set a breakpoint anywhere in "main" the stack frame contains a
faulty DoIt entry.
[0]
FunctionName: "Main"
FuncType: set (has the proper sig for main)
Position: !dbg !19 (call to DoIt)
[1]
FunctionName: "DoIt"
FuncType: NULL
Position: !dbg !18 (ret)
[2]
FuncName: "start"
FuncType: NULL
Position: not set
At this point there's nothing in the stack frame that calls DoIt yet. If
at this point I step into "DoIt" it inserts a proper DoIt entry in the list:
[0]
FunctionName: "DoIt"
FuncType: set (proper sig for DoIt)
Position: !dbg !16 (alloca)
[1]
FunctionName: "Main"
FuncType: set (has the proper sig for main)
Position: !dbg !19 (call to DoIt)
[2]
FunctionName: "DoIt"
FuncType: NULL
Position: !dbg !18 (ret)
[3]
FuncName: "start"
FuncType: NULL
Position: not set
but the old one is still there. Where does this come from?
-------------- next part --------------
; ModuleID = 'ConsoleApplication18'
@.str0 = linker_private constant [28 x i8] c"The magic happens here. %d\0A\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 @DoIt(i32, i32) uwtable {
%3 = alloca i32
store i32 %0, i32* %3
%4 = alloca i32
store i32 %1, i32* %4
%5 = alloca i32
call void @llvm.dbg.declare(metadata !{i32* %5}, metadata !13), !dbg !16
store i32 0, i32* %5, !dbg !16
%6 = load i32* %3, !dbg !17
%7 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([28 x i8]* @.str0, i32 0, i32 0), i32 %6), !dbg !17
%8 = load i32* %5, !dbg !18
ret i32 %8, !dbg !18
; No predecessors!
unreachable, !dbg !18
}
define void @main() uwtable {
%1 = call i32 @DoIt(i32 15, i32 12), !dbg !19
ret void, !dbg !21
; No predecessors!
unreachable, !dbg !21
}
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 !"Program.pas", metadata !"C:\5CUsers\5CCarlo\5CDocuments\5CVisual Studio 2012\5CProjects\5CConsoleApplication18\5CConsoleApplication18", metadata !"RemObjects Nougat (LLVM) 6.0.42.1108", i1 true, i1 false, metadata !"", i32 2, metadata !1, metadata !1, metadata !3, metadata !1} ; [ DW_TAG_compile_unit ] [C:\Users\Carlo\Documents\Visual Studio 2012\Projects\ConsoleApplication18\ConsoleApplication18/Program.pas] [DW_LANG_ObjC]
!1 = metadata !{metadata !2}
!2 = metadata !{i32 0}
!3 = metadata !{metadata !4}
!4 = metadata !{metadata !5, metadata !10}
!5 = metadata !{i32 786478, i32 0, metadata !6, metadata !"DoIt", metadata !"DoIt", metadata !"", metadata !6, i32 13, metadata !7, i1 true, i1 true, i32 0, i32 0, null, i32 0, i1 false, i32 (i32, i32)* @DoIt, null, null, metadata !1, i32 13} ; [ DW_TAG_subprogram ] [line 13] [local] [def] [DoIt]
!6 = metadata !{i32 786473, metadata !"Program.pas", metadata !"C:\5CUsers\5CCarlo\5CDocuments\5CVisual Studio 2012\5CProjects\5CConsoleApplication18\5CConsoleApplication18", 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 ] [line 0, size 0, align 0, offset 0] [from ]
!8 = metadata !{metadata !9}
!9 = metadata !{i32 786468, null, metadata !"Integer", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [Integer] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
!10 = metadata !{i32 786478, i32 0, metadata !6, metadata !"main", metadata !"main", metadata !"", metadata !6, i32 24, metadata !11, i1 true, i1 true, i32 0, i32 0, null, i32 0, i1 false, void ()* @main, null, null, metadata !1, i32 24} ; [ DW_TAG_subprogram ] [line 24] [local] [def] [main]
!11 = metadata !{i32 786453, i32 0, metadata !"", i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !12, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
!12 = metadata !{null}
!13 = metadata !{i32 786688, metadata !14, metadata !"Result", metadata !6, i32 14, metadata !9, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [Result] [line 14]
!14 = metadata !{i32 786443, metadata !15, i32 14, i32 1, metadata !6, i32 25} ; [ DW_TAG_lexical_block ] [C:\Users\Carlo\Documents\Visual Studio 2012\Projects\ConsoleApplication18\ConsoleApplication18/Program.pas]
!15 = metadata !{i32 786443, metadata !5, i32 13, i32 1, metadata !6, i32 24} ; [ DW_TAG_lexical_block ] [C:\Users\Carlo\Documents\Visual Studio 2012\Projects\ConsoleApplication18\ConsoleApplication18/Program.pas]
!16 = metadata !{i32 14, i32 1, metadata !14, null}
!17 = metadata !{i32 19, i32 5, metadata !14, null}
!18 = metadata !{i32 22, i32 1, metadata !14, null}
!19 = metadata !{i32 26, i32 3, metadata !20, null}
!20 = metadata !{i32 786443, metadata !10, i32 24, i32 1, metadata !6, i32 26} ; [ DW_TAG_lexical_block ] [C:\Users\Carlo\Documents\Visual Studio 2012\Projects\ConsoleApplication18\ConsoleApplication18/Program.pas]
!21 = metadata !{i32 27, i32 1, metadata !20, null}
More information about the lldb-dev
mailing list