LLDB
mainline
llvm-project
lldb
include
lldb
Target
StackID.h
Go to the documentation of this file.
1
//===-- StackID.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_TARGET_STACKID_H
10
#define LLDB_TARGET_STACKID_H
11
12
#include "
lldb/Core/AddressRange.h
"
13
14
namespace
lldb_private
{
15
16
class
Process
;
17
18
class
StackID
{
19
public
:
20
StackID
() =
default
;
21
22
explicit
StackID
(
lldb::addr_t
pc
,
lldb::addr_t
cfa,
23
SymbolContextScope
*symbol_scope,
Process
*process);
24
25
~StackID
() =
default
;
26
27
lldb::addr_t
GetPC
()
const
{
return
m_pc
; }
28
29
lldb::addr_t
GetCallFrameAddressWithMetadata
()
const
{
30
return
m_cfa_with_metadata
;
31
}
32
33
lldb::addr_t
GetCallFrameAddressWithoutMetadata
()
const
{
return
m_cfa
; }
34
35
SymbolContextScope
*
GetSymbolContextScope
()
const
{
return
m_symbol_scope
; }
36
37
void
SetSymbolContextScope
(
SymbolContextScope
*symbol_scope) {
38
m_symbol_scope
= symbol_scope;
39
}
40
41
void
Clear
() {
42
m_pc
=
LLDB_INVALID_ADDRESS
;
43
m_cfa
=
LLDB_INVALID_ADDRESS
;
44
m_symbol_scope
=
nullptr
;
45
}
46
47
bool
IsValid
()
const
{
48
return
m_pc
!=
LLDB_INVALID_ADDRESS
||
m_cfa
!=
LLDB_INVALID_ADDRESS
;
49
}
50
51
void
Dump
(
Stream
*s);
52
53
/// Returns true if this StackID corresponds to a frame younger (i.e. higher
54
/// on the call stack) than `other`, and false otherwise (including when the
55
/// frames are not comparable, in some cases where this can be detected).
56
bool
IsYoungerThan
(
const
StackID
&other)
const
;
57
58
protected
:
59
friend
class
StackFrame
;
60
friend
class
SyntheticStackFrameList
;
61
62
void
SetPC
(
lldb::addr_t
pc
,
Process
*process);
63
void
SetCFA
(
lldb::addr_t
cfa,
Process
*process);
64
65
/// The pc value for the function/symbol for this frame. This will only get
66
/// used if the symbol scope is nullptr (the code where we are stopped is not
67
/// represented by any function or symbol in any shared library).
68
lldb::addr_t
m_pc
=
LLDB_INVALID_ADDRESS
;
69
70
/// The call frame address (stack pointer) value at the beginning of the
71
/// function that uniquely identifies this frame (along with m_symbol_scope
72
/// below)
73
lldb::addr_t
m_cfa
=
LLDB_INVALID_ADDRESS
;
74
75
/// The cfa with metadata (i.e. prior to Process::FixAddress).
76
lldb::addr_t
m_cfa_with_metadata
=
LLDB_INVALID_ADDRESS
;
77
78
/// If nullptr, there is no block or symbol for this frame. If not nullptr,
79
/// this will either be the scope for the lexical block for the frame, or the
80
/// scope for the symbol. Symbol context scopes are always be unique pointers
81
/// since the are part of the Block and Symbol objects and can easily be used
82
/// to tell if a stack ID is the same as another.
83
SymbolContextScope
*
m_symbol_scope
=
nullptr
;
84
};
85
86
bool
operator==
(
const
StackID
&lhs,
const
StackID
&rhs);
87
bool
operator!=
(
const
StackID
&lhs,
const
StackID
&rhs);
88
}
// namespace lldb_private
89
90
#endif
// LLDB_TARGET_STACKID_H
AddressRange.h
pc
@ pc
Definition
CompactUnwindInfo.cpp:1240
lldb_private::Process
A plug-in interface definition class for debugging a process.
Definition
Process.h:359
lldb_private::StackID
Definition
StackID.h:18
lldb_private::StackID::Dump
void Dump(Stream *s)
Definition
StackID.cpp:37
lldb_private::StackID::m_cfa
lldb::addr_t m_cfa
The call frame address (stack pointer) value at the beginning of the function that uniquely identifie...
Definition
StackID.h:73
lldb_private::StackID::GetCallFrameAddressWithoutMetadata
lldb::addr_t GetCallFrameAddressWithoutMetadata() const
Definition
StackID.h:33
lldb_private::StackID::SetPC
void SetPC(lldb::addr_t pc, Process *process)
Definition
StackID.cpp:28
lldb_private::StackID::IsValid
bool IsValid() const
Definition
StackID.h:47
lldb_private::StackID::GetSymbolContextScope
SymbolContextScope * GetSymbolContextScope() const
Definition
StackID.h:35
lldb_private::StackID::Clear
void Clear()
Definition
StackID.h:41
lldb_private::StackID::~StackID
~StackID()=default
lldb_private::StackID::m_pc
lldb::addr_t m_pc
The pc value for the function/symbol for this frame.
Definition
StackID.h:68
lldb_private::StackID::SyntheticStackFrameList
friend class SyntheticStackFrameList
Definition
StackID.h:60
lldb_private::StackID::GetPC
lldb::addr_t GetPC() const
Definition
StackID.h:27
lldb_private::StackID::m_cfa_with_metadata
lldb::addr_t m_cfa_with_metadata
The cfa with metadata (i.e. prior to Process::FixAddress).
Definition
StackID.h:76
lldb_private::StackID::StackID
StackID()=default
lldb_private::StackID::IsYoungerThan
bool IsYoungerThan(const StackID &other) const
Returns true if this StackID corresponds to a frame younger (i.e.
Definition
StackID.cpp:72
lldb_private::StackID::StackFrame
friend class StackFrame
Definition
StackID.h:59
lldb_private::StackID::m_symbol_scope
SymbolContextScope * m_symbol_scope
If nullptr, there is no block or symbol for this frame.
Definition
StackID.h:83
lldb_private::StackID::SetSymbolContextScope
void SetSymbolContextScope(SymbolContextScope *symbol_scope)
Definition
StackID.h:37
lldb_private::StackID::GetCallFrameAddressWithMetadata
lldb::addr_t GetCallFrameAddressWithMetadata() const
Definition
StackID.h:29
lldb_private::StackID::SetCFA
void SetCFA(lldb::addr_t cfa, Process *process)
Definition
StackID.cpp:32
lldb_private::Stream
A stream class that can stream formatted output to a file.
Definition
Stream.h:28
lldb_private::SymbolContextScope
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
Definition
SymbolContextScope.h:64
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition
lldb-defines.h:82
lldb_private
A class that represents a running process on the host machine.
Definition
SBAddressRange.h:14
lldb_private::operator!=
bool operator!=(const Address &lhs, const Address &rhs)
Definition
Address.cpp:1010
lldb_private::operator==
bool operator==(const Address &lhs, const Address &rhs)
Definition
Address.cpp:1004
lldb::addr_t
uint64_t addr_t
Definition
lldb-types.h:80
Generated on
for LLDB by
1.14.0