1 //===-- ScriptInterpreter.cpp -----------------------------------*- 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 #include "lldb/Interpreter/ScriptInterpreter.h" 11 12 #include <string> 13 #include <stdlib.h> 14 #include <stdio.h> 15 16 #include "lldb/Core/Error.h" 17 #include "lldb/Core/Stream.h" 18 #include "lldb/Core/StringList.h" 19 #include "lldb/Interpreter/CommandReturnObject.h" 20 #include "lldb/Utility/PseudoTerminal.h" 21 22 using namespace lldb; 23 using namespace lldb_private; 24 25 ScriptInterpreter::ScriptInterpreter (ScriptLanguage script_lang) : 26 m_script_lang (script_lang), 27 m_interpreter_pty () 28 { 29 if (m_interpreter_pty.OpenFirstAvailableMaster (O_RDWR|O_NOCTTY, NULL, 0)) 30 { 31 const char *slave_name = m_interpreter_pty.GetSlaveName(NULL, 0); 32 if (slave_name) 33 m_pty_slave_name.assign(slave_name); 34 } 35 } 36 37 ScriptInterpreter::~ScriptInterpreter () 38 { 39 m_interpreter_pty.CloseMasterFileDescriptor(); 40 } 41 42 const char * 43 ScriptInterpreter::GetScriptInterpreterPtyName () 44 { 45 return m_pty_slave_name.c_str(); 46 } 47 48 int 49 ScriptInterpreter::GetMasterFileDescriptor () 50 { 51 return m_interpreter_pty.GetMasterFileDescriptor(); 52 } 53 54 void 55 ScriptInterpreter::CollectDataForBreakpointCommandCallback 56 ( 57 BreakpointOptions *bp_options, 58 CommandReturnObject &result 59 ) 60 { 61 result.SetStatus (eReturnStatusFailed); 62 result.AppendError ("ScriptInterpreter::GetScriptCommands(StringList &) is not implemented."); 63 } 64 65 66