santhoshe447 wrote: **Overview of this: ** Initially, this PR included the RISC-V feature attribute reading logic. Since we received PR https://github.com/llvm/llvm-project/pull/173046, I have incorporated those changes and removed the duplicate logic accordingly.
**Issue: ** RISC-V is a collection of modular extensions. Previously, if the user missed mentioning a specific extension in the command, LLDB would fail to decode the instruction. Eg: ``` (lldb) disassemble -n main <+0>: 051f 0058 0000 <unknown> <+6>: 1516 <unknown> Valid instructions display as <unknown> ``` Solution: The basic solution is to automatically append RISC-V feature attributes to the feature string during a disassembly request. LLDB retrieves the feature strings directly from the ELF binary. It updates the feature string sent to the disassembler. So, the disassembler knows the correct extensions without the user having to type them manually. User can override via -Y (It is already available with disassemble command): It helps the user override the default CPU features for disassembly. Eg: `(lldb) disassemble -n main -Y -zca, -xqci` This allows the user to explicitly disable/enable feature extensions. Here the lldb retrieve the feature strings from the ELF and update the feature string then for the disassembly. **My Implementation: ** My changes are now limited to handling the case where the user overrides the feature string using the -Y option. I have added basic validation for the user-provided feature string and merged it with the subtarget string retrieved from the ELF. The code evaluates if the user-requested CPU feature is valid: 1. Must start with +/-. 2. Must be at least 2 characters long. 3. It should not start with numeric. 4. Appends default feature attributes retrieved from the ELF. 5. If the user explicitly disables a feature (e.g., -zca), the code ensures the default feature from the ELF (e.g., +zca) is not appended. 6. This respects the user's intent to hide or disable that specific extension. **How does it help? ** I have limited knowledge about this, I think it helps in instruction level debugging. Users can isolate issues by specifically enabling or disabling extensions to see how the binary is interpreted. https://github.com/llvm/llvm-project/pull/147990 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
