1 //===-- SBBlock.h -----------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_API_SBBLOCK_H
10 #define LLDB_API_SBBLOCK_H
11 
12 #include "lldb/API/SBDefines.h"
13 #include "lldb/API/SBFrame.h"
14 #include "lldb/API/SBTarget.h"
15 #include "lldb/API/SBValueList.h"
16 
17 namespace lldb {
18 
19 class LLDB_API SBBlock {
20 public:
21   SBBlock();
22 
23   SBBlock(const lldb::SBBlock &rhs);
24 
25   ~SBBlock();
26 
27   const lldb::SBBlock &operator=(const lldb::SBBlock &rhs);
28 
29   bool IsInlined() const;
30 
31   explicit operator bool() const;
32 
33   bool IsValid() const;
34 
35   const char *GetInlinedName() const;
36 
37   lldb::SBFileSpec GetInlinedCallSiteFile() const;
38 
39   uint32_t GetInlinedCallSiteLine() const;
40 
41   uint32_t GetInlinedCallSiteColumn() const;
42 
43   lldb::SBBlock GetParent();
44 
45   lldb::SBBlock GetSibling();
46 
47   lldb::SBBlock GetFirstChild();
48 
49   uint32_t GetNumRanges();
50 
51   lldb::SBAddress GetRangeStartAddress(uint32_t idx);
52 
53   lldb::SBAddress GetRangeEndAddress(uint32_t idx);
54 
55   uint32_t GetRangeIndexForBlockAddress(lldb::SBAddress block_addr);
56 
57   lldb::SBValueList GetVariables(lldb::SBFrame &frame, bool arguments,
58                                  bool locals, bool statics,
59                                  lldb::DynamicValueType use_dynamic);
60 
61   lldb::SBValueList GetVariables(lldb::SBTarget &target, bool arguments,
62                                  bool locals, bool statics);
63   /// Get the inlined block that contains this block.
64   ///
65   /// \return
66   ///     If this block is inlined, it will return this block, else
67   ///     parent blocks will be searched to see if any contain this
68   ///     block and are themselves inlined. An invalid SBBlock will
69   ///     be returned if this block nor any parent blocks are inlined
70   ///     function blocks.
71   lldb::SBBlock GetContainingInlinedBlock();
72 
73   bool GetDescription(lldb::SBStream &description);
74 
75 private:
76   friend class SBAddress;
77   friend class SBFrame;
78   friend class SBFunction;
79   friend class SBSymbolContext;
80 
81   lldb_private::Block *GetPtr();
82 
83   void SetPtr(lldb_private::Block *lldb_object_ptr);
84 
85   SBBlock(lldb_private::Block *lldb_object_ptr);
86 
87   void AppendVariables(bool can_create, bool get_parent_variables,
88                        lldb_private::VariableList *var_list);
89 
90   lldb_private::Block *m_opaque_ptr = nullptr;
91 };
92 
93 } // namespace lldb
94 
95 #endif // LLDB_API_SBBLOCK_H
96