diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h @@ -61,6 +61,8 @@ clang::DeclContext *GetParentDeclContext(PdbSymUid uid); clang::FunctionDecl *GetOrCreateFunctionDecl(PdbCompilandSymId func_id); + clang::FunctionDecl * + GetOrCreateInlinedFunctionDecl(PdbCompilandSymId inlinesite_id); clang::BlockDecl *GetOrCreateBlockDecl(PdbCompilandSymId block_id); clang::VarDecl *GetOrCreateVariableDecl(PdbCompilandSymId scope_id, PdbCompilandSymId var_id); @@ -116,7 +118,11 @@ clang::NamespaceDecl *GetOrCreateNamespaceDecl(const char *name, clang::DeclContext &context); - + clang::FunctionDecl * + CreateFunctionDecl(PdbCompilandSymId func_id, llvm::StringRef func_name, + TypeIndex func_ti, CompilerType func_ct, + uint32_t param_count, clang::StorageClass func_storage, + bool is_inline, clang::DeclContext *parent); void ParseAllNamespacesPlusChildrenOf(llvm::Optional parent); void ParseDeclsForSimpleContext(clang::DeclContext &context); void ParseBlockChildren(PdbCompilandSymId block_id); diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp @@ -514,6 +514,8 @@ return nullptr; case S_BLOCK32: return GetOrCreateBlockDecl(id); + case S_INLINESITE: + return GetOrCreateInlinedFunctionDecl(id); default: return nullptr; } @@ -539,6 +541,9 @@ default: return llvm::None; } + + if (!result) + return llvm::None; m_uid_to_decl[toOpaqueUid(uid)] = result; return ToCompilerDecl(*result); } @@ -913,6 +918,8 @@ return llvm::dyn_cast(decl); clang::DeclContext *scope = GetOrCreateDeclContextForUid(scope_id); + if (!scope) + return nullptr; CVSymbol sym = m_index.ReadSymbolRecord(var_id); return CreateVariableDecl(PdbSymUid(var_id), sym, *scope); @@ -1042,60 +1049,31 @@ } clang::FunctionDecl * -PdbAstBuilder::GetOrCreateFunctionDecl(PdbCompilandSymId func_id) { - if (clang::Decl *decl = TryGetDecl(func_id)) - return llvm::dyn_cast(decl); - - clang::DeclContext *parent = GetParentDeclContext(PdbSymUid(func_id)); - std::string context_name; - if (clang::NamespaceDecl *ns = llvm::dyn_cast(parent)) { - context_name = ns->getQualifiedNameAsString(); - } else if (clang::TagDecl *tag = llvm::dyn_cast(parent)) { - context_name = tag->getQualifiedNameAsString(); - } - - CVSymbol cvs = m_index.ReadSymbolRecord(func_id); - ProcSym proc(static_cast(cvs.kind())); - llvm::cantFail(SymbolDeserializer::deserializeAs(cvs, proc)); - - PdbTypeSymId type_id(proc.FunctionType); - clang::QualType qt = GetOrCreateType(type_id); - if (qt.isNull()) - return nullptr; - - clang::StorageClass storage = clang::SC_None; - if (proc.Kind == SymbolRecordKind::ProcSym) - storage = clang::SC_Static; - - const clang::FunctionProtoType *func_type = - llvm::dyn_cast(qt); - - CompilerType func_ct = ToCompilerType(qt); - - llvm::StringRef proc_name = proc.Name; - proc_name.consume_front(context_name); - proc_name.consume_front("::"); - +PdbAstBuilder::CreateFunctionDecl(PdbCompilandSymId func_id, + llvm::StringRef func_name, TypeIndex func_ti, + CompilerType func_ct, uint32_t param_count, + clang::StorageClass func_storage, + bool is_inline, clang::DeclContext *parent) { clang::FunctionDecl *function_decl = nullptr; if (parent->isRecord()) { - clang::QualType parent_qt = llvm::cast(parent) + clang::QualType parent_qt = llvm::dyn_cast(parent) ->getTypeForDecl() ->getCanonicalTypeInternal(); lldb::opaque_compiler_type_t parent_opaque_ty = ToCompilerType(parent_qt).GetOpaqueQualType(); - auto iter = m_cxx_record_map.find(parent_opaque_ty); if (iter != m_cxx_record_map.end()) { - if (iter->getSecond().contains({proc_name, func_ct})) { + if (iter->getSecond().contains({func_name, func_ct})) { return nullptr; } } - CVType cvt = m_index.tpi().getType(type_id.index); + CVType cvt = m_index.tpi().getType(func_ti); MemberFunctionRecord func_record(static_cast(cvt.kind())); llvm::cantFail(TypeDeserializer::deserializeAs( cvt, func_record)); TypeIndex class_index = func_record.getClassType(); + CVType parent_cvt = m_index.tpi().getType(class_index); ClassRecord class_record = CVTagRecord::create(parent_cvt).asClass(); // If it's a forward reference, try to get the real TypeIndex. @@ -1109,29 +1087,152 @@ } if (!class_record.FieldList.isSimple()) { CVType field_list = m_index.tpi().getType(class_record.FieldList); - CreateMethodDecl process(m_index, m_clang, type_id.index, function_decl, - parent_opaque_ty, proc_name, func_ct); + CreateMethodDecl process(m_index, m_clang, func_ti, function_decl, + parent_opaque_ty, func_name, func_ct); if (llvm::Error err = visitMemberRecordStream(field_list.data(), process)) llvm::consumeError(std::move(err)); } if (!function_decl) { function_decl = m_clang.AddMethodToCXXRecordType( - parent_opaque_ty, proc_name, + parent_opaque_ty, func_name, /*mangled_name=*/nullptr, func_ct, /*access=*/lldb::AccessType::eAccessPublic, /*is_virtual=*/false, /*is_static=*/false, /*is_inline=*/false, /*is_explicit=*/false, /*is_attr_used=*/false, /*is_artificial=*/false); } - - m_cxx_record_map[parent_opaque_ty].insert({proc_name, func_ct}); + m_cxx_record_map[parent_opaque_ty].insert({func_name, func_ct}); } else { function_decl = m_clang.CreateFunctionDeclaration( - parent, OptionalClangModuleID(), proc_name, func_ct, storage, false); - CreateFunctionParameters(func_id, *function_decl, - func_type->getNumParams()); + parent, OptionalClangModuleID(), func_name, func_ct, func_storage, + is_inline); + CreateFunctionParameters(func_id, *function_decl, param_count); + } + return function_decl; +} + +clang::FunctionDecl * +PdbAstBuilder::GetOrCreateInlinedFunctionDecl(PdbCompilandSymId inlinesite_id) { + CompilandIndexItem *cii = + m_index.compilands().GetCompiland(inlinesite_id.modi); + CVSymbol sym = cii->m_debug_stream.readSymbolAtOffset(inlinesite_id.offset); + InlineSiteSym inline_site(static_cast(sym.kind())); + cantFail(SymbolDeserializer::deserializeAs(sym, inline_site)); + + PdbTypeSymId func_id(inline_site.Inlinee, true); + if (clang::Decl *decl = TryGetDecl(func_id)) + return llvm::dyn_cast(decl); + + CVType inlinee_cvt = m_index.ipi().getType(func_id.index); + llvm::StringRef func_name; + TypeIndex func_ti; + CompilerType func_ct; + uint32_t param_count = 0; + clang::DeclContext *parent = nullptr; + switch (inlinee_cvt.kind()) { + case LF_MFUNC_ID: { + MemberFuncIdRecord mfr; + cantFail( + TypeDeserializer::deserializeAs(inlinee_cvt, mfr)); + func_name = mfr.getName(); + func_ti = mfr.getFunctionType(); + PdbTypeSymId class_type_id(mfr.ClassType, false); + parent = GetOrCreateDeclContextForUid(class_type_id); + break; } + case LF_FUNC_ID: { + FuncIdRecord fir; + cantFail(TypeDeserializer::deserializeAs(inlinee_cvt, fir)); + func_name = fir.getName(); + func_ti = fir.getFunctionType(); + parent = FromCompilerDeclContext(GetTranslationUnitDecl()); + if (!fir.ParentScope.isNoneType()) { + CVType parent_cvt = m_index.ipi().getType(fir.ParentScope); + StringIdRecord sir; + cantFail( + TypeDeserializer::deserializeAs(parent_cvt, sir)); + parent = GetOrCreateNamespaceDecl(sir.String.data(), *parent); + } + + CVType func_type_cvt = m_index.tpi().getType(func_ti); + if (func_type_cvt.kind() == LF_PROCEDURE) { + ProcedureRecord pr; + cantFail( + TypeDeserializer::deserializeAs(func_type_cvt, pr)); + param_count = pr.getParameterCount(); + } + break; + } + default: + lldbassert(false && "Invalid inline function type!"); + } + clang::QualType func_qt = GetOrCreateType(func_ti); + if (func_qt.isNull()) + return nullptr; + func_ct = ToCompilerType(func_qt); + const clang::FunctionProtoType *func_type = + llvm::dyn_cast(func_qt); + param_count = func_type->getNumParams(); + clang::FunctionDecl *function_decl = + CreateFunctionDecl(inlinesite_id, func_name, func_ti, func_ct, + param_count, clang::SC_None, true, parent); + + // Use inline site id in m_decl_to_status because it's expected to be a + // PdbCompilandSymId so that we can parse local variables info after it. + uint64_t inlinesite_uid = toOpaqueUid(inlinesite_id); + DeclStatus status; + status.resolved = true; + status.uid = inlinesite_uid; + m_decl_to_status.insert({function_decl, status}); + // Use the index in IPI stream as uid in m_uid_to_decl, because index in IPI + // stream are unique and there could be multiple inline sites (different ids) + // referring the same inline function. This avoid creating multiple same + // inline function delcs. + uint64_t func_uid = toOpaqueUid(func_id); + lldbassert(m_uid_to_decl.count(func_uid) == 0); + m_uid_to_decl[func_uid] = function_decl; + return function_decl; +} + +clang::FunctionDecl * +PdbAstBuilder::GetOrCreateFunctionDecl(PdbCompilandSymId func_id) { + if (clang::Decl *decl = TryGetDecl(func_id)) + return llvm::dyn_cast(decl); + + clang::DeclContext *parent = GetParentDeclContext(PdbSymUid(func_id)); + std::string context_name; + if (clang::NamespaceDecl *ns = llvm::dyn_cast(parent)) { + context_name = ns->getQualifiedNameAsString(); + } else if (clang::TagDecl *tag = llvm::dyn_cast(parent)) { + context_name = tag->getQualifiedNameAsString(); + } + + CVSymbol cvs = m_index.ReadSymbolRecord(func_id); + ProcSym proc(static_cast(cvs.kind())); + llvm::cantFail(SymbolDeserializer::deserializeAs(cvs, proc)); + + PdbTypeSymId type_id(proc.FunctionType); + clang::QualType qt = GetOrCreateType(type_id); + if (qt.isNull()) + return nullptr; + + clang::StorageClass storage = clang::SC_None; + if (proc.Kind == SymbolRecordKind::ProcSym) + storage = clang::SC_Static; + + const clang::FunctionProtoType *func_type = + llvm::dyn_cast(qt); + + CompilerType func_ct = ToCompilerType(qt); + + llvm::StringRef proc_name = proc.Name; + proc_name.consume_front(context_name); + proc_name.consume_front("::"); + + clang::FunctionDecl *function_decl = + CreateFunctionDecl(func_id, proc_name, proc.FunctionType, func_ct, + func_type->getNumParams(), storage, false, parent); lldbassert(m_uid_to_decl.count(toOpaqueUid(func_id)) == 0); m_uid_to_decl[toOpaqueUid(func_id)] = function_decl; @@ -1384,7 +1485,7 @@ void PdbAstBuilder::ParseBlockChildren(PdbCompilandSymId block_id) { CVSymbol sym = m_index.ReadSymbolRecord(block_id); lldbassert(sym.kind() == S_GPROC32 || sym.kind() == S_LPROC32 || - sym.kind() == S_BLOCK32); + sym.kind() == S_BLOCK32 || sym.kind() == S_INLINESITE); CompilandIndexItem &cii = m_index.compilands().GetOrCreateCompiland(block_id.modi); CVSymbolArray symbols = @@ -1396,11 +1497,12 @@ symbols = skipFunctionParameters(*m_uid_to_decl[toOpaqueUid(block_id)], symbols); + symbols.drop_front(); auto begin = symbols.begin(); while (begin != symbols.end()) { PdbCompilandSymId child_sym_id(block_id.modi, begin.offset()); GetOrCreateSymbolForId(child_sym_id); - if (begin->kind() == S_BLOCK32) { + if (begin->kind() == S_BLOCK32 || begin->kind() == S_INLINESITE) { ParseBlockChildren(child_sym_id); begin = symbols.at(getScopeEndOffset(*begin)); } diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -372,7 +372,7 @@ std::shared_ptr inline_site = m_inline_sites[opaque_block_uid]; Block &parent_block = GetOrCreateBlock(inline_site->parent_id); parent_block.AddChild(child_block); - + m_ast->GetOrCreateInlinedFunctionDecl(block_id); // Copy ranges from InlineSite to Block. for (size_t i = 0; i < inline_site->ranges.GetSize(); ++i) { auto *entry = inline_site->ranges.GetEntryAtIndex(i); @@ -1742,8 +1742,7 @@ case S_BLOCK32: break; case S_INLINESITE: - // TODO: Handle inline site case. - return 0; + break; default: lldbassert(false && "Symbol is not a block!"); return 0; @@ -1770,8 +1769,10 @@ PdbCompilandSymId child_sym_id(block_id.modi, record_offset); ++iter; - // If this is a block, recurse into its children and then skip it. - if (variable_cvs.kind() == S_BLOCK32) { + // If this is a block or inline site, recurse into its children and then + // skip it. + if (variable_cvs.kind() == S_BLOCK32 || + variable_cvs.kind() == S_INLINESITE) { uint32_t block_end = getScopeEndOffset(variable_cvs); count += ParseVariablesForBlock(child_sym_id); iter = syms.at(block_end); diff --git a/lldb/test/Shell/SymbolFile/NativePDB/Inputs/inline_sites.lldbinit b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/inline_sites.lldbinit --- a/lldb/test/Shell/SymbolFile/NativePDB/Inputs/inline_sites.lldbinit +++ b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/inline_sites.lldbinit @@ -1,17 +1,28 @@ image dump line-table a.cpp -v -b a.cpp:5 b a.h:5 b a.h:6 b a.h:7 +b a.h:8 +b a.h:9 +b b.h:5 b b.h:6 +b b.h:7 +b c.h:5 b c.h:6 +b c.h:7 +b a.cpp:3 +b a.cpp:4 +b a.h:8 image lookup -a 0x140001003 -v image lookup -a 0x140001004 -v -image lookup -a 0x140001014 -v -image lookup -a 0x14000101a -v -image lookup -a 0x140001021 -v -image lookup -a 0x140001028 -v +image lookup -a 0x140001010 -v +image lookup -a 0x14000101c -v +image lookup -a 0x14000102a -v +image lookup -a 0x140001039 -v +image lookup -a 0x140001044 -v + +target modules dump ast quit \ No newline at end of file diff --git a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites.s b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites.s --- a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites.s +++ b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites.s @@ -7,121 +7,199 @@ # RUN: %p/Inputs/inline_sites.lldbinit 2>&1 | FileCheck %s # Compiled from the following files, but replaced the call to abort with nop. +# clang-cl -fuse-ld=lld-link /Z7 /O1 /Faa.asm /winsysroot~/win_toolchain a.cpp # a.cpp: -# #include "stdlib.h" # #include "a.h" # int main(int argc, char** argv) { -# Namespace1::foo(2); +# volatile int main_local = Namespace1::foo(2); # return 0; # } # a.h: +# #include # #include "b.h" # namespace Namespace1 { -# inline void foo(int x) { -# static volatile int gv_foo; -# ++gv_foo; -# if (!gv_foo) +# inline int foo(int x) { +# volatile int foo_local = x + 1; +# ++foo_local; +# if (!foo_local) # abort(); -# Class1::bar(x + 1); -# } +# return Class1::bar(foo_local); # } +# } // namespace Namespace1 # b.h: # #include "c.h" # class Class1 { # public: -# inline static void bar(int x) { -# static volatile int gv_bar; -# ++gv_bar; -# Namespace2::Class2::func(x + 1); +# inline static int bar(int x) { +# volatile int bar_local = x + 1; +# ++bar_local; +# return Namespace2::Class2::func(bar_local); # } # }; # c.h: -# namespace Namespace2{ -# class Class2{ -# public: -# inline static void func(int x) { -# static volatile int gv_func; -# gv_func += x; -# } -# }; -# } +# namespace Namespace2 { +# class Class2 { +# public: +# inline static int func(int x) { +# volatile int func_local = x + 1; +# func_local += x; +# return func_local; +# } +# }; +# } // namespace Namespace2 # CHECK: (lldb) image dump line-table a.cpp -v -# CHECK-NEXT: Line table for {{.*}}a.cpp in -# CHECK-NEXT: 0x0000000140001000: {{.*}}a.cpp:3 -# CHECK-NEXT: 0x0000000140001004: {{.*}}a.h:5, is_start_of_statement = TRUE, is_prologue_end = TRUE -# CHECK-NEXT: 0x000000014000100a: {{.*}}a.h:6 -# CHECK-NEXT: 0x0000000140001014: {{.*}}b.h:6, is_start_of_statement = TRUE, is_prologue_end = TRUE -# CHECK-NEXT: 0x000000014000101a: {{.*}}c.h:6, is_start_of_statement = TRUE, is_prologue_end = TRUE -# CHECK-NEXT: 0x0000000140001021: {{.*}}a.cpp:5 -# CHECK-NEXT: 0x0000000140001028: {{.*}}a.h:7, is_start_of_statement = TRUE -# CHECK-NEXT: 0x000000014000102a: {{.*}}a.cpp:5, is_terminal_entry = TRUE +# CHECK-NEXT: Line table +# CHECK-NEXT: 0x0000000140001000: /tmp/a.cpp:2 +# CHECK-NEXT: 0x0000000140001004: /tmp/a.h:5, is_start_of_statement = TRUE, is_prologue_end = TRUE +# CHECK-NEXT: 0x000000014000100c: /tmp/a.h:6 +# CHECK-NEXT: 0x0000000140001010: /tmp/a.h:7 +# CHECK-NEXT: 0x0000000140001018: /tmp/a.h:9 +# CHECK-NEXT: 0x000000014000101c: /tmp/b.h:5, is_start_of_statement = TRUE, is_prologue_end = TRUE +# CHECK-NEXT: 0x0000000140001022: /tmp/b.h:6 +# CHECK-NEXT: 0x0000000140001026: /tmp/b.h:7 +# CHECK-NEXT: 0x000000014000102a: /tmp/c.h:5, is_start_of_statement = TRUE, is_prologue_end = TRUE +# CHECK-NEXT: 0x0000000140001031: /tmp/c.h:6 +# CHECK-NEXT: 0x0000000140001035: /tmp/c.h:7 +# CHECK-NEXT: 0x0000000140001039: /tmp/a.cpp:3 +# CHECK-NEXT: 0x000000014000103d: /tmp/a.cpp:4 +# CHECK-NEXT: 0x0000000140001044: /tmp/a.h:8, is_start_of_statement = TRUE +# CHECK-NEXT: 0x0000000140001046: /tmp/a.cpp:4, is_terminal_entry = TRUE -# CEHCK: (lldb) b a.cpp:5 -# CHECK: Breakpoint 1: where = {{.*}}`main + 33 at a.cpp:5, address = 0x0000000140001021 -# CEHCK: (lldb) b a.h:5 -# CHECK: Breakpoint 2: where = {{.*}}`main + 4 [inlined] Namespace1::foo at a.h:5, address = 0x0000000140001004 -# CEHCK: (lldb) b a.h:6 -# CHECK: Breakpoint 3: where = {{.*}}`main + 10 [inlined] Namespace1::foo + 6 at a.h:6, address = 0x000000014000100a -# CEHCK: (lldb) b a.h:7 -# CHECK: Breakpoint 4: where = {{.*}}`main + 40 [inlined] Namespace1::foo at a.h:7, address = 0x0000000140001028 -# CEHCK: (lldb) b b.h:6 -# CHECK: Breakpoint 5: where = {{.*}}`main + 20 [inlined] Class1::bar at b.h:6, address = 0x0000000140001014 -# CEHCK: (lldb) b c.h:6 -# CHECK: Breakpoint 6: where = {{.*}}`main + 26 [inlined] Namespace2::Class2::func at c.h:6, address = 0x000000014000101a +#CHECK: (lldb) b a.h:5 +#CHECK: Breakpoint 1: where = {{.*}}`main + 4 [inlined] Namespace1::foo at a.h:5, address = 0x0000000140001004 +#CHECK: (lldb) b a.h:6 +#CHECK: Breakpoint 2: where = {{.*}}`main + 12 [inlined] Namespace1::foo + 8 at a.h:6, address = 0x000000014000100c +#CHECK: (lldb) b a.h:7 +#CHECK: Breakpoint 3: where = {{.*}}`main + 16 [inlined] Namespace1::foo + 12 at a.h:7, address = 0x0000000140001010 +#CHECK: (lldb) b a.h:8 +#CHECK: Breakpoint 4: where = {{.*}}`main + 68 [inlined] Namespace1::foo at a.h:8, address = 0x0000000140001044 +#CHECK: (lldb) b a.h:9 +#CHECK: Breakpoint 5: where = {{.*}}`main + 24 [inlined] Namespace1::foo + 20 at a.h:9, address = 0x0000000140001018 +#CHECK: (lldb) b b.h:5 +#CHECK: Breakpoint 6: where = {{.*}}`main + 28 [inlined] Class1::bar at b.h:5, address = 0x000000014000101c +#CHECK: (lldb) b b.h:6 +#CHECK: Breakpoint 7: where = {{.*}}`main + 34 [inlined] Class1::bar + 6 at b.h:6, address = 0x0000000140001022 +#CHECK: (lldb) b b.h:7 +#CHECK: Breakpoint 8: where = {{.*}}`main + 38 [inlined] Class1::bar + 10 at b.h:7, address = 0x0000000140001026 +#CHECK: (lldb) b c.h:5 +#CHECK: Breakpoint 9: where = {{.*}}`main + 42 [inlined] Namespace2::Class2::func at c.h:5, address = 0x000000014000102a +#CHECK: (lldb) b c.h:6 +#CHECK: Breakpoint 10: where = {{.*}}`main + 49 [inlined] Namespace2::Class2::func + 7 at c.h:6, address = 0x0000000140001031 +#CHECK: (lldb) b c.h:7 +#CHECK: Breakpoint 11: where = {{.*}}`main + 53 [inlined] Namespace2::Class2::func + 11 at c.h:7, address = 0x0000000140001035 +#CHECK: (lldb) b a.cpp:3 +#CHECK: Breakpoint 12: where = {{.*}}`main + 57 at a.cpp:3, address = 0x0000000140001039 +#CHECK: (lldb) b a.cpp:4 +#CHECK: Breakpoint 13: where = {{.*}}`main + 61 at a.cpp:4, address = 0x000000014000103d +#CHECK: (lldb) b a.h:8 +#CHECK: Breakpoint 14: where = {{.*}}`main + 68 [inlined] Namespace1::foo at a.h:8, address = 0x0000000140001044 # CEHCK-LABEL: (lldb) image lookup -a 0x140001003 -v -# CHECK: Summary: {{.*}}`main + 3 at a.cpp:3 -# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x000000014000102a) -# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x14000102a) -# CHECK: LineEntry: [0x0000000140001000-0x0000000140001004): {{.*}}a.cpp:3 +# CHECK: Summary: {{.*}}`main + 3 at a.cpp:2 +# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046) +# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046) +# CHECK: LineEntry: [0x0000000140001000-0x0000000140001004): /tmp/a.cpp:2 +# CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = [0x0000000140001000-0x0000000140001045) # CEHCK-LABEL: (lldb) image lookup -a 0x140001004 -v -# CHECK: Summary: {{.*}}`main + 4 [inlined] Namespace1::foo at a.h:5 -# CHECK-NEXT: {{.*}}`main + 4 at a.cpp:4 -# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x000000014000102a) -# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x14000102a) -# CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001021)[0x140001028-0x14000102a), name = "Namespace1::foo", decl = a.h:3 -# CHECK: LineEntry: [0x0000000140001004-0x000000014000100a): {{.*}}a.h:5 +# CHECK: Summary: {{.*}}`main + 4 [inlined] Namespace1::foo at a.h:5 +# CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3 +# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046) +# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046) +# CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001039)[0x140001044-0x140001046), name = "Namespace1::foo", decl = a.h:4 +# CHECK: LineEntry: [0x0000000140001004-0x000000014000100c): /tmp/a.h:5 +# CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = [0x0000000140001000-0x0000000140001045) +# CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = [0x0000000140001004-0x0000000140001046) -# CEHCK-LABEL: (lldb) image lookup -a 0x140001014 -v -# CHECK: Summary: {{.*}}`main + 20 [inlined] Class1::bar at b.h:6 -# CHECK-NEXT: {{.*}}`main + 20 [inlined] Namespace1::foo + 16 at a.h:8 -# CHECK-NEXT: {{.*}}`main + 4 at a.cpp:4 -# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x000000014000102a) -# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x14000102a) -# CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001021)[0x140001028-0x14000102a), name = "Namespace1::foo", decl = a.h:3 -# CHECK-NEXT: id = {{.*}}, range = [0x140001014-0x140001021), name = "Class1::bar", decl = b.h:4 -# CHECK: LineEntry: [0x0000000140001014-0x000000014000101a): {{.*}}b.h:6 +# CEHCK-LABEL: (lldb) image lookup -a 0x140001010 -v +# CHECK: Summary: {{.*}}`main + 16 [inlined] Namespace1::foo + 12 at a.h:7 +# CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3 +# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046) +# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046) +# CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001039)[0x140001044-0x140001046), name = "Namespace1::foo", decl = a.h:4 +# CHECK: LineEntry: [0x0000000140001010-0x0000000140001018): /tmp/a.h:7 +# CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = [0x000000014000100f-0x0000000140001046) +# CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = [0x0000000140001000-0x0000000140001045) +# CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = [0x0000000140001004-0x0000000140001046) -# CEHCK-LABEL: (lldb) image lookup -a 0x14000101a -v -# CHECK: Summary: {{.*}}`main + 26 [inlined] Namespace2::Class2::func at c.h:6 -# CHECK-NEXT: {{.*}}`main + 26 [inlined] Class1::bar + 6 at b.h:7 -# CHECK-NEXT: {{.*}}`main + 20 [inlined] Namespace1::foo + 16 at a.h:8 -# CHECK-NEXT: {{.*}}`main + 4 at a.cpp:4 -# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x000000014000102a) -# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x14000102a) -# CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001021)[0x140001028-0x14000102a), name = "Namespace1::foo", decl = a.h:3 -# CHECK-NEXT: id = {{.*}}, range = [0x140001014-0x140001021), name = "Class1::bar", decl = b.h:4 -# CHECK-NEXT: id = {{.*}}, range = [0x14000101a-0x140001021), name = "Namespace2::Class2::func", decl = c.h:4 -# CHECK: LineEntry: [0x000000014000101a-0x0000000140001021): {{.*}}c.h:6 +# CEHCK-LABEL: (lldb) image lookup -a 0x14000101c -v +# CHECK: Summary: {{.*}}`main + 28 [inlined] Class1::bar at b.h:5 +# CHECK-NEXT: {{.*}}`main + 28 [inlined] Namespace1::foo + 24 at a.h:9 +# CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3 +# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046) +# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046) +# CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001039)[0x140001044-0x140001046), name = "Namespace1::foo", decl = a.h:4 +# CHECK-NEXT: id = {{.*}}, range = [0x14000101c-0x140001039), name = "Class1::bar", decl = b.h:4 +# CHECK: LineEntry: [0x000000014000101c-0x0000000140001022): /tmp/b.h:5 +# CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int", valid ranges = [0x000000014000101c-0x000000014000101e) +# CHECK-NEXT: Variable: id = {{.*}}, name = "bar_local", type = "int", valid ranges = [0x000000014000101c-0x0000000140001039) +# CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = [0x000000014000100f-0x0000000140001046) +# CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = [0x0000000140001017-0x0000000140001045) +# CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = [0x0000000140001000-0x0000000140001045) +# CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = [0x0000000140001004-0x0000000140001046) -# CEHCK-LABEL: (lldb) image lookup -a 0x140001021 -v -# CHECK: Summary: {{.*}}`main + 33 at a.cpp:5 -# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x000000014000102a) -# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x14000102a) -# CHECK: LineEntry: [0x0000000140001021-0x0000000140001028): {{.*}}a.cpp:5 +# CEHCK-LABEL: (lldb) image lookup -a 0x14000102a -v +# CHECK: Summary: {{.*}}`main + 42 [inlined] Namespace2::Class2::func at c.h:5 +# CHECK-NEXT: {{.*}}`main + 42 [inlined] Class1::bar + 14 at b.h:7 +# CHECK-NEXT: {{.*}}`main + 28 [inlined] Namespace1::foo + 24 at a.h:9 +# CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3 +# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046) +# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046) +# CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001039)[0x140001044-0x140001046), name = "Namespace1::foo", decl = a.h:4 +# CHECK-NEXT: id = {{.*}}, range = [0x14000101c-0x140001039), name = "Class1::bar", decl = b.h:4 +# CHECK-NEXT: id = {{.*}}, range = [0x14000102a-0x140001039), name = "Namespace2::Class2::func", decl = c.h:4 +# CHECK: LineEntry: [0x000000014000102a-0x0000000140001031): /tmp/c.h:5 +# CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int", valid ranges = [0x000000014000102a-0x0000000140001039) +# CHECK-NEXT: Variable: id = {{.*}}, name = "func_local", type = "int", valid ranges = [0x000000014000102a-0x0000000140001039) +# CHECK-NEXT: Variable: id = {{.*}}, name = "bar_local", type = "int", valid ranges = [0x000000014000101c-0x0000000140001039) +# CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = [0x000000014000100f-0x0000000140001046) +# CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = [0x0000000140001017-0x0000000140001045) +# CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = [0x0000000140001000-0x0000000140001045) +# CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = [0x0000000140001004-0x0000000140001046) -# CEHCK-LABEL: (lldb) image lookup -a 0x140001028 -v -# CHECK: Summary: {{.*}}`main + 40 [inlined] Namespace1::foo at a.h:7 -# CHECK-NEXT: {{.*}}`main + 40 at a.cpp:4 -# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x000000014000102a) -# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x14000102a) -# CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001021)[0x140001028-0x14000102a), name = "Namespace1::foo", decl = a.h:3 -# CHECK: LineEntry: [0x0000000140001028-0x000000014000102a): {{.*}}a.h:7 +# CEHCK-LABEL: (lldb) image lookup -a 0x140001039 -v +# CHECK: Summary: {{.*}}`main + 57 at a.cpp:3 +# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046) +# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046) +# CHECK: LineEntry: [0x0000000140001039-0x000000014000103d): /tmp/a.cpp:3 +# CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = [0x0000000140001017-0x0000000140001045) +# CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = [0x0000000140001000-0x0000000140001045) +# CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = [0x0000000140001004-0x0000000140001046) + +# CEHCK-LABEL: (lldb) image lookup -a 0x140001044 -v +# CHECK: Summary: {{.*}}`main + 68 [inlined] Namespace1::foo at a.h:8 +# CHECK-NEXT: {{.*}}`main + 68 at a.cpp:3 +# CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046) +# CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046) +# CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001039)[0x140001044-0x140001046), name = "Namespace1::foo", decl = a.h:4 +# CHECK: LineEntry: [0x0000000140001044-0x0000000140001046): /tmp/a.h:8 +# CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = [0x000000014000100f-0x0000000140001046) +# CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = [0x0000000140001017-0x0000000140001045) +# CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = [0x0000000140001000-0x0000000140001045) +# CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = [0x0000000140001004-0x0000000140001046) + +# CHECK-LABEL: (lldb) target modules dump ast +# CHECK-NEXT: Dumping clang ast for 1 modules. +# CHECK-NEXT: TranslationUnitDecl {{.*}} +# CHECK-NEXT: |-FunctionDecl {{.*}} main 'int (int, char **)' +# CHECK-NEXT: | |-ParmVarDecl {{.*}} argc 'int' +# CHECK-NEXT: | `-ParmVarDecl {{.*}} argv 'char **' +# CHECK-NEXT: |-NamespaceDecl {{.*}} Namespace1 +# CHECK-NEXT: | `-FunctionDecl {{.*}} foo 'int (int)' inline +# CHECK-NEXT: | `-ParmVarDecl {{.*}} x 'int' +# CHECK-NEXT: |-CXXRecordDecl {{.*}} class Class1 +# CHECK-NEXT: | |-AccessSpecDecl {{.*}} public +# CHECK-NEXT: | `-CXXMethodDecl {{.*}} bar 'int (int)' static +# CHECK-NEXT: | `-ParmVarDecl {{.*}} 'int' +# CHECK-NEXT: `-NamespaceDecl {{.*}} Namespace2 +# CHECK-NEXT: `-CXXRecordDecl {{.*}} class Class2 +# CHECK-NEXT: |-AccessSpecDecl {{.*}} public +# CHECK-NEXT: `-CXXMethodDecl {{.*}} func 'int (int)' static +# CHECK-NEXT: `-ParmVarDecl {{.*}} 'int' .text - .def @feat.00; + .def @feat.00; .scl 3; .type 0; .endef @@ -129,7 +207,7 @@ .set @feat.00, 0 .intel_syntax noprefix .file "a.cpp" - .def main; + .def main; .scl 2; .type 32; .endef @@ -138,79 +216,81 @@ main: # @main .Lfunc_begin0: .cv_func_id 0 - .cv_file 1 "/tmp/a.cpp" "4ECCDD2814054DCF80EA72F4349036C4" 1 - .cv_loc 0 1 3 0 # a.cpp:3:0 + .cv_file 1 "/tmp/a.cpp" "4FFB96E5DF1A95CE7DB9732CFFE001D7" 1 + .cv_loc 0 1 2 0 # a.cpp:2:0 .seh_proc main -# %bb.0: # %entry +# %bb.0: #DEBUG_VALUE: main:argv <- $rdx #DEBUG_VALUE: main:argc <- $ecx #DEBUG_VALUE: foo:x <- 2 - sub rsp, 40 - .seh_stackalloc 40 + sub rsp, 56 + .seh_stackalloc 56 .seh_endprologue .Ltmp0: - .cv_file 2 "/tmp/./a.h" "9E656AFA1B1B681265C87EEA8BBE073E" 1 - .cv_inline_site_id 1 within 0 inlined_at 1 4 0 + .cv_file 2 "/tmp/./a.h" "BBFED90EF093E9C1D032CC9B05B5D167" 1 + .cv_inline_site_id 1 within 0 inlined_at 1 3 0 .cv_loc 1 2 5 0 # ./a.h:5:0 - inc dword ptr [rip + "?gv_foo@?1??foo@Namespace1@@YAXH@Z@4HC"] + mov dword ptr [rsp + 44], 3 .cv_loc 1 2 6 0 # ./a.h:6:0 - mov eax, dword ptr [rip + "?gv_foo@?1??foo@Namespace1@@YAXH@Z@4HC"] + inc dword ptr [rsp + 44] + .cv_loc 1 2 7 0 # ./a.h:7:0 + mov eax, dword ptr [rsp + 44] test eax, eax je .LBB0_2 .Ltmp1: -# %bb.1: # %"?foo@Namespace1@@YAXH@Z.exit" - #DEBUG_VALUE: foo:x <- 2 - #DEBUG_VALUE: main:argc <- $ecx +# %bb.1: #DEBUG_VALUE: main:argv <- $rdx - #DEBUG_VALUE: bar:x <- [DW_OP_plus_uconst 1, DW_OP_stack_value] 2 - .cv_file 3 "/tmp/./b.h" "BE52983EB17A3B0DA14E68A5CCBC4399" 1 - .cv_inline_site_id 2 within 1 inlined_at 2 8 0 - .cv_loc 2 3 6 0 # ./b.h:6:0 - inc dword ptr [rip + "?gv_bar@?1??bar@Class1@@SAXH@Z@4HC"] + #DEBUG_VALUE: main:argc <- $ecx + #DEBUG_VALUE: foo:x <- 2 + .cv_loc 1 2 9 0 # ./a.h:9:0 + mov eax, dword ptr [rsp + 44] .Ltmp2: - #DEBUG_VALUE: func:x <- 4 - .cv_file 4 "/tmp/./c.h" "D1B76A1C2A54DBEA648F3A11496166B8" 1 + #DEBUG_VALUE: bar:x <- $eax + .cv_file 3 "/tmp/./b.h" "A26CC743A260115F33AF91AB11F95877" 1 + .cv_inline_site_id 2 within 1 inlined_at 2 9 0 + .cv_loc 2 3 5 0 # ./b.h:5:0 + inc eax +.Ltmp3: + mov dword ptr [rsp + 52], eax + .cv_loc 2 3 6 0 # ./b.h:6:0 + inc dword ptr [rsp + 52] + .cv_loc 2 3 7 0 # ./b.h:7:0 + mov eax, dword ptr [rsp + 52] +.Ltmp4: + #DEBUG_VALUE: func:x <- $eax + .cv_file 4 "/tmp/./c.h" "8AF4613F78624BBE96D1C408ABA39B2D" 1 .cv_inline_site_id 3 within 2 inlined_at 3 7 0 + .cv_loc 3 4 5 0 # ./c.h:5:0 + lea ecx, [rax + 1] +.Ltmp5: + #DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $ecx + mov dword ptr [rsp + 48], ecx .cv_loc 3 4 6 0 # ./c.h:6:0 - add dword ptr [rip + "?gv_func@?1??func@Class2@Namespace2@@SAXH@Z@4HC"], 4 -.Ltmp3: - .cv_loc 0 1 5 0 # a.cpp:5:0 + add dword ptr [rsp + 48], eax + .cv_loc 3 4 7 0 # ./c.h:7:0 + mov eax, dword ptr [rsp + 48] +.Ltmp6: + .cv_loc 0 1 3 0 # a.cpp:3:0 + mov dword ptr [rsp + 48], eax + .cv_loc 0 1 4 0 # a.cpp:4:0 xor eax, eax - add rsp, 40 + add rsp, 56 ret -.Ltmp4: -.LBB0_2: # %if.then.i - #DEBUG_VALUE: foo:x <- 2 - #DEBUG_VALUE: main:argc <- $ecx +.Ltmp7: +.LBB0_2: #DEBUG_VALUE: main:argv <- $rdx - .cv_loc 1 2 7 0 # ./a.h:7:0 + #DEBUG_VALUE: main:argc <- $ecx + #DEBUG_VALUE: foo:x <- 2 + .cv_loc 1 2 8 0 # ./a.h:8:0 nop -.Ltmp5: +.Ltmp8: int3 -.Ltmp6: - #DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rdx +.Ltmp9: #DEBUG_VALUE: main:argc <- [DW_OP_LLVM_entry_value 1] $ecx + #DEBUG_VALUE: main:argv <- [DW_OP_LLVM_entry_value 1] $rdx .Lfunc_end0: .seh_endproc # -- End function - .section .bss,"bw",discard,"?gv_foo@?1??foo@Namespace1@@YAXH@Z@4HC" - .globl "?gv_foo@?1??foo@Namespace1@@YAXH@Z@4HC" # @"?gv_foo@?1??foo@Namespace1@@YAXH@Z@4HC" - .p2align 2 -"?gv_foo@?1??foo@Namespace1@@YAXH@Z@4HC": - .long 0 # 0x0 - - .section .bss,"bw",discard,"?gv_bar@?1??bar@Class1@@SAXH@Z@4HC" - .globl "?gv_bar@?1??bar@Class1@@SAXH@Z@4HC" # @"?gv_bar@?1??bar@Class1@@SAXH@Z@4HC" - .p2align 2 -"?gv_bar@?1??bar@Class1@@SAXH@Z@4HC": - .long 0 # 0x0 - - .section .bss,"bw",discard,"?gv_func@?1??func@Class2@Namespace2@@SAXH@Z@4HC" - .globl "?gv_func@?1??func@Class2@Namespace2@@SAXH@Z@4HC" # @"?gv_func@?1??func@Class2@Namespace2@@SAXH@Z@4HC" - .p2align 2 -"?gv_func@?1??func@Class2@Namespace2@@SAXH@Z@4HC": - .long 0 # 0x0 - .section .drectve,"yn" .ascii " /DEFAULTLIB:libcmt.lib" .ascii " /DEFAULTLIB:oldnames.lib" @@ -218,42 +298,42 @@ .p2align 2 .long 4 # Debug section magic .long 241 - .long .Ltmp8-.Ltmp7 # Subsection size -.Ltmp7: - .short .Ltmp10-.Ltmp9 # Record length -.Ltmp9: + .long .Ltmp11-.Ltmp10 # Subsection size +.Ltmp10: + .short .Ltmp13-.Ltmp12 # Record length +.Ltmp12: .short 4353 # Record kind: S_OBJNAME .long 0 # Signature - .asciz "/tmp/a-e5dd01.obj" # Object name + .asciz "/tmp/a-2b2ba0.obj" # Object name .p2align 2 -.Ltmp10: - .short .Ltmp12-.Ltmp11 # Record length -.Ltmp11: +.Ltmp13: + .short .Ltmp15-.Ltmp14 # Record length +.Ltmp14: .short 4412 # Record kind: S_COMPILE3 .long 1 # Flags and language .short 208 # CPUType - .short 14 # Frontend version + .short 15 # Frontend version .short 0 .short 0 .short 0 - .short 14000 # Backend version + .short 15000 # Backend version .short 0 .short 0 .short 0 - .asciz "clang version 14.0.0" # Null-terminated compiler version string + .asciz "clang version 15.0.0" # Null-terminated compiler version string .p2align 2 -.Ltmp12: -.Ltmp8: +.Ltmp15: +.Ltmp11: .p2align 2 .long 246 # Inlinee lines subsection - .long .Ltmp14-.Ltmp13 # Subsection size -.Ltmp13: + .long .Ltmp17-.Ltmp16 # Subsection size +.Ltmp16: .long 0 # Inlinee lines signature - # Inlined function foo starts at ./a.h:3 + # Inlined function foo starts at ./a.h:4 .long 4099 # Type index of inlined function .cv_filechecksumoffset 2 # Offset into filechecksum table - .long 3 # Starting line number + .long 4 # Starting line number # Inlined function bar starts at ./b.h:4 .long 4106 # Type index of inlined function @@ -264,16 +344,16 @@ .long 4113 # Type index of inlined function .cv_filechecksumoffset 4 # Offset into filechecksum table .long 4 # Starting line number -.Ltmp14: +.Ltmp17: .p2align 2 .section .debug$S,"dr",associative,main .p2align 2 .long 4 # Debug section magic .long 241 # Symbol subsection for main - .long .Ltmp16-.Ltmp15 # Subsection size -.Ltmp15: - .short .Ltmp18-.Ltmp17 # Record length -.Ltmp17: + .long .Ltmp19-.Ltmp18 # Subsection size +.Ltmp18: + .short .Ltmp21-.Ltmp20 # Record length +.Ltmp20: .short 4423 # Record kind: S_GPROC32_ID .long 0 # PtrParent .long 0 # PtrEnd @@ -287,11 +367,11 @@ .byte 0 # Flags .asciz "main" # Function name .p2align 2 -.Ltmp18: - .short .Ltmp20-.Ltmp19 # Record length -.Ltmp19: +.Ltmp21: + .short .Ltmp23-.Ltmp22 # Record length +.Ltmp22: .short 4114 # Record kind: S_FRAMEPROC - .long 40 # FrameSize + .long 56 # FrameSize .long 0 # Padding .long 0 # Offset of padding .long 0 # Bytes of callee saved registers @@ -299,103 +379,114 @@ .short 0 # Exception handler section .long 81920 # Flags (defines frame register) .p2align 2 -.Ltmp20: - .short .Ltmp22-.Ltmp21 # Record length -.Ltmp21: +.Ltmp23: + .short .Ltmp25-.Ltmp24 # Record length +.Ltmp24: .short 4414 # Record kind: S_LOCAL .long 116 # TypeIndex .short 1 # Flags .asciz "argc" .p2align 2 -.Ltmp22: - .cv_def_range .Lfunc_begin0 .Ltmp5, reg, 18 - .short .Ltmp24-.Ltmp23 # Record length -.Ltmp23: +.Ltmp25: + .cv_def_range .Lfunc_begin0 .Ltmp5 .Ltmp7 .Ltmp8, reg, 18 + .short .Ltmp27-.Ltmp26 # Record length +.Ltmp26: .short 4414 # Record kind: S_LOCAL .long 4114 # TypeIndex .short 1 # Flags .asciz "argv" .p2align 2 -.Ltmp24: - .cv_def_range .Lfunc_begin0 .Ltmp5, reg, 331 - .short .Ltmp26-.Ltmp25 # Record length -.Ltmp25: - .short 4365 # Record kind: S_GDATA32 - .long 4118 # Type - .secrel32 "?gv_foo@?1??foo@Namespace1@@YAXH@Z@4HC" # DataOffset - .secidx "?gv_foo@?1??foo@Namespace1@@YAXH@Z@4HC" # Segment - .asciz "Namespace1::foo::gv_foo" # Name - .p2align 2 -.Ltmp26: - .short .Ltmp28-.Ltmp27 # Record length .Ltmp27: - .short 4365 # Record kind: S_GDATA32 - .long 4118 # Type - .secrel32 "?gv_bar@?1??bar@Class1@@SAXH@Z@4HC" # DataOffset - .secidx "?gv_bar@?1??bar@Class1@@SAXH@Z@4HC" # Segment - .asciz "Class1::bar::gv_bar" # Name - .p2align 2 + .cv_def_range .Lfunc_begin0 .Ltmp8, reg, 331 + .short .Ltmp29-.Ltmp28 # Record length .Ltmp28: - .short .Ltmp30-.Ltmp29 # Record length -.Ltmp29: - .short 4365 # Record kind: S_GDATA32 - .long 4118 # Type - .secrel32 "?gv_func@?1??func@Class2@Namespace2@@SAXH@Z@4HC" # DataOffset - .secidx "?gv_func@?1??func@Class2@Namespace2@@SAXH@Z@4HC" # Segment - .asciz "Namespace2::Class2::func::gv_func" # Name + .short 4414 # Record kind: S_LOCAL + .long 4118 # TypeIndex + .short 0 # Flags + .asciz "main_local" .p2align 2 +.Ltmp29: + .cv_def_range .Ltmp0 .Ltmp9, frame_ptr_rel, 48 + .short .Ltmp31-.Ltmp30 # Record length .Ltmp30: - .short .Ltmp32-.Ltmp31 # Record length -.Ltmp31: .short 4429 # Record kind: S_INLINESITE .long 0 # PtrParent .long 0 # PtrEnd .long 4099 # Inlinee type index - .cv_inline_linetable 1 2 3 .Lfunc_begin0 .Lfunc_end0 + .cv_inline_linetable 1 2 4 .Lfunc_begin0 .Lfunc_end0 .p2align 2 +.Ltmp31: + .short .Ltmp33-.Ltmp32 # Record length .Ltmp32: - .short .Ltmp34-.Ltmp33 # Record length -.Ltmp33: .short 4414 # Record kind: S_LOCAL .long 116 # TypeIndex .short 257 # Flags .asciz "x" .p2align 2 +.Ltmp33: + .short .Ltmp35-.Ltmp34 # Record length .Ltmp34: - .short .Ltmp36-.Ltmp35 # Record length + .short 4414 # Record kind: S_LOCAL + .long 4118 # TypeIndex + .short 0 # Flags + .asciz "foo_local" + .p2align 2 .Ltmp35: + .cv_def_range .Ltmp0 .Ltmp6 .Ltmp7 .Ltmp9, frame_ptr_rel, 44 + .short .Ltmp37-.Ltmp36 # Record length +.Ltmp36: .short 4429 # Record kind: S_INLINESITE .long 0 # PtrParent .long 0 # PtrEnd .long 4106 # Inlinee type index .cv_inline_linetable 2 3 4 .Lfunc_begin0 .Lfunc_end0 .p2align 2 -.Ltmp36: - .short .Ltmp38-.Ltmp37 # Record length .Ltmp37: + .short .Ltmp39-.Ltmp38 # Record length +.Ltmp38: .short 4414 # Record kind: S_LOCAL .long 116 # TypeIndex - .short 257 # Flags + .short 1 # Flags .asciz "x" .p2align 2 -.Ltmp38: - .short .Ltmp40-.Ltmp39 # Record length .Ltmp39: + .cv_def_range .Ltmp2 .Ltmp3, reg, 17 + .short .Ltmp41-.Ltmp40 # Record length +.Ltmp40: + .short 4414 # Record kind: S_LOCAL + .long 4118 # TypeIndex + .short 0 # Flags + .asciz "bar_local" + .p2align 2 +.Ltmp41: + .cv_def_range .Ltmp2 .Ltmp6, frame_ptr_rel, 52 + .short .Ltmp43-.Ltmp42 # Record length +.Ltmp42: .short 4429 # Record kind: S_INLINESITE .long 0 # PtrParent .long 0 # PtrEnd .long 4113 # Inlinee type index .cv_inline_linetable 3 4 4 .Lfunc_begin0 .Lfunc_end0 .p2align 2 -.Ltmp40: - .short .Ltmp42-.Ltmp41 # Record length -.Ltmp41: +.Ltmp43: + .short .Ltmp45-.Ltmp44 # Record length +.Ltmp44: .short 4414 # Record kind: S_LOCAL .long 116 # TypeIndex - .short 257 # Flags + .short 1 # Flags .asciz "x" .p2align 2 -.Ltmp42: +.Ltmp45: + .cv_def_range .Ltmp4 .Ltmp6, reg, 17 + .short .Ltmp47-.Ltmp46 # Record length +.Ltmp46: + .short 4414 # Record kind: S_LOCAL + .long 4118 # TypeIndex + .short 0 # Flags + .asciz "func_local" + .p2align 2 +.Ltmp47: + .cv_def_range .Ltmp4 .Ltmp6, frame_ptr_rel, 48 .short 2 # Record length .short 4430 # Record kind: S_INLINESITE_END .short 2 # Record length @@ -404,41 +495,41 @@ .short 4430 # Record kind: S_INLINESITE_END .short 2 # Record length .short 4431 # Record kind: S_PROC_ID_END -.Ltmp16: +.Ltmp19: .p2align 2 .cv_linetable 0, main, .Lfunc_end0 .section .debug$S,"dr" .long 241 - .long .Ltmp44-.Ltmp43 # Subsection size -.Ltmp43: - .short .Ltmp46-.Ltmp45 # Record length -.Ltmp45: + .long .Ltmp49-.Ltmp48 # Subsection size +.Ltmp48: + .short .Ltmp51-.Ltmp50 # Record length +.Ltmp50: .short 4360 # Record kind: S_UDT .long 4103 # Type .asciz "Class1" .p2align 2 -.Ltmp46: - .short .Ltmp48-.Ltmp47 # Record length -.Ltmp47: +.Ltmp51: + .short .Ltmp53-.Ltmp52 # Record length +.Ltmp52: .short 4360 # Record kind: S_UDT .long 4110 # Type .asciz "Namespace2::Class2" .p2align 2 -.Ltmp48: -.Ltmp44: +.Ltmp53: +.Ltmp49: .p2align 2 .cv_filechecksums # File index to string table offset subsection .cv_stringtable # String table .long 241 - .long .Ltmp50-.Ltmp49 # Subsection size -.Ltmp49: - .short .Ltmp52-.Ltmp51 # Record length -.Ltmp51: + .long .Ltmp55-.Ltmp54 # Subsection size +.Ltmp54: + .short .Ltmp57-.Ltmp56 # Record length +.Ltmp56: .short 4428 # Record kind: S_BUILDINFO - .long 4121 # LF_BUILDINFO index + .long 4124 # LF_BUILDINFO index .p2align 2 -.Ltmp52: -.Ltmp50: +.Ltmp57: +.Ltmp55: .p2align 2 .section .debug$T,"dr" .p2align 2 @@ -457,7 +548,7 @@ # Procedure (0x1002) .short 0xe # Record length .short 0x1008 # Record kind: LF_PROCEDURE - .long 0x3 # ReturnType: void + .long 0x74 # ReturnType: int .byte 0x0 # CallingConvention: NearC .byte 0x0 # FunctionOptions .short 0x1 # NumParameters @@ -466,7 +557,7 @@ .short 0xe # Record length .short 0x1601 # Record kind: LF_FUNC_ID .long 0x1000 # ParentScope: Namespace1 - .long 0x1002 # FunctionType: void (int) + .long 0x1002 # FunctionType: int (int) .asciz "foo" # Name # Class (0x1004) .short 0x2a # Record length @@ -484,7 +575,7 @@ # MemberFunction (0x1005) .short 0x1a # Record length .short 0x1009 # Record kind: LF_MFUNCTION - .long 0x3 # ReturnType: void + .long 0x74 # ReturnType: int .long 0x1004 # ClassType: Class1 .long 0x0 # ThisType .byte 0x0 # CallingConvention: NearC @@ -497,7 +588,7 @@ .short 0x1203 # Record kind: LF_FIELDLIST .short 0x1511 # Member kind: OneMethod ( LF_ONEMETHOD ) .short 0xb # Attrs: Public, Static - .long 0x1005 # Type: void Class1::(int) + .long 0x1005 # Type: int Class1::(int) .asciz "bar" # Name # Class (0x1007) .short 0x2a # Record length @@ -528,7 +619,7 @@ .short 0xe # Record length .short 0x1602 # Record kind: LF_MFUNC_ID .long 0x1004 # ClassType: Class1 - .long 0x1005 # FunctionType: void Class1::(int) + .long 0x1005 # FunctionType: int Class1::(int) .asciz "bar" # Name # Class (0x100B) .short 0x42 # Record length @@ -547,7 +638,7 @@ # MemberFunction (0x100C) .short 0x1a # Record length .short 0x1009 # Record kind: LF_MFUNCTION - .long 0x3 # ReturnType: void + .long 0x74 # ReturnType: int .long 0x100b # ClassType: Namespace2::Class2 .long 0x0 # ThisType .byte 0x0 # CallingConvention: NearC @@ -560,7 +651,7 @@ .short 0x1203 # Record kind: LF_FIELDLIST .short 0x1511 # Member kind: OneMethod ( LF_ONEMETHOD ) .short 0xb # Attrs: Public, Static - .long 0x100c # Type: void Namespace2::Class2::(int) + .long 0x100c # Type: int Namespace2::Class2::(int) .asciz "func" # Name .byte 243 .byte 242 @@ -595,7 +686,7 @@ .short 0x12 # Record length .short 0x1602 # Record kind: LF_MFUNC_ID .long 0x100b # ClassType: Namespace2::Class2 - .long 0x100c # FunctionType: void Namespace2::Class2::(int) + .long 0x100c # FunctionType: int Namespace2::Class2::(int) .asciz "func" # Name .byte 243 .byte 242 @@ -650,18 +741,38 @@ .asciz "a.cpp" # StringData .byte 242 .byte 241 - # BuildInfo (0x1019) + # StringId (0x1019) + .short 0xa # Record length + .short 0x1605 # Record kind: LF_STRING_ID + .long 0x0 # Id + .byte 0 # StringData + .byte 243 + .byte 242 + .byte 241 + # StringId (0x101A) + .short 0x4e # Record length + .short 0x1605 # Record kind: LF_STRING_ID + .long 0x0 # Id + .asciz "/usr/local/google/home/zequanwu/llvm-project/build/release/bin/clang" # StringData + .byte 243 + .byte 242 + .byte 241 + # StringId (0x101B) + .short 0x9f6 # Record length + .short 0x1605 # Record kind: LF_STRING_ID + .long 0x0 # Id + .asciz "\"-cc1\" \"-triple\" \"x86_64-pc-windows-msvc19.20.0\" \"-S\" \"-disable-free\" \"-clear-ast-before-backend\" \"-disable-llvm-verifier\" \"-discard-value-names\" \"-mrelocation-model\" \"pic\" \"-pic-level\" \"2\" \"-mframe-pointer=none\" \"-relaxed-aliasing\" \"-fmath-errno\" \"-ffp-contract=on\" \"-fno-rounding-math\" \"-mconstructor-aliases\" \"-funwind-tables=2\" \"-target-cpu\" \"x86-64\" \"-mllvm\" \"-x86-asm-syntax=intel\" \"-tune-cpu\" \"generic\" \"-mllvm\" \"-treat-scalable-fixed-error-as-warning\" \"-D_MT\" \"-flto-visibility-public-std\" \"--dependent-lib=libcmt\" \"--dependent-lib=oldnames\" \"-stack-protector\" \"2\" \"-fms-volatile\" \"-fdiagnostics-format\" \"msvc\" \"-gno-column-info\" \"-gcodeview\" \"-debug-info-kind=constructor\" \"-ffunction-sections\" \"-fcoverage-compilation-dir=/tmp\" \"-resource-dir\" \"/usr/local/google/home/zequanwu/llvm-project/build/release/lib/clang/15.0.0\" \"-internal-isystem\" \"/usr/local/google/home/zequanwu/llvm-project/build/release/lib/clang/15.0.0/include\" \"-internal-isystem\" \"/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/DIA SDK/include\" \"-internal-isystem\" \"/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/include\" \"-internal-isystem\" \"/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/include\" \"-internal-isystem\" \"/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/Windows Kits/10/Include/10.0.19041.0/ucrt\" \"-internal-isystem\" \"/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/Windows Kits/10/Include/10.0.19041.0/shared\" \"-internal-isystem\" \"/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/Windows Kits/10/Include/10.0.19041.0/um\" \"-internal-isystem\" \"/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/Windows Kits/10/Include/10.0.19041.0/winrt\" \"-internal-isystem\" \"/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/Windows Kits/10/Include/10.0.19041.0/cppwinrt\" \"-Os\" \"-fdeprecated-macro\" \"-fdebug-compilation-dir=/tmp\" \"-ferror-limit\" \"19\" \"-fno-use-cxa-atexit\" \"-fms-extensions\" \"-fms-compatibility\" \"-fms-compatibility-version=19.20\" \"-std=c++14\" \"-fdelayed-template-parsing\" \"-fcolor-diagnostics\" \"-vectorize-loops\" \"-vectorize-slp\" \"-faddrsig\" \"-x\" \"c++\"" # StringData + .byte 242 + .byte 241 + # BuildInfo (0x101C) .short 0x1a # Record length .short 0x1603 # Record kind: LF_BUILDINFO .short 0x5 # NumArgs .long 0x1017 # Argument: /tmp - .long 0x0 # Argument + .long 0x101a # Argument: /usr/local/google/home/zequanwu/llvm-project/build/release/bin/clang .long 0x1018 # Argument: a.cpp - .long 0x0 # Argument - .long 0x0 # Argument + .long 0x1019 # Argument + .long 0x101b # Argument: "-cc1" "-triple" "x86_64-pc-windows-msvc19.20.0" "-S" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-relaxed-aliasing" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-mllvm" "-x86-asm-syntax=intel" "-tune-cpu" "generic" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-D_MT" "-flto-visibility-public-std" "--dependent-lib=libcmt" "--dependent-lib=oldnames" "-stack-protector" "2" "-fms-volatile" "-fdiagnostics-format" "msvc" "-gno-column-info" "-gcodeview" "-debug-info-kind=constructor" "-ffunction-sections" "-fcoverage-compilation-dir=/tmp" "-resource-dir" "/usr/local/google/home/zequanwu/llvm-project/build/release/lib/clang/15.0.0" "-internal-isystem" "/usr/local/google/home/zequanwu/llvm-project/build/release/lib/clang/15.0.0/include" "-internal-isystem" "/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/DIA SDK/include" "-internal-isystem" "/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/include" "-internal-isystem" "/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/VC/Tools/MSVC/14.26.28801/atlmfc/include" "-internal-isystem" "/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/Windows Kits/10/Include/10.0.19041.0/ucrt" "-internal-isystem" "/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/Windows Kits/10/Include/10.0.19041.0/shared" "-internal-isystem" "/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/Windows Kits/10/Include/10.0.19041.0/um" "-internal-isystem" "/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/Windows Kits/10/Include/10.0.19041.0/winrt" "-internal-isystem" "/usr/local/google/home/zequanwu/chromium/src/third_party/depot_tools/win_toolchain/vs_files/3bda71a11e/Windows Kits/10/Include/10.0.19041.0/cppwinrt" "-Os" "-fdeprecated-macro" "-fdebug-compilation-dir=/tmp" "-ferror-limit" "19" "-fno-use-cxa-atexit" "-fms-extensions" "-fms-compatibility" "-fms-compatibility-version=19.20" "-std=c++14" "-fdelayed-template-parsing" "-fcolor-diagnostics" "-vectorize-loops" "-vectorize-slp" "-faddrsig" "-x" "c++" .byte 242 .byte 241 .addrsig - .addrsig_sym "?gv_foo@?1??foo@Namespace1@@YAXH@Z@4HC" - .addrsig_sym "?gv_bar@?1??bar@Class1@@SAXH@Z@4HC" - .addrsig_sym "?gv_func@?1??func@Class2@Namespace2@@SAXH@Z@4HC" diff --git a/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp b/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp --- a/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp +++ b/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp @@ -157,6 +157,7 @@ // CHECK-NEXT: | |-ParmVarDecl {{.*}} argc 'int' // CHECK-NEXT: | `-ParmVarDecl {{.*}} argv 'char **' // CHECK-NEXT: |-FunctionDecl {{.*}} __scrt_common_main_seh 'int ()' static +// CHECK-NEXT: |-FunctionDecl {{.*}} invoke_main 'int ()' inline // CHECK-NEXT: `-FunctionDecl {{.*}} Function 'int (int, char)' // CHECK-NEXT: |-ParmVarDecl {{.*}} Param1 'int' // CHECK-NEXT: `-ParmVarDecl {{.*}} Param2 'char'