stacksmashing / tamarin-firmware

GNU General Public License v3.0
432 stars 51 forks source link

Limitations of OpenOCD JTAG with GDB #24

Open PatriceBlin opened 1 month ago

PatriceBlin commented 1 month ago

Hi, after following few blogposts I managed to make openocd work with GDB and now I have a few questions regarding what can actually be done with a debugger.

My setup is as follow:

With this I can connect with GDB, display registers and stepi but nothing more sophisticated without reaching the TAMARIN_QUEUE_SIZE limitation (assert).

Looking into OpenOCB documentation ("GDB-and-OpenOCD") there seems to be some limitations,

Do not use GDB commands continue, step or next as they synchronize GDB with your target and GDB would require stopping the target to get the prompt back.

What should I expect to be able to do while debugging with GDB, IDA or Ghidra ?
At first I had the idea to set some breakpoints in XNU kernel while running an update recovery from USB but if I can't "continue" that might be difficult/tedious.

From OpenOCD documentation I added this inside my gdb configuration, would other options be pertinent ?

# Info : iphone.ecore0: hardware has 2 breakpoints, 3 watchpoints
set remote hardware-breakpoint-limit 2
set remote hardware-watchpoint-limit 3

# https://openocd.org/doc/html/GDB-and-OpenOCD.html
set remote interrupt-on-connect off
set mem inaccessible-by-default off

Thanks