Skip to content

Instantly share code, notes, and snippets.

@jackoalan
Created June 21, 2020 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackoalan/e33c878c545c5b270e6f3da44ef57320 to your computer and use it in GitHub Desktop.
Save jackoalan/e33c878c545c5b270e6f3da44ef57320 to your computer and use it in GitHub Desktop.
(lldb)p MyClass::MyMember
== [UserExpression::Evaluate] Parsing expression MyClass::MyMember ==
ClangUserExpression::ScanContext()
[CUE::SC] Null function
[C++ module config] Language doesn't support C++ modules
List of imported modules in expression:
List of include directories gathered for modules:
Parsing the following code:
#line 1 "<lldb wrapper prefix>"
#ifndef offsetof
#define offsetof(t, d) __builtin_offsetof(t, d)
#endif
#ifndef NULL
#define NULL (__null)
#endif
#ifndef Nil
#define Nil (__null)
#endif
#ifndef nil
#define nil (__null)
#endif
#ifndef YES
#define YES ((BOOL)1)
#endif
#ifndef NO
#define NO ((BOOL)0)
#endif
typedef __INT8_TYPE__ int8_t;
typedef __UINT8_TYPE__ uint8_t;
typedef __INT16_TYPE__ int16_t;
typedef __UINT16_TYPE__ uint16_t;
typedef __INT32_TYPE__ int32_t;
typedef __UINT32_TYPE__ uint32_t;
typedef __INT64_TYPE__ int64_t;
typedef __UINT64_TYPE__ uint64_t;
typedef __INTPTR_TYPE__ intptr_t;
typedef __UINTPTR_TYPE__ uintptr_t;
typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
typedef unsigned short unichar;
extern "C"
{
int printf(const char * __restrict, ...);
}
typedef signed char BOOL;
void
$__lldb_expr(void *$__lldb_arg)
{
;
#line 1 "<user expression 0>"
MyClass::MyMember
;
#line 1 "<lldb wrapper suffix>"
}
Using x86_64-pc-windows-msvc as the target triple
Using SIMD alignment: 128
Target datalayout string: 'e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128'
Target ABI: ''
Target vector alignment: 0
ClangExpressionDeclMap::FindExternalVisibleDecls for '$__lldb_arg' in a 'TranslationUnit'
CEDM::FEVD Searching the root namespace
ClangASTSource::FindExternalVisibleDecls on (ASTContext*)0x0000020CDD94E300 'Expression ASTContext for '<user expressio
n 0>'' for '$__lldb_arg' in a 'TranslationUnit'
CAS::FEVD Searching the root namespace
ClangExpressionDeclMap::FindExternalVisibleDecls for '$__lldb_expr' in a 'TranslationUnit'
CEDM::FEVD Searching the root namespace
ClangASTSource::FindExternalVisibleDecls on (ASTContext*)0x0000020CDD94E300 'Expression ASTContext for '<user expressio
n 0>'' for '$__lldb_expr' in a 'TranslationUnit'
CAS::FEVD Searching the root namespace
ClangExpressionDeclMap::FindExternalVisibleDecls for 'MyClass' in a 'TranslationUnit'
CEDM::FEVD Searching the root namespace
ClangASTSource::FindExternalVisibleDecls on (ASTContext*)0x0000020CDD94E300 'Expression ASTContext for '<user expressio
n 0>'' for 'MyClass' in a 'TranslationUnit'
CAS::FEVD Searching the root namespace
CAS::FEVD Matching type found for "MyClass": MyClass
[ClangASTImporter] Imported (CXXRecordDecl*)0x0000020CDD98E4C8, named MyClass (from (Decl*)0x0000020CDD6B1418), met
adata 65620
[ClangASTImporter] Decl has no origin information in (ASTContext*)0x0000020CDC552080
[ClangASTImporter] To is a TagDecl - attributes Lexical [complete->complete]
FindExternalLexicalDecls on (ASTContext*)0x0000020CDD94E300 'Expression ASTContext for '<user expression 0>'' in 'MyCla
ss' (%sDecl*)CXXRecord
FELD Original decl 0x0000020CDC552080 (Decl*)0x0000020cdd6b1418:
CXXRecordDecl 0x20cdd6b1418 <<invalid sloc>> <invalid sloc> struct MyClass definition
|-DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_
non_copy_move_ctor can_const_default_init
| |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
| |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
| |-MoveConstructor exists simple trivial needs_implicit
| |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param
| |-MoveAssignment exists simple trivial needs_implicit
| `-Destructor simple irrelevant trivial needs_implicit
`-VarDecl 0x20cdd6b1558 <<invalid sloc>> <invalid sloc> MyMember 'const unsigned int' static cinit
`-IntegerLiteral 0x20cdd6b15c0 <<invalid sloc>> 'unsigned int' 16
FELD Adding [to CXXRecordDecl MyClass] lexical VarDecl VarDecl 0x20cdd6b1558 <<invalid sloc>> <invalid sloc> MyMember
'const unsigned int' static cinit
`-IntegerLiteral 0x20cdd6b15c0 <<invalid sloc>> 'unsigned int' 16
[ClangASTImporter] Imported (VarDecl*)0x0000020CDD98E620, named MyMember (from (Decl*)0x0000020CDD6B1558), metadata
18446744073709551615
[ClangASTImporter] Decl has no origin information in (ASTContext*)0x0000020CDC552080
Last statement is an lvalue with type: const unsigned int
Found function ?$__lldb_expr@@YAXPEAX@Z for $__lldb_expr
lldb_private::ClangExpressionParser::PrepareForExecution - Current expression language is unknown
Module as passed in to IRForTarget:
"; ModuleID = '$__lldb_module'
source_filename = "$__lldb_module"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
@"?$__lldb_expr_result@?1??$__lldb_expr@@YAXPEAX@Z@4IB" = internal constant i32 16, align 4
; Function Attrs: convergent noinline nounwind optnone
define dso_local void @"?$__lldb_expr@@YAXPEAX@Z"(i8* %"$__lldb_arg") #0 {
entry:
%"$__lldb_arg.addr" = alloca i8*, align 8, !clang.decl.ptr !9
store i8* %"$__lldb_arg", i8** %"$__lldb_arg.addr", align 8
ret void
}
attributes #0 = { convergent noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-cal
ls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-ma
th"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="tru
e" "stack-protector-buffer-size"="0" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-fl
oat"="false" }
!clang.global.decl.ptrs = !{!0, !1, !0}
!llvm.module.flags = !{!2, !3, !4, !5, !6, !7}
!llvm.ident = !{!8}
!0 = !{i32* @"?$__lldb_expr_result@?1??$__lldb_expr@@YAXPEAX@Z@4IB", i64 2254280648592}
!1 = !{void (i8*)* @"?$__lldb_expr@@YAXPEAX@Z", i64 2254280647680}
!2 = !{i32 1, !"Objective-C Version", i32 2}
!3 = !{i32 1, !"Objective-C Image Info Version", i32 0}
!4 = !{i32 1, !"Objective-C Image Info Section", !".objc_imageinfo$B"}
!5 = !{i32 1, !"Objective-C Garbage Collection", i8 0}
!6 = !{i32 1, !"Objective-C Class Properties", i32 64}
!7 = !{i32 1, !"wchar_size", i32 2}
!8 = !{!"clang version 11.0.0 (D:Usersjackollvm-project 5b8acd369b43e9d0b0db2be1904750aa5c78e31e)"}
!9 = !{i64 2254280647456}
"
Result name: "?$__lldb_expr_result@?1??$__lldb_expr@@YAXPEAX@Z@4IB"
Found result in the IR: "@"?$__lldb_expr_result@?1??$__lldb_expr@@YAXPEAX@Z@4IB" = internal constant i32 16, align 4"
Found result decl: "static const unsigned int $__lldb_expr_resultMyClass::MyMember"
Result decl type: "const unsigned int"
Creating a new result global: "$RESULT_NAME" with size 4
Replacing "@"?$__lldb_expr_result@?1??$__lldb_expr@@YAXPEAX@Z@4IB" = internal constant i32 16, align 4" with "@"$RESULT
_NAME" = external global i32"
Synthesized result store " store i32 16, i32* @"$RESULT_NAME", align 4"
[ClangASTImporter] DeportType called on (const unsigned intType*)0x0000020CDD9329B1 from (ASTContext*)0x0000020CDD9
4E300 to (ASTContext*)0x0000020CDD8BD590
Examining reloc_placeholder, DeclForGlobalValue returns 0x0000000000000000
Examining $RESULT_NAME, DeclForGlobalValue returns 0x0000020CDD98E790
MaybeHandleVariable (@"$RESULT_NAME" = external global i32)
Type of "$__lldb_expr_result" is [clang "const unsigned int *", llvm "i32**"] [size 8, align 8]
Adding value for (NamedDecl*)%p [%s - %s] to the structure
Already placed at 0x0
Placed at 0x0
Element arrangement:
Arg: "i8* %"$__lldb_arg""
"$RESULT_NAME" ("$__lldb_expr_result") placed at 0
Replacing [@"$RESULT_NAME" = external global i32]
Total structure [align 8, size 8]
[ClangASTImporter] Forgetting destination (ASTContext*)0x0000020CDD94E300
[ClangASTImporter] Forgetting source->dest (ASTContext*)0x0000020CDD94E300->(ASTContext*)0x0000020CDD8BD590
== [UserExpression::Evaluate] Executing expression ==
IRMemoryMap::Malloc (15, 0x8, 0x3, eAllocationPolicyHostOnly) -> 0x1eb34fa0000
IRMemoryMap::Malloc (524295, 0x8, 0x3, eAllocationPolicyHostOnly) -> 0x1eb35130000
IRMemoryMap::lldb_private::IRMemoryMap::Malloc process_sp=0x20cdb1cbb20, process_sp->CanJIT()=true, process_sp->IsAlive
()=true
IRMemoryMap::WriteMemory (0x1eb34fa0010, 0x20cdd67c300, 0x4) went to [0x1eb34fa0010..0x1eb34fa0017)
IRMemoryMap::Malloc (7, 0x4, 0x3, eAllocationPolicyMirror) -> 0x1eb34fa0010
IRMemoryMap::WriteMemory (0x1eb34fa0000, 0x574378be68, 0x8) went to [0x1eb34fa0000..0x1eb34fa000f)
Materializer::Materialize (frame_sp = 0000020CDB100970, process_address = 0x1eb34fa0000) materialized:
IRMemoryMap::ReadMemory (0x1eb34fa0000, 0x20cdd6c9630, 0x8) came from [0x1eb34fa0000..0x1eb34fa000f)
IRMemoryMap::ReadMemory (0x1eb34fa0010, 0x20cdd67ce00, 0x4) came from [0x1eb34fa0010..0x1eb34fa0017)
0x1eb34fa0000: EntityResultVariable
Pointer:
0x1eb34fa0000: 10 00 fa 34 eb 01 00 00
Temporary allocation:
0x1eb34fa0000: 00 00 00 00
Module as passed in to IRInterpreter::Interpret:
"; ModuleID = '$__lldb_module'
source_filename = "$__lldb_module"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
@reloc_placeholder = internal global i8 0
; Function Attrs: convergent noinline nounwind optnone
define dso_local void @"?$__lldb_expr@@YAXPEAX@Z"(i8* %"$__lldb_arg") #0 {
entry:
%0 = getelementptr i8, i8* %"$__lldb_arg", i32 0
%1 = bitcast i8* %0 to i32**
%2 = load i32*, i32** %1, align 8
store i32 16, i32* %2, align 4
%"$__lldb_arg.addr" = alloca i8*, align 8, !clang.decl.ptr !10
store i8* %"$__lldb_arg", i8** %"$__lldb_arg.addr", align 8
ret void
}
attributes #0 = { convergent noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-cal
ls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-builtins" "no-infs-fp-ma
th"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="tru
e" "stack-protector-buffer-size"="0" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-fl
oat"="false" }
!clang.global.decl.ptrs = !{!0, !1, !0, !2}
!llvm.module.flags = !{!3, !4, !5, !6, !7, !8}
!llvm.ident = !{!9}
!0 = distinct !{null, i64 2254280648592}
!1 = !{void (i8*)* @"?$__lldb_expr@@YAXPEAX@Z", i64 2254280647680}
!2 = distinct !{null, i64 2254280648592}
!3 = !{i32 1, !"Objective-C Version", i32 2}
!4 = !{i32 1, !"Objective-C Image Info Version", i32 0}
!5 = !{i32 1, !"Objective-C Image Info Section", !".objc_imageinfo$B"}
!6 = !{i32 1, !"Objective-C Garbage Collection", i8 0}
!7 = !{i32 1, !"Objective-C Class Properties", i32 64}
!8 = !{i32 1, !"wchar_size", i32 2}
!9 = !{!"clang version 11.0.0 (D:Usersjackollvm-project 5b8acd369b43e9d0b0db2be1904750aa5c78e31e)"}
!10 = !{i64 2254280647456}
"
IRMemoryMap::WriteMemory (0x1eb351afff8, 0x5743789d48, 0x8) went to [0x1eb35130000..0x1eb351b0007)
Made an allocation for argument i8* %"$__lldb_arg"
Data region : 1eb34fa0000
Ref region : 1eb351afff8
Interpreting %0 = getelementptr i8, i8* %"$__lldb_arg", i32 0
IRMemoryMap::WriteMemory (0x1eb351afff0, 0x20cdd6c8d70, 0x8) went to [0x1eb35130000..0x1eb351b0007)
Interpreted a GetElementPtrInst
P : i8* %"$__lldb_arg" 0x1eb351afff8
Poffset : %0 = getelementptr i8, i8* %"$__lldb_arg", i32 0 0x1eb351afff0
Interpreting %1 = bitcast i8* %0 to i32**
IRMemoryMap::WriteMemory (0x1eb351affe8, 0x20cdd6c8ff0, 0x8) went to [0x1eb35130000..0x1eb351b0007)
Interpreting %2 = load i32*, i32** %1, align 8
IRMemoryMap::ReadMemory (0x1eb351affe8, 0x20cdd6c91d0, 0x8) came from [0x1eb35130000..0x1eb351b0007)
IRMemoryMap::ReadMemory (0x1eb34fa0000, 0x20cdd6c9450, 0x8) came from [0x1eb34fa0000..0x1eb34fa000f)
IRMemoryMap::WriteMemory (0x1eb351affe0, 0x20cdd6c9450, 0x8) went to [0x1eb35130000..0x1eb351b0007)
Interpreted a LoadInst
P : 0x1eb351affe8
R : 0x1eb34fa0000
D : 0x1eb351affe0
Interpreting store i32 16, i32* %2, align 4
IRMemoryMap::WriteMemory (0x1eb351affdc, 0x20cdd67c600, 0x4) went to [0x1eb35130000..0x1eb351b0007)
IRMemoryMap::ReadMemory (0x1eb351affe0, 0x20cdd6c9360, 0x8) came from [0x1eb35130000..0x1eb351b0007)
IRMemoryMap::ReadMemory (0x1eb351affdc, 0x20cdd67d180, 0x4) came from [0x1eb35130000..0x1eb351b0007)
IRMemoryMap::WriteMemory (0x1eb34fa0010, 0x20cdd67d180, 0x4) went to [0x1eb34fa0010..0x1eb34fa0017)
Interpreted a StoreInst
D : 0x1eb351affdc
P : 0x1eb351affe0
R : 0x1eb34fa0010
Interpreting %"$__lldb_arg.addr" = alloca i8*, align 8, !clang.decl.ptr !10
IRMemoryMap::WriteMemory (0x1eb351affc8, 0x5743789e98, 0x8) went to [0x1eb35130000..0x1eb351b0007)
Interpreted an AllocaInst
R : 0x1eb351affd0
P : 0x1eb351affc8
Interpreting store i8* %"$__lldb_arg", i8** %"$__lldb_arg.addr", align 8
IRMemoryMap::ReadMemory (0x1eb351affc8, 0x20cdd6c9f90, 0x8) came from [0x1eb35130000..0x1eb351b0007)
IRMemoryMap::ReadMemory (0x1eb351afff8, 0x20cdd6c9fe0, 0x8) came from [0x1eb35130000..0x1eb351b0007)
IRMemoryMap::WriteMemory (0x1eb351affd0, 0x20cdd6c9fe0, 0x8) went to [0x1eb35130000..0x1eb351b0007)
Interpreted a StoreInst
D : 0x1eb351afff8
P : 0x1eb351affc8
R : 0x1eb351affd0
Interpreting ret void
-- [UserExpression::FinalizeJITExecution] Dematerializing after execution --
Materializer::Dematerialize (frame_sp = 0000020CDB100970, process_address = 0x1eb34fa0000) about to dematerialize:
IRMemoryMap::ReadMemory (0x1eb34fa0000, 0x20cdd6c97c0, 0x8) came from [0x1eb34fa0000..0x1eb34fa000f)
IRMemoryMap::ReadMemory (0x1eb34fa0010, 0x20cdd67d1c0, 0x4) came from [0x1eb34fa0010..0x1eb34fa0017)
0x1eb34fa0000: EntityResultVariable
Pointer:
0x1eb34fa0000: 10 00 fa 34 eb 01 00 00
Temporary allocation:
0x1eb34fa0000: 10 00 00 00
IRMemoryMap::ReadMemory (0x1eb34fa0000, 0x20cdd6c8230, 0x8) came from [0x1eb34fa0000..0x1eb34fa000f)
IRMemoryMap::ReadMemory (0x1eb34fa0010, 0x20cdd67d140, 0x4) came from [0x1eb34fa0010..0x1eb34fa0017)
IRMemoryMap::Free (0x1eb34fa0010) freed [0x1eb34fa0010..0x1eb34fa0017)
== [UserExpression::Evaluate] Execution completed normally with result %s ==
IRMemoryMap::Free (0x1eb34fa0000) freed [0x1eb34fa0000..0x1eb34fa000f)
IRMemoryMap::Free (0x1eb35130000) freed [0x1eb35130000..0x1eb351b0007)
(const unsigned int) $0 = 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment