LLDB
mainline
llvm-project
lldb
include
lldb
Expression
ExternalSymbolResolver.h
Go to the documentation of this file.
1
//===-- ExternalSymbolResolver.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_EXPRESSION_EXTERNALSYMBOLRESOLVER_H
10
#define LLDB_EXPRESSION_EXTERNALSYMBOLRESOLVER_H
11
12
#include <vector>
13
14
#include "
lldb/Core/ModuleList.h
"
15
#include "
lldb/Symbol/SymbolContext.h
"
16
#include "
lldb/Utility/ConstString.h
"
17
#include "
lldb/lldb-types.h
"
18
19
namespace
lldb_private
{
20
21
/// \class ExternalSymbolResolver ExternalSymbolResolver.h
22
/// "lldb/Expression/ExternalSymbolResolver.h" Finds the load addresses of
23
/// symbols that an expression refers to but does not define.
24
///
25
/// An expression's IR refers by name to functions and variables that live
26
/// outside the expression's own module. Finding the address for such a name is
27
/// not a simple lookup: the name may be an LLDB function call label, it may
28
/// need alternate manglings tried, and it may be satisfied by the target's
29
/// images, by a language runtime, or by a symbol that a previous expression
30
/// defined (see Target::GetPersistentSymbol).
31
class
ExternalSymbolResolver
{
32
public
:
33
/// Constructor
34
///
35
/// \param[in] sym_ctx
36
/// The symbol context to search from. Its module, if any, is searched
37
/// before all others.
38
///
39
/// \param[in] strip_underscore
40
/// True for platforms where global symbols have a _ prefix, in which case
41
/// the name with that prefix removed is also tried.
42
ExternalSymbolResolver
(
const
SymbolContext
&sym_ctx,
bool
strip_underscore);
43
44
/// Search the modules of \p contexts before any others, except for the
45
/// module of the symbol context this resolver was constructed with.
46
void
AppendPreferredSymbolContexts
(
SymbolContextList
const
&contexts) {
47
for
(
auto
const
&ctx : contexts)
48
if
(ctx.module_sp)
49
m_preferred_modules
.Append(ctx.module_sp);
50
}
51
52
/// Find the load address of \p name.
53
///
54
/// \param[out] missing_weak
55
/// Set to true if \p name was only found as a weak undefined symbol, in
56
/// which case the returned address is 0.
57
///
58
/// \return
59
/// The load address, or LLDB_INVALID_ADDRESS if \p name was not found.
60
lldb::addr_t
FindSymbol
(
ConstString
name,
bool
&missing_weak);
61
62
private
:
63
void
CollectCandidateCNames
(std::vector<ConstString> &C_names,
64
ConstString
name);
65
66
void
CollectCandidateCPlusPlusNames
(std::vector<ConstString> &CPP_names,
67
const
std::vector<ConstString> &C_names,
68
const
SymbolContext
&sc);
69
70
lldb::addr_t
FindInSymbols
(
const
std::vector<ConstString> &names,
71
const
lldb_private::SymbolContext
&sc,
72
bool
&symbol_was_missing_weak);
73
74
lldb::addr_t
FindInRuntimes
(
const
std::vector<ConstString> &names,
75
const
lldb_private::SymbolContext
&sc);
76
77
lldb::addr_t
FindInUserDefinedSymbols
(
const
std::vector<ConstString> &names,
78
const
lldb_private::SymbolContext
&sc);
79
80
SymbolContext
m_sym_ctx
;
///< Used for symbol lookups
81
82
bool
m_strip_underscore
;
///< True for platforms where global symbols have a
83
/// _ prefix
84
85
/// Any Module in this list will be used for symbol/function lookup before
86
/// any other module (except for the module corresponding to the current
87
/// frame).
88
ModuleList
m_preferred_modules
;
89
};
90
91
}
// namespace lldb_private
92
93
#endif
// LLDB_EXPRESSION_EXTERNALSYMBOLRESOLVER_H
ConstString.h
ModuleList.h
SymbolContext.h
lldb_private::ConstString
A uniqued constant string class.
Definition
ConstString.h:40
lldb_private::ExternalSymbolResolver::ExternalSymbolResolver
ExternalSymbolResolver(const SymbolContext &sym_ctx, bool strip_underscore)
Constructor.
Definition
ExternalSymbolResolver.cpp:28
lldb_private::ExternalSymbolResolver::m_sym_ctx
SymbolContext m_sym_ctx
Used for symbol lookups.
Definition
ExternalSymbolResolver.h:80
lldb_private::ExternalSymbolResolver::FindSymbol
lldb::addr_t FindSymbol(ConstString name, bool &missing_weak)
Find the load address of name.
Definition
ExternalSymbolResolver.cpp:321
lldb_private::ExternalSymbolResolver::FindInSymbols
lldb::addr_t FindInSymbols(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc, bool &symbol_was_missing_weak)
Definition
ExternalSymbolResolver.cpp:181
lldb_private::ExternalSymbolResolver::FindInUserDefinedSymbols
lldb::addr_t FindInUserDefinedSymbols(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc)
Definition
ExternalSymbolResolver.cpp:306
lldb_private::ExternalSymbolResolver::FindInRuntimes
lldb::addr_t FindInRuntimes(const std::vector< ConstString > &names, const lldb_private::SymbolContext &sc)
Definition
ExternalSymbolResolver.cpp:280
lldb_private::ExternalSymbolResolver::AppendPreferredSymbolContexts
void AppendPreferredSymbolContexts(SymbolContextList const &contexts)
Search the modules of contexts before any others, except for the module of the symbol context this re...
Definition
ExternalSymbolResolver.h:46
lldb_private::ExternalSymbolResolver::m_preferred_modules
ModuleList m_preferred_modules
Any Module in this list will be used for symbol/function lookup before any other module (except for t...
Definition
ExternalSymbolResolver.h:88
lldb_private::ExternalSymbolResolver::CollectCandidateCPlusPlusNames
void CollectCandidateCPlusPlusNames(std::vector< ConstString > &CPP_names, const std::vector< ConstString > &C_names, const SymbolContext &sc)
Definition
ExternalSymbolResolver.cpp:40
lldb_private::ExternalSymbolResolver::m_strip_underscore
bool m_strip_underscore
True for platforms where global symbols have a _ prefix.
Definition
ExternalSymbolResolver.h:82
lldb_private::ExternalSymbolResolver::CollectCandidateCNames
void CollectCandidateCNames(std::vector< ConstString > &C_names, ConstString name)
Definition
ExternalSymbolResolver.cpp:33
lldb_private::ModuleList
A collection class for Module objects.
Definition
ModuleList.h:127
lldb_private::SymbolContextList
Defines a list of symbol context objects.
Definition
SymbolContext.h:396
lldb_private::SymbolContext
Defines a symbol context baton that can be handed other debug core functions.
Definition
SymbolContext.h:37
lldb-types.h
lldb_private
A class that represents a running process on the host machine.
Definition
SBAddressRange.h:14
lldb::addr_t
uint64_t addr_t
Definition
lldb-types.h:80
Generated on
for LLDB by
1.14.0