[Lldb-commits] [lldb] [lldb-dap] Add feature to remember last non-empty expression. (PR #107485)
@@ -1376,6 +1382,16 @@ void request_evaluate(const llvm::json::Object &request) { EmplaceSafeString(body, "result", result); body.try_emplace("variablesReference", (int64_t)0); } else { +if (context == "repl") { + // If the expression is empty and the last expression was for a + // variable, set the expression to the previous expression (repeat the + // evaluation); otherwise save the current non-empty expression for the + // next (possibly empty) variable expression. + if (expression.empty()) +expression = g_dap.last_nonempty_var_expression; walter-erquinigo wrote: IIUC, this has the following flow in the debug console: - You send a command (non-var expression) FOO - You send a var expression VAR - You send empty text -> then FOO repeats If that understanding is correct, that would lead to a confusing behavior. I think it's better to repeat only if the previous input was exactly a command. https://github.com/llvm/llvm-project/pull/107485 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add feature to remember last non-empty expression. (PR #107485)
@@ -1364,8 +1364,14 @@ void request_evaluate(const llvm::json::Object &request) { std::string expression = GetString(arguments, "expression").str(); llvm::StringRef context = GetString(arguments, "context"); - if (context == "repl" && g_dap.DetectExpressionContext(frame, expression) == - ExpressionContext::Command) { + if (context == "repl" && + (expression.empty() ? + g_dap.last_nonempty_var_expression.empty() : + g_dap.DetectExpressionContext(frame, expression) == walter-erquinigo wrote: it's hard to read this. Please move this ternary check into another variable with a good name. https://github.com/llvm/llvm-project/pull/107485 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created (PR #106791)
JDevlieghere wrote: It looks like this breaks `Unwind.trap_frame_sym_ctx` on x86_64: https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/lldb-cmake/5745/testReport/junit/lldb-shell/Unwind/trap_frame_sym_ctx_test/ I'm going to revert this to get the bots green over the weekend. https://github.com/llvm/llvm-project/pull/106791 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created" (PR #108715)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/108715 Reverts llvm/llvm-project#106791 because it breaks `trap_frame_sym_ctx.test ` on x86_64. https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/lldb-cmake/5745/ >From ba6e663299e1d7b54a3ac4a7c647d44f66d8699d Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Sat, 14 Sep 2024 10:49:27 -0700 Subject: [PATCH] =?UTF-8?q?Revert=20"[lldb]=20Do=20not=20use=20LC=5FFUNCTI?= =?UTF-8?q?ON=5FSTARTS=20data=20to=20determine=20symbol=20size=20as?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0351dc522a25df0473a63b414a5bfde5814d3dc3. --- .../ObjectFile/Mach-O/ObjectFileMachO.cpp | 63 +++ 1 file changed, 63 insertions(+) diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index c36748963db37b..06da83e26a26a5 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -3768,6 +3768,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { SymbolType type = eSymbolTypeInvalid; SectionSP symbol_section; + lldb::addr_t symbol_byte_size = 0; bool add_nlist = true; bool is_gsym = false; bool demangled_is_synthesized = false; @@ -4353,6 +4354,47 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { if (symbol_section) { const addr_t section_file_addr = symbol_section->GetFileAddress(); +if (symbol_byte_size == 0 && function_starts_count > 0) { + addr_t symbol_lookup_file_addr = nlist.n_value; + // Do an exact address match for non-ARM addresses, else get the + // closest since the symbol might be a thumb symbol which has an + // address with bit zero set. + FunctionStarts::Entry *func_start_entry = + function_starts.FindEntry(symbol_lookup_file_addr, !is_arm); + if (is_arm && func_start_entry) { +// Verify that the function start address is the symbol address +// (ARM) or the symbol address + 1 (thumb). +if (func_start_entry->addr != symbol_lookup_file_addr && +func_start_entry->addr != (symbol_lookup_file_addr + 1)) { + // Not the right entry, NULL it out... + func_start_entry = nullptr; +} + } + if (func_start_entry) { +func_start_entry->data = true; + +addr_t symbol_file_addr = func_start_entry->addr; +if (is_arm) + symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; + +const FunctionStarts::Entry *next_func_start_entry = +function_starts.FindNextEntry(func_start_entry); +const addr_t section_end_file_addr = +section_file_addr + symbol_section->GetByteSize(); +if (next_func_start_entry) { + addr_t next_symbol_file_addr = next_func_start_entry->addr; + // Be sure the clear the Thumb address bit when we calculate the + // size from the current and next address + if (is_arm) +next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; + symbol_byte_size = std::min( + next_symbol_file_addr - symbol_file_addr, + section_end_file_addr - symbol_file_addr); +} else { + symbol_byte_size = section_end_file_addr - symbol_file_addr; +} + } +} symbol_value -= section_file_addr; } @@ -4459,6 +4501,9 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { if (nlist.n_desc & N_WEAK_REF) sym[sym_idx].SetIsWeak(true); + if (symbol_byte_size > 0) +sym[sym_idx].SetByteSize(symbol_byte_size); + if (demangled_is_synthesized) sym[sym_idx].SetDemangledNameIsSynthesized(true); @@ -4577,7 +4622,23 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { Address symbol_addr; if (module_sp->ResolveFileAddress(symbol_file_addr, symbol_addr)) { SectionSP symbol_section(symbol_addr.GetSection()); +uint32_t symbol_byte_size = 0; if (symbol_section) { + const addr_t section_file_addr = symbol_section->GetFileAddress(); + const FunctionStarts::Entry *next_func_start_entry = + function_starts.FindNextEntry(func_start_entry); + const addr_t section_end_file_addr = + section_file_addr + symbol_section->GetByteSize(); + if (next_func_start_entry) { +addr_t next_symbol_file_addr = next_func_start_entry->addr; +if (is_arm) + next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; +symbol_byte_size = std::min( +next
[Lldb-commits] [lldb] Revert "[lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created" (PR #108715)
https://github.com/JDevlieghere edited https://github.com/llvm/llvm-project/pull/108715 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fa478bd - Revert "[lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created" (#108715)
Author: Jonas Devlieghere Date: 2024-09-14T10:50:44-07:00 New Revision: fa478bd275f473861f6d4df4896244a730d4853f URL: https://github.com/llvm/llvm-project/commit/fa478bd275f473861f6d4df4896244a730d4853f DIFF: https://github.com/llvm/llvm-project/commit/fa478bd275f473861f6d4df4896244a730d4853f.diff LOG: Revert "[lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created" (#108715) Reverts llvm/llvm-project#106791 because it breaks `trap_frame_sym_ctx.test ` on x86_64. https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake/5745/ 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 c36748963db37b..06da83e26a26a5 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -3768,6 +3768,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { SymbolType type = eSymbolTypeInvalid; SectionSP symbol_section; + lldb::addr_t symbol_byte_size = 0; bool add_nlist = true; bool is_gsym = false; bool demangled_is_synthesized = false; @@ -4353,6 +4354,47 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { if (symbol_section) { const addr_t section_file_addr = symbol_section->GetFileAddress(); +if (symbol_byte_size == 0 && function_starts_count > 0) { + addr_t symbol_lookup_file_addr = nlist.n_value; + // Do an exact address match for non-ARM addresses, else get the + // closest since the symbol might be a thumb symbol which has an + // address with bit zero set. + FunctionStarts::Entry *func_start_entry = + function_starts.FindEntry(symbol_lookup_file_addr, !is_arm); + if (is_arm && func_start_entry) { +// Verify that the function start address is the symbol address +// (ARM) or the symbol address + 1 (thumb). +if (func_start_entry->addr != symbol_lookup_file_addr && +func_start_entry->addr != (symbol_lookup_file_addr + 1)) { + // Not the right entry, NULL it out... + func_start_entry = nullptr; +} + } + if (func_start_entry) { +func_start_entry->data = true; + +addr_t symbol_file_addr = func_start_entry->addr; +if (is_arm) + symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; + +const FunctionStarts::Entry *next_func_start_entry = +function_starts.FindNextEntry(func_start_entry); +const addr_t section_end_file_addr = +section_file_addr + symbol_section->GetByteSize(); +if (next_func_start_entry) { + addr_t next_symbol_file_addr = next_func_start_entry->addr; + // Be sure the clear the Thumb address bit when we calculate the + // size from the current and next address + if (is_arm) +next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; + symbol_byte_size = std::min( + next_symbol_file_addr - symbol_file_addr, + section_end_file_addr - symbol_file_addr); +} else { + symbol_byte_size = section_end_file_addr - symbol_file_addr; +} + } +} symbol_value -= section_file_addr; } @@ -4459,6 +4501,9 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { if (nlist.n_desc & N_WEAK_REF) sym[sym_idx].SetIsWeak(true); + if (symbol_byte_size > 0) +sym[sym_idx].SetByteSize(symbol_byte_size); + if (demangled_is_synthesized) sym[sym_idx].SetDemangledNameIsSynthesized(true); @@ -4577,7 +4622,23 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { Address symbol_addr; if (module_sp->ResolveFileAddress(symbol_file_addr, symbol_addr)) { SectionSP symbol_section(symbol_addr.GetSection()); +uint32_t symbol_byte_size = 0; if (symbol_section) { + const addr_t section_file_addr = symbol_section->GetFileAddress(); + const FunctionStarts::Entry *next_func_start_entry = + function_starts.FindNextEntry(func_start_entry); + const addr_t section_end_file_addr = + section_file_addr + symbol_section->GetByteSize(); + if (next_func_start_entry) { +addr_t next_symbol_file_addr = next_func_start_entry->addr; +if (is_arm) + next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; +symbol_byte_size = std::min( +next_symbol_file_addr - symbol_file_addr, +s
[Lldb-commits] [lldb] Revert "[lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created" (PR #108715)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes Reverts llvm/llvm-project#106791 because it breaks `trap_frame_sym_ctx.test ` on x86_64. https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake/5745/ --- Full diff: https://github.com/llvm/llvm-project/pull/108715.diff 1 Files Affected: - (modified) lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (+63) ``diff diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index c36748963db37b..06da83e26a26a5 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -3768,6 +3768,7 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { SymbolType type = eSymbolTypeInvalid; SectionSP symbol_section; + lldb::addr_t symbol_byte_size = 0; bool add_nlist = true; bool is_gsym = false; bool demangled_is_synthesized = false; @@ -4353,6 +4354,47 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { if (symbol_section) { const addr_t section_file_addr = symbol_section->GetFileAddress(); +if (symbol_byte_size == 0 && function_starts_count > 0) { + addr_t symbol_lookup_file_addr = nlist.n_value; + // Do an exact address match for non-ARM addresses, else get the + // closest since the symbol might be a thumb symbol which has an + // address with bit zero set. + FunctionStarts::Entry *func_start_entry = + function_starts.FindEntry(symbol_lookup_file_addr, !is_arm); + if (is_arm && func_start_entry) { +// Verify that the function start address is the symbol address +// (ARM) or the symbol address + 1 (thumb). +if (func_start_entry->addr != symbol_lookup_file_addr && +func_start_entry->addr != (symbol_lookup_file_addr + 1)) { + // Not the right entry, NULL it out... + func_start_entry = nullptr; +} + } + if (func_start_entry) { +func_start_entry->data = true; + +addr_t symbol_file_addr = func_start_entry->addr; +if (is_arm) + symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; + +const FunctionStarts::Entry *next_func_start_entry = +function_starts.FindNextEntry(func_start_entry); +const addr_t section_end_file_addr = +section_file_addr + symbol_section->GetByteSize(); +if (next_func_start_entry) { + addr_t next_symbol_file_addr = next_func_start_entry->addr; + // Be sure the clear the Thumb address bit when we calculate the + // size from the current and next address + if (is_arm) +next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; + symbol_byte_size = std::min( + next_symbol_file_addr - symbol_file_addr, + section_end_file_addr - symbol_file_addr); +} else { + symbol_byte_size = section_end_file_addr - symbol_file_addr; +} + } +} symbol_value -= section_file_addr; } @@ -4459,6 +4501,9 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { if (nlist.n_desc & N_WEAK_REF) sym[sym_idx].SetIsWeak(true); + if (symbol_byte_size > 0) +sym[sym_idx].SetByteSize(symbol_byte_size); + if (demangled_is_synthesized) sym[sym_idx].SetDemangledNameIsSynthesized(true); @@ -4577,7 +4622,23 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) { Address symbol_addr; if (module_sp->ResolveFileAddress(symbol_file_addr, symbol_addr)) { SectionSP symbol_section(symbol_addr.GetSection()); +uint32_t symbol_byte_size = 0; if (symbol_section) { + const addr_t section_file_addr = symbol_section->GetFileAddress(); + const FunctionStarts::Entry *next_func_start_entry = + function_starts.FindNextEntry(func_start_entry); + const addr_t section_end_file_addr = + section_file_addr + symbol_section->GetByteSize(); + if (next_func_start_entry) { +addr_t next_symbol_file_addr = next_func_start_entry->addr; +if (is_arm) + next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; +symbol_byte_size = std::min( +next_symbol_file_addr - symbol_file_addr, +section_end_file_addr - symbol_file_addr); + } else { +symbol_byte_size = section_end_file_addr - symbol_file_addr; + } sym[sym_idx].SetID(synthetic_sym_id++); // Don't set the name for any synthetic symbols, the Symbol // object will
[Lldb-commits] [lldb] Revert "[lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created" (PR #108715)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/108715 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][intel-pt] Fix build error on conversion from llvm::Error to Status::FromError (PR #108719)
https://github.com/kusmour created https://github.com/llvm/llvm-project/pull/108719 Summary: This introduced from upstream [#107163](https://github.com/llvm/llvm-project/pull/107163) Test Plan: I can build >From ff2f26081b5535587e5ccb28522b728a596b6e12 Mon Sep 17 00:00:00 2001 From: Wanyi Ye Date: Sat, 14 Sep 2024 14:23:01 -0700 Subject: [PATCH] [lldb][intel-pt] Fix build error on conversion from llvm::Error to Status::FromError Summary: This introduced from upstream #107163 Test Plan: I can build --- .../Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp index 81f7c228561a6d..40035e4480495f 100644 --- a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp +++ b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp @@ -78,7 +78,7 @@ bool CommandObjectThreadTraceStartIntelPT::DoExecuteOnThreads( llvm::ArrayRef tids) { if (Error err = m_trace.Start(tids, m_options.m_ipt_trace_size, m_options.m_enable_tsc, m_options.m_psb_period)) -result.SetError(Status(std::move(err))); +result.SetError(Status::FromError(std::move(err))); else result.SetStatus(eReturnStatusSuccessFinishResult); @@ -164,7 +164,7 @@ void CommandObjectProcessTraceStartIntelPT::DoExecute( m_options.m_ipt_trace_size, m_options.m_process_buffer_size_limit, m_options.m_enable_tsc, m_options.m_psb_period, m_options.m_per_cpu_tracing, m_options.m_disable_cgroup_filtering)) -result.SetError(Status(std::move(err))); +result.SetError(Status::FromError(std::move(err))); else result.SetStatus(eReturnStatusSuccessFinishResult); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][intel-pt] Fix build error on conversion from llvm::Error to Status::FromError (PR #108719)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Wanyi (kusmour) Changes Summary: This introduced from upstream [#107163](https://github.com/llvm/llvm-project/pull/107163) Test Plan: I can build --- Full diff: https://github.com/llvm/llvm-project/pull/108719.diff 1 Files Affected: - (modified) lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp (+2-2) ``diff diff --git a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp index 81f7c228561a6d..40035e4480495f 100644 --- a/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp +++ b/lldb/source/Plugins/Trace/intel-pt/CommandObjectTraceStartIntelPT.cpp @@ -78,7 +78,7 @@ bool CommandObjectThreadTraceStartIntelPT::DoExecuteOnThreads( llvm::ArrayRef tids) { if (Error err = m_trace.Start(tids, m_options.m_ipt_trace_size, m_options.m_enable_tsc, m_options.m_psb_period)) -result.SetError(Status(std::move(err))); +result.SetError(Status::FromError(std::move(err))); else result.SetStatus(eReturnStatusSuccessFinishResult); @@ -164,7 +164,7 @@ void CommandObjectProcessTraceStartIntelPT::DoExecute( m_options.m_ipt_trace_size, m_options.m_process_buffer_size_limit, m_options.m_enable_tsc, m_options.m_psb_period, m_options.m_per_cpu_tracing, m_options.m_disable_cgroup_filtering)) -result.SetError(Status(std::move(err))); +result.SetError(Status::FromError(std::move(err))); else result.SetStatus(eReturnStatusSuccessFinishResult); } `` https://github.com/llvm/llvm-project/pull/108719 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][intel-pt] Fix build error on conversion from llvm::Error to Status::FromError (PR #108719)
Jlalond wrote: Hey @kusmour. I actually looked into this on Thursday, see #108248. If we are going to merge this I think we should just call `std::move` and not `Status::FromError(std::move(err))` as the API takes an err r-value. https://github.com/llvm/llvm-project/pull/108719 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [debugserver] Use "full" x86_64 GPR state when available. (PR #108663)
jasonmolenda wrote: Nice improvement. Let me apply it and experiment a tiny bit next week, but a quick read looks good. https://github.com/llvm/llvm-project/pull/108663 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] [debugserver] Use "full" x86_64 GPR state when available. (PR #108663)
jasonmolenda wrote: (I hadn't noticed the kernel added this new flavor for intel machines, I've had people ask for access to these before.) https://github.com/llvm/llvm-project/pull/108663 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits