2021-01-26 12:08:02 +02:00
|
|
|
define bmconnect
|
|
|
|
if $argc < 1 || $argc > 2
|
|
|
|
help bmconnect
|
|
|
|
else
|
|
|
|
target extended-remote $arg0
|
|
|
|
if $argc == 2
|
|
|
|
monitor $arg1 enable
|
|
|
|
end
|
|
|
|
monitor swdp_scan
|
|
|
|
attach 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
document bmconnect
|
|
|
|
Attach to the Black Magic Probe at the given serial port/device.
|
|
|
|
bmconnect PORT [tpwr]
|
|
|
|
Specify PORT as COMx in Microsoft Windows or as /dev/ttyACMx in Linux.
|
|
|
|
If the second parameter is set as "tpwr", the power-sense pin is driven to
|
|
|
|
3.3V
|
|
|
|
end
|
|
|
|
|
|
|
|
# Load .gdbinit files from current dir
|
|
|
|
set auto-load local-gdbinit
|
2022-02-02 15:33:36 +02:00
|
|
|
set auto-load safe-path ~
|
2022-02-19 20:00:43 +02:00
|
|
|
add-auto-load-safe-path /usr/lib/go/src/runtime/runtime-gdb.py
|
2023-02-13 17:31:18 +02:00
|
|
|
add-auto-load-safe-path /usr/share/gdb/auto-load/usr/lib
|
2021-01-26 12:08:02 +02:00
|
|
|
|
|
|
|
# save command history
|
|
|
|
set history save on
|
|
|
|
set history size 10000
|
|
|
|
set history remove-duplicates unlimited
|
|
|
|
set history filename ~/.gdb_history
|
2021-01-26 20:03:38 +02:00
|
|
|
|
|
|
|
# give me pretty structures
|
|
|
|
set print pretty on
|
|
|
|
|
|
|
|
# Allow memory access outside of server provided memory map
|
|
|
|
set mem inaccessible-by-default off
|
2021-02-19 13:52:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Clion is stupid
|
|
|
|
# define target remote
|
|
|
|
# bmconnect /dev/ttyBmpGdb
|
|
|
|
# end
|
2021-07-04 00:00:38 +03:00
|
|
|
|
2022-10-14 14:46:00 +03:00
|
|
|
# upgrade remote commands
|
|
|
|
define target remote
|
|
|
|
target extended-remote $arg0
|
|
|
|
end
|
|
|
|
|
2021-07-04 00:00:38 +03:00
|
|
|
|
|
|
|
define xxd
|
|
|
|
if $argc < 2
|
|
|
|
set $size = sizeof(*$arg0)
|
|
|
|
else
|
|
|
|
set $size = $arg1
|
|
|
|
end
|
|
|
|
dump binary memory dump.bin $arg0 ((void *)$arg0)+$size
|
|
|
|
eval "shell xxd -o %d dump.bin; rm dump.bin", ((void *)$arg0)
|
|
|
|
end
|
|
|
|
document xxd
|
|
|
|
Dump memory with xxd command (keep the address as offset)
|
|
|
|
|
|
|
|
xxd addr [size]
|
|
|
|
addr -- expression resolvable as an address
|
|
|
|
size -- size (in byte) of memory to dump
|
|
|
|
sizeof(*addr) is used by default
|
|
|
|
end
|