Path: blob/main/contrib/llvm-project/lldb/tools/driver/Driver.h
34879 views
//===-- Driver.h ------------------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_TOOLS_DRIVER_DRIVER_H9#define LLDB_TOOLS_DRIVER_DRIVER_H1011#include "Platform.h"1213#include "lldb/API/SBBroadcaster.h"14#include "lldb/API/SBDebugger.h"15#include "lldb/API/SBDefines.h"16#include "lldb/API/SBError.h"1718#include "llvm/Option/Arg.h"19#include "llvm/Option/ArgList.h"20#include "llvm/Option/Option.h"2122#include <set>23#include <string>24#include <vector>2526class Driver : public lldb::SBBroadcaster {27public:28enum CommandPlacement {29eCommandPlacementBeforeFile,30eCommandPlacementAfterFile,31eCommandPlacementAfterCrash,32};3334Driver();3536virtual ~Driver();3738/// Runs the main loop.39///40/// \return The exit code that the process should return.41int MainLoop();4243lldb::SBError ProcessArgs(const llvm::opt::InputArgList &args, bool &exiting);4445void WriteCommandsForSourcing(CommandPlacement placement,46lldb::SBStream &strm);4748struct OptionData {49void AddInitialCommand(std::string command, CommandPlacement placement,50bool is_file, lldb::SBError &error);5152struct InitialCmdEntry {53InitialCmdEntry(std::string contents, bool in_is_file,54bool in_quiet = false)55: contents(std::move(contents)), is_file(in_is_file),56source_quietly(in_quiet) {}5758std::string contents;59bool is_file;60bool source_quietly;61};6263std::vector<std::string> m_args;6465lldb::LanguageType m_repl_lang = lldb::eLanguageTypeUnknown;66lldb::pid_t m_process_pid = LLDB_INVALID_PROCESS_ID;6768std::string m_core_file;69std::string m_crash_log;70std::string m_repl_options;71std::string m_process_name;7273std::vector<InitialCmdEntry> m_initial_commands;74std::vector<InitialCmdEntry> m_after_file_commands;75std::vector<InitialCmdEntry> m_after_crash_commands;7677bool m_source_quietly = false;78bool m_print_version = false;79bool m_print_python_path = false;80bool m_print_script_interpreter_info = false;81bool m_wait_for = false;82bool m_repl = false;83bool m_batch = false;8485// FIXME: When we have set/show variables we can remove this from here.86bool m_use_external_editor = false;8788using OptionSet = std::set<char>;89OptionSet m_seen_options;90};9192lldb::SBDebugger &GetDebugger() { return m_debugger; }9394void ResizeWindow(unsigned short col);9596private:97lldb::SBDebugger m_debugger;98OptionData m_option_data;99};100101#endif // LLDB_TOOLS_DRIVER_DRIVER_H102103104