gdb/sparc: implement PRSTATUS elf32-sparc handler
Adds a handler for SPARC ELF32 PRSTATUS notes in GDB to correctly parse core dumps.
This patch introduces a handler in GDB for the PRSTATUS NOTE section found in SPARC ELF32 core dumps. Previously, these notes were unparsed, leading to incorrect core dump analysis. The new handler extracts signal and process ID information, and defines a pseudo-section for register data, improving core dump interpretation for this architecture.
- proposer
Approves the patch for implementing the PRSTATUS handler for SPARC ELF32 core dumps.
“FWIW this looks good to me.”
- contributor
Explains the problem: unparsed PRSTATUS notes in SPARC ELF32 core dumps lead to incorrect coredump views.
“Some SPARC ELF32 coredumps emit a PRSTATUS note which is left unparsed without a handler in GDB, leading to incorrectly viewed coredumps.”
Technical Tradeoffs
- Improves core dump analysis for SPARC ELF32 on GDB.
- Adds specific handling for a particular NOTE type, increasing code complexity.
In Details
This patch adds the elf32_sparc_grok_prstatus function to bfd/elf32-sparc.c. This function handles the PRSTATUS note type, which is part of the ELF core dump format for SPARC 32-bit systems. It parses specific fields like pr_cursig and pr_pid and uses _bfd_elfcore_make_pseudosection to create a section for register data, addressing a gap in GDB's core dump parsing for this architecture.
- SPARC
- A RISC instruction set architecture originally developed by Sun Microsystems.
- ELF
- Executable and Linkable Format, a standard file format for executables, object code, shared libraries, and core dumps on Unix-like systems.
- core dump
- A file that records the memory image of a crashed process. Debuggers can use core dumps to inspect the state of the program at the time of the crash.
- PRSTATUS
- A specific NOTE type in ELF core dumps that contains process status information, including signal, PID, and register values.
- bfd
- Binary File Descriptor library, part of binutils, which provides a generic interface to object file formats.