RISC-V: Add an "arch=" disassembler option.
Adds an 'arch=' option to the RISC-V disassembler to specify the ISA when the object file lacks this information.
This patch introduces an ‘arch=’ option for the RISC-V disassembler. This option is crucial for disassembling object files that do not contain architecture information, such as core files or raw binaries, allowing the user to specify the ISA explicitly. The new option overrides the default ISA and is designed to work in conjunction with GDB for analyzing core files without the associated executable.
- proposer
Proposes adding an 'arch=' option to the RISC-V disassembler to handle objects lacking architecture attributes.
“The disassembler uses the ISA from the object's architecture attribute, or rv64gc if there is none. Some objects cannot carry the attribute. A core file is one, and only the program that loads it knows the ISA. Add an "arch=" option that overrides the ISA recorded in the object.”
In Details
This patch adds a disassembler option for RISC-V to specify the Instruction Set Architecture (ISA) when the object file itself (e.g., a core dump or raw binary) doesn't contain the necessary ELF architecture attribute. This complements GDB's ability to analyze such files by providing the disassembler with the correct ISA context.
- disassembler
- A program that translates machine code (binary instructions) into a human-readable assembly language representation.
- ISA
- Instruction Set Architecture. Defines the set of instructions that a particular processor can execute.
- RISC-V
- An open-source instruction set architecture based on RISC principles, gaining popularity for its modularity and extensibility.
- core file
- A file generated when a program crashes, containing a snapshot of the program's memory and state at the time of the crash.
- ELF
- Executable and Linkable Format. A common standard file format for executables, object code, shared libraries, and core dumps on Unix-like systems.