1#include <cstdint>
2
3int main() {
4 constexpr uint64_t rax = 0x0102030405060708;
5 constexpr uint64_t rbx = 0x1112131415161718;
6 constexpr uint64_t rcx = 0x2122232425262728;
7 constexpr uint64_t rdx = 0x3132333435363738;
8 constexpr uint64_t rsp = 0x4142434445464748;
9 constexpr uint64_t rbp = 0x5152535455565758;
10 constexpr uint64_t rsi = 0x6162636465666768;
11 constexpr uint64_t rdi = 0x7172737475767778;
12
13 asm volatile(
14 // save rsp & rbp
15 "movq %%rsp, %%r8\n\t"
16 "movq %%rbp, %%r9\n\t"
17 "\n\t"
18 "movq %4, %%rsp\n\t"
19 "movq %5, %%rbp\n\t"
20 "\n\t"
21 "int3\n\t"
22 "\n\t"
23 // restore rsp & rbp
24 "movq %%r8, %%rsp\n\t"
25 "movq %%r9, %%rbp"
26 :
27 : "a"(rax), "b"(rbx), "c"(rcx), "d"(rdx), "i"(rsp), "i"(rbp), "S"(rsi),
28 "D"(rdi)
29 : "%r8", "%r9"
30 );
31
32 return 0;
33}
34

source code of lldb/test/Shell/Register/Inputs/x86-64-gp-read.cpp