SBFrame.h revision a894fe78bc15344a0025c1154e414c554ab31dd9
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//===-- SBFrame.h -----------------------------------------------*- C++ -*-===//
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//                     The LLVM Compiler Infrastructure
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This file is distributed under the University of Illinois Open Source
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// License. See LICENSE.TXT for details.
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//===----------------------------------------------------------------------===//
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef LLDB_SBFrame_h_
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define LLDB_SBFrame_h_
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "lldb/API/SBDefines.h"
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "lldb/API/SBValueList.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "lldb/API/SBWatchpoint.h"
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
17d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)namespace lldb {
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SBFrame
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles){
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)public:
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SBFrame ();
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SBFrame (const lldb::SBFrame &rhs);
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    const lldb::SBFrame &
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    operator =(const lldb::SBFrame &rhs);
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   ~SBFrame();
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    bool
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    IsEqual (const lldb::SBFrame &that) const;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    bool
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    IsValid() const;
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    uint32_t
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetFrameID () const;
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::addr_t
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetPC () const;
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    bool
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    SetPC (lldb::addr_t new_pc);
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::addr_t
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetSP () const;
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::addr_t
505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetFP () const;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::SBAddress
532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    GetPCAddress () const;
542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::SBSymbolContext
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetSymbolContext (uint32_t resolve_scope) const;
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::SBModule
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetModule () const;
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::SBCompileUnit
625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetCompileUnit () const;
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::SBFunction
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetFunction () const;
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::SBSymbol
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetSymbol () const;
695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// Gets the deepest block that contains the frame PC.
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ///
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// See also GetFrameBlock().
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::SBBlock
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetBlock () const;
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// Get the appropriate function name for this frame. Inlined functions in
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// LLDB are represented by Blocks that have inlined function information, so
782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    /// just looking at the SBFunction or SBSymbol for a frame isn't enough.
792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    /// This function will return the appriopriate function, symbol or inlined
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// function name for the frame.
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ///
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// This function returns:
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// - the name of the inlined function (if there is one)
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// - the name of the concrete function (if there is one)
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// - the name of the symbol (if there is one)
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// - NULL
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ///
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// See also IsInlined().
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    const char *
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    GetFunctionName();
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// Return true if this frame represents an inlined function.
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ///
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// See also GetFunctionName().
955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    bool
965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    IsInlined();
975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// The version that doesn't supply a 'use_dynamic' value will use the
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    /// target's default.
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    lldb::SBValue
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    EvaluateExpression (const char *expr);
102
103    lldb::SBValue
104    EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic);
105
106    /// Gets the lexical block that defines the stack frame. Another way to think
107    /// of this is it will return the block that contains all of the variables
108    /// for a stack frame. Inlined functions are represented as SBBlock objects
109    /// that have inlined function information: the name of the inlined function,
110    /// where it was called from. The block that is returned will be the first
111    /// block at or above the block for the PC (SBFrame::GetBlock()) that defines
112    /// the scope of the frame. When a function contains no inlined functions,
113    /// this will be the top most lexical block that defines the function.
114    /// When a function has inlined functions and the PC is currently
115    /// in one of those inlined functions, this method will return the inlined
116    /// block that defines this frame. If the PC isn't currently in an inlined
117    /// function, the lexical block that defines the function is returned.
118    lldb::SBBlock
119    GetFrameBlock () const;
120
121    lldb::SBLineEntry
122    GetLineEntry () const;
123
124    lldb::SBThread
125    GetThread () const;
126
127    const char *
128    Disassemble () const;
129
130    void
131    Clear();
132
133    bool
134    operator == (const lldb::SBFrame &rhs) const;
135
136    bool
137    operator != (const lldb::SBFrame &rhs) const;
138
139    /// The version that doesn't supply a 'use_dynamic' value will use the
140    /// target's default.
141    lldb::SBValueList
142    GetVariables (bool arguments,
143                  bool locals,
144                  bool statics,
145                  bool in_scope_only);
146
147    lldb::SBValueList
148    GetVariables (bool arguments,
149                  bool locals,
150                  bool statics,
151                  bool in_scope_only,
152                  lldb::DynamicValueType  use_dynamic);
153
154    lldb::SBValueList
155    GetRegisters ();
156
157    /// The version that doesn't supply a 'use_dynamic' value will use the
158    /// target's default.
159    lldb::SBValue
160    FindVariable (const char *var_name);
161
162    lldb::SBValue
163    FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic);
164
165    // Find a value for a variable expression path like "rect.origin.x" or
166    // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_
167    // and expression result and is not a constant object like
168    // SBFrame::EvaluateExpression(...) returns, but a child object of
169    // the variable value.
170    lldb::SBValue
171    GetValueForVariablePath (const char *var_expr_cstr,
172                             DynamicValueType use_dynamic);
173
174    /// The version that doesn't supply a 'use_dynamic' value will use the
175    /// target's default.
176    lldb::SBValue
177    GetValueForVariablePath (const char *var_path);
178
179    /// Find variables, register sets, registers, or persistent variables using
180    /// the frame as the scope.
181    ///
182    /// The version that doesn't supply a 'use_dynamic' value will use the
183    /// target's default.
184    lldb::SBValue
185    FindValue (const char *name, ValueType value_type);
186
187    lldb::SBValue
188    FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic);
189
190    /// Find and watch a variable using the frame as the scope.
191    /// It returns an SBValue, similar to FindValue() method, if find-and-watch
192    /// operation succeeds.  Otherwise, an invalid SBValue is returned.
193    /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch.
194    lldb::SBValue
195    WatchValue (const char *name, ValueType value_type, uint32_t watch_type);
196
197    /// Find and watch the location pointed to by a variable using the frame as
198    /// the scope.
199    /// It returns an SBValue, similar to FindValue() method, if find-and-watch
200    /// operation succeeds.  Otherwise, an invalid SBValue is returned.
201    /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch.
202    lldb::SBValue
203    WatchLocation (const char *name, ValueType value_type, uint32_t watch_type, size_t size);
204
205    bool
206    GetDescription (lldb::SBStream &description);
207
208    SBFrame (const lldb::StackFrameSP &lldb_object_sp);
209
210protected:
211
212    friend class SBBlock;
213    friend class SBInstruction;
214    friend class SBThread;
215    friend class SBValue;
216#ifndef LLDB_DISABLE_PYTHON
217    friend class lldb_private::ScriptInterpreterPython;
218#endif
219
220    lldb::StackFrameSP
221    GetFrameSP() const;
222
223    void
224    SetFrameSP (const lldb::StackFrameSP &lldb_object_sp);
225
226    lldb::ExecutionContextRefSP m_opaque_sp;
227};
228
229} // namespace lldb
230
231#endif  // LLDB_SBFrame_h_
232