Skip to content

Instantly share code, notes, and snippets.

@patois
Last active September 14, 2022 07:04
Show Gist options
  • Save patois/acf25673672d12990d506faec9b30426 to your computer and use it in GitHub Desktop.
Save patois/acf25673672d12990d506faec9b30426 to your computer and use it in GitHub Desktop.
ARM(32) Code Snippet debugging with GDB Lauterbach Trace32 Simulator
  1. Install TRACE32 demo/trial for ARM from https://www.lauterbach.com/frames.html?download_demo.html
  2. place ida_arm.cmm into the TRACE32 installation folder
  3. backup config.t32 and replace it with the one provided here
  4. change the "SYS" variable of this config.t32 file to point to your TRACE32 install folder
  5. In your IDA installation folder, find and add the contents of the file "gdb_arch.cfg" provided here, edit the path to TRACE32 in line one, save the file
  6. Run IDA, go to "Debugger -> Select debugger", pick "Remote GDB debugger"
  7. Go to "Debugger -> Debugger options -> Set specific options", tick the "Run a program..." checkbox, then click "Choose a configuration" and pick "TRACE32: ARM32"
  8. Confirm and close the dialog, go to "Debugger -> Process options...", insert a hostname (127.0.0.1) and port (30000)
  9. Use "Start process" (F9) or "Run to cursor" (F4) in order to start a debug session

IDA setup

Setting up remote GDB debugging for other CPUs using Lauterbach TRACE32 Simulators should work in the same/similar way.

currently supported GDB backends

Further examples: Tricore: https://gist.github.com/patois/4d32ac437f32682b49f3480569ae0ec6

Renesas V850/RH850: https://gist.github.com/patois/8f76ff7d1f9e27a17338a11cbc3ef92d

IDA / TRACE§32 debug session

PBI=SIM
PRINTER=WINDOWS
SCREEN=
HEADER=TRACE32 ARM SIMULATOR
GDB=NETASSIST
PACKLEN=1024
PORT=30000
PROTOCOL=TCP
OS=
SYS=<path_to_simarm> ; <- edit this
set TRACE32_ARM_PATH c:\tools\simarm
.ARM_TRACE32
name TRACE32: ARM32
cpu arm
range DATA RAM 0x00000000:0xFFFFFF00
initial_sp 0x08000000
cmdline "$(TRACE32_ARM_PATH)/t32marm.exe" -c "$(TRACE32_ARM_PATH)/config.t32" -s "$(TRACE32_ARM_PATH)/ida_arm.cmm" "%e"
LOCAL &arg1
;========================================================================
; initialize and start the debugger
RESet
; uncomment and edit the following lines if you'd like to
; change the cpu mode / emulate a different cpu
;SYStem.Option DisMode THUMBS
;SYStem.CPU STM32f765NI
SYStem.Up
;========================================================================
&arg1=PRACTICE.ARG(0)
data.load.ELF &arg1
; open some windows
WinCLEAR
Register.view
list.Asm
ENDDO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment