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_
13 #include "lldb/Utility/PseudoTerminal.h"
20 #include "lldb/API/SBDefines.h"
21 #include "lldb/API/SBBroadcaster.h"
22 #include "lldb/API/SBDebugger.h"
23 #include "lldb/API/SBError.h"
24 #include "lldb/API/SBInputReader.h"
27 #define NO_ASYNC false
37 class Driver : public lldb::SBBroadcaster
41 eBroadcastBitReadyForInput = (1 << 0),
42 eBroadcastBitThreadShouldExit = (1 << 1)
54 PutSTDIN (const char *src, size_t src_len);
57 GetFromMaster (const char *src, size_t src_len);
60 HandleIOEvent (const lldb::SBEvent &event);
63 HandleProcessEvent (const lldb::SBEvent &event);
66 HandleBreakpointEvent (const lldb::SBEvent &event);
69 HandleThreadEvent (const lldb::SBEvent &event);
72 ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &do_exit);
78 GetCrashLogFilename() const;
84 GetScriptLanguage() const;
87 GetNumSourceCommandFiles () const;
90 GetSourceCommandFileAtIndex (uint32_t idx) const;
105 //static OptionDefinition m_cmd_option_table[];
107 std::vector<std::string> m_args;
108 lldb::ScriptLanguage m_script_lang;
109 std::string m_core_file;
110 std::string m_crash_log;
111 std::vector<std::string> m_source_command_files;
113 bool m_print_version;
114 bool m_print_python_path;
117 std::string m_process_name;
118 lldb::pid_t m_process_pid;
119 bool m_use_external_editor; // FIXME: When we have set/show variables we can remove this from here.
120 typedef std::set<char> OptionSet;
121 OptionSet m_seen_options;
126 SetOptionValue (int option_idx,
127 const char *option_arg,
128 Driver::OptionData &data);
138 EditlineReaderIsTop ()
140 return m_debugger.InputReaderIsTopReader (m_editline_reader);
156 ResizeWindow (unsigned short col);
159 lldb::SBDebugger m_debugger;
160 lldb_utility::PseudoTerminal m_editline_pty;
161 FILE *m_editline_slave_fh;
162 lldb::SBInputReader m_editline_reader;
163 std::unique_ptr<IOChannel> m_io_channel_ap;
164 OptionData m_option_data;
165 bool m_executing_user_command;
166 bool m_waiting_for_command;
170 ResetOptionValues ();
179 UpdateSelectedThread ();
182 CloseIOChannelFile ();
185 EditLineInputReaderCallback (void *baton,
186 lldb::SBInputReader *reader,
187 lldb::InputReaderAction notification,
192 ReadThreadBytesReceived (void *baton, const void *src, size_t src_len);
195 MasterThreadBytesReceived (void *baton, const void *src, size_t src_len);
201 #endif // lldb_Driver_h_