[Lldb-commits] [PATCH] D123401: [lldb] Fix debug_info decorators for NO_DEBUG_INFO_TESTCASE
labath added a comment. Thanks. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123401/new/ https://reviews.llvm.org/D123401 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D121631: Introduce new symbol on-demand for debug info
labath added a comment. Yes, I think that's exactly what I had in mind. Basically, the idea is to structure things such that the ondemand class can sit between the actual symbol file class and the outside world, but that it does not (and cannot) interfere with any of the interactions that happen inside a symbol file class. If it works, I think that kind of a setup would be much cleaner/understandable. As it stands now, one has to consider the possibility that any action inside the real symbol file can reenter the ondemand instance, which makes it harder to reason about. I definitely wouldn't want to do it as a part of this patch, but it would be better to do it as a preparatory patch rather than a followup. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121631/new/ https://reviews.llvm.org/D121631 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D123793: [lldb] Handle empty search string in "memory find"
DavidSpickett created this revision. Herald added a project: All. DavidSpickett requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits. Given that you'd never find empty string, just error. Also add a test that an invalid expr generates an error. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D123793 Files: lldb/source/Commands/CommandObjectMemory.cpp lldb/test/API/functionalities/memory/find/TestMemoryFind.py Index: lldb/test/API/functionalities/memory/find/TestMemoryFind.py === --- lldb/test/API/functionalities/memory/find/TestMemoryFind.py +++ lldb/test/API/functionalities/memory/find/TestMemoryFind.py @@ -41,6 +41,11 @@ # Test the memory find commands. +# Empty search string should be handled. +self.expect('memory find -s "" `stringdata` `stringdata+16`', +error=True, +substrs=["error: search string must have non-zero length."]) + self.expect( 'memory find -s "in const" `stringdata` `stringdata+(int)strlen(stringdata)`', substrs=[ @@ -48,6 +53,12 @@ '69 6e 20 63', 'in const']) +# Invalid expr is an error. +self.expect( +'memory find -e "not_a_symbol" `&bytedata[0]` `&bytedata[15]`', +error=True, +substrs=["error: expression evaluation failed. pass a string instead"]) + self.expect( 'memory find -e "(uint8_t)0x22" `&bytedata[0]` `&bytedata[15]`', substrs=[ Index: lldb/source/Commands/CommandObjectMemory.cpp === --- lldb/source/Commands/CommandObjectMemory.cpp +++ lldb/source/Commands/CommandObjectMemory.cpp @@ -1052,9 +1052,14 @@ DataBufferHeap buffer; -if (m_memory_options.m_string.OptionWasSet()) - buffer.CopyData(m_memory_options.m_string.GetStringValue()); -else if (m_memory_options.m_expr.OptionWasSet()) { +if (m_memory_options.m_string.OptionWasSet()) { + llvm::StringRef str = m_memory_options.m_string.GetStringValue(); + if (str.empty()) { +result.AppendError("search string must have non-zero length."); +return false; + } + buffer.CopyData(str); +} else if (m_memory_options.m_expr.OptionWasSet()) { StackFrame *frame = m_exe_ctx.GetFramePtr(); ValueObjectSP result_sp; if ((eExpressionCompleted == Index: lldb/test/API/functionalities/memory/find/TestMemoryFind.py === --- lldb/test/API/functionalities/memory/find/TestMemoryFind.py +++ lldb/test/API/functionalities/memory/find/TestMemoryFind.py @@ -41,6 +41,11 @@ # Test the memory find commands. +# Empty search string should be handled. +self.expect('memory find -s "" `stringdata` `stringdata+16`', +error=True, +substrs=["error: search string must have non-zero length."]) + self.expect( 'memory find -s "in const" `stringdata` `stringdata+(int)strlen(stringdata)`', substrs=[ @@ -48,6 +53,12 @@ '69 6e 20 63', 'in const']) +# Invalid expr is an error. +self.expect( +'memory find -e "not_a_symbol" `&bytedata[0]` `&bytedata[15]`', +error=True, +substrs=["error: expression evaluation failed. pass a string instead"]) + self.expect( 'memory find -e "(uint8_t)0x22" `&bytedata[0]` `&bytedata[15]`', substrs=[ Index: lldb/source/Commands/CommandObjectMemory.cpp === --- lldb/source/Commands/CommandObjectMemory.cpp +++ lldb/source/Commands/CommandObjectMemory.cpp @@ -1052,9 +1052,14 @@ DataBufferHeap buffer; -if (m_memory_options.m_string.OptionWasSet()) - buffer.CopyData(m_memory_options.m_string.GetStringValue()); -else if (m_memory_options.m_expr.OptionWasSet()) { +if (m_memory_options.m_string.OptionWasSet()) { + llvm::StringRef str = m_memory_options.m_string.GetStringValue(); + if (str.empty()) { +result.AppendError("search string must have non-zero length."); +return false; + } + buffer.CopyData(str); +} else if (m_memory_options.m_expr.OptionWasSet()) { StackFrame *frame = m_exe_ctx.GetFramePtr(); ValueObjectSP result_sp; if ((eExpressionCompleted == ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D123793: [lldb] Handle empty search string in "memory find"
DavidSpickett added a comment. Previously this would crash. Unless we'd rather treat it as `\x0` but that could be confusing. You can always search for literal 0 instead. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123793/new/ https://reviews.llvm.org/D123793 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D123698: [lldb] Port Process::PrintWarning* to use the new diagnostic events
kastiglione accepted this revision. kastiglione added inline comments. This revision is now accepted and ready to land. Comment at: lldb/include/lldb/Core/Module.h:820-825 + void ReportWarningOptimization( + llvm::Optional debugger_id = llvm::None); + + void ReportWarningUnsupportedLanguage( + lldb::LanguageType language, + llvm::Optional debugger_id = llvm::None); In this diff, it seems the debugger_id is always given. Is the `Optional`ality for future uses? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123698/new/ https://reviews.llvm.org/D123698 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D123698: [lldb] Port Process::PrintWarning* to use the new diagnostic events
JDevlieghere marked an inline comment as done. JDevlieghere added inline comments. Comment at: lldb/include/lldb/Core/Module.h:820-825 + void ReportWarningOptimization( + llvm::Optional debugger_id = llvm::None); + + void ReportWarningUnsupportedLanguage( + lldb::LanguageType language, + llvm::Optional debugger_id = llvm::None); kastiglione wrote: > In this diff, it seems the debugger_id is always given. Is the > `Optional`ality for future uses? Yeah, my thinking was that modules are rarely tied to a single debugger, but these particular function are only called from the process. I'll make them non-optional. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123698/new/ https://reviews.llvm.org/D123698 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D123092: [LLDB][NativePDB] Fix inline line info in line table
zequanwu added a comment. Ping. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123092/new/ https://reviews.llvm.org/D123092 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D122943: [LLDB][NativePDB] Fix a crash when S_DEFRANGE_SUBFIELD_REGISTER descirbes a simple type
zequanwu added a comment. Ping. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122943/new/ https://reviews.llvm.org/D122943 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 64d9b23 - [lldb] Prevent crash when adding a stop hook with --shlib
Author: Jonas Devlieghere Date: 2022-04-14T11:00:21-07:00 New Revision: 64d9b233b9905a951b450eff5b258707a35e110f URL: https://github.com/llvm/llvm-project/commit/64d9b233b9905a951b450eff5b258707a35e110f DIFF: https://github.com/llvm/llvm-project/commit/64d9b233b9905a951b450eff5b258707a35e110f.diff LOG: [lldb] Prevent crash when adding a stop hook with --shlib Currently, lldb crashes when adding a stop hook with --shlib because we unconditionally use the target in SymbolContextSpecifier::AddSpecification. This patch prevents the crash and add a test. rdar://68524781 Differential revision: https://reviews.llvm.org/D123746 Added: lldb/test/Shell/Commands/command-stop-hook-no-target.test Modified: lldb/source/Symbol/SymbolContext.cpp Removed: diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index 2985a39462aae..33999fabca434 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -960,8 +960,9 @@ bool SymbolContextSpecifier::AddSpecification(const char *spec_string, // See if we can find the Module, if so stick it in the SymbolContext. FileSpec module_file_spec(spec_string); ModuleSpec module_spec(module_file_spec); -lldb::ModuleSP module_sp( -m_target_sp->GetImages().FindFirstModule(module_spec)); +lldb::ModuleSP module_sp = +m_target_sp ? m_target_sp->GetImages().FindFirstModule(module_spec) +: nullptr; m_type |= eModuleSpecified; if (module_sp) m_module_sp = module_sp; diff --git a/lldb/test/Shell/Commands/command-stop-hook-no-target.test b/lldb/test/Shell/Commands/command-stop-hook-no-target.test new file mode 100644 index 0..ee9ded164d745 --- /dev/null +++ b/lldb/test/Shell/Commands/command-stop-hook-no-target.test @@ -0,0 +1,4 @@ +# RUN: %clang_host -g %S/Inputs/main.c -o %t +# RUN: %lldb -b -o 'target stop-hook add --name test --shlib test -o "p 95000 + 126"' -o 'file %t' -o 'b main' -o 'r' 2>&1 | FileCheck %s +# CHECK: Stop hook #1 added +# CHECK-NOT: 95126 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 99d9c44 - [lldb] Port Process::PrintWarning* to use the new diagnostic events
Author: Jonas Devlieghere Date: 2022-04-14T11:00:21-07:00 New Revision: 99d9c44434f57df5f188146925eea3bd8771260d URL: https://github.com/llvm/llvm-project/commit/99d9c44434f57df5f188146925eea3bd8771260d DIFF: https://github.com/llvm/llvm-project/commit/99d9c44434f57df5f188146925eea3bd8771260d.diff LOG: [lldb] Port Process::PrintWarning* to use the new diagnostic events Port the two Process::PrintWarning functions to use the new diagnostic events through Debugger::ReportWarning. I kept the wrapper function in the process, but delegated the work to the Module. Consistent with the current code, the Module ensures the warning is only printed once per module. Differential revision: https://reviews.llvm.org/D123698 Added: Modified: lldb/include/lldb/Core/Module.h lldb/include/lldb/Target/Process.h lldb/source/Core/Module.cpp lldb/source/Target/Process.cpp lldb/test/Shell/Process/Optimization.test lldb/test/Shell/Process/UnsupportedLanguage.test Removed: diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index f6c32586eda84..c97abeade2725 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -817,6 +817,12 @@ class Module : public std::enable_shared_from_this, void ReportErrorIfModifyDetected(const char *format, ...) __attribute__((format(printf, 2, 3))); + void ReportWarningOptimization(llvm::Optional debugger_id); + + void + ReportWarningUnsupportedLanguage(lldb::LanguageType language, + llvm::Optional debugger_id); + // Return true if the file backing this module has changed since the module // was originally created since we saved the initial file modification time // when the module first gets created. @@ -1053,6 +1059,9 @@ class Module : public std::enable_shared_from_this, /// time for the symbol tables can be aggregated here. StatsDuration m_symtab_index_time; + std::once_flag m_optimization_warning; + std::once_flag m_language_warning; + /// Resolve a file or load virtual address. /// /// Tries to resolve \a vm_addr as a file address (if \a diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 7d8fbb7797d89..c8e874f3bd416 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -365,9 +365,6 @@ class Process : public std::enable_shared_from_this, eBroadcastInternalStateControlResume = (1 << 2) }; - /// Process warning types. - enum Warnings { eWarningsOptimization = 1, eWarningsUnsupportedLanguage = 2 }; - typedef Range LoadRange; // We use a read/write lock to allow on or more clients to access the process // state while the process is stopped (reader). We lock the write lock to @@ -2637,35 +2634,6 @@ void PruneThreadPlans(); // Called internally void CompleteAttach(); - /// Print a user-visible warning one time per Process - /// - /// A facility for printing a warning to the user once per repeat_key. - /// - /// warning_type is from the Process::Warnings enums. repeat_key is a - /// pointer value that will be used to ensure that the warning message is - /// not printed multiple times. For instance, with a warning about a - /// function being optimized, you can pass the CompileUnit pointer to have - /// the warning issued for only the first function in a CU, or the Function - /// pointer to have it issued once for every function, or a Module pointer - /// to have it issued once per Module. - /// - /// Classes outside Process should call a specific PrintWarning method so - /// that the warning strings are all centralized in Process, instead of - /// calling PrintWarning() directly. - /// - /// \param [in] warning_type - /// One of the types defined in Process::Warnings. - /// - /// \param [in] repeat_key - /// A pointer value used to ensure that the warning is only printed once. - /// May be nullptr, indicating that the warning is printed unconditionally - /// every time. - /// - /// \param [in] fmt - /// printf style format string - void PrintWarning(uint64_t warning_type, const void *repeat_key, -const char *fmt, ...) __attribute__((format(printf, 4, 5))); - // NextEventAction provides a way to register an action on the next event // that is delivered to this process. There is currently only one next event // action allowed in the process at one time. If a new "NextEventAction" is @@ -2830,8 +2798,6 @@ void PruneThreadPlans(); // Type definitions typedef std::map LanguageRuntimeCollection; - typedef std::unordered_set WarningsPointerSet; - typedef std::map WarningsCollection; struct PreResumeCallbackAndBaton { bool (*callback)(void *); @@ -2961,11 +2927,9 @@ void PruneThreadPlans(); ///
[Lldb-commits] [PATCH] D123698: [lldb] Port Process::PrintWarning* to use the new diagnostic events
This revision was automatically updated to reflect the committed changes. JDevlieghere marked an inline comment as done. Closed by commit rG99d9c44434f5: [lldb] Port Process::PrintWarning* to use the new diagnostic events (authored by JDevlieghere). Herald added a project: LLDB. Changed prior to commit: https://reviews.llvm.org/D123698?vs=422647&id=422916#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123698/new/ https://reviews.llvm.org/D123698 Files: lldb/include/lldb/Core/Module.h lldb/include/lldb/Target/Process.h lldb/source/Core/Module.cpp lldb/source/Target/Process.cpp lldb/test/Shell/Process/Optimization.test lldb/test/Shell/Process/UnsupportedLanguage.test Index: lldb/test/Shell/Process/UnsupportedLanguage.test === --- lldb/test/Shell/Process/UnsupportedLanguage.test +++ lldb/test/Shell/Process/UnsupportedLanguage.test @@ -3,6 +3,6 @@ RUN: %clang_host %S/Inputs/true.c -std=c99 -g -c -S -emit-llvm -o - \ RUN: | sed -e 's/DW_LANG_C99/DW_LANG_Mips_Assembler/g' >%t.ll RUN: %clang_host %t.ll -g -o %t.exe -RUN: %lldb -o "b main" -o r -o q -b %t.exe | FileCheck %s +RUN: %lldb -o "b main" -o r -o q -b %t.exe 2>&1 | FileCheck %s CHECK: This version of LLDB has no plugin for the language "assembler" Index: lldb/test/Shell/Process/Optimization.test === --- lldb/test/Shell/Process/Optimization.test +++ lldb/test/Shell/Process/Optimization.test @@ -1,6 +1,6 @@ Test warnings. REQUIRES: shell, system-darwin RUN: %clang_host -O3 %S/Inputs/true.c -std=c99 -g -o %t.exe -RUN: %lldb -o "b main" -o r -o q -b %t.exe | FileCheck %s +RUN: %lldb -o "b main" -o r -o q -b %t.exe 2>&1 | FileCheck %s CHECK: compiled with optimization Index: lldb/source/Target/Process.cpp === --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -436,8 +436,8 @@ m_private_run_lock(), m_finalizing(false), m_clear_thread_plans_on_stop(false), m_force_next_event_delivery(false), m_last_broadcast_state(eStateInvalid), m_destroy_in_process(false), - m_can_interpret_function_calls(false), m_warnings_issued(), - m_run_thread_plan_lock(), m_can_jit(eCanJITDontKnow) { + m_can_interpret_function_calls(false), m_run_thread_plan_lock(), + m_can_jit(eCanJITDontKnow) { CheckInWithManager(); Log *log = GetLog(LLDBLog::Object); @@ -5697,48 +5697,12 @@ } } -void Process::PrintWarning(uint64_t warning_type, const void *repeat_key, - const char *fmt, ...) { - bool print_warning = true; - - StreamSP stream_sp = GetTarget().GetDebugger().GetAsyncOutputStream(); - if (!stream_sp) -return; - - if (repeat_key != nullptr) { -WarningsCollection::iterator it = m_warnings_issued.find(warning_type); -if (it == m_warnings_issued.end()) { - m_warnings_issued[warning_type] = WarningsPointerSet(); - m_warnings_issued[warning_type].insert(repeat_key); -} else { - if (it->second.find(repeat_key) != it->second.end()) { -print_warning = false; - } else { -it->second.insert(repeat_key); - } -} - } - - if (print_warning) { -va_list args; -va_start(args, fmt); -stream_sp->PrintfVarArg(fmt, args); -va_end(args); - } -} - void Process::PrintWarningOptimization(const SymbolContext &sc) { if (!GetWarningsOptimization()) return; - if (!sc.module_sp) + if (!sc.module_sp || !sc.function || !sc.function->GetIsOptimized()) return; - if (!sc.module_sp->GetFileSpec().GetFilename().IsEmpty() && sc.function && - sc.function->GetIsOptimized()) { -PrintWarning(Process::Warnings::eWarningsOptimization, sc.module_sp.get(), - "%s was compiled with optimization - stepping may behave " - "oddly; variables may not be available.\n", - sc.module_sp->GetFileSpec().GetFilename().GetCString()); - } + sc.module_sp->ReportWarningOptimization(GetTarget().GetDebugger().GetID()); } void Process::PrintWarningUnsupportedLanguage(const SymbolContext &sc) { @@ -5751,13 +5715,10 @@ return; LanguageSet plugins = PluginManager::GetAllTypeSystemSupportedLanguagesForTypes(); - if (!plugins[language]) { -PrintWarning(Process::Warnings::eWarningsUnsupportedLanguage, - sc.module_sp.get(), - "This version of LLDB has no plugin for the language \"%s\". " - "Inspection of frame variables will be limited.\n", - Language::GetNameForLanguageType(language)); - } + if (plugins[language]) +return; + sc.module_sp->ReportWarningUnsupportedLanguage( + language, GetTarget().GetDebugger().GetID()); } bool Process::GetProcessInfo(ProcessInstanceInfo &info) { Index: lldb/source/Core/Module.cpp ===
[Lldb-commits] [PATCH] D123746: [lldb] Prevent crash when adding a stop hook with --shlib
This revision was automatically updated to reflect the committed changes. Closed by commit rG64d9b233b990: [lldb] Prevent crash when adding a stop hook with --shlib (authored by JDevlieghere). Herald added a project: LLDB. Changed prior to commit: https://reviews.llvm.org/D123746?vs=422695&id=422915#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123746/new/ https://reviews.llvm.org/D123746 Files: lldb/source/Symbol/SymbolContext.cpp lldb/test/Shell/Commands/command-stop-hook-no-target.test Index: lldb/test/Shell/Commands/command-stop-hook-no-target.test === --- /dev/null +++ lldb/test/Shell/Commands/command-stop-hook-no-target.test @@ -0,0 +1,4 @@ +# RUN: %clang_host -g %S/Inputs/main.c -o %t +# RUN: %lldb -b -o 'target stop-hook add --name test --shlib test -o "p 95000 + 126"' -o 'file %t' -o 'b main' -o 'r' 2>&1 | FileCheck %s +# CHECK: Stop hook #1 added +# CHECK-NOT: 95126 Index: lldb/source/Symbol/SymbolContext.cpp === --- lldb/source/Symbol/SymbolContext.cpp +++ lldb/source/Symbol/SymbolContext.cpp @@ -960,8 +960,9 @@ // See if we can find the Module, if so stick it in the SymbolContext. FileSpec module_file_spec(spec_string); ModuleSpec module_spec(module_file_spec); -lldb::ModuleSP module_sp( -m_target_sp->GetImages().FindFirstModule(module_spec)); +lldb::ModuleSP module_sp = +m_target_sp ? m_target_sp->GetImages().FindFirstModule(module_spec) +: nullptr; m_type |= eModuleSpecified; if (module_sp) m_module_sp = module_sp; Index: lldb/test/Shell/Commands/command-stop-hook-no-target.test === --- /dev/null +++ lldb/test/Shell/Commands/command-stop-hook-no-target.test @@ -0,0 +1,4 @@ +# RUN: %clang_host -g %S/Inputs/main.c -o %t +# RUN: %lldb -b -o 'target stop-hook add --name test --shlib test -o "p 95000 + 126"' -o 'file %t' -o 'b main' -o 'r' 2>&1 | FileCheck %s +# CHECK: Stop hook #1 added +# CHECK-NOT: 95126 Index: lldb/source/Symbol/SymbolContext.cpp === --- lldb/source/Symbol/SymbolContext.cpp +++ lldb/source/Symbol/SymbolContext.cpp @@ -960,8 +960,9 @@ // See if we can find the Module, if so stick it in the SymbolContext. FileSpec module_file_spec(spec_string); ModuleSpec module_spec(module_file_spec); -lldb::ModuleSP module_sp( -m_target_sp->GetImages().FindFirstModule(module_spec)); +lldb::ModuleSP module_sp = +m_target_sp ? m_target_sp->GetImages().FindFirstModule(module_spec) +: nullptr; m_type |= eModuleSpecified; if (module_sp) m_module_sp = module_sp; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] ef7cba7 - [LLDB][NativePDB] Fix inline line info in line table
Author: Zequan Wu Date: 2022-04-14T11:00:56-07:00 New Revision: ef7cba71486df8d6905000f932805774f1cbcc46 URL: https://github.com/llvm/llvm-project/commit/ef7cba71486df8d6905000f932805774f1cbcc46 DIFF: https://github.com/llvm/llvm-project/commit/ef7cba71486df8d6905000f932805774f1cbcc46.diff LOG: [LLDB][NativePDB] Fix inline line info in line table It fixes the following case: ``` 0602 line 1 (+1) 0315 code 0x15 (+0x15) 0B2B code 0x20 (+0xB) line 2 (+1) 0602 line 3 (+1) 0311 code 0x31 (+0x11) ... ``` Inline ranges should have following mapping: `[0x15, 0x20) -> line 1` `[0x20, 0x31) -> line 2` Inline line entries: `0x15, line 1`, `0x20, line 2`, `0x31, line 3`. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D123092 Added: Modified: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/test/Shell/SymbolFile/NativePDB/Inputs/inline_sites.lldbinit lldb/test/Shell/SymbolFile/NativePDB/Inputs/inline_sites.s lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test Removed: diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp index 351c0bfc37f3d..00d4422bc979e 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -1303,8 +1303,8 @@ void SymbolFileNativePDB::ParseInlineSite(PdbCompilandSymId id, GetFileIndex(*cii, inlinee_line.Header->FileID); if (!file_index_or_err) return; - uint32_t decl_file_idx = file_index_or_err.get(); - decl_file = files.GetFileSpecAtIndex(decl_file_idx); + uint32_t file_offset = file_index_or_err.get(); + decl_file = files.GetFileSpecAtIndex(file_offset); uint32_t decl_line = inlinee_line.Header->SourceLineNum; std::unique_ptr decl_up = std::make_unique(decl_file, decl_line); @@ -1312,54 +1312,36 @@ void SymbolFileNativePDB::ParseInlineSite(PdbCompilandSymId id, // Parse range and line info. uint32_t code_offset = 0; int32_t line_offset = 0; - bool has_base = false; - bool is_new_line_offset = false; - - bool is_start_of_statement = false; + llvm::Optional code_offset_base; + llvm::Optional code_offset_end; + llvm::Optional cur_line_offset; + llvm::Optional next_line_offset; + llvm::Optional next_file_offset; + + bool is_terminal_entry = false; + bool is_start_of_statement = true; // The first instruction is the prologue end. bool is_prologue_end = true; - auto change_code_offset = [&](uint32_t code_delta) { -if (has_base) { - inline_site_sp->ranges.Append(RangeSourceLineVector::Entry( - code_offset, code_delta, decl_line + line_offset)); - is_prologue_end = false; - is_start_of_statement = false; -} else { - is_start_of_statement = true; -} -has_base = true; -code_offset += code_delta; - -if (is_new_line_offset) { - LineTable::Entry line_entry(func_base + code_offset, - decl_line + line_offset, 0, decl_file_idx, - true, false, is_prologue_end, false, false); - inline_site_sp->line_entries.push_back(line_entry); - is_new_line_offset = false; -} - }; - auto change_code_length = [&](uint32_t length) { -inline_site_sp->ranges.Append(RangeSourceLineVector::Entry( -code_offset, length, decl_line + line_offset)); -has_base = false; - -LineTable::Entry end_line_entry(func_base + code_offset + length, -decl_line + line_offset, 0, decl_file_idx, -false, false, false, false, true); -inline_site_sp->line_entries.push_back(end_line_entry); + auto update_code_offset = [&](uint32_t code_delta) { +if (!code_offset_base) + code_offset_base = code_offset; +else if (!code_offset_end) + code_offset_end = *code_offset_base + code_delta; }; - auto change_line_offset = [&](int32_t line_delta) { + auto update_line_offset = [&](int32_t line_delta) { line_offset += line_delta; -if (has_base) { - LineTable::Entry line_entry( - func_base + code_offset, decl_line + line_offset, 0, decl_file_idx, - is_start_of_statement, false, is_prologue_end, false, false); - inline_site_sp->line_entries.push_back(line_entry); -} else { - // Add line entry in next call to change_code_offset. - is_new_line_offset = true; -} +if (!code_offset_base || !cur_line_offset) + cur_line_offset = line_offset; +else + next_line_offset = line_offset; +; + }; + auto update_file_offset = [&](uint32_t offset) { +if (!code_offset_base) + file_offset = offset; +else + next_file_offset = offset; }; for (auto &annot : inline_site.annotations()) { @@ -1367,26 +1349,6
[Lldb-commits] [PATCH] D123092: [LLDB][NativePDB] Fix inline line info in line table
This revision was automatically updated to reflect the committed changes. Closed by commit rGef7cba71486d: [LLDB][NativePDB] Fix inline line info in line table (authored by zequanwu). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123092/new/ https://reviews.llvm.org/D123092 Files: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/test/Shell/SymbolFile/NativePDB/Inputs/inline_sites.lldbinit lldb/test/Shell/SymbolFile/NativePDB/Inputs/inline_sites.s lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test Index: lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test === --- lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test +++ lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test @@ -21,7 +21,8 @@ # CHECK-NEXT: 0x000140001035: /tmp/c.h:7 # CHECK-NEXT: 0x000140001039: /tmp/a.cpp:3 # CHECK-NEXT: 0x00014000103d: /tmp/a.cpp:4 -# CHECK-NEXT: 0x000140001044: /tmp/a.h:8, is_start_of_statement = TRUE +# CHECK-NEXT: 0x00014000103f: /tmp/a.h:20 +# CHECK-NEXT: 0x000140001044: /tmp/a.h:8 # CHECK-NEXT: 0x000140001046: /tmp/a.cpp:4, is_terminal_entry = TRUE #CHECK: (lldb) b a.h:5 @@ -31,7 +32,7 @@ #CHECK: (lldb) b a.h:7 #CHECK: Breakpoint 3: where = {{.*}}`main + 16 [inlined] Namespace1::foo + 12 at a.h:7, address = 0x000140001010 #CHECK: (lldb) b a.h:8 -#CHECK: Breakpoint 4: where = {{.*}}`main + 68 [inlined] Namespace1::foo at a.h:8, address = 0x000140001044 +#CHECK: Breakpoint 4: where = {{.*}}`main + 68 [inlined] Namespace1::foo + 5 at a.h:8, address = 0x000140001044 #CHECK: (lldb) b a.h:9 #CHECK: Breakpoint 5: where = {{.*}}`main + 24 [inlined] Namespace1::foo + 20 at a.h:9, address = 0x000140001018 #CHECK: (lldb) b b.h:5 @@ -50,8 +51,6 @@ #CHECK: Breakpoint 12: where = {{.*}}`main + 57 at a.cpp:3, address = 0x000140001039 #CHECK: (lldb) b a.cpp:4 #CHECK: Breakpoint 13: where = {{.*}}`main + 61 at a.cpp:4, address = 0x00014000103d -#CHECK: (lldb) b a.h:8 -#CHECK: Breakpoint 14: where = {{.*}}`main + 68 [inlined] Namespace1::foo at a.h:8, address = 0x000140001044 # CEHCK-LABEL: (lldb) image lookup -a 0x140001003 -v # CHECK: Summary: {{.*}}`main + 3 at a.cpp:2 @@ -66,7 +65,7 @@ # CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3 # CHECK: Function: id = {{.*}}, name = "main", range = [0x000140001000-0x000140001046) # CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046) -# CHECK-NEXT:id = {{.*}}, ranges = [0x140001004-0x140001039)[0x140001044-0x140001046), name = "Namespace1::foo", decl = a.h:4 +# CHECK-NEXT:id = {{.*}}, ranges = [0x140001004-0x140001039)[0x14000103f-0x140001046), name = "Namespace1::foo", decl = a.h:4 # CHECK: LineEntry: [0x000140001004-0x00014000100c): /tmp/a.h:5 # CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = [0x000140001004-0x000140001039) # CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = [0x000140001000-0x00014000102d) @@ -78,7 +77,7 @@ # CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3 # CHECK: Function: id = {{.*}}, name = "main", range = [0x000140001000-0x000140001046) # CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046) -# CHECK-NEXT:id = {{.*}}, ranges = [0x140001004-0x140001039)[0x140001044-0x140001046), name = "Namespace1::foo", decl = a.h:4 +# CHECK-NEXT:id = {{.*}}, ranges = [0x140001004-0x140001039)[0x14000103f-0x140001046), name = "Namespace1::foo", decl = a.h:4 # CHECK: LineEntry: [0x000140001010-0x000140001018): /tmp/a.h:7 # CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = [0x000140001004-0x000140001039) # CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = [0x000140001000-0x00014000102d) @@ -91,7 +90,7 @@ # CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3 # CHECK: Function: id = {{.*}}, name = "main", range = [0x000140001000-0x000140001046) # CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046) -# CHECK-NEXT:id = {{.*}}, ranges = [0x140001004-0x140001039)[0x140001044-0x140001046), name = "Namespace1::foo", decl = a.h:4 +# CHECK-NEXT:id = {{.*}}, ranges = [0x140001004-0x140001039)[0x14000103f-0x140001046), name = "Namespace1::foo", decl = a.h:4 # CHECK-NEXT:id = {{.*}}, range = [0x14000101c-0x140001039), name = "Class1::bar", decl = b.h:4 # CHECK: LineEntry: [0x00014000101c-0x000140001022): /tmp/b.h:5 # CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int", valid ranges = [0x00014000101c-0x00014000101e) @@ -108,7 +107,7 @@ # CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3 # CHECK: Function: id = {{.*}}, name = "main", range = [0x0001400
[Lldb-commits] [lldb] 3dbf524 - [LLDB][NativePDB] Fix a crash when S_DEFRANGE_SUBFIELD_REGISTER descirbes a simple type
Author: Zequan Wu Date: 2022-04-14T11:06:21-07:00 New Revision: 3dbf524ad75bf4aa6d4a1f72b82000943a1d967c URL: https://github.com/llvm/llvm-project/commit/3dbf524ad75bf4aa6d4a1f72b82000943a1d967c DIFF: https://github.com/llvm/llvm-project/commit/3dbf524ad75bf4aa6d4a1f72b82000943a1d967c.diff LOG: [LLDB][NativePDB] Fix a crash when S_DEFRANGE_SUBFIELD_REGISTER descirbes a simple type When a variable is simple type and has 64 bits, the debug info may look like the following when targeting 32bit windows. The variable's content is split into two 32bits registers. ``` 480 | S_LOCAL [size = 12] `x` type=0x0013 (__int64), flags = param 492 | S_DEFRANGE_SUBFIELD_REGISTER [size = 20] register = EAX, may have no name = true, offset in parent = 0 range = [0001:0073,+7), gaps = [] 512 | S_DEFRANGE_SUBFIELD_REGISTER [size = 20] register = ECX, may have no name = true, offset in parent = 4 range = [0001:0073,+7), gaps = [] ``` Reviewed By: labath Differential Revision: https://reviews.llvm.org/D122943 Added: lldb/test/Shell/SymbolFile/NativePDB/Inputs/subfield_register_simple_type.lldbinit lldb/test/Shell/SymbolFile/NativePDB/subfield_register_simple_type.s Modified: lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp Removed: diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp index 54fc8d505c958..1f0ca3f3d5d80 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp @@ -51,10 +51,11 @@ MakeRangeList(const PdbIndex &index, const LocalVariableAddrRange &range, namespace { struct FindMembersSize : public TypeVisitorCallbacks { - FindMembersSize(std::vector> &members_info, - TpiStream &tpi) + FindMembersSize( + llvm::SmallVectorImpl> &members_info, + TpiStream &tpi) : members_info(members_info), tpi(tpi) {} - std::vector> &members_info; + llvm::SmallVectorImpl> &members_info; TpiStream &tpi; llvm::Error visitKnownMember(CVMemberRecord &cvr, DataMemberRecord &member) override { @@ -670,7 +671,7 @@ VariableInfo lldb_private::npdb::GetVariableLocationInfo( result.ranges = std::move(ranges); } break; -} +} case S_DEFRANGE_REGISTER_REL: { DefRangeRegisterRelSym loc(SymbolRecordKind::DefRangeRegisterRelSym); cantFail(SymbolDeserializer::deserializeAs( @@ -707,22 +708,32 @@ VariableInfo lldb_private::npdb::GetVariableLocationInfo( break; } case S_DEFRANGE_SUBFIELD_REGISTER: { - CVType class_cvt = index.tpi().getType(result.type); - ClassRecord class_record = CVTagRecord::create(class_cvt).asClass(); - CVType field_list = index.tpi().getType(class_record.FieldList); - std::vector> members_info; - FindMembersSize find_members_size(members_info, index.tpi()); - if (llvm::Error err = - visitMemberRecordStream(field_list.data(), find_members_size)) -llvm::consumeError(std::move(err)); - - std::vector range_lists; + // A vector of register id and member size pairs. If the variable is a + // simple type, then we don't know the number of subfields. Otherwise, the + // vector size will be the number of subfields in the udt type. + llvm::SmallVector> members_info; + bool is_simple_type = result.type.isSimple(); + if (!is_simple_type) { +CVType class_cvt = index.tpi().getType(result.type); +ClassRecord class_record = CVTagRecord::create(class_cvt).asClass(); +CVType field_list = index.tpi().getType(class_record.FieldList); +FindMembersSize find_members_size(members_info, index.tpi()); +if (llvm::Error err = +visitMemberRecordStream(field_list.data(), find_members_size)) { + llvm::consumeError(std::move(err)); + break; +} + } + + uint32_t prev_offset = 0; uint32_t cur_offset = 0; size_t member_idx = 0; // Assuming S_DEFRANGE_SUBFIELD_REGISTER is followed only by // S_DEFRANGE_SUBFIELD_REGISTER, need to verify. - while (loc_specifier_cvs.kind() == S_DEFRANGE_SUBFIELD_REGISTER && - member_idx < members_info.size()) { + while (loc_specifier_cvs.kind() == S_DEFRANGE_SUBFIELD_REGISTER) { +if (!is_simple_type && member_idx >= members_info.size()) + break; + DefRangeSubfieldRegisterSym loc( SymbolRecordKind::DefRangeSubfieldRegisterSym); cantFail(SymbolDeserializer::deserializeAs( @@ -736,17 +747,27 @@ VariableInfo lldb_private::npdb::GetVariableLocationInfo( result.ranges->Sort(); } -// Some fields maybe optimized away and have no -// S_DEFRANGE_SUBFIELD_REGISTER to describe them. Skip them. -while (l
[Lldb-commits] [PATCH] D122943: [LLDB][NativePDB] Fix a crash when S_DEFRANGE_SUBFIELD_REGISTER descirbes a simple type
This revision was automatically updated to reflect the committed changes. Closed by commit rG3dbf524ad75b: [LLDB][NativePDB] Fix a crash when S_DEFRANGE_SUBFIELD_REGISTER descirbes a… (authored by zequanwu). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D122943/new/ https://reviews.llvm.org/D122943 Files: lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp lldb/test/Shell/SymbolFile/NativePDB/Inputs/subfield_register_simple_type.lldbinit lldb/test/Shell/SymbolFile/NativePDB/subfield_register_simple_type.s Index: lldb/test/Shell/SymbolFile/NativePDB/subfield_register_simple_type.s === --- /dev/null +++ lldb/test/Shell/SymbolFile/NativePDB/subfield_register_simple_type.s @@ -0,0 +1,433 @@ +# clang-format off +# REQUIRES: lld, x86 + +# RUN: %clang_cl --target=i386-windows-msvc -c /Fo%t.obj %s +# RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe /base:0x40 +# RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ +# RUN: %p/Inputs/subfield_register_simple_type.lldbinit 2>&1 | FileCheck %s + +# This file is compiled from following source file: +# clang-cl --target=i386-windows-msvc /Z7 /O1 -c /Fa a.cpp +# __int64 __attribute__((optnone)) bar(__int64 x) { return x; }; +# __int64 foo(__int64 x) { +# return bar(x); +# } +# +# int main(int argc, char** argv) { +# foo(argc); +# return 0; +# } + +# FIXME: The following variable location have wrong register numbers due to +# https://github.com/llvm/llvm-project/issues/53575. Fix them after resolving +# the issue. + +# CHECK: (lldb) image lookup -a 0x40102f -v +# CHECK: LineEntry: [0x00401026-0x00401039): C:\src\a.cpp:3 +# CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int64_t", valid ranges = [0x0040102f-0x00401036), location = DW_OP_reg0 EAX, DW_OP_piece 0x4, DW_OP_reg2 EDX, DW_OP_piece 0x4, decl = + + .text + .def @feat.00; + .scl 3; + .type 0; + .endef + .globl @feat.00 +.set @feat.00, 1 + .intel_syntax noprefix + .file "a.cpp" + .def "?bar@@YA_J_J@Z"; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,"?bar@@YA_J_J@Z" + .globl "?bar@@YA_J_J@Z"# -- Begin function ?bar@@YA_J_J@Z + .p2align 4, 0x90 +"?bar@@YA_J_J@Z": # @"?bar@@YA_J_J@Z" +Lfunc_begin0: + .cv_func_id 0 + .cv_file 1 "C:\\src\\a.cpp" "CB99424BC3DD1AB059A2DBC6841147F2" 1 + .cv_loc 0 1 1 0 # a.cpp:1:0 + .cv_fpo_proc "?bar@@YA_J_J@Z" 8 +# %bb.0:# %entry + push ebp + .cv_fpo_pushreg ebp + mov ebp, esp + .cv_fpo_setframe ebp + and esp, -8 + .cv_fpo_stackalign 8 + sub esp, 8 + .cv_fpo_stackalloc 8 + .cv_fpo_endprologue + mov eax, dword ptr [ebp + 8] + mov ecx, dword ptr [ebp + 12] + mov dword ptr [esp], eax + mov dword ptr [esp + 4], ecx +Ltmp0: + mov eax, dword ptr [esp] + mov edx, dword ptr [esp + 4] + mov esp, ebp + pop ebp + ret +Ltmp1: + .cv_fpo_endproc +Lfunc_end0: +# -- End function + .def "?foo@@YA_J_J@Z"; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,"?foo@@YA_J_J@Z" + .globl "?foo@@YA_J_J@Z"# -- Begin function ?foo@@YA_J_J@Z +"?foo@@YA_J_J@Z": # @"?foo@@YA_J_J@Z" +Lfunc_begin1: + .cv_func_id 1 + .cv_fpo_proc "?foo@@YA_J_J@Z" 8 +# %bb.0:# %entry + #DEBUG_VALUE: foo:x <- [DW_OP_plus_uconst 4] [$esp+0] + .cv_loc 1 1 3 0 # a.cpp:3:0 + jmp "?bar@@YA_J_J@Z"# TAILCALL +Ltmp2: + .cv_fpo_endproc +Lfunc_end1: +# -- End function + .def _main; + .scl 2; + .type 32; + .endef + .section .text,"xr",one_only,_main + .globl _main # -- Begin function main +_main: # @main +Lfunc_begin2: + .cv_func_id 2 + .cv_loc 2 1 6 0 # a.cpp:6:0 + .cv_fpo_proc _main 8 +# %bb.0:# %entry + #DEBUG_VALUE: main:argv <- [DW_OP_plus_uconst 8] [$esp+0] + #DEBUG_VALUE: main:argc <- [DW_OP_plus_uconst 4] [$esp+0] + .cv_inline_site_id 3 within 2 inlined_at 1 7 0 + .cv_loc 3 1 3 0 # a.cpp:3:0 + mov eax, dword ptr [esp + 4] + mov ecx, eax + sar ecx, 31 +Ltmp3: + #DEBUG_VALUE: foo:x <- [DW_OP_LLVM_fragment 0 32] $eax + #DEBUG_VALUE: foo:x <- [DW_OP_LLVM_fragment 32 32] $ecx + push ecx +Ltmp4: + push eax + call "?bar@@YA_J_J@Z" +Ltmp5: + add esp, 8 +Ltmp6: + .cv_loc 2 1 8 0 # a.cpp:8:0 + xor eax, eax + ret +Ltmp7: + .cv_fpo_endproc +Lfunc_end2: +# -- End function + .section .drectve,"yn" + .ascii " /DEFAULTLIB:libcmt.lib" + .ascii " /DEFAULTLIB:oldnames.lib" + .section .debug$S,"dr" + .p2align 2 + .long 4 # Debug section magic + .long 241 + .long Ltmp9-Ltmp8 # Subsection size +Ltmp8: + .short Ltmp11-Ltmp10
[Lldb-commits] [lldb] 428775d - [lldb] Remove TestShell.test
Author: Jonas Devlieghere Date: 2022-04-14T12:10:54-07:00 New Revision: 428775d5186fb075e76563c5ebab8607c3620a13 URL: https://github.com/llvm/llvm-project/commit/428775d5186fb075e76563c5ebab8607c3620a13 DIFF: https://github.com/llvm/llvm-project/commit/428775d5186fb075e76563c5ebab8607c3620a13.diff LOG: [lldb] Remove TestShell.test Remove TestShell.test because it's failing on the bot with "this is a non-interactive debug session, cannot get permission to debug processes." The only thing that's special about this test is the shell we're launching with. I need to do a bit of digging to understand why that's causing this error. rdar://91766931 Added: Modified: Removed: lldb/test/Shell/Process/TestShell.test diff --git a/lldb/test/Shell/Process/TestShell.test b/lldb/test/Shell/Process/TestShell.test deleted file mode 100644 index b08d8611d41f5..0 --- a/lldb/test/Shell/Process/TestShell.test +++ /dev/null @@ -1,8 +0,0 @@ -REQUIRES: shell, system-darwin -RUN: %clang_host %p/Inputs/echo.c -o %t.out - -RUN: not %lldb %t.out -b -o 'process launch --shell=tcsh -- $NO_SUCH_SHELL_VARIABLE' 2>&1 | FileCheck --check-prefix=FAILURE %s -RUN: %lldb %t.out -b -o 'process launch --shell=tcsh -- $HOME' 2>&1 | FileCheck --check-prefix=SUCCESS %s - -FAILURE: exited with status 1 -SUCCESS: exited with status = 0 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D123793: [lldb] Handle empty search string in "memory find"
JDevlieghere accepted this revision. JDevlieghere added a comment. This revision is now accepted and ready to land. LGTM Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123793/new/ https://reviews.llvm.org/D123793 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D123743: [lldb] Show the DBGError if dsymForUUID can't find a dSYM
jasonmolenda accepted this revision. jasonmolenda added a comment. This revision is now accepted and ready to land. LGTM. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123743/new/ https://reviews.llvm.org/D123743 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 03049c5 - Revert "[lldb] Pin the shared cache when iterating over its images"
Author: Jonas Devlieghere Date: 2022-04-14T16:23:56-07:00 New Revision: 03049c51251189b5aafed825095f3adcd52b3dee URL: https://github.com/llvm/llvm-project/commit/03049c51251189b5aafed825095f3adcd52b3dee DIFF: https://github.com/llvm/llvm-project/commit/03049c51251189b5aafed825095f3adcd52b3dee.diff LOG: Revert "[lldb] Pin the shared cache when iterating over its images" This reverts commit af969141fa285157044e34fb6b27963c3278241b because it didn't have the intended performance benefit to offset the increase in our (virtual) memory usage. Added: Modified: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Removed: diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 3de3ed2f84b79..b5912e907d8e0 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -2712,7 +2712,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { if (process_shared_cache_uuid.IsValid() && process_shared_cache_uuid != UUID::fromOptionalData(&cache_uuid, 16)) return; - const bool pinned = dyld_shared_cache_pin_mapping(shared_cache); + dyld_shared_cache_for_each_image(shared_cache, ^(dyld_image_t image) { uuid_t dsc_image_uuid; if (found_image) @@ -2769,8 +2769,6 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { nlist_count = nlistCount; }); }); - if (pinned) -dyld_shared_cache_unpin_mapping(shared_cache); }); if (nlist_buffer) { DataExtractor dsc_local_symbols_data(nlist_buffer, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] af91446 - [lldb] Show the DBGError if dsymForUUID can't find a dSYM
Author: Jonas Devlieghere Date: 2022-04-14T16:54:00-07:00 New Revision: af91446aa2903324c81d9e0b0a8a9fc037edc1a4 URL: https://github.com/llvm/llvm-project/commit/af91446aa2903324c81d9e0b0a8a9fc037edc1a4 DIFF: https://github.com/llvm/llvm-project/commit/af91446aa2903324c81d9e0b0a8a9fc037edc1a4.diff LOG: [lldb] Show the DBGError if dsymForUUID can't find a dSYM Show the user the DBGError (if available) when dsymForUUID fails. rdar://90949180 Differential revision: https://reviews.llvm.org/D123743 Added: lldb/source/Symbol/LocateSymbolFileMacOSX.cpp.rej lldb/test/Shell/SymbolFile/Inputs/a.yaml lldb/test/Shell/SymbolFile/Inputs/dsymforuuid.sh lldb/test/Shell/SymbolFile/add-dsym.test test/Shell/SymbolFile/Inputs/a.yaml test/Shell/SymbolFile/Inputs/dsymforuuid.sh test/Shell/SymbolFile/add-dsym.test Modified: lldb/include/lldb/Symbol/LocateSymbolFile.h lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Interpreter/CommandReturnObject.cpp lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/source/Symbol/LocateSymbolFile.cpp lldb/source/Symbol/LocateSymbolFileMacOSX.cpp Removed: diff --git a/lldb/include/lldb/Symbol/LocateSymbolFile.h b/lldb/include/lldb/Symbol/LocateSymbolFile.h index 2c3f6a7b7b595..f3d0feea4eccc 100644 --- a/lldb/include/lldb/Symbol/LocateSymbolFile.h +++ b/lldb/include/lldb/Symbol/LocateSymbolFile.h @@ -13,6 +13,7 @@ #include "lldb/Core/FileSpecList.h" #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" namespace lldb_private { @@ -50,6 +51,7 @@ class Symbols { // enabled the external program before calling. // static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec, + Status &error, bool force_lookup = true); }; diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 61944ebd69e24..aeb65daff4cba 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2464,7 +2464,8 @@ class CommandObjectTargetModulesAdd : public CommandObjectParsed { if (m_symbol_file.GetOptionValue().OptionWasSet()) module_spec.GetSymbolFileSpec() = m_symbol_file.GetOptionValue().GetCurrentValue(); -if (Symbols::DownloadObjectAndSymbolFile(module_spec)) { +Status error; +if (Symbols::DownloadObjectAndSymbolFile(module_spec, error)) { ModuleSP module_sp( target->GetOrCreateModule(module_spec, true /* notify */)); if (module_sp) { @@ -2500,6 +2501,7 @@ class CommandObjectTargetModulesAdd : public CommandObjectParsed { result.AppendErrorWithFormat( "Unable to locate the executable or symbol file with UUID %s", strm.GetData()); + result.SetError(error); return false; } } else { @@ -4165,10 +4167,13 @@ class CommandObjectTargetSymbolsAdd : public CommandObjectParsed { bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec, CommandReturnObject &result, bool &flush) { -if (Symbols::DownloadObjectAndSymbolFile(module_spec)) { +Status error; +if (Symbols::DownloadObjectAndSymbolFile(module_spec, error)) { if (module_spec.GetSymbolFileSpec()) return AddModuleSymbols(m_exe_ctx.GetTargetPtr(), module_spec, flush, result); +} else { + result.SetError(error); } return false; } diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp index 798dced0f1c6d..4433c43ff6d46 100644 --- a/lldb/source/Interpreter/CommandReturnObject.cpp +++ b/lldb/source/Interpreter/CommandReturnObject.cpp @@ -106,7 +106,8 @@ void CommandReturnObject::AppendError(llvm::StringRef in_string) { void CommandReturnObject::SetError(const Status &error, const char *fallback_error_cstr) { - AppendError(error.AsCString(fallback_error_cstr)); + if (error.Fail()) +AppendError(error.AsCString(fallback_error_cstr)); } void CommandReturnObject::SetError(llvm::Error error) { diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 1b699f293b37f..74c501d3dbb0e 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicL
[Lldb-commits] [PATCH] D123743: [lldb] Show the DBGError if dsymForUUID can't find a dSYM
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGaf91446aa290: [lldb] Show the DBGError if dsymForUUID can't find a dSYM (authored by JDevlieghere). Herald added a project: LLDB. Changed prior to commit: https://reviews.llvm.org/D123743?vs=422688&id=422985#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D123743/new/ https://reviews.llvm.org/D123743 Files: lldb/include/lldb/Symbol/LocateSymbolFile.h lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Interpreter/CommandReturnObject.cpp lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/source/Symbol/LocateSymbolFile.cpp lldb/source/Symbol/LocateSymbolFileMacOSX.cpp lldb/source/Symbol/LocateSymbolFileMacOSX.cpp.rej lldb/test/Shell/SymbolFile/Inputs/a.yaml lldb/test/Shell/SymbolFile/Inputs/dsymforuuid.sh lldb/test/Shell/SymbolFile/add-dsym.test test/Shell/SymbolFile/Inputs/a.yaml test/Shell/SymbolFile/Inputs/dsymforuuid.sh test/Shell/SymbolFile/add-dsym.test Index: test/Shell/SymbolFile/add-dsym.test === --- /dev/null +++ test/Shell/SymbolFile/add-dsym.test @@ -0,0 +1,5 @@ +# REQUIRES: system-darwin + +# RUN: yaml2obj %S/Inputs/a.yaml -o %t.out +# RUN: LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s +# CHECK: UUID information was not found Index: test/Shell/SymbolFile/Inputs/dsymforuuid.sh === --- /dev/null +++ test/Shell/SymbolFile/Inputs/dsymforuuid.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +echo "" +echo "http://www.apple.com/DTDs/PropertyList-1.0.dtd\";>" +echo "" +echo "" +echo "93483F20-FD9C-30AD-A72D-94EF12837DBA" +echo "" +echo "DBGArchitecture" +echo "arm64" +echo "DBGError" +echo "UUID information was not found" +echo "" +echo "" +echo "" Index: test/Shell/SymbolFile/Inputs/a.yaml === --- /dev/null +++ test/Shell/SymbolFile/Inputs/a.yaml @@ -0,0 +1,225 @@ +--- !mach-o +FileHeader: + magic: 0xFEEDFACF + cputype: 0x10C + cpusubtype: 0x0 + filetype:0x2 + ncmds: 16 + sizeofcmds: 824 + flags: 0x200085 + reserved:0x0 +LoadCommands: + - cmd: LC_SEGMENT_64 +cmdsize: 72 +segname: __PAGEZERO +vmaddr: 0 +vmsize: 4294967296 +fileoff: 0 +filesize:0 +maxprot: 0 +initprot:0 +nsects: 0 +flags: 0 + - cmd: LC_SEGMENT_64 +cmdsize: 312 +segname: __TEXT +vmaddr: 4294967296 +vmsize: 16384 +fileoff: 0 +filesize:16384 +maxprot: 5 +initprot:5 +nsects: 3 +flags: 0 +Sections: + - sectname:__text +segname: __TEXT +addr:0x13F60 +size:32 +offset: 0x3F60 +align: 2 +reloff: 0x0 +nreloc: 0 +flags: 0x8400 +reserved1: 0x0 +reserved2: 0x0 +reserved3: 0x0 +content: FF4300D1E80300AA8052FF0F00B9E80B00B9E10300F9FF430091C0035FD6 + - sectname:__unwind_info +segname: __TEXT +addr:0x13F80 +size:72 +offset: 0x3F80 +align: 2 +reloff: 0x0 +nreloc: 0 +flags: 0x0 +reserved1: 0x0 +reserved2: 0x0 +reserved3: 0x0 +content: 01001C001C001C000200603F34003400813F340003000C00010011001403 + - sectname:__eh_frame +segname: __TEXT +addr:0x13FC8 +size:56 +offset: 0x3FC8 +align: 3 +reloff: 0x0 +nreloc: 0 +flags: 0x0 +reserved1: 0x0 +reserved2: 0x0 +reserved3: 0x0 +content: 117A520001781E01100C1F00200018007CFF20440E10580E + - cmd: LC_SEGMENT_64 +cmdsize: 72 +s