[Lldb-commits] [PATCH] D45628: [LLDB] Support compressed debug info sections (.zdebug*)
labath added a comment. Thank you for the patch. For testing I'd recommend taking a look at r320813 https://reviews.llvm.org/D40616, which implemented the SHF_COMPRESSED part of the compressed section support. It looks like we should add a new field to the "lldb-test module-sections" output, so that we can test the section type computation code. https://reviews.llvm.org/D45628 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r330147 - [Statistics] Move GetStatDescription to an header file.
Author: davide Date: Mon Apr 16 11:25:57 2018 New Revision: 330147 URL: http://llvm.org/viewvc/llvm-project?rev=330147&view=rev Log: [Statistics] Move GetStatDescription to an header file. In preparation for using it in the API. Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h lldb/trunk/source/Commands/CommandObjectStats.cpp Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-enumerations.h?rev=330147&r1=330146&r2=330147&view=diff == --- lldb/trunk/include/lldb/lldb-private-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-private-enumerations.h Mon Apr 16 11:25:57 2018 @@ -246,6 +246,23 @@ enum StatisticKind { StatisticMax = 4 }; + +std::string GetStatDescription(lldb_private::StatisticKind K) { + switch (K) { + case StatisticKind::ExpressionSuccessful: + return "Number of expr evaluation successes"; + case StatisticKind::ExpressionFailure: + return "Number of expr evaluation failures"; + case StatisticKind::FrameVarSuccess: + return "Number of frame var successes"; + case StatisticKind::FrameVarFailure: + return "Number of frame var failures"; + case StatisticKind::StatisticMax: + return ""; + } + llvm_unreachable("Statistic not registered!"); +} + } // namespace lldb_private namespace llvm { Modified: lldb/trunk/source/Commands/CommandObjectStats.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectStats.cpp?rev=330147&r1=330146&r2=330147&view=diff == --- lldb/trunk/source/Commands/CommandObjectStats.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectStats.cpp Mon Apr 16 11:25:57 2018 @@ -67,23 +67,6 @@ protected: }; class CommandObjectStatsDump : public CommandObjectParsed { -private: - std::string GetStatDescription(lldb_private::StatisticKind K) { -switch (K) { -case StatisticKind::ExpressionSuccessful: - return "Number of expr evaluation successes"; -case StatisticKind::ExpressionFailure: - return "Number of expr evaluation failures"; -case StatisticKind::FrameVarSuccess: - return "Number of frame var successes"; -case StatisticKind::FrameVarFailure: - return "Number of frame var failures"; -case StatisticKind::StatisticMax: - return ""; -} -llvm_unreachable("Statistic not registered!"); - } - public: CommandObjectStatsDump(CommandInterpreter &interpreter) : CommandObjectParsed(interpreter, "dump", "Dump statistics results", @@ -99,7 +82,7 @@ protected: for (auto &stat : target->GetStatistics()) { result.AppendMessageWithFormat( "%s : %u\n", - GetStatDescription(static_cast(i)) + lldb_private::GetStatDescription(static_cast(i)) .c_str(), stat); i += 1; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r330147 - [Statistics] Move GetStatDescription to an header file.
I think you need to mark this inline otherwise you're going to get multiple definitions no? On Mon, Apr 16, 2018 at 11:29 AM Davide Italiano via lldb-commits < lldb-commits@lists.llvm.org> wrote: > Author: davide > Date: Mon Apr 16 11:25:57 2018 > New Revision: 330147 > > URL: http://llvm.org/viewvc/llvm-project?rev=330147&view=rev > Log: > [Statistics] Move GetStatDescription to an header file. > > In preparation for using it in the API. > > > > Modified: > lldb/trunk/include/lldb/lldb-private-enumerations.h > lldb/trunk/source/Commands/CommandObjectStats.cpp > > Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-enumerations.h?rev=330147&r1=330146&r2=330147&view=diff > > == > --- lldb/trunk/include/lldb/lldb-private-enumerations.h (original) > +++ lldb/trunk/include/lldb/lldb-private-enumerations.h Mon Apr 16 > 11:25:57 2018 > @@ -246,6 +246,23 @@ enum StatisticKind { >StatisticMax = 4 > }; > > + > +std::string GetStatDescription(lldb_private::StatisticKind K) { > + switch (K) { > + case StatisticKind::ExpressionSuccessful: > + return "Number of expr evaluation successes"; > + case StatisticKind::ExpressionFailure: > + return "Number of expr evaluation failures"; > + case StatisticKind::FrameVarSuccess: > + return "Number of frame var successes"; > + case StatisticKind::FrameVarFailure: > + return "Number of frame var failures"; > + case StatisticKind::StatisticMax: > + return ""; > + } > + llvm_unreachable("Statistic not registered!"); > +} > + > } // namespace lldb_private > > namespace llvm { > > Modified: lldb/trunk/source/Commands/CommandObjectStats.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectStats.cpp?rev=330147&r1=330146&r2=330147&view=diff > > == > --- lldb/trunk/source/Commands/CommandObjectStats.cpp (original) > +++ lldb/trunk/source/Commands/CommandObjectStats.cpp Mon Apr 16 11:25:57 > 2018 > @@ -67,23 +67,6 @@ protected: > }; > > class CommandObjectStatsDump : public CommandObjectParsed { > -private: > - std::string GetStatDescription(lldb_private::StatisticKind K) { > -switch (K) { > -case StatisticKind::ExpressionSuccessful: > - return "Number of expr evaluation successes"; > -case StatisticKind::ExpressionFailure: > - return "Number of expr evaluation failures"; > -case StatisticKind::FrameVarSuccess: > - return "Number of frame var successes"; > -case StatisticKind::FrameVarFailure: > - return "Number of frame var failures"; > -case StatisticKind::StatisticMax: > - return ""; > -} > -llvm_unreachable("Statistic not registered!"); > - } > - > public: >CommandObjectStatsDump(CommandInterpreter &interpreter) >: CommandObjectParsed(interpreter, "dump", "Dump statistics > results", > @@ -99,7 +82,7 @@ protected: > for (auto &stat : target->GetStatistics()) { >result.AppendMessageWithFormat( >"%s : %u\n", > - GetStatDescription(static_cast(i)) > + > lldb_private::GetStatDescription(static_cast(i)) >.c_str(), >stat); >i += 1; > > > ___ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r330147 - [Statistics] Move GetStatDescription to an header file.
On Mon, Apr 16, 2018 at 11:30 AM, Zachary Turner via lldb-commits wrote: > I think you need to mark this inline otherwise you're going to get multiple > definitions no? > I'm pretty sure you're correct, although this didn't show up (probably because it's used only in one place). Let me change it now. Thanks, -- Davide ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D45554: Make sure deleting all breakpoints clears their sites first
eugene added a comment. If nobody minds, I'd appreciate if somebody would accept this patch. https://reviews.llvm.org/D45554 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D45554: Make sure deleting all breakpoints clears their sites first
jingham accepted this revision. jingham added a comment. This revision is now accepted and ready to land. Sure. https://reviews.llvm.org/D45554 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r330149 - [lldb-private] Mark a function as inline to prevent multiple def errors.
Author: davide Date: Mon Apr 16 12:07:14 2018 New Revision: 330149 URL: http://llvm.org/viewvc/llvm-project?rev=330149&view=rev Log: [lldb-private] Mark a function as inline to prevent multiple def errors. Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-enumerations.h?rev=330149&r1=330148&r2=330149&view=diff == --- lldb/trunk/include/lldb/lldb-private-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-private-enumerations.h Mon Apr 16 12:07:14 2018 @@ -247,7 +247,7 @@ enum StatisticKind { }; -std::string GetStatDescription(lldb_private::StatisticKind K) { +inline std::string GetStatDescription(lldb_private::StatisticKind K) { switch (K) { case StatisticKind::ExpressionSuccessful: return "Number of expr evaluation successes"; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D45700: Improve LLDB's handling of non-local minidumps
lemo created this revision. lemo added reviewers: clayborg, labath, amccarth. lemo added a project: LLDB. Herald added subscribers: JDevlieghere, aprantl. Normally, LLDB is creating a high-fidelity representation of a live process, including a list of modules and sections, with the associated memory address ranges. In order to build the module and section map LLDB tries to locate the local module image (object file) and will parse it. This does not work for postmortem debugging scenarios where the crash dump (minidump in this case) was captured on a different machine. Also, we may want to completly disable the search for matching local object files if we load minidumps unless we can prove that the local image matches the one from the crash origin. (not part of this change, see: llvm.org/pr35193) Fortunatelly the minidump format encodes enough information about each module's memory range to allow us to create placeholder modules. This enables most LLDB functionality involving address-to-module translations: Example: Identify the module from a stack frame PC: --- Before: - thread #1, stop reason = Exception 0xc005 encountered at address 0x164d14 - frame #0: 0x00164d14 frame #1: 0x00167c79 frame #2: 0x00167e6d frame #3: 0x7510336a frame #4: 0x77759882 frame #5: 0x77759855 After: - thread #1, stop reason = Exception 0xc005 encountered at address 0x164d14 - frame #0: 0x00164d14 C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe frame #1: 0x00167c79 C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe frame #2: 0x00167e6d C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe frame #3: 0x7510336a C:\Windows\SysWOW64\kernel32.dll frame #4: 0x77759882 C:\Windows\SysWOW64\ntdll.dll frame #5: 0x77759855 C:\Windows\SysWOW64\ntdll.dll Example: target modules list Before: error: the target has no associated executable images After: [ 0] C:\Windows\System32\MSVCP120D.dll [ 1] C:\Windows\SysWOW64\kernel32.dll [ 2] C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe [ 3] C:\Windows\System32\MSVCR120D.dll [ 4] C:\Windows\SysWOW64\KERNELBASE.dll [ 5] C:\Windows\SysWOW64\ntdll.dll NOTE: the minidump format also includes the debug info GUID, so we can fill-in the module UUID from it, but this part was excluded from this change to keep the changes simple (the LLDB UUID is hardcoded to be either 16 or 20 bytes, while the CodeView GUIDs are normally 24 bytes) https://reviews.llvm.org/D45700 Files: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py source/Commands/CommandObjectTarget.cpp source/Core/Section.cpp source/Plugins/Process/minidump/ProcessMinidump.cpp source/Plugins/Process/minidump/ProcessMinidump.h Index: source/Plugins/Process/minidump/ProcessMinidump.h === --- source/Plugins/Process/minidump/ProcessMinidump.h +++ source/Plugins/Process/minidump/ProcessMinidump.h @@ -61,6 +61,8 @@ uint32_t GetPluginVersion() override; + SystemRuntime *GetSystemRuntime() override { return nullptr; } + Status DoDestroy() override; void RefreshStateAfterStop() override; Index: source/Plugins/Process/minidump/ProcessMinidump.cpp === --- source/Plugins/Process/minidump/ProcessMinidump.cpp +++ source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -19,6 +19,7 @@ #include "lldb/Core/State.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/MemoryRegionInfo.h" +#include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/DataBufferLLVM.h" @@ -31,9 +32,53 @@ // C includes // C++ includes +using namespace lldb; using namespace lldb_private; using namespace minidump; +//-- +/// A placeholder module used for minidumps, where the original +/// object files may not be available (so we can't parse the object +/// files to extract the set of sections/segments) +/// +/// This placeholder module has a single synthetic section (.module_image) +/// which represents the module memory range covering the whole module. +//-- +class PlaceholderModule : public Module { +public: + PlaceholderModule(const FileSpec &file_spec, const ArchSpec &arch) : +Module(file_spec, arch) {} + + // Creates a synthetic module section covering the whole module image + void CreateImageSection(const MinidumpModule *module, Target& target) { +const ConstString section_name(".module_image"); +lldb::SectionSP section_sp(new
[Lldb-commits] [PATCH] D45700: Improve LLDB's handling of non-local minidumps
amccarth added a comment. Nice! Comment at: source/Plugins/Process/minidump/ProcessMinidump.cpp:53 + // Creates a synthetic module section covering the whole module image + void CreateImageSection(const MinidumpModule *module, Target& target) { +const ConstString section_name(".module_image"); I wonder if this should just be part of the constructor. I don't see a scenario where you'd create a PlaceholderModule and not want to create exactly one fake image section. I know the style guide is against doing lots of work in a constructor, but that's mostly because it's hard to report failures, which you're not doing here anyway. Comment at: source/Plugins/Process/minidump/ProcessMinidump.cpp:329 if (!module_sp || error.Fail()) { - continue; + // We failed to locate a matching local object file. Fortunatelly + // the minidump format encodes enough information about each module's nit: s/Fortunatelly/Fortunately/ Comment at: source/Plugins/Process/minidump/ProcessMinidump.cpp:339 + my_module->CreateImageSection(module, GetTarget()); + module_sp = my_module; + GetTarget().GetImages().Append(module_sp); If CreateImageSection bit were done by the PlaceholderModule's constructor, then there'd be no need for the artificial `my_module` temporary, and nobody would ever make a PlaceholderModule without an image section. https://reviews.llvm.org/D45700 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D45700: Improve LLDB's handling of non-local minidumps
lemo added inline comments. Comment at: source/Plugins/Process/minidump/ProcessMinidump.cpp:53 + // Creates a synthetic module section covering the whole module image + void CreateImageSection(const MinidumpModule *module, Target& target) { +const ConstString section_name(".module_image"); amccarth wrote: > I wonder if this should just be part of the constructor. I don't see a > scenario where you'd create a PlaceholderModule and not want to create > exactly one fake image section. I know the style guide is against doing lots > of work in a constructor, but that's mostly because it's hard to report > failures, which you're not doing here anyway. Thanks for the suggestion. I agree, this would look a bit cleaner to fold everything in the constructor (except the extra arguments to the constructor, but it will probably still be a net win) The reason for a separate method is the little "shared_from_this()". It can't be done from the constructor since the object is not yet managed by a shared_ptr, so we need to do it post-construction. https://reviews.llvm.org/D45700 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D45700: Improve LLDB's handling of non-local minidumps
lemo updated this revision to Diff 142706. lemo edited the summary of this revision. https://reviews.llvm.org/D45700 Files: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py packages/Python/lldbsuite/test/functionalities/postmortem/minidump/TestMiniDump.py source/Commands/CommandObjectTarget.cpp source/Core/Section.cpp source/Plugins/Process/minidump/ProcessMinidump.cpp source/Plugins/Process/minidump/ProcessMinidump.h Index: source/Plugins/Process/minidump/ProcessMinidump.h === --- source/Plugins/Process/minidump/ProcessMinidump.h +++ source/Plugins/Process/minidump/ProcessMinidump.h @@ -61,6 +61,8 @@ uint32_t GetPluginVersion() override; + SystemRuntime *GetSystemRuntime() override { return nullptr; } + Status DoDestroy() override; void RefreshStateAfterStop() override; Index: source/Plugins/Process/minidump/ProcessMinidump.cpp === --- source/Plugins/Process/minidump/ProcessMinidump.cpp +++ source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -19,6 +19,7 @@ #include "lldb/Core/State.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/MemoryRegionInfo.h" +#include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Target/UnixSignals.h" #include "lldb/Utility/DataBufferLLVM.h" @@ -31,9 +32,53 @@ // C includes // C++ includes +using namespace lldb; using namespace lldb_private; using namespace minidump; +//-- +/// A placeholder module used for minidumps, where the original +/// object files may not be available (so we can't parse the object +/// files to extract the set of sections/segments) +/// +/// This placeholder module has a single synthetic section (.module_image) +/// which represents the module memory range covering the whole module. +//-- +class PlaceholderModule : public Module { +public: + PlaceholderModule(const FileSpec &file_spec, const ArchSpec &arch) : +Module(file_spec, arch) {} + + // Creates a synthetic module section covering the whole module image + void CreateImageSection(const MinidumpModule *module, Target& target) { +const ConstString section_name(".module_image"); +lldb::SectionSP section_sp(new Section( +shared_from_this(), // Module to which this section belongs. +nullptr,// ObjectFile +0, // Section ID. +section_name, // Section name. +eSectionTypeContainer, // Section type. +module->base_of_image, // VM address. +module->size_of_image, // VM size in bytes of this section. +0, // Offset of this section in the file. +module->size_of_image, // Size of the section as found in the file. +12, // Alignment of the section (log2) +0, // Flags for this section. +1));// Number of host bytes per target byte +section_sp->SetPermissions(ePermissionsExecutable | ePermissionsReadable); +m_sections.AddSection(section_sp); +target.GetSectionLoadList().SetSectionLoadAddress( +section_sp, module->base_of_image); + } + + ObjectFile *GetObjectFile() override { return nullptr; } + + SectionList *GetSectionList() override { return &m_sections; } + +private: + SectionList m_sections; +}; + ConstString ProcessMinidump::GetPluginNameStatic() { static ConstString g_name("minidump"); return g_name; @@ -281,7 +326,18 @@ Status error; lldb::ModuleSP module_sp = GetTarget().GetSharedModule(module_spec, &error); if (!module_sp || error.Fail()) { - continue; + // We failed to locate a matching local object file. Fortunately, + // the minidump format encodes enough information about each module's + // memory range to allow us to create placeholder modules. + // + // This enables most LLDB functionality involving address-to-module + // translations (ex. identifing the module for a stack frame PC) and + // modules/sections commands (ex. target modules list, ...) + auto placeholder_module = + std::make_shared(file_spec, GetArchitecture()); + placeholder_module->CreateImageSection(module, GetTarget()); + module_sp = placeholder_module; + GetTarget().GetImages().Append(module_sp); } if (log) { Index: source/Core/Section.cpp === --- source/Core/Section.cpp +++ source/Core/Section.cpp @@ -326,10 +326,11 @@ // The top most section prints the module basename const char *name = NULL; ModuleSP module_sp(GetModule()); -const FileSpec &file_spec = m_obj_file->GetFileSpec(); -if (m_obj_file)
[Lldb-commits] [lldb] r330163 - Make sure deleting all breakpoints clears their sites first
Author: eugene Date: Mon Apr 16 15:26:21 2018 New Revision: 330163 URL: http://llvm.org/viewvc/llvm-project?rev=330163&view=rev Log: Make sure deleting all breakpoints clears their sites first Bug: https://bugs.llvm.org/show_bug.cgi?id=36430 Differential Revision: https://reviews.llvm.org/D45554 Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c lldb/trunk/source/Breakpoint/BreakpointList.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py?rev=330163&r1=330162&r2=330163&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py Mon Apr 16 15:26:21 2018 @@ -45,6 +45,25 @@ class BreakpointCommandTestCase(TestBase self.addTearDownHook( lambda: self.runCmd("settings clear auto-confirm")) +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") +def test_delete_all_breakpoints(self): +"""Test that deleting all breakpoints works.""" +self.build() +exe = self.getBuildArtifact("a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +lldbutil.run_break_set_by_symbol(self, "main") +lldbutil.run_break_set_by_file_and_line( +self, "main.c", self.line, num_expected_locations=1, loc_exact=True) + +self.runCmd("run", RUN_SUCCEEDED) + +self.runCmd("breakpoint delete") +self.runCmd("process continue") +self.expect("process status", PROCESS_STOPPED, +patterns=['Process .* exited with status = 0']) + + def breakpoint_command_sequence(self): """Test a sequence of breakpoint command add, list, and delete.""" exe = self.getBuildArtifact("a.out") Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c?rev=330163&r1=330162&r2=330163&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c Mon Apr 16 15:26:21 2018 @@ -9,5 +9,9 @@ int main (int argc, char const *argv[]) { +// Add a body to the function, so we can set more than one +// breakpoint in it. +static volatile int var = 0; +var++; return 0; // Set break point at this line. } Modified: lldb/trunk/source/Breakpoint/BreakpointList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointList.cpp?rev=330163&r1=330162&r2=330163&view=diff == --- lldb/trunk/source/Breakpoint/BreakpointList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointList.cpp Mon Apr 16 15:26:21 2018 @@ -99,7 +99,7 @@ void BreakpointList::RemoveAll(bool noti void BreakpointList::RemoveAllowed(bool notify) { std::lock_guard guard(m_mutex); - + bp_collection::iterator pos, end = m_breakpoints.end(); if (notify) { for (pos = m_breakpoints.begin(); pos != end; ++pos) { @@ -116,10 +116,12 @@ void BreakpointList::RemoveAllowed(bool } pos = m_breakpoints.begin(); while ( pos != end) { - if((*pos)->AllowDelete()) -pos = m_breakpoints.erase(pos); - else -pos++; +auto bp = *pos; +if (bp->AllowDelete()) { + bp->ClearAllBreakpointSites(); + pos = m_breakpoints.erase(pos); +} else + pos++; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D45554: Make sure deleting all breakpoints clears their sites first
This revision was automatically updated to reflect the committed changes. Closed by commit rL330163: Make sure deleting all breakpoints clears their sites first (authored by eugene, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D45554?vs=142319&id=142710#toc Repository: rL LLVM https://reviews.llvm.org/D45554 Files: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c lldb/trunk/source/Breakpoint/BreakpointList.cpp Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c @@ -9,5 +9,9 @@ int main (int argc, char const *argv[]) { +// Add a body to the function, so we can set more than one +// breakpoint in it. +static volatile int var = 0; +var++; return 0; // Set break point at this line. } Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py @@ -45,6 +45,25 @@ self.addTearDownHook( lambda: self.runCmd("settings clear auto-confirm")) +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") +def test_delete_all_breakpoints(self): +"""Test that deleting all breakpoints works.""" +self.build() +exe = self.getBuildArtifact("a.out") +self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + +lldbutil.run_break_set_by_symbol(self, "main") +lldbutil.run_break_set_by_file_and_line( +self, "main.c", self.line, num_expected_locations=1, loc_exact=True) + +self.runCmd("run", RUN_SUCCEEDED) + +self.runCmd("breakpoint delete") +self.runCmd("process continue") +self.expect("process status", PROCESS_STOPPED, +patterns=['Process .* exited with status = 0']) + + def breakpoint_command_sequence(self): """Test a sequence of breakpoint command add, list, and delete.""" exe = self.getBuildArtifact("a.out") Index: lldb/trunk/source/Breakpoint/BreakpointList.cpp === --- lldb/trunk/source/Breakpoint/BreakpointList.cpp +++ lldb/trunk/source/Breakpoint/BreakpointList.cpp @@ -99,7 +99,7 @@ void BreakpointList::RemoveAllowed(bool notify) { std::lock_guard guard(m_mutex); - + bp_collection::iterator pos, end = m_breakpoints.end(); if (notify) { for (pos = m_breakpoints.begin(); pos != end; ++pos) { @@ -116,10 +116,12 @@ } pos = m_breakpoints.begin(); while ( pos != end) { - if((*pos)->AllowDelete()) -pos = m_breakpoints.erase(pos); - else -pos++; +auto bp = *pos; +if (bp->AllowDelete()) { + bp->ClearAllBreakpointSites(); + pos = m_breakpoints.erase(pos); +} else + pos++; } } Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/main.c @@ -9,5 +9,9 @@ int main (int argc, char const *argv[]) { +// Add a body to the function, so we can set more than one +// breakpoint in it. +static volatile int var = 0; +var++; return 0; // Set break point at this line. } Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py === --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py @@ -45,6 +45,25 @@ self.addTearDownHook( lambda: self.runCmd("settings clear auto-confirm")) +@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528") +def test_delete_all_breakpoints(self): +"""Test that deleting all breakpoints works.""" +self.build() +exe = self.getBuildArtifact("a.out") +self.runCmd("file " + exe,
[Lldb-commits] [lldb] r330165 - [Commands] Expose statistics through the SBAPI.
Author: davide Date: Mon Apr 16 15:55:34 2018 New Revision: 330165 URL: http://llvm.org/viewvc/llvm-project?rev=330165&view=rev Log: [Commands] Expose statistics through the SBAPI. The API is `SBStructuredData GetStatistics()`. This allows the command to be used in scripts. Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/ lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/main.c Modified: lldb/trunk/include/lldb/API/SBStructuredData.h lldb/trunk/include/lldb/API/SBTarget.h lldb/trunk/scripts/interface/SBTarget.i lldb/trunk/source/API/SBTarget.cpp Modified: lldb/trunk/include/lldb/API/SBStructuredData.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStructuredData.h?rev=330165&r1=330164&r2=330165&view=diff == --- lldb/trunk/include/lldb/API/SBStructuredData.h (original) +++ lldb/trunk/include/lldb/API/SBStructuredData.h Mon Apr 16 15:55:34 2018 @@ -99,6 +99,7 @@ public: protected: friend class SBTraceOptions; friend class SBDebugger; + friend class SBTarget; StructuredDataImplUP m_impl_up; }; Modified: lldb/trunk/include/lldb/API/SBTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=330165&r1=330164&r2=330165&view=diff == --- lldb/trunk/include/lldb/API/SBTarget.h (original) +++ lldb/trunk/include/lldb/API/SBTarget.h Mon Apr 16 15:55:34 2018 @@ -75,6 +75,8 @@ public: lldb::SBProcess GetProcess(); + lldb::SBStructuredData GetStatistics(); + //-- /// Return the platform object associated with the target. /// Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile?rev=330165&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/Makefile Mon Apr 16 15:55:34 2018 @@ -0,0 +1,3 @@ +LEVEL = ../../make +C_SOURCES := main.c +include $(LEVEL)/Makefile.rules Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py?rev=330165&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py Mon Apr 16 15:55:34 2018 @@ -0,0 +1,28 @@ +# Test the SBAPI for GetStatistics() + +import json +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestStatsAPI(TestBase): +mydir = TestBase.compute_mydir(__file__) + +def setUp(self): +TestBase.setUp(self) + +def test_stats_api(self): +self.build() +exe = self.getBuildArtifact("a.out") +target = self.dbg.CreateTarget(exe) +stats = target.GetStatistics() +stream = lldb.SBStream() +res = stats.GetAsJSON(stream) +stats_json = sorted(json.loads(stream.GetData())) +self.assertEqual(len(stats_json), 4) +self.assertEqual(stats_json[0], "Number of expr evaluation failures") +self.assertEqual(stats_json[1], "Number of expr evaluation successes") +self.assertEqual(stats_json[2], "Number of frame var failures") +self.assertEqual(stats_json[3], "Number of frame var successes") Added: lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/main.c?rev=330165&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/main.c (added) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/main.c Mon Apr 16 15:55:34 2018 @@ -0,0 +1,3 @@ +int main(void) { + return 0; +} Modified: lldb/trunk/scripts/interface/SBTarget.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBTarget.i?rev=330165&r1=330164&r2=330165&view=diff == --- lldb/trunk/scripts/interface/SBTarget.i (original) +++
[Lldb-commits] [PATCH] D45700: Improve LLDB's handling of non-local minidumps
clayborg added a comment. Looks good. I questions if we want PlaceholderModule to be available for all symbolicators/core dump plugins. See inlined comments. Comment at: source/Plugins/Process/minidump/ProcessMinidump.cpp:47 +//-- +class PlaceholderModule : public Module { +public: I would be worth putting this class maybe in the same folder as lldb_private::Module and possibly renaming it. I can see this kind of thing being useful for symbolication in general and it won't be limited to use in minidumps. It should have enough accessors that allows an external client to modify everything. Comment at: source/Plugins/Process/minidump/ProcessMinidump.cpp:79 +private: + SectionList m_sections; +}; Just use lldb_private::Module::m_sections_ap and put the sections in there? Any reason not to? https://reviews.llvm.org/D45700 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r330170 - [Statistics] Relax the test output a little bit.
Author: davide Date: Mon Apr 16 16:59:01 2018 New Revision: 330170 URL: http://llvm.org/viewvc/llvm-project?rev=330170&view=rev Log: [Statistics] Relax the test output a little bit. We don't really care about the order as this is a dictionary. It should be more resilient to changes (adding/shuffling stats around). Pointed out by Jason Molenda in a post-commit review (thanks Jason). Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py?rev=330170&r1=330169&r2=330170&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/stats_api/TestStatisticsAPI.py Mon Apr 16 16:59:01 2018 @@ -22,7 +22,7 @@ class TestStatsAPI(TestBase): res = stats.GetAsJSON(stream) stats_json = sorted(json.loads(stream.GetData())) self.assertEqual(len(stats_json), 4) -self.assertEqual(stats_json[0], "Number of expr evaluation failures") -self.assertEqual(stats_json[1], "Number of expr evaluation successes") -self.assertEqual(stats_json[2], "Number of frame var failures") -self.assertEqual(stats_json[3], "Number of frame var successes") +self.assertTrue("Number of expr evaluation failures" in stats_json) +self.assertTrue("Number of expr evaluation successes" in stats_json) +self.assertTrue("Number of frame var failures" in stats_json) +self.assertTrue("Number of frame var successes" in stats_json) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits