Skip to content

Instantly share code, notes, and snippets.

View Mark-G1's full-sized avatar

Mark Mark-G1

View GitHub Profile
@aldelaro5
aldelaro5 / ghidra_mgba_gdb.md
Last active October 4, 2023 07:56
Debugging with ghidra + mgba's GDB server

CURRENTLY WORKS MOSTLY FOR LINUX, WINDOWS INSTRUCTIONS WILL BE WRITTEN EVENTUALLY

Requirements

  • mgba BUILT FROM SOURCE, this is because you need some changes that as of this writting, aren't present in the lattest version (0.9.3). They will only be present in a release in 0.10.0+
  • Ghidra 10.0.3+ (you NEED 10.0.3+ due to fixes being applied that specifically impacts this process as well as a feature that allows to sync the static listing with the dynamic listing). I recommend however to install the lattest version at the time you are setting this up and upgrade as you feel like it (projects are usually upwards compatible, but the opposite isn't true).
  • gdb-multiarch. You need the multiarch version because it has every targets enabled includring armv4t which is the one we care about here.
  • GhidraGBA extension (you need to modify extension.properties in the zip to have the version say your ghidra's version (like "10.0.3" or "10.1") so it can be installed).
  • If you want better step over experi
@natersoz
natersoz / JLinkGDBServer_Multiple_Sessions.md
Last active February 4, 2023 01:12
Mutiple Debug Sessions with JLinkGDBServer

Running Multiple JLinkGDBServer Sessions

The documentation for the JLinkGDBServer command line options is incomplete. Getting multiple debug sessions running using JLinkGDBServer is a trial/error/google and repeat process. Here are bare-bones instructions for getting multiple JLinkGDBServer sessions over USB running on an OSX host. An ethernet configuration will differ. These instructions should work for Linux and Windows as well but have not been tested in those environments.

Get the debug interface serial number

The serial number is printed whenever the JLinkGDBServer program is started and it attaches to a SEGGER JLink debug interface (either a USB connected pod or on-boad SWO interface). Attach only one of the units for debugging and run the JLinkGDBServer program. The serial number of the JLink debug interface is a 9 digit number prefixed with the text S/N:.

The Serial Number may also be printed on the debug