Skip to content

Add memory tracing and scanning debugger commands#735

Open
lusca0x01 wants to merge 8 commits intoLIJI32:masterfrom
lusca0x01:master
Open

Add memory tracing and scanning debugger commands#735
lusca0x01 wants to merge 8 commits intoLIJI32:masterfrom
lusca0x01:master

Conversation

@lusca0x01
Copy link
Copy Markdown

This PR adds new debugger commands for memory analysis, useful for ROM debugging and reverse engineering.

New Commands

Memory Tracing:

  • read <address> - Read and display a single memory address
  • trace_read - Toggle logging of all memory reads
  • trace_write - Toggle logging of all memory writes
  • trace_clear - Clear the trace buffers
  • trace_dump <filename> - Dump traced memory to a file

Memory Scanning (CheatEngine-like):

  • scan all - Initialize scan with all addresses
  • scan exact <value> - Filter addresses matching exact value
  • scan changed - Filter addresses whose value changed since last scan
  • scan unchanged - Filter addresses whose value remained the same
  • scan_dump <filename> - Export scan results to file
  • scan_clear - Reset scan state

Use Cases

  • Debugging homebrew ROMs
  • Finding memory addresses for specific game values (lives, score, etc.)
  • Tracing memory access patterns during execution
  • Reverse engineering ROM behavior

Implementation

  • Added trace and scan state fields to GB_gameboy_t (guarded by GB_DISABLE_DEBUGGER)
  • Memory tracing hooks in GB_read_memory and GB_write_memory
  • All new commands follow existing debugger command patterns

Inspired by LiveOverflow's Game Boy hacking videos.

@ISSOtm
Copy link
Copy Markdown
Contributor

ISSOtm commented Dec 23, 2025

This kind of functionality looks very interesting, but I'm not sure what the intended syntax for the new commands' arguments is? Like, what kind of range syntaxes are supported, etc.

@lusca0x01 lusca0x01 marked this pull request as draft December 23, 2025 01:54
@lusca0x01
Copy link
Copy Markdown
Author

I've updated the command help strings to clarify the syntax!
Let me know if you'd prefer a different format or if the documentation still needs adjustment!

@lusca0x01 lusca0x01 marked this pull request as ready for review December 23, 2025 21:29
@LIJI32 LIJI32 force-pushed the master branch 2 times, most recently from 4873d7c to 858f003 Compare December 29, 2025 11:56
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