Open ajmandadi opened 10 months ago
in this test case, i'm using snprintf which is a compressed instruction so removing the them throws an error that "Compressed instructions not enabled!". Hence unsure if this is also a side effect of compressed instructions problem.
When running this test against this branch, which fixes compressed instructions,: https://github.com/tactcomplabs/rev/tree/TestDbg we no longer see the failure. This branch currently has a vexing memory corruption issue preventing it from being merged to devel, but the changes here should fix this issue when merged
Probably still being worked on but just wanted to update that I tested it out on the above branch, and though i dont see a crash anymore, there is no print to console i.e the ECALL to rev_write doesnt seem to have been made.
Not reproducible anymore. Probably fixed by https://github.com/tactcomplabs/rev/pull/298, https://github.com/tactcomplabs/rev/pull/296 and https://github.com/tactcomplabs/rev/pull/288.
Describe the bug To print a variable from inside rev, we use snprintf to populate a buffer. But this causes a segfault inside rev's calcphysaddr.
To Reproduce
Expected behavior To print the value 98
BackTrace
Additional context Attached the binary's objdump as well and looks like the PC during failure (0x13b00) is a LOAD instruction inside the snprint function call. Code compiled with below command with compressed instruction enabled -
"/opt/riscv/bin/riscv64-unknown-elf-gcc" -march=rv64imafdc -O0 -o revprint.exe rev_print.c -static.
code.tar.gz