Lines Matching +full:cancel +full:- +full:in +full:- +full:progress
1 //===-- Debugger.cpp ------------------------------------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
18 #include "lldb/Core/Progress.h"
55 #include "lldb/lldb-enumerations.h"
117 "no-debuginfo",
122 "no-source",
154 "Use no verbosity when running dwim-print."},
156 "Use partial verbosity when running dwim-print - display a message when "
159 "Use full verbosity when running dwim-print."},
165 "ansi-or-caret",
167 "mode is enabled; otherwise, fall back to using a text-only caret (^) "
168 "as if \"caret-only\" mode was selected.",
180 "stop column. This method introduces a new line in source listings "
205 (property_path == "target.load-script-from-symbol-file");
207 bool invalidate_data_vis = (property_path == "escape-non-printables");
209 (property_path == "target.max-zero-padding-in-float-format");
216 if (is_load_script && exe_ctx && exe_ctx->GetTargetSP()) {
217 target_sp = exe_ctx->GetTargetSP();
219 target_sp->TargetProperties::GetLoadScriptFromSymbolFile();
223 // FIXME it would be nice to have "on-change" callbacks for properties
236 // use-color changed. Ping the prompt so it can reset the ansi terminal
248 // use-source-cache changed. Wipe out the cache contents if it was
255 if (target_sp->TargetProperties::GetLoadScriptFromSymbolFile() ==
259 if (!target_sp->LoadScriptingResources(errors, feedback_stream)) {
378 handler_sp->TerminalSizeChanged();
394 handler_sp->TerminalSizeChanged();
652 debugger->HandleDestroyCallback();
665 debugger->Clear();
666 g_debugger_list_ptr->clear();
684 // The g_load_plugin_callback is registered in SBDebugger::Initialize() and
721 debugger->LoadPlugin(plugin_file_spec, plugin_load_error);
768 g_debugger_list_ptr->push_back(debugger_sp);
770 debugger_sp->InstanceInitialize();
776 // Invoke and remove all the callbacks in an FIFO order. Callbacks which are
785 // Pop the first item in the list
798 debugger_sp->HandleDestroyCallback();
799 CommandInterpreter &cmd_interpreter = debugger_sp->GetCommandInterpreter();
802 CommandReturnObject result(debugger_sp->GetUseColor());
805 (*debugger_sp->GetAsyncOutputStream())
808 (*debugger_sp->GetAsyncErrorStream()) << result.GetErrorString() << '\n';
811 debugger_sp->Clear();
815 DebuggerList::iterator pos, end = g_debugger_list_ptr->end();
816 for (pos = g_debugger_list_ptr->begin(); pos != end; ++pos) {
818 g_debugger_list_ptr->erase(pos);
835 if (llvm::StringRef(debugger_sp->GetInstanceName()) == instance_name)
845 DebuggerList::iterator pos, end = g_debugger_list_ptr->end();
846 for (pos = g_debugger_list_ptr->begin(); pos != end; ++pos) {
847 target_sp = (*pos)->GetTargetList().FindTargetWithProcessID(pid);
859 DebuggerList::iterator pos, end = g_debugger_list_ptr->end();
860 for (pos = g_debugger_list_ptr->begin(); pos != end; ++pos) {
861 target_sp = (*pos)->GetTargetList().FindTargetWithProcess(process);
896 m_collection_sp->Initialize(g_debugger_properties);
897 m_collection_sp->AppendProperty(
900 m_collection_sp->AppendProperty(
903 m_collection_sp->AppendProperty(
906 m_collection_sp->AppendProperty(
910 m_collection_sp->AppendProperty(
913 m_command_interpreter_up->GetValueProperties());
918 m_command_interpreter_up->Initialize();
937 m_collection_sp->GetPropertyAtIndexAsOptionValueUInt64(
939 term_width->SetMinimumValue(10);
942 m_collection_sp->GetPropertyAtIndexAsOptionValueUInt64(
944 term_height->SetMinimumValue(10);
946 // Turn off use-color if this is a dumb terminal.
950 // Turn off use-color if we don't write to a terminal with color support.
956 [this](const FileSpec &dir) -> llvm::Error {
992 m_listener_sp->Clear();
995 if (ProcessSP process_sp = target_sp->GetProcessSP())
996 process_sp->Finalize(false /* not destructing */);
997 target_sp->Destroy();
1000 m_broadcaster_manager_sp->Clear();
1007 m_command_interpreter_up->Clear();
1015 return !m_command_interpreter_up->GetSynchronous();
1019 m_command_interpreter_up->SetSynchronous(!async_execution);
1036 int fds[2] = {-1, -1};
1078 assert(file_sp && file_sp->IsValid());
1081 // it in RestoreInputState.
1086 assert(file_sp && file_sp->IsValid());
1091 assert(file_sp && file_sp->IsValid());
1113 reader_sp->Interrupt();
1120 reader_sp->GotEOF();
1140 reader_sp->Run();
1148 if (top_reader_sp && top_reader_sp->GetIsDone())
1166 top_reader_sp->Run();
1178 if (top_reader_sp && top_reader_sp->GetIsDone()) {
1204 stream->Write(s, len);
1229 void Debugger::AdoptTopIOHandlerFilesIfInvalid(FileSP &in, StreamFileSP &out,
1231 // Before an IOHandler runs, it must have in/out/err streams. This function
1233 // input reader's in/out/err streams, or fall back to the debugger file
1239 if (!in || !in->IsValid()) {
1241 in = top_reader_sp->GetInputFileSP();
1243 in = GetInputFileSP();
1245 if (!in)
1246 in = std::make_shared<NativeFile>(stdin, false);
1249 if (!out || !out->GetFile().IsValid()) {
1251 out = top_reader_sp->GetOutputStreamFileSP();
1259 if (!err || !err->GetFile().IsValid()) {
1261 err = top_reader_sp->GetErrorStreamFileSP();
1286 reader_sp->Activate();
1291 top_reader_sp->Deactivate();
1293 top_reader_sp->Cancel();
1313 reader_sp->Deactivate();
1314 reader_sp->Cancel();
1319 reader_sp->Activate();
1340 m_interrupt_requested--;
1375 if (debugger_sp->InterruptRequested())
1385 return g_debugger_list_ptr->size();
1395 if (index < g_debugger_list_ptr->size())
1396 debugger_sp = g_debugger_list_ptr->at(index);
1407 DebuggerList::iterator pos, end = g_debugger_list_ptr->end();
1408 for (pos = g_debugger_list_ptr->begin(); pos != end; ++pos) {
1409 if ((*pos)->GetID() == id) {
1426 if (exe_ctx != nullptr && exe_ctx->HasTargetScope())
1427 format = exe_ctx->GetTargetRef().GetDebugger().GetDisassemblyFormat();
1435 if (prev_sc && (prev_sc->function || prev_sc->symbol)) {
1436 if (sc && (sc->function || sc->symbol)) {
1437 if (prev_sc->symbol && sc->symbol) {
1438 if (!sc->symbol->Compare(prev_sc->symbol->GetName(),
1439 prev_sc->symbol->GetType())) {
1442 } else if (prev_sc->function && sc->function) {
1443 if (prev_sc->function->GetMangled() != sc->function->GetMangled()) {
1450 // no Function or Symbol -- if SymbolContext had an IsValid() method, it
1452 if ((sc && (sc->function || sc->symbol)) && prev_sc &&
1453 (prev_sc->function == nullptr && prev_sc->symbol == nullptr)) {
1496 if (it->token == token) {
1509 // Only deliver progress events if we have any progress listeners.
1525 // Check if this progress is for a specific debugger.
1537 // The progress event is not debugger specific, iterate over all debuggers
1538 // and deliver a progress event to each one.
1541 DebuggerList::iterator pos, end = g_debugger_list_ptr->end();
1542 for (pos = g_debugger_list_ptr->begin(); pos != end; ++pos)
1647 debugger_sp->GetBroadcaster().BroadcastEvent(event_sp);
1687 log_handler_sp = pos->second.lock();
1704 CreateLogHandler(log_handler_kind, (*file)->GetDescriptor(),
1770 output_sp->Printf("%d location%s added to breakpoint %d\n",
1772 breakpoint->GetID());
1773 output_sp->Flush();
1811 const uint32_t event_type = event_sp->GetType();
1862 plugin_sp->GetDescription(structured_data_sp, content_stream);
1870 output_stream_sp->PutCString(content_stream.GetString());
1873 error_stream_sp->Format("Failed to print structured "
1875 plugin_sp->GetPluginName(), error);
1888 output_stream_sp->Flush();
1889 error_stream_sp->Flush();
1892 process_sp->PopProcessIOHandler();
1900 const uint32_t event_type = event_sp->GetType();
1907 thread_sp->GetStatus(*GetAsyncOutputStream(), 0, 1, 1, stop_format,
1940 listener_sp->StartListeningForEventSpec(m_broadcaster_manager_sp,
1942 listener_sp->StartListeningForEventSpec(m_broadcaster_manager_sp,
1944 listener_sp->StartListeningForEventSpec(m_broadcaster_manager_sp,
1946 listener_sp->StartListeningForEvents(
1952 listener_sp->StartListeningForEvents(
1965 if (listener_sp->GetEvent(event_sp, std::nullopt)) {
1967 Broadcaster *broadcaster = event_sp->GetBroadcaster();
1969 uint32_t event_type = event_sp->GetType();
1970 ConstString broadcaster_class(broadcaster->GetBroadcasterClass());
1991 error_sp->PutCString(data);
1992 error_sp->Flush();
2002 output_sp->PutCString(data);
2003 output_sp->Flush();
2018 m_forward_listener_sp->AddEvent(event_sp);
2031 ConstString full_name("lldb.debugger.event-handler");
2033 listener_sp->StartListeningForEvents(&m_sync_broadcaster,
2039 : "dbg.evt-handler";
2060 listener_sp->GetEvent(event_sp, std::nullopt);
2085 // going to show the progress.
2086 const uint64_t id = data->GetID();
2089 if (log && log->GetVerbose()) {
2095 data->Dump(&log_stream);
2097 log->PutString(log_stream.GetString());
2101 if (data->GetCompleted() == data->GetTotal())
2107 // Decide whether we actually are going to show the progress. This decision
2122 output->Printf("\r");
2124 if (data->GetCompleted() == data->GetTotal()) {
2126 output->Printf("\x1B[2K");
2127 output->Flush();
2131 // Trim the progress message if it exceeds the window's width and print it.
2132 std::string message = data->GetMessage();
2133 if (data->IsFinite())
2134 message = llvm::formatv("[{0}/{1}] {2}", data->GetCompleted(),
2135 data->GetTotal(), message)
2138 // Trim the progress message if it exceeds the window's width and print it.
2142 message.resize(term_width - ellipsis);
2147 output->Printf(
2150 output->Printf("%s...", message.c_str());
2154 output->Printf(
2158 output->Printf("\x1B[K\r");
2161 output->Flush();
2170 data->Dump(stream.get());
2186 "lldb.debugger.io-handler", [this] { return IOHandlerThread(); },
2251 nullptr; // passing in an empty target means the REPL must create one
2266 repl_sp->SetCompilerOptions(repl_options);
2267 repl_sp->RunLoop();