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