Commit e0a51c4
authored
Fix sgx-gdb throw exceptions on every ocall in Rust-SGX (#489)
* Fix sgx-gdb throw exceptions on every ocall in Rust-SGX
In Rust-SGX environment, `sgx-gdb` always throws exception after ocall:
```
Python Exception <class 'gdb.error'> syntax error in expression, near `)0x7fffffffd840 = 0'.:
```
And the debugger stops immediately. At this time, the debugger is working in `Rust` mode instead of `C` mode:
```
gdb-peda$ set *(uintptr_t *)0x7fffffffd6d0 = 0
syntax error in expression, near `)0x7fffffffd6d0 = 0'.
gdb-peda$ set *(u32)0x7fffffffd6d0 = 0
syntax error in expression, near `0x7fffffffd6d0 = 0'.
gdb-peda$ p sizeof(u32)
$4 = 0x4
gdb-peda$ show language
The current source language is "auto; currently rust".
gdb-peda$ set language c
gdb-peda$ set *(uintptr_t *)0x7fffffffd6d0 = 0
gdb-peda$
```
This PR helps set the language to `c` before execution of essential gdb commands, and rolls back to `auto` afterwards. This would benefit lots of developers who are developing SGX enclaves in other languages.
Signed-off-by: Yu Ding <[email protected]>
* Fix1 parent 7b9f974 commit e0a51c4
File tree
1 file changed
+2
-0
lines changed- sdk/debugger_interface/linux/gdb-sgx-plugin
1 file changed
+2
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
| 613 | + | |
613 | 614 | | |
614 | 615 | | |
615 | 616 | | |
616 | 617 | | |
617 | 618 | | |
618 | 619 | | |
| 620 | + | |
619 | 621 | | |
620 | 622 | | |
621 | 623 | | |
| |||
0 commit comments