[Lldb-commits] [lldb] 8941f89 - [lldb] Transfer some environment variables into the tests on Windows build host (#115613)
Author: Dmitry Vasilyev Date: 2024-11-11T18:14:22+04:00 New Revision: 8941f898f1921857720034b9a0950e4ec32d5d87 URL: https://github.com/llvm/llvm-project/commit/8941f898f1921857720034b9a0950e4ec32d5d87 DIFF: https://github.com/llvm/llvm-project/commit/8941f898f1921857720034b9a0950e4ec32d5d87.diff LOG: [lldb] Transfer some environment variables into the tests on Windows build host (#115613) Some API tests (compiler calls) create a lot of garbage and cause unexpected behavior in case of Windows host and Linux target, e.g. ``` lldb/test/API/commands/process/attach/%SystemDrive%/ lldb/test/API/functionalities/deleted-executable/%SystemDrive%/ lldb/test/API/functionalities/exec/%SystemDrive%/ lldb/test/API/functionalities/load_unload/%SystemDrive%/ lldb/test/API/functionalities/target-new-solib-notifications/%SystemDrive%/ lldb/test/API/functionalities/thread/create_after_attach/%SystemDrive%/ ``` It can be fixed by transfer some standard Windows environment variables into API tests. Added: Modified: lldb/test/API/lit.cfg.py Removed: diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py index 6ef09f36a1907e..06c685ebc3f5a5 100644 --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -334,3 +334,9 @@ def delete_module_cache(path): # Propagate XDG_CACHE_HOME if "XDG_CACHE_HOME" in os.environ: config.environment["XDG_CACHE_HOME"] = os.environ["XDG_CACHE_HOME"] + +# Transfer some environment variables into the tests on Windows build host. +if platform.system() == "Windows": +for v in ["SystemDrive"]: +if v in os.environ: +config.environment[v] = os.environ[v] ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Transfer some environment variables into the tests on Windows build host (PR #115613)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/115613 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix inline_sites_live.cpp Shell test on Linux remote (PR #115722)
https://github.com/dzhidzhoev created https://github.com/llvm/llvm-project/pull/115722 Test fails on https://lab.llvm.org/staging/#/builders/197/builds/76 because of a little difference in format of output. >From 3cf79d9bb129005fce07a9b7b5f651971e08579b Mon Sep 17 00:00:00 2001 From: Vladislav Dzhidzhoev Date: Mon, 11 Nov 2024 15:46:51 +0100 Subject: [PATCH] [lldb][test] Fix inline_sites_live.cpp Shell test on Linux remote Test fails on https://lab.llvm.org/staging/#/builders/197/builds/76 because of a little difference in format of output. --- lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp index df6353e28303a3..549bc881b19bb7 100644 --- a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp +++ b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp @@ -22,11 +22,11 @@ int main(int argc, char** argv) { foo(argc); } -// CHECK: * thread #1, stop reason = breakpoint 1 +// CHECK: * thread #1, {{.*}}stop reason = breakpoint 1 // CHECK-NEXT:frame #0: {{.*}}`main [inlined] bar(param=2) // CHECK: (lldb) expression param // CHECK-NEXT: (int) $0 = 2 -// CHECK: * thread #1, stop reason = breakpoint 2 +// CHECK: * thread #1, {{.*}}stop reason = breakpoint 2 // CHECK-NEXT:frame #0: {{.*}}`main [inlined] foo(param=1) // CHECK: (lldb) expression param // CHECK-NEXT: (int) $1 = 1 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix inline_sites_live.cpp Shell test on Linux remote (PR #115722)
https://github.com/dzhidzhoev edited https://github.com/llvm/llvm-project/pull/115722 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix inline_sites_live.cpp Shell test on Linux remote (PR #115722)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Vladislav Dzhidzhoev (dzhidzhoev) Changes Test fails on https://lab.llvm.org/staging/#/builders/197/builds/76 because of a little difference in format of output. --- Full diff: https://github.com/llvm/llvm-project/pull/115722.diff 1 Files Affected: - (modified) lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp (+2-2) ``diff diff --git a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp index df6353e28303a3..549bc881b19bb7 100644 --- a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp +++ b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp @@ -22,11 +22,11 @@ int main(int argc, char** argv) { foo(argc); } -// CHECK: * thread #1, stop reason = breakpoint 1 +// CHECK: * thread #1, {{.*}}stop reason = breakpoint 1 // CHECK-NEXT:frame #0: {{.*}}`main [inlined] bar(param=2) // CHECK: (lldb) expression param // CHECK-NEXT: (int) $0 = 2 -// CHECK: * thread #1, stop reason = breakpoint 2 +// CHECK: * thread #1, {{.*}}stop reason = breakpoint 2 // CHECK-NEXT:frame #0: {{.*}}`main [inlined] foo(param=1) // CHECK: (lldb) expression param // CHECK-NEXT: (int) $1 = 1 `` https://github.com/llvm/llvm-project/pull/115722 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] (Begin to) support discontinuous lldb_private::Functions (PR #115730)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Pavel Labath (labath) Changes This is the beginning of a different, more fundamental approach to handling. This PR tries to tries to minimize functional changes. It only makes sure that we store the true set of ranges inside the function object, so that subsequent patches can make use of it. --- Full diff: https://github.com/llvm/llvm-project/pull/115730.diff 11 Files Affected: - (modified) lldb/include/lldb/Symbol/Function.h (+6-2) - (modified) lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp (+1-1) - (modified) lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp (+1-1) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h (+1-1) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (+9-11) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h (+1-1) - (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+11-22) - (modified) lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp (+1-1) - (modified) lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (+3-3) - (modified) lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (+1-1) - (modified) lldb/source/Symbol/Function.cpp (+29-10) ``diff diff --git a/lldb/include/lldb/Symbol/Function.h b/lldb/include/lldb/Symbol/Function.h index 8255c2baea7700..bbfc25fe74ea06 100644 --- a/lldb/include/lldb/Symbol/Function.h +++ b/lldb/include/lldb/Symbol/Function.h @@ -428,7 +428,7 @@ class Function : public UserID, public SymbolContextScope { /// The section offset based address for this function. Function(CompileUnit *comp_unit, lldb::user_id_t func_uid, lldb::user_id_t func_type_uid, const Mangled &mangled, - Type *func_type, const AddressRange &range); + Type *func_type, AddressRanges ranges); /// Destructor. ~Function() override; @@ -649,8 +649,12 @@ class Function : public UserID, public SymbolContextScope { /// All lexical blocks contained in this function. Block m_block; + /// List of address ranges belonging to the function. + AddressRanges m_ranges; + /// The function address range that covers the widest range needed to contain - /// all blocks + /// all blocks. DEPRECATED: do not use this field in new code as the range may + /// include addresses belonging to other functions. AddressRange m_range; /// The frame base expression for variables that are relative to the frame diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp index 9e78ba8174e3d5..fadc19676609bf 100644 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -255,7 +255,7 @@ FunctionSP SymbolFileBreakpad::GetOrCreateFunction(CompileUnit &comp_unit) { section_sp, address - section_sp->GetFileAddress(), record->Size); // Use the CU's id because every CU has only one function inside. func_sp = std::make_shared(&comp_unit, id, 0, func_name, - nullptr, func_range); + nullptr, AddressRanges{func_range}); comp_unit.AddFunction(func_sp); } } diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp index bb738c3dcc54a0..15e8d38e7f334b 100644 --- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp +++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp @@ -829,7 +829,7 @@ size_t SymbolFileCTF::ParseFunctions(CompileUnit &cu) { lldb::user_id_t func_uid = m_functions.size(); FunctionSP function_sp = std::make_shared( &cu, func_uid, function_type_uid, symbol->GetMangled(), type_sp.get(), - func_range); + AddressRanges{func_range}); m_functions.emplace_back(function_sp); cu.AddFunction(function_sp); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h index 971cbe47fb702d..80f7becc1b24ba 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h @@ -42,7 +42,7 @@ class DWARFASTParser { virtual Function *ParseFunctionFromDWARF(CompileUnit &comp_unit, const DWARFDIE &die, - const AddressRange &range) = 0; + AddressRanges ranges) = 0; virtual bool CompleteTypeFromDWARF(const DWARFDIE &die, Type *type, const CompilerType &compiler_type) = 0; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index a30d898a93cc4d..66b9013de34179 100644 -
[Lldb-commits] [lldb] [lldb] (Begin to) support discontinuous lldb_private::Functions (PR #115730)
https://github.com/labath created https://github.com/llvm/llvm-project/pull/115730 This is the beginning of a different, more fundamental approach to handling. This PR tries to tries to minimize functional changes. It only makes sure that we store the true set of ranges inside the function object, so that subsequent patches can make use of it. >From 39a29e37cfcd3d581c488605959c9a7c9ada5d69 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 11 Nov 2024 16:49:38 +0100 Subject: [PATCH] [lldb] (Begin to) support discontinuous lldb_private::Functions This is the beginning of a different, more fundamental approach to handling. This PR tries to tries to minimize functional changes. It only makes sure that we store the true set of ranges inside the function object, so that subsequent patches can make use of it. --- lldb/include/lldb/Symbol/Function.h | 8 +++- .../Breakpad/SymbolFileBreakpad.cpp | 2 +- .../Plugins/SymbolFile/CTF/SymbolFileCTF.cpp | 2 +- .../Plugins/SymbolFile/DWARF/DWARFASTParser.h | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 20 +- .../SymbolFile/DWARF/DWARFASTParserClang.h| 2 +- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 33 ++-- .../NativePDB/SymbolFileNativePDB.cpp | 2 +- .../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp | 6 +-- .../SymbolFile/Symtab/SymbolFileSymtab.cpp| 2 +- lldb/source/Symbol/Function.cpp | 39 ++- 11 files changed, 64 insertions(+), 54 deletions(-) diff --git a/lldb/include/lldb/Symbol/Function.h b/lldb/include/lldb/Symbol/Function.h index 8255c2baea7700..bbfc25fe74ea06 100644 --- a/lldb/include/lldb/Symbol/Function.h +++ b/lldb/include/lldb/Symbol/Function.h @@ -428,7 +428,7 @@ class Function : public UserID, public SymbolContextScope { /// The section offset based address for this function. Function(CompileUnit *comp_unit, lldb::user_id_t func_uid, lldb::user_id_t func_type_uid, const Mangled &mangled, - Type *func_type, const AddressRange &range); + Type *func_type, AddressRanges ranges); /// Destructor. ~Function() override; @@ -649,8 +649,12 @@ class Function : public UserID, public SymbolContextScope { /// All lexical blocks contained in this function. Block m_block; + /// List of address ranges belonging to the function. + AddressRanges m_ranges; + /// The function address range that covers the widest range needed to contain - /// all blocks + /// all blocks. DEPRECATED: do not use this field in new code as the range may + /// include addresses belonging to other functions. AddressRange m_range; /// The frame base expression for variables that are relative to the frame diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp index 9e78ba8174e3d5..fadc19676609bf 100644 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -255,7 +255,7 @@ FunctionSP SymbolFileBreakpad::GetOrCreateFunction(CompileUnit &comp_unit) { section_sp, address - section_sp->GetFileAddress(), record->Size); // Use the CU's id because every CU has only one function inside. func_sp = std::make_shared(&comp_unit, id, 0, func_name, - nullptr, func_range); + nullptr, AddressRanges{func_range}); comp_unit.AddFunction(func_sp); } } diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp index bb738c3dcc54a0..15e8d38e7f334b 100644 --- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp +++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp @@ -829,7 +829,7 @@ size_t SymbolFileCTF::ParseFunctions(CompileUnit &cu) { lldb::user_id_t func_uid = m_functions.size(); FunctionSP function_sp = std::make_shared( &cu, func_uid, function_type_uid, symbol->GetMangled(), type_sp.get(), - func_range); + AddressRanges{func_range}); m_functions.emplace_back(function_sp); cu.AddFunction(function_sp); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h index 971cbe47fb702d..80f7becc1b24ba 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h @@ -42,7 +42,7 @@ class DWARFASTParser { virtual Function *ParseFunctionFromDWARF(CompileUnit &comp_unit, const DWARFDIE &die, - const AddressRange &range) = 0; + AddressRanges ranges) = 0; virtual bool CompleteTypeFromDWARF(const DWARFDIE &die, Type *type,
[Lldb-commits] [lldb] [lldb][AIX] Added Ptrace extensions for AIX (PR #108000)
DhruvSrivastavaX wrote: Ok Sure, Got it. Will Proceed accordingly then. Thanks! https://github.com/llvm/llvm-project/pull/108000 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Improve locking in PathMappingLists (NFC) (PR #114576)
@@ -264,34 +288,35 @@ PathMappingList::FindFile(const FileSpec &orig_spec) const { bool PathMappingList::Replace(llvm::StringRef path, llvm::StringRef new_path, bool notify) { - std::lock_guard lock(m_mutex); - uint32_t idx = FindIndexForPath(path); - if (idx < m_pairs.size()) { + { +std::lock_guard lock(m_pairs_mutex); +uint32_t idx = FindIndexForPath(path); JDevlieghere wrote: Yup, I fixed the issue in the re-land. @kastiglione confirmed offline that that fixed the deadlock he observed. https://github.com/llvm/llvm-project/pull/114576 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)
jimingham wrote: My notion was that when you push a plan that has an intention to run in a direction, if the plan above it on the stack was going in the opposite direction, it has to be popped. But plans that don't have an intention don't change the stack above them. https://github.com/llvm/llvm-project/pull/112079 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)
rocallahan wrote: > My notion was that when you push a plan that has an intention to run in a > direction, if the plan above it on the stack was going in the opposite > direction, it has to be popped. That's in the current code in this PR but I agree that was the wrong direction. My experimental [reverse-continue-thread-plan](https://github.com/rocallahan/llvm-project/tree/reverse-continue-thread-plan) branch doesn't do this. > After all, you might be doing a backwards direction next, but hit a > breakpoint while doing that. You then want to step FORWARDS from that > breakpoint to check something out. Right. > Then if stepping backwards and forwards were working like lldb stepping > currently works, you'd expect "continue" to return control to the backwards > next to finish out the operation. There's a UX issue here: in the scenario you describe (hit breakpoint during reverse-next, step forward, continue) *should* the reverse-step be resumed? Personally I think not. I think it's very confusing if "continue" ever causes reverse execution (and likewise if "reverse-continue" ever causes forward execution). So in this case I would say "reverse-continue" should resume the reverse-next but "continue" should pop it. This is helpful discussion but it doesn't directly address my question in https://github.com/llvm/llvm-project/pull/112079#issuecomment-2468857787. Can we focus on that? https://github.com/llvm/llvm-project/pull/112079 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)
jimingham wrote: I also think in the long run we need a more flexible procedure. After all, you might be doing a backwards direction next, but hit a breakpoint while doing that. You then want to step FORWARDS from that breakpoint to check something out. Then if stepping backwards and forwards were working like lldb stepping currently works, you'd expect "continue" to return control to the backwards next to finish out the operation. So I don't think in the long run we should be kicking all backwards plans off the stack when we start to go forwards. I think instead we should use the IsPlanStale mechanism to tell when a backwards plan can no longer do its job. https://github.com/llvm/llvm-project/pull/112079 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)
jimingham wrote: That would require that the thread wouldn't have a direction itself, but the direction would be governed by whoever explained the stop and set up the next phase of execution. Since all the threads need to work in lock step, that probably means that `thread step-over --direction ` needs to not only push a "thread plan step-over" with the right direction on the current thread, but all the other threads get a "thread plan go in a direction" plan that coordinates with the plan that's moving the process along about when it should be done. That's linking the thread plans from different threads, which we haven't much done yet, but I think that's better than trying to hold some state outside the thread plan stack and some in it. https://github.com/llvm/llvm-project/pull/112079 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Infer MSInheritanceAttr for CXXRecordDecl with DWARF on Windows (PR #115177)
https://github.com/ZequanWu approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/115177 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Infer MSInheritanceAttr for CXXRecordDecl with DWARF on Windows (PR #115177)
Michael137 wrote: Btw @weliveindetail , the `TestDAP_evaluate.py` test failure happens on other PRs too. So I think this is safe to merge. https://github.com/llvm/llvm-project/pull/115177 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support true/false in ValueObject::SetValueFromCString (PR #115780)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/115780 Support "true" and "false" (and "YES" and "NO" in Objective-C) in ValueObject::SetValueFromCString. Fixes #112597 >From 3450bca62abbc0e9595b61f663114cd67927ffaf Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 11 Nov 2024 14:17:17 -0800 Subject: [PATCH] [lldb] Support true/false in ValueObject::SetValueFromCString Support "true" and "false" (and "YES" and "NO" in Objective-C) in ValueObject::SetValueFromCString. Fixes #112597 --- lldb/include/lldb/Target/Language.h | 4 +++- .../Plugins/Language/ObjC/ObjCLanguage.cpp | 8 .../source/Plugins/Language/ObjC/ObjCLanguage.h | 3 +++ .../ObjCPlusPlus/ObjCPlusPlusLanguage.cpp | 8 .../ObjCPlusPlus/ObjCPlusPlusLanguage.h | 3 +++ lldb/source/Target/Language.cpp | 8 lldb/source/ValueObject/ValueObject.cpp | 15 +++ .../data-formatter/setvaluefromcstring/main.m | 7 ++- .../value/change_values/TestChangeValueAPI.py | 17 +++-- .../API/python_api/value/change_values/main.c | 15 +-- 10 files changed, 78 insertions(+), 10 deletions(-) diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index c9cddee6baa2da..38ca458159edc7 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -245,7 +245,7 @@ class Language : public PluginInterface { // a match. But we wouldn't want this to match AnotherA::my_function. The // user is specifying a truncated path, not a truncated set of characters. // This function does a language-aware comparison for those purposes. - virtual bool DemangledNameContainsPath(llvm::StringRef path, + virtual bool DemangledNameContainsPath(llvm::StringRef path, ConstString demangled) const; // if a language has a custom format for printing variable declarations that @@ -372,6 +372,8 @@ class Language : public PluginInterface { return {}; } + virtual std::optional GetBooleanFromString(llvm::StringRef str) const; + /// Returns true if this Language supports exception breakpoints on throw via /// a corresponding LanguageRuntime plugin. virtual bool SupportsExceptionBreakpointsOnThrow() const { return false; } diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp index b44971e36c6d0e..2ae203405cbba0 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -1040,3 +1040,11 @@ bool ObjCLanguage::IsSourceFile(llvm::StringRef file_path) const { } return false; } + +std::optional +ObjCLanguage::GetBooleanFromString(llvm::StringRef str) const { + return llvm::StringSwitch>(str) + .Case("YES", {true}) + .Case("NO", {false}) + .Default({}); +} diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h index d9c0cd3c18cfa1..6d265a9be52771 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h @@ -194,6 +194,9 @@ class ObjCLanguage : public Language { llvm::StringRef GetInstanceVariableName() override { return "self"; } + virtual std::optional + GetBooleanFromString(llvm::StringRef str) const override; + bool SupportsExceptionBreakpointsOnThrow() const override { return true; } // PluginInterface protocol diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp index 79830e529df2d7..0489f4d6ada321 100644 --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp @@ -43,3 +43,11 @@ Language *ObjCPlusPlusLanguage::CreateInstance(lldb::LanguageType language) { return nullptr; } } + +std::optional +ObjCPlusPlusLanguage::GetBooleanFromString(llvm::StringRef str) const { + return llvm::StringSwitch>(str) + .Cases("true", "YES", {true}) + .Cases("false", "NO", {false}) + .Default({}); +} diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h index 1beab9348eb72e..229dffe8462e41 100644 --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h @@ -44,6 +44,9 @@ class ObjCPlusPlusLanguage : public Language { llvm::StringRef GetInstanceVariableName() override { return "self"; } + virtual std::optional + GetBooleanFromString(llvm::StringRef str) const override; + static llvm::StringRef GetPluginNameStatic() { return "objcplusplus"; } // PluginInterface protocol diff --git a/lldb/source/Target/Language.cpp b/lldb/s
[Lldb-commits] [lldb] [lldb] Support true/false in ValueObject::SetValueFromCString (PR #115780)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes Support "true" and "false" (and "YES" and "NO" in Objective-C) in ValueObject::SetValueFromCString. Fixes #112597 --- Full diff: https://github.com/llvm/llvm-project/pull/115780.diff 10 Files Affected: - (modified) lldb/include/lldb/Target/Language.h (+3-1) - (modified) lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp (+8) - (modified) lldb/source/Plugins/Language/ObjC/ObjCLanguage.h (+3) - (modified) lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp (+8) - (modified) lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h (+3) - (modified) lldb/source/Target/Language.cpp (+8) - (modified) lldb/source/ValueObject/ValueObject.cpp (+15) - (modified) lldb/test/API/functionalities/data-formatter/setvaluefromcstring/main.m (+6-1) - (modified) lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py (+15-2) - (modified) lldb/test/API/python_api/value/change_values/main.c (+9-6) ``diff diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index c9cddee6baa2da..38ca458159edc7 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -245,7 +245,7 @@ class Language : public PluginInterface { // a match. But we wouldn't want this to match AnotherA::my_function. The // user is specifying a truncated path, not a truncated set of characters. // This function does a language-aware comparison for those purposes. - virtual bool DemangledNameContainsPath(llvm::StringRef path, + virtual bool DemangledNameContainsPath(llvm::StringRef path, ConstString demangled) const; // if a language has a custom format for printing variable declarations that @@ -372,6 +372,8 @@ class Language : public PluginInterface { return {}; } + virtual std::optional GetBooleanFromString(llvm::StringRef str) const; + /// Returns true if this Language supports exception breakpoints on throw via /// a corresponding LanguageRuntime plugin. virtual bool SupportsExceptionBreakpointsOnThrow() const { return false; } diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp index b44971e36c6d0e..2ae203405cbba0 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -1040,3 +1040,11 @@ bool ObjCLanguage::IsSourceFile(llvm::StringRef file_path) const { } return false; } + +std::optional +ObjCLanguage::GetBooleanFromString(llvm::StringRef str) const { + return llvm::StringSwitch>(str) + .Case("YES", {true}) + .Case("NO", {false}) + .Default({}); +} diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h index d9c0cd3c18cfa1..6d265a9be52771 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h @@ -194,6 +194,9 @@ class ObjCLanguage : public Language { llvm::StringRef GetInstanceVariableName() override { return "self"; } + virtual std::optional + GetBooleanFromString(llvm::StringRef str) const override; + bool SupportsExceptionBreakpointsOnThrow() const override { return true; } // PluginInterface protocol diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp index 79830e529df2d7..0489f4d6ada321 100644 --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp @@ -43,3 +43,11 @@ Language *ObjCPlusPlusLanguage::CreateInstance(lldb::LanguageType language) { return nullptr; } } + +std::optional +ObjCPlusPlusLanguage::GetBooleanFromString(llvm::StringRef str) const { + return llvm::StringSwitch>(str) + .Cases("true", "YES", {true}) + .Cases("false", "NO", {false}) + .Default({}); +} diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h index 1beab9348eb72e..229dffe8462e41 100644 --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h @@ -44,6 +44,9 @@ class ObjCPlusPlusLanguage : public Language { llvm::StringRef GetInstanceVariableName() override { return "self"; } + virtual std::optional + GetBooleanFromString(llvm::StringRef str) const override; + static llvm::StringRef GetPluginNameStatic() { return "objcplusplus"; } // PluginInterface protocol diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp index d0bffe441f6395..a75894ffa4b3b6 100644 --- a/lldb/source/Target/Language.cpp +++ b/lldb/source/Target/Language.cpp @@ -528,6 +528,14 @@ void Lang
[Lldb-commits] [lldb] [lldb] Support true/false in ValueObject::SetValueFromCString (PR #115780)
@@ -2,10 +2,15 @@ int main() { NSDictionary* dic = @{@1 : @2}; +BOOL b = NO; NSLog(@"hello world"); //% dic = self.frame().FindVariable("dic") //% dic.SetPreferSyntheticValue(True) //% dic.SetPreferDynamicValue(lldb.eDynamicCanRunTarget) //% dic.SetValueFromCString("12") +//% b = self.frame().FindVariable("b") +//% b.SetValueFromCString("YES") return 0; //% dic = self.frame().FindVariable("dic") -//% self.assertTrue(dic.GetValueAsUnsigned() == 0xC, "failed to read what I wrote") +//% self.assertTrue(dic.GetValueAsUnsigned() == 0xC, "failed to read what I +//wrote") % b = self.frame().FindVariable("b") % bulbazord wrote: Is the formatting here correct? Looks like one line spans two. https://github.com/llvm/llvm-project/pull/115780 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support true/false in ValueObject::SetValueFromCString (PR #115780)
@@ -2,10 +2,15 @@ int main() { NSDictionary* dic = @{@1 : @2}; +BOOL b = NO; NSLog(@"hello world"); //% dic = self.frame().FindVariable("dic") //% dic.SetPreferSyntheticValue(True) //% dic.SetPreferDynamicValue(lldb.eDynamicCanRunTarget) //% dic.SetValueFromCString("12") +//% b = self.frame().FindVariable("b") +//% b.SetValueFromCString("YES") return 0; //% dic = self.frame().FindVariable("dic") -//% self.assertTrue(dic.GetValueAsUnsigned() == 0xC, "failed to read what I wrote") +//% self.assertTrue(dic.GetValueAsUnsigned() == 0xC, "failed to read what I +//wrote") % b = self.frame().FindVariable("b") % JDevlieghere wrote: I think `black` messed that up. Let me fix it and see what the tool says. https://github.com/llvm/llvm-project/pull/115780 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support true/false in ValueObject::SetValueFromCString (PR #115780)
https://github.com/JDevlieghere edited https://github.com/llvm/llvm-project/pull/115780 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support true/false in ValueObject::SetValueFromCString (PR #115780)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/115780 >From 3450bca62abbc0e9595b61f663114cd67927ffaf Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 11 Nov 2024 14:17:17 -0800 Subject: [PATCH 1/2] [lldb] Support true/false in ValueObject::SetValueFromCString Support "true" and "false" (and "YES" and "NO" in Objective-C) in ValueObject::SetValueFromCString. Fixes #112597 --- lldb/include/lldb/Target/Language.h | 4 +++- .../Plugins/Language/ObjC/ObjCLanguage.cpp | 8 .../source/Plugins/Language/ObjC/ObjCLanguage.h | 3 +++ .../ObjCPlusPlus/ObjCPlusPlusLanguage.cpp | 8 .../ObjCPlusPlus/ObjCPlusPlusLanguage.h | 3 +++ lldb/source/Target/Language.cpp | 8 lldb/source/ValueObject/ValueObject.cpp | 15 +++ .../data-formatter/setvaluefromcstring/main.m | 7 ++- .../value/change_values/TestChangeValueAPI.py | 17 +++-- .../API/python_api/value/change_values/main.c | 15 +-- 10 files changed, 78 insertions(+), 10 deletions(-) diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index c9cddee6baa2da..38ca458159edc7 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -245,7 +245,7 @@ class Language : public PluginInterface { // a match. But we wouldn't want this to match AnotherA::my_function. The // user is specifying a truncated path, not a truncated set of characters. // This function does a language-aware comparison for those purposes. - virtual bool DemangledNameContainsPath(llvm::StringRef path, + virtual bool DemangledNameContainsPath(llvm::StringRef path, ConstString demangled) const; // if a language has a custom format for printing variable declarations that @@ -372,6 +372,8 @@ class Language : public PluginInterface { return {}; } + virtual std::optional GetBooleanFromString(llvm::StringRef str) const; + /// Returns true if this Language supports exception breakpoints on throw via /// a corresponding LanguageRuntime plugin. virtual bool SupportsExceptionBreakpointsOnThrow() const { return false; } diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp index b44971e36c6d0e..2ae203405cbba0 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -1040,3 +1040,11 @@ bool ObjCLanguage::IsSourceFile(llvm::StringRef file_path) const { } return false; } + +std::optional +ObjCLanguage::GetBooleanFromString(llvm::StringRef str) const { + return llvm::StringSwitch>(str) + .Case("YES", {true}) + .Case("NO", {false}) + .Default({}); +} diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h index d9c0cd3c18cfa1..6d265a9be52771 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h @@ -194,6 +194,9 @@ class ObjCLanguage : public Language { llvm::StringRef GetInstanceVariableName() override { return "self"; } + virtual std::optional + GetBooleanFromString(llvm::StringRef str) const override; + bool SupportsExceptionBreakpointsOnThrow() const override { return true; } // PluginInterface protocol diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp index 79830e529df2d7..0489f4d6ada321 100644 --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp @@ -43,3 +43,11 @@ Language *ObjCPlusPlusLanguage::CreateInstance(lldb::LanguageType language) { return nullptr; } } + +std::optional +ObjCPlusPlusLanguage::GetBooleanFromString(llvm::StringRef str) const { + return llvm::StringSwitch>(str) + .Cases("true", "YES", {true}) + .Cases("false", "NO", {false}) + .Default({}); +} diff --git a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h index 1beab9348eb72e..229dffe8462e41 100644 --- a/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h +++ b/lldb/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h @@ -44,6 +44,9 @@ class ObjCPlusPlusLanguage : public Language { llvm::StringRef GetInstanceVariableName() override { return "self"; } + virtual std::optional + GetBooleanFromString(llvm::StringRef str) const override; + static llvm::StringRef GetPluginNameStatic() { return "objcplusplus"; } // PluginInterface protocol diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp index d0bffe441f6395..a75894ffa4b3b6 100644 --- a/lldb/source/Target/Language.cpp +++
[Lldb-commits] [lldb] [lldb] Support true/false in ValueObject::SetValueFromCString (PR #115780)
https://github.com/bulbazord approved this pull request. https://github.com/llvm/llvm-project/pull/115780 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)
jimingham wrote: > > My notion was that when you push a plan that has an intention to run in a > > direction, if the plan above it on the stack was going in the opposite > > direction, it has to be popped. > > That's in the current code in this PR but I agree that was the wrong > direction. My experimental > [reverse-continue-thread-plan](https://github.com/rocallahan/llvm-project/tree/reverse-continue-thread-plan) > branch doesn't do this. > > > After all, you might be doing a backwards direction next, but hit a > > breakpoint while doing that. You then want to step FORWARDS from that > > breakpoint to check something out. > > Right. > > > Then if stepping backwards and forwards were working like lldb stepping > > currently works, you'd expect "continue" to return control to the backwards > > next to finish out the operation. > > There's a UX issue here: in the scenario you describe (hit breakpoint during > reverse-next, step forward, continue) _should_ the reverse-step be resumed? > Personally I think not. I think it's very confusing if "continue" ever causes > reverse execution (and likewise if "reverse-continue" ever causes forward > execution). So in this case I would say "reverse-continue" should resume the > reverse-next but "continue" should pop it. I have to play around with a working version more to know. I worry that people in a situation like this where there's a pending task people will lose important state because they forgot that "continue" doesn't mean "continue what I was doing" - which is what it currently means in lldb - but instead means "continue what I was doing if it happens to be going forwards". Not sure how to weigh the surprise of that vrs. the surprise of "continue" continuing backwards. > > This is helpful discussion but it doesn't directly address my question in > [#112079 > (comment)](https://github.com/llvm/llvm-project/pull/112079#issuecomment-2468857787). > Can we focus on that? So first off, I think ultimately I'm arguing against requiring: "we either have all forward or all backwards plans on any given thread plan stack" because I don't think that is flexible enough to support all the use cases we want to support. But I thought I was giving a suggestion for your previous problem. IIUC, when you go to push a plan onto the plan stack you want to say "if this is a forward going plan, remove all the backwards going plans from the stack when you push it" and ditto for adding backwards going plans. I was suggesting separating the actual direction a plan says the thread should go when it resumes from whether it is a "forward or backwards going plan" for the purposes of thread plan stack management. Then I was suggesting adding to the latter determinant the ability to say a plan doesn't have an opinion about the current forwards or backwards state of the current thread plan stack. So for instance, if you are reverse continuing, and stop at a breakpoint with a condition, the ThreadPlanCallFunction that you push would have "no opinion" about the overall forwards or backwards state of the current plan stack. So it wouldn't require either forward or backwards going plans to be removed from the stack. For this to work, we would have to require that all "no opinion" plans run only their thread. For condition expressions that should be good enough for most uses, and I don't know what it would mean to run the other threads anyway. So in your specific case, you would stop at the breakpoint, and push the "no opinion" ThreadPlanCallFunction to handle the condition. When we check whether we need to pop the reverse continue plan from the stack on pushing this new function call plan, we would say "ah, that plan has no opinion, so we can just push it on the stack." Then when we go to resume, we see that there's a "run me only" thread plan among the threads, and like we always do we run that one first (if there's more than one we run them all round robin till all the run me plans are done). But when we go to restart that thread we ask for the "actual" not the "nominal" direction, which for the call function thread plan is "forward". Then when that call function thread plan is done, we pop it off the stack and check the result to see if the condition failed or succeeded. If it fails then you can just resume going whatever direction the youngest plan on the stack says to, without changing the plan stacks at all. But if it says stop, then we pass control to the next up plan on the stack to figure out what to do with the stop. You might be doing a fancy reverse continue plan that is doing something like "when I hit this breakpoint and pass this condition, do two more `next`-s and then stop". Am I missing something? https://github.com/llvm/llvm-project/pull/112079 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list
[Lldb-commits] [lldb] [LLDB] Add framework for Data Inspection Language (DIL) work. (PR #115666)
jimingham wrote: IIUC, the goal is that In the end, DIL will win and there will only be one VariableExpressionPath interface lldb. So it seems inefficient for the interim stage to introduce another function and switch between them with UseDIL all over the code. Why not leave GetValueForVariableExpressionPath for now, and move the `if (UseDIL())` into that function. They have the same signature, and you'll always be able to find the target from the ValueObject when you are in GetValueForVariableExpressionPath, so that should be possible. That will make the diff much smaller, and in the end mean that pulling the switch to use only the DIL will be less disruptive. https://github.com/llvm/llvm-project/pull/115666 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f109517 - [lldb] Support overriding the disassembly CPU & features (#115382)
Author: Jonas Devlieghere Date: 2024-11-11T16:27:15-08:00 New Revision: f109517d153609d4a8a3a3d3d3cc06da1b629364 URL: https://github.com/llvm/llvm-project/commit/f109517d153609d4a8a3a3d3d3cc06da1b629364 DIFF: https://github.com/llvm/llvm-project/commit/f109517d153609d4a8a3a3d3d3cc06da1b629364.diff LOG: [lldb] Support overriding the disassembly CPU & features (#115382) Add the ability to override the disassembly CPU and CPU features through a target setting (`target.disassembly-cpu` and `target.disassembly-features`) and a `disassemble` command option (`--cpu` and `--features`). This is especially relevant for architectures like RISC-V which relies heavily on CPU extensions. The majority of this patch is plumbing the options through. I recommend looking at DisassemblerLLVMC and the test for the observable change in behavior. Added: lldb/test/Shell/Commands/command-disassemble-cpu-features.yaml Modified: lldb/include/lldb/Core/Disassembler.h lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h lldb/include/lldb/Target/Target.h lldb/include/lldb/lldb-enumerations.h lldb/include/lldb/lldb-private-interfaces.h lldb/source/API/SBFunction.cpp lldb/source/API/SBSymbol.cpp lldb/source/API/SBTarget.cpp lldb/source/Commands/CommandObjectDisassemble.cpp lldb/source/Commands/CommandObjectDisassemble.h lldb/source/Commands/Options.td lldb/source/Core/Disassembler.cpp lldb/source/Core/DumpDataExtractor.cpp lldb/source/Expression/IRExecutionUnit.cpp lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp lldb/source/Symbol/Function.cpp lldb/source/Symbol/Symbol.cpp lldb/source/Target/Process.cpp lldb/source/Target/StackFrame.cpp lldb/source/Target/Target.cpp lldb/source/Target/TargetProperties.td lldb/source/Target/ThreadPlanStepRange.cpp lldb/source/Target/ThreadPlanTracer.cpp lldb/source/Target/TraceDumper.cpp lldb/unittests/Disassembler/ARM/TestArm64Disassembly.cpp lldb/unittests/Disassembler/ARM/TestArmv7Disassembly.cpp lldb/unittests/Disassembler/RISCV/TestMCDisasmInstanceRISCV.cpp lldb/unittests/Disassembler/x86/TestGetControlFlowKindx86.cpp Removed: diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h index 21969aed03c209..e0ad4316e02497 100644 --- a/lldb/include/lldb/Core/Disassembler.h +++ b/lldb/include/lldb/Core/Disassembler.h @@ -409,35 +409,37 @@ class Disassembler : public std::enable_shared_from_this, // flavor string gets set wrong. Instead, if you get a flavor string you // don't understand, use the default. Folks who care to check can use the // FlavorValidForArchSpec method on the disassembler they got back. - static lldb::DisassemblerSP - FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name); + static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch, + const char *flavor, const char *cpu, + const char *features, + const char *plugin_name); // This version will use the value in the Target settings if flavor is NULL; - static lldb::DisassemblerSP FindPluginForTarget(const Target &target, - const ArchSpec &arch, - const char *flavor, - const char *plugin_name); + static lldb::DisassemblerSP + FindPluginForTarget(const Target &target, const ArchSpec &arch, + const char *flavor, const char *cpu, const char *features, + const char *plugin_name); struct Limit { enum { Bytes, Instructions } kind; lldb::addr_t value; }; - static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch, - const char *plugin_name, - const char *flavor, - Target &target, - const AddressRange &disasm_range, - bool force_live_memory = false); + static lldb::DisassemblerSP + DisassembleRange(const ArchSpec &arch, const char *plugin_name, + const char *flavor, const char *cpu, const char *features, + Target &target, const AddressRange &disasm_range, + bool force
[Lldb-commits] [lldb] [lldb] Support overriding the disassembly CPU & features (PR #115382)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/115382 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix remote Shell tests failures on Windows host (PR #115716)
https://github.com/dzhidzhoev updated https://github.com/llvm/llvm-project/pull/115716 >From 306cf0dd5a6ccb80a1ec530b1753f6fa8d538715 Mon Sep 17 00:00:00 2001 From: Vladislav Dzhidzhoev Date: Thu, 29 Aug 2024 16:27:25 + Subject: [PATCH 1/3] [lldb][test] Fix remote Shell tests failures on Windows host. These tests should be now disabled on Windows target instead of Windows host, since remote run of Shell tests was added. This should fix failures on https://lab.llvm.org/staging/#/builders/197/builds/76. --- lldb/test/Shell/Commands/command-disassemble-mixed.c | 2 +- .../test/Shell/Commands/command-target-create-resolve-exe.test | 2 +- lldb/test/Shell/Expr/TestIRMemoryMapWindows.test | 2 +- lldb/test/Shell/Process/Windows/exception_access_violation.cpp | 2 +- lldb/test/Shell/Process/Windows/process_load.cpp | 2 +- lldb/test/Shell/SymbolFile/DWARF/packed.cpp| 2 +- lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp | 2 +- lldb/test/Shell/SymbolFile/NativePDB/stack_unwinding01.cpp | 2 +- lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test| 2 +- lldb/test/Shell/SymbolFile/PDB/class-layout.test | 2 +- lldb/test/Shell/SymbolFile/PDB/compilands.test | 2 +- lldb/test/Shell/SymbolFile/PDB/expressions.test| 2 +- lldb/test/Shell/SymbolFile/PDB/func-symbols.test | 2 +- lldb/test/Shell/SymbolFile/PDB/function-level-linking.test | 2 +- lldb/test/Shell/SymbolFile/PDB/pointers.test | 2 +- lldb/test/Shell/SymbolFile/PDB/type-quals.test | 2 +- lldb/test/Shell/SymbolFile/PDB/udt-layout.test | 2 +- lldb/test/Shell/SymbolFile/PDB/variables-locations.test| 2 +- lldb/test/Shell/SymbolFile/PDB/vbases.test | 2 +- lldb/test/Shell/Target/dependent-modules-nodupe-windows.test | 2 +- lldb/test/Shell/lit.cfg.py | 3 +++ 21 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lldb/test/Shell/Commands/command-disassemble-mixed.c b/lldb/test/Shell/Commands/command-disassemble-mixed.c index 1e530095c5c56b..4af85c0a4c020b 100644 --- a/lldb/test/Shell/Commands/command-disassemble-mixed.c +++ b/lldb/test/Shell/Commands/command-disassemble-mixed.c @@ -1,6 +1,6 @@ // invalid mixed disassembly line -// XFAIL: system-windows +// XFAIL: target-windows // RUN: %clang_host -g %s -o %t // RUN: %lldb %t -o "dis -m -n main" -o "exit" | FileCheck %s diff --git a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test index 0ebbaf25e652de..3a0c7bd91a73e4 100644 --- a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test +++ b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test @@ -1,4 +1,4 @@ -# REQUIRES: system-windows +# REQUIRES: target-windows ## This checks that when starting lldb (or using `target create`) with a ## program name which is on $PATH, or not specify the .exe suffix of a program diff --git a/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test b/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test index ae29492c9ccc9f..66f0bce3047303 100644 --- a/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test +++ b/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test @@ -1,4 +1,4 @@ -# REQUIRES: system-windows +# REQUIRES: target-windows # RUN: %clang_cl_host /Zi /GS- %p/Inputs/call-function.cpp /c /o %t.obj # RUN: %msvc_link /debug:full %t.obj /out:%t diff --git a/lldb/test/Shell/Process/Windows/exception_access_violation.cpp b/lldb/test/Shell/Process/Windows/exception_access_violation.cpp index 4835b498ee4dfd..93898a1991bc6d 100644 --- a/lldb/test/Shell/Process/Windows/exception_access_violation.cpp +++ b/lldb/test/Shell/Process/Windows/exception_access_violation.cpp @@ -1,6 +1,6 @@ // clang-format off -// REQUIRES: system-windows +// REQUIRES: target-windows // RUN: %build --compiler=clang-cl -o %t.exe -- %s // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "run" -- write | FileCheck --check-prefix=WRITE %s // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "run" -- read | FileCheck --check-prefix=READ %s diff --git a/lldb/test/Shell/Process/Windows/process_load.cpp b/lldb/test/Shell/Process/Windows/process_load.cpp index 43bf45865f9bae..de3b4afc77f87f 100644 --- a/lldb/test/Shell/Process/Windows/process_load.cpp +++ b/lldb/test/Shell/Process/Windows/process_load.cpp @@ -1,6 +1,6 @@ // clang-format off -// REQUIRES: system-windows +// REQUIRES: target-windows // RUN: %build --compiler=clang-cl -o %t.exe -- %s // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "process launch" -o "process load kernel32.dll" | FileCheck %s diff --git a/lldb/test/Shell/SymbolFile/DWARF/packed.cpp b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp index 56a4308ff7c5ef..6a794a012a6e53 100644 --- a/lldb/test/Shell/Sym
[Lldb-commits] [lldb] fix: Target Process may crash on detaching process on windows (PR #115712)
https://github.com/anatawa12 edited https://github.com/llvm/llvm-project/pull/115712 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] bc368e4 - [lldb][test] TestConstStaticIntegralMember.py: skip dsym variant for older compiler versions
Author: Michael Buch Date: 2024-11-11T13:30:06Z New Revision: bc368e4b578730bf0b10acd5412e476ccf7a5807 URL: https://github.com/llvm/llvm-project/commit/bc368e4b578730bf0b10acd5412e476ccf7a5807 DIFF: https://github.com/llvm/llvm-project/commit/bc368e4b578730bf0b10acd5412e476ccf7a5807.diff LOG: [lldb][test] TestConstStaticIntegralMember.py: skip dsym variant for older compiler versions The existing XFAIL was being ignored because of the `expectedFailureDarwin` causing failures on the matrix macOS bot: ``` == FAIL: test_inline_static_members_dwarf5_dsym (TestConstStaticIntegralMember.TestCase) -- Traceback (most recent call last): File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1769, in test_method return attrvalue(self) File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py", line 151, in test_inline_static_members_dwarf5 self.check_inline_static_members("-gdwarf-5") File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py", line 129, in check_inline_static_members self.check_global_var("A::int_val", "const int", "1") File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py", line 118, in check_global_var self.assertGreaterEqual(len(var_list), 1) AssertionError: 0 not greater than or equal to 1 Config=x86_64-/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/clang_1501_build/bin/clang == FAIL: test_shadowed_static_inline_members_dwarf5_dsym (TestConstStaticIntegralMember.TestCase) -- Traceback (most recent call last): File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1769, in test_method return attrvalue(self) File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py", line 205, in test_shadowed_static_inline_members_dwarf5 self.check_shadowed_static_inline_members("-gdwarf-5") File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py", line 192, in check_shadowed_static_inline_members self.check_global_var("ns::Foo::mem", "const int", "10") File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py", line 118, in check_global_var self.assertGreaterEqual(len(var_list), 1) AssertionError: 0 not greater than or equal to 1 Config=x86_64-/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-matrix/clang_1501_build/bin/clang -- ``` Added: Modified: lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py Removed: diff --git a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py index c79cf19f36aafd..9de7eb2e4a6e3a 100644 --- a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py +++ b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py @@ -146,7 +146,7 @@ def check_inline_static_members(self, flags): @skipIfWindows # On linux this passes due to the manual index @expectedFailureDarwin(debug_info=no_match(["dsym"])) -@expectedFailureAll(debug_info=["dsym"], compiler=["clang"], compiler_version=["<", "19.0"]) +@skipIf(debug_info=["dsym"], compiler=["clang"], compiler_version=["<", "19.0"]) def test_inline_static_members_dwarf5(self): self.check_inline_static_members("-gdwarf-5") @@ -200,7 +200,7 @@ def check_shadowed_static_inline_members(self, flags): @skipIfWindows # On linux this passes due to the manual index @expectedFailureDarwin(debug_info=no_match(["dsym"])) -@expectedFailureAll(debug_info=["dsym"], compiler=["clang"], compiler_version=["<", "19.0"]) +@skipIf(debug_info=["dsym"], compiler=["clang"], compiler_version=["<", "19.0"]) def test_shadowed_static_inline_members_dwarf5(self): self.check_sh
[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)
rocallahan wrote: Giving ThreadPlans a direction gets complicated when there are multiple runnable threads, because the topmost plans for different runnable threads could disagree about the execution direction, which is obviously unworkable. In my experimental branch I linked above, I resolve this by defaulting to forward execution if there's a disagreement and popping reverse-execution plans from runnable threads until all the topmost plans agree on forward execution. But this means that reverse-continue has to push a `ThreadPlanReverseContinue` onto all threads' plan stacks. So when the reverse-continue is over we really need to pop those `ThreadPlanReverseContinue`s from all threads. https://github.com/llvm/llvm-project/pull/112079 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)
rocallahan wrote: The approach I implemented fails when evaluating a breakpoint condition requires running a function in the target process, e.g. evaluating a breakpoint condition that's a function call, or calling `mmap()` to allocate memory for JITted code. That pushes a `ThreadPlanCallFunction` onto the plan stack and resumes the target in the forward direction. With my code as-is, switching directions discards all thread plans before resuming, so we discard the `ThreadPlanCallFunction` and everything breaks. In this case we need the `ThreadPlanCallFunction` to complete normally and then when the breakpoint condition has finished evaluating to false, resume execution in the reverse direction. So it seems like we should use the thread plan stack --- associate a direction with each thread plan, so `ThreadPlanCallFunction` executes forward and completes, but after it has been popped, the thread plan below it will tell us to execute in reverse. So I tried adding a virtual function `ThreadPlan::GetDirection()` and [introducing `ThreadPlanReverseContinue`](https://github.com/rocallahan/llvm-project/tree/reverse-continue-thread-plan) which executes in reverse. `SBProcess::ReverseContinue()` pushes a `ThreadPlanReverseContinue` onto the plan stack and resumes. There is big question about when/how this plan should be removed. In principle we should remove it when a stop is reported to the user. I tried making `ThreadPlanReverseContinue::MischiefManaged()` always return true. That doesn't work because it makes us pop the `ThreadPlanReverseContinue` before the breakpoint condition is even evaluated. So what would be a good way to pop `ThreadPlanReverseContinue`? An alternative approach would be to store a "current direction" in `ThreadPlanBase` and have `SBProcess::Continue/ReverseContinue` both set it. But that is kind of scary because any execution command that doesn't go through `SBProcess::Continue/ReverseContinue` will resume in the last-used direction. But let me know if that sounds better. @jimingham this all sounds like your territory. https://github.com/llvm/llvm-project/pull/112079 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Transfer some environment variables into the tests on Windows build host (PR #115613)
slydiman wrote: Reduced the list of environment variables to SystemDrive only. We can easily add necessary variables later. It must fix `cmake-configure` step here https://lab.llvm.org/staging/#/builders/197/builds/77 https://github.com/llvm/llvm-project/pull/115613 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Transfer some environment variables into the tests on Windows build host (PR #115613)
https://github.com/labath approved this pull request. https://github.com/llvm/llvm-project/pull/115613 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [AArch64] Reduce +sve2-aes to an alias of +sve-aes+sve2 (PR #114293)
@@ -6,10 +6,10 @@ tbx z0.b, z1.b, z2.b // CHECK: error: instruction requires: sve2 or sme // CHECK-NEXT: tbx z0.b, z1.b, z2.b -.arch_extension sve2-aes -.arch_extension nosve2-aes +.arch_extension sve-aes +.arch_extension nosve-aes SpencerAbson wrote: I see, thanks. https://github.com/llvm/llvm-project/pull/114293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [AArch64] Reduce +sve2-aes to an alias of +sve-aes+sve2 (PR #114293)
@@ -6,10 +6,10 @@ tbx z0.b, z1.b, z2.b // CHECK: error: instruction requires: sve2 or sme // CHECK-NEXT: tbx z0.b, z1.b, z2.b -.arch_extension sve2-aes -.arch_extension nosve2-aes +.arch_extension sve-aes +.arch_extension nosve-aes labrinea wrote: You may find in useful to look at https://github.com/llvm/llvm-project/pull/110816/files. In order to make nosve2-aes backwards compatible on the command line you need to adjust AArch64::ExtensionSet::disable in TargetParser. Then you can add tests in clang/test/Driver/ for it. https://github.com/llvm/llvm-project/pull/114293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added XCOFF Object File Header for AIX (PR #111814)
https://github.com/DhruvSrivastavaX updated https://github.com/llvm/llvm-project/pull/111814 >From 08c9d5ae66ca857d165dc878ebd1b2e0de364a24 Mon Sep 17 00:00:00 2001 From: Dhruv-Srivastava Date: Thu, 10 Oct 2024 02:24:42 -0500 Subject: [PATCH 1/9] Taking base file structure from ELF as reference --- .../ObjectFile/XCOFF/ObjectFileXCOFF.h| 440 ++ 1 file changed, 440 insertions(+) create mode 100644 lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h diff --git a/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h new file mode 100644 index 00..aba3a5bfcbf5b6 --- /dev/null +++ b/lldb/source/Plugins/ObjectFile/XCOFF/ObjectFileXCOFF.h @@ -0,0 +1,440 @@ +//===-- ObjectFileELF.h --- -*- C++ -*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_SOURCE_PLUGINS_OBJECTFILE_ELF_OBJECTFILEELF_H +#define LLDB_SOURCE_PLUGINS_OBJECTFILE_ELF_OBJECTFILEELF_H + +#include + +#include +#include + +#include "lldb/Symbol/ObjectFile.h" +#include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/UUID.h" +#include "lldb/lldb-private.h" + +#include "ELFHeader.h" + +struct ELFNote { + elf::elf_word n_namesz = 0; + elf::elf_word n_descsz = 0; + elf::elf_word n_type = 0; + + std::string n_name; + + ELFNote() = default; + + /// Parse an ELFNote entry from the given DataExtractor starting at position + /// \p offset. + /// + /// \param[in] data + ///The DataExtractor to read from. + /// + /// \param[in,out] offset + ///Pointer to an offset in the data. On return the offset will be + ///advanced by the number of bytes read. + /// + /// \return + ///True if the ELFRel entry was successfully read and false otherwise. + bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset); + + size_t GetByteSize() const { +return 12 + llvm::alignTo(n_namesz, 4) + llvm::alignTo(n_descsz, 4); + } +}; + +/// \class ObjectFileELF +/// Generic ELF object file reader. +/// +/// This class provides a generic ELF (32/64 bit) reader plugin implementing +/// the ObjectFile protocol. +class ObjectFileELF : public lldb_private::ObjectFile { +public: + // Static Functions + static void Initialize(); + + static void Terminate(); + + static llvm::StringRef GetPluginNameStatic() { return "elf"; } + + static llvm::StringRef GetPluginDescriptionStatic() { +return "ELF object file reader."; + } + + static lldb_private::ObjectFile * + CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP data_sp, + lldb::offset_t data_offset, const lldb_private::FileSpec *file, + lldb::offset_t file_offset, lldb::offset_t length); + + static lldb_private::ObjectFile *CreateMemoryInstance( + const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, + const lldb::ProcessSP &process_sp, lldb::addr_t header_addr); + + static size_t GetModuleSpecifications(const lldb_private::FileSpec &file, +lldb::DataBufferSP &data_sp, +lldb::offset_t data_offset, +lldb::offset_t file_offset, +lldb::offset_t length, +lldb_private::ModuleSpecList &specs); + + static bool MagicBytesMatch(lldb::DataBufferSP &data_sp, lldb::addr_t offset, + lldb::addr_t length); + + // PluginInterface protocol + llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } + + // LLVM RTTI support + static char ID; + bool isA(const void *ClassID) const override { +return ClassID == &ID || ObjectFile::isA(ClassID); + } + static bool classof(const ObjectFile *obj) { return obj->isA(&ID); } + + // ObjectFile Protocol. + bool ParseHeader() override; + + bool SetLoadAddress(lldb_private::Target &target, lldb::addr_t value, + bool value_is_offset) override; + + lldb::ByteOrder GetByteOrder() const override; + + bool IsExecutable() const override; + + uint32_t GetAddressByteSize() const override; + + lldb_private::AddressClass GetAddressClass(lldb::addr_t file_addr) override; + + void ParseSymtab(lldb_private::Symtab &symtab) override; + + bool IsStripped() override; + + void CreateSections(lldb_private::SectionList &unified_section_list) override; + + void Dump(lldb_private::Stream *s) override; + + lldb_private::ArchSpec GetArchitecture() override; + + lldb_private::UUID GetUUID() override; + + /// Return the contents of the .gnu_debuglink section, if the object file +
[Lldb-commits] [lldb] [lldb][AIX] Added XCOFF Object File Header for AIX (PR #111814)
DhruvSrivastavaX wrote: > Are XCOFF files always big endian? If so, then all you need is to add a > `DataExtractor::SetByteOrder()`. If not (and you want to support both > endiannesses), then it would be better to add both cases to > `XCOFFHeaderSizeFromMagic`. Yes, AIX XCOFF does not support little endian, so I went ahead with the SetByteOrder Fix. https://github.com/llvm/llvm-project/pull/111814 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added XCOFF Object File Header for AIX (PR #111814)
@@ -0,0 +1,193 @@ +//===-- ObjectFileXCOFF.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 "ObjectFileXCOFF.h" + +#include +#include +#include +#include + +#include "lldb/Core/Module.h" +#include "lldb/Core/ModuleSpec.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Core/Progress.h" +#include "lldb/Core/Section.h" +#include "lldb/Host/FileSystem.h" +#include "lldb/Symbol/SymbolContext.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Target.h" +#include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/FileSpecList.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/RangeMap.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/Stream.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/BinaryFormat/XCOFF.h" +#include "llvm/Object/XCOFFObjectFile.h" +#include "llvm/Support/MemoryBuffer.h" + +using namespace llvm; +using namespace lldb; +using namespace lldb_private; + +LLDB_PLUGIN_DEFINE(ObjectFileXCOFF) + +// FIXME: target 64bit at this moment. + +// Static methods. +void ObjectFileXCOFF::Initialize() { + PluginManager::RegisterPlugin(GetPluginNameStatic(), +GetPluginDescriptionStatic(), CreateInstance, +CreateMemoryInstance, GetModuleSpecifications); +} + +void ObjectFileXCOFF::Terminate() { + PluginManager::UnregisterPlugin(CreateInstance); +} + +ObjectFile *ObjectFileXCOFF::CreateInstance(const lldb::ModuleSP &module_sp, +DataBufferSP data_sp, +lldb::offset_t data_offset, +const lldb_private::FileSpec *file, +lldb::offset_t file_offset, +lldb::offset_t length) { + if (!data_sp) { +data_sp = MapFileData(*file, length, file_offset); +if (!data_sp) + return nullptr; +data_offset = 0; + } + if (!ObjectFileXCOFF::MagicBytesMatch(data_sp, data_offset, length)) +return nullptr; + // Update the data to contain the entire file if it doesn't already + if (data_sp->GetByteSize() < length) { +data_sp = MapFileData(*file, length, file_offset); +if (!data_sp) + return nullptr; +data_offset = 0; + } + auto objfile_up = std::make_unique( + module_sp, data_sp, data_offset, file, file_offset, length); + if (!objfile_up) +return nullptr; + + return objfile_up.release(); +} + +ObjectFile *ObjectFileXCOFF::CreateMemoryInstance( +const lldb::ModuleSP &module_sp, WritableDataBufferSP data_sp, +const lldb::ProcessSP &process_sp, lldb::addr_t header_addr) { + return nullptr; +} + +size_t ObjectFileXCOFF::GetModuleSpecifications( +const lldb_private::FileSpec &file, lldb::DataBufferSP &data_sp, +lldb::offset_t data_offset, lldb::offset_t file_offset, +lldb::offset_t length, lldb_private::ModuleSpecList &specs) { + const size_t initial_count = specs.GetSize(); + + if (ObjectFileXCOFF::MagicBytesMatch(data_sp, 0, data_sp->GetByteSize())) { +ArchSpec arch_spec = +ArchSpec(eArchTypeXCOFF, XCOFF::TCPU_PPC64, LLDB_INVALID_CPUTYPE); +ModuleSpec spec(file, arch_spec); +spec.GetArchitecture().SetArchitecture(eArchTypeXCOFF, XCOFF::TCPU_PPC64, + LLDB_INVALID_CPUTYPE, + llvm::Triple::AIX); +specs.Append(spec); + } + return specs.GetSize() - initial_count; +} + +static uint32_t XCOFFHeaderSizeFromMagic(uint32_t magic) { + switch (magic) { +/* TODO: 32bit not supported yet +case XCOFF::XCOFF32: + return sizeof(struct llvm::object::XCOFFFileHeader32); +*/ + + case XCOFF::XCOFF64: +return sizeof(struct llvm::object::XCOFFFileHeader64); +break; + + default: +break; + } + return 0; +} + +bool ObjectFileXCOFF::MagicBytesMatch(DataBufferSP &data_sp, + lldb::addr_t data_offset, + lldb::addr_t data_length) { + lldb_private::DataExtractor data; + data.SetData(data_sp, data_offset, data_length); + lldb::offset_t offset = 0; + uint16_t magic = data.GetU16(&offset); + if (magic == 0xF701) +magic = 0x01F7; /* Since AIX is big endian, and the host checking platform + might be little endian. */ DhruvSrivastavaX wrote: Great. Done, Thanks! https://github.com/llvm/llvm-project/pull/111814 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https:
[Lldb-commits] [lldb] fix: Target Process may crash on detaching process (PR #115712)
https://github.com/anatawa12 created https://github.com/llvm/llvm-project/pull/115712 I hope this fixes #67825 Fixes [RIDER-99436](https://youtrack.jetbrains.com/issue/RIDER-99436/Unity-Editor-will-be-crashed-when-detaching-LLDB-debugger-in-Rider), which is upstream issue of #67825. This PR changes the timing of calling `DebugActiveProcessStop` to after calling `ContinueDebugEvent` for last debugger exception. I confirmed the crashing behavior is because we call `DebugActiveProcessStop` before `ContinueDebugEvent` for last debugger exception with https://github.com/anatawa12/debug-api-test. I have no idea how should I test this so I did not add tests. Could you let me know how should I test for this chages? >From cabe26fc14cb4a924b2aebe6f3dd080408fed6ce Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Mon, 11 Nov 2024 20:22:33 +0900 Subject: [PATCH] fix: Target Process may crash on detaching process --- .../Process/Windows/Common/DebuggerThread.cpp | 45 --- .../Process/Windows/Common/DebuggerThread.h | 2 +- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp index ca8e9c078e1f99..ac63997abe823d 100644 --- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp @@ -239,12 +239,13 @@ void DebuggerThread::DebugLoop() { BOOL wait_result = WaitForDebugEvent(&dbe, INFINITE); if (wait_result) { DWORD continue_status = DBG_CONTINUE; + bool shutting_down = m_is_shutting_down; switch (dbe.dwDebugEventCode) { default: llvm_unreachable("Unhandle debug event code!"); case EXCEPTION_DEBUG_EVENT: { -ExceptionResult status = -HandleExceptionEvent(dbe.u.Exception, dbe.dwThreadId); +ExceptionResult status = HandleExceptionEvent( +dbe.u.Exception, dbe.dwThreadId, shutting_down); if (status == ExceptionResult::MaskException) continue_status = DBG_CONTINUE; @@ -292,6 +293,25 @@ void DebuggerThread::DebugLoop() { ::ContinueDebugEvent(dbe.dwProcessId, dbe.dwThreadId, continue_status); + // We have to DebugActiveProcessStop after ContinueDebugEvent, otherwise + // the target process will crash + if (shutting_down) { +// A breakpoint that occurs while `m_pid_to_detach` is non-zero is a +// magic exception that we use simply to wake up the DebuggerThread so +// that we can close out the debug loop. +if (m_pid_to_detach != 0 && +(dbe.u.Exception.ExceptionRecord.ExceptionCode == + EXCEPTION_BREAKPOINT || + dbe.u.Exception.ExceptionRecord.ExceptionCode == + STATUS_WX86_BREAKPOINT)) { + LLDB_LOG(log, + "Breakpoint exception is cue to detach from process {0:x}", + m_pid_to_detach.load()); + ::DebugActiveProcessStop(m_pid_to_detach); + m_detached = true; +} + } + if (m_detached) { should_debug = false; } @@ -310,25 +330,18 @@ void DebuggerThread::DebugLoop() { ExceptionResult DebuggerThread::HandleExceptionEvent(const EXCEPTION_DEBUG_INFO &info, - DWORD thread_id) { + DWORD thread_id, bool shutting_down) { Log *log = GetLog(WindowsLog::Event | WindowsLog::Exception); - if (m_is_shutting_down) { -// A breakpoint that occurs while `m_pid_to_detach` is non-zero is a magic -// exception that -// we use simply to wake up the DebuggerThread so that we can close out the -// debug loop. -if (m_pid_to_detach != 0 && + if (shutting_down) { +bool is_breakpoint = (info.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT || - info.ExceptionRecord.ExceptionCode == STATUS_WX86_BREAKPOINT)) { - LLDB_LOG(log, "Breakpoint exception is cue to detach from process {0:x}", - m_pid_to_detach.load()); - ::DebugActiveProcessStop(m_pid_to_detach); - m_detached = true; -} + info.ExceptionRecord.ExceptionCode == STATUS_WX86_BREAKPOINT); // Don't perform any blocking operations while we're shutting down. That // will cause TerminateProcess -> WaitForSingleObject to time out. -return ExceptionResult::SendToApplication; +// We should not send breakpoint exceptions to the application. +return is_breakpoint ? ExceptionResult::MaskException + : ExceptionResult::SendToApplication; } bool first_chance = (info.dwFirstChance != 0); diff --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h index e3439ff34584be..5960237b778673 100644 --- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h +++ b/lldb/sourc
[Lldb-commits] [lldb] fix: Target Process may crash on detaching process (PR #115712)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/115712 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fix: Target Process may crash on detaching process (PR #115712)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: anatawa12 (anatawa12) Changes I hope this fixes #67825 Fixes [RIDER-99436](https://youtrack.jetbrains.com/issue/RIDER-99436/Unity-Editor-will-be-crashed-when-detaching-LLDB-debugger-in-Rider), which is upstream issue of #67825. This PR changes the timing of calling `DebugActiveProcessStop` to after calling `ContinueDebugEvent` for last debugger exception. I confirmed the crashing behavior is because we call `DebugActiveProcessStop` before `ContinueDebugEvent` for last debugger exception with https://github.com/anatawa12/debug-api-test. I have no idea how should I test this so I did not add tests. Could you let me know how should I test for this chages? --- Full diff: https://github.com/llvm/llvm-project/pull/115712.diff 2 Files Affected: - (modified) lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp (+29-16) - (modified) lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h (+1-1) ``diff diff --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp index ca8e9c078e1f99..ac63997abe823d 100644 --- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp +++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp @@ -239,12 +239,13 @@ void DebuggerThread::DebugLoop() { BOOL wait_result = WaitForDebugEvent(&dbe, INFINITE); if (wait_result) { DWORD continue_status = DBG_CONTINUE; + bool shutting_down = m_is_shutting_down; switch (dbe.dwDebugEventCode) { default: llvm_unreachable("Unhandle debug event code!"); case EXCEPTION_DEBUG_EVENT: { -ExceptionResult status = -HandleExceptionEvent(dbe.u.Exception, dbe.dwThreadId); +ExceptionResult status = HandleExceptionEvent( +dbe.u.Exception, dbe.dwThreadId, shutting_down); if (status == ExceptionResult::MaskException) continue_status = DBG_CONTINUE; @@ -292,6 +293,25 @@ void DebuggerThread::DebugLoop() { ::ContinueDebugEvent(dbe.dwProcessId, dbe.dwThreadId, continue_status); + // We have to DebugActiveProcessStop after ContinueDebugEvent, otherwise + // the target process will crash + if (shutting_down) { +// A breakpoint that occurs while `m_pid_to_detach` is non-zero is a +// magic exception that we use simply to wake up the DebuggerThread so +// that we can close out the debug loop. +if (m_pid_to_detach != 0 && +(dbe.u.Exception.ExceptionRecord.ExceptionCode == + EXCEPTION_BREAKPOINT || + dbe.u.Exception.ExceptionRecord.ExceptionCode == + STATUS_WX86_BREAKPOINT)) { + LLDB_LOG(log, + "Breakpoint exception is cue to detach from process {0:x}", + m_pid_to_detach.load()); + ::DebugActiveProcessStop(m_pid_to_detach); + m_detached = true; +} + } + if (m_detached) { should_debug = false; } @@ -310,25 +330,18 @@ void DebuggerThread::DebugLoop() { ExceptionResult DebuggerThread::HandleExceptionEvent(const EXCEPTION_DEBUG_INFO &info, - DWORD thread_id) { + DWORD thread_id, bool shutting_down) { Log *log = GetLog(WindowsLog::Event | WindowsLog::Exception); - if (m_is_shutting_down) { -// A breakpoint that occurs while `m_pid_to_detach` is non-zero is a magic -// exception that -// we use simply to wake up the DebuggerThread so that we can close out the -// debug loop. -if (m_pid_to_detach != 0 && + if (shutting_down) { +bool is_breakpoint = (info.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT || - info.ExceptionRecord.ExceptionCode == STATUS_WX86_BREAKPOINT)) { - LLDB_LOG(log, "Breakpoint exception is cue to detach from process {0:x}", - m_pid_to_detach.load()); - ::DebugActiveProcessStop(m_pid_to_detach); - m_detached = true; -} + info.ExceptionRecord.ExceptionCode == STATUS_WX86_BREAKPOINT); // Don't perform any blocking operations while we're shutting down. That // will cause TerminateProcess -> WaitForSingleObject to time out. -return ExceptionResult::SendToApplication; +// We should not send breakpoint exceptions to the application. +return is_breakpoint ? ExceptionResult::MaskException + : ExceptionResult::SendToApplication; } bool first_chance = (info.dwFirstChance != 0); diff --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h index e3439ff34584be..5960237b778673 100644 --- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h +++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.h @@ -46,7 +46,7 @@ class DebuggerThread : public std::ena
[Lldb-commits] [lldb] [lldb][AIX] Added new plugin AIX-DYLD (Dynamic Loader) Base Support (PR #115714)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (Lakshmi-Surekha) Changes This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: 1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 2. https://github.com/llvm/llvm-project/issues/101657 The complete changes for porting are present in this draft PR: https://github.com/llvm/llvm-project/pull/102601 Added Dynamic Loader base implementation for LLDB support for AIX Added base functionality. Will enhance the files in incremental PRs @DavidSpickett @labath @DhruvSrivastavaX --- Full diff: https://github.com/llvm/llvm-project/pull/115714.diff 4 Files Affected: - (added) lldb/source/Plugins/DynamicLoader/AIX-DYLD/CMakeLists.txt (+9) - (added) lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp (+146) - (added) lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h (+53) - (modified) lldb/source/Plugins/DynamicLoader/CMakeLists.txt (+1) ``diff diff --git a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/CMakeLists.txt b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/CMakeLists.txt new file mode 100644 index 00..c3bd424479f17c --- /dev/null +++ b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/CMakeLists.txt @@ -0,0 +1,9 @@ +add_lldb_library(lldbPluginDynamicLoaderAIXDYLD PLUGIN + DynamicLoaderAIXDYLD.cpp + + LINK_LIBS +lldbCore +lldbTarget + LINK_COMPONENTS +Support + ) diff --git a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp new file mode 100644 index 00..6b48737551bfb4 --- /dev/null +++ b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp @@ -0,0 +1,146 @@ +//===-- DynamicLoaderAIXDYLD.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 "DynamicLoaderAIXDYLD.h" + +#include "lldb/Core/Module.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/Platform.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/RegisterContext.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/ThreadPlanStepInstruction.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" + +using namespace lldb; +using namespace lldb_private; + +LLDB_PLUGIN_DEFINE(DynamicLoaderAIXDYLD) + +DynamicLoaderAIXDYLD::DynamicLoaderAIXDYLD(Process *process) +: DynamicLoader(process) {} + +DynamicLoaderAIXDYLD::~DynamicLoaderAIXDYLD() = default; + +void DynamicLoaderAIXDYLD::Initialize() { + PluginManager::RegisterPlugin(GetPluginNameStatic(), +GetPluginDescriptionStatic(), CreateInstance); +} + +void DynamicLoaderAIXDYLD::Terminate() {} + +llvm::StringRef DynamicLoaderAIXDYLD::GetPluginDescriptionStatic() { + return "Dynamic loader plug-in that watches for shared library " + "loads/unloads in AIX processes."; +} + +DynamicLoader *DynamicLoaderAIXDYLD::CreateInstance(Process *process, +bool force) { + bool should_create = force; + if (!should_create) { +const llvm::Triple &triple_ref = +process->GetTarget().GetArchitecture().GetTriple(); +if (triple_ref.getOS() == llvm::Triple::AIX) + should_create = true; + } + + if (should_create) +return new DynamicLoaderAIXDYLD(process); + + return nullptr; +} + +void DynamicLoaderAIXDYLD::OnLoadModule(lldb::ModuleSP module_sp, +const ModuleSpec module_spec, +lldb::addr_t module_addr) { + + // Resolve the module unless we already have one. + if (!module_sp) { +Status error; +module_sp = m_process->GetTarget().GetOrCreateModule( +module_spec, true /* notify */, &error); +if (error.Fail()) + return; + } + + m_loaded_modules[module_sp] = module_addr; + UpdateLoadedSectionsCommon(module_sp, module_addr, false); + ModuleList module_list; + module_list.Append(module_sp); + m_process->GetTarget().ModulesDidLoad(module_list); +} + +void DynamicLoaderAIXDYLD::OnUnloadModule(lldb::addr_t module_addr) { + Address resolved_addr; + if (!m_process->GetTarget().ResolveLoadAddress(module_addr, resolved_addr)) +return; + + ModuleSP module_sp = resolved_addr.GetModule(); + if (module_sp) { +m_loaded_modules.erase(module_sp); +UnloadSectionsCommon(module_sp); +ModuleList module_list; +module_list.Append(module_sp); +m_process->GetTarget().ModulesDidUnload(module_list, false); + } +} + +lldb::addr_t DynamicLoaderAIXDYLD::GetLoadAddress(ModuleSP executable) { + // First, see if the load address is alr
[Lldb-commits] [lldb] [lldb][AIX] Added new plugin AIX-DYLD (Dynamic Loader) Base Support (PR #115714)
https://github.com/Lakshmi-Surekha created https://github.com/llvm/llvm-project/pull/115714 This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: 1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 2. https://github.com/llvm/llvm-project/issues/101657 The complete changes for porting are present in this draft PR: https://github.com/llvm/llvm-project/pull/102601 Added Dynamic Loader base implementation for LLDB support for AIX Added base functionality. Will enhance the files in incremental PRs @DavidSpickett @labath @DhruvSrivastavaX >From 468ad873cd90312cea67900851f8a0cf44a830f6 Mon Sep 17 00:00:00 2001 From: Lakshmi Surekha Kovvuri Date: Mon, 11 Nov 2024 03:02:16 -0600 Subject: [PATCH 1/4] New Plugin DynamicLoader(AIX-DYLD) for Platform AIX --- lldb/source/Plugins/DynamicLoader/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt index 30607159acdc08..4f3fb693faae18 100644 --- a/lldb/source/Plugins/DynamicLoader/CMakeLists.txt +++ b/lldb/source/Plugins/DynamicLoader/CMakeLists.txt @@ -5,4 +5,5 @@ add_subdirectory(POSIX-DYLD) add_subdirectory(Static) add_subdirectory(Hexagon-DYLD) add_subdirectory(Windows-DYLD) +add_subdirectory(AIX-DYLD) add_subdirectory(wasm-DYLD) >From 7add496ea80646cfe2b8aad0ecd595811cc01522 Mon Sep 17 00:00:00 2001 From: Lakshmi Surekha Kovvuri Date: Mon, 11 Nov 2024 03:48:02 -0600 Subject: [PATCH 2/4] New Plugin DynamicLoader(AIX-DYLD) for Platform AIX --- .../DynamicLoader/AIX-DYLD/CMakeLists.txt | 11 ++ .../AIX-DYLD/DynamicLoaderAIXDYLD.cpp | 153 ++ .../AIX-DYLD/DynamicLoaderAIXDYLD.h | 55 +++ 3 files changed, 219 insertions(+) create mode 100644 lldb/source/Plugins/DynamicLoader/AIX-DYLD/CMakeLists.txt create mode 100644 lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp create mode 100644 lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.h diff --git a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/CMakeLists.txt b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/CMakeLists.txt new file mode 100644 index 00..02fe0d617955a0 --- /dev/null +++ b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/CMakeLists.txt @@ -0,0 +1,11 @@ +add_definitions("-D_ALL_SOURCE") + +add_lldb_library(lldbPluginDynamicLoaderAIXDYLD PLUGIN + DynamicLoaderAIXDYLD.cpp + + LINK_LIBS +lldbCore +lldbTarget + LINK_COMPONENTS +Support + ) diff --git a/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp new file mode 100644 index 00..070831cc0f54fa --- /dev/null +++ b/lldb/source/Plugins/DynamicLoader/AIX-DYLD/DynamicLoaderAIXDYLD.cpp @@ -0,0 +1,153 @@ +//===-- DynamicLoaderAIXDYLD.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 "DynamicLoaderAIXDYLD.h" + +#include "lldb/Core/Module.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/Platform.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/RegisterContext.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/ThreadPlanStepInstruction.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" +#if defined(_AIX) +#include +#endif + +/*#include "llvm/ADT/Triple.h" +*/ + +using namespace lldb; +using namespace lldb_private; + +LLDB_PLUGIN_DEFINE(DynamicLoaderAIXDYLD) + +DynamicLoaderAIXDYLD::DynamicLoaderAIXDYLD(Process *process) +: DynamicLoader(process) {} + +DynamicLoaderAIXDYLD::~DynamicLoaderAIXDYLD() = default; + +void DynamicLoaderAIXDYLD::Initialize() { + PluginManager::RegisterPlugin(GetPluginNameStatic(), +GetPluginDescriptionStatic(), CreateInstance); +} + +void DynamicLoaderAIXDYLD::Terminate() {} + +llvm::StringRef DynamicLoaderAIXDYLD::GetPluginDescriptionStatic() { + return "Dynamic loader plug-in that watches for shared library " + "loads/unloads in AIX processes."; +} + +DynamicLoader *DynamicLoaderAIXDYLD::CreateInstance(Process *process, +bool force) { + bool should_create = force; + if (!should_create) { +const llvm::Triple &triple_ref = +process->GetTarget().GetArchitecture().GetTriple(); +if (triple_ref.getOS() == llvm::Triple::AIX) + should_create = true; + } + + if (should_create) +return new DynamicLoaderAIXDYLD(process); + + return nullptr; +} + +void DynamicLoaderAIXDYLD::OnLoadModule(lldb::ModuleSP module_sp, +
[Lldb-commits] [lldb] [lldb][AIX] Added new plugin AIX-DYLD (Dynamic Loader) Base Support (PR #115714)
github-actions[bot] wrote: Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using `@` followed by their GitHub username. If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the [LLVM GitHub User Guide](https://llvm.org/docs/GitHub.html). You can also ask questions in a comment on this PR, on the [LLVM Discord](https://discord.com/invite/xS7Z362) or on the [forums](https://discourse.llvm.org/). https://github.com/llvm/llvm-project/pull/115714 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix remote Shell tests failures on Windows host. (PR #115716)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Vladislav Dzhidzhoev (dzhidzhoev) Changes Since the remote Shell test execution feature was added, these tests should now be disabled on Windows target instead of Windows host. It should fix failures on https://lab.llvm.org/staging/#/builders/197/builds/76. --- Full diff: https://github.com/llvm/llvm-project/pull/115716.diff 21 Files Affected: - (modified) lldb/test/Shell/Commands/command-disassemble-mixed.c (+1-1) - (modified) lldb/test/Shell/Commands/command-target-create-resolve-exe.test (+1-1) - (modified) lldb/test/Shell/Expr/TestIRMemoryMapWindows.test (+1-1) - (modified) lldb/test/Shell/Process/Windows/exception_access_violation.cpp (+1-1) - (modified) lldb/test/Shell/Process/Windows/process_load.cpp (+1-1) - (modified) lldb/test/Shell/SymbolFile/DWARF/packed.cpp (+1-1) - (modified) lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp (+1-1) - (modified) lldb/test/Shell/SymbolFile/NativePDB/stack_unwinding01.cpp (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/class-layout.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/compilands.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/expressions.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/func-symbols.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/function-level-linking.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/pointers.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/type-quals.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/udt-layout.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/variables-locations.test (+1-1) - (modified) lldb/test/Shell/SymbolFile/PDB/vbases.test (+1-1) - (modified) lldb/test/Shell/Target/dependent-modules-nodupe-windows.test (+1-1) - (modified) lldb/test/Shell/lit.cfg.py (+3) ``diff diff --git a/lldb/test/Shell/Commands/command-disassemble-mixed.c b/lldb/test/Shell/Commands/command-disassemble-mixed.c index 1e530095c5c56b8..4af85c0a4c020b2 100644 --- a/lldb/test/Shell/Commands/command-disassemble-mixed.c +++ b/lldb/test/Shell/Commands/command-disassemble-mixed.c @@ -1,6 +1,6 @@ // invalid mixed disassembly line -// XFAIL: system-windows +// XFAIL: target-windows // RUN: %clang_host -g %s -o %t // RUN: %lldb %t -o "dis -m -n main" -o "exit" | FileCheck %s diff --git a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test index 0ebbaf25e652de4..3a0c7bd91a73e48 100644 --- a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test +++ b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test @@ -1,4 +1,4 @@ -# REQUIRES: system-windows +# REQUIRES: target-windows ## This checks that when starting lldb (or using `target create`) with a ## program name which is on $PATH, or not specify the .exe suffix of a program diff --git a/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test b/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test index ae29492c9ccc9fb..66f0bce3047303a 100644 --- a/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test +++ b/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test @@ -1,4 +1,4 @@ -# REQUIRES: system-windows +# REQUIRES: target-windows # RUN: %clang_cl_host /Zi /GS- %p/Inputs/call-function.cpp /c /o %t.obj # RUN: %msvc_link /debug:full %t.obj /out:%t diff --git a/lldb/test/Shell/Process/Windows/exception_access_violation.cpp b/lldb/test/Shell/Process/Windows/exception_access_violation.cpp index 4835b498ee4dfd4..93898a1991bc6d5 100644 --- a/lldb/test/Shell/Process/Windows/exception_access_violation.cpp +++ b/lldb/test/Shell/Process/Windows/exception_access_violation.cpp @@ -1,6 +1,6 @@ // clang-format off -// REQUIRES: system-windows +// REQUIRES: target-windows // RUN: %build --compiler=clang-cl -o %t.exe -- %s // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "run" -- write | FileCheck --check-prefix=WRITE %s // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "run" -- read | FileCheck --check-prefix=READ %s diff --git a/lldb/test/Shell/Process/Windows/process_load.cpp b/lldb/test/Shell/Process/Windows/process_load.cpp index 43bf45865f9bae8..de3b4afc77f87fa 100644 --- a/lldb/test/Shell/Process/Windows/process_load.cpp +++ b/lldb/test/Shell/Process/Windows/process_load.cpp @@ -1,6 +1,6 @@ // clang-format off -// REQUIRES: system-windows +// REQUIRES: target-windows // RUN: %build --compiler=clang-cl -o %t.exe -- %s // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "process launch" -o "process load kernel32.dll" | FileCheck %s diff --git a/lldb/test/Shell/SymbolFile/DWARF/packed.cpp b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp index 56a4308ff7c5efe..6a794a012a6e53c 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/packed.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/packed.cpp @@ -1,4 +1,4 @@ -// XFAIL: system-win
[Lldb-commits] [lldb] [lldb][test] Fix remote Shell tests failures on Windows host. (PR #115716)
https://github.com/dzhidzhoev created https://github.com/llvm/llvm-project/pull/115716 Since the remote Shell test execution feature was added, these tests should now be disabled on Windows target instead of Windows host. It should fix failures on https://lab.llvm.org/staging/#/builders/197/builds/76. >From 306cf0dd5a6ccb80a1ec530b1753f6fa8d538715 Mon Sep 17 00:00:00 2001 From: Vladislav Dzhidzhoev Date: Thu, 29 Aug 2024 16:27:25 + Subject: [PATCH] [lldb][test] Fix remote Shell tests failures on Windows host. These tests should be now disabled on Windows target instead of Windows host, since remote run of Shell tests was added. This should fix failures on https://lab.llvm.org/staging/#/builders/197/builds/76. --- lldb/test/Shell/Commands/command-disassemble-mixed.c | 2 +- .../test/Shell/Commands/command-target-create-resolve-exe.test | 2 +- lldb/test/Shell/Expr/TestIRMemoryMapWindows.test | 2 +- lldb/test/Shell/Process/Windows/exception_access_violation.cpp | 2 +- lldb/test/Shell/Process/Windows/process_load.cpp | 2 +- lldb/test/Shell/SymbolFile/DWARF/packed.cpp| 2 +- lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp | 2 +- lldb/test/Shell/SymbolFile/NativePDB/stack_unwinding01.cpp | 2 +- lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test| 2 +- lldb/test/Shell/SymbolFile/PDB/class-layout.test | 2 +- lldb/test/Shell/SymbolFile/PDB/compilands.test | 2 +- lldb/test/Shell/SymbolFile/PDB/expressions.test| 2 +- lldb/test/Shell/SymbolFile/PDB/func-symbols.test | 2 +- lldb/test/Shell/SymbolFile/PDB/function-level-linking.test | 2 +- lldb/test/Shell/SymbolFile/PDB/pointers.test | 2 +- lldb/test/Shell/SymbolFile/PDB/type-quals.test | 2 +- lldb/test/Shell/SymbolFile/PDB/udt-layout.test | 2 +- lldb/test/Shell/SymbolFile/PDB/variables-locations.test| 2 +- lldb/test/Shell/SymbolFile/PDB/vbases.test | 2 +- lldb/test/Shell/Target/dependent-modules-nodupe-windows.test | 2 +- lldb/test/Shell/lit.cfg.py | 3 +++ 21 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lldb/test/Shell/Commands/command-disassemble-mixed.c b/lldb/test/Shell/Commands/command-disassemble-mixed.c index 1e530095c5c56b8..4af85c0a4c020b2 100644 --- a/lldb/test/Shell/Commands/command-disassemble-mixed.c +++ b/lldb/test/Shell/Commands/command-disassemble-mixed.c @@ -1,6 +1,6 @@ // invalid mixed disassembly line -// XFAIL: system-windows +// XFAIL: target-windows // RUN: %clang_host -g %s -o %t // RUN: %lldb %t -o "dis -m -n main" -o "exit" | FileCheck %s diff --git a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test index 0ebbaf25e652de4..3a0c7bd91a73e48 100644 --- a/lldb/test/Shell/Commands/command-target-create-resolve-exe.test +++ b/lldb/test/Shell/Commands/command-target-create-resolve-exe.test @@ -1,4 +1,4 @@ -# REQUIRES: system-windows +# REQUIRES: target-windows ## This checks that when starting lldb (or using `target create`) with a ## program name which is on $PATH, or not specify the .exe suffix of a program diff --git a/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test b/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test index ae29492c9ccc9fb..66f0bce3047303a 100644 --- a/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test +++ b/lldb/test/Shell/Expr/TestIRMemoryMapWindows.test @@ -1,4 +1,4 @@ -# REQUIRES: system-windows +# REQUIRES: target-windows # RUN: %clang_cl_host /Zi /GS- %p/Inputs/call-function.cpp /c /o %t.obj # RUN: %msvc_link /debug:full %t.obj /out:%t diff --git a/lldb/test/Shell/Process/Windows/exception_access_violation.cpp b/lldb/test/Shell/Process/Windows/exception_access_violation.cpp index 4835b498ee4dfd4..93898a1991bc6d5 100644 --- a/lldb/test/Shell/Process/Windows/exception_access_violation.cpp +++ b/lldb/test/Shell/Process/Windows/exception_access_violation.cpp @@ -1,6 +1,6 @@ // clang-format off -// REQUIRES: system-windows +// REQUIRES: target-windows // RUN: %build --compiler=clang-cl -o %t.exe -- %s // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "run" -- write | FileCheck --check-prefix=WRITE %s // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "run" -- read | FileCheck --check-prefix=READ %s diff --git a/lldb/test/Shell/Process/Windows/process_load.cpp b/lldb/test/Shell/Process/Windows/process_load.cpp index 43bf45865f9bae8..de3b4afc77f87fa 100644 --- a/lldb/test/Shell/Process/Windows/process_load.cpp +++ b/lldb/test/Shell/Process/Windows/process_load.cpp @@ -1,6 +1,6 @@ // clang-format off -// REQUIRES: system-windows +// REQUIRES: target-windows // RUN: %build --compiler=clang-cl -o %t.exe -- %s // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "process launc
[Lldb-commits] [lldb] [lldb][AIX] Added new plugin AIX-DYLD (Dynamic Loader) Base Support (PR #115714)
https://github.com/Lakshmi-Surekha edited https://github.com/llvm/llvm-project/pull/115714 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix remote Shell tests failures on Windows host (PR #115716)
https://github.com/dzhidzhoev edited https://github.com/llvm/llvm-project/pull/115716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Disable TestCancelAttach for Windows host (PR #115619)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/115619 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 1277bea - [lldb] Disable TestCancelAttach for Windows host (#115619)
Author: Dmitry Vasilyev Date: 2024-11-11T12:40:01+04:00 New Revision: 1277bea4311692d3bd3d1a6566ec1011d3e72f65 URL: https://github.com/llvm/llvm-project/commit/1277bea4311692d3bd3d1a6566ec1011d3e72f65 DIFF: https://github.com/llvm/llvm-project/commit/1277bea4311692d3bd3d1a6566ec1011d3e72f65.diff LOG: [lldb] Disable TestCancelAttach for Windows host (#115619) See #115618 for details. Added: Modified: lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py Removed: diff --git a/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py b/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py index 9f643d50e58fc0..3be0a85d595002 100644 --- a/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py +++ b/lldb/test/API/python_api/process/cancel_attach/TestCancelAttach.py @@ -14,6 +14,11 @@ class AttachCancelTestCase(TestBase): NO_DEBUG_INFO_TESTCASE = True +@skipIf( +remote=True, +hostoslist=["windows"], +bugnumber="https://github.com/llvm/llvm-project/issues/115618";, +) def test_scripted_implementation(self): """Test that cancelling a stuck "attach waitfor" works.""" # First make an empty target for the attach: ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added Ptrace extensions for AIX (PR #108000)
labath wrote: I don't think we should submit this, because I believe this file exists only as a consequence of shoehorning NativeProcessAIX into the NativeProcessLinux mould. I think this needs to be reviewed in conjunction with the rest of the process code using it. If you want to start reviewing NativeProcessAIX, then I'd suggest you create a PR for that, and include this file in that PR. Looking over the file again, I'm fairly certain we won't be trying to make a common linux+aix base class (though we may want to move some parts into a common helper function/class), so you don't have to create a diff-with-linux PR (not on my account at least), and you can create the PR as you would want the final checked in form to look. The reason I suggested moving this to the Process tree is so that we could punt on this file for now -- my assumption was that you want to deal with the changes in the Host folder first (I see you still have a fair number of those), as those would be required to get a functional process plugin. If they're not, and you want to do the process plugin first, then be my guest. https://github.com/llvm/llvm-project/pull/108000 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Disable TestCancelAttach for Windows host (PR #115619)
slydiman wrote: @labath > The problem might have something to do with the fact that this somehow ends > up in the windows platform code: This callstack has no problem. It is the callstack on local Windows just for the comparison. I will remove this callstack from the issue description to avoid confusing. https://github.com/llvm/llvm-project/pull/115619 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Transfer some environment variables into the tests on Windows build host (PR #115613)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/115613 >From 17b3338decd050612d0b804ef6d9966912b0950b Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Sat, 9 Nov 2024 21:11:16 +0400 Subject: [PATCH 1/2] [lldb] Transfer some environment variables into the tests on Windows build host Some API tests (compiler calls) create a lot of garbage and cause unexpected behavior in case of Windows host and Linux target, e.g. ``` lldb/test/API/commands/process/attach/%SystemDrive%/ lldb/test/API/functionalities/deleted-executable/%SystemDrive%/ lldb/test/API/functionalities/exec/%SystemDrive%/ lldb/test/API/functionalities/load_unload/%SystemDrive%/ lldb/test/API/functionalities/target-new-solib-notifications/%SystemDrive%/ lldb/test/API/functionalities/thread/create_after_attach/%SystemDrive%/ ``` It can be fixed by transfer some standard Windows environment variables into API tests. --- lldb/test/API/lit.cfg.py | 19 +++ 1 file changed, 19 insertions(+) diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py index 6ef09f36a1907e..febf8dc3d19021 100644 --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -334,3 +334,22 @@ def delete_module_cache(path): # Propagate XDG_CACHE_HOME if "XDG_CACHE_HOME" in os.environ: config.environment["XDG_CACHE_HOME"] = os.environ["XDG_CACHE_HOME"] + +# Transfer some environment variables into the tests on Windows build host. +if platform.system() == "Windows": +for v in [ +"SystemDrive", +"SystemRoot", +"ALLUSERSPROFILE", +"APPDATA", +"LOCALAPPDATA", +"USERDNSDOMAIN", +"USERDOMAIN", +"USERNAME", +"USERPROFILE", +"USERDOMAIN_ROAMINGPROFILE", +"COMPUTERNAME", +"ProgramData", +]: +if v in os.environ: +config.environment[v] = os.environ[v] >From 28c619781774096340e1d9321853184a2da34e5f Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 11 Nov 2024 12:48:06 +0400 Subject: [PATCH 2/2] Reduced the list of environment variables to SystemDrive only. We can easily add necessary variables later. --- lldb/test/API/lit.cfg.py | 15 +-- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py index febf8dc3d19021..06c685ebc3f5a5 100644 --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -337,19 +337,6 @@ def delete_module_cache(path): # Transfer some environment variables into the tests on Windows build host. if platform.system() == "Windows": -for v in [ -"SystemDrive", -"SystemRoot", -"ALLUSERSPROFILE", -"APPDATA", -"LOCALAPPDATA", -"USERDNSDOMAIN", -"USERDOMAIN", -"USERNAME", -"USERPROFILE", -"USERDOMAIN_ROAMINGPROFILE", -"COMPUTERNAME", -"ProgramData", -]: +for v in ["SystemDrive"]: if v in os.environ: config.environment[v] = os.environ[v] ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] ebcdc70 - [lldb] Use heterogenous lookups with std::map (NFC) (#115684)
Author: Kazu Hirata Date: 2024-11-11T00:00:20-08:00 New Revision: ebcdc700d68582a44dd059c40f382583126f29a6 URL: https://github.com/llvm/llvm-project/commit/ebcdc700d68582a44dd059c40f382583126f29a6 DIFF: https://github.com/llvm/llvm-project/commit/ebcdc700d68582a44dd059c40f382583126f29a6.diff LOG: [lldb] Use heterogenous lookups with std::map (NFC) (#115684) Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string. Note that CommandMap just started accepting heterogeneous lookups (#115634). Added: Modified: lldb/source/Interpreter/CommandInterpreter.cpp Removed: diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 227ed802aa933c..f2712af0a08a73 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1274,7 +1274,7 @@ CommandObject *CommandInterpreter::GetUserCommandObject( llvm::StringRef cmd, StringList *matches, StringList *descriptions) const { std::string cmd_str(cmd); auto find_exact = [&](const CommandObject::CommandMap &map) { -auto found_elem = map.find(std::string(cmd)); +auto found_elem = map.find(cmd); if (found_elem == map.end()) return (CommandObject *)nullptr; CommandObject *exact_cmd = found_elem->second.get(); @@ -1310,7 +1310,7 @@ CommandObject *CommandInterpreter::GetAliasCommandObject( llvm::StringRef cmd, StringList *matches, StringList *descriptions) const { auto find_exact = [&](const CommandObject::CommandMap &map) -> CommandObject * { -auto found_elem = map.find(cmd.str()); +auto found_elem = map.find(cmd); if (found_elem == map.end()) return (CommandObject *)nullptr; CommandObject *exact_cmd = found_elem->second.get(); @@ -1340,13 +1340,12 @@ CommandObject *CommandInterpreter::GetAliasCommandObject( } bool CommandInterpreter::CommandExists(llvm::StringRef cmd) const { - return m_command_dict.find(std::string(cmd)) != m_command_dict.end(); + return m_command_dict.find(cmd) != m_command_dict.end(); } bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, std::string &full_name) const { - bool exact_match = - (m_alias_dict.find(std::string(cmd)) != m_alias_dict.end()); + bool exact_match = (m_alias_dict.find(cmd) != m_alias_dict.end()); if (exact_match) { full_name.assign(std::string(cmd)); return exact_match; @@ -1374,15 +1373,15 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd, } bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const { - return m_alias_dict.find(std::string(cmd)) != m_alias_dict.end(); + return m_alias_dict.find(cmd) != m_alias_dict.end(); } bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const { - return m_user_dict.find(std::string(cmd)) != m_user_dict.end(); + return m_user_dict.find(cmd) != m_user_dict.end(); } bool CommandInterpreter::UserMultiwordCommandExists(llvm::StringRef cmd) const { - return m_user_mw_dict.find(std::string(cmd)) != m_user_mw_dict.end(); + return m_user_mw_dict.find(cmd) != m_user_mw_dict.end(); } CommandAlias * @@ -1406,7 +1405,7 @@ CommandInterpreter::AddAlias(llvm::StringRef alias_name, } bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) { - auto pos = m_alias_dict.find(std::string(alias_name)); + auto pos = m_alias_dict.find(alias_name); if (pos != m_alias_dict.end()) { m_alias_dict.erase(pos); return true; @@ -1415,7 +1414,7 @@ bool CommandInterpreter::RemoveAlias(llvm::StringRef alias_name) { } bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) { - auto pos = m_command_dict.find(std::string(cmd)); + auto pos = m_command_dict.find(cmd); if (pos != m_command_dict.end()) { if (force || pos->second->IsRemovable()) { // Only regular expression objects or python commands are removable under @@ -1428,8 +1427,7 @@ bool CommandInterpreter::RemoveCommand(llvm::StringRef cmd, bool force) { } bool CommandInterpreter::RemoveUser(llvm::StringRef user_name) { - CommandObject::CommandMap::iterator pos = - m_user_dict.find(std::string(user_name)); + CommandObject::CommandMap::iterator pos = m_user_dict.find(user_name); if (pos != m_user_dict.end()) { m_user_dict.erase(pos); return true; @@ -1438,8 +1436,7 @@ bool CommandInterpreter::RemoveUser(llvm::StringRef user_name) { } bool CommandInterpreter::RemoveUserMultiword(llvm::StringRef multi_name) { - CommandObject::CommandMap::iterator pos = - m_user_mw_dict.find(std::string(multi_name)); + CommandObject::CommandMap::iterator pos = m_user_mw_dict.find(multi_name); if (pos != m_user_mw_dict.end()) { m_user_mw_dict.erase(pos); return true; @@ -2213,7 +2210,7 @@ const CommandAl
[Lldb-commits] [lldb] [lldb] Use heterogenous lookups with std::map (NFC) (PR #115684)
https://github.com/kazutakahirata closed https://github.com/llvm/llvm-project/pull/115684 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] [llvm] [AArch64] Reduce +sve2-aes to an alias of +sve-aes+sve2 (PR #114293)
@@ -6,10 +6,10 @@ tbx z0.b, z1.b, z2.b // CHECK: error: instruction requires: sve2 or sme // CHECK-NEXT: tbx z0.b, z1.b, z2.b -.arch_extension sve2-aes -.arch_extension nosve2-aes +.arch_extension sve-aes +.arch_extension nosve-aes labrinea wrote: > all sve2-aes does is enable sve2 and sve-aes Correct. > disabling a specific feature does not disable it's dependencies Also correct To preserve the old semantics of `nosve2-aes` we need to change the asm parser as follows: `{"sve2-aes", {AArch64::FeatureSVE2, AArch64::FeatureSVEAES}}` https://github.com/llvm/llvm-project/pull/114293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 04b295e - [lldb][ObjC] Fix method list entry offset calculation (#115571)
Author: Michael Buch Date: 2024-11-11T10:05:54Z New Revision: 04b295e8938778251821f8a39903fdad0501112c URL: https://github.com/llvm/llvm-project/commit/04b295e8938778251821f8a39903fdad0501112c DIFF: https://github.com/llvm/llvm-project/commit/04b295e8938778251821f8a39903fdad0501112c.diff LOG: [lldb][ObjC] Fix method list entry offset calculation (#115571) The `relative_list_list_entry_t` offset field in the Objective-C runtime is of type `int64_t`. There are cases where these offsets are negative values. For negative offsets, LLDB would currently incorrectly zero-extend the offset (dropping the fact that the offset was negative), instead producing large offsets that, when added to the `m_baseMethods_ptr` result in addresses that had their upper bits set (e.g., `0x00017ff81b3241b0`). We then would try to `GetMethodList` from such an address but fail to read it (because it's an invalid address). This would manifest in Objective-C decls not getting completed correctly (and formatters not working). We noticed this in CI failures on our Intel bots. This happened to work fine on arm64 because we strip the upper bits when calling `ClassDescriptorV2::method_list_t::Read` using the `FixCodeAddress` ABI plugin API (which doesn't do that on Intel). The fix is to sign-extend the offset calculation. Example failure before this patch: ``` == FAIL: test_break_dwarf (TestRuntimeTypes.RuntimeTypesTestCase) Test setting objc breakpoints using '_regexp-break' and 'breakpoint set'. -- Traceback (most recent call last): File "/Users/michaelbuch/Git/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1769, in test_method return attrvalue(self) File "/Users/michaelbuch/Git/llvm-project/lldb/test/API/lang/objc/foundation/TestRuntimeTypes.py", line 48, in test_break self.expect( File "/Users/michaelbuch/Git/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2370, in expect self.runCmd( File "/Users/michaelbuch/Git/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1000, in runCmd self.assertTrue(self.res.Succeeded(), msg + output) AssertionError: False is not true : Got a valid type Error output: error: :1:11: no known method '+stringWithCString:encoding:'; cast the message send to the method's return type 1 | [NSString stringWithCString:"foo" encoding:1] | ~~^~~ Config=x86_64-/Users/michaelbuch/Git/lldb-build-main-no-modules/bin/clang -- ``` Added: Modified: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp Removed: diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
[Lldb-commits] [lldb] [lldb][ObjC] Fix method list entry offset calculation (PR #115571)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/115571 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)
rocallahan wrote: Thanks, that sounds OK but I don't see how it would help with my main question right now: > So what would be a good way to pop `ThreadPlanReverseContinue`? Put it another way: if we change the plan stack state to request reverse execution (push a `ThreadPlanReverseContinue`, or change some state on `ThreadPlanBase`), when/how would be the right place in the code to undo that change? It has to happen before any user-initiated forward-execution command resumes the target, but it must not happen when we stop for a breakpoint whose condition turns out to be false. https://github.com/llvm/llvm-project/pull/112079 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)
chelcassanova wrote: I agree that those who want to change their colours in LLDB shouldn't have to touch the ANSI suffix setting in order to do this. We do use settings for changing the suffix in other places in LLDB, so if we were change how this setting works then I think it's outside of the scope of this patch and it would be better as a larger refactor to the colour settings. https://github.com/llvm/llvm-project/pull/91404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)
chelcassanova wrote: I also agree with how I was misusing the `pexpect` module here, I was way overcomplicating things there by trying to model my test after the one that drives the `expect` program instead of lldb itself 😅 https://github.com/llvm/llvm-project/pull/91404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix inline_sites_live.cpp Shell test on Linux remote (PR #115722)
https://github.com/dzhidzhoev edited https://github.com/llvm/llvm-project/pull/115722 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix inline_sites_live.cpp Shell test on Linux remote (PR #115722)
https://github.com/dzhidzhoev edited https://github.com/llvm/llvm-project/pull/115722 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support both Lua 5.3 and Lua 5.4 (PR #115500)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/115500 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e19d740 - [lldb] Support both Lua 5.3 and Lua 5.4 (#115500)
Author: Jonas Devlieghere Date: 2024-11-11T08:11:03-08:00 New Revision: e19d74016971faed321e5cca20da7016047eb029 URL: https://github.com/llvm/llvm-project/commit/e19d74016971faed321e5cca20da7016047eb029 DIFF: https://github.com/llvm/llvm-project/commit/e19d74016971faed321e5cca20da7016047eb029.diff LOG: [lldb] Support both Lua 5.3 and Lua 5.4 (#115500) Lua 5.3 and Lua 5.4 are similar enough that we can easily support both in LLDB. This patch adds support for building LLDB with both and updates the documentation accordingly. Added: Modified: lldb/CMakeLists.txt lldb/cmake/modules/FindLuaAndSwig.cmake lldb/docs/resources/build.rst lldb/test/API/lit.site.cfg.py.in lldb/test/API/lldbtest.py lldb/test/API/lua_api/TestLuaAPI.py Removed: diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 5827e04b5662f3..85ba4fde17418a 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -87,8 +87,7 @@ if (LLDB_ENABLE_PYTHON) endif () if (LLDB_ENABLE_LUA) - find_program(Lua_EXECUTABLE lua5.3) - set(LLDB_LUA_DEFAULT_RELATIVE_PATH "lib/lua/5.3") + set(LLDB_LUA_DEFAULT_RELATIVE_PATH "lib/lua/${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}") set(LLDB_LUA_RELATIVE_PATH ${LLDB_LUA_DEFAULT_RELATIVE_PATH} CACHE STRING "Path where Lua modules are installed, relative to install prefix") endif () @@ -138,12 +137,12 @@ endif() if (LLDB_ENABLE_LUA) if(LLDB_BUILD_FRAMEWORK) -set(lldb_lua_target_dir "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Lua") +set(LLDB_LUA_CPATH "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Lua") else() -set(lldb_lua_target_dir "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_LUA_RELATIVE_PATH}") +set(LLDB_LUA_CPATH "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_LUA_RELATIVE_PATH}") endif() get_target_property(lldb_lua_bindings_dir swig_wrapper_lua BINARY_DIR) - finish_swig_lua("lldb-lua" "${lldb_lua_bindings_dir}" "${lldb_lua_target_dir}") + finish_swig_lua("lldb-lua" "${lldb_lua_bindings_dir}" "${LLDB_LUA_CPATH}") endif() set(LLDB_INCLUDE_UNITTESTS ON) diff --git a/lldb/cmake/modules/FindLuaAndSwig.cmake b/lldb/cmake/modules/FindLuaAndSwig.cmake index 11548b76f843f0..33fadb2a097407 100644 --- a/lldb/cmake/modules/FindLuaAndSwig.cmake +++ b/lldb/cmake/modules/FindLuaAndSwig.cmake @@ -8,11 +8,21 @@ if(LUA_LIBRARIES AND LUA_INCLUDE_DIR AND LLDB_ENABLE_SWIG) set(LUAANDSWIG_FOUND TRUE) else() if (LLDB_ENABLE_SWIG) -find_package(Lua 5.3 EXACT) +find_package(Lua 5.3) if(LUA_FOUND) + # Find the Lua executable. Only required to run a subset of the Lua + # tests. + find_program(LUA_EXECUTABLE +NAMES +"lua" +"lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}" + ) mark_as_advanced( LUA_LIBRARIES -LUA_INCLUDE_DIR) +LUA_INCLUDE_DIR +LUA_VERSION_MINOR +LUA_VERSION_MAJOR +LUA_EXECUTABLE) endif() else() message(STATUS "SWIG 4 or later is required for Lua support in LLDB but could not be found") @@ -26,5 +36,7 @@ else() REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + LUA_VERSION_MINOR + LUA_VERSION_MAJOR LLDB_ENABLE_SWIG) endif() diff --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst index 33b6a6f79def4b..66db84522bff1f 100644 --- a/lldb/docs/resources/build.rst +++ b/lldb/docs/resources/build.rst @@ -64,7 +64,7 @@ CMake configuration error. +---+--+--+ | Python| Python scripting | ``LLDB_ENABLE_PYTHON`` | +---+--+--+ -| Lua | Lua scripting| ``LLDB_ENABLE_LUA`` | +| Lua | Lua scripting. Lua 5.3 and 5.4 are supported.| ``LLDB_ENABLE_LUA`` | +---+--+--+ Depending on your platform and package manager, one might run any of the diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in index 7dd8ffd2f5cb4c..ecebc447748593 100644 --- a/lldb/test/API/lit.site.cfg.py.in +++ b/lldb/test/API/lit.site.cfg.py.in @@ -20,7 +20,8 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" config.target_triple = "@LLVM_TARGET_TRIPLE@" config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@" config.python_executable = "@Python3_EXECUTABLE@" -config.lua_executable = "@Lua_EXECUTABLE@" +config.lua_executable
[Lldb-commits] [lldb] [lldb] (Begin to) support discontinuous lldb_private::Functions (PR #115730)
https://github.com/labath updated https://github.com/llvm/llvm-project/pull/115730 >From 39a29e37cfcd3d581c488605959c9a7c9ada5d69 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 11 Nov 2024 16:49:38 +0100 Subject: [PATCH 1/3] [lldb] (Begin to) support discontinuous lldb_private::Functions This is the beginning of a different, more fundamental approach to handling. This PR tries to tries to minimize functional changes. It only makes sure that we store the true set of ranges inside the function object, so that subsequent patches can make use of it. --- lldb/include/lldb/Symbol/Function.h | 8 +++- .../Breakpad/SymbolFileBreakpad.cpp | 2 +- .../Plugins/SymbolFile/CTF/SymbolFileCTF.cpp | 2 +- .../Plugins/SymbolFile/DWARF/DWARFASTParser.h | 2 +- .../SymbolFile/DWARF/DWARFASTParserClang.cpp | 20 +- .../SymbolFile/DWARF/DWARFASTParserClang.h| 2 +- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 33 ++-- .../NativePDB/SymbolFileNativePDB.cpp | 2 +- .../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp | 6 +-- .../SymbolFile/Symtab/SymbolFileSymtab.cpp| 2 +- lldb/source/Symbol/Function.cpp | 39 ++- 11 files changed, 64 insertions(+), 54 deletions(-) diff --git a/lldb/include/lldb/Symbol/Function.h b/lldb/include/lldb/Symbol/Function.h index 8255c2baea7700..bbfc25fe74ea06 100644 --- a/lldb/include/lldb/Symbol/Function.h +++ b/lldb/include/lldb/Symbol/Function.h @@ -428,7 +428,7 @@ class Function : public UserID, public SymbolContextScope { /// The section offset based address for this function. Function(CompileUnit *comp_unit, lldb::user_id_t func_uid, lldb::user_id_t func_type_uid, const Mangled &mangled, - Type *func_type, const AddressRange &range); + Type *func_type, AddressRanges ranges); /// Destructor. ~Function() override; @@ -649,8 +649,12 @@ class Function : public UserID, public SymbolContextScope { /// All lexical blocks contained in this function. Block m_block; + /// List of address ranges belonging to the function. + AddressRanges m_ranges; + /// The function address range that covers the widest range needed to contain - /// all blocks + /// all blocks. DEPRECATED: do not use this field in new code as the range may + /// include addresses belonging to other functions. AddressRange m_range; /// The frame base expression for variables that are relative to the frame diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp index 9e78ba8174e3d5..fadc19676609bf 100644 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -255,7 +255,7 @@ FunctionSP SymbolFileBreakpad::GetOrCreateFunction(CompileUnit &comp_unit) { section_sp, address - section_sp->GetFileAddress(), record->Size); // Use the CU's id because every CU has only one function inside. func_sp = std::make_shared(&comp_unit, id, 0, func_name, - nullptr, func_range); + nullptr, AddressRanges{func_range}); comp_unit.AddFunction(func_sp); } } diff --git a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp index bb738c3dcc54a0..15e8d38e7f334b 100644 --- a/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp +++ b/lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp @@ -829,7 +829,7 @@ size_t SymbolFileCTF::ParseFunctions(CompileUnit &cu) { lldb::user_id_t func_uid = m_functions.size(); FunctionSP function_sp = std::make_shared( &cu, func_uid, function_type_uid, symbol->GetMangled(), type_sp.get(), - func_range); + AddressRanges{func_range}); m_functions.emplace_back(function_sp); cu.AddFunction(function_sp); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h index 971cbe47fb702d..80f7becc1b24ba 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h @@ -42,7 +42,7 @@ class DWARFASTParser { virtual Function *ParseFunctionFromDWARF(CompileUnit &comp_unit, const DWARFDIE &die, - const AddressRange &range) = 0; + AddressRanges ranges) = 0; virtual bool CompleteTypeFromDWARF(const DWARFDIE &die, Type *type, const CompilerType &compiler_type) = 0; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index a30d898a93cc4d..66b9013de34179 100644 --- a/lldb/source/Plugin
[Lldb-commits] [lldb] [lldb] (Begin to) support discontinuous lldb_private::Functions (PR #115730)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 00a1f1ab71302d190f8059d86a53ec62485fbce9 39a29e37cfcd3d581c488605959c9a7c9ada5d69 --extensions h,cpp -- lldb/include/lldb/Symbol/Function.h lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp lldb/source/Symbol/Function.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 66b9013de3..b69b433fde 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -2340,10 +2340,8 @@ DWARFASTParserClang::ConstructDemangledNameFromDWARF(const DWARFDIE &die) { return ConstString(sstr.GetString()); } -Function * -DWARFASTParserClang::ParseFunctionFromDWARF(CompileUnit &comp_unit, -const DWARFDIE &die, -AddressRanges func_ranges) { +Function *DWARFASTParserClang::ParseFunctionFromDWARF( +CompileUnit &comp_unit, const DWARFDIE &die, AddressRanges func_ranges) { DWARFRangeList unused_func_ranges; const char *name = nullptr; const char *mangled = nullptr; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 30553567fe..666595a6d0 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -918,7 +918,6 @@ Function *SymbolFileDWARF::ParseFunction(CompileUnit &comp_unit, if (!dwarf_ast) return nullptr; - AddressRanges ranges; ModuleSP module_sp(die.GetModule()); for (const auto &range : die.GetDIE()->GetAttributeAddressRanges( diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp index fd53465140..46bb62d9d4 100644 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -262,7 +262,7 @@ AddressRange CollapseRanges(llvm::ArrayRef ranges) { Address lowest_addr = ranges[0].GetBaseAddress(); addr_t highest_addr = lowest_addr.GetFileAddress() + ranges[0].GetByteSize(); - for (const AddressRange &range: ranges.drop_front()) { + for (const AddressRange &range : ranges.drop_front()) { Address range_begin = range.GetBaseAddress(); addr_t range_end = range_begin.GetFileAddress() + range.GetByteSize(); if (range_begin.GetFileAddress() < lowest_addr.GetFileAddress()) `` https://github.com/llvm/llvm-project/pull/115730 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Implement basic support for reverse-continue (PR #112079)
jimingham wrote: We have another negotiation among the threads that want to run with other threads suspended. We let all the threads that want to run with others suspended go in a round robin and only when there are none of those left do we let the "run all threads" plans do their thing. Maybe there's a similar principle we can come up with here. Let all the backwards running threads run till they are done and then make forward progress. Then to handle things like "forward execution of a function call plan while backwards execution" by having thread plans have an "actual run direction" - which is "forward" or "backwards" and a "run intention" - which is "forward", "backwards" or "no opinion". If a plan has no intention, then we query its parent. When we're querying the threads to see who is forward going and who backwards, we'd use the "run intention". Function calling thread plans would have "no intention" so they wouldn't move their "backwards" running threads into the forward camp... https://github.com/llvm/llvm-project/pull/112079 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix inline_sites_live.cpp Shell test on Linux remote (PR #115722)
https://github.com/dzhidzhoev edited https://github.com/llvm/llvm-project/pull/115722 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix inline_sites_live.cpp Shell test on Linux remote (PR #115722)
https://github.com/dzhidzhoev edited https://github.com/llvm/llvm-project/pull/115722 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)
@@ -0,0 +1,26 @@ +""" +Test that disabling breakpoints and viewing them in a list uses the correct ANSI color settings when colors are enabled and disabled. +""" + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil +from lldbsuite.test.lldbpexpect import PExpectTest + +import io + + +class DisabledBreakpointsTest(PExpectTest): +@add_test_categories(["pexpect"]) +def test_disabling_breakpoints_with_color(self): +"""Test that disabling a breakpoint and viewing the breakpoints list uses the specified ANSI color prefix.""" +ansi_red_color_code = "\x1b[31m" + +self.launch(use_colors=True, dimensions=(100, 100)) +self.expect('settings set disable-breakpoint-ansi-prefix "${ansi.fg.red}"') +self.expect("b main") +self.expect("br dis") +self.expect("br l") +self.child.expect_exact(ansi_red_color_code + "1:") chelcassanova wrote: Thanks for the suggestion to use `substrs` here! By "expectations" you just mean adding a `self.expect` after all the previous commands to check that their output is fine right? If so then yeah I can add that 👍🏾 https://github.com/llvm/llvm-project/pull/91404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added new plugin AIX-DYLD (Dynamic Loader) Base Support (PR #115714)
labath wrote: It's very hard to review this without seeing the related code as well (who calls On(Un)loadModule and why?), and I don't think it's a high priority for review/upstreaming. You should be able to go quite a long way without a dynamic loader plugin. The first thing you need to do it get the basic functionality covered. Parsing object files, reading registers (object file and process plugins) as well as all of the changes in common code (what's up with those hacks in the DWARF parser?). I would expect the dynamic loader to be one of the last things you need to implement. https://github.com/llvm/llvm-project/pull/115714 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added XCOFF Object File Header for AIX (PR #111814)
https://github.com/labath approved this pull request. Looks good. Thanks. Do you need someone to push the merge button? https://github.com/llvm/llvm-project/pull/111814 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added XCOFF Object File Header for AIX (PR #111814)
DhruvSrivastavaX wrote: > Looks good. Thanks. Do you need someone to push the merge button? Ok, great. Yes, please merge it, I don't have the permission to do that yet. https://github.com/llvm/llvm-project/pull/111814 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix inline_sites_live.cpp Shell test on Linux remote (PR #115722)
labath wrote: How can you run a PDB test on a linux machine? https://github.com/llvm/llvm-project/pull/115722 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fix: Target Process may crash on detaching process on windows (PR #115712)
labath wrote: So, it sounds like this is fixing test/API/commands/process/detach-resumes/TestDetachResumes.py (which is linked to #89077, which may be a dupe of the bug you're referencing), so the first step would be to figure out whether this test actually passes with your patch. Note that the test was never successfully run on windows, so you may need to tweak it a bit to make it windows compatible (I don't see anything that should be a problem for windows, but it's very easy for os assumptions to sneak in). I'm not really familiar with windows APIs, but the change doesn't seem particularly controversial. https://github.com/llvm/llvm-project/pull/115712 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)
@@ -0,0 +1,26 @@ +""" +Test that disabling breakpoints and viewing them in a list uses the correct ANSI color settings when colors are enabled and disabled. +""" + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil +from lldbsuite.test.lldbpexpect import PExpectTest + +import io + + +class DisabledBreakpointsTest(PExpectTest): +@add_test_categories(["pexpect"]) +def test_disabling_breakpoints_with_color(self): +"""Test that disabling a breakpoint and viewing the breakpoints list uses the specified ANSI color prefix.""" +ansi_red_color_code = "\x1b[31m" + +self.launch(use_colors=True, dimensions=(100, 100)) +self.expect('settings set disable-breakpoint-ansi-prefix "${ansi.fg.red}"') +self.expect("b main") +self.expect("br dis") +self.expect("br l") +self.child.expect_exact(ansi_red_color_code + "1:") labath wrote: What I meant was adding a `substr` argument to the existing `expect` calls (e.g. `self.expect("br dis", substrs=["All breakpoints disabled."])`), not adding new expect calls. https://github.com/llvm/llvm-project/pull/91404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] (Begin to) support discontinuous lldb_private::Functions (PR #115730)
https://github.com/JDevlieghere approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/115730 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] (Begin to) support discontinuous lldb_private::Functions (PR #115730)
@@ -254,12 +254,32 @@ Function *IndirectCallEdge::GetCallee(ModuleList &images, /// @} +AddressRange CollapseRanges(llvm::ArrayRef ranges) { + if (ranges.empty()) +return AddressRange(); + if (ranges.size() == 1) +return ranges[0]; + + Address lowest_addr = ranges[0].GetBaseAddress(); + addr_t highest_addr = lowest_addr.GetFileAddress() + ranges[0].GetByteSize(); + for (const AddressRange &range : ranges.drop_front()) { +Address range_begin = range.GetBaseAddress(); +addr_t range_end = range_begin.GetFileAddress() + range.GetByteSize(); +if (range_begin.GetFileAddress() < lowest_addr.GetFileAddress()) + lowest_addr = range_begin; +if (range_end > highest_addr) + highest_addr = range_end; + } + return AddressRange(lowest_addr, highest_addr - lowest_addr.GetFileAddress()); JDevlieghere wrote: I can't help but think you don't actually need the `highest_addr` and you could just keep extending the byte size of the range, but maybe I'm missing something? https://github.com/llvm/llvm-project/pull/115730 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] (Begin to) support discontinuous lldb_private::Functions (PR #115730)
https://github.com/JDevlieghere edited https://github.com/llvm/llvm-project/pull/115730 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
@@ -1062,6 +1063,16 @@ void request_breakpointLocations(const llvm::json::Object &request) { continue; if (line == end_line && column > end_column) continue; + + // Make sure we are in the right file. + // We might have a match on line & column range and still + // be in the wrong file, e.g. for included files. + if (std::string_view(line_entry.GetFileSpec().GetFilename()) != labath wrote: FWIW, these strings are coming from lldb's string pool, so you should be able to just compare the raw pointers for equality. https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] Support column breakpoints (PR #113787)
https://github.com/labath approved this pull request. https://github.com/llvm/llvm-project/pull/113787 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits