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