xref: /freebsd/contrib/llvm-project/lldb/include/lldb/API/SBBlock.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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/SBAddressRange.h"
13 #include "lldb/API/SBAddressRangeList.h"
14 #include "lldb/API/SBDefines.h"
15 #include "lldb/API/SBFrame.h"
16 #include "lldb/API/SBTarget.h"
17 #include "lldb/API/SBValueList.h"
18 
19 namespace lldb {
20 
21 class LLDB_API SBBlock {
22 public:
23   SBBlock();
24 
25   SBBlock(const lldb::SBBlock &rhs);
26 
27   ~SBBlock();
28 
29   const lldb::SBBlock &operator=(const lldb::SBBlock &rhs);
30 
31   bool IsInlined() const;
32 
33   explicit operator bool() const;
34 
35   bool IsValid() const;
36 
37   const char *GetInlinedName() const;
38 
39   lldb::SBFileSpec GetInlinedCallSiteFile() const;
40 
41   uint32_t GetInlinedCallSiteLine() const;
42 
43   uint32_t GetInlinedCallSiteColumn() const;
44 
45   lldb::SBBlock GetParent();
46 
47   lldb::SBBlock GetSibling();
48 
49   lldb::SBBlock GetFirstChild();
50 
51   uint32_t GetNumRanges();
52 
53   lldb::SBAddress GetRangeStartAddress(uint32_t idx);
54 
55   lldb::SBAddress GetRangeEndAddress(uint32_t idx);
56 
57   lldb::SBAddressRangeList GetRanges();
58 
59   uint32_t GetRangeIndexForBlockAddress(lldb::SBAddress block_addr);
60 
61   lldb::SBValueList GetVariables(lldb::SBFrame &frame, bool arguments,
62                                  bool locals, bool statics,
63                                  lldb::DynamicValueType use_dynamic);
64 
65   lldb::SBValueList GetVariables(lldb::SBTarget &target, bool arguments,
66                                  bool locals, bool statics);
67   /// Get the inlined block that contains this block.
68   ///
69   /// \return
70   ///     If this block is inlined, it will return this block, else
71   ///     parent blocks will be searched to see if any contain this
72   ///     block and are themselves inlined. An invalid SBBlock will
73   ///     be returned if this block nor any parent blocks are inlined
74   ///     function blocks.
75   lldb::SBBlock GetContainingInlinedBlock();
76 
77   bool GetDescription(lldb::SBStream &description);
78 
79 private:
80   friend class SBAddress;
81   friend class SBFrame;
82   friend class SBFunction;
83   friend class SBSymbolContext;
84 
85   lldb_private::Block *GetPtr();
86 
87   void SetPtr(lldb_private::Block *lldb_object_ptr);
88 
89   SBBlock(lldb_private::Block *lldb_object_ptr);
90 
91   void AppendVariables(bool can_create, bool get_parent_variables,
92                        lldb_private::VariableList *var_list);
93 
94   lldb_private::Block *m_opaque_ptr = nullptr;
95 };
96 
97 } // namespace lldb
98 
99 #endif // LLDB_API_SBBLOCK_H
100