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.
338 DirectCallEdge(const char *symbol_name, AddrType caller_address_type,
341
342 Function *GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override;
343
344private:
346
347 const char *m_symbol_name;
348 std::once_flag m_resolved_flag;
350};
351
352/// An indirect call site. Used to represent call sites where the address of
353/// the callee is not fixed, e.g. a call to a C++ virtual function (where the
354/// address is loaded out of a vtable), or a call to a function pointer in C.
356public:
357 /// Construct a call edge using a DWARFExpression to identify the callee, and
358 /// a return PC within the calling function to identify a specific call site.
362
363 Function *GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override;
364
365private:
366 // Used to describe an indirect call.
367 //
368 // Specifies the location of the callee address in the calling frame.
370};
371
372/// \class Function Function.h "lldb/Symbol/Function.h"
373/// A class that describes a function.
374///
375/// Functions belong to CompileUnit objects (Function::m_comp_unit), have
376/// unique user IDs (Function::UserID), know how to reconstruct their symbol
377/// context (Function::SymbolContextScope), have a specific function type
378/// (Function::m_type_uid), have a simple method name (FunctionInfo::m_name),
379/// be declared at a specific location (FunctionInfo::m_declaration), possibly
380/// have mangled names (Function::m_mangled), an optional return type
381/// (Function::m_type), and contains lexical blocks (Function::m_blocks).
382///
383/// The function information is split into a few pieces:
384/// \li The concrete instance information
385/// \li The abstract information
386///
387/// The abstract information is found in the function type (Type) that
388/// describes a function information, return type and parameter types.
389///
390/// The concrete information is the address range information and specific
391/// locations for an instance of this function.
392class Function : public UserID, public SymbolContextScope {
393public:
394 /// Construct with a compile unit, function UID, function type UID, optional
395 /// mangled name, function type, and a section offset based address range.
396 ///
397 /// \param[in] comp_unit
398 /// The compile unit to which this function belongs.
399 ///
400 /// \param[in] func_uid
401 /// The UID for this function. This value is provided by the
402 /// SymbolFile plug-in and can be any value that allows
403 /// the plug-in to quickly find and parse more detailed
404 /// information when and if more information is needed.
405 ///
406 /// \param[in] func_type_uid
407 /// The type UID for the function Type to allow for lazy type
408 /// parsing from the debug information.
409 ///
410 /// \param[in] mangled
411 /// The optional mangled name for this function. If empty, there
412 /// is no mangled information.
413 ///
414 /// \param[in] func_type
415 /// The optional function type. If NULL, the function type will
416 /// be parsed on demand when accessed using the
417 /// Function::GetType() function by asking the SymbolFile
418 /// plug-in to get the type for \a func_type_uid.
419 ///
420 /// \param[in] range
421 /// The section offset based address for this function.
422 Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
423 lldb::user_id_t func_type_uid, const Mangled &mangled,
424 Type *func_type, Address address, AddressRanges ranges);
425
426 /// Destructor.
427 ~Function() override;
428
429 /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
430 ///
431 /// \see SymbolContextScope
432 void CalculateSymbolContext(SymbolContext *sc) override;
433
435
437
439
440 AddressRanges GetAddressRanges() { return m_block.GetRanges(); }
441
442 /// Return the address of the function (its entry point). This address is also
443 /// used as a base address for relocation of function-scope entities (blocks
444 /// and variables).
445 const Address &GetAddress() const { return m_address; }
446
448 AddressRange &range) {
449 return m_block.GetRangeContainingLoadAddress(load_addr, target, range);
450 }
451
453
454 /// Find the file and line number of the source location of the start of the
455 /// function. This will use the declaration if present and fall back on the
456 /// line table if that fails. So there may NOT be a line table entry for
457 /// this source file/line combo.
458 ///
459 /// \param[out] source_file
460 /// The source file.
461 ///
462 /// \param[out] line_no
463 /// The line number.
464 void GetStartLineSourceInfo(SupportFileNSP &source_file_sp,
465 uint32_t &line_no);
466
468 /// Find the file and line number range of the function.
469 llvm::Expected<std::pair<SupportFileNSP, SourceRange>> GetSourceInfo();
470
471 /// Get the outgoing call edges from this function, sorted by their return
472 /// PC addresses (in increasing order).
473 llvm::ArrayRef<std::unique_ptr<CallEdge>> GetCallEdges();
474
475 /// Get the outgoing tail-calling edges from this function. If none exist,
476 /// return std::nullopt.
477 llvm::ArrayRef<std::unique_ptr<CallEdge>> GetTailCallingEdges();
478
479 /// Get the outgoing call edge from this function which has the given return
480 /// address \p return_pc, or return nullptr. Note that this will not return a
481 /// tail-calling edge.
483
484 /// Get accessor for the block list.
485 ///
486 /// \return
487 /// The block list object that describes all lexical blocks
488 /// in the function.
489 ///
490 /// \see BlockList
491 Block &GetBlock(bool can_create);
492
493 /// Get accessor for the compile unit that owns this function.
494 ///
495 /// \return
496 /// A compile unit object pointer.
498
499 /// Get const accessor for the compile unit that owns this function.
500 ///
501 /// \return
502 /// A const compile unit object pointer.
503 const CompileUnit *GetCompileUnit() const;
504
505 void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target);
506
507 /// Get accessor for the frame base location.
508 ///
509 /// \return
510 /// A location expression that describes the function frame
511 /// base.
513
514 /// Get const accessor for the frame base location.
515 ///
516 /// \return
517 /// A const compile unit object pointer.
519
520 ConstString GetName() const;
521
523
525
526 const Mangled &GetMangled() const { return m_mangled; }
527
528 /// Get the DeclContext for this function, if available.
529 ///
530 /// \return
531 /// The DeclContext, or NULL if none exists.
533
534 /// Get the CompilerContext for this function, if available.
535 ///
536 /// \return
537 /// The CompilerContext, or an empty vector if none is available.
538 std::vector<CompilerContext> GetCompilerContext();
539
540 /// Get accessor for the type that describes the function return value type,
541 /// and parameter types.
542 ///
543 /// \return
544 /// A type object pointer.
545 Type *GetType();
546
547 /// Get const accessor for the type that describes the function return value
548 /// type, and parameter types.
549 ///
550 /// \return
551 /// A const type object pointer.
552 const Type *GetType() const;
553
555
556 /// Get the size of the prologue instructions for this function. The
557 /// "prologue" instructions include any instructions given line number 0
558 /// immediately following the prologue end.
559 ///
560 /// \return
561 /// The size of the prologue.
562 uint32_t GetPrologueByteSize();
563
564 /// Dump a description of this object to a Stream.
565 ///
566 /// Dump a description of the contents of this object to the supplied stream
567 /// \a s.
568 ///
569 /// \param[in] s
570 /// The stream to which to dump the object description.
571 ///
572 /// \param[in] show_context
573 /// If \b true, variables will dump their symbol context
574 /// information.
575 void Dump(Stream *s, bool show_context) const;
576
577 /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
578 ///
579 /// \see SymbolContextScope
580 void DumpSymbolContext(Stream *s) override;
581
582 /// Get the memory cost of this object.
583 ///
584 /// \return
585 /// The number of bytes that this object occupies in memory.
586 /// The returned value does not include the bytes for any
587 /// shared string values.
588 size_t MemorySize() const;
589
590 /// Get whether compiler optimizations were enabled for this function
591 ///
592 /// The debug information may provide information about whether this
593 /// function was compiled with optimization or not. In this case,
594 /// "optimized" means that the debug experience may be difficult for the
595 /// user to understand. Variables may not be available when the developer
596 /// would expect them, stepping through the source lines in the function may
597 /// appear strange, etc.
598 ///
599 /// \return
600 /// Returns 'true' if this function was compiled with
601 /// optimization. 'false' indicates that either the optimization
602 /// is unknown, or this function was built without optimization.
603 bool GetIsOptimized();
604
605 /// Get whether this function represents a 'top-level' function
606 ///
607 /// The concept of a top-level function is language-specific, mostly meant
608 /// to represent the notion of scripting-style code that has global
609 /// visibility of the variables/symbols/functions/... defined within the
610 /// containing file/module
611 ///
612 /// If stopped in a top-level function, LLDB will expose global variables
613 /// as-if locals in the 'frame variable' command
614 ///
615 /// \return
616 /// Returns 'true' if this function is a top-level function,
617 /// 'false' otherwise.
618 bool IsTopLevelFunction();
619
621 const char *flavor,
622 bool force_live_memory = false);
623
624 bool GetDisassembly(const ExecutionContext &exe_ctx, const char *flavor,
625 Stream &strm, bool force_live_memory = false);
626
627protected:
628 enum {
629 /// Whether we already tried to calculate the prologue size.
631 };
632
633 /// The compile unit that owns this function.
635
636 /// The user ID of for the prototype Type for this function.
638
639 /// The function prototype type for this function that includes the function
640 /// info (FunctionInfo), return type and parameters.
642
643 /// The mangled function name if any. If empty, there is no mangled
644 /// information.
646
647 /// All lexical blocks contained in this function.
649
650 /// The address (entry point) of the function.
652
653 /// The frame base expression for variables that are relative to the frame
654 /// pointer.
656
658
659 /// Compute the prologue size once and cache it.
661
662 /// Exclusive lock that controls read/write access to m_call_edges and
663 /// m_call_edges_resolved.
665
666 /// Whether call site info has been parsed.
668
669 /// Outgoing call edges.
670 std::vector<std::unique_ptr<CallEdge>> m_call_edges;
671
672private:
673 Function(const Function &) = delete;
674 const Function &operator=(const Function &) = delete;
675};
676
677} // namespace lldb_private
678
679#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:156
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:133
CallEdge(AddrType caller_address_type, lldb::addr_t caller_address, bool is_tail_call, CallSiteParameterArray &&parameters)
Definition Function.cpp:128
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
Function * GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override
Get the callee's definition.
Definition Function.cpp:202
std::once_flag m_resolved_flag
Definition Function.h:348
Function * ResolveCallee(ModuleList &images)
Definition Function.cpp:161
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:194
"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:54
void Dump(Stream *s, bool show_fullpaths) const
Dump a description of this object to a Stream.
Definition Function.cpp:40
virtual ~FunctionInfo()
Destructor.
ConstString GetName() const
Get accessor for the method name.
Definition Function.cpp:60
FunctionInfo(const char *name, const Declaration *decl_ptr)
Construct with the function method name and optional declaration information.
Definition Function.cpp:32
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:62
static int Compare(const FunctionInfo &lhs, const FunctionInfo &rhs)
Compare two function information objects.
Definition Function.cpp:46
Declaration m_declaration
Information describing where this function information was defined.
Definition Function.h:121
A class that describes a function.
Definition Function.h:392
std::vector< std::unique_ptr< CallEdge > > m_call_edges
Outgoing call edges.
Definition Function.h:670
uint32_t m_prologue_byte_size
Compute the prologue size once and cache it.
Definition Function.h:660
bool GetIsOptimized()
Get whether compiler optimizations were enabled for this function.
Definition Function.cpp:517
lldb::user_id_t m_type_uid
The user ID of for the prototype Type for this function.
Definition Function.h:637
Function(const Function &)=delete
const Address & GetAddress() const
Return the address of the function (its entry point).
Definition Function.h:445
void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target)
Definition Function.cpp:406
const Function & operator=(const Function &)=delete
CompilerType GetCompilerType()
Definition Function.cpp:576
bool GetRangeContainingLoadAddress(lldb::addr_t load_addr, Target &target, AddressRange &range)
Definition Function.h:447
DWARFExpressionList & GetFrameBaseExpression()
Get accessor for the frame base location.
Definition Function.h:512
bool IsTopLevelFunction()
Get whether this function represents a 'top-level' function.
Definition Function.cpp:528
lldb::ModuleSP CalculateSymbolContextModule() override
Definition Function.cpp:460
CompileUnit * m_comp_unit
The compile unit that owns this function.
Definition Function.h:634
ConstString GetName() const
Definition Function.cpp:713
const Mangled & GetMangled() const
Definition Function.h:526
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:372
void GetStartLineSourceInfo(SupportFileNSP &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:280
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:335
void Dump(Stream *s, bool show_context) const
Dump a description of this object to a Stream.
Definition Function.cpp:437
@ flagsCalculatedPrologueSize
Whether we already tried to calculate the prologue size.
Definition Function.h:630
Block m_block
All lexical blocks contained in this function.
Definition Function.h:648
DWARFExpressionList m_frame_base
The frame base expression for variables that are relative to the frame pointer.
Definition Function.h:655
Type * m_type
The function prototype type for this function that includes the function info (FunctionInfo),...
Definition Function.h:641
void CalculateSymbolContext(SymbolContext *sc) override
Reconstruct the object's symbol context into sc.
Definition Function.cpp:455
Address m_address
The address (entry point) of the function.
Definition Function.h:651
void DumpSymbolContext(Stream *s) override
Dump the object's symbol context to the stream s.
Definition Function.cpp:507
llvm::ArrayRef< std::unique_ptr< CallEdge > > GetTailCallingEdges()
Get the outgoing tail-calling edges from this function.
Definition Function.cpp:365
bool GetDisassembly(const ExecutionContext &exe_ctx, const char *flavor, Stream &strm, bool force_live_memory=false)
Definition Function.cpp:485
Type * GetType()
Get accessor for the type that describes the function return value type, and parameter types.
Definition Function.cpp:555
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:664
lldb::LanguageType GetLanguage() const
Definition Function.cpp:702
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:263
uint32_t GetPrologueByteSize()
Get the size of the prologue instructions for this function.
Definition Function.cpp:583
CompilerDeclContext GetDeclContext()
Get the DeclContext for this function, if available.
Definition Function.cpp:541
AddressRanges GetAddressRanges()
Definition Function.h:440
CompileUnit * CalculateSymbolContextCompileUnit() override
Definition Function.cpp:467
llvm::Expected< std::pair< SupportFileNSP, SourceRange > > GetSourceInfo()
Find the file and line number range of the function.
Definition Function.cpp:309
CompileUnit * GetCompileUnit()
Get accessor for the compile unit that owns this function.
Definition Function.cpp:402
~Function() override
Destructor.
bool m_call_edges_resolved
Whether call site info has been parsed.
Definition Function.h:667
ConstString GetDisplayName() const
Definition Function.cpp:537
ConstString GetNameNoArguments() const
Definition Function.cpp:717
lldb::DisassemblerSP GetInstructions(const ExecutionContext &exe_ctx, const char *flavor, bool force_live_memory=false)
Definition Function.cpp:473
Function * CalculateSymbolContextFunction() override
Definition Function.cpp:471
const DWARFExpressionList & GetFrameBaseExpression() const
Get const accessor for the frame base location.
Definition Function.h:518
std::vector< CompilerContext > GetCompilerContext()
Get the CompilerContext for this function, if available.
Definition Function.cpp:548
Range< uint32_t, uint32_t > SourceRange
Definition Function.h:467
size_t MemorySize() const
Get the memory cost of this object.
Definition Function.cpp:512
Mangled m_mangled
The mangled function name if any.
Definition Function.h:645
Block & GetBlock(bool can_create)
Get accessor for the block list.
Definition Function.cpp:387
Function * GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override
Get the callee's definition.
Definition Function.cpp:217
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:208
DWARFExpressionList call_target
Definition Function.h:369
size_t MemorySize() const override
Get the memory cost of this object.
Definition Function.cpp:119
void DumpStopContext(Stream *s) const
Definition Function.cpp:88
ConstString GetDisplayName() const
Definition Function.cpp:103
Declaration & GetCallSite()
Get accessor for the call site declaration information.
Definition Function.cpp:109
ConstString GetName() const
Definition Function.cpp:97
~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:66
void Dump(Stream *s, bool show_fullpaths) const
Dump a description of this object to a Stream.
Definition Function.cpp:82
Mangled & GetMangled()
Get accessor for the mangled name object.
Definition Function.cpp:115
A class that handles mangled names.
Definition Mangled.h:34
A collection class for Module objects.
Definition ModuleList.h:125
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.
NonNullSharedPtr< lldb_private::SupportFile > SupportFileNSP
Definition SupportFile.h:80
llvm::SmallVector< CallSiteParameter, 0 > CallSiteParameterArray
A vector of CallSiteParameter.
Definition Function.h:262
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
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