aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorbarsolo2000 <barsolo@meta.com>2025-09-18 13:41:16 -0700
committerGitHub <noreply@github.com>2025-09-18 15:41:16 -0500
commit1c95d80ba68efd2ca9a0336529ea5fb7dc871417 (patch)
treef31defb166bdb8bfd57bb9ba71e78e26f34f1090 /llvm/lib/Support/CommandLine.cpp
parent1cee4fa968f985489a50b88b66bd392c35f0870e (diff)
downloadllvm-1c95d80ba68efd2ca9a0336529ea5fb7dc871417.zip
llvm-1c95d80ba68efd2ca9a0336529ea5fb7dc871417.tar.gz
llvm-1c95d80ba68efd2ca9a0336529ea5fb7dc871417.tar.bz2
RISCV enable assembly unwinding (#158161)
**Added emulator unwinding support for RISCV files.** Emulated Instructions: ADD (addi sp, sp, imm) STORE (sd ra, offset(sp)) LOAD (ld ra, offset(sp)). We had to overwrite SetInstructions() since UnwindAssemblyInstEmulation calls EvaluateInstruction() directly after calling SetInstruction(), but it never calls ReadInstruction(). This means that the m_decoded member variable in the instruction emulator is never properly initialized. By overriding SetInstruction(), we decode the instruction bytes and set m_decoded directly. This ensures that subsequent emulation (including unwinding) operates on the correct instruction. We also had to change the the OpCode GetOpcodeBytes function since recent changes made it so GetOpcodeBytes will return None for type eType16_32Tuples (an alternative and longer way, would've been to type check during the overwritten SetInstruction() and call a DataExtractor with .GetU16(&offset) to set the inst_data. Added a test - TestSimpleRiscvFunction (took inspiration from: [link](https://github.com/llvm/llvm-project/blob/main/lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp)) [----------] 1 test from TestRiscvInstEmulation [ RUN ] TestRiscvInstEmulation.TestSimpleRiscvFunction [ OK ] TestRiscvInstEmulation.TestSimpleRiscvFunction (1 ms) [----------] 1 test from TestRiscvInstEmulation (1 ms total) [----------] Global test environment tear-down [==========] 63 tests from 5 test suites ran. (11 ms total) [ PASSED ] 63 tests. --------- Co-authored-by: Bar Soloveychik <barsolo@fb.com>
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
0 files changed, 0 insertions, 0 deletions