Skip to content

Fix the monitor for the current dmod API and for Renode's GDB server - #56

Merged
JohnAmadis merged 2 commits into
masterfrom
ccr-09cd1b4c-fehk7j
Sep 30, 2026
Merged

JohnAmadis merged 2 commits into
masterfrom
ccr-09cd1b4c-fehk7j

Conversation

@JohnAmadis

@JohnAmadis JohnAmadis commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

This PR fixes two problems that together broke the dmod-boot Renode test (choco-technologies/dmod-boot#102).

  1. Build. dmod develop (which dmlog fetches) now requires DMOD_CURRENT_ALLOCATOR on the system side. Dmod_Malloc and Dmod_Free became macros over Dmod_MallocEx/Dmod_FreeEx, and the plain functions are gone.
    • tools/monitor/monitor.c never included dmod.h and relied on implicit declarations, so dmlog_monitor failed to link: undefined reference to 'Dmod_Malloc'.
    • The test executables are raw add_executable targets, so they hit the #error DMOD_CURRENT_ALLOCATOR must be defined in dmod_sal.h.
  2. GDB live mode stalls the target under Renode. With the GDB backend, every ring read interrupts the target and resumes it afterwards, and monitor_wait_for_new_data() polled every 10 ms. Under Renode that window lets the firmware execute almost nothing. Once the monitor catches up with the ring, the target is effectively stopped. The dmod-boot boot never got past configuring its drivers while monitor-gdb was attached: 240 s with the ring head not moving.

Fix

  • monitor.c: #include "dmod.h".
  • tests/CMakeLists.txt: call dmod_set_current_allocator() for each test executable.
  • monitor_wait_for_new_data(): poll every 200 ms with the GDB backend. OpenOCD keeps 10 ms.

Verification

  • dmlog, locally against dmod develop: ctest passes 5/5, and tests/test_automated_gdb.sh passes 7/7 (gdbserver backend, including the file transfer scenarios).
  • dmod-boot scripts/run_renode_tests.sh, run locally in chocotechnologies/dmboot:1.0.0 with this monitor: DMOD-Boot started ... ✓ FOUND, Renode emulation tests PASSED (3 runs). Without the poll change the same setup fails.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JWVYTSBnZLbpDqp7X1sknv

dmod now requires DMOD_CURRENT_ALLOCATOR on the system side and
Dmod_Malloc/Dmod_Free became macros over Dmod_MallocEx/Dmod_FreeEx, with
the plain Dmod_Malloc/Dmod_Free functions removed.

- tools/monitor/monitor.c never included dmod.h and relied on implicit
  declarations of Dmod_Malloc/Dmod_Free/Dmod_File*; with no Dmod_Malloc
  symbol left, linking dmlog_monitor failed (this is what breaks the
  dmod-boot Renode test, which builds the monitor on the host). Include
  dmod.h so the macros expand; dmod_add_tool() already defines the
  allocator for the tool.
- tests/CMakeLists.txt: the test executables are raw add_executable
  targets, so they hit dmod_sal.h's #error. Call
  dmod_set_current_allocator() for each of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JWVYTSBnZLbpDqp7X1sknv
With the GDB backend each ring read interrupts the target and resumes it
afterwards, and monitor_wait_for_new_data() polled every 10 ms. Under
Renode such a short window lets the firmware execute next to nothing, so
once the monitor had caught up with the ring the target effectively
stopped: dmod-boot's boot never got past loading its drivers while
monitor-gdb was attached. Poll every 200 ms with the GDB backend; OpenOCD
keeps the 10 ms interval.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JWVYTSBnZLbpDqp7X1sknv
@JohnAmadis JohnAmadis changed the title Build the monitor and tests against the current dmod allocator API Fix the monitor for the current dmod API and for Renode's GDB server Sep 30, 2026
@JohnAmadis
JohnAmadis merged commit fb05e82 into master Sep 30, 2026
2 checks passed
JohnAmadis pushed a commit to choco-technologies/dmod-boot that referenced this pull request Sep 30, 2026
choco-technologies/dmlog#56 is merged; fb05e82 is its merge commit, with
the same tree as the branch commit tested here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JWVYTSBnZLbpDqp7X1sknv
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