Driver.h revision 276479
1//===-- Driver.h ------------------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef lldb_Driver_h_ 11#define lldb_Driver_h_ 12 13#include "Platform.h" 14#include "lldb/Utility/PseudoTerminal.h" 15 16#include <set> 17#include <bitset> 18#include <string> 19#include <vector> 20 21#include "lldb/API/SBDefines.h" 22#include "lldb/API/SBBroadcaster.h" 23#include "lldb/API/SBDebugger.h" 24#include "lldb/API/SBError.h" 25 26class IOChannel; 27 28class Driver : public lldb::SBBroadcaster 29{ 30public: 31 Driver (); 32 33 virtual 34 ~Driver (); 35 36 void 37 MainLoop (); 38 39 lldb::SBError 40 ParseArgs (int argc, const char *argv[], FILE *out_fh, bool &do_exit); 41 42 const char * 43 GetFilename() const; 44 45 const char * 46 GetCrashLogFilename() const; 47 48 const char * 49 GetArchName() const; 50 51 lldb::ScriptLanguage 52 GetScriptLanguage() const; 53 54 void 55 WriteInitialCommands (bool before_file, lldb::SBStream &strm); 56 57 bool 58 GetDebugMode() const; 59 60 61 class OptionData 62 { 63 public: 64 OptionData (); 65 ~OptionData (); 66 67 void 68 Clear(); 69 70 void 71 AddInitialCommand (const char *command, bool before_file, bool is_file, lldb::SBError &error); 72 73 //static OptionDefinition m_cmd_option_table[]; 74 75 std::vector<std::string> m_args; 76 lldb::ScriptLanguage m_script_lang; 77 std::string m_core_file; 78 std::string m_crash_log; 79 std::vector<std::pair<bool,std::string> > m_initial_commands; 80 std::vector<std::pair<bool,std::string> > m_after_file_commands; 81 bool m_debug_mode; 82 bool m_source_quietly; 83 bool m_print_version; 84 bool m_print_python_path; 85 bool m_print_help; 86 bool m_wait_for; 87 std::string m_process_name; 88 lldb::pid_t m_process_pid; 89 bool m_use_external_editor; // FIXME: When we have set/show variables we can remove this from here. 90 typedef std::set<char> OptionSet; 91 OptionSet m_seen_options; 92 }; 93 94 95 static lldb::SBError 96 SetOptionValue (int option_idx, 97 const char *option_arg, 98 Driver::OptionData &data); 99 100 101 lldb::SBDebugger & 102 GetDebugger() 103 { 104 return m_debugger; 105 } 106 107 void 108 ResizeWindow (unsigned short col); 109 110private: 111 lldb::SBDebugger m_debugger; 112 OptionData m_option_data; 113 114 void 115 ResetOptionValues (); 116 117 void 118 ReadyForCommand (); 119}; 120 121#endif // lldb_Driver_h_ 122