diff options
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r-- | lldb/source/Commands/CommandCompletions.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectFrame.cpp | 36 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 45 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectThread.cpp | 7 |
4 files changed, 63 insertions, 27 deletions
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index 21ffba5..4d7e3d7 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -735,7 +735,7 @@ void CommandCompletions::FrameIndexes(CommandInterpreter &interpreter, lldb::StackFrameSP frame_sp = thread_sp->GetStackFrameAtIndex(i); StreamString strm; // Dumping frames can be slow, allow interruption. - if (dbg.InterruptRequested()) + if (INTERRUPT_REQUESTED(dbg, "Interrupted in frame completion")) break; frame_sp->Dump(&strm, false, true); request.TryCompleteCurrentArg(std::to_string(i), strm.GetString()); diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index db31b15..3f68425 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -326,21 +326,29 @@ protected: } } else if (*m_options.relative_frame_offset > 0) { // I don't want "up 20" where "20" takes you past the top of the stack - // to produce - // an error, but rather to just go to the top. So I have to count the - // stack here... - const uint32_t num_frames = thread->GetStackFrameCount(); - if (static_cast<int32_t>(num_frames - frame_idx) > - *m_options.relative_frame_offset) - frame_idx += *m_options.relative_frame_offset; + // to produce an error, but rather to just go to the top. OTOH, start + // by seeing if the requested frame exists, in which case we can avoid + // counting the stack here... + const uint32_t frame_requested = frame_idx + + *m_options.relative_frame_offset; + StackFrameSP frame_sp = thread->GetStackFrameAtIndex(frame_requested); + if (frame_sp) + frame_idx = frame_requested; else { - if (frame_idx == num_frames - 1) { - // If we are already at the top of the stack, just warn and don't - // reset the frame. - result.AppendError("Already at the top of the stack."); - return false; - } else - frame_idx = num_frames - 1; + // The request went past the stack, so handle that case: + const uint32_t num_frames = thread->GetStackFrameCount(); + if (static_cast<int32_t>(num_frames - frame_idx) > + *m_options.relative_frame_offset) + frame_idx += *m_options.relative_frame_offset; + else { + if (frame_idx == num_frames - 1) { + // If we are already at the top of the stack, just warn and don't + // reset the frame. + result.AppendError("Already at the top of the stack."); + return false; + } else + frame_idx = num_frames - 1; + } } } } else { diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 868dc87..1b40651b 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2005,8 +2005,11 @@ protected: result.GetOutputStream().EOL(); result.GetOutputStream().EOL(); } - if (GetDebugger().InterruptRequested()) + if (INTERRUPT_REQUESTED(GetDebugger(), + "Interrupted in dump all symtabs with {0} " + "of {1} dumped.", num_dumped, num_modules)) break; + num_dumped++; DumpModuleSymtab(m_interpreter, result.GetOutputStream(), module_sp.get(), m_options.m_sort_order, @@ -2032,8 +2035,11 @@ protected: result.GetOutputStream().EOL(); result.GetOutputStream().EOL(); } - if (GetDebugger().InterruptRequested()) + if (INTERRUPT_REQUESTED(GetDebugger(), + "Interrupted in dump symtab list with {0} of {1} dumped.", + num_dumped, num_matches)) break; + num_dumped++; DumpModuleSymtab(m_interpreter, result.GetOutputStream(), module_sp.get(), m_options.m_sort_order, @@ -2093,8 +2099,11 @@ protected: result.GetOutputStream().Format("Dumping sections for {0} modules.\n", num_modules); for (size_t image_idx = 0; image_idx < num_modules; ++image_idx) { - if (GetDebugger().InterruptRequested()) + if (INTERRUPT_REQUESTED(GetDebugger(), + "Interrupted in dump all sections with {0} of {1} dumped", + image_idx, num_modules)) break; + num_dumped++; DumpModuleSections( m_interpreter, result.GetOutputStream(), @@ -2111,8 +2120,11 @@ protected: FindModulesByName(target, arg_cstr, module_list, true); if (num_matches > 0) { for (size_t i = 0; i < num_matches; ++i) { - if (GetDebugger().InterruptRequested()) + if (INTERRUPT_REQUESTED(GetDebugger(), + "Interrupted in dump section list with {0} of {1} dumped.", + i, num_matches)) break; + Module *module = module_list.GetModulePointerAtIndex(i); if (module) { num_dumped++; @@ -2228,7 +2240,7 @@ protected: result.GetOutputStream().Format("Dumping clang ast for {0} modules.\n", num_modules); for (ModuleSP module_sp : module_list.ModulesNoLocking()) { - if (GetDebugger().InterruptRequested()) + if (INTERRUPT_REQUESTED(GetDebugger(), "Interrupted dumping clang ast")) break; if (SymbolFile *sf = module_sp->GetSymbolFile()) sf->DumpClangAST(result.GetOutputStream()); @@ -2253,8 +2265,11 @@ protected: } for (size_t i = 0; i < num_matches; ++i) { - if (GetDebugger().InterruptRequested()) + if (INTERRUPT_REQUESTED(GetDebugger(), + "Interrupted in dump clang ast list with {0} of {1} dumped.", + i, num_matches)) break; + Module *m = module_list.GetModulePointerAtIndex(i); if (SymbolFile *sf = m->GetSymbolFile()) sf->DumpClangAST(result.GetOutputStream()); @@ -2302,8 +2317,11 @@ protected: result.GetOutputStream().Format( "Dumping debug symbols for {0} modules.\n", num_modules); for (ModuleSP module_sp : target_modules.ModulesNoLocking()) { - if (GetDebugger().InterruptRequested()) + if (INTERRUPT_REQUESTED(GetDebugger(), "Interrupted in dumping all " + "debug symbols with {0} of {1} modules dumped", + num_dumped, num_modules)) break; + if (DumpModuleSymbolFile(result.GetOutputStream(), module_sp.get())) num_dumped++; } @@ -2318,7 +2336,9 @@ protected: FindModulesByName(target, arg_cstr, module_list, true); if (num_matches > 0) { for (size_t i = 0; i < num_matches; ++i) { - if (GetDebugger().InterruptRequested()) + if (INTERRUPT_REQUESTED(GetDebugger(), "Interrupted dumping {0} " + "of {1} requested modules", + i, num_matches)) break; Module *module = module_list.GetModulePointerAtIndex(i); if (module) { @@ -2382,11 +2402,16 @@ protected: const ModuleList &target_modules = target->GetImages(); std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex()); - if (target_modules.GetSize() > 0) { + size_t num_modules = target_modules.GetSize(); + if (num_modules > 0) { uint32_t num_dumped = 0; for (ModuleSP module_sp : target_modules.ModulesNoLocking()) { - if (GetDebugger().InterruptRequested()) + if (INTERRUPT_REQUESTED(GetDebugger(), + "Interrupted in dump all line tables with " + "{0} of {1} dumped", num_dumped, + num_modules)) break; + if (DumpCompileUnitLineTable( m_interpreter, result.GetOutputStream(), module_sp.get(), file_spec, diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 66a33f5..64f3edc 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -228,8 +228,11 @@ protected: thread->GetIndexID()); return false; } - if (m_options.m_extended_backtrace && !GetDebugger().InterruptRequested()) { - DoExtendedBacktrace(thread, result); + if (m_options.m_extended_backtrace) { + if (!INTERRUPT_REQUESTED(GetDebugger(), + "Interrupt skipped extended backtrace")) { + DoExtendedBacktrace(thread, result); + } } return true; |