[Lldb-commits] [lldb] [lldb] Reland: Store SupportFile in FileEntry (NFC (PR #85892)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/85892 Same change as #85468 but broken down into two commits as discussed in the original PR. >From 0914ecdf582831ec4da776e26ae5ebd2cf9f984f Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 19 Mar 2024 21:13:29 -0700 Subject: [PATCH 1/2] Make LineEntry::file private --- lldb/include/lldb/Core/Disassembler.h | 2 +- lldb/include/lldb/Symbol/LineEntry.h | 5 + lldb/include/lldb/Utility/SupportFile.h| 3 +++ lldb/source/API/SBLineEntry.cpp| 10 +- lldb/source/API/SBThread.cpp | 2 +- lldb/source/Breakpoint/BreakpointResolver.cpp | 2 +- .../Breakpoint/BreakpointResolverFileLine.cpp | 7 --- lldb/source/Commands/CommandObjectBreakpoint.cpp | 4 ++-- lldb/source/Commands/CommandObjectSource.cpp | 14 +++--- lldb/source/Commands/CommandObjectThread.cpp | 2 +- lldb/source/Core/Address.cpp | 2 +- lldb/source/Core/Disassembler.cpp | 8 lldb/source/Core/FormatEntity.cpp | 2 +- lldb/source/Core/IOHandlerCursesGUI.cpp| 11 ++- lldb/source/Core/SourceManager.cpp | 2 +- .../Clang/ClangExpressionSourceCode.cpp| 2 +- lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp | 4 ++-- lldb/source/Symbol/CompileUnit.cpp | 2 +- lldb/source/Symbol/Function.cpp| 4 ++-- lldb/source/Symbol/LineTable.cpp | 4 ++-- lldb/source/Symbol/SymbolContext.cpp | 4 ++-- lldb/source/Target/StackFrame.cpp | 2 +- lldb/source/Target/StackFrameList.cpp | 4 ++-- lldb/source/Target/Thread.cpp | 8 lldb/source/Target/TraceDumper.cpp | 4 ++-- .../SymbolFile/PDB/SymbolFilePDBTests.cpp | 2 +- 26 files changed, 63 insertions(+), 53 deletions(-) diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h index 885ac1bb4a7ef8..e037a49f152c74 100644 --- a/lldb/include/lldb/Core/Disassembler.h +++ b/lldb/include/lldb/Core/Disassembler.h @@ -538,7 +538,7 @@ class Disassembler : public std::enable_shared_from_this, ElideMixedSourceAndDisassemblyLine(const ExecutionContext _ctx, const SymbolContext , LineEntry ) { SourceLine sl; -sl.file = line.file; +sl.file = line.GetFile(); sl.line = line.line; sl.column = line.column; return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl); diff --git a/lldb/include/lldb/Symbol/LineEntry.h b/lldb/include/lldb/Symbol/LineEntry.h index 31e1cd0b36f96e..0135b834cc7488 100644 --- a/lldb/include/lldb/Symbol/LineEntry.h +++ b/lldb/include/lldb/Symbol/LineEntry.h @@ -130,11 +130,16 @@ struct LineEntry { /// Shared pointer to the target this LineEntry belongs to. void ApplyFileMappings(lldb::TargetSP target_sp); + const FileSpec& GetFile() const { return file; } + void SetFile(const FileSpec& file_spec) { file = file_spec; } + /// The section offset address range for this line entry. AddressRange range; + private: /// The source file, possibly mapped by the target.source-map setting. FileSpec file; + public: /// The original source file, from debug info. lldb::SupportFileSP original_file_sp; diff --git a/lldb/include/lldb/Utility/SupportFile.h b/lldb/include/lldb/Utility/SupportFile.h index 0ea0ca4e7c97a1..7505d7f345c5dd 100644 --- a/lldb/include/lldb/Utility/SupportFile.h +++ b/lldb/include/lldb/Utility/SupportFile.h @@ -45,6 +45,9 @@ class SupportFile { /// Materialize the file to disk and return the path to that temporary file. virtual const FileSpec () { return m_file_spec; } + /// Change the file name. + void Update(const FileSpec _spec) { m_file_spec = file_spec; } + protected: FileSpec m_file_spec; Checksum m_checksum; diff --git a/lldb/source/API/SBLineEntry.cpp b/lldb/source/API/SBLineEntry.cpp index 28d12e65fdaf8a..0941ef20d0ff3b 100644 --- a/lldb/source/API/SBLineEntry.cpp +++ b/lldb/source/API/SBLineEntry.cpp @@ -81,8 +81,8 @@ SBFileSpec SBLineEntry::GetFileSpec() const { LLDB_INSTRUMENT_VA(this); SBFileSpec sb_file_spec; - if (m_opaque_up.get() && m_opaque_up->file) -sb_file_spec.SetFileSpec(m_opaque_up->file); + if (m_opaque_up.get() && m_opaque_up->GetFile()) +sb_file_spec.SetFileSpec(m_opaque_up->GetFile()); return sb_file_spec; } @@ -109,9 +109,9 @@ void SBLineEntry::SetFileSpec(lldb::SBFileSpec filespec) { LLDB_INSTRUMENT_VA(this, filespec); if (filespec.IsValid()) -ref().file = filespec.ref(); +ref().SetFile(filespec.ref()); else -ref().file.Clear(); +ref().SetFile(FileSpec()); } void SBLineEntry::SetLine(uint32_t line) { LLDB_INSTRUMENT_VA(this, line); @@ -168,7 +168,7 @@ bool
[Lldb-commits] [lldb] 92b2b49 - [lldb] Outline Doxygen comments in LineEntry.h (NFC)
Author: Jonas Devlieghere Date: 2024-03-19T20:49:56-07:00 New Revision: 92b2b49994eb804253db1deeb7e9f63904cd96d1 URL: https://github.com/llvm/llvm-project/commit/92b2b49994eb804253db1deeb7e9f63904cd96d1 DIFF: https://github.com/llvm/llvm-project/commit/92b2b49994eb804253db1deeb7e9f63904cd96d1.diff LOG: [lldb] Outline Doxygen comments in LineEntry.h (NFC) Outline and correct Doxygen comments in LineEntry. Added: Modified: lldb/include/lldb/Symbol/LineEntry.h Removed: diff --git a/lldb/include/lldb/Symbol/LineEntry.h b/lldb/include/lldb/Symbol/LineEntry.h index c2daba916e3f98..31e1cd0b36f96e 100644 --- a/lldb/include/lldb/Symbol/LineEntry.h +++ b/lldb/include/lldb/Symbol/LineEntry.h @@ -130,31 +130,40 @@ struct LineEntry { /// Shared pointer to the target this LineEntry belongs to. void ApplyFileMappings(lldb::TargetSP target_sp); - // Member variables. - AddressRange range; ///< The section offset address range for this line entry. - FileSpec file; ///< The source file, possibly mapped by the target.source-map - ///setting - lldb::SupportFileSP - original_file_sp; ///< The original source file, from debug info. - uint32_t line = LLDB_INVALID_LINE_NUMBER; ///< The source line number, or zero -///< if there is no line number -/// information. - uint16_t column = - 0; ///< The column number of the source line, or zero if there - /// is no column information. - uint16_t is_start_of_statement : 1, ///< Indicates this entry is the beginning - ///of a statement. - is_start_of_basic_block : 1, ///< Indicates this entry is the beginning of - ///a basic block. - is_prologue_end : 1, ///< Indicates this entry is one (of possibly many) - ///where execution should be suspended for an entry - ///breakpoint of a function. - is_epilogue_begin : 1, ///< Indicates this entry is one (of possibly many) - ///where execution should be suspended for an exit - ///breakpoint of a function. - is_terminal_entry : 1; ///< Indicates this entry is that of the first byte - ///after the end of a sequence of target machine - ///instructions. + /// The section offset address range for this line entry. + AddressRange range; + + /// The source file, possibly mapped by the target.source-map setting. + FileSpec file; + + /// The original source file, from debug info. + lldb::SupportFileSP original_file_sp; + + /// The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line + /// number information. + uint32_t line = LLDB_INVALID_LINE_NUMBER; + + /// The column number of the source line, or zero if there is no column + /// information. + uint16_t column = 0; + + /// Indicates this entry is the beginning of a statement. + uint16_t is_start_of_statement : 1; + + /// Indicates this entry is the beginning of a basic block. + uint16_t is_start_of_basic_block : 1; + + /// Indicates this entry is one (of possibly many) where execution should be + /// suspended for an entry breakpoint of a function. + uint16_t is_prologue_end : 1; + + /// Indicates this entry is one (of possibly many) where execution should be + /// suspended for an exit breakpoint of a function. + uint16_t is_epilogue_begin : 1; + + /// Indicates this entry is that of the first byte after the end of a sequence + /// of target machine instructions. + uint16_t is_terminal_entry : 1; }; /// Less than operator. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Store SupportFile in FileEntry (NFC) (PR #85468)
JDevlieghere wrote: @slackito @dwblaikie I'm really puzzled, I've audited every change in this patch and I can't figure out where things could be going wrong. My first guess was that we're not updating the FileSpec. There's only 3 places that explicitly modify the file in the line entry: 2 in `SBLineEntry::SetFileSpec` and of course `LineEntry::ApplyFileMapping`. All of them seem to be doing the right thing. I thought maybe somewhere we were taking a reference and modifying it later, but the new `GetFile()` getter returns a const ref so the compiler would've caught that. The same thing goes for all the call sites using the `SupportFile` directly, you can only access the `FileSpec` as a `const ref`. My second guess was that the code is behaving differently because we're comparing `SupportFile`s instead of their FileSpec. The equals operator for `SupportFile` also compares the checksum so that could cause two `SupportFile`s to be different while their FileSpecs might not. But the only place we do a compare, we explicitly compare the `FileSpec`s, no the `SupportFile`s or the shared pointer. Unless you can think of something else I'm out of ideas. I'll split up the patch into the part that introduces the getter and the part that swaps out the FileSpec for the support file. If you could apply those and tell me which one causes the test to fail that'd be helpful. https://github.com/llvm/llvm-project/pull/85468 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Store SupportFile in FileEntry (NFC)" (PR #85885)
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 e2fa90fa0a4b7950dd0d7fae6933e89c075d0af0 719069e6b7e191e338bbb17e9e18b7974b5acef0 -- lldb/include/lldb/Core/Disassembler.h lldb/include/lldb/Symbol/LineEntry.h lldb/include/lldb/Utility/SupportFile.h lldb/source/API/SBLineEntry.cpp lldb/source/API/SBThread.cpp lldb/source/Breakpoint/BreakpointResolver.cpp lldb/source/Breakpoint/BreakpointResolverFileLine.cpp lldb/source/Commands/CommandObjectBreakpoint.cpp lldb/source/Commands/CommandObjectSource.cpp lldb/source/Commands/CommandObjectThread.cpp lldb/source/Core/Address.cpp lldb/source/Core/Disassembler.cpp lldb/source/Core/FormatEntity.cpp lldb/source/Core/IOHandlerCursesGUI.cpp lldb/source/Core/SourceManager.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp lldb/source/Symbol/CompileUnit.cpp lldb/source/Symbol/Function.cpp lldb/source/Symbol/LineEntry.cpp lldb/source/Symbol/LineTable.cpp lldb/source/Symbol/SymbolContext.cpp lldb/source/Target/StackFrame.cpp lldb/source/Target/StackFrameList.cpp lldb/source/Target/Thread.cpp lldb/source/Target/TraceDumper.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/include/lldb/Symbol/LineEntry.h b/lldb/include/lldb/Symbol/LineEntry.h index c2daba916e..fc938645be 100644 --- a/lldb/include/lldb/Symbol/LineEntry.h +++ b/lldb/include/lldb/Symbol/LineEntry.h @@ -133,7 +133,7 @@ struct LineEntry { // Member variables. AddressRange range; ///< The section offset address range for this line entry. FileSpec file; ///< The source file, possibly mapped by the target.source-map - ///setting + /// setting lldb::SupportFileSP original_file_sp; ///< The original source file, from debug info. uint32_t line = LLDB_INVALID_LINE_NUMBER; ///< The source line number, or zero `` https://github.com/llvm/llvm-project/pull/85885 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Store SupportFile in FileEntry (NFC) (PR #85468)
JDevlieghere wrote: I reverted the change as this was meant to be RFC and ostensibly it's not. I'll read through this to see if I can spot where this might behave differently. https://github.com/llvm/llvm-project/pull/85468 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Store SupportFile in FileEntry (NFC)" (PR #85885)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes Reverts llvm/llvm-project#85468 because @slackito reports this broke stepping in one of their tests [1] and this patch was meant to be NFC. [1] https://github.com/llvm/llvm-project/commit/d5a277d309e92b1d3e493da6036cffdf815105b1#commitcomment-139991120 --- Patch is 28.17 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/85885.diff 26 Files Affected: - (modified) lldb/include/lldb/Core/Disassembler.h (+1-1) - (modified) lldb/include/lldb/Symbol/LineEntry.h (+12-22) - (modified) lldb/include/lldb/Utility/SupportFile.h (-3) - (modified) lldb/source/API/SBLineEntry.cpp (+5-5) - (modified) lldb/source/API/SBThread.cpp (+1-1) - (modified) lldb/source/Breakpoint/BreakpointResolver.cpp (+1-1) - (modified) lldb/source/Breakpoint/BreakpointResolverFileLine.cpp (+3-4) - (modified) lldb/source/Commands/CommandObjectBreakpoint.cpp (+2-2) - (modified) lldb/source/Commands/CommandObjectSource.cpp (+7-7) - (modified) lldb/source/Commands/CommandObjectThread.cpp (+1-1) - (modified) lldb/source/Core/Address.cpp (+1-1) - (modified) lldb/source/Core/Disassembler.cpp (+4-4) - (modified) lldb/source/Core/FormatEntity.cpp (+1-1) - (modified) lldb/source/Core/IOHandlerCursesGUI.cpp (+5-6) - (modified) lldb/source/Core/SourceManager.cpp (+1-1) - (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp (+1-1) - (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp (+2-2) - (modified) lldb/source/Symbol/CompileUnit.cpp (+1-1) - (modified) lldb/source/Symbol/Function.cpp (+2-2) - (modified) lldb/source/Symbol/LineEntry.cpp (+7-10) - (modified) lldb/source/Symbol/LineTable.cpp (+2-2) - (modified) lldb/source/Symbol/SymbolContext.cpp (+2-2) - (modified) lldb/source/Target/StackFrame.cpp (+1-1) - (modified) lldb/source/Target/StackFrameList.cpp (+2-2) - (modified) lldb/source/Target/Thread.cpp (+4-4) - (modified) lldb/source/Target/TraceDumper.cpp (+2-2) ``diff diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h index e037a49f152c74..885ac1bb4a7ef8 100644 --- a/lldb/include/lldb/Core/Disassembler.h +++ b/lldb/include/lldb/Core/Disassembler.h @@ -538,7 +538,7 @@ class Disassembler : public std::enable_shared_from_this, ElideMixedSourceAndDisassemblyLine(const ExecutionContext _ctx, const SymbolContext , LineEntry ) { SourceLine sl; -sl.file = line.GetFile(); +sl.file = line.file; sl.line = line.line; sl.column = line.column; return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl); diff --git a/lldb/include/lldb/Symbol/LineEntry.h b/lldb/include/lldb/Symbol/LineEntry.h index eb8ad6ee9368d2..c2daba916e3f98 100644 --- a/lldb/include/lldb/Symbol/LineEntry.h +++ b/lldb/include/lldb/Symbol/LineEntry.h @@ -130,28 +130,18 @@ struct LineEntry { /// Shared pointer to the target this LineEntry belongs to. void ApplyFileMappings(lldb::TargetSP target_sp); - const FileSpec () const { -assert(file_sp); -return file_sp->GetSpecOnly(); - } - - /// The section offset address range for this line entry. - AddressRange range; - - /// The source file, possibly mapped by the target.source-map setting. - lldb::SupportFileSP file_sp; - - /// The original source file, from debug info. - lldb::SupportFileSP original_file_sp; - - /// The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line - /// number information. - uint32_t line = LLDB_INVALID_LINE_NUMBER; - - /// The column number of the source line, or zero if there is no column - /// information. - uint16_t column = 0; - + // Member variables. + AddressRange range; ///< The section offset address range for this line entry. + FileSpec file; ///< The source file, possibly mapped by the target.source-map + ///setting + lldb::SupportFileSP + original_file_sp; ///< The original source file, from debug info. + uint32_t line = LLDB_INVALID_LINE_NUMBER; ///< The source line number, or zero +///< if there is no line number +/// information. + uint16_t column = + 0; ///< The column number of the source line, or zero if there + /// is no column information. uint16_t is_start_of_statement : 1, ///< Indicates this entry is the beginning ///of a statement. is_start_of_basic_block : 1, ///< Indicates this entry is the beginning of diff --git a/lldb/include/lldb/Utility/SupportFile.h b/lldb/include/lldb/Utility/SupportFile.h index 7505d7f345c5dd..0ea0ca4e7c97a1 100644 --- a/lldb/include/lldb/Utility/SupportFile.h +++ b/lldb/include/lldb/Utility/SupportFile.h @@ -45,9 +45,6 @@ class SupportFile { /// Materialize the file to disk and return the path to that temporary
[Lldb-commits] [lldb] a289f66 - Revert "[lldb] Store SupportFile in FileEntry (NFC)" (#85885)
Author: Jonas Devlieghere Date: 2024-03-19T17:48:46-07:00 New Revision: a289f66efd638c2af14cdb88968e4eaeea0c0605 URL: https://github.com/llvm/llvm-project/commit/a289f66efd638c2af14cdb88968e4eaeea0c0605 DIFF: https://github.com/llvm/llvm-project/commit/a289f66efd638c2af14cdb88968e4eaeea0c0605.diff LOG: Revert "[lldb] Store SupportFile in FileEntry (NFC)" (#85885) Reverts llvm/llvm-project#85468 because @slackito reports this broke stepping in one of their tests [1] and this patch was meant to be NFC. [1] https://github.com/llvm/llvm-project/commit/d5a277d309e92b1d3e493da6036cffdf815105b1#commitcomment-139991120 Added: Modified: lldb/include/lldb/Core/Disassembler.h lldb/include/lldb/Symbol/LineEntry.h lldb/include/lldb/Utility/SupportFile.h lldb/source/API/SBLineEntry.cpp lldb/source/API/SBThread.cpp lldb/source/Breakpoint/BreakpointResolver.cpp lldb/source/Breakpoint/BreakpointResolverFileLine.cpp lldb/source/Commands/CommandObjectBreakpoint.cpp lldb/source/Commands/CommandObjectSource.cpp lldb/source/Commands/CommandObjectThread.cpp lldb/source/Core/Address.cpp lldb/source/Core/Disassembler.cpp lldb/source/Core/FormatEntity.cpp lldb/source/Core/IOHandlerCursesGUI.cpp lldb/source/Core/SourceManager.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp lldb/source/Symbol/CompileUnit.cpp lldb/source/Symbol/Function.cpp lldb/source/Symbol/LineEntry.cpp lldb/source/Symbol/LineTable.cpp lldb/source/Symbol/SymbolContext.cpp lldb/source/Target/StackFrame.cpp lldb/source/Target/StackFrameList.cpp lldb/source/Target/Thread.cpp lldb/source/Target/TraceDumper.cpp Removed: diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h index e037a49f152c74..885ac1bb4a7ef8 100644 --- a/lldb/include/lldb/Core/Disassembler.h +++ b/lldb/include/lldb/Core/Disassembler.h @@ -538,7 +538,7 @@ class Disassembler : public std::enable_shared_from_this, ElideMixedSourceAndDisassemblyLine(const ExecutionContext _ctx, const SymbolContext , LineEntry ) { SourceLine sl; -sl.file = line.GetFile(); +sl.file = line.file; sl.line = line.line; sl.column = line.column; return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl); diff --git a/lldb/include/lldb/Symbol/LineEntry.h b/lldb/include/lldb/Symbol/LineEntry.h index eb8ad6ee9368d2..c2daba916e3f98 100644 --- a/lldb/include/lldb/Symbol/LineEntry.h +++ b/lldb/include/lldb/Symbol/LineEntry.h @@ -130,28 +130,18 @@ struct LineEntry { /// Shared pointer to the target this LineEntry belongs to. void ApplyFileMappings(lldb::TargetSP target_sp); - const FileSpec () const { -assert(file_sp); -return file_sp->GetSpecOnly(); - } - - /// The section offset address range for this line entry. - AddressRange range; - - /// The source file, possibly mapped by the target.source-map setting. - lldb::SupportFileSP file_sp; - - /// The original source file, from debug info. - lldb::SupportFileSP original_file_sp; - - /// The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line - /// number information. - uint32_t line = LLDB_INVALID_LINE_NUMBER; - - /// The column number of the source line, or zero if there is no column - /// information. - uint16_t column = 0; - + // Member variables. + AddressRange range; ///< The section offset address range for this line entry. + FileSpec file; ///< The source file, possibly mapped by the target.source-map + ///setting + lldb::SupportFileSP + original_file_sp; ///< The original source file, from debug info. + uint32_t line = LLDB_INVALID_LINE_NUMBER; ///< The source line number, or zero +///< if there is no line number +/// information. + uint16_t column = + 0; ///< The column number of the source line, or zero if there + /// is no column information. uint16_t is_start_of_statement : 1, ///< Indicates this entry is the beginning ///of a statement. is_start_of_basic_block : 1, ///< Indicates this entry is the beginning of diff --git a/lldb/include/lldb/Utility/SupportFile.h b/lldb/include/lldb/Utility/SupportFile.h index 7505d7f345c5dd..0ea0ca4e7c97a1 100644 --- a/lldb/include/lldb/Utility/SupportFile.h +++ b/lldb/include/lldb/Utility/SupportFile.h @@ -45,9 +45,6 @@ class SupportFile { /// Materialize the file to disk and return the path to that temporary file. virtual const FileSpec () { return m_file_spec; } - /// Change the file name. - void Update(const FileSpec _spec) { m_file_spec = file_spec; } - protected: FileSpec m_file_spec; Checksum
[Lldb-commits] [lldb] Revert "[lldb] Store SupportFile in FileEntry (NFC)" (PR #85885)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/85885 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Store SupportFile in FileEntry (NFC)" (PR #85885)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/85885 Reverts llvm/llvm-project#85468 because @slackito reports this broke stepping in one of their tests [1] and this patch was meant to be NFC. [1] https://github.com/llvm/llvm-project/commit/d5a277d309e92b1d3e493da6036cffdf815105b1#commitcomment-139991120 >From 719069e6b7e191e338bbb17e9e18b7974b5acef0 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 19 Mar 2024 17:47:26 -0700 Subject: [PATCH] Revert "[lldb] Store SupportFile in FileEntry (NFC) (#85468)" This reverts commit d5a277d309e92b1d3e493da6036cffdf815105b1. --- lldb/include/lldb/Core/Disassembler.h | 2 +- lldb/include/lldb/Symbol/LineEntry.h | 34 +++ lldb/include/lldb/Utility/SupportFile.h | 3 -- lldb/source/API/SBLineEntry.cpp | 10 +++--- lldb/source/API/SBThread.cpp | 2 +- lldb/source/Breakpoint/BreakpointResolver.cpp | 2 +- .../Breakpoint/BreakpointResolverFileLine.cpp | 7 ++-- .../Commands/CommandObjectBreakpoint.cpp | 4 +-- lldb/source/Commands/CommandObjectSource.cpp | 14 lldb/source/Commands/CommandObjectThread.cpp | 2 +- lldb/source/Core/Address.cpp | 2 +- lldb/source/Core/Disassembler.cpp | 8 ++--- lldb/source/Core/FormatEntity.cpp | 2 +- lldb/source/Core/IOHandlerCursesGUI.cpp | 11 +++--- lldb/source/Core/SourceManager.cpp| 2 +- .../Clang/ClangExpressionSourceCode.cpp | 2 +- .../Plugins/Language/CPlusPlus/LibCxx.cpp | 4 +-- lldb/source/Symbol/CompileUnit.cpp| 2 +- lldb/source/Symbol/Function.cpp | 4 +-- lldb/source/Symbol/LineEntry.cpp | 17 -- lldb/source/Symbol/LineTable.cpp | 4 +-- lldb/source/Symbol/SymbolContext.cpp | 4 +-- lldb/source/Target/StackFrame.cpp | 2 +- lldb/source/Target/StackFrameList.cpp | 4 +-- lldb/source/Target/Thread.cpp | 8 ++--- lldb/source/Target/TraceDumper.cpp| 4 +-- 26 files changed, 71 insertions(+), 89 deletions(-) diff --git a/lldb/include/lldb/Core/Disassembler.h b/lldb/include/lldb/Core/Disassembler.h index e037a49f152c74..885ac1bb4a7ef8 100644 --- a/lldb/include/lldb/Core/Disassembler.h +++ b/lldb/include/lldb/Core/Disassembler.h @@ -538,7 +538,7 @@ class Disassembler : public std::enable_shared_from_this, ElideMixedSourceAndDisassemblyLine(const ExecutionContext _ctx, const SymbolContext , LineEntry ) { SourceLine sl; -sl.file = line.GetFile(); +sl.file = line.file; sl.line = line.line; sl.column = line.column; return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl); diff --git a/lldb/include/lldb/Symbol/LineEntry.h b/lldb/include/lldb/Symbol/LineEntry.h index eb8ad6ee9368d2..c2daba916e3f98 100644 --- a/lldb/include/lldb/Symbol/LineEntry.h +++ b/lldb/include/lldb/Symbol/LineEntry.h @@ -130,28 +130,18 @@ struct LineEntry { /// Shared pointer to the target this LineEntry belongs to. void ApplyFileMappings(lldb::TargetSP target_sp); - const FileSpec () const { -assert(file_sp); -return file_sp->GetSpecOnly(); - } - - /// The section offset address range for this line entry. - AddressRange range; - - /// The source file, possibly mapped by the target.source-map setting. - lldb::SupportFileSP file_sp; - - /// The original source file, from debug info. - lldb::SupportFileSP original_file_sp; - - /// The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line - /// number information. - uint32_t line = LLDB_INVALID_LINE_NUMBER; - - /// The column number of the source line, or zero if there is no column - /// information. - uint16_t column = 0; - + // Member variables. + AddressRange range; ///< The section offset address range for this line entry. + FileSpec file; ///< The source file, possibly mapped by the target.source-map + ///setting + lldb::SupportFileSP + original_file_sp; ///< The original source file, from debug info. + uint32_t line = LLDB_INVALID_LINE_NUMBER; ///< The source line number, or zero +///< if there is no line number +/// information. + uint16_t column = + 0; ///< The column number of the source line, or zero if there + /// is no column information. uint16_t is_start_of_statement : 1, ///< Indicates this entry is the beginning ///of a statement. is_start_of_basic_block : 1, ///< Indicates this entry is the beginning of diff --git a/lldb/include/lldb/Utility/SupportFile.h b/lldb/include/lldb/Utility/SupportFile.h index 7505d7f345c5dd..0ea0ca4e7c97a1 100644 --- a/lldb/include/lldb/Utility/SupportFile.h +++ b/lldb/include/lldb/Utility/SupportFile.h @@ -45,9 +45,6 @@ class
[Lldb-commits] [lldb] [lldb/API] Add missing `eBroadcastBitSymbolsChanged` to SBTarget (NFC) (PR #85883)
https://github.com/medismailben closed https://github.com/llvm/llvm-project/pull/85883 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e2fa90f - [lldb/API] Add missing `eBroadcastBitSymbolsChanged` to SBTarget (NFC) (#85883)
Author: Med Ismail Bennani Date: 2024-03-20T00:42:59Z New Revision: e2fa90fa0a4b7950dd0d7fae6933e89c075d0af0 URL: https://github.com/llvm/llvm-project/commit/e2fa90fa0a4b7950dd0d7fae6933e89c075d0af0 DIFF: https://github.com/llvm/llvm-project/commit/e2fa90fa0a4b7950dd0d7fae6933e89c075d0af0.diff LOG: [lldb/API] Add missing `eBroadcastBitSymbolsChanged` to SBTarget (NFC) (#85883) This patch exposes the missing `eBroadcastBitSymbolsChanged` event bit in `SBTarget`. Signed-off-by: Med Ismail Bennani Added: Modified: lldb/include/lldb/API/SBTarget.h Removed: diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index f7bdd3093d2025..3644ac056da3dc 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/include/lldb/API/SBTarget.h @@ -42,7 +42,8 @@ class LLDB_API SBTarget { eBroadcastBitModulesLoaded = (1 << 1), eBroadcastBitModulesUnloaded = (1 << 2), eBroadcastBitWatchpointChanged = (1 << 3), -eBroadcastBitSymbolsLoaded = (1 << 4) +eBroadcastBitSymbolsLoaded = (1 << 4), +eBroadcastBitSymbolsChanged = (1 << 5), }; // Constructors ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/API] Add missing `eBroadcastBitSymbolsChanged` to SBTarget (NFC) (PR #85883)
https://github.com/medismailben updated https://github.com/llvm/llvm-project/pull/85883 >From 2d6450747584c99a0b40706e04cb7feee9297ad0 Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Wed, 20 Mar 2024 00:39:47 + Subject: [PATCH] [lldb/API] Add missing `eBroadcastBitSymbolsChanged` to SBTarget (NFC) This patch exposes the missing `eBroadcastBitSymbolsChanged` event bit in `SBTarget`. Signed-off-by: Med Ismail Bennani --- lldb/include/lldb/API/SBTarget.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index f7bdd3093d2025d..3644ac056da3dca 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/include/lldb/API/SBTarget.h @@ -42,7 +42,8 @@ class LLDB_API SBTarget { eBroadcastBitModulesLoaded = (1 << 1), eBroadcastBitModulesUnloaded = (1 << 2), eBroadcastBitWatchpointChanged = (1 << 3), -eBroadcastBitSymbolsLoaded = (1 << 4) +eBroadcastBitSymbolsLoaded = (1 << 4), +eBroadcastBitSymbolsChanged = (1 << 5), }; // Constructors ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/API] Add missing `eBroadcastBitSymbolsChanged` to SBTarget (NFC) (PR #85883)
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 22ac5f743811ae1e5004fdd43be556ebbd0496d1 f3c88d52cb72082d070a68822f0d1aad94ce306a -- lldb/include/lldb/API/SBTarget.h `` View the diff from clang-format here. ``diff diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index a8ba3d893a..2c6e9b7d03 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/include/lldb/API/SBTarget.h @@ -42,8 +42,8 @@ public: eBroadcastBitModulesLoaded = (1 << 1), eBroadcastBitModulesUnloaded = (1 << 2), eBroadcastBitWatchpointChanged = (1 << 3), -eBroadcastBitSymbolsLoaded = (1 << 4) -eBroadcastBitSymbolsChanged = (1 << 5), +eBroadcastBitSymbolsLoaded = (1 << 4) eBroadcastBitSymbolsChanged = +(1 << 5), }; // Constructors `` https://github.com/llvm/llvm-project/pull/85883 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/API] Add missing `eBroadcastBitSymbolsChanged` to SBTarget (NFC) (PR #85883)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Med Ismail Bennani (medismailben) Changes This patch exposes the missing `eBroadcastBitSymbolsChanged` event bit in `SBTarget`. --- Full diff: https://github.com/llvm/llvm-project/pull/85883.diff 1 Files Affected: - (modified) lldb/include/lldb/API/SBTarget.h (+1) ``diff diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index f7bdd3093d2025..a8ba3d893a0a3e 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/include/lldb/API/SBTarget.h @@ -43,6 +43,7 @@ class LLDB_API SBTarget { eBroadcastBitModulesUnloaded = (1 << 2), eBroadcastBitWatchpointChanged = (1 << 3), eBroadcastBitSymbolsLoaded = (1 << 4) +eBroadcastBitSymbolsChanged = (1 << 5), }; // Constructors `` https://github.com/llvm/llvm-project/pull/85883 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb/API] Add missing `eBroadcastBitSymbolsChanged` to SBTarget (NFC) (PR #85883)
https://github.com/medismailben created https://github.com/llvm/llvm-project/pull/85883 This patch exposes the missing `eBroadcastBitSymbolsChanged` event bit in `SBTarget`. >From f3c88d52cb72082d070a68822f0d1aad94ce306a Mon Sep 17 00:00:00 2001 From: Med Ismail Bennani Date: Wed, 20 Mar 2024 00:31:51 + Subject: [PATCH] [lldb/API] Add missing `eBroadcastBitSymbolsChanged` to SBTarget (NFC) This patch exposes the missing `eBroadcastBitSymbolsChanged` event bit in `SBTarget`. Signed-off-by: Med Ismail Bennani --- lldb/include/lldb/API/SBTarget.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h index f7bdd3093d2025..a8ba3d893a0a3e 100644 --- a/lldb/include/lldb/API/SBTarget.h +++ b/lldb/include/lldb/API/SBTarget.h @@ -43,6 +43,7 @@ class LLDB_API SBTarget { eBroadcastBitModulesUnloaded = (1 << 2), eBroadcastBitWatchpointChanged = (1 << 3), eBroadcastBitSymbolsLoaded = (1 << 4) +eBroadcastBitSymbolsChanged = (1 << 5), }; // Constructors ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Store SupportFile in FileEntry (NFC) (PR #85468)
dwblaikie wrote: (because we don't have a good sense of where feedback should be provided... crosslinking here from some feedback on the commit: https://github.com/llvm/llvm-project/commit/d5a277d309e92b1d3e493da6036cffdf815105b1#commitcomment-139991120 ) https://github.com/llvm/llvm-project/pull/85468 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)
kastiglione wrote: @jimingham now that I've switched to llvm format, I'll loop back and follow up on your comments. https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)
kastiglione wrote: I've updated this PR to use llvm formatting instead of printf. For the following reasons: 1. For printf, users would have to know the system's size of the value, eg `%d` vs `%ld` etc 2. Users would have to provide different values for different systems, which limits the use/convenience of such summary strings Getting the size wrong could be any of undefined behavior, buggy, crashy, insecure. https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove process restart prompt from TestSourceManager (PR #85861)
https://github.com/medismailben approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/85861 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)
https://github.com/kastiglione edited https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove process restart prompt from TestSourceManager (PR #85861)
https://github.com/bulbazord updated https://github.com/llvm/llvm-project/pull/85861 >From c24630bbccd3d53079314f7dc6393ffa27ea192f Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 19 Mar 2024 13:18:23 -0700 Subject: [PATCH 1/2] [lldb] Remove process restart prompt from TestSourceManager In TestSourceManager, test_artificial_source_location will give the process restart prompt if you run the test individually. The reason is that we run the process twice: first using a convenience function to run to a specific breakpoint and then again to check for a specific message emitted when you hit the breakpoint. Instead of running twice and making the test difficult to run individually, we can just check for the specific messages using other commands instead. --- lldb/test/API/source-manager/TestSourceManager.py | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/source-manager/TestSourceManager.py b/lldb/test/API/source-manager/TestSourceManager.py index eab8924d108146..896fec24791cd2 100644 --- a/lldb/test/API/source-manager/TestSourceManager.py +++ b/lldb/test/API/source-manager/TestSourceManager.py @@ -323,13 +323,13 @@ def test_artificial_source_location(self): ) self.expect( -"run", -RUN_SUCCEEDED, +"thread info", substrs=[f"{src_file}:0", "stop reason = breakpoint"] +) +self.expect( +"frame select 0", substrs=[ -"stop reason = breakpoint", -"%s:%d" % (src_file, 0), -"Note: this address is compiler-generated code in " "function", -"that has no source code associated " "with it.", +"Note: this address is compiler-generated code in function", +"that has no source code associated with it.", ], ) >From ab0a0d026f129be17505f8b34406f7ca94332d2e Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 19 Mar 2024 16:12:29 -0700 Subject: [PATCH 2/2] Collapse into one command --- lldb/test/API/source-manager/TestSourceManager.py | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lldb/test/API/source-manager/TestSourceManager.py b/lldb/test/API/source-manager/TestSourceManager.py index 896fec24791cd2..ad7c85aac70eaf 100644 --- a/lldb/test/API/source-manager/TestSourceManager.py +++ b/lldb/test/API/source-manager/TestSourceManager.py @@ -323,11 +323,10 @@ def test_artificial_source_location(self): ) self.expect( -"thread info", substrs=[f"{src_file}:0", "stop reason = breakpoint"] -) -self.expect( -"frame select 0", +"process status", substrs=[ +"stop reason = breakpoint", +f"{src_file}:0", "Note: this address is compiler-generated code in function", "that has no source code associated with it.", ], ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)
https://github.com/kastiglione edited https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)
https://github.com/kastiglione updated https://github.com/llvm/llvm-project/pull/81196 >From 81a2034ff2b41e30a1f5b82c86b4d5d4c429ed52 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Thu, 8 Feb 2024 13:59:12 -0800 Subject: [PATCH 1/5] [lldb] Support custom printf formatting for variables --- lldb/source/Core/FormatEntity.cpp | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index fa5eadc6ff4e9a..0e929203935304 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -883,8 +883,29 @@ static bool DumpValue(Stream , const SymbolContext *sc, } if (!is_array_range) { -LLDB_LOGF(log, - "[Debugger::FormatPrompt] dumping ordinary printable output"); +if (!entry.printf_format.empty()) { + auto type_info = target->GetTypeInfo(); + if (type_info & eTypeIsInteger) { +if (type_info & eTypeIsSigned) { + bool success = false; + auto integer = target->GetValueAsSigned(0, ); + if (success) { +LLDB_LOGF(log, "dumping using printf format"); +s.Printf(entry.printf_format.c_str(), integer); +return true; + } +} else { + bool success = false; + auto integer = target->GetValueAsUnsigned(0, ); + if (success) { +LLDB_LOGF(log, "dumping using printf format"); +s.Printf(entry.printf_format.c_str(), integer); +return true; + } +} + } +} +LLDB_LOGF(log, "dumping ordinary printable output"); return target->DumpPrintableRepresentation(s, val_obj_display, custom_format); } else { >From 335ab1de4b39257e3bbb3bd969a0dd6991747558 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Tue, 13 Feb 2024 13:26:35 -0800 Subject: [PATCH 2/5] Factor out DumpValueWithPrintf; Add test --- lldb/source/Core/FormatEntity.cpp | 45 +++ .../custom-printf-summary/Makefile| 2 + .../TestCustomPrintfSummary.py| 11 + .../custom-printf-summary/main.c | 13 ++ 4 files changed, 52 insertions(+), 19 deletions(-) create mode 100644 lldb/test/API/functionalities/data-formatter/custom-printf-summary/Makefile create mode 100644 lldb/test/API/functionalities/data-formatter/custom-printf-summary/TestCustomPrintfSummary.py create mode 100644 lldb/test/API/functionalities/data-formatter/custom-printf-summary/main.c diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 0e929203935304..57a05507d844cf 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -658,6 +658,25 @@ static char ConvertValueObjectStyleToChar( return '\0'; } +static bool DumpValueWithPrintf(Stream , llvm::StringRef format, +ValueObject ) { + auto type_info = target.GetTypeInfo(); + if (type_info & eTypeIsInteger) { +if (type_info & eTypeIsSigned) { + if (auto integer = target.GetValueAsSigned()) { +s.Printf(format.data(), *integer); +return true; + } +} else { + if (auto integer = target.GetValueAsUnsigned()) { +s.Printf(format.data(), *integer); +return true; + } +} + } + return false; +} + static bool DumpValue(Stream , const SymbolContext *sc, const ExecutionContext *exe_ctx, const FormatEntity::Entry , ValueObject *valobj) { @@ -884,25 +903,13 @@ static bool DumpValue(Stream , const SymbolContext *sc, if (!is_array_range) { if (!entry.printf_format.empty()) { - auto type_info = target->GetTypeInfo(); - if (type_info & eTypeIsInteger) { -if (type_info & eTypeIsSigned) { - bool success = false; - auto integer = target->GetValueAsSigned(0, ); - if (success) { -LLDB_LOGF(log, "dumping using printf format"); -s.Printf(entry.printf_format.c_str(), integer); -return true; - } -} else { - bool success = false; - auto integer = target->GetValueAsUnsigned(0, ); - if (success) { -LLDB_LOGF(log, "dumping using printf format"); -s.Printf(entry.printf_format.c_str(), integer); -return true; - } -} + if (DumpValueWithPrintf(s, entry.printf_format, *target)) { +LLDB_LOGF(log, "dumping using printf format"); +return true; + } else { +LLDB_LOG(log, + "unsupported printf format '{0}' - for type info flags {1}", + entry.printf_format, target->GetTypeInfo()); } } LLDB_LOGF(log, "dumping ordinary printable output"); diff --git a/lldb/test/API/functionalities/data-formatter/custom-printf-summary/Makefile
[Lldb-commits] [lldb] [lldb] Remove process restart prompt from TestSourceManager (PR #85861)
@@ -323,13 +323,13 @@ def test_artificial_source_location(self): ) self.expect( -"run", -RUN_SUCCEEDED, +"thread info", substrs=[f"{src_file}:0", "stop reason = breakpoint"] +) +self.expect( +"frame select 0", substrs=[ -"stop reason = breakpoint", -"%s:%d" % (src_file, 0), -"Note: this address is compiler-generated code in " "function", -"that has no source code associated " "with it.", +"Note: this address is compiler-generated code in function", +"that has no source code associated with it.", bulbazord wrote: Just tried it out, it totally can be. Thanks for the tip! https://github.com/llvm/llvm-project/pull/85861 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove process restart prompt from TestSourceManager (PR #85861)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/85861 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove process restart prompt from TestSourceManager (PR #85861)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Alex Langford (bulbazord) Changes In TestSourceManager, test_artificial_source_location will give the process restart prompt if you run the test individually. The reason is that we run the process twice: first using a convenience function to run to a specific breakpoint and then again to check for a specific message emitted when you hit the breakpoint. Instead of running twice and making the test difficult to run individually, we can just check for the specific messages using other commands. --- Full diff: https://github.com/llvm/llvm-project/pull/85861.diff 1 Files Affected: - (modified) lldb/test/API/source-manager/TestSourceManager.py (+6-6) ``diff diff --git a/lldb/test/API/source-manager/TestSourceManager.py b/lldb/test/API/source-manager/TestSourceManager.py index eab8924d108146..896fec24791cd2 100644 --- a/lldb/test/API/source-manager/TestSourceManager.py +++ b/lldb/test/API/source-manager/TestSourceManager.py @@ -323,13 +323,13 @@ def test_artificial_source_location(self): ) self.expect( -"run", -RUN_SUCCEEDED, +"thread info", substrs=[f"{src_file}:0", "stop reason = breakpoint"] +) +self.expect( +"frame select 0", substrs=[ -"stop reason = breakpoint", -"%s:%d" % (src_file, 0), -"Note: this address is compiler-generated code in " "function", -"that has no source code associated " "with it.", +"Note: this address is compiler-generated code in function", +"that has no source code associated with it.", ], ) `` https://github.com/llvm/llvm-project/pull/85861 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove process restart prompt from TestSourceManager (PR #85861)
https://github.com/bulbazord created https://github.com/llvm/llvm-project/pull/85861 In TestSourceManager, test_artificial_source_location will give the process restart prompt if you run the test individually. The reason is that we run the process twice: first using a convenience function to run to a specific breakpoint and then again to check for a specific message emitted when you hit the breakpoint. Instead of running twice and making the test difficult to run individually, we can just check for the specific messages using other commands. >From c24630bbccd3d53079314f7dc6393ffa27ea192f Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 19 Mar 2024 13:18:23 -0700 Subject: [PATCH] [lldb] Remove process restart prompt from TestSourceManager In TestSourceManager, test_artificial_source_location will give the process restart prompt if you run the test individually. The reason is that we run the process twice: first using a convenience function to run to a specific breakpoint and then again to check for a specific message emitted when you hit the breakpoint. Instead of running twice and making the test difficult to run individually, we can just check for the specific messages using other commands instead. --- lldb/test/API/source-manager/TestSourceManager.py | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/source-manager/TestSourceManager.py b/lldb/test/API/source-manager/TestSourceManager.py index eab8924d108146..896fec24791cd2 100644 --- a/lldb/test/API/source-manager/TestSourceManager.py +++ b/lldb/test/API/source-manager/TestSourceManager.py @@ -323,13 +323,13 @@ def test_artificial_source_location(self): ) self.expect( -"run", -RUN_SUCCEEDED, +"thread info", substrs=[f"{src_file}:0", "stop reason = breakpoint"] +) +self.expect( +"frame select 0", substrs=[ -"stop reason = breakpoint", -"%s:%d" % (src_file, 0), -"Note: this address is compiler-generated code in " "function", -"that has no source code associated " "with it.", +"Note: this address is compiler-generated code in function", +"that has no source code associated with it.", ], ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Invert relationship between Process and AddressableBits (PR #85858)
https://github.com/jasonmolenda approved this pull request. Thanks for fixing this, I hadn't been paying attention to the separation when I added this method. https://github.com/llvm/llvm-project/pull/85858 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Omit --show-globals in `help target var` (PR #85855)
@@ -50,6 +50,11 @@ static constexpr OptionDefinition g_variable_options[] = { "Specify a summary string to use to format the variable output."}, }; +static constexpr auto g_num_frame_options = 4; felipepiovezan wrote: Sadly it seems we need to hand-maintain it. The basic thing we need to maintain is "here is an array of options for target var, and here is an array of options for frame var", and one array is a suffix of the other. And they have to be arrays, because of the indexing that is done on them. Given all of that, I don't think there is a clean way to avoid having to maintain this constant, but the hope is that with the new approach it becomes harder to make the mistake that introduced this bug. https://github.com/llvm/llvm-project/pull/85855 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Invert relationship between Process and AddressableBits (PR #85858)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Alex Langford (bulbazord) Changes AddressableBits is in the Utility module of LLDB. It currently directly refers to Process, which is from the Target LLDB module. This is a layering violation which concretely means that it is impossible to link anything that uses Utility without it also using Target as well. This is generally not an issue for LLDB (since everything is built together) but it may make it difficult to write unit tests for AddressableBits later on. --- Full diff: https://github.com/llvm/llvm-project/pull/85858.diff 6 Files Affected: - (modified) lldb/include/lldb/Target/Process.h (+3) - (modified) lldb/include/lldb/Utility/AddressableBits.h (+4-2) - (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (+2-2) - (modified) lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp (+1-1) - (modified) lldb/source/Target/Process.cpp (+23) - (modified) lldb/source/Utility/AddressableBits.cpp (+10-18) ``diff diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index e260e1b4b797bc..2f3a3c22422efe 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -43,6 +43,7 @@ #include "lldb/Target/ThreadList.h" #include "lldb/Target/ThreadPlanStack.h" #include "lldb/Target/Trace.h" +#include "lldb/Utility/AddressableBits.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/Broadcaster.h" #include "lldb/Utility/Event.h" @@ -3219,6 +3220,8 @@ void PruneThreadPlans(); void LoadOperatingSystemPlugin(bool flush); + void SetAddressableBitMasks(AddressableBits bit_masks); + private: Status DestroyImpl(bool force_kill); diff --git a/lldb/include/lldb/Utility/AddressableBits.h b/lldb/include/lldb/Utility/AddressableBits.h index 75752fcf840a44..0d27c3561ec272 100644 --- a/lldb/include/lldb/Utility/AddressableBits.h +++ b/lldb/include/lldb/Utility/AddressableBits.h @@ -32,11 +32,13 @@ class AddressableBits { void SetLowmemAddressableBits(uint32_t lowmem_addressing_bits); + uint32_t GetLowmemAddressableBits() const; + void SetHighmemAddressableBits(uint32_t highmem_addressing_bits); - static lldb::addr_t AddressableBitToMask(uint32_t addressable_bits); + uint32_t GetHighmemAddressableBits() const; - void SetProcessMasks(lldb_private::Process ); + static lldb::addr_t AddressableBitToMask(uint32_t addressable_bits); private: uint32_t m_low_memory_addr_bits; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 5b9a9d71802f86..871683a605686f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -900,7 +900,7 @@ void ProcessGDBRemote::DidLaunchOrAttach(ArchSpec _arch) { } AddressableBits addressable_bits = m_gdb_comm.GetAddressableBits(); - addressable_bits.SetProcessMasks(*this); + SetAddressableBitMasks(addressable_bits); if (process_arch.IsValid()) { const ArchSpec _arch = GetTarget().GetArchitecture(); @@ -2337,7 +2337,7 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor _packet) { } } -addressable_bits.SetProcessMasks(*this); +SetAddressableBitMasks(addressable_bits); ThreadSP thread_sp = SetThreadStopInfo( tid, expedited_register_map, signo, thread_name, reason, description, diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index 7b9938d4f02020..1da7696c9a352a 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -574,7 +574,7 @@ Status ProcessMachCore::DoLoadCore() { CleanupMemoryRegionPermissions(); AddressableBits addressable_bits = core_objfile->GetAddressableBits(); - addressable_bits.SetProcessMasks(*this); + SetAddressableBitMasks(addressable_bits); return error; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 6d58873b54a3ad..f02ec37cb0f08f 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -63,6 +63,7 @@ #include "lldb/Target/ThreadPlanCallFunction.h" #include "lldb/Target/ThreadPlanStack.h" #include "lldb/Target/UnixSignals.h" +#include "lldb/Utility/AddressableBits.h" #include "lldb/Utility/Event.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" @@ -6453,3 +6454,25 @@ Status Process::CalculateCoreFileSaveRanges(lldb::SaveCoreStyle core_style, return Status(); // Success! } + +void Process::SetAddressableBitMasks(AddressableBits bit_masks) { + uint32_t low_memory_addr_bits = bit_masks.GetLowmemAddressableBits(); + uint32_t high_memory_addr_bits = bit_masks.GetHighmemAddressableBits(); + + if (low_memory_addr_bits == 0 && high_memory_addr_bits == 0) +return; + +
[Lldb-commits] [lldb] [lldb] Invert relationship between Process and AddressableBits (PR #85858)
https://github.com/bulbazord created https://github.com/llvm/llvm-project/pull/85858 AddressableBits is in the Utility module of LLDB. It currently directly refers to Process, which is from the Target LLDB module. This is a layering violation which concretely means that it is impossible to link anything that uses Utility without it also using Target as well. This is generally not an issue for LLDB (since everything is built together) but it may make it difficult to write unit tests for AddressableBits later on. >From 476a9c40ce60008255a6f248b5ffd7c3f87b1215 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 19 Mar 2024 12:59:16 -0700 Subject: [PATCH] [lldb] Invert relationship between Process and AddressableBits AddressableBits is in the Utility module of LLDB. It currently directly refers to Process, which is from the Target LLDB module. This is a layering violation which concretely means that it is impossible to link anything that uses Utility without it also using Target as well. This is generally not an issue for LLDB (since everything is built together) but it may make it difficult to write unit tests for AddressableBits later on. --- lldb/include/lldb/Target/Process.h| 3 ++ lldb/include/lldb/Utility/AddressableBits.h | 6 ++-- .../Process/gdb-remote/ProcessGDBRemote.cpp | 4 +-- .../Process/mach-core/ProcessMachCore.cpp | 2 +- lldb/source/Target/Process.cpp| 23 +++ lldb/source/Utility/AddressableBits.cpp | 28 +++ 6 files changed, 43 insertions(+), 23 deletions(-) diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index e260e1b4b797bc..2f3a3c22422efe 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -43,6 +43,7 @@ #include "lldb/Target/ThreadList.h" #include "lldb/Target/ThreadPlanStack.h" #include "lldb/Target/Trace.h" +#include "lldb/Utility/AddressableBits.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/Broadcaster.h" #include "lldb/Utility/Event.h" @@ -3219,6 +3220,8 @@ void PruneThreadPlans(); void LoadOperatingSystemPlugin(bool flush); + void SetAddressableBitMasks(AddressableBits bit_masks); + private: Status DestroyImpl(bool force_kill); diff --git a/lldb/include/lldb/Utility/AddressableBits.h b/lldb/include/lldb/Utility/AddressableBits.h index 75752fcf840a44..0d27c3561ec272 100644 --- a/lldb/include/lldb/Utility/AddressableBits.h +++ b/lldb/include/lldb/Utility/AddressableBits.h @@ -32,11 +32,13 @@ class AddressableBits { void SetLowmemAddressableBits(uint32_t lowmem_addressing_bits); + uint32_t GetLowmemAddressableBits() const; + void SetHighmemAddressableBits(uint32_t highmem_addressing_bits); - static lldb::addr_t AddressableBitToMask(uint32_t addressable_bits); + uint32_t GetHighmemAddressableBits() const; - void SetProcessMasks(lldb_private::Process ); + static lldb::addr_t AddressableBitToMask(uint32_t addressable_bits); private: uint32_t m_low_memory_addr_bits; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 5b9a9d71802f86..871683a605686f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -900,7 +900,7 @@ void ProcessGDBRemote::DidLaunchOrAttach(ArchSpec _arch) { } AddressableBits addressable_bits = m_gdb_comm.GetAddressableBits(); - addressable_bits.SetProcessMasks(*this); + SetAddressableBitMasks(addressable_bits); if (process_arch.IsValid()) { const ArchSpec _arch = GetTarget().GetArchitecture(); @@ -2337,7 +2337,7 @@ StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor _packet) { } } -addressable_bits.SetProcessMasks(*this); +SetAddressableBitMasks(addressable_bits); ThreadSP thread_sp = SetThreadStopInfo( tid, expedited_register_map, signo, thread_name, reason, description, diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index 7b9938d4f02020..1da7696c9a352a 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -574,7 +574,7 @@ Status ProcessMachCore::DoLoadCore() { CleanupMemoryRegionPermissions(); AddressableBits addressable_bits = core_objfile->GetAddressableBits(); - addressable_bits.SetProcessMasks(*this); + SetAddressableBitMasks(addressable_bits); return error; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 6d58873b54a3ad..f02ec37cb0f08f 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -63,6 +63,7 @@ #include "lldb/Target/ThreadPlanCallFunction.h" #include "lldb/Target/ThreadPlanStack.h" #include "lldb/Target/UnixSignals.h" +#include
[Lldb-commits] [lldb] [lldb] Omit --show-globals in `help target var` (PR #85855)
https://github.com/bulbazord edited https://github.com/llvm/llvm-project/pull/85855 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Omit --show-globals in `help target var` (PR #85855)
https://github.com/bulbazord edited https://github.com/llvm/llvm-project/pull/85855 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Omit --show-globals in `help target var` (PR #85855)
@@ -50,6 +50,11 @@ static constexpr OptionDefinition g_variable_options[] = { "Specify a summary string to use to format the variable output."}, }; +static constexpr auto g_num_frame_options = 4; bulbazord wrote: Is this number computable? Or does it need to be hand-maintained? https://github.com/llvm/llvm-project/pull/85855 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Omit --show-globals in `help target var` (PR #85855)
https://github.com/bulbazord commented: Big fan of centralizing the options here. I had one question about automating another portion of this, but otherwise LGTM. https://github.com/llvm/llvm-project/pull/85855 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Omit --show-globals in `help target var` (PR #85855)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Felipe de Azevedo Piovezan (felipepiovezan) Changes This option doesn't exist. It is currently displayed by `help target var` due to a bug introduced by 41ae8e7445 in 2018. Some code for `target var` and `frame var` is shared, and some hard-code constants are used in order to filter out options that belong only to `frame var`. However, the aforementioned commit failed to update these constants properly. This patch addresses the issue by having a _single_ place where the filtering of options needs to be done. --- Full diff: https://github.com/llvm/llvm-project/pull/85855.diff 2 Files Affected: - (modified) lldb/source/Interpreter/OptionGroupVariable.cpp (+12-14) - (modified) lldb/test/API/functionalities/target_var/TestTargetVar.py (+10) ``diff diff --git a/lldb/source/Interpreter/OptionGroupVariable.cpp b/lldb/source/Interpreter/OptionGroupVariable.cpp index 0e35a641361b82..99644b3f423c81 100644 --- a/lldb/source/Interpreter/OptionGroupVariable.cpp +++ b/lldb/source/Interpreter/OptionGroupVariable.cpp @@ -50,6 +50,11 @@ static constexpr OptionDefinition g_variable_options[] = { "Specify a summary string to use to format the variable output."}, }; +static constexpr auto g_num_frame_options = 4; +static const auto g_variable_options_noframe = +llvm::ArrayRef(g_variable_options) +.drop_front(g_num_frame_options); + static Status ValidateNamedSummary(const char *str, void *) { if (!str || !str[0]) return Status("must specify a valid named summary"); @@ -77,9 +82,9 @@ OptionGroupVariable::SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { Status error; - if (!include_frame_options) -option_idx += 3; - const int short_option = g_variable_options[option_idx].short_option; + llvm::ArrayRef variable_options = + include_frame_options ? g_variable_options : g_variable_options_noframe; + const int short_option = variable_options[option_idx].short_option; switch (short_option) { case 'r': use_regex = true; @@ -128,16 +133,9 @@ void OptionGroupVariable::OptionParsingStarting( summary_string.Clear(); } -#define NUM_FRAME_OPTS 3 - llvm::ArrayRef OptionGroupVariable::GetDefinitions() { - auto result = llvm::ArrayRef(g_variable_options); - // Show the "--no-args", "--no-locals" and "--show-globals" options if we are - // showing frame specific options - if (include_frame_options) -return result; - - // Skip the "--no-args", "--no-locals" and "--show-globals" options if we are - // not showing frame specific options (globals only) - return result.drop_front(NUM_FRAME_OPTS); + // Show the "--no-args", "--no-recognized-args", "--no-locals" and + // "--show-globals" options if we are showing frame specific options + return include_frame_options ? g_variable_options + : g_variable_options_noframe; } diff --git a/lldb/test/API/functionalities/target_var/TestTargetVar.py b/lldb/test/API/functionalities/target_var/TestTargetVar.py index a0f3663f036510..54b7b77b6773ce 100644 --- a/lldb/test/API/functionalities/target_var/TestTargetVar.py +++ b/lldb/test/API/functionalities/target_var/TestTargetVar.py @@ -15,6 +15,16 @@ class targetCommandTestCase(TestBase): def testTargetVarExpr(self): self.build() lldbutil.run_to_name_breakpoint(self, "main") +self.expect( +"help target variable", +substrs=[ +"--no-args", +"--no-recognized-args", +"--no-locals", +"--show-globals", +], +matching=False, +) self.expect("target variable i", substrs=["i", "42"]) self.expect( "target variable var", patterns=["\(incomplete \*\) var = 0[xX](0)*dead"] `` https://github.com/llvm/llvm-project/pull/85855 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Omit --show-globals in `help target var` (PR #85855)
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/85855 This option doesn't exist. It is currently displayed by `help target var` due to a bug introduced by 41ae8e7445 in 2018. Some code for `target var` and `frame var` is shared, and some hard-code constants are used in order to filter out options that belong only to `frame var`. However, the aforementioned commit failed to update these constants properly. This patch addresses the issue by having a _single_ place where the filtering of options needs to be done. >From 2ba04f7df635e9f51407e4439dcd1f73fc6bfdef Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Tue, 19 Mar 2024 12:39:42 -0700 Subject: [PATCH] [lldb] Omit --show-globals in `help target var` This option doesn't exist. It is currently displayed by `help target var` due to a bug introduced by 41ae8e7445 in 2018. Some code for `target var` and `frame var` is shared, and some hard-code constants are used in order to filter out options that belong only to `frame var`. However, the aforementioned commit failed to update these constants properly. This patch addresses the issue by having a _single_ place where the filtering of options needs to be done. --- .../Interpreter/OptionGroupVariable.cpp | 26 +-- .../target_var/TestTargetVar.py | 10 +++ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/lldb/source/Interpreter/OptionGroupVariable.cpp b/lldb/source/Interpreter/OptionGroupVariable.cpp index 0e35a641361b82..99644b3f423c81 100644 --- a/lldb/source/Interpreter/OptionGroupVariable.cpp +++ b/lldb/source/Interpreter/OptionGroupVariable.cpp @@ -50,6 +50,11 @@ static constexpr OptionDefinition g_variable_options[] = { "Specify a summary string to use to format the variable output."}, }; +static constexpr auto g_num_frame_options = 4; +static const auto g_variable_options_noframe = +llvm::ArrayRef(g_variable_options) +.drop_front(g_num_frame_options); + static Status ValidateNamedSummary(const char *str, void *) { if (!str || !str[0]) return Status("must specify a valid named summary"); @@ -77,9 +82,9 @@ OptionGroupVariable::SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { Status error; - if (!include_frame_options) -option_idx += 3; - const int short_option = g_variable_options[option_idx].short_option; + llvm::ArrayRef variable_options = + include_frame_options ? g_variable_options : g_variable_options_noframe; + const int short_option = variable_options[option_idx].short_option; switch (short_option) { case 'r': use_regex = true; @@ -128,16 +133,9 @@ void OptionGroupVariable::OptionParsingStarting( summary_string.Clear(); } -#define NUM_FRAME_OPTS 3 - llvm::ArrayRef OptionGroupVariable::GetDefinitions() { - auto result = llvm::ArrayRef(g_variable_options); - // Show the "--no-args", "--no-locals" and "--show-globals" options if we are - // showing frame specific options - if (include_frame_options) -return result; - - // Skip the "--no-args", "--no-locals" and "--show-globals" options if we are - // not showing frame specific options (globals only) - return result.drop_front(NUM_FRAME_OPTS); + // Show the "--no-args", "--no-recognized-args", "--no-locals" and + // "--show-globals" options if we are showing frame specific options + return include_frame_options ? g_variable_options + : g_variable_options_noframe; } diff --git a/lldb/test/API/functionalities/target_var/TestTargetVar.py b/lldb/test/API/functionalities/target_var/TestTargetVar.py index a0f3663f036510..54b7b77b6773ce 100644 --- a/lldb/test/API/functionalities/target_var/TestTargetVar.py +++ b/lldb/test/API/functionalities/target_var/TestTargetVar.py @@ -15,6 +15,16 @@ class targetCommandTestCase(TestBase): def testTargetVarExpr(self): self.build() lldbutil.run_to_name_breakpoint(self, "main") +self.expect( +"help target variable", +substrs=[ +"--no-args", +"--no-recognized-args", +"--no-locals", +"--show-globals", +], +matching=False, +) self.expect("target variable i", substrs=["i", "42"]) self.expect( "target variable var", patterns=["\(incomplete \*\) var = 0[xX](0)*dead"] ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add register lookup as another fallback computation for address-expressions (PR #85492)
https://github.com/adrian-prantl approved this pull request. https://github.com/llvm/llvm-project/pull/85492 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)
https://github.com/kevinfrei edited https://github.com/llvm/llvm-project/pull/85693 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)
https://github.com/kevinfrei updated https://github.com/llvm/llvm-project/pull/85693 >From 9713607cd4839ad355c7fd2e786ae7eb5a96f637 Mon Sep 17 00:00:00 2001 From: Kevin Frei Date: Fri, 15 Mar 2024 08:54:04 -0700 Subject: [PATCH 1/5] Tests (w/fixes) for initial DebugInfoD LLDB integration Summary: While adding tests for DebugInfoD integration, there were a couple issues that came up: DWP from /debuginfo for a stripped binary needs to return symbols from /executable Test Plan: Added some API tests Reviewers: gclayton, hyubo Subscribers: Tasks: T179375937 Tags: debuginfod Differential Revision: https://phabricator.intern.facebook.com/D54953389 --- .../Python/lldbsuite/test/make/Makefile.rules | 33 +++- .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 40 +++-- .../Plugins/SymbolLocator/CMakeLists.txt | 7 +- .../SymbolVendor/ELF/SymbolVendorELF.cpp | 32 +++- lldb/test/API/debuginfod/Normal/Makefile | 25 +++ .../API/debuginfod/Normal/TestDebuginfod.py | 159 + lldb/test/API/debuginfod/Normal/main.c| 7 + lldb/test/API/debuginfod/SplitDWARF/Makefile | 29 +++ .../SplitDWARF/TestDebuginfodDWP.py | 167 ++ lldb/test/API/debuginfod/SplitDWARF/main.c| 7 + 10 files changed, 489 insertions(+), 17 deletions(-) create mode 100644 lldb/test/API/debuginfod/Normal/Makefile create mode 100644 lldb/test/API/debuginfod/Normal/TestDebuginfod.py create mode 100644 lldb/test/API/debuginfod/Normal/main.c create mode 100644 lldb/test/API/debuginfod/SplitDWARF/Makefile create mode 100644 lldb/test/API/debuginfod/SplitDWARF/TestDebuginfodDWP.py create mode 100644 lldb/test/API/debuginfod/SplitDWARF/main.c diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index bfd249ccd43f2e..b33c087357a79b 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -51,7 +51,7 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../ # # GNUWin32 uname gives "windows32" or "server version windows32" while # some versions of MSYS uname return "MSYS_NT*", but most environments -# standardize on "Windows_NT", so we'll make it consistent here. +# standardize on "Windows_NT", so we'll make it consistent here. # When running tests from Visual Studio, the environment variable isn't # inherited all the way down to the process spawned for make. #-- @@ -210,6 +210,12 @@ else ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" DSYM = $(EXE).debug endif + + ifeq "$(MERGE_DWOS)" "YES" + MAKE_DWO := YES + DWP_NAME = $(EXE).dwp + DYLIB_DWP_NAME = $(DYLIB_NAME).dwp + endif endif LIMIT_DEBUG_INFO_FLAGS = @@ -357,6 +363,7 @@ ifneq "$(OS)" "Darwin" OBJCOPY ?= $(call replace_cc_with,objcopy) ARCHIVER ?= $(call replace_cc_with,ar) + DWP ?= $(call replace_cc_with,dwp) override AR = $(ARCHIVER) endif @@ -527,6 +534,10 @@ ifneq "$(CXX)" "" endif endif +ifeq "$(GEN_GNU_BUILD_ID)" "YES" + LDFLAGS += -Wl,--build-id +endif + #-- # DYLIB_ONLY variable can be used to skip the building of a.out. # See the sections below regarding dSYM file as well as the building of @@ -565,11 +576,25 @@ else endif else ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" +ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES" + cp "$(EXE)" "$(EXE).full" +endif $(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)" $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)" endif +ifeq "$(MERGE_DWOS)" "YES" + $(DWP) -o "$(DWP_NAME)" $(DWOS) +endif endif + +#-- +# Support emitting the context of the GNU build-id into a file +# This needs to be used in conjunction with GEN_GNU_BUILD_ID := YES +#-- +$(EXE).uuid : $(EXE) + $(OBJCOPY) --dump-section=.note.gnu.build-id=$@ $< + #-- # Make the dylib #-- @@ -610,9 +635,15 @@ endif else $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)" ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" + ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES" + cp "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).full" + endif $(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug" $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)" endif +ifeq "$(MERGE_DWOS)" "YES" + $(DWP) -o $(DYLIB_DWP_FILE) $(DYLIB_DWOS) +endif endif
[Lldb-commits] [lldb] DebugInfoD tests + fixing issues exposed by tests (PR #85693)
@@ -4377,26 +4377,40 @@ const std::shared_ptr ::GetDwpSymbolFile() { FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); ModuleSpec module_spec; module_spec.GetFileSpec() = m_objfile_sp->GetFileSpec(); +FileSpec dwp_filespec; for (const auto : symfiles.files()) { module_spec.GetSymbolFileSpec() = FileSpec(symfile.GetPath() + ".dwp", symfile.GetPathStyle()); LLDB_LOG(log, "Searching for DWP using: \"{0}\"", module_spec.GetSymbolFileSpec()); - FileSpec dwp_filespec = + dwp_filespec = PluginManager::LocateExecutableSymbolFile(module_spec, search_paths); if (FileSystem::Instance().Exists(dwp_filespec)) { -LLDB_LOG(log, "Found DWP file: \"{0}\"", dwp_filespec); -DataBufferSP dwp_file_data_sp; -lldb::offset_t dwp_file_data_offset = 0; -ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin( -GetObjectFile()->GetModule(), _filespec, 0, -FileSystem::Instance().GetByteSize(dwp_filespec), dwp_file_data_sp, -dwp_file_data_offset); -if (dwp_obj_file) { - m_dwp_symfile = std::make_shared( - *this, dwp_obj_file, DIERef::k_file_index_mask); - break; -} +break; + } +} +if (!FileSystem::Instance().Exists(dwp_filespec)) { + LLDB_LOG(log, "No DWP file found locally"); + // Fill in the UUID for the module we're trying to match for, so we can + // find the correct DWP file, as the Debuginfod plugin uses *only* this + // data to correctly match the DWP file with the binary. + module_spec.GetUUID() = m_objfile_sp->GetUUID(); + dwp_filespec = + PluginManager::LocateExecutableSymbolFile(module_spec, search_paths); + // Set it back so it's not outliving the m_objfile_sp shared pointer. + module_spec.GetUUID() = {}; kevinfrei wrote: Actually, that line of code is left-over from a previous iteration (before I moved it to after the original loop). @clayborg had removed the assignment for other reasons, but it needs to be there for the Debuginfod plugin. It's not used again, and doesn't hurt anything (the original value is actually {}, because that module_spec is a file-loc only skeleton). I've removed the line. https://github.com/llvm/llvm-project/pull/85693 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatter] Fix format specifiers in LibCxxSliceArray summary provider (PR #85763)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/85763 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 7edfbf2 - [lldb][DataFormatter] Fix format specifiers in LibCxxSliceArray summary provider (#85763)
Author: Michael Buch Date: 2024-03-19T11:26:43Z New Revision: 7edfbf2af2253297f48ff8adaba99373f67e8dca URL: https://github.com/llvm/llvm-project/commit/7edfbf2af2253297f48ff8adaba99373f67e8dca DIFF: https://github.com/llvm/llvm-project/commit/7edfbf2af2253297f48ff8adaba99373f67e8dca.diff LOG: [lldb][DataFormatter] Fix format specifiers in LibCxxSliceArray summary provider (#85763) This caused following warnings in an LLDB build: ``` [237/1072] Building CXX object tools/l...lusLanguage.dir/LibCxxSliceArray.cpp.o /Volumes/Data/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp:38:53: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat] 38 | stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); | ~ ^~ /Volumes/Data/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp:38:61: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat] 38 | stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); | ~ ^~~~ 2 warnings generated. ``` This patch simply changes the format specifiers to use the `%zu` for `size_t`s. Added: Modified: lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp Removed: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp index 323de11b1c97c9..32e67d2e38c5d3 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp @@ -35,7 +35,7 @@ bool LibcxxStdSliceArraySummaryProvider(ValueObject , Stream , return false; const size_t stride = ptr_sp->GetValueAsUnsigned(0); - stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); + stream.Printf("stride=%zu size=%zu", stride, size); return true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatter] Fix format specifiers in LibCxxSliceArray summary provider (PR #85763)
https://github.com/mordante approved this pull request. I wasn't aware LLDB's print accepts `%zu`, thanks for the fix! https://github.com/llvm/llvm-project/pull/85763 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatter] Fix format specifiers in LibCxxSliceArray summary provider (PR #85763)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) Changes This caused following warnings in an LLDB build: ``` [237/1072] Building CXX object tools/l...lusLanguage.dir/LibCxxSliceArray.cpp.o /Volumes/Data/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp:38:53: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat] 38 | stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); | ~ ^~ /Volumes/Data/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp:38:61: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat] 38 | stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); | ~ ^~~~ 2 warnings generated. ``` This patch simply changes the format specifiers to use the `%zu` for `size_t`s. --- Full diff: https://github.com/llvm/llvm-project/pull/85763.diff 1 Files Affected: - (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp (+1-1) ``diff diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp index 323de11b1c97c9..32e67d2e38c5d3 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp @@ -35,7 +35,7 @@ bool LibcxxStdSliceArraySummaryProvider(ValueObject , Stream , return false; const size_t stride = ptr_sp->GetValueAsUnsigned(0); - stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); + stream.Printf("stride=%zu size=%zu", stride, size); return true; } `` https://github.com/llvm/llvm-project/pull/85763 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DataFormatter] Fix format specifiers in LibCxxSliceArray summary provider (PR #85763)
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/85763 This caused following warnings in an LLDB build: ``` [237/1072] Building CXX object tools/l...lusLanguage.dir/LibCxxSliceArray.cpp.o /Volumes/Data/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp:38:53: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat] 38 | stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); | ~ ^~ /Volumes/Data/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp:38:61: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat] 38 | stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); | ~ ^~~~ 2 warnings generated. ``` This patch simply changes the format specifiers to use the `%zu` for `size_t`s. >From 33a1597e380ba08eb08df063a00eb6cd97ec7429 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 19 Mar 2024 10:05:02 + Subject: [PATCH] [lldb][DataFormatter] Fix format specifiers in LibCxxSliceArray summary providers This caused following warnings in an LLDB build: ``` [237/1072] Building CXX object tools/l...lusLanguage.dir/LibCxxSliceArray.cpp.o /Volumes/Data/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp:38:53: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat] 38 | stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); | ~ ^~ /Volumes/Data/llvm-project/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp:38:61: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat] 38 | stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); | ~ ^~~~ 2 warnings generated. ``` This patch simply changes the format specifiers to use the `%zu` for `size_t`s. --- lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp index 323de11b1c97c9..32e67d2e38c5d3 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxSliceArray.cpp @@ -35,7 +35,7 @@ bool LibcxxStdSliceArraySummaryProvider(ValueObject , Stream , return false; const size_t stride = ptr_sp->GetValueAsUnsigned(0); - stream.Printf("stride=%" PRIu64 " size=%" PRIu64, stride, size); + stream.Printf("stride=%zu size=%zu", stride, size); return true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits