DPU Core Dump
dpu-lldb provides a way to save the state of the DPU and to load it.
Let’s consider the following DPU program (in core_dump_example.c), and compile it:
#include <mram.h>
#include <stdint.h>
__mram_noinit uint64_t mram_value;
void write_my_value(uint64_t val) {
mram_write((void *)&val, &mram_value, sizeof(uint64_t));
}
uint64_t read_my_value() {
uint64_t ret_value = 0xffffffffffffffffULL;
mram_read(&mram_value, (void *)&ret_value, sizeof(uint64_t));
return ret_value;
}
int main() {
const uint64_t val = 0x0123456789abcdefULL;
uint64_t new_val;
write_my_value(val);
new_val = read_my_value();
return val == new_val;
}
dpu-upmem-dpurte-clang -O2 core_dump_example.c -o core_dump_example
We are now ready to run the program until it gets to the mram_read function.
Then we will generate a Core Dump of the execution using the process save-core command of dpu-lldb:
file core_dump_example
breakpoint set -n mram_read
process launch
disassemble --pc
process save-core core_dump_example.core_dump
exit
(lldb) disassemble --pc
core_dump_example`main:
-> 0x80000090 <+56>: ldma r3, r2, 0x0
0x80000098 <+64>: ld d2, r22, 0x0
0x800000a0 <+72>: sub zero, r3, r1
0x800000a8 <+80>: subc r0, r2, r0, xz
We have created a Core Dump of the execution in the core_dump_example.core_dump file.
Let’s load it with dpu-lldb, and stop at entry to see that the Core Dump program start just where we were at when generating it.
Then we will be able to resume the program to let it finish:
dpu-lldb -c core_dump_example.core_dump -- core_dump_example
process launch --stop-at-entry
disassemble --pc
process continue
exit