[Lldb-commits] [lldb] Fix an integer trunctation issues for the DW_AT_frame_base DWARF loca… (PR #110388)
https://github.com/clayborg created https://github.com/llvm/llvm-project/pull/110388 …tion expression. This patch allows offsets to the DW_AT_frame_base to exceed 4GB. Prior to this, for any .debug_info.dwo offset that exceeded 4GB, we would truncate the offset to the DW_AT_frame_base expression bytes to be 32 bit only. Changing the offset to 64 bits restores correct functionality. No test for this as we don't want to create a .dwp file that has a .debug_info.dwo size that is over 4GB. >From 499ca2180159b5a93634763feed626af6b070552 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Sat, 28 Sep 2024 15:28:01 -0700 Subject: [PATCH] Fix an integer trunctation issues for the DW_AT_frame_base DWARF location expression. This patch allows offsets to the DW_AT_frame_base to exceed 4GB. Prior to this, for any .debug_info.dwo offset that exceeded 4GB, we would truncate the offset to the DW_AT_frame_base expression bytes to be 32 bit only. Changing the offset to 64 bits restores correct functionality. No test for this as we don't want to create a .dwp file that has a .debug_info.dwo size that is over 4GB. --- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp index 77ef59d605c9c4..66d0bc4b90cb52 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -229,9 +229,9 @@ bool DWARFDebugInfoEntry::GetDIENamesAndRanges( case DW_AT_frame_base: if (frame_base) { if (form_value.BlockData()) { - uint32_t block_offset = + uint64_t block_offset = form_value.BlockData() - data.GetDataStart(); - uint32_t block_length = form_value.Unsigned(); + uint64_t block_length = form_value.Unsigned(); *frame_base = DWARFExpressionList(module, DWARFExpression(DataExtractor( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix an integer trunctation issues for the DW_AT_frame_base DWARF loca… (PR #110388)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Greg Clayton (clayborg) Changes …tion expression. This patch allows offsets to the DW_AT_frame_base to exceed 4GB. Prior to this, for any .debug_info.dwo offset that exceeded 4GB, we would truncate the offset to the DW_AT_frame_base expression bytes to be 32 bit only. Changing the offset to 64 bits restores correct functionality. No test for this as we don't want to create a .dwp file that has a .debug_info.dwo size that is over 4GB. --- Full diff: https://github.com/llvm/llvm-project/pull/110388.diff 1 Files Affected: - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (+2-2) ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp index 77ef59d605c9c4..66d0bc4b90cb52 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -229,9 +229,9 @@ bool DWARFDebugInfoEntry::GetDIENamesAndRanges( case DW_AT_frame_base: if (frame_base) { if (form_value.BlockData()) { - uint32_t block_offset = + uint64_t block_offset = form_value.BlockData() - data.GetDataStart(); - uint32_t block_length = form_value.Unsigned(); + uint64_t block_length = form_value.Unsigned(); *frame_base = DWARFExpressionList(module, DWARFExpression(DataExtractor( `` https://github.com/llvm/llvm-project/pull/110388 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [LLDB][Minidump] Add breakpoint stop reasons to the minidump. (PR #108448)
@@ -246,6 +246,8 @@ static_assert(sizeof(Thread) == 48); struct Exception { static constexpr size_t MaxParameters = 15; + static constexpr size_t MaxParameterBytes = MaxParameters * sizeof(uint64_t); + static const uint32_t LLDB_FLAG = 0x8000; clayborg wrote: Maybe set to to an ASCII integer like this: ``` static const uint32_t LLDB_FLAG = 'LLDB'; ``` Then we check if the `exp_record.ExceptionFlags` is equal to LLDB_FLAG, we are sure this is an LLDB thing. We don't want to load something from a different minidump creator and just assume since the high bit is set that it is a LLDB exeption. Or we can leave `exp_record.ExceptionFlags` alone and encode this 'LLDB' as the first item in the `exp_record.NumberParameters` args and then append anything else we need to encode. https://github.com/llvm/llvm-project/pull/108448 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [LLDB][Minidump] Add breakpoint stop reasons to the minidump. (PR #108448)
@@ -685,50 +684,42 @@ Status MinidumpFileBuilder::AddExceptions() { Status error; for (const ThreadSP &thread_sp : thread_list) { StopInfoSP stop_info_sp = thread_sp->GetStopInfo(); -bool add_exception = false; -if (stop_info_sp) { - switch (stop_info_sp->GetStopReason()) { - case eStopReasonSignal: - case eStopReasonException: -add_exception = true; -break; - default: -break; - } -} -if (add_exception) { - constexpr size_t minidump_exception_size = - sizeof(llvm::minidump::ExceptionStream); - error = AddDirectory(StreamType::Exception, minidump_exception_size); - if (error.Fail()) -return error; +if (!stop_info_sp) + continue; - StopInfoSP stop_info_sp = thread_sp->GetStopInfo(); - RegisterContextSP reg_ctx_sp(thread_sp->GetRegisterContext()); - Exception exp_record = {}; - exp_record.ExceptionCode = - static_cast(stop_info_sp->GetValue()); - exp_record.ExceptionFlags = static_cast(0); - exp_record.ExceptionRecord = static_cast(0); - exp_record.ExceptionAddress = reg_ctx_sp->GetPC(); - exp_record.NumberParameters = static_cast(0); - exp_record.UnusedAlignment = static_cast(0); - // exp_record.ExceptionInformation; - - ExceptionStream exp_stream; - exp_stream.ThreadId = - static_cast(thread_sp->GetID()); - exp_stream.UnusedAlignment = static_cast(0); - exp_stream.ExceptionRecord = exp_record; - auto Iter = m_tid_to_reg_ctx.find(thread_sp->GetID()); - if (Iter != m_tid_to_reg_ctx.end()) { -exp_stream.ThreadContext = Iter->second; - } else { -exp_stream.ThreadContext.DataSize = 0; -exp_stream.ThreadContext.RVA = 0; - } - m_data.AppendData(&exp_stream, minidump_exception_size); +constexpr size_t minidump_exception_size = +sizeof(llvm::minidump::ExceptionStream); +error = AddDirectory(StreamType::Exception, minidump_exception_size); +if (error.Fail()) + return error; + +RegisterContextSP reg_ctx_sp(thread_sp->GetRegisterContext()); +Exception exp_record = {}; +exp_record.ExceptionCode = static_cast(stop_info_sp->GetValue()); +exp_record.ExceptionCode = +static_cast(stop_info_sp->GetValue()); clayborg wrote: This is being done twice? https://github.com/llvm/llvm-project/pull/108448 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Fix an integer trunctation issues for the DW_AT_frame_base DWARF loca… (PR #110388)
clayborg wrote: Since .dwp files can get large, it is ok for the `.debug_info.dwo` section to exceed 4GB as we can parse the linked list of dwarf units in the `.debug_info.dwo` and ignore the CU and TU indexes which are limited to 4GB. We have work arounds already checked into LLVM's DWARF code that detects this issues and reconstructs the CU and TU index to be 64 bit safe. So this fix allows variables to show correctly when they have a `DW_AT_frame_base` attribute on the `DW_TAG_subprogram` were the `.debug_info.dwo` offset of the `DW_TAG_subprogram` is over 4GB. https://github.com/llvm/llvm-project/pull/110388 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb][DWARF] Replace lldb's DWARFDebugArangeSet with llvm's (PR #110058)
https://github.com/clayborg commented: LGTM. I will let others comment. https://github.com/llvm/llvm-project/pull/110058 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits