blob: fa3ac31e69160754937338e4ff94ca16ba61e354 [file] [log] [blame]
Chris Lattner24943d22010-06-08 16:52:24 +00001//===-- 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
23using namespace lldb;
24using namespace lldb_private;
25
26ScriptInterpreter::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
38ScriptInterpreter::~ScriptInterpreter ()
39{
40 m_interpreter_pty.CloseMasterFileDescriptor();
41}
42
43const char *
44ScriptInterpreter::GetScriptInterpreterPtyName ()
45{
46 return m_pty_slave_name.c_str();
47}
48
49int
50ScriptInterpreter::GetMasterFileDescriptor ()
51{
52 return m_interpreter_pty.GetMasterFileDescriptor();
53}
54
55void
56ScriptInterpreter::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