SBCommandInterpreter.h revision 24943d2ee8bfaa7cf5893e4709143924157a5c1e
1//===-- SBCommandInterpreter.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_SBCommandInterpreter_h_
11#define LLDB_SBCommandInterpreter_h_
12
13#include <LLDB/SBDefines.h>
14
15namespace lldb {
16
17class SBCommandInterpreter
18{
19public:
20    enum
21    {
22        eBroadcastBitThreadShouldExit       = (1 << 0),
23        eBroadcastBitResetPrompt            = (1 << 1),
24        eBroadcastBitQuitCommandReceived    = (1 << 2)   // User entered quit
25    };
26
27
28    ~SBCommandInterpreter ();
29
30    bool
31    CommandExists (const char *cmd);
32
33    bool
34    AliasExists (const char *cmd);
35
36    bool
37    UserCommandExists (const char *cmd);
38
39    lldb::SBBroadcaster
40    GetBroadcaster ();
41
42    const char **
43    GetEnvironmentVariables ();
44
45    bool
46    HasCommands ();
47
48    bool
49    HasAliases ();
50
51    bool
52    HasUserCommands ();
53
54    bool
55    HasAliasOptions ();
56
57    bool
58    HasInterpreterVariables ();
59
60    lldb::SBProcess
61    GetProcess ();
62
63    ssize_t
64    WriteToScriptInterpreter (const char *src);
65
66    ssize_t
67    WriteToScriptInterpreter (const char *src, size_t src_len);
68
69    void
70    SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
71
72    void
73    SourceInitFileInCurrentWorkingDirectory (lldb::SBCommandReturnObject &result);
74
75    lldb::ReturnStatus
76    HandleCommand (const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history = false);
77
78    int
79    HandleCompletion (const char *current_line,
80                      const char *cursor,
81                      const char *last_char,
82                      int match_start_point,
83                      int max_return_elements,
84                      SBStringList &matches);
85
86protected:
87
88    lldb_private::CommandInterpreter &
89    GetLLDBObjectRef ();
90
91    lldb_private::CommandInterpreter *
92    GetLLDBObjectPtr ();
93
94private:
95    friend class SBDebugger;
96
97    SBCommandInterpreter (lldb_private::CommandInterpreter &interpreter_ptr);   // Access using SBDebugger::GetSharedInstance().GetCommandInterpreter();
98
99    lldb_private::CommandInterpreter &m_interpreter;
100};
101
102
103} // namespace lldb
104
105#endif // LLDB_SBCommandInterpreter_h_
106