Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame^] | 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 | |
| 21 | #include "PseudoTerminal.h" |
| 22 | |
| 23 | using namespace lldb; |
| 24 | using namespace lldb_private; |
| 25 | |
| 26 | ScriptInterpreter::ScriptInterpreter (ScriptLanguage script_lang) : |
| 27 | m_script_lang (script_lang), |
| 28 | m_interpreter_pty () |
| 29 | { |
| 30 | if (m_interpreter_pty.OpenFirstAvailableMaster (O_RDWR|O_NOCTTY, NULL, 0)) |
| 31 | { |
| 32 | const char *slave_name = m_interpreter_pty.GetSlaveName(NULL, 0); |
| 33 | if (slave_name) |
| 34 | m_pty_slave_name.assign(slave_name); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | ScriptInterpreter::~ScriptInterpreter () |
| 39 | { |
| 40 | m_interpreter_pty.CloseMasterFileDescriptor(); |
| 41 | } |
| 42 | |
| 43 | const char * |
| 44 | ScriptInterpreter::GetScriptInterpreterPtyName () |
| 45 | { |
| 46 | return m_pty_slave_name.c_str(); |
| 47 | } |
| 48 | |
| 49 | int |
| 50 | ScriptInterpreter::GetMasterFileDescriptor () |
| 51 | { |
| 52 | return m_interpreter_pty.GetMasterFileDescriptor(); |
| 53 | } |
| 54 | |
| 55 | void |
| 56 | ScriptInterpreter::CollectDataForBreakpointCommandCallback |
| 57 | ( |
| 58 | BreakpointOptions *bp_options, |
| 59 | CommandReturnObject &result |
| 60 | ) |
| 61 | { |
| 62 | result.SetStatus (eReturnStatusFailed); |
| 63 | result.AppendError ("ScriptInterpreter::GetScriptCommands(StringList &) is not implemented."); |
| 64 | } |
| 65 | |
| 66 | |