003 File Manager
Current Path:
/usr/src/contrib/llvm-project/lldb/source/Commands
usr
/
src
/
contrib
/
llvm-project
/
lldb
/
source
/
Commands
/
📁
..
📄
CommandCompletions.cpp
(21.8 KB)
📄
CommandObjectApropos.cpp
(3.61 KB)
📄
CommandObjectApropos.h
(904 B)
📄
CommandObjectBreakpoint.cpp
(81.05 KB)
📄
CommandObjectBreakpoint.h
(1.72 KB)
📄
CommandObjectBreakpointCommand.cpp
(25.81 KB)
📄
CommandObjectBreakpointCommand.h
(902 B)
📄
CommandObjectCommands.cpp
(63.2 KB)
📄
CommandObjectCommands.h
(877 B)
📄
CommandObjectDisassemble.cpp
(17.74 KB)
📄
CommandObjectDisassemble.h
(3.05 KB)
📄
CommandObjectExpression.cpp
(23.86 KB)
📄
CommandObjectExpression.h
(3.63 KB)
📄
CommandObjectFrame.cpp
(42.35 KB)
📄
CommandObjectFrame.h
(852 B)
📄
CommandObjectGUI.cpp
(1.79 KB)
📄
CommandObjectGUI.h
(870 B)
📄
CommandObjectHelp.cpp
(8.53 KB)
📄
CommandObjectHelp.h
(2.35 KB)
📄
CommandObjectLanguage.cpp
(933 B)
📄
CommandObjectLanguage.h
(883 B)
📄
CommandObjectLog.cpp
(17.02 KB)
📄
CommandObjectLog.h
(1004 B)
📄
CommandObjectMemory.cpp
(61.7 KB)
📄
CommandObjectMemory.h
(799 B)
📄
CommandObjectMultiword.cpp
(13.54 KB)
📄
CommandObjectPlatform.cpp
(61.17 KB)
📄
CommandObjectPlatform.h
(997 B)
📄
CommandObjectPlugin.cpp
(2.68 KB)
📄
CommandObjectPlugin.h
(799 B)
📄
CommandObjectProcess.cpp
(55.63 KB)
📄
CommandObjectProcess.h
(866 B)
📄
CommandObjectQuit.cpp
(3.81 KB)
📄
CommandObjectQuit.h
(930 B)
📄
CommandObjectRegister.cpp
(15.66 KB)
📄
CommandObjectRegister.h
(1.04 KB)
📄
CommandObjectReproducer.cpp
(17.86 KB)
📄
CommandObjectReproducer.h
(851 B)
📄
CommandObjectSettings.cpp
(38.87 KB)
📄
CommandObjectSettings.h
(873 B)
📄
CommandObjectSource.cpp
(47.71 KB)
📄
CommandObjectSource.h
(863 B)
📄
CommandObjectStats.cpp
(3.52 KB)
📄
CommandObjectStats.h
(791 B)
📄
CommandObjectTarget.cpp
(177.86 KB)
📄
CommandObjectTarget.h
(859 B)
📄
CommandObjectThread.cpp
(78.3 KB)
📄
CommandObjectThread.h
(826 B)
📄
CommandObjectType.cpp
(98.61 KB)
📄
CommandObjectType.h
(774 B)
📄
CommandObjectVersion.cpp
(1.18 KB)
📄
CommandObjectVersion.h
(898 B)
📄
CommandObjectWatchpoint.cpp
(40.55 KB)
📄
CommandObjectWatchpoint.h
(1.04 KB)
📄
CommandObjectWatchpointCommand.cpp
(23.68 KB)
📄
CommandObjectWatchpointCommand.h
(902 B)
📄
Options.td
(58.93 KB)
📄
OptionsBase.td
(7.3 KB)
Editing: CommandObjectQuit.cpp
//===-- CommandObjectQuit.cpp ---------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "CommandObjectQuit.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Target/Process.h" #include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; // CommandObjectQuit CommandObjectQuit::CommandObjectQuit(CommandInterpreter &interpreter) : CommandObjectParsed(interpreter, "quit", "Quit the LLDB debugger.", "quit [exit-code]") {} CommandObjectQuit::~CommandObjectQuit() {} // returns true if there is at least one alive process is_a_detach will be true // if all alive processes will be detached when you quit and false if at least // one process will be killed instead bool CommandObjectQuit::ShouldAskForConfirmation(bool &is_a_detach) { if (!m_interpreter.GetPromptOnQuit()) return false; bool should_prompt = false; is_a_detach = true; for (uint32_t debugger_idx = 0; debugger_idx < Debugger::GetNumDebuggers(); debugger_idx++) { DebuggerSP debugger_sp(Debugger::GetDebuggerAtIndex(debugger_idx)); if (!debugger_sp) continue; const TargetList &target_list(debugger_sp->GetTargetList()); for (uint32_t target_idx = 0; target_idx < static_cast<uint32_t>(target_list.GetNumTargets()); target_idx++) { TargetSP target_sp(target_list.GetTargetAtIndex(target_idx)); if (!target_sp) continue; ProcessSP process_sp(target_sp->GetProcessSP()); if (process_sp && process_sp->IsValid() && process_sp->IsAlive() && process_sp->WarnBeforeDetach()) { should_prompt = true; if (!process_sp->GetShouldDetach()) { // if we need to kill at least one process, just say so and return is_a_detach = false; return should_prompt; } } } } return should_prompt; } bool CommandObjectQuit::DoExecute(Args &command, CommandReturnObject &result) { bool is_a_detach = true; if (ShouldAskForConfirmation(is_a_detach)) { StreamString message; message.Printf("Quitting LLDB will %s one or more processes. Do you really " "want to proceed", (is_a_detach ? "detach from" : "kill")); if (!m_interpreter.Confirm(message.GetString(), true)) { result.SetStatus(eReturnStatusFailed); return false; } } if (command.GetArgumentCount() > 1) { result.AppendError("Too many arguments for 'quit'. Only an optional exit " "code is allowed"); result.SetStatus(eReturnStatusFailed); return false; } // We parse the exit code argument if there is one. if (command.GetArgumentCount() == 1) { llvm::StringRef arg = command.GetArgumentAtIndex(0); int exit_code; if (arg.getAsInteger(/*autodetect radix*/ 0, exit_code)) { lldb_private::StreamString s; std::string arg_str = arg.str(); s.Printf("Couldn't parse '%s' as integer for exit code.", arg_str.data()); result.AppendError(s.GetString()); result.SetStatus(eReturnStatusFailed); return false; } if (!m_interpreter.SetQuitExitCode(exit_code)) { result.AppendError("The current driver doesn't allow custom exit codes" " for the quit command."); result.SetStatus(eReturnStatusFailed); return false; } } const uint32_t event_type = CommandInterpreter::eBroadcastBitQuitCommandReceived; m_interpreter.BroadcastEvent(event_type); result.SetStatus(eReturnStatusQuit); return true; }
Upload File
Create Folder