LLDB mainline
Function.h
Go to the documentation of this file.
1//===-- Function.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_SYMBOL_FUNCTION_H
10#define LLDB_SYMBOL_FUNCTION_H
11
14#include "lldb/Core/Mangled.h"
16#include "lldb/Symbol/Block.h"
17#include "lldb/Utility/UserID.h"
18#include "lldb/lldb-forward.h"
19#include "llvm/ADT/ArrayRef.h"
20
21#include <mutex>
22
23namespace lldb_private {
24
26
27/// \class FunctionInfo Function.h "lldb/Symbol/Function.h"
28/// A class that contains generic function information.
29///
30/// This provides generic function information that gets reused between inline
31/// functions and function types.
33public:
34 /// Construct with the function method name and optional declaration
35 /// information.
36 ///
37 /// \param[in] name
38 /// A C string name for the method name for this function. This
39 /// value should not be the mangled named, but the simple method
40 /// name.
41 ///
42 /// \param[in] decl_ptr
43 /// Optional declaration information that describes where the
44 /// function was declared. This can be NULL.
45 FunctionInfo(const char *name, const Declaration *decl_ptr);
46
47 /// Construct with the function method name and optional declaration
48 /// information.
49 ///
50 /// \param[in] name
51 /// A name for the method name for this function. This value
52 /// should not be the mangled named, but the simple method name.
53 ///
54 /// \param[in] decl_ptr
55 /// Optional declaration information that describes where the
56 /// function was declared. This can be NULL.
57 FunctionInfo(ConstString name, const Declaration *decl_ptr);
58
59 /// Destructor.
60 ///
61 /// The destructor is virtual since classes inherit from this class.
62 virtual ~FunctionInfo();
63
64 /// Compare two function information objects.
65 ///
66 /// First compares the method names, and if equal, then compares the
67 /// declaration information.
68 ///
69 /// \param[in] lhs
70 /// The Left Hand Side const FunctionInfo object reference.
71 ///
72 /// \param[in] rhs
73 /// The Right Hand Side const FunctionInfo object reference.
74 ///
75 /// \return
76 /// -1 if lhs < rhs
77 /// 0 if lhs == rhs
78 /// 1 if lhs > rhs
79 static int Compare(const FunctionInfo &lhs, const FunctionInfo &rhs);
80
81 /// Dump a description of this object to a Stream.
82 ///
83 /// Dump a description of the contents of this object to the supplied stream
84 /// \a s.
85 ///
86 /// \param[in] s
87 /// The stream to which to dump the object description.
88 void Dump(Stream *s, bool show_fullpaths) const;
89
90 /// Get accessor for the declaration information.
91 ///
92 /// \return
93 /// A reference to the declaration object.
95
96 /// Get const accessor for the declaration information.
97 ///
98 /// \return
99 /// A const reference to the declaration object.
100 const Declaration &GetDeclaration() const;
101
102 /// Get accessor for the method name.
103 ///
104 /// \return
105 /// A const reference to the method name object.
106 ConstString GetName() const;
107
108 /// Get the memory cost of this object.
109 ///
110 /// \return
111 /// The number of bytes that this object occupies in memory.
112 /// The returned value does not include the bytes for any
113 /// shared string values.
114 virtual size_t MemorySize() const;
115
116protected:
117 /// Function method name (not a mangled name).
119
120 /// Information describing where this function information was defined.
122};
123
124/// \class InlineFunctionInfo Function.h "lldb/Symbol/Function.h"
125/// A class that describes information for an inlined function.
127public:
128 /// Construct with the function method name, mangled name, and optional
129 /// declaration information.
130 ///
131 /// \param[in] name
132 /// A C string name for the method name for this function. This
133 /// value should not be the mangled named, but the simple method
134 /// name.
135 ///
136 /// \param[in] mangled
137 /// A C string name for the mangled name for this function. This
138 /// value can be NULL if there is no mangled information.
139 ///
140 /// \param[in] decl_ptr
141 /// Optional declaration information that describes where the
142 /// function was declared. This can be NULL.
143 ///
144 /// \param[in] call_decl_ptr
145 /// Optional calling location declaration information that
146 /// describes from where this inlined function was called.
147 InlineFunctionInfo(const char *name, llvm::StringRef mangled,
148 const Declaration *decl_ptr,
149 const Declaration *call_decl_ptr);
150
151 /// Construct with the function method name, mangled name, and optional
152 /// declaration information.
153 ///
154 /// \param[in] name
155 /// A name for the method name for this function. This value
156 /// should not be the mangled named, but the simple method name.
157 ///
158 /// \param[in] mangled
159 /// A name for the mangled name for this function. This value
160 /// can be empty if there is no mangled information.
161 ///
162 /// \param[in] decl_ptr
163 /// Optional declaration information that describes where the
164 /// function was declared. This can be NULL.
165 ///
166 /// \param[in] call_decl_ptr
167 /// Optional calling location declaration information that
168 /// describes from where this inlined function was called.
169 InlineFunctionInfo(ConstString name, const Mangled &mangled,
170 const Declaration *decl_ptr,
171 const Declaration *call_decl_ptr);
172
173 /// Destructor.
175
176 /// Compare two inlined function information objects.
177 ///
178 /// First compares the FunctionInfo objects, and if equal, compares the
179 /// mangled names.
180 ///
181 /// \param[in] lhs
182 /// The Left Hand Side const InlineFunctionInfo object
183 /// reference.
184 ///
185 /// \param[in] rhs
186 /// The Right Hand Side const InlineFunctionInfo object
187 /// reference.
188 ///
189 /// \return
190 /// -1 if lhs < rhs
191 /// 0 if lhs == rhs
192 /// 1 if lhs > rhs
193 int Compare(const InlineFunctionInfo &lhs, const InlineFunctionInfo &rhs);
194
195 /// Dump a description of this object to a Stream.
196 ///
197 /// Dump a description of the contents of this object to the supplied stream
198 /// \a s.
199 ///
200 /// \param[in] s
201 /// The stream to which to dump the object description.
202 void Dump(Stream *s, bool show_fullpaths) const;
203
204 void DumpStopContext(Stream *s) const;
205
206 ConstString GetName() const;
207
209
210 /// Get accessor for the call site declaration information.
211 ///
212 /// \return
213 /// A reference to the declaration object.
215
216 /// Get const accessor for the call site declaration information.
217 ///
218 /// \return
219 /// A const reference to the declaration object.
220 const Declaration &GetCallSite() const;
221
222 /// Get accessor for the mangled name object.
223 ///
224 /// \return
225 /// A reference to the mangled name object.
227
228 /// Get const accessor for the mangled name object.
229 ///
230 /// \return
231 /// A const reference to the mangled name object.
232 const Mangled &GetMangled() const;
233
234 /// Get the memory cost of this object.
235 ///
236 /// \return
237 /// The number of bytes that this object occupies in memory.
238 /// The returned value does not include the bytes for any
239 /// shared string values.
240 size_t MemorySize() const override;
241
242private:
243 /// Mangled inlined function name (can be empty if there is no mangled
244 /// information).
246
248};
249
250class Function;
251
252/// \class CallSiteParameter Function.h "lldb/Symbol/Function.h"
253///
254/// Represent the locations of a parameter at a call site, both in the caller
255/// and in the callee.
260
261/// A vector of \c CallSiteParameter.
262using CallSiteParameterArray = llvm::SmallVector<CallSiteParameter, 0>;
263
264/// \class CallEdge Function.h "lldb/Symbol/Function.h"
265///
266/// Represent a call made within a Function. This can be used to find a path
267/// in the call graph between two functions, or to evaluate DW_OP_entry_value.
268class CallEdge {
269public:
270 enum class AddrType : uint8_t { Call, AfterCall };
271 virtual ~CallEdge();
272
273 /// Get the callee's definition.
274 ///
275 /// Note that this might lazily invoke the DWARF parser. A register context
276 /// from the caller's activation is needed to find indirect call targets.
277 virtual Function *GetCallee(ModuleList &images,
278 ExecutionContext &exe_ctx) = 0;
279
280 /// Get the load PC address of the instruction which executes after the call
281 /// returns. Returns LLDB_INVALID_ADDRESS iff this is a tail call. \p caller
282 /// is the Function containing this call, and \p target is the Target which
283 /// made the call.
284 lldb::addr_t GetReturnPCAddress(Function &caller, Target &target) const;
285
286 /// Return an address in the caller. This can either be the address of the
287 /// call instruction, or the address of the instruction after the call.
288 std::pair<AddrType, lldb::addr_t> GetCallerAddress(Function &caller,
289 Target &target) const {
290 return {caller_address_type,
291 GetLoadAddress(caller_address, caller, target)};
292 }
293
294 bool IsTailCall() const { return is_tail_call; }
295
296 /// Get the call site parameters available at this call edge.
297 llvm::ArrayRef<CallSiteParameter> GetCallSiteParameters() const {
298 return parameters;
299 }
300
301 /// Non-tail-calls go first, sorted by the return address. They are followed
302 /// by tail calls, which have no specific order.
303 std::pair<bool, lldb::addr_t> GetSortKey() const {
305 }
306
307protected:
310
311 /// Helper that finds the load address of \p unresolved_pc, a file address
312 /// which refers to an instruction within \p caller.
313 static lldb::addr_t GetLoadAddress(lldb::addr_t unresolved_pc,
314 Function &caller, Target &target);
315
316 /// Like \ref GetReturnPCAddress, but returns an unresolved file address.
322
323private:
327
329};
330
331/// A direct call site. Used to represent call sites where the address of the
332/// callee is fixed (e.g. a function call in C in which the call target is not
333/// a function pointer).
334class DirectCallEdge : public CallEdge {
335public:
336 /// Construct a call edge using a symbol name to identify the callee, and a
337 /// return PC within the calling function to identify a specific call site.
341
342 Function *GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override;
343
344private:
346
347 // Used to describe a direct call.
348 //
349 // Either the callee's mangled name or its definition, discriminated by
350 // \ref resolved.
351 union {
352 const char *symbol_name;
355
356 /// Whether or not an attempt was made to find the callee's definition.
357 bool resolved = false;
358};
359
360/// An indirect call site. Used to represent call sites where the address of
361/// the callee is not fixed, e.g. a call to a C++ virtual function (where the
362/// address is loaded out of a vtable), or a call to a function pointer in C.
364public:
365 /// Construct a call edge using a DWARFExpression to identify the callee, and
366 /// a return PC within the calling function to identify a specific call site.
370
371 Function *GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override;
372
373private:
374 // Used to describe an indirect call.
375 //
376 // Specifies the location of the callee address in the calling frame.
378};
379
380/// \class Function Function.h "lldb/Symbol/Function.h"
381/// A class that describes a function.
382///
383/// Functions belong to CompileUnit objects (Function::m_comp_unit), have
384/// unique user IDs (Function::UserID), know how to reconstruct their symbol
385/// context (Function::SymbolContextScope), have a specific function type
386/// (Function::m_type_uid), have a simple method name (FunctionInfo::m_name),
387/// be declared at a specific location (FunctionInfo::m_declaration), possibly
388/// have mangled names (Function::m_mangled), an optional return type
389/// (Function::m_type), and contains lexical blocks (Function::m_blocks).
390///
391/// The function information is split into a few pieces:
392/// \li The concrete instance information
393/// \li The abstract information
394///
395/// The abstract information is found in the function type (Type) that
396/// describes a function information, return type and parameter types.
397///
398/// The concrete information is the address range information and specific
399/// locations for an instance of this function.
400class Function : public UserID, public SymbolContextScope {
401public:
402 /// Construct with a compile unit, function UID, function type UID, optional
403 /// mangled name, function type, and a section offset based address range.
404 ///
405 /// \param[in] comp_unit
406 /// The compile unit to which this function belongs.
407 ///
408 /// \param[in] func_uid
409 /// The UID for this function. This value is provided by the
410 /// SymbolFile plug-in and can be any value that allows
411 /// the plug-in to quickly find and parse more detailed
412 /// information when and if more information is needed.
413 ///
414 /// \param[in] func_type_uid
415 /// The type UID for the function Type to allow for lazy type
416 /// parsing from the debug information.
417 ///
418 /// \param[in] mangled
419 /// The optional mangled name for this function. If empty, there
420 /// is no mangled information.
421 ///
422 /// \param[in] func_type
423 /// The optional function type. If NULL, the function type will
424 /// be parsed on demand when accessed using the
425 /// Function::GetType() function by asking the SymbolFile
426 /// plug-in to get the type for \a func_type_uid.
427 ///
428 /// \param[in] range
429 /// The section offset based address for this function.
430 Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
431 lldb::user_id_t func_type_uid, const Mangled &mangled,
432 Type *func_type, Address address, AddressRanges ranges);
433
434 /// Destructor.
435 ~Function() override;
436
437 /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
438 ///
439 /// \see SymbolContextScope
440 void CalculateSymbolContext(SymbolContext *sc) override;
441
443
445
447
448 AddressRanges GetAddressRanges() { return m_block.GetRanges(); }
449
450 /// Return the address of the function (its entry point). This address is also
451 /// used as a base address for relocation of function-scope entities (blocks
452 /// and variables).
453 const Address &GetAddress() const { return m_address; }
454
456 AddressRange &range) {
457 return m_block.GetRangeContainingLoadAddress(load_addr, target, range);
458 }
459
461
462 /// Find the file and line number of the source location of the start of the
463 /// function. This will use the declaration if present and fall back on the
464 /// line table if that fails. So there may NOT be a line table entry for
465 /// this source file/line combo.
466 ///
467 /// \param[out] source_file
468 /// The source file.
469 ///
470 /// \param[out] line_no
471 /// The line number.
472 void GetStartLineSourceInfo(lldb::SupportFileSP &source_file_sp,
473 uint32_t &line_no);
474
476 /// Find the file and line number range of the function.
477 llvm::Expected<std::pair<lldb::SupportFileSP, SourceRange>> GetSourceInfo();
478
479 /// Get the outgoing call edges from this function, sorted by their return
480 /// PC addresses (in increasing order).
481 llvm::ArrayRef<std::unique_ptr<CallEdge>> GetCallEdges();
482
483 /// Get the outgoing tail-calling edges from this function. If none exist,
484 /// return std::nullopt.
485 llvm::ArrayRef<std::unique_ptr<CallEdge>> GetTailCallingEdges();
486
487 /// Get the outgoing call edge from this function which has the given return
488 /// address \p return_pc, or return nullptr. Note that this will not return a
489 /// tail-calling edge.
491
492 /// Get accessor for the block list.
493 ///
494 /// \return
495 /// The block list object that describes all lexical blocks
496 /// in the function.
497 ///
498 /// \see BlockList
499 Block &GetBlock(bool can_create);
500
501 /// Get accessor for the compile unit that owns this function.
502 ///
503 /// \return
504 /// A compile unit object pointer.
506
507 /// Get const accessor for the compile unit that owns this function.
508 ///
509 /// \return
510 /// A const compile unit object pointer.
511 const CompileUnit *GetCompileUnit() const;
512
513 void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target);
514
515 /// Get accessor for the frame base location.
516 ///
517 /// \return
518 /// A location expression that describes the function frame
519 /// base.
521
522 /// Get const accessor for the frame base location.
523 ///
524 /// \return
525 /// A const compile unit object pointer.
527
528 ConstString GetName() const;
529
531
533
534 const Mangled &GetMangled() const { return m_mangled; }
535
536 /// Get the DeclContext for this function, if available.
537 ///
538 /// \return
539 /// The DeclContext, or NULL if none exists.
541
542 /// Get the CompilerContext for this function, if available.
543 ///
544 /// \return
545 /// The CompilerContext, or an empty vector if none is available.
546 std::vector<CompilerContext> GetCompilerContext();
547
548 /// Get accessor for the type that describes the function return value type,
549 /// and parameter types.
550 ///
551 /// \return
552 /// A type object pointer.
553 Type *GetType();
554
555 /// Get const accessor for the type that describes the function return value
556 /// type, and parameter types.
557 ///
558 /// \return
559 /// A const type object pointer.
560 const Type *GetType() const;
561
563
564 /// Get the size of the prologue instructions for this function. The
565 /// "prologue" instructions include any instructions given line number 0
566 /// immediately following the prologue end.
567 ///
568 /// \return
569 /// The size of the prologue.
570 uint32_t GetPrologueByteSize();
571
572 /// Dump a description of this object to a Stream.
573 ///
574 /// Dump a description of the contents of this object to the supplied stream
575 /// \a s.
576 ///
577 /// \param[in] s
578 /// The stream to which to dump the object description.
579 ///
580 /// \param[in] show_context
581 /// If \b true, variables will dump their symbol context
582 /// information.
583 void Dump(Stream *s, bool show_context) const;
584
585 /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
586 ///
587 /// \see SymbolContextScope
588 void DumpSymbolContext(Stream *s) override;
589
590 /// Get the memory cost of this object.
591 ///
592 /// \return
593 /// The number of bytes that this object occupies in memory.
594 /// The returned value does not include the bytes for any
595 /// shared string values.
596 size_t MemorySize() const;
597
598 /// Get whether compiler optimizations were enabled for this function
599 ///
600 /// The debug information may provide information about whether this
601 /// function was compiled with optimization or not. In this case,
602 /// "optimized" means that the debug experience may be difficult for the
603 /// user to understand. Variables may not be available when the developer
604 /// would expect them, stepping through the source lines in the function may
605 /// appear strange, etc.
606 ///
607 /// \return
608 /// Returns 'true' if this function was compiled with
609 /// optimization. 'false' indicates that either the optimization
610 /// is unknown, or this function was built without optimization.
611 bool GetIsOptimized();
612
613 /// Get whether this function represents a 'top-level' function
614 ///
615 /// The concept of a top-level function is language-specific, mostly meant
616 /// to represent the notion of scripting-style code that has global
617 /// visibility of the variables/symbols/functions/... defined within the
618 /// containing file/module
619 ///
620 /// If stopped in a top-level function, LLDB will expose global variables
621 /// as-if locals in the 'frame variable' command
622 ///
623 /// \return
624 /// Returns 'true' if this function is a top-level function,
625 /// 'false' otherwise.
626 bool IsTopLevelFunction();
627
629 const char *flavor,
630 bool force_live_memory = false);
631
632 bool GetDisassembly(const ExecutionContext &exe_ctx, const char *flavor,
633 Stream &strm, bool force_live_memory = false);
634
635protected:
636 enum {
637 /// Whether we already tried to calculate the prologue size.
639 };
640
641 /// The compile unit that owns this function.
643
644 /// The user ID of for the prototype Type for this function.
646
647 /// The function prototype type for this function that includes the function
648 /// info (FunctionInfo), return type and parameters.
650
651 /// The mangled function name if any. If empty, there is no mangled
652 /// information.
654
655 /// All lexical blocks contained in this function.
657
658 /// The address (entry point) of the function.
660
661 /// The frame base expression for variables that are relative to the frame
662 /// pointer.
664
666
667 /// Compute the prologue size once and cache it.
669
670 /// Exclusive lock that controls read/write access to m_call_edges and
671 /// m_call_edges_resolved.
673
674 /// Whether call site info has been parsed.
676
677 /// Outgoing call edges.
678 std::vector<std::unique_ptr<CallEdge>> m_call_edges;
679
680private:
681 Function(const Function &) = delete;
682 const Function &operator=(const Function &) = delete;
683};
684
685} // namespace lldb_private
686
687#endif // LLDB_SYMBOL_FUNCTION_H
A section + offset based address range class.
A section + offset based address class.
Definition Address.h:62
A class that describes a single lexical block.
Definition Block.h:41
Represent a call made within a Function.
Definition Function.h:268
AddrType caller_address_type
Definition Function.h:325
virtual Function * GetCallee(ModuleList &images, ExecutionContext &exe_ctx)=0
Get the callee's definition.
bool IsTailCall() const
Definition Function.h:294
std::pair< bool, lldb::addr_t > GetSortKey() const
Non-tail-calls go first, sorted by the return address.
Definition Function.h:303
std::pair< AddrType, lldb::addr_t > GetCallerAddress(Function &caller, Target &target) const
Return an address in the caller.
Definition Function.h:288
CallSiteParameterArray parameters
Definition Function.h:328
llvm::ArrayRef< CallSiteParameter > GetCallSiteParameters() const
Get the call site parameters available at this call edge.
Definition Function.h:297
lldb::addr_t GetReturnPCAddress(Function &caller, Target &target) const
Get the load PC address of the instruction which executes after the call returns.
Definition Function.cpp:155
lldb::addr_t caller_address
Definition Function.h:324
static lldb::addr_t GetLoadAddress(lldb::addr_t unresolved_pc, Function &caller, Target &target)
Helper that finds the load address of unresolved_pc, a file address which refers to an instruction wi...
Definition Function.cpp:132
CallEdge(AddrType caller_address_type, lldb::addr_t caller_address, bool is_tail_call, CallSiteParameterArray &&parameters)
Definition Function.cpp:127
lldb::addr_t GetUnresolvedReturnPCAddress() const
Like GetReturnPCAddress, but returns an unresolved file address.
Definition Function.h:317
A class that describes a compilation unit.
Definition CompileUnit.h:43
Represents a generic declaration context in a program.
Generic representation of a type in a programming language.
A uniqued constant string class.
Definition ConstString.h:40
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
A class that describes the declaration location of a lldb object.
Definition Declaration.h:24
union lldb_private::DirectCallEdge::@365073217334004215133022257144172244077326052052 lazy_callee
Function * GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override
Get the callee's definition.
Definition Function.cpp:204
bool resolved
Whether or not an attempt was made to find the callee's definition.
Definition Function.h:357
void ParseSymbolFileAndResolve(ModuleList &images)
Definition Function.cpp:160
DirectCallEdge(const char *symbol_name, AddrType caller_address_type, lldb::addr_t caller_address, bool is_tail_call, CallSiteParameterArray &&parameters)
Construct a call edge using a symbol name to identify the callee, and a return PC within the calling ...
Definition Function.cpp:195
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A class to manage flags.
Definition Flags.h:22
Declaration & GetDeclaration()
Get accessor for the declaration information.
Definition Function.cpp:53
void Dump(Stream *s, bool show_fullpaths) const
Dump a description of this object to a Stream.
Definition Function.cpp:39
virtual ~FunctionInfo()
Destructor.
ConstString GetName() const
Get accessor for the method name.
Definition Function.cpp:59
FunctionInfo(const char *name, const Declaration *decl_ptr)
Construct with the function method name and optional declaration information.
Definition Function.cpp:31
ConstString m_name
Function method name (not a mangled name).
Definition Function.h:118
virtual size_t MemorySize() const
Get the memory cost of this object.
Definition Function.cpp:61
static int Compare(const FunctionInfo &lhs, const FunctionInfo &rhs)
Compare two function information objects.
Definition Function.cpp:45
Declaration m_declaration
Information describing where this function information was defined.
Definition Function.h:121
A class that describes a function.
Definition Function.h:400
llvm::Expected< std::pair< lldb::SupportFileSP, SourceRange > > GetSourceInfo()
Find the file and line number range of the function.
Definition Function.cpp:304
std::vector< std::unique_ptr< CallEdge > > m_call_edges
Outgoing call edges.
Definition Function.h:678
uint32_t m_prologue_byte_size
Compute the prologue size once and cache it.
Definition Function.h:668
bool GetIsOptimized()
Get whether compiler optimizations were enabled for this function.
Definition Function.cpp:512
lldb::user_id_t m_type_uid
The user ID of for the prototype Type for this function.
Definition Function.h:645
Function(const Function &)=delete
const Address & GetAddress() const
Return the address of the function (its entry point).
Definition Function.h:453
void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target)
Definition Function.cpp:401
void GetStartLineSourceInfo(lldb::SupportFileSP &source_file_sp, uint32_t &line_no)
Find the file and line number of the source location of the start of the function.
Definition Function.cpp:275
const Function & operator=(const Function &)=delete
CompilerType GetCompilerType()
Definition Function.cpp:571
bool GetRangeContainingLoadAddress(lldb::addr_t load_addr, Target &target, AddressRange &range)
Definition Function.h:455
DWARFExpressionList & GetFrameBaseExpression()
Get accessor for the frame base location.
Definition Function.h:520
bool IsTopLevelFunction()
Get whether this function represents a 'top-level' function.
Definition Function.cpp:523
lldb::ModuleSP CalculateSymbolContextModule() override
Definition Function.cpp:455
CompileUnit * m_comp_unit
The compile unit that owns this function.
Definition Function.h:642
ConstString GetName() const
Definition Function.cpp:708
const Mangled & GetMangled() const
Definition Function.h:534
CallEdge * GetCallEdgeForReturnAddress(lldb::addr_t return_pc, Target &target)
Get the outgoing call edge from this function which has the given return address return_pc,...
Definition Function.cpp:367
llvm::ArrayRef< std::unique_ptr< CallEdge > > GetCallEdges()
Get the outgoing call edges from this function, sorted by their return PC addresses (in increasing or...
Definition Function.cpp:330
void Dump(Stream *s, bool show_context) const
Dump a description of this object to a Stream.
Definition Function.cpp:432
Block m_block
All lexical blocks contained in this function.
Definition Function.h:656
@ flagsCalculatedPrologueSize
Whether we already tried to calculate the prologue size.
Definition Function.h:638
DWARFExpressionList m_frame_base
The frame base expression for variables that are relative to the frame pointer.
Definition Function.h:663
Type * m_type
The function prototype type for this function that includes the function info (FunctionInfo),...
Definition Function.h:649
void CalculateSymbolContext(SymbolContext *sc) override
Reconstruct the object's symbol context into sc.
Definition Function.cpp:450
Address m_address
The address (entry point) of the function.
Definition Function.h:659
void DumpSymbolContext(Stream *s) override
Dump the object's symbol context to the stream s.
Definition Function.cpp:502
llvm::ArrayRef< std::unique_ptr< CallEdge > > GetTailCallingEdges()
Get the outgoing tail-calling edges from this function.
Definition Function.cpp:360
bool GetDisassembly(const ExecutionContext &exe_ctx, const char *flavor, Stream &strm, bool force_live_memory=false)
Definition Function.cpp:480
Type * GetType()
Get accessor for the type that describes the function return value type, and parameter types.
Definition Function.cpp:550
std::mutex m_call_edges_lock
Exclusive lock that controls read/write access to m_call_edges and m_call_edges_resolved.
Definition Function.h:672
lldb::LanguageType GetLanguage() const
Definition Function.cpp:697
Function(CompileUnit *comp_unit, lldb::user_id_t func_uid, lldb::user_id_t func_type_uid, const Mangled &mangled, Type *func_type, Address address, AddressRanges ranges)
Construct with a compile unit, function UID, function type UID, optional mangled name,...
Definition Function.cpp:258
uint32_t GetPrologueByteSize()
Get the size of the prologue instructions for this function.
Definition Function.cpp:578
CompilerDeclContext GetDeclContext()
Get the DeclContext for this function, if available.
Definition Function.cpp:536
AddressRanges GetAddressRanges()
Definition Function.h:448
CompileUnit * CalculateSymbolContextCompileUnit() override
Definition Function.cpp:462
CompileUnit * GetCompileUnit()
Get accessor for the compile unit that owns this function.
Definition Function.cpp:397
~Function() override
Destructor.
bool m_call_edges_resolved
Whether call site info has been parsed.
Definition Function.h:675
ConstString GetDisplayName() const
Definition Function.cpp:532
ConstString GetNameNoArguments() const
Definition Function.cpp:712
lldb::DisassemblerSP GetInstructions(const ExecutionContext &exe_ctx, const char *flavor, bool force_live_memory=false)
Definition Function.cpp:468
Function * CalculateSymbolContextFunction() override
Definition Function.cpp:466
const DWARFExpressionList & GetFrameBaseExpression() const
Get const accessor for the frame base location.
Definition Function.h:526
std::vector< CompilerContext > GetCompilerContext()
Get the CompilerContext for this function, if available.
Definition Function.cpp:543
Range< uint32_t, uint32_t > SourceRange
Definition Function.h:475
size_t MemorySize() const
Get the memory cost of this object.
Definition Function.cpp:507
Mangled m_mangled
The mangled function name if any.
Definition Function.h:653
Block & GetBlock(bool can_create)
Get accessor for the block list.
Definition Function.cpp:382
Function * GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override
Get the callee's definition.
Definition Function.cpp:219
IndirectCallEdge(DWARFExpressionList call_target, AddrType caller_address_type, lldb::addr_t caller_address, bool is_tail_call, CallSiteParameterArray &&parameters)
Construct a call edge using a DWARFExpression to identify the callee, and a return PC within the call...
Definition Function.cpp:210
DWARFExpressionList call_target
Definition Function.h:377
size_t MemorySize() const override
Get the memory cost of this object.
Definition Function.cpp:118
void DumpStopContext(Stream *s) const
Definition Function.cpp:87
ConstString GetDisplayName() const
Definition Function.cpp:102
Declaration & GetCallSite()
Get accessor for the call site declaration information.
Definition Function.cpp:108
ConstString GetName() const
Definition Function.cpp:96
~InlineFunctionInfo() override
Destructor.
Mangled m_mangled
Mangled inlined function name (can be empty if there is no mangled information).
Definition Function.h:245
int Compare(const InlineFunctionInfo &lhs, const InlineFunctionInfo &rhs)
Compare two inlined function information objects.
InlineFunctionInfo(const char *name, llvm::StringRef mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr)
Construct with the function method name, mangled name, and optional declaration information.
Definition Function.cpp:65
void Dump(Stream *s, bool show_fullpaths) const
Dump a description of this object to a Stream.
Definition Function.cpp:81
Mangled & GetMangled()
Get accessor for the mangled name object.
Definition Function.cpp:114
A class that handles mangled names.
Definition Mangled.h:34
A collection class for Module objects.
Definition ModuleList.h:104
A stream class that can stream formatted output to a file.
Definition Stream.h:28
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
Defines a symbol context baton that can be handed other debug core functions.
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
llvm::SmallVector< CallSiteParameter, 0 > CallSiteParameterArray
A vector of CallSiteParameter.
Definition Function.h:262
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
std::shared_ptr< lldb_private::SupportFile > SupportFileSP
LanguageType
Programming language type.
std::shared_ptr< lldb_private::Disassembler > DisassemblerSP
uint64_t user_id_t
Definition lldb-types.h:82
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::Module > ModuleSP
Represent the locations of a parameter at a call site, both in the caller and in the callee.
Definition Function.h:256
DWARFExpressionList LocationInCaller
Definition Function.h:258
DWARFExpressionList LocationInCallee
Definition Function.h:257
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
Definition UserID.h:33