Skip to content

Commit 8cd95a3

Browse files
committedAug 25, 2014
Add a little documentation for the register kinds
and the method to convert between them. llvm-svn: 216372
1 parent 7f33ff7 commit 8cd95a3

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed
 

Diff for: ‎lldb/include/lldb/Target/RegisterContext.h

+36-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,42 @@ class RegisterContext :
8686

8787
bool
8888
CopyFromRegisterContext (lldb::RegisterContextSP context);
89-
89+
90+
//------------------------------------------------------------------
91+
/// Convert from a given register numbering scheme to the lldb register
92+
/// numbering scheme
93+
///
94+
/// There may be multiple ways to enumerate the registers for a given
95+
/// architecture. ABI references will specify one to be used with
96+
/// DWARF, the register numberings from stabs (aka "gcc"), there may
97+
/// be a variation used for eh_frame unwind instructions (e.g. on Darwin),
98+
/// and so on. Register 5 by itself is meaningless - RegisterKind
99+
/// enumeration tells you what context that number should be translated as.
100+
///
101+
/// Inside lldb, register numbers are in the eRegisterKindLLDB scheme;
102+
/// arguments which take a register number should take one in that
103+
/// scheme.
104+
///
105+
/// eRegisterKindGeneric is a special numbering scheme which gives us
106+
/// constant values for the pc, frame register, stack register, etc., for
107+
/// use within lldb. They may not be defined for all architectures but
108+
/// it allows generic code to translate these common registers into the
109+
/// lldb numbering scheme.
110+
///
111+
/// This method translates a given register kind + register number into
112+
/// the eRegisterKindLLDB register numbering.
113+
///
114+
/// @param [in] kind
115+
/// The register numbering scheme (RegisterKind) that the following
116+
/// register number is in.
117+
///
118+
/// @param [in] num
119+
/// A register number in the 'kind' register numbering scheme.
120+
///
121+
/// @return
122+
/// The equivalent register number in the eRegisterKindLLDB
123+
/// numbering scheme, if possible, else LLDB_INVALID_REGNUM.
124+
//------------------------------------------------------------------
90125
virtual uint32_t
91126
ConvertRegisterKindToRegisterNumber (lldb::RegisterKind kind, uint32_t num) = 0;
92127

Diff for: ‎lldb/include/lldb/lldb-enumerations.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,16 @@ namespace lldb {
157157

158158
//----------------------------------------------------------------------
159159
// Register numbering types
160+
// See RegisterContext::ConvertRegisterKindToRegisterNumber to convert
161+
// any of these to the lldb internal register numbering scheme
162+
// (eRegisterKindLLDB).
160163
//----------------------------------------------------------------------
161164
typedef enum RegisterKind
162165
{
163166
eRegisterKindGCC = 0, // the register numbers seen in eh_frame
164167
eRegisterKindDWARF, // the register numbers seen DWARF
165168
eRegisterKindGeneric, // insn ptr reg, stack ptr reg, etc not specific to any particular target
166-
eRegisterKindGDB, // the register numbers gdb uses (matches stabs numbers?)
169+
eRegisterKindGDB, // the register numbers gdb uses (matches stabs numbers)
167170
eRegisterKindLLDB, // lldb's internal register numbers
168171
kNumRegisterKinds
169172
} RegisterKind;

0 commit comments

Comments
 (0)
Please sign in to comment.