[Lldb-commits] [PATCH] D33347: Fix incorrect Status -> Error rename in IOHandler
bgianfo created this revision. Change 302872 was a massive rename of the Error class to Status. The change included an incorrect rename of the "Status" window in the LLDB GUI from "Status to "Error". This patch undoes this incorrect rename and restores the status window's correct name. Repository: rL LLVM https://reviews.llvm.org/D33347 Files: source/Core/IOHandler.cpp Index: source/Core/IOHandler.cpp === --- source/Core/IOHandler.cpp +++ source/Core/IOHandler.cpp @@ -4640,7 +4640,7 @@ WindowSP threads_window_sp( main_window_sp->CreateSubWindow("Threads", threads_bounds, false)); WindowSP status_window_sp( -main_window_sp->CreateSubWindow("Error", status_bounds, false)); +main_window_sp->CreateSubWindow("Status", status_bounds, false)); status_window_sp->SetCanBeActive( false); // Don't let the status bar become the active window main_window_sp->SetDelegate( Index: source/Core/IOHandler.cpp === --- source/Core/IOHandler.cpp +++ source/Core/IOHandler.cpp @@ -4640,7 +4640,7 @@ WindowSP threads_window_sp( main_window_sp->CreateSubWindow("Threads", threads_bounds, false)); WindowSP status_window_sp( -main_window_sp->CreateSubWindow("Error", status_bounds, false)); +main_window_sp->CreateSubWindow("Status", status_bounds, false)); status_window_sp->SetCanBeActive( false); // Don't let the status bar become the active window main_window_sp->SetDelegate( ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D33347: Fix incorrect Status -> Error rename in IOHandler
bgianfo updated this revision to Diff 99525. bgianfo added a comment. Fixing source path https://reviews.llvm.org/D33347 Files: lldb/trunk/source/Core/IOHandler.cpp Index: lldb/trunk/source/Core/IOHandler.cpp === --- lldb/trunk/source/Core/IOHandler.cpp +++ lldb/trunk/source/Core/IOHandler.cpp @@ -4640,7 +4640,7 @@ WindowSP threads_window_sp( main_window_sp->CreateSubWindow("Threads", threads_bounds, false)); WindowSP status_window_sp( -main_window_sp->CreateSubWindow("Error", status_bounds, false)); +main_window_sp->CreateSubWindow("Status", status_bounds, false)); status_window_sp->SetCanBeActive( false); // Don't let the status bar become the active window main_window_sp->SetDelegate( Index: lldb/trunk/source/Core/IOHandler.cpp === --- lldb/trunk/source/Core/IOHandler.cpp +++ lldb/trunk/source/Core/IOHandler.cpp @@ -4640,7 +4640,7 @@ WindowSP threads_window_sp( main_window_sp->CreateSubWindow("Threads", threads_bounds, false)); WindowSP status_window_sp( -main_window_sp->CreateSubWindow("Error", status_bounds, false)); +main_window_sp->CreateSubWindow("Status", status_bounds, false)); status_window_sp->SetCanBeActive( false); // Don't let the status bar become the active window main_window_sp->SetDelegate( ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D33426: Introduce new command: thread unique-stacks
bgianfo created this revision. This patch introduces a new thread command "unique-stacks". The command is based off of "thread backtrace all" but will instead find all threads which share matching call stacks and de-duplicate their output, listing call stack and all the threads which share it. This is especially useful for apps which use thread/task pools sitting around waiting for work and cause excessive duplicate output. I needed this behavior recently when debugging a core with 700+ threads. https://reviews.llvm.org/D33426 Files: include/lldb/Target/Thread.h source/Commands/CommandObjectThread.cpp source/Core/Debugger.cpp source/Target/Thread.cpp Index: source/Target/Thread.cpp === --- source/Target/Thread.cpp +++ source/Target/Thread.cpp @@ -1912,39 +1912,42 @@ size_t Thread::GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, - bool stop_format) { - ExecutionContext exe_ctx(shared_from_this()); - Target *target = exe_ctx.GetTargetPtr(); - Process *process = exe_ctx.GetProcessPtr(); - size_t num_frames_shown = 0; - strm.Indent(); - bool is_selected = false; - if (process) { -if (process->GetThreadList().GetSelectedThread().get() == this) - is_selected = true; - } - strm.Printf("%c ", is_selected ? '*' : ' '); - if (target && target->GetDebugger().GetUseExternalEditor()) { -StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); -if (frame_sp) { - SymbolContext frame_sc( - frame_sp->GetSymbolContext(eSymbolContextLineEntry)); - if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { -Host::OpenFileInExternalEditor(frame_sc.line_entry.file, - frame_sc.line_entry.line); + bool stop_format, bool only_stacks) { + + if (!only_stacks) { +ExecutionContext exe_ctx(shared_from_this()); +Target *target = exe_ctx.GetTargetPtr(); +Process *process = exe_ctx.GetProcessPtr(); +strm.Indent(); +bool is_selected = false; +if (process) { + if (process->GetThreadList().GetSelectedThread().get() == this) +is_selected = true; +} +strm.Printf("%c ", is_selected ? '*' : ' '); +if (target && target->GetDebugger().GetUseExternalEditor()) { + StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); + if (frame_sp) { +SymbolContext frame_sc( +frame_sp->GetSymbolContext(eSymbolContextLineEntry)); +if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { + Host::OpenFileInExternalEditor(frame_sc.line_entry.file, + frame_sc.line_entry.line); +} } } - } - DumpUsingSettingsFormat(strm, start_frame, stop_format); +DumpUsingSettingsFormat(strm, start_frame, stop_format); + } + size_t num_frames_shown = 0; if (num_frames > 0) { strm.IndentMore(); const bool show_frame_info = true; const char *selected_frame_marker = nullptr; -if (num_frames == 1 || +if (num_frames == 1 || only_stacks || (GetID() != GetProcess()->GetThreadList().GetSelectedThread()->GetID())) strm.IndentMore(); else Index: source/Core/Debugger.cpp === --- source/Core/Debugger.cpp +++ source/Core/Debugger.cpp @@ -236,7 +236,7 @@ "when displaying thread information."}, {"thread-stop-format", OptionValue::eTypeFormatEntity, true, 0, DEFAULT_THREAD_STOP_FORMAT, nullptr, "The default thread format " - "string to usewhen displaying thread " + "string to use when displaying thread " "information as part of the stop display."}, {"use-external-editor", OptionValue::eTypeBoolean, true, false, nullptr, nullptr, "Whether to use an external editor or not."}, Index: source/Commands/CommandObjectThread.cpp === --- source/Commands/CommandObjectThread.cpp +++ source/Commands/CommandObjectThread.cpp @@ -42,7 +42,7 @@ using namespace lldb_private; //- -// CommandObjectThreadBacktrace +// CommandObjectIterateOverThreads //- class CommandObjectIterateOverThreads : public CommandObjectParsed { @@ -291,6 +291,122 @@ CommandOptions m_options; }; +//- +// CommandObjectUniqueThreadStacks +//- + +class CommandObjectUniqueThreadStacks : public CommandObjectParsed { + + class UniqueS
[Lldb-commits] [PATCH] D33426: Introduce new command: thread unique-stacks
bgianfo updated this revision to Diff 99844. bgianfo marked 3 inline comments as done. bgianfo added a comment. This iteration addresses Jim's feedback. I've updated all of the code to match the surrounding style where I missed it originally. (branches/variable names) I also moved the command under "thread backtrace unique". This required refactoring the thread iterator command object. I've tried to reuse as much as code possible in the thread iterator so that we actually use HandleOneThread to push the rending of of the call stack down to the BackTrace command. The bucketing has been moved directly into the command iterator when he user passes in the "unique" option. https://reviews.llvm.org/D33426 Files: include/lldb/Target/Thread.h source/Commands/CommandObjectThread.cpp source/Core/Debugger.cpp source/Target/Thread.cpp Index: source/Target/Thread.cpp === --- source/Target/Thread.cpp +++ source/Target/Thread.cpp @@ -1912,39 +1912,42 @@ size_t Thread::GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, - bool stop_format) { - ExecutionContext exe_ctx(shared_from_this()); - Target *target = exe_ctx.GetTargetPtr(); - Process *process = exe_ctx.GetProcessPtr(); - size_t num_frames_shown = 0; - strm.Indent(); - bool is_selected = false; - if (process) { -if (process->GetThreadList().GetSelectedThread().get() == this) - is_selected = true; - } - strm.Printf("%c ", is_selected ? '*' : ' '); - if (target && target->GetDebugger().GetUseExternalEditor()) { -StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); -if (frame_sp) { - SymbolContext frame_sc( - frame_sp->GetSymbolContext(eSymbolContextLineEntry)); - if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { -Host::OpenFileInExternalEditor(frame_sc.line_entry.file, - frame_sc.line_entry.line); + bool stop_format, bool only_stacks) { + + if (!only_stacks) { +ExecutionContext exe_ctx(shared_from_this()); +Target *target = exe_ctx.GetTargetPtr(); +Process *process = exe_ctx.GetProcessPtr(); +strm.Indent(); +bool is_selected = false; +if (process) { + if (process->GetThreadList().GetSelectedThread().get() == this) +is_selected = true; +} +strm.Printf("%c ", is_selected ? '*' : ' '); +if (target && target->GetDebugger().GetUseExternalEditor()) { + StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); + if (frame_sp) { +SymbolContext frame_sc( +frame_sp->GetSymbolContext(eSymbolContextLineEntry)); +if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { + Host::OpenFileInExternalEditor(frame_sc.line_entry.file, + frame_sc.line_entry.line); +} } } - } - DumpUsingSettingsFormat(strm, start_frame, stop_format); +DumpUsingSettingsFormat(strm, start_frame, stop_format); + } + size_t num_frames_shown = 0; if (num_frames > 0) { strm.IndentMore(); const bool show_frame_info = true; const char *selected_frame_marker = nullptr; -if (num_frames == 1 || +if (num_frames == 1 || only_stacks || (GetID() != GetProcess()->GetThreadList().GetSelectedThread()->GetID())) strm.IndentMore(); else Index: source/Core/Debugger.cpp === --- source/Core/Debugger.cpp +++ source/Core/Debugger.cpp @@ -236,7 +236,7 @@ "when displaying thread information."}, {"thread-stop-format", OptionValue::eTypeFormatEntity, true, 0, DEFAULT_THREAD_STOP_FORMAT, nullptr, "The default thread format " - "string to usewhen displaying thread " + "string to use when displaying thread " "information as part of the stop display."}, {"use-external-editor", OptionValue::eTypeBoolean, true, false, nullptr, nullptr, "Whether to use an external editor or not."}, Index: source/Commands/CommandObjectThread.cpp === --- source/Commands/CommandObjectThread.cpp +++ source/Commands/CommandObjectThread.cpp @@ -42,10 +42,40 @@ using namespace lldb_private; //- -// CommandObjectThreadBacktrace +// CommandObjectIterateOverThreads //- class CommandObjectIterateOverThreads : public CommandObjectParsed { + + class UniqueStack { + + public: +UniqueStack(std::stack stack_frames, uint32_t thread_index_id) + : m_stack_frames(stack_frames) { + m_t
[Lldb-commits] [PATCH] D33426: Introduce new command: thread backtrace unique
bgianfo updated this revision to Diff 100047. bgianfo marked an inline comment as done. bgianfo added a comment. Address Pavel/Jim/Greg's feedback with the addition of a new test. I followed Jim's advice and extended the existing num_threads suite so that we start more thread3's. The new test_unique_stacks test case was added to verify that we correct bucketing of the multiple thread3 call stacks executing across threads. Thanks for the feedback thus far! https://reviews.llvm.org/D33426 Files: include/lldb/Target/Thread.h packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp source/Commands/CommandObjectThread.cpp source/Core/Debugger.cpp source/Target/Thread.cpp Index: source/Target/Thread.cpp === --- source/Target/Thread.cpp +++ source/Target/Thread.cpp @@ -1912,39 +1912,42 @@ size_t Thread::GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, - bool stop_format) { - ExecutionContext exe_ctx(shared_from_this()); - Target *target = exe_ctx.GetTargetPtr(); - Process *process = exe_ctx.GetProcessPtr(); - size_t num_frames_shown = 0; - strm.Indent(); - bool is_selected = false; - if (process) { -if (process->GetThreadList().GetSelectedThread().get() == this) - is_selected = true; - } - strm.Printf("%c ", is_selected ? '*' : ' '); - if (target && target->GetDebugger().GetUseExternalEditor()) { -StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); -if (frame_sp) { - SymbolContext frame_sc( - frame_sp->GetSymbolContext(eSymbolContextLineEntry)); - if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { -Host::OpenFileInExternalEditor(frame_sc.line_entry.file, - frame_sc.line_entry.line); + bool stop_format, bool only_stacks) { + + if (!only_stacks) { +ExecutionContext exe_ctx(shared_from_this()); +Target *target = exe_ctx.GetTargetPtr(); +Process *process = exe_ctx.GetProcessPtr(); +strm.Indent(); +bool is_selected = false; +if (process) { + if (process->GetThreadList().GetSelectedThread().get() == this) +is_selected = true; +} +strm.Printf("%c ", is_selected ? '*' : ' '); +if (target && target->GetDebugger().GetUseExternalEditor()) { + StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); + if (frame_sp) { +SymbolContext frame_sc( +frame_sp->GetSymbolContext(eSymbolContextLineEntry)); +if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { + Host::OpenFileInExternalEditor(frame_sc.line_entry.file, + frame_sc.line_entry.line); +} } } - } - DumpUsingSettingsFormat(strm, start_frame, stop_format); +DumpUsingSettingsFormat(strm, start_frame, stop_format); + } + size_t num_frames_shown = 0; if (num_frames > 0) { strm.IndentMore(); const bool show_frame_info = true; const char *selected_frame_marker = nullptr; -if (num_frames == 1 || +if (num_frames == 1 || only_stacks || (GetID() != GetProcess()->GetThreadList().GetSelectedThread()->GetID())) strm.IndentMore(); else Index: source/Core/Debugger.cpp === --- source/Core/Debugger.cpp +++ source/Core/Debugger.cpp @@ -236,7 +236,7 @@ "when displaying thread information."}, {"thread-stop-format", OptionValue::eTypeFormatEntity, true, 0, DEFAULT_THREAD_STOP_FORMAT, nullptr, "The default thread format " - "string to usewhen displaying thread " + "string to use when displaying thread " "information as part of the stop display."}, {"use-external-editor", OptionValue::eTypeBoolean, true, false, nullptr, nullptr, "Whether to use an external editor or not."}, Index: source/Commands/CommandObjectThread.cpp === --- source/Commands/CommandObjectThread.cpp +++ source/Commands/CommandObjectThread.cpp @@ -42,10 +42,40 @@ using namespace lldb_private; //- -// CommandObjectThreadBacktrace +// CommandObjectIterateOverThreads //- class CommandObjectIterateOverThreads : public CommandObjectParsed { + + class UniqueStack { + + public: +UniqueStack(std::stack stack_frames, uint32_t thread_index_id) + : m_stack_frames(stack_frames) { + m_thread_index_ids.push_back(thread_index_id); +} + +
[Lldb-commits] [PATCH] D33426: Introduce new command: thread backtrace unique
bgianfo updated this revision to Diff 100365. bgianfo added a comment. Address Pavel's feedback, made the unit test more robust. This update increases the robustness of the new test I added. We ensure synchronization, and force the threads into the state we want them to be in by manually stepping them into place. https://reviews.llvm.org/D33426 Files: include/lldb/Target/Thread.h packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp source/Commands/CommandObjectThread.cpp source/Core/Debugger.cpp source/Target/Thread.cpp Index: source/Target/Thread.cpp === --- source/Target/Thread.cpp +++ source/Target/Thread.cpp @@ -1912,39 +1912,42 @@ size_t Thread::GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, - bool stop_format) { - ExecutionContext exe_ctx(shared_from_this()); - Target *target = exe_ctx.GetTargetPtr(); - Process *process = exe_ctx.GetProcessPtr(); - size_t num_frames_shown = 0; - strm.Indent(); - bool is_selected = false; - if (process) { -if (process->GetThreadList().GetSelectedThread().get() == this) - is_selected = true; - } - strm.Printf("%c ", is_selected ? '*' : ' '); - if (target && target->GetDebugger().GetUseExternalEditor()) { -StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); -if (frame_sp) { - SymbolContext frame_sc( - frame_sp->GetSymbolContext(eSymbolContextLineEntry)); - if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { -Host::OpenFileInExternalEditor(frame_sc.line_entry.file, - frame_sc.line_entry.line); + bool stop_format, bool only_stacks) { + + if (!only_stacks) { +ExecutionContext exe_ctx(shared_from_this()); +Target *target = exe_ctx.GetTargetPtr(); +Process *process = exe_ctx.GetProcessPtr(); +strm.Indent(); +bool is_selected = false; +if (process) { + if (process->GetThreadList().GetSelectedThread().get() == this) +is_selected = true; +} +strm.Printf("%c ", is_selected ? '*' : ' '); +if (target && target->GetDebugger().GetUseExternalEditor()) { + StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); + if (frame_sp) { +SymbolContext frame_sc( +frame_sp->GetSymbolContext(eSymbolContextLineEntry)); +if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { + Host::OpenFileInExternalEditor(frame_sc.line_entry.file, + frame_sc.line_entry.line); +} } } - } - DumpUsingSettingsFormat(strm, start_frame, stop_format); +DumpUsingSettingsFormat(strm, start_frame, stop_format); + } + size_t num_frames_shown = 0; if (num_frames > 0) { strm.IndentMore(); const bool show_frame_info = true; const char *selected_frame_marker = nullptr; -if (num_frames == 1 || +if (num_frames == 1 || only_stacks || (GetID() != GetProcess()->GetThreadList().GetSelectedThread()->GetID())) strm.IndentMore(); else Index: source/Core/Debugger.cpp === --- source/Core/Debugger.cpp +++ source/Core/Debugger.cpp @@ -236,7 +236,7 @@ "when displaying thread information."}, {"thread-stop-format", OptionValue::eTypeFormatEntity, true, 0, DEFAULT_THREAD_STOP_FORMAT, nullptr, "The default thread format " - "string to usewhen displaying thread " + "string to use when displaying thread " "information as part of the stop display."}, {"use-external-editor", OptionValue::eTypeBoolean, true, false, nullptr, nullptr, "Whether to use an external editor or not."}, Index: source/Commands/CommandObjectThread.cpp === --- source/Commands/CommandObjectThread.cpp +++ source/Commands/CommandObjectThread.cpp @@ -42,10 +42,40 @@ using namespace lldb_private; //- -// CommandObjectThreadBacktrace +// CommandObjectIterateOverThreads //- class CommandObjectIterateOverThreads : public CommandObjectParsed { + + class UniqueStack { + + public: +UniqueStack(std::stack stack_frames, uint32_t thread_index_id) + : m_stack_frames(stack_frames) { + m_thread_index_ids.push_back(thread_index_id); +} + +void AddThread(uint32_t thread_index_id) { + m_thread_index_ids.push_back(thread_index_id); +} + +const std::vector& GetUniqueThr
[Lldb-commits] [PATCH] D33426: Introduce new command: thread backtrace unique
bgianfo updated this revision to Diff 100529. bgianfo marked 7 inline comments as done. bgianfo added a comment. Address Pavel and Greg's feedback on Diff 100365. Pavel: I took your suggestions to make the test case more readable, I really appreciate the guidance. I did have to tweak some of the functionality to make the test case pass reliably, as there were still some races possible. I also saw that SBThread.Resume() seems to occasionally result in a StopReason of eStopReasonNon. So I worked around that by only including threads int expected output that the Resume resulted in making it to our breakpoint. I have verified the test is consistently passes by executing it on repeat 100 times, Greg: Thanks for the suggestions for using std::set, and lldb:adrr_t. The code is a lot cleaner now, and as you mentioned should perform faster. I didn't notice any significant speed up with my 700 thread dump however. https://reviews.llvm.org/D33426 Files: include/lldb/Target/Thread.h packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp source/Commands/CommandObjectThread.cpp source/Core/Debugger.cpp source/Target/Thread.cpp Index: source/Target/Thread.cpp === --- source/Target/Thread.cpp +++ source/Target/Thread.cpp @@ -1912,39 +1912,42 @@ size_t Thread::GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, - bool stop_format) { - ExecutionContext exe_ctx(shared_from_this()); - Target *target = exe_ctx.GetTargetPtr(); - Process *process = exe_ctx.GetProcessPtr(); - size_t num_frames_shown = 0; - strm.Indent(); - bool is_selected = false; - if (process) { -if (process->GetThreadList().GetSelectedThread().get() == this) - is_selected = true; - } - strm.Printf("%c ", is_selected ? '*' : ' '); - if (target && target->GetDebugger().GetUseExternalEditor()) { -StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); -if (frame_sp) { - SymbolContext frame_sc( - frame_sp->GetSymbolContext(eSymbolContextLineEntry)); - if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { -Host::OpenFileInExternalEditor(frame_sc.line_entry.file, - frame_sc.line_entry.line); + bool stop_format, bool only_stacks) { + + if (!only_stacks) { +ExecutionContext exe_ctx(shared_from_this()); +Target *target = exe_ctx.GetTargetPtr(); +Process *process = exe_ctx.GetProcessPtr(); +strm.Indent(); +bool is_selected = false; +if (process) { + if (process->GetThreadList().GetSelectedThread().get() == this) +is_selected = true; +} +strm.Printf("%c ", is_selected ? '*' : ' '); +if (target && target->GetDebugger().GetUseExternalEditor()) { + StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); + if (frame_sp) { +SymbolContext frame_sc( +frame_sp->GetSymbolContext(eSymbolContextLineEntry)); +if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { + Host::OpenFileInExternalEditor(frame_sc.line_entry.file, + frame_sc.line_entry.line); +} } } - } - DumpUsingSettingsFormat(strm, start_frame, stop_format); +DumpUsingSettingsFormat(strm, start_frame, stop_format); + } + size_t num_frames_shown = 0; if (num_frames > 0) { strm.IndentMore(); const bool show_frame_info = true; const char *selected_frame_marker = nullptr; -if (num_frames == 1 || +if (num_frames == 1 || only_stacks || (GetID() != GetProcess()->GetThreadList().GetSelectedThread()->GetID())) strm.IndentMore(); else Index: source/Core/Debugger.cpp === --- source/Core/Debugger.cpp +++ source/Core/Debugger.cpp @@ -236,7 +236,7 @@ "when displaying thread information."}, {"thread-stop-format", OptionValue::eTypeFormatEntity, true, 0, DEFAULT_THREAD_STOP_FORMAT, nullptr, "The default thread format " - "string to usewhen displaying thread " + "string to use when displaying thread " "information as part of the stop display."}, {"use-external-editor", OptionValue::eTypeBoolean, true, false, nullptr, nullptr, "Whether to use an external editor or not."}, Index: source/Commands/CommandObjectThread.cpp === --- source/Commands/CommandObjectThread.cpp +++ source/Commands/CommandObjectThread.cpp @@ -42,10 +42,42 @@ using namespace lldb_private; //---
[Lldb-commits] [PATCH] D33426: Introduce new command: thread backtrace unique
bgianfo updated this revision to Diff 100830. bgianfo added a comment. Fix bug in "unique" backtrace output that Greg pointed out. Introduced a new format for unique frames and plumbed that through the stacks to be able to toggle between them both depending on the calling arguments. https://reviews.llvm.org/D33426 Files: include/lldb/Core/Debugger.h include/lldb/Target/StackFrame.h include/lldb/Target/StackFrameList.h include/lldb/Target/Thread.h packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp source/Commands/CommandObjectThread.cpp source/Core/Debugger.cpp source/Target/StackFrame.cpp source/Target/StackFrameList.cpp source/Target/Thread.cpp Index: source/Target/Thread.cpp === --- source/Target/Thread.cpp +++ source/Target/Thread.cpp @@ -1913,47 +1913,50 @@ size_t Thread::GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, - bool stop_format) { - ExecutionContext exe_ctx(shared_from_this()); - Target *target = exe_ctx.GetTargetPtr(); - Process *process = exe_ctx.GetProcessPtr(); - size_t num_frames_shown = 0; - strm.Indent(); - bool is_selected = false; - if (process) { -if (process->GetThreadList().GetSelectedThread().get() == this) - is_selected = true; - } - strm.Printf("%c ", is_selected ? '*' : ' '); - if (target && target->GetDebugger().GetUseExternalEditor()) { -StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); -if (frame_sp) { - SymbolContext frame_sc( - frame_sp->GetSymbolContext(eSymbolContextLineEntry)); - if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { -Host::OpenFileInExternalEditor(frame_sc.line_entry.file, - frame_sc.line_entry.line); + bool stop_format, bool only_stacks) { + + if (!only_stacks) { +ExecutionContext exe_ctx(shared_from_this()); +Target *target = exe_ctx.GetTargetPtr(); +Process *process = exe_ctx.GetProcessPtr(); +strm.Indent(); +bool is_selected = false; +if (process) { + if (process->GetThreadList().GetSelectedThread().get() == this) +is_selected = true; +} +strm.Printf("%c ", is_selected ? '*' : ' '); +if (target && target->GetDebugger().GetUseExternalEditor()) { + StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); + if (frame_sp) { +SymbolContext frame_sc( +frame_sp->GetSymbolContext(eSymbolContextLineEntry)); +if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { + Host::OpenFileInExternalEditor(frame_sc.line_entry.file, + frame_sc.line_entry.line); +} } } - } - DumpUsingSettingsFormat(strm, start_frame, stop_format); +DumpUsingSettingsFormat(strm, start_frame, stop_format); + } + size_t num_frames_shown = 0; if (num_frames > 0) { strm.IndentMore(); const bool show_frame_info = true; - +const bool show_frame_unique = only_stacks; const char *selected_frame_marker = nullptr; -if (num_frames == 1 || +if (num_frames == 1 || only_stacks || (GetID() != GetProcess()->GetThreadList().GetSelectedThread()->GetID())) strm.IndentMore(); else selected_frame_marker = "* "; num_frames_shown = GetStackFrameList()->GetStatus( strm, start_frame, num_frames, show_frame_info, num_frames_with_source, -selected_frame_marker); +show_frame_unique, selected_frame_marker); if (num_frames == 1) strm.IndentLess(); strm.IndentLess(); Index: source/Target/StackFrameList.cpp === --- source/Target/StackFrameList.cpp +++ source/Target/StackFrameList.cpp @@ -801,7 +801,7 @@ size_t StackFrameList::GetStatus(Stream &strm, uint32_t first_frame, uint32_t num_frames, bool show_frame_info, - uint32_t num_frames_with_source, + uint32_t num_frames_with_source, bool show_unique, const char *selected_frame_marker) { size_t num_frames_displayed = 0; @@ -842,7 +842,7 @@ if (!frame_sp->GetStatus(strm, show_frame_info, num_frames_with_source > (first_frame - frame_idx), - marker)) + show_unique, marker)) break; ++num_frames_displayed; } Index: source/Target/StackFrame.cpp === --- source/Target/StackFrame.cpp +++ source/Target/StackFrame.cpp @@ -1744,6 +1744,7 @@ } void StackFrame::DumpUsingSettingsFormat(Stream *s
[Lldb-commits] [PATCH] D33426: Introduce new command: thread backtrace unique
bgianfo added a comment. @jingham @labath do you have any more feedback? https://reviews.llvm.org/D33426 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D33426: Introduce new command: thread backtrace unique
bgianfo updated this revision to Diff 101664. bgianfo added a comment. Update test to user thread.StepOut() instead of thread.Resume(). https://reviews.llvm.org/D33426 Files: include/lldb/Core/Debugger.h include/lldb/Target/StackFrame.h include/lldb/Target/StackFrameList.h include/lldb/Target/Thread.h packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py packages/Python/lldbsuite/test/functionalities/thread/num_threads/main.cpp source/Commands/CommandObjectThread.cpp source/Core/Debugger.cpp source/Target/StackFrame.cpp source/Target/StackFrameList.cpp source/Target/Thread.cpp Index: source/Target/Thread.cpp === --- source/Target/Thread.cpp +++ source/Target/Thread.cpp @@ -1913,47 +1913,50 @@ size_t Thread::GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, - bool stop_format) { - ExecutionContext exe_ctx(shared_from_this()); - Target *target = exe_ctx.GetTargetPtr(); - Process *process = exe_ctx.GetProcessPtr(); - size_t num_frames_shown = 0; - strm.Indent(); - bool is_selected = false; - if (process) { -if (process->GetThreadList().GetSelectedThread().get() == this) - is_selected = true; - } - strm.Printf("%c ", is_selected ? '*' : ' '); - if (target && target->GetDebugger().GetUseExternalEditor()) { -StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); -if (frame_sp) { - SymbolContext frame_sc( - frame_sp->GetSymbolContext(eSymbolContextLineEntry)); - if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { -Host::OpenFileInExternalEditor(frame_sc.line_entry.file, - frame_sc.line_entry.line); + bool stop_format, bool only_stacks) { + + if (!only_stacks) { +ExecutionContext exe_ctx(shared_from_this()); +Target *target = exe_ctx.GetTargetPtr(); +Process *process = exe_ctx.GetProcessPtr(); +strm.Indent(); +bool is_selected = false; +if (process) { + if (process->GetThreadList().GetSelectedThread().get() == this) +is_selected = true; +} +strm.Printf("%c ", is_selected ? '*' : ' '); +if (target && target->GetDebugger().GetUseExternalEditor()) { + StackFrameSP frame_sp = GetStackFrameAtIndex(start_frame); + if (frame_sp) { +SymbolContext frame_sc( +frame_sp->GetSymbolContext(eSymbolContextLineEntry)); +if (frame_sc.line_entry.line != 0 && frame_sc.line_entry.file) { + Host::OpenFileInExternalEditor(frame_sc.line_entry.file, + frame_sc.line_entry.line); +} } } - } - DumpUsingSettingsFormat(strm, start_frame, stop_format); +DumpUsingSettingsFormat(strm, start_frame, stop_format); + } + size_t num_frames_shown = 0; if (num_frames > 0) { strm.IndentMore(); const bool show_frame_info = true; - +const bool show_frame_unique = only_stacks; const char *selected_frame_marker = nullptr; -if (num_frames == 1 || +if (num_frames == 1 || only_stacks || (GetID() != GetProcess()->GetThreadList().GetSelectedThread()->GetID())) strm.IndentMore(); else selected_frame_marker = "* "; num_frames_shown = GetStackFrameList()->GetStatus( strm, start_frame, num_frames, show_frame_info, num_frames_with_source, -selected_frame_marker); +show_frame_unique, selected_frame_marker); if (num_frames == 1) strm.IndentLess(); strm.IndentLess(); Index: source/Target/StackFrameList.cpp === --- source/Target/StackFrameList.cpp +++ source/Target/StackFrameList.cpp @@ -801,7 +801,7 @@ size_t StackFrameList::GetStatus(Stream &strm, uint32_t first_frame, uint32_t num_frames, bool show_frame_info, - uint32_t num_frames_with_source, + uint32_t num_frames_with_source, bool show_unique, const char *selected_frame_marker) { size_t num_frames_displayed = 0; @@ -842,7 +842,7 @@ if (!frame_sp->GetStatus(strm, show_frame_info, num_frames_with_source > (first_frame - frame_idx), - marker)) + show_unique, marker)) break; ++num_frames_displayed; } Index: source/Target/StackFrame.cpp === --- source/Target/StackFrame.cpp +++ source/Target/StackFrame.cpp @@ -1744,6 +1744,7 @@ } void StackFrame::DumpUsingSettingsFormat(Stream *strm, + bool show_unique, const char *frame_marker) { if (strm ==
[Lldb-commits] [PATCH] D33426: Introduce new command: thread backtrace unique
bgianfo added a comment. Can someone commit this as I obviously don't have a svn commit bit? https://reviews.llvm.org/D33426 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits