summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-16 21:04:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-16 21:04:22 +0000
commit4befb1f96d641a958548654b2c3b674f0ce8404c (patch)
tree664480204c546e55b123766a30e6fcf022c5486e /source
parentf1d04915a666728c241bedb36bd99aafee3ea444 (diff)
Notes
Diffstat (limited to 'source')
-rw-r--r--source/Commands/CommandObjectThread.cpp137
-rw-r--r--source/Core/Debugger.cpp73
-rw-r--r--source/Host/common/Symbols.cpp76
-rw-r--r--source/Target/StackFrame.cpp16
-rw-r--r--source/Target/StackFrameList.cpp3
-rw-r--r--source/Target/Thread.cpp53
-rw-r--r--source/Utility/Status.cpp15
7 files changed, 270 insertions, 103 deletions
diff --git a/source/Commands/CommandObjectThread.cpp b/source/Commands/CommandObjectThread.cpp
index b585ef9ef8ad9..cfd8fcb7291d6 100644
--- a/source/Commands/CommandObjectThread.cpp
+++ b/source/Commands/CommandObjectThread.cpp
@@ -42,10 +42,44 @@ using namespace lldb;
using namespace lldb_private;
//-------------------------------------------------------------------------
-// CommandObjectThreadBacktrace
+// CommandObjectIterateOverThreads
//-------------------------------------------------------------------------
class CommandObjectIterateOverThreads : public CommandObjectParsed {
+
+ class UniqueStack {
+
+ public:
+ UniqueStack(std::stack<lldb::addr_t> 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) const {
+ m_thread_index_ids.push_back(thread_index_id);
+ }
+
+ const std::vector<uint32_t> &GetUniqueThreadIndexIDs() const {
+ return m_thread_index_ids;
+ }
+
+ lldb::tid_t GetRepresentativeThread() const {
+ return m_thread_index_ids.front();
+ }
+
+ friend bool inline operator<(const UniqueStack &lhs,
+ const UniqueStack &rhs) {
+ return lhs.m_stack_frames < rhs.m_stack_frames;
+ }
+
+ protected:
+ // Mark the thread index as mutable, as we don't care about it from a const
+ // perspective, we only care about m_stack_frames so we keep our std::set
+ // sorted.
+ mutable std::vector<uint32_t> m_thread_index_ids;
+ std::stack<lldb::addr_t> m_stack_frames;
+ };
+
public:
CommandObjectIterateOverThreads(CommandInterpreter &interpreter,
const char *name, const char *help,
@@ -57,11 +91,15 @@ public:
bool DoExecute(Args &command, CommandReturnObject &result) override {
result.SetStatus(m_success_return);
+ bool all_threads = false;
if (command.GetArgumentCount() == 0) {
Thread *thread = m_exe_ctx.GetThreadPtr();
if (!HandleOneThread(thread->GetID(), result))
return false;
return result.Succeeded();
+ } else if (command.GetArgumentCount() == 1) {
+ all_threads = ::strcmp(command.GetArgumentAtIndex(0), "all") == 0;
+ m_unique_stacks = ::strcmp(command.GetArgumentAtIndex(0), "unique") == 0;
}
// Use tids instead of ThreadSPs to prevent deadlocking problems which
@@ -69,8 +107,7 @@ public:
// code while iterating over the (locked) ThreadSP list.
std::vector<lldb::tid_t> tids;
- if (command.GetArgumentCount() == 1 &&
- ::strcmp(command.GetArgumentAtIndex(0), "all") == 0) {
+ if (all_threads || m_unique_stacks) {
Process *process = m_exe_ctx.GetProcessPtr();
for (ThreadSP thread_sp : process->Threads())
@@ -108,15 +145,47 @@ public:
}
}
- uint32_t idx = 0;
- for (const lldb::tid_t &tid : tids) {
- if (idx != 0 && m_add_return)
- result.AppendMessage("");
+ if (m_unique_stacks) {
+ // Iterate over threads, finding unique stack buckets.
+ std::set<UniqueStack> unique_stacks;
+ for (const lldb::tid_t &tid : tids) {
+ if (!BucketThread(tid, unique_stacks, result)) {
+ return false;
+ }
+ }
- if (!HandleOneThread(tid, result))
- return false;
+ // Write the thread id's and unique call stacks to the output stream
+ Stream &strm = result.GetOutputStream();
+ Process *process = m_exe_ctx.GetProcessPtr();
+ for (const UniqueStack &stack : unique_stacks) {
+ // List the common thread ID's
+ const std::vector<uint32_t> &thread_index_ids =
+ stack.GetUniqueThreadIndexIDs();
+ strm.Printf("%lu thread(s) ", thread_index_ids.size());
+ for (const uint32_t &thread_index_id : thread_index_ids) {
+ strm.Printf("#%u ", thread_index_id);
+ }
+ strm.EOL();
- ++idx;
+ // List the shared call stack for this set of threads
+ uint32_t representative_thread_id = stack.GetRepresentativeThread();
+ ThreadSP thread = process->GetThreadList().FindThreadByIndexID(
+ representative_thread_id);
+ if (!HandleOneThread(thread->GetID(), result)) {
+ return false;
+ }
+ }
+ } else {
+ uint32_t idx = 0;
+ for (const lldb::tid_t &tid : tids) {
+ if (idx != 0 && m_add_return)
+ result.AppendMessage("");
+
+ if (!HandleOneThread(tid, result))
+ return false;
+
+ ++idx;
+ }
}
return result.Succeeded();
}
@@ -134,7 +203,43 @@ protected:
virtual bool HandleOneThread(lldb::tid_t, CommandReturnObject &result) = 0;
+ bool BucketThread(lldb::tid_t tid, std::set<UniqueStack> &unique_stacks,
+ CommandReturnObject &result) {
+ // Grab the corresponding thread for the given thread id.
+ Process *process = m_exe_ctx.GetProcessPtr();
+ Thread *thread = process->GetThreadList().FindThreadByID(tid).get();
+ if (thread == nullptr) {
+ result.AppendErrorWithFormat("Failed to process thread# %lu.\n", tid);
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+
+ // Collect the each frame's address for this call-stack
+ std::stack<lldb::addr_t> stack_frames;
+ const uint32_t frame_count = thread->GetStackFrameCount();
+ for (uint32_t frame_index = 0; frame_index < frame_count; frame_index++) {
+ const lldb::StackFrameSP frame_sp =
+ thread->GetStackFrameAtIndex(frame_index);
+ const lldb::addr_t pc = frame_sp->GetStackID().GetPC();
+ stack_frames.push(pc);
+ }
+
+ uint32_t thread_index_id = thread->GetIndexID();
+ UniqueStack new_unique_stack(stack_frames, thread_index_id);
+
+ // Try to match the threads stack to and existing entry.
+ std::set<UniqueStack>::iterator matching_stack =
+ unique_stacks.find(new_unique_stack);
+ if (matching_stack != unique_stacks.end()) {
+ matching_stack->AddThread(thread_index_id);
+ } else {
+ unique_stacks.insert(new_unique_stack);
+ }
+ return true;
+ }
+
ReturnStatus m_success_return = eReturnStatusSuccessFinishResult;
+ bool m_unique_stacks = false;
bool m_add_return = true;
};
@@ -218,9 +323,10 @@ public:
: CommandObjectIterateOverThreads(
interpreter, "thread backtrace",
"Show thread call stacks. Defaults to the current thread, thread "
- "indexes can be specified as arguments. Use the thread-index "
- "\"all\" "
- "to see all threads.",
+ "indexes can be specified as arguments.\n"
+ "Use the thread-index \"all\" to see all threads.\n"
+ "Use the thread-index \"unique\" to see threads grouped by unique "
+ "call stacks.",
nullptr,
eCommandRequiresProcess | eCommandRequiresThread |
eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
@@ -270,11 +376,14 @@ protected:
Stream &strm = result.GetOutputStream();
+ // Only dump stack info if we processing unique stacks.
+ const bool only_stacks = m_unique_stacks;
+
// Don't show source context when doing backtraces.
const uint32_t num_frames_with_source = 0;
const bool stop_format = true;
if (!thread->GetStatus(strm, m_options.m_start, m_options.m_count,
- num_frames_with_source, stop_format)) {
+ num_frames_with_source, stop_format, only_stacks)) {
result.AppendErrorWithFormat(
"error displaying backtrace for thread: \"0x%4.4x\"\n",
thread->GetIndexID());
diff --git a/source/Core/Debugger.cpp b/source/Core/Debugger.cpp
index 75fcedb10156f..d42e4df56d8bc 100644
--- a/source/Core/Debugger.cpp
+++ b/source/Core/Debugger.cpp
@@ -112,6 +112,12 @@ OptionEnumValueElement g_language_enumerators[] = {
"{ " \
"${module.file.basename}{`${function.name-with-args}" \
"{${frame.no-debug}${function.pc-offset}}}}"
+
+#define MODULE_WITH_FUNC_NO_ARGS \
+ "{ " \
+ "${module.file.basename}{`${function.name-without-args}" \
+ "{${frame.no-debug}${function.pc-offset}}}}"
+
#define FILE_AND_LINE "{ at ${line.file.basename}:${line.number}}"
#define IS_OPTIMIZED "{${function.is-optimized} [opt]}"
@@ -141,6 +147,10 @@ OptionEnumValueElement g_language_enumerators[] = {
"frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC FILE_AND_LINE \
IS_OPTIMIZED "\\n"
+#define DEFAULT_FRAME_FORMAT_NO_ARGS \
+ "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC_NO_ARGS FILE_AND_LINE \
+ IS_OPTIMIZED "\\n"
+
// Three parts to this disassembly format specification:
// 1. If this is a new function/symbol (no previous symbol/function), print
// dylib`funcname:\n
@@ -186,13 +196,15 @@ static PropertyDefinition g_properties[] = {
{"auto-confirm", OptionValue::eTypeBoolean, true, false, nullptr, nullptr,
"If true all confirmation prompts will receive their default reply."},
{"disassembly-format", OptionValue::eTypeFormatEntity, true, 0,
- DEFAULT_DISASSEMBLY_FORMAT, nullptr, "The default disassembly format "
- "string to use when disassembling "
- "instruction sequences."},
+ DEFAULT_DISASSEMBLY_FORMAT, nullptr,
+ "The default disassembly format "
+ "string to use when disassembling "
+ "instruction sequences."},
{"frame-format", OptionValue::eTypeFormatEntity, true, 0,
- DEFAULT_FRAME_FORMAT, nullptr, "The default frame format string to use "
- "when displaying stack frame information "
- "for threads."},
+ DEFAULT_FRAME_FORMAT, nullptr,
+ "The default frame format string to use "
+ "when displaying stack frame information "
+ "for threads."},
{"notify-void", OptionValue::eTypeBoolean, true, false, nullptr, nullptr,
"Notify the user explicitly if an expression returns void (default: "
"false)."},
@@ -203,18 +215,21 @@ static PropertyDefinition g_properties[] = {
nullptr, g_language_enumerators,
"The script language to be used for evaluating user-written scripts."},
{"stop-disassembly-count", OptionValue::eTypeSInt64, true, 4, nullptr,
- nullptr, "The number of disassembly lines to show when displaying a "
- "stopped context."},
+ nullptr,
+ "The number of disassembly lines to show when displaying a "
+ "stopped context."},
{"stop-disassembly-display", OptionValue::eTypeEnum, true,
Debugger::eStopDisassemblyTypeNoDebugInfo, nullptr,
g_show_disassembly_enum_values,
"Control when to display disassembly when displaying a stopped context."},
{"stop-line-count-after", OptionValue::eTypeSInt64, true, 3, nullptr,
- nullptr, "The number of sources lines to display that come after the "
- "current source line when displaying a stopped context."},
+ nullptr,
+ "The number of sources lines to display that come after the "
+ "current source line when displaying a stopped context."},
{"stop-line-count-before", OptionValue::eTypeSInt64, true, 3, nullptr,
- nullptr, "The number of sources lines to display that come before the "
- "current source line when displaying a stopped context."},
+ nullptr,
+ "The number of sources lines to display that come before the "
+ "current source line when displaying a stopped context."},
{"stop-show-column", OptionValue::eTypeEnum, false,
eStopShowColumnAnsiOrCaret, nullptr, s_stop_show_column_values,
"If true, LLDB will use the column information from the debug info to "
@@ -232,19 +247,22 @@ static PropertyDefinition g_properties[] = {
{"term-width", OptionValue::eTypeSInt64, true, 80, nullptr, nullptr,
"The maximum number of columns to use for displaying text."},
{"thread-format", OptionValue::eTypeFormatEntity, true, 0,
- DEFAULT_THREAD_FORMAT, nullptr, "The default thread format string to use "
- "when displaying thread information."},
+ DEFAULT_THREAD_FORMAT, nullptr,
+ "The default thread format string to use "
+ "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 "
- "information as part of the stop display."},
+ DEFAULT_THREAD_STOP_FORMAT, nullptr,
+ "The default thread format "
+ "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."},
{"use-color", OptionValue::eTypeBoolean, true, true, nullptr, nullptr,
"Whether to use Ansi color codes or not."},
{"auto-one-line-summaries", OptionValue::eTypeBoolean, true, true, nullptr,
- nullptr, "If true, LLDB will automatically display small structs in "
- "one-liner format (default: true)."},
+ nullptr,
+ "If true, LLDB will automatically display small structs in "
+ "one-liner format (default: true)."},
{"auto-indent", OptionValue::eTypeBoolean, true, true, nullptr, nullptr,
"If true, LLDB will auto indent/outdent code. Currently only supported in "
"the REPL (default: true)."},
@@ -255,8 +273,13 @@ static PropertyDefinition g_properties[] = {
"The tab size to use when indenting code in multi-line input mode "
"(default: 4)."},
{"escape-non-printables", OptionValue::eTypeBoolean, true, true, nullptr,
- nullptr, "If true, LLDB will automatically escape non-printable and "
- "escape characters when formatting strings."},
+ nullptr,
+ "If true, LLDB will automatically escape non-printable and "
+ "escape characters when formatting strings."},
+ {"frame-format-unique", OptionValue::eTypeFormatEntity, true, 0,
+ DEFAULT_FRAME_FORMAT_NO_ARGS, nullptr,
+ "The default frame format string to use when displaying stack frame"
+ "information for threads from thread backtrace unique."},
{nullptr, OptionValue::eTypeInvalid, true, 0, nullptr, nullptr, nullptr}};
enum {
@@ -282,7 +305,8 @@ enum {
ePropertyAutoIndent,
ePropertyPrintDecls,
ePropertyTabSize,
- ePropertyEscapeNonPrintables
+ ePropertyEscapeNonPrintables,
+ ePropertyFrameFormatUnique,
};
LoadPluginCallbackType Debugger::g_load_plugin_callback = nullptr;
@@ -358,6 +382,11 @@ const FormatEntity::Entry *Debugger::GetFrameFormat() const {
return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx);
}
+const FormatEntity::Entry *Debugger::GetFrameFormatUnique() const {
+ const uint32_t idx = ePropertyFrameFormatUnique;
+ return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx);
+}
+
bool Debugger::GetNotifyVoid() const {
const uint32_t idx = ePropertyNotiftVoid;
return m_collection_sp->GetPropertyAtIndexAsBoolean(
diff --git a/source/Host/common/Symbols.cpp b/source/Host/common/Symbols.cpp
index 1d9180bf528ef..fe29b9e789900 100644
--- a/source/Host/common/Symbols.cpp
+++ b/source/Host/common/Symbols.cpp
@@ -86,7 +86,6 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec,
path);
}
}
- size_t obj_file_path_length = strlen(path);
::strncat(path, ".dSYM/Contents/Resources/DWARF/",
sizeof(path) - strlen(path) - 1);
::strncat(path, exec_fspec->GetFilename().AsCString(),
@@ -105,38 +104,55 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec,
}
return true;
} else {
- path[obj_file_path_length] = '\0';
-
- char *last_dot = strrchr(path, '.');
- while (last_dot != NULL && last_dot[0]) {
- char *next_slash = strchr(last_dot, '/');
- if (next_slash != NULL) {
- *next_slash = '\0';
- ::strncat(path, ".dSYM/Contents/Resources/DWARF/",
- sizeof(path) - strlen(path) - 1);
- ::strncat(path, exec_fspec->GetFilename().AsCString(),
- sizeof(path) - strlen(path) - 1);
- dsym_fspec.SetFile(path, false);
+ FileSpec parent_dirs = exec_fspec;
+
+ // Remove the binary name from the FileSpec
+ parent_dirs.RemoveLastPathComponent();
+
+ // Add a ".dSYM" name to each directory component of the path, stripping
+ // off components. e.g. we may have a binary like
+ // /S/L/F/Foundation.framework/Versions/A/Foundation
+ // and
+ // /S/L/F/Foundation.framework.dSYM
+ //
+ // so we'll need to start with /S/L/F/Foundation.framework/Versions/A,
+ // add the .dSYM part to the "A", and if that doesn't exist, strip off
+ // the "A" and try it again with "Versions", etc., until we find a dSYM
+ // bundle or we've stripped off enough path components that there's no
+ // need to continue.
+
+ for (int i = 0; i < 4; i++) {
+ // Does this part of the path have a "." character - could it be a bundle's
+ // top level directory?
+ const char *fn = parent_dirs.GetFilename().AsCString();
+ if (fn == nullptr)
+ break;
+ if (::strchr (fn, '.') != nullptr) {
+ dsym_fspec = parent_dirs;
+ dsym_fspec.RemoveLastPathComponent();
+
+ // If the current directory name is "Foundation.framework", see if
+ // "Foundation.framework.dSYM/Contents/Resources/DWARF/Foundation"
+ // exists & has the right uuid.
+ std::string dsym_fn = fn;
+ dsym_fn += ".dSYM";
+ dsym_fspec.AppendPathComponent(dsym_fn.c_str());
+ dsym_fspec.AppendPathComponent("Contents");
+ dsym_fspec.AppendPathComponent("Resources");
+ dsym_fspec.AppendPathComponent("DWARF");
+ dsym_fspec.AppendPathComponent(exec_fspec->GetFilename().AsCString());
if (dsym_fspec.Exists() &&
- FileAtPathContainsArchAndUUID(
- dsym_fspec, module_spec.GetArchitecturePtr(),
- module_spec.GetUUIDPtr())) {
- if (log) {
- log->Printf("dSYM with matching UUID & arch found at %s",
- path);
- }
- return true;
- } else {
- *last_dot = '\0';
- char *prev_slash = strrchr(path, '/');
- if (prev_slash != NULL)
- *prev_slash = '\0';
- else
- break;
+ FileAtPathContainsArchAndUUID(
+ dsym_fspec, module_spec.GetArchitecturePtr(),
+ module_spec.GetUUIDPtr())) {
+ if (log) {
+ log->Printf("dSYM with matching UUID & arch found at %s",
+ dsym_fspec.GetPath().c_str());
+ }
+ return true;
}
- } else {
- break;
}
+ parent_dirs.RemoveLastPathComponent();
}
}
}
diff --git a/source/Target/StackFrame.cpp b/source/Target/StackFrame.cpp
index 4ef4a399290ae..30fceb11c11f3 100644
--- a/source/Target/StackFrame.cpp
+++ b/source/Target/StackFrame.cpp
@@ -1744,7 +1744,7 @@ void StackFrame::CalculateExecutionContext(ExecutionContext &exe_ctx) {
exe_ctx.SetContext(shared_from_this());
}
-void StackFrame::DumpUsingSettingsFormat(Stream *strm,
+void StackFrame::DumpUsingSettingsFormat(Stream *strm, bool show_unique,
const char *frame_marker) {
if (strm == nullptr)
return;
@@ -1758,8 +1758,13 @@ void StackFrame::DumpUsingSettingsFormat(Stream *strm,
const FormatEntity::Entry *frame_format = nullptr;
Target *target = exe_ctx.GetTargetPtr();
- if (target)
- frame_format = target->GetDebugger().GetFrameFormat();
+ if (target) {
+ if (show_unique) {
+ frame_format = target->GetDebugger().GetFrameFormatUnique();
+ } else {
+ frame_format = target->GetDebugger().GetFrameFormat();
+ }
+ }
if (frame_format && FormatEntity::Format(*frame_format, s, &m_sc, &exe_ctx,
nullptr, nullptr, false, false)) {
strm->PutCString(s.GetString());
@@ -1841,11 +1846,10 @@ bool StackFrame::HasCachedData() const {
}
bool StackFrame::GetStatus(Stream &strm, bool show_frame_info, bool show_source,
- const char *frame_marker) {
-
+ bool show_unique, const char *frame_marker) {
if (show_frame_info) {
strm.Indent();
- DumpUsingSettingsFormat(&strm, frame_marker);
+ DumpUsingSettingsFormat(&strm, show_unique, frame_marker);
}
if (show_source) {
diff --git a/source/Target/StackFrameList.cpp b/source/Target/StackFrameList.cpp
index 044f860ba32b2..be7fa8001212e 100644
--- a/source/Target/StackFrameList.cpp
+++ b/source/Target/StackFrameList.cpp
@@ -802,6 +802,7 @@ StackFrameList::GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr) {
size_t StackFrameList::GetStatus(Stream &strm, uint32_t first_frame,
uint32_t num_frames, bool show_frame_info,
uint32_t num_frames_with_source,
+ bool show_unique,
const char *selected_frame_marker) {
size_t num_frames_displayed = 0;
@@ -842,7 +843,7 @@ size_t StackFrameList::GetStatus(Stream &strm, uint32_t first_frame,
if (!frame_sp->GetStatus(strm, show_frame_info,
num_frames_with_source > (first_frame - frame_idx),
- marker))
+ show_unique, marker))
break;
++num_frames_displayed;
}
diff --git a/source/Target/Thread.cpp b/source/Target/Thread.cpp
index 4aba30be5f78b..505d14012d65b 100644
--- a/source/Target/Thread.cpp
+++ b/source/Target/Thread.cpp
@@ -1913,39 +1913,42 @@ const char *Thread::RunModeAsCString(lldb::RunMode mode) {
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
@@ -1953,7 +1956,7 @@ size_t Thread::GetStatus(Stream &strm, uint32_t start_frame,
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();
diff --git a/source/Utility/Status.cpp b/source/Utility/Status.cpp
index 6ecc7717620b9..b11a3db64e6d2 100644
--- a/source/Utility/Status.cpp
+++ b/source/Utility/Status.cpp
@@ -56,10 +56,11 @@ Status::Status(const char *format, ...)
va_end(args);
}
-Status::Status(llvm::Error error)
- : m_code(0), m_type(ErrorType::eErrorTypeGeneric) {
- if (!error)
- return;
+const Status &Status::operator=(llvm::Error error) {
+ if (!error) {
+ Clear();
+ return *this;
+ }
// if the error happens to be a errno error, preserve the error code
error = llvm::handleErrors(
@@ -74,8 +75,12 @@ Status::Status(llvm::Error error)
});
// Otherwise, just preserve the message
- if (error)
+ if (error) {
+ SetErrorToGenericError();
SetErrorString(llvm::toString(std::move(error)));
+ }
+
+ return *this;
}
llvm::Error Status::ToError() const {