[Lldb-commits] [lldb] c6ad690 - [lldb, test] Fix typos in the lldb tests
Author: Venkata Ramanaiah Nalamothu Date: 2022-06-02T12:45:57+05:30 New Revision: c6ad6901734f8fa7c1ecd3aeb7de651b07ab21a6 URL: https://github.com/llvm/llvm-project/commit/c6ad6901734f8fa7c1ecd3aeb7de651b07ab21a6 DIFF: https://github.com/llvm/llvm-project/commit/c6ad6901734f8fa7c1ecd3aeb7de651b07ab21a6.diff LOG: [lldb, test] Fix typos in the lldb tests Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D126596 Added: Modified: lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py lldb/test/API/commands/frame/language/TestGuessLanguage.py lldb/test/API/commands/frame/var/TestFrameVar.py lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py lldb/test/API/commands/target/stop-hooks/TestStopHooks.py lldb/test/API/functionalities/history/TestHistoryRecall.py lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py lldb/test/API/functionalities/var_path/TestVarPath.py lldb/test/API/lang/c/find_struct_type/TestFindStructTypes.py lldb/test/API/lang/cpp/dynamic-value-same-basename/TestDynamicValueSameBase.py lldb/test/API/macosx/save_crashlog/TestSaveCrashlog.py lldb/test/API/macosx/version_zero/TestGetVersionZeroVersion.py lldb/test/API/sample_test/TestSampleTest.py Removed: diff --git a/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py b/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py index 7bba9c8d2c8d7..bd62e30b7fc19 100644 --- a/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py +++ b/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py @@ -13,7 +13,7 @@ class TestAllowJIT(TestBase): mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/commands/frame/language/TestGuessLanguage.py b/lldb/test/API/commands/frame/language/TestGuessLanguage.py index 1adab53a4ebc1..231f1d4238c6c 100644 --- a/lldb/test/API/commands/frame/language/TestGuessLanguage.py +++ b/lldb/test/API/commands/frame/language/TestGuessLanguage.py @@ -14,7 +14,7 @@ class TestFrameGuessLanguage(TestBase): mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/commands/frame/var/TestFrameVar.py b/lldb/test/API/commands/frame/var/TestFrameVar.py index c325c65ca155e..d142e356f28e1 100644 --- a/lldb/test/API/commands/frame/var/TestFrameVar.py +++ b/lldb/test/API/commands/frame/var/TestFrameVar.py @@ -13,7 +13,7 @@ class TestFrameVar(TestBase): mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py b/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py index 53c2c2e07a332..017aee982207b 100644 --- a/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py +++ b/lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py @@ -13,7 +13,7 @@ class TestStopHooks(TestBase): mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/commands/target/stop-hooks/TestStopHooks.py b/lldb/test/API/commands/target/stop-hooks/TestStopHooks.py index 6f5df860db57c..b9a6e5348614e 100644 --- a/lldb/test/API/commands/target/stop-hooks/TestStopHooks.py +++ b/lldb/test/API/commands/target/stop-hooks/TestStopHooks.py @@ -13,7 +13,7 @@ class TestStopHooks(TestBase): mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True diff --git a/lldb/test/API/functionalities/history/TestHistoryRecall.py b/lldb/test/API/functionalities/history/TestHistoryRecall.py index 4be4bdd6d9a15..b3a012dd7bbae 100644 --- a/lldb/test/API/functionalities/history/TestHistoryRecall.py +++ b/lldb/test/API/functionalities/history/TestHistoryRecall.py @@ -
[Lldb-commits] [PATCH] D126596: [lldb, test] Fix typos in the lldb tests
This revision was automatically updated to reflect the committed changes. Closed by commit rGc6ad6901734f: [lldb, test] Fix typos in the lldb tests (authored by RamNalamothu). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D126596/new/ https://reviews.llvm.org/D126596 Files: lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py lldb/test/API/commands/frame/language/TestGuessLanguage.py lldb/test/API/commands/frame/var/TestFrameVar.py lldb/test/API/commands/target/stop-hooks/TestStopHookScripted.py lldb/test/API/commands/target/stop-hooks/TestStopHooks.py lldb/test/API/functionalities/history/TestHistoryRecall.py lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py lldb/test/API/functionalities/var_path/TestVarPath.py lldb/test/API/lang/c/find_struct_type/TestFindStructTypes.py lldb/test/API/lang/cpp/dynamic-value-same-basename/TestDynamicValueSameBase.py lldb/test/API/macosx/save_crashlog/TestSaveCrashlog.py lldb/test/API/macosx/version_zero/TestGetVersionZeroVersion.py lldb/test/API/sample_test/TestSampleTest.py Index: lldb/test/API/sample_test/TestSampleTest.py === --- lldb/test/API/sample_test/TestSampleTest.py +++ lldb/test/API/sample_test/TestSampleTest.py @@ -13,7 +13,7 @@ mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True Index: lldb/test/API/macosx/version_zero/TestGetVersionZeroVersion.py === --- lldb/test/API/macosx/version_zero/TestGetVersionZeroVersion.py +++ lldb/test/API/macosx/version_zero/TestGetVersionZeroVersion.py @@ -14,7 +14,7 @@ mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True Index: lldb/test/API/macosx/save_crashlog/TestSaveCrashlog.py === --- lldb/test/API/macosx/save_crashlog/TestSaveCrashlog.py +++ lldb/test/API/macosx/save_crashlog/TestSaveCrashlog.py @@ -14,7 +14,7 @@ mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True Index: lldb/test/API/lang/cpp/dynamic-value-same-basename/TestDynamicValueSameBase.py === --- lldb/test/API/lang/cpp/dynamic-value-same-basename/TestDynamicValueSameBase.py +++ lldb/test/API/lang/cpp/dynamic-value-same-basename/TestDynamicValueSameBase.py @@ -14,7 +14,7 @@ mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True Index: lldb/test/API/lang/c/find_struct_type/TestFindStructTypes.py === --- lldb/test/API/lang/c/find_struct_type/TestFindStructTypes.py +++ lldb/test/API/lang/c/find_struct_type/TestFindStructTypes.py @@ -13,7 +13,7 @@ mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True Index: lldb/test/API/functionalities/var_path/TestVarPath.py === --- lldb/test/API/functionalities/var_path/TestVarPath.py +++ lldb/test/API/functionalities/var_path/TestVarPath.py @@ -13,7 +13,7 @@ mydir = TestBase.compute_mydir(__file__) -# If your test case doesn't stress debug info, the +# If your test case doesn't stress debug info, then # set this to true. That way it won't be run once for # each debug info format. NO_DEBUG_INFO_TESTCASE = True Index: lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py === --- lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrames.py +++ lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/TestSteppingOutWithArtificialFrame
[Lldb-commits] [lldb] f9b8f42 - [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code
Author: Luís Ferreira Date: 2022-06-02T14:44:07Z New Revision: f9b8f422e711efbf225e4f0f3002396cfbe48118 URL: https://github.com/llvm/llvm-project/commit/f9b8f422e711efbf225e4f0f3002396cfbe48118 DIFF: https://github.com/llvm/llvm-project/commit/f9b8f422e711efbf225e4f0f3002396cfbe48118.diff LOG: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code This patch moves ParseChildArrayInfo out of DWARFASTParserClang in order to decouple Clang-specific logic from DWARFASTParser. Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D114668 Signed-off-by: Luís Ferreira Added: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp Modified: lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt index 550404314af53..71fc850127331 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt +++ b/lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt @@ -11,6 +11,7 @@ add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN DebugNamesDWARFIndex.cpp DIERef.cpp DWARFAbbreviationDeclaration.cpp + DWARFASTParser.cpp DWARFASTParserClang.cpp DWARFAttribute.cpp DWARFBaseDIE.cpp diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp new file mode 100644 index 0..fe9b0b7044a43 --- /dev/null +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp @@ -0,0 +1,100 @@ +//===-- DWARFASTParser.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "DWARFASTParser.h" +#include "DWARFAttribute.h" +#include "DWARFDIE.h" + +#include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/SymbolFile.h" +#include "lldb/Target/StackFrame.h" + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::dwarf; + +llvm::Optional +DWARFASTParser::ParseChildArrayInfo(const DWARFDIE &parent_die, +const ExecutionContext *exe_ctx) { + SymbolFile::ArrayInfo array_info; + if (!parent_die) +return llvm::None; + + for (DWARFDIE die : parent_die.children()) { +const dw_tag_t tag = die.Tag(); +if (tag != DW_TAG_subrange_type) + continue; + +DWARFAttributes attributes; +const size_t num_child_attributes = die.GetAttributes(attributes); +if (num_child_attributes > 0) { + uint64_t num_elements = 0; + uint64_t lower_bound = 0; + uint64_t upper_bound = 0; + bool upper_bound_valid = false; + uint32_t i; + for (i = 0; i < num_child_attributes; ++i) { +const dw_attr_t attr = attributes.AttributeAtIndex(i); +DWARFFormValue form_value; +if (attributes.ExtractFormValueAtIndex(i, form_value)) { + switch (attr) { + case DW_AT_name: +break; + + case DW_AT_count: +if (DWARFDIE var_die = die.GetReferencedDIE(DW_AT_count)) { + if (var_die.Tag() == DW_TAG_variable) +if (exe_ctx) { + if (auto frame = exe_ctx->GetFrameSP()) { +Status error; +lldb::VariableSP var_sp; +auto valobj_sp = frame->GetValueForVariableExpressionPath( +var_die.GetName(), eNoDynamicValues, 0, var_sp, error); +if (valobj_sp) { + num_elements = valobj_sp->GetValueAsUnsigned(0); + break; +} + } +} +} else + num_elements = form_value.Unsigned(); +break; + + case DW_AT_bit_stride: +array_info.bit_stride = form_value.Unsigned(); +break; + + case DW_AT_byte_stride: +array_info.byte_stride = form_value.Unsigned(); +break; + + case DW_AT_lower_bound: +lower_bound = form_value.Unsigned(); +break; + + case DW_AT_upper_bound: +upper_bound_valid = true; +upper_bound = form_value.Unsigned(); +break; + + default: +break; + } +} + } + + if (num_elements == 0) { +if (upper_bound_valid && upper_bound >= lower_bound) + num_elements = upper_bound - lower_bound + 1; + } + + array_info.element_orders.push_back(num_elements); +} + } + return array_info; +} diff --git a/lldb/source/Plugins/SymbolF
[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code
This revision was automatically updated to reflect the committed changes. Closed by commit rGf9b8f422e711: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code (authored by ljmf00). Herald added a project: All. Changed prior to commit: https://reviews.llvm.org/D114668?vs=391867&id=433751#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114668/new/ https://reviews.llvm.org/D114668 Files: lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp === --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -3019,99 +3019,6 @@ return arg_idx; } -llvm::Optional -DWARFASTParser::ParseChildArrayInfo(const DWARFDIE &parent_die, -const ExecutionContext *exe_ctx) { - SymbolFile::ArrayInfo array_info; - if (!parent_die) -return llvm::None; - - for (DWARFDIE die : parent_die.children()) { -const dw_tag_t tag = die.Tag(); -if (tag != DW_TAG_subrange_type) - continue; - -DWARFAttributes attributes; -const size_t num_child_attributes = die.GetAttributes(attributes); -if (num_child_attributes > 0) { - uint64_t num_elements = 0; - uint64_t lower_bound = 0; - uint64_t upper_bound = 0; - bool upper_bound_valid = false; - uint32_t i; - for (i = 0; i < num_child_attributes; ++i) { -const dw_attr_t attr = attributes.AttributeAtIndex(i); -DWARFFormValue form_value; -if (attributes.ExtractFormValueAtIndex(i, form_value)) { - switch (attr) { - case DW_AT_name: -break; - - case DW_AT_count: -if (DWARFDIE var_die = die.GetReferencedDIE(DW_AT_count)) { - if (var_die.Tag() == DW_TAG_variable) -if (exe_ctx) { - if (auto frame = exe_ctx->GetFrameSP()) { -Status error; -lldb::VariableSP var_sp; -auto valobj_sp = frame->GetValueForVariableExpressionPath( -var_die.GetName(), eNoDynamicValues, 0, var_sp, -error); -if (valobj_sp) { - num_elements = valobj_sp->GetValueAsUnsigned(0); - break; -} - } -} -} else - num_elements = form_value.Unsigned(); -break; - - case DW_AT_bit_stride: -array_info.bit_stride = form_value.Unsigned(); -break; - - case DW_AT_byte_stride: -array_info.byte_stride = form_value.Unsigned(); -break; - - case DW_AT_lower_bound: -lower_bound = form_value.Unsigned(); -break; - - case DW_AT_upper_bound: -upper_bound_valid = true; -upper_bound = form_value.Unsigned(); -break; - - default: - case DW_AT_abstract_origin: - case DW_AT_accessibility: - case DW_AT_allocated: - case DW_AT_associated: - case DW_AT_data_location: - case DW_AT_declaration: - case DW_AT_description: - case DW_AT_sibling: - case DW_AT_threads_scaled: - case DW_AT_type: - case DW_AT_visibility: -break; - } -} - } - - if (num_elements == 0) { -if (upper_bound_valid && upper_bound >= lower_bound) - num_elements = upper_bound - lower_bound + 1; - } - - array_info.element_orders.push_back(num_elements); -} - } - return array_info; -} - Type *DWARFASTParserClang::GetTypeForDIE(const DWARFDIE &die) { if (die) { SymbolFileDWARF *dwarf = die.GetDWARF(); Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp === --- /dev/null +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp @@ -0,0 +1,100 @@ +//===-- DWARFASTParser.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "DWARFASTParser.h" +#include "DWARFAttribute.h" +#include "DWARFDIE.h" + +#include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/SymbolFile.h" +#include "lldb/Target/StackFrame.h" + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::dwarf; + +llvm::Optional +DWARFASTParser::ParseChild
[Lldb-commits] [PATCH] D114668: [lldb][NFC] Move generic DWARFASTParser code out of Clang-specific code
ljmf00 added a comment. Sorry for leaving this hanging for a long time. Feel free to leave feedback if I'm missing something, in the meantime. I'll try to push the other patches too. I ran the test suite again and didn't break anything. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114668/new/ https://reviews.llvm.org/D114668 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 3da4f9c - [lldb][NFC] Move non-clang specific method to the generic DWARF Parser
Author: Luís Ferreira Date: 2022-06-02T16:39:39Z New Revision: 3da4f9c57b15b3d76b8acbaa8c2b420ad525fa25 URL: https://github.com/llvm/llvm-project/commit/3da4f9c57b15b3d76b8acbaa8c2b420ad525fa25 DIFF: https://github.com/llvm/llvm-project/commit/3da4f9c57b15b3d76b8acbaa8c2b420ad525fa25.diff LOG: [lldb][NFC] Move non-clang specific method to the generic DWARF Parser This patch renames DW_ACCESS_to_AccessType function and move it to the abstract DWARFASTParser, since there is no clang-specific code there. This is useful for plugins other than Clang. Reviewed By: shafik, bulbazord Differential Revision: https://reviews.llvm.org/D114719 Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp index fe9b0b7044a4..364d34c73375 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp @@ -98,3 +98,18 @@ DWARFASTParser::ParseChildArrayInfo(const DWARFDIE &parent_die, } return array_info; } + +AccessType +DWARFASTParser::GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) { + switch (dwarf_accessibility) { + case DW_ACCESS_public: +return eAccessPublic; + case DW_ACCESS_private: +return eAccessPrivate; + case DW_ACCESS_protected: +return eAccessProtected; + default: +break; + } + return eAccessNone; +} diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h index 00123a4b9216..97b0ea1874e1 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h @@ -14,6 +14,7 @@ #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/CompilerDecl.h" #include "lldb/Symbol/CompilerDeclContext.h" +#include "lldb/lldb-enumerations.h" class DWARFDIE; namespace lldb_private { @@ -54,6 +55,8 @@ class DWARFASTParser { static llvm::Optional ParseChildArrayInfo(const DWARFDIE &parent_die, const lldb_private::ExecutionContext *exe_ctx = nullptr); + + static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility); }; #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index e5f7b8a8201d..dc3941526b7c 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -8,6 +8,7 @@ #include +#include "DWARFASTParser.h" #include "DWARFASTParserClang.h" #include "DWARFDebugInfo.h" #include "DWARFDeclContext.h" @@ -63,20 +64,6 @@ DWARFASTParserClang::DWARFASTParserClang(TypeSystemClang &ast) DWARFASTParserClang::~DWARFASTParserClang() = default; -static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) { - switch (dwarf_accessibility) { - case DW_ACCESS_public: -return eAccessPublic; - case DW_ACCESS_private: -return eAccessPrivate; - case DW_ACCESS_protected: -return eAccessProtected; - default: -break; - } - return eAccessNone; -} - static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) { switch (decl_kind) { case clang::Decl::CXXRecord: @@ -314,7 +301,7 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE &die) { break; case DW_AT_accessibility: - accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); + accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned()); break; case DW_AT_artificial: @@ -1423,7 +1410,7 @@ void DWARFASTParserClang::ParseInheritance( break; case DW_AT_accessibility: -accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); +accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned()); break; case DW_AT_virtuality: @@ -2478,7 +2465,7 @@ MemberAttributes::MemberAttributes(const DWARFDIE &die, break; case DW_AT_accessibility: -accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); +accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned()); break; case DW_AT_artificial: is_artificial = form_value.Boolean(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D114719: [lldb][NFC] Move non-clang specific method to the generic DWARF Parser
This revision was automatically updated to reflect the committed changes. Closed by commit rG3da4f9c57b15: [lldb][NFC] Move non-clang specific method to the generic DWARF Parser (authored by ljmf00). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D114719/new/ https://reviews.llvm.org/D114719 Files: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp === --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -8,6 +8,7 @@ #include +#include "DWARFASTParser.h" #include "DWARFASTParserClang.h" #include "DWARFDebugInfo.h" #include "DWARFDeclContext.h" @@ -63,20 +64,6 @@ DWARFASTParserClang::~DWARFASTParserClang() = default; -static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) { - switch (dwarf_accessibility) { - case DW_ACCESS_public: -return eAccessPublic; - case DW_ACCESS_private: -return eAccessPrivate; - case DW_ACCESS_protected: -return eAccessProtected; - default: -break; - } - return eAccessNone; -} - static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) { switch (decl_kind) { case clang::Decl::CXXRecord: @@ -314,7 +301,7 @@ break; case DW_AT_accessibility: - accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); + accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned()); break; case DW_AT_artificial: @@ -1423,7 +1410,7 @@ break; case DW_AT_accessibility: -accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); +accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned()); break; case DW_AT_virtuality: @@ -2478,7 +2465,7 @@ break; case DW_AT_accessibility: -accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned()); +accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned()); break; case DW_AT_artificial: is_artificial = form_value.Boolean(); Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h === --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h @@ -14,6 +14,7 @@ #include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/CompilerDecl.h" #include "lldb/Symbol/CompilerDeclContext.h" +#include "lldb/lldb-enumerations.h" class DWARFDIE; namespace lldb_private { @@ -54,6 +55,8 @@ static llvm::Optional ParseChildArrayInfo(const DWARFDIE &parent_die, const lldb_private::ExecutionContext *exe_ctx = nullptr); + + static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility); }; #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp === --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp @@ -98,3 +98,18 @@ } return array_info; } + +AccessType +DWARFASTParser::GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) { + switch (dwarf_accessibility) { + case DW_ACCESS_public: +return eAccessPublic; + case DW_ACCESS_private: +return eAccessPrivate; + case DW_ACCESS_protected: +return eAccessProtected; + default: +break; + } + return eAccessNone; +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D50304: [lldb] Fix thread step until to not set breakpoint(s) on incorrect line numbers
RamNalamothu updated this revision to Diff 433784. RamNalamothu retitled this revision from "[lldb] CommandObjectThreadUntil should set breakpoint at either on exact or the nearest subsequent line number but not on all the subsequent line numbers" to "[lldb] Fix thread step until to not set breakpoint(s) on incorrect line numbers". RamNalamothu edited the summary of this revision. RamNalamothu added a comment. Herald added a project: LLDB. Added the test coverage. By the way, I am surprized that it looks like no else landed into this issue since the time I got into it during Aug/2018. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D50304/new/ https://reviews.llvm.org/D50304 Files: lldb/source/Commands/CommandObjectThread.cpp lldb/test/API/functionalities/thread/step_until/TestStepUntil.py Index: lldb/test/API/functionalities/thread/step_until/TestStepUntil.py === --- lldb/test/API/functionalities/thread/step_until/TestStepUntil.py +++ lldb/test/API/functionalities/thread/step_until/TestStepUntil.py @@ -21,7 +21,7 @@ self.greater_than_two = line_number('main.c', 'Greater than or equal to 2.') self.back_out_in_main = line_number('main.c', 'Back out in main') -def do_until (self, args, until_lines, expected_linenum): +def common_setup (self, args): self.build() exe = self.getBuildArtifact("a.out") @@ -50,7 +50,8 @@ thread = threads[0] return thread -thread = self.common_setup(None) +def do_until (self, args, until_lines, expected_linenum): +thread = self.common_setup(args) cmd_interp = self.dbg.GetCommandInterpreter() ret_obj = lldb.SBCommandReturnObject() @@ -79,7 +80,7 @@ self.do_until(None, [self.less_than_two, self.greater_than_two], self.less_than_two) def test_missing_one (self): -"""Test thread step until - targeting one line and missing it.""" +"""Test thread step until - targeting one line and missing it by stepping out to call site""" self.do_until(["foo", "bar", "baz"], [self.less_than_two], self.back_out_in_main) Index: lldb/source/Commands/CommandObjectThread.cpp === --- lldb/source/Commands/CommandObjectThread.cpp +++ lldb/source/Commands/CommandObjectThread.cpp @@ -1034,11 +1034,21 @@ line_table->FindLineEntryByAddress(fun_end_addr, function_start, &end_ptr); +// Since not all source lines will contribute code, check if we are +// setting the breakpoint on the exact line number or the nearest +// subsequent line number and set breakpoints at all the line table +// entries of the chosen line number (exact or nearest subsequent). for (uint32_t line_number : line_numbers) { + LineEntry line_entry; + bool exact = false; uint32_t start_idx_ptr = index_ptr; + start_idx_ptr = sc.comp_unit->FindLineEntry( + index_ptr, line_number, nullptr, exact, &line_entry); + if (start_idx_ptr != UINT32_MAX) +line_number = line_entry.line; + exact = true; + start_idx_ptr = index_ptr; while (start_idx_ptr <= end_ptr) { -LineEntry line_entry; -const bool exact = false; start_idx_ptr = sc.comp_unit->FindLineEntry( start_idx_ptr, line_number, nullptr, exact, &line_entry); if (start_idx_ptr == UINT32_MAX) Index: lldb/test/API/functionalities/thread/step_until/TestStepUntil.py === --- lldb/test/API/functionalities/thread/step_until/TestStepUntil.py +++ lldb/test/API/functionalities/thread/step_until/TestStepUntil.py @@ -21,7 +21,7 @@ self.greater_than_two = line_number('main.c', 'Greater than or equal to 2.') self.back_out_in_main = line_number('main.c', 'Back out in main') -def do_until (self, args, until_lines, expected_linenum): +def common_setup (self, args): self.build() exe = self.getBuildArtifact("a.out") @@ -50,7 +50,8 @@ thread = threads[0] return thread -thread = self.common_setup(None) +def do_until (self, args, until_lines, expected_linenum): +thread = self.common_setup(args) cmd_interp = self.dbg.GetCommandInterpreter() ret_obj = lldb.SBCommandReturnObject() @@ -79,7 +80,7 @@ self.do_until(None, [self.less_than_two, self.greater_than_two], self.less_than_two) def test_missing_one (self): -"""Test thread step until - targeting one line and missing it.""" +"""Test thread step until - targeting one line and missing it by stepping out to call site""" self.do_until(["foo", "bar", "baz"], [self.less_than_t
[Lldb-commits] [lldb] 8eed95c - Adapt IRForTarget::RewriteObjCSelector() for D126689.
Author: Adrian Prantl Date: 2022-06-02T11:42:28-07:00 New Revision: 8eed95c83ecd0e42eaaca4f6591faafa4dad0d88 URL: https://github.com/llvm/llvm-project/commit/8eed95c83ecd0e42eaaca4f6591faafa4dad0d88 DIFF: https://github.com/llvm/llvm-project/commit/8eed95c83ecd0e42eaaca4f6591faafa4dad0d88.diff LOG: Adapt IRForTarget::RewriteObjCSelector() for D126689. With opaque pointers, the LLVM IR expected by this function changed. Added: Modified: lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Removed: diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 60fe84035a5b7..bd30ab546d4b8 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -758,17 +758,16 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) { // Unpack the message name from the selector. In LLVM IR, an objc_msgSend // gets represented as // - // %tmp = load i8** @"OBJC_SELECTOR_REFERENCES_" ; %call= call - // i8* (i8*, i8*, ...)* @objc_msgSend(i8* %obj, i8* %tmp, ...) ; + // %sel = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 8 + // call i8 @objc_msgSend(ptr %obj, ptr %sel, ...) // - // where %obj is the object pointer and %tmp is the selector. + // where %obj is the object pointer and %sel is the selector. // // @"OBJC_SELECTOR_REFERENCES_" is a pointer to a character array called // @"\01L_OBJC_llvm_moduleETH_VAR_NAllvm_moduleE_". // @"\01L_OBJC_llvm_moduleETH_VAR_NAllvm_moduleE_" contains the string. - // Find the pointer's initializer (a ConstantExpr with opcode GetElementPtr) - // and get the string from its target + // Find the pointer's initializer and get the string from its target. GlobalVariable *_objc_selector_references_ = dyn_cast(load->getPointerOperand()); @@ -778,22 +777,13 @@ bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) { return false; Constant *osr_initializer = _objc_selector_references_->getInitializer(); - - ConstantExpr *osr_initializer_expr = dyn_cast(osr_initializer); - - if (!osr_initializer_expr || - osr_initializer_expr->getOpcode() != Instruction::GetElementPtr) -return false; - - Value *osr_initializer_base = osr_initializer_expr->getOperand(0); - - if (!osr_initializer_base) + if (!osr_initializer) return false; // Find the string's initializer (a ConstantArray) and get the string from it GlobalVariable *_objc_meth_var_name_ = - dyn_cast(osr_initializer_base); + dyn_cast(osr_initializer); if (!_objc_meth_var_name_ || !_objc_meth_var_name_->hasInitializer()) return false; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e7b929d - Adapt IRForTarget::RewriteObjCConstStrings() for D126689.
Author: Adrian Prantl Date: 2022-06-02T13:06:40-07:00 New Revision: e7b929d756504c70d3ab0d0ba82f28eec7f7b363 URL: https://github.com/llvm/llvm-project/commit/e7b929d756504c70d3ab0d0ba82f28eec7f7b363 DIFF: https://github.com/llvm/llvm-project/commit/e7b929d756504c70d3ab0d0ba82f28eec7f7b363.diff LOG: Adapt IRForTarget::RewriteObjCConstStrings() for D126689. With opaque pointers, the LLVM IR expected by this function changed. Added: Modified: lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Removed: diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index bd30ab546d4b..1cfa2b8742a6 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -615,29 +615,7 @@ bool IRForTarget::RewriteObjCConstStrings() { return false; } - ConstantExpr *nsstring_expr = dyn_cast(nsstring_member); - - if (!nsstring_expr) { -LLDB_LOG(log, - "NSString initializer's str element is not a ConstantExpr"); - -m_error_stream.Printf("Internal error [IRForTarget]: An Objective-C " - "constant string's string initializer is not " - "constant\n"); - -return false; - } - - GlobalVariable *cstr_global = nullptr; - - if (nsstring_expr->getOpcode() == Instruction::GetElementPtr) { -Constant *nsstring_cstr = nsstring_expr->getOperand(0); -cstr_global = dyn_cast(nsstring_cstr); - } else if (nsstring_expr->getOpcode() == Instruction::BitCast) { -Constant *nsstring_cstr = nsstring_expr->getOperand(0); -cstr_global = dyn_cast(nsstring_cstr); - } - + auto *cstr_global = dyn_cast(nsstring_member); if (!cstr_global) { LLDB_LOG(log, "NSString initializer's str element is not a GlobalVariable"); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D48865: [LLDB] CommandObjectThreadUntil::DoExecute() sets the wrong selected thread ID
RamNalamothu updated this revision to Diff 433966. RamNalamothu added a comment. Herald added a project: LLDB. Went ahead and added the error capturing for setting incorrect thread id and also the fix. Without the following change/fix diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 04457b232f3b..11affe8a7c13 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -1095,8 +1095,7 @@ protected: return false; } - if (!process->GetThreadList().SetSelectedThreadByID( - m_options.m_thread_idx)) { + if (!process->GetThreadList().SetSelectedThreadByID(thread->GetID())) { result.AppendErrorWithFormat( "Failed to set the selected thread to thread id %" PRIu64 ".\n", thread->GetID()); the `lldb/test/API/commands/expression/formatters/TestFormatters.py:228: self.runCmd("thread until " + str(ret))` test would fail. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D48865/new/ https://reviews.llvm.org/D48865 Files: lldb/source/Commands/CommandObjectThread.cpp Index: lldb/source/Commands/CommandObjectThread.cpp === --- lldb/source/Commands/CommandObjectThread.cpp +++ lldb/source/Commands/CommandObjectThread.cpp @@ -984,8 +984,8 @@ thread->GetStackFrameAtIndex(m_options.m_frame_idx).get(); if (frame == nullptr) { result.AppendErrorWithFormat( -"Frame index %u is out of range for thread %u.\n", -m_options.m_frame_idx, m_options.m_thread_idx); +"Frame index %u is out of range for thread id %" PRIu64 ".\n", +m_options.m_frame_idx, thread->GetID()); return false; } @@ -1002,9 +1002,8 @@ if (line_table == nullptr) { result.AppendErrorWithFormat("Failed to resolve the line table for " - "frame %u of thread index %u.\n", - m_options.m_frame_idx, - m_options.m_thread_idx); + "frame %u of thread id %" PRIu64 ".\n", + m_options.m_frame_idx, thread->GetID()); return false; } @@ -1090,13 +1089,18 @@ return false; } } else { -result.AppendErrorWithFormat( -"Frame index %u of thread %u has no debug information.\n", -m_options.m_frame_idx, m_options.m_thread_idx); +result.AppendErrorWithFormat("Frame index %u of thread id %" PRIu64 + " has no debug information.\n", + m_options.m_frame_idx, thread->GetID()); return false; } - process->GetThreadList().SetSelectedThreadByID(m_options.m_thread_idx); + if (!process->GetThreadList().SetSelectedThreadByID(thread->GetID())) { +result.AppendErrorWithFormat( +"Failed to set the selected thread to thread id %" PRIu64 ".\n", +thread->GetID()); +return false; + } StreamString stream; Status error; Index: lldb/source/Commands/CommandObjectThread.cpp === --- lldb/source/Commands/CommandObjectThread.cpp +++ lldb/source/Commands/CommandObjectThread.cpp @@ -984,8 +984,8 @@ thread->GetStackFrameAtIndex(m_options.m_frame_idx).get(); if (frame == nullptr) { result.AppendErrorWithFormat( -"Frame index %u is out of range for thread %u.\n", -m_options.m_frame_idx, m_options.m_thread_idx); +"Frame index %u is out of range for thread id %" PRIu64 ".\n", +m_options.m_frame_idx, thread->GetID()); return false; } @@ -1002,9 +1002,8 @@ if (line_table == nullptr) { result.AppendErrorWithFormat("Failed to resolve the line table for " - "frame %u of thread index %u.\n", - m_options.m_frame_idx, - m_options.m_thread_idx); + "frame %u of thread id %" PRIu64 ".\n", + m_options.m_frame_idx, thread->GetID()); return false; } @@ -1090,13 +1089,18 @@ return false; } } else { -result.AppendErrorWithFormat( -"Frame index %u of thread %u has no debug information.\n", -m_options.m_frame_idx, m_options.m_thread_idx); +result.AppendErrorWithFormat("Frame index %u of thread id %" PRIu64 + " has no debug information.\n", + m_optio