Skip to content

Conversation

@etiaro
Copy link

@etiaro etiaro commented Aug 28, 2025

Description

Introduces libcoredumpsrv which provides coredump server functionality and configuration options.

JIRA: RTOS-1054

Motivation and Context

Created as static library in order to allow including in -multi devices to save memory on chosen targets similar to posixsrv and dummyfs.
Standard way of use is standalone executable provided in phoenix-rtos-utils.
Exports functions and constants required for configuration eg. via psh applet.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: armv7m7-imxrt117x-evk, ia32-generic-qemu

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @etiaro, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces libcoredumpsrv, a new static library designed to provide coredump server functionality and configuration options. Its primary motivation is to enable coredumping on memory-constrained devices, similar to how posixsrv and dummyfs operate, by allowing it to be included as a static library. The library also exports necessary functions and constants for external configuration, such as via a psh applet.

Highlights

  • Coredump Server Core Logic: Implements the central coredump mechanism, including ELF header generation, capturing process information (threads, memory segments, CPU contexts), and handling output to files or console.
  • Configurable Coredump Options: Introduces various configuration parameters for the coredump server, such as maximum threads to dump, maximum stack size, memory scope (none, exception thread stack, all stacks, or all memory), floating-point context saving, print options, save path, and maximum number of coredump files.
  • ELF Format Support: Provides structures and functions for generating coredumps in the ELF (Executable and Linkable Format) standard, supporting both 32-bit and 64-bit ELF classes, including program headers and note sections for process and thread information.
  • Architecture-Specific HAL: Includes a Hardware Abstraction Layer (HAL) with implementations for multiple CPU architectures (AArch64, ARMv7-A, ARMv7-M, ARMv7-R, ARMv8-M, ARMv8-R, IA32, RISC-V 64-bit, SPARCv8 LEON) to correctly capture and format CPU-specific register contexts and FPU states for the coredump.
  • Data Encoding Utilities: Integrates CRC32 and Base64 encoding functionalities, used for data integrity checks and efficient text-based output of binary coredump data.
  • Kernel Communication Interface: Defines a communication protocol and functions for the coredump server to interact with the kernel, requesting crash information, thread contexts, and memory contents from the crashed process.
  • Dynamic Configuration via Device: Allows runtime configuration of the coredump server settings through a dedicated device interface (/dev/coredumpctrl), enabling dynamic adjustments to coredump behavior.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant new feature: a coredump server library. The implementation is comprehensive, covering various CPU architectures and providing a flexible configuration mechanism. My review focuses on ensuring correctness, robustness, and proper memory management in this new, complex codebase. I've identified a few critical and high-severity issues related to potential crashes and memory leaks that should be addressed. Additionally, there are some medium-severity issues that would improve the code's correctness and clarity.

Introduces libcoredumpsrv which provides coredump server functionality and
configuration options.
Created as static library in order to allow including in -multi devices to
save memory on chosen targets similar to posixsrv and dummyfs.
Standard way of use is standalone executable provided in phoenix-rtos-utils.
Exports functions and constants required for configuration eg. via psh applet.

JIRA: RTOS-1054
@etiaro etiaro force-pushed the etiaro/libcoredumpsrv branch from ccc4659 to 1368e17 Compare November 5, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants