Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
ef4bb4e3
Unverified
Commit
ef4bb4e3
authored
Jun 27, 2023
by
michalbiesek
Committed by
GitHub
Jun 27, 2023
Browse files
Add RISC-V debug support (#12349)
- Add support for `getAndSetMcontextEip` - Add support for `logRegisters`
parent
f58fd9e6
Changes
1
Show whitespace changes
Inline
Side-by-side
src/debug.c
View file @
ef4bb4e3
...
...
@@ -1218,6 +1218,8 @@ static void* getAndSetMcontextEip(ucontext_t *uc, void *eip) {
GET_SET_RETURN
(
uc
->
uc_mcontext
.
gregs
[
16
],
eip
);
#elif defined(__ia64__)
/* Linux IA64 */
GET_SET_RETURN
(
uc
->
uc_mcontext
.
sc_ip
,
eip
);
#elif defined(__riscv)
/* Linux RISC-V */
GET_SET_RETURN
(
uc
->
uc_mcontext
.
__gregs
[
REG_PC
],
eip
);
#elif defined(__arm__)
/* Linux ARM */
GET_SET_RETURN
(
uc
->
uc_mcontext
.
arm_pc
,
eip
);
#elif defined(__aarch64__)
/* Linux AArch64 */
...
...
@@ -1452,6 +1454,49 @@ void logRegisters(ucontext_t *uc) {
(
unsigned
long
)
uc
->
uc_mcontext
.
gregs
[
18
]
);
logStackContent
((
void
**
)
uc
->
uc_mcontext
.
gregs
[
15
]);
#elif defined(__riscv)
/* Linux RISC-V */
serverLog
(
LL_WARNING
,
"
\n
"
"ra:%016lx gp:%016lx
\n
tp:%016lx t0:%016lx
\n
"
"t1:%016lx t2:%016lx
\n
s0:%016lx s1:%016lx
\n
"
"a0:%016lx a1:%016lx
\n
a2:%016lx a3:%016lx
\n
"
"a4:%016lx a5:%016lx
\n
a6:%016lx a7:%016lx
\n
"
"s2:%016lx s3:%016lx
\n
s4:%016lx s5:%016lx
\n
"
"s6:%016lx s7:%016lx
\n
s8:%016lx s9:%016lx
\n
"
"s10:%016lx s11:%016lx
\n
t3:%016lx t4:%016lx
\n
"
"t5:%016lx t6:%016lx
\n
"
,
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
1
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
3
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
4
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
5
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
6
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
7
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
8
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
9
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
10
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
11
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
12
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
13
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
14
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
15
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
16
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
17
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
18
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
19
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
20
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
21
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
22
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
23
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
24
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
25
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
26
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
27
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
28
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
29
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
30
],
(
unsigned
long
)
uc
->
uc_mcontext
.
__gregs
[
31
]
);
logStackContent
((
void
**
)
uc
->
uc_mcontext
.
__gregs
[
REG_SP
]);
#elif defined(__aarch64__)
/* Linux AArch64 */
serverLog
(
LL_WARNING
,
"
\n
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment