1 //===-- Driver.h ------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef lldb_Driver_h_
11 #define lldb_Driver_h_
14 #include "lldb/Host/PseudoTerminal.h"
21 #include "lldb/API/SBBroadcaster.h"
22 #include "lldb/API/SBDebugger.h"
23 #include "lldb/API/SBDefines.h"
24 #include "lldb/API/SBError.h"
28 class Driver : public lldb::SBBroadcaster {
30 typedef enum CommandPlacement {
31 eCommandPlacementBeforeFile,
32 eCommandPlacementAfterFile,
33 eCommandPlacementAfterCrash,
42 lldb::SBError ParseArgs(int argc, const char *argv[], FILE *out_fh,
45 const char *GetFilename() const;
47 const char *GetCrashLogFilename() const;
49 const char *GetArchName() const;
51 lldb::ScriptLanguage GetScriptLanguage() const;
53 void WriteCommandsForSourcing(CommandPlacement placement,
54 lldb::SBStream &strm);
56 bool GetDebugMode() const;
65 void AddInitialCommand(const char *command, CommandPlacement placement,
66 bool is_file, lldb::SBError &error);
68 // static OptionDefinition m_cmd_option_table[];
70 struct InitialCmdEntry {
71 InitialCmdEntry(const char *in_contents, bool in_is_file,
72 bool is_cwd_lldbinit_file_read, bool in_quiet = false)
73 : contents(in_contents), is_file(in_is_file),
74 is_cwd_lldbinit_file_read(is_cwd_lldbinit_file_read),
75 source_quietly(in_quiet) {}
79 bool is_cwd_lldbinit_file_read; // if this is reading ./.lldbinit - so we
80 // may skip if not permitted
84 std::vector<std::string> m_args;
85 lldb::ScriptLanguage m_script_lang;
86 std::string m_core_file;
87 std::string m_crash_log;
88 std::vector<InitialCmdEntry> m_initial_commands;
89 std::vector<InitialCmdEntry> m_after_file_commands;
90 std::vector<InitialCmdEntry> m_after_crash_commands;
92 bool m_source_quietly;
94 bool m_print_python_path;
98 lldb::LanguageType m_repl_lang;
99 std::string m_repl_options;
100 std::string m_process_name;
101 lldb::pid_t m_process_pid;
102 bool m_use_external_editor; // FIXME: When we have set/show variables we can
103 // remove this from here.
105 typedef std::set<char> OptionSet;
106 OptionSet m_seen_options;
109 static lldb::SBError SetOptionValue(int option_idx, const char *option_arg,
110 Driver::OptionData &data);
112 lldb::SBDebugger &GetDebugger() { return m_debugger; }
114 void ResizeWindow(unsigned short col);
117 lldb::SBDebugger m_debugger;
118 OptionData m_option_data;
120 void ResetOptionValues();
122 void ReadyForCommand();
125 #endif // lldb_Driver_h_