SBTarget.h revision 24943d2ee8bfaa7cf5893e4709143924157a5c1e
1//===-- SBTarget.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_SBTarget_h_
11#define LLDB_SBTarget_h_
12
13#include <LLDB/SBDefines.h>
14#include <LLDB/SBBroadcaster.h>
15#include <LLDB/SBFileSpec.h>
16
17namespace lldb {
18
19class SBBreakpoint;
20
21class SBTarget
22{
23public:
24    //------------------------------------------------------------------
25    // Broadcaster bits.
26    //------------------------------------------------------------------
27    enum
28    {
29        eBroadcastBitBreakpointChanged  = (1 << 0),
30        eBroadcastBitModulesLoaded      = (1 << 1),
31        eBroadcastBitModulesUnloaded    = (1 << 2)
32    };
33
34    //------------------------------------------------------------------
35    // Constructors and Destructors
36    //------------------------------------------------------------------
37    SBTarget (const lldb::SBTarget& rhs);
38
39    SBTarget ();  // Required for SWIG.
40
41    //------------------------------------------------------------------
42    // Destructor
43    //------------------------------------------------------------------
44    ~SBTarget();
45
46    const lldb::SBTarget&
47    Assign (const lldb::SBTarget& rhs);
48
49    bool
50    IsValid() const;
51
52    lldb::SBProcess
53    GetProcess ();
54
55    lldb::SBProcess
56    CreateProcess ();
57
58    lldb::SBProcess
59    LaunchProcess (char const **argv,
60                   char const **envp,
61                   const char *tty,
62                   bool stop_at_entry);
63
64    lldb::SBFileSpec
65    GetExecutable ();
66
67    uint32_t
68    GetNumModules () const;
69
70    lldb::SBModule
71    GetModuleAtIndex (uint32_t idx);
72
73    lldb::SBModule
74    FindModule (const lldb::SBFileSpec &file_spec);
75
76    bool
77    DeleteTargetFromList (lldb_private::TargetList *list);
78
79    bool
80    MakeCurrentTarget ();
81
82    lldb::SBBreakpoint
83    BreakpointCreateByLocation (const char *file, uint32_t line);
84
85    lldb::SBBreakpoint
86    BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
87
88    lldb::SBBreakpoint
89    BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
90
91    lldb::SBBreakpoint
92    BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
93
94    lldb::SBBreakpoint
95    BreakpointCreateByAddress (addr_t address);
96
97    bool
98    BreakpointDelete (break_id_t break_id);
99
100    void
101    ListAllBreakpoints ();
102
103    lldb::SBBreakpoint
104    FindBreakpointByID (break_id_t break_id);
105
106    bool
107    EnableAllBreakpoints ();
108
109    bool
110    DisableAllBreakpoints ();
111
112    bool
113    DeleteAllBreakpoints ();
114
115    lldb::SBBroadcaster
116    GetBroadcaster () const;
117
118    //void
119    //Disassemble ();
120
121    void
122    Disassemble (lldb::addr_t file_address_start, lldb::addr_t file_address_end = LLDB_INVALID_ADDRESS,
123                 const char *module_name = NULL);
124
125    void
126    Disassemble (const char *function_name, const char *module_name = NULL);
127
128#ifndef SWIG
129    bool
130    operator == (const lldb::SBTarget &rhs) const;
131
132    bool
133    operator != (const lldb::SBTarget &rhs) const;
134
135#endif
136
137protected:
138    friend class SBDebugger;
139    friend class SBProcess;
140
141    //------------------------------------------------------------------
142    // Constructors are private, use static Target::Create function to
143    // create an instance of this class.
144    //------------------------------------------------------------------
145
146    SBTarget (const lldb::TargetSP& target_sp);
147
148    void
149    SetLLBDTarget (const lldb::TargetSP& target_sp);
150
151    lldb_private::Target *
152    GetLLDBObjectPtr();
153
154    const lldb_private::Target *
155    GetLLDBObjectPtr() const;
156
157private:
158    //------------------------------------------------------------------
159    // For Target only
160    //------------------------------------------------------------------
161
162    lldb::TargetSP m_target_sp;
163};
164
165} // namespace lldb
166
167#endif  // LLDB_SBTarget_h_
168