ESP32 JTAG
来自Jack's Lab
(版本间的差异)
(→Overview) |
|||
第8行: | 第8行: | ||
$ make && sudo make install | $ make && sudo make install | ||
</source> | </source> | ||
+ | |||
+ | <br><br> | ||
+ | |||
+ | == GDB Tips == | ||
+ | |||
+ | == GDB Tips == | ||
+ | |||
+ | 1. show register | ||
+ | |||
+ | <pre> | ||
+ | (gdb) i r | ||
+ | (gdb) i r a # show all registers including float and multimedia | ||
+ | (gdb) i r esp | ||
+ | (gdb) i r pc | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | 2. show memory | ||
+ | |||
+ | <pre> | ||
+ | (gdb) x /wx 0x80040000 # Displays the data at the specified address in hexadecimal | ||
+ | (gdb) x /8x $esp | ||
+ | (gdb) x /16x $esp+12 | ||
+ | (gdb) x /16s 0x86468700 # Displays the data at the specified address as a string | ||
+ | (gdb) x /24i 0x8048a51 # Display the data at the specified address as instruction (24 instructions) | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | 3. modify register | ||
+ | |||
+ | <pre> | ||
+ | (gdb) set $v0 = 0x004000000 | ||
+ | (gdb) set $epc = 0xbfc00000 | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | 4. modify memory | ||
+ | |||
+ | <pre> | ||
+ | (gdb) set {unsigned int}0x8048a51=0x0 | ||
+ | (gdb) set *(unsigned int*)0x8048a54=0x55aa55aa | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | 5. search memory | ||
+ | |||
+ | <pre> | ||
+ | Usage: find <start> <end> <count> <value> | ||
+ | |||
+ | (gdb) define find | ||
+ | set $ptr = $arg0 | ||
+ | set $cnt = 0 | ||
+ | while ( ($ptr<=$arg1) && ($cnt<$arg2) ) | ||
+ | if ( *(unsigned int *)$ptr == $arg3 ) | ||
+ | x /wx $ptr | ||
+ | set $cnt = $cnt + 1 | ||
+ | end | ||
+ | set $ptr = $ptr + 4 | ||
+ | end | ||
+ | end | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | 6. breakpoint & watchpoint | ||
+ | |||
+ | <pre> | ||
+ | (gdb) b *0x80400000 | ||
+ | (gdb) watch *(unsigned int *)0xbffff400==0x90909090 | ||
+ | </pre> | ||
<br><br> | <br><br> |
2016年11月6日 (日) 12:50的版本
1 Overview
$ sudo apt-get install libftdi-dev make libtool pkg-config autoconf automake texinfo $ git clone --recursive git://github.com/espressif/openocd-esp32.git $ cd openocd-esp32 $ ./bootstrap $ make && sudo make install
2 GDB Tips
3 GDB Tips
1. show register
(gdb) i r (gdb) i r a # show all registers including float and multimedia (gdb) i r esp (gdb) i r pc
2. show memory
(gdb) x /wx 0x80040000 # Displays the data at the specified address in hexadecimal (gdb) x /8x $esp (gdb) x /16x $esp+12 (gdb) x /16s 0x86468700 # Displays the data at the specified address as a string (gdb) x /24i 0x8048a51 # Display the data at the specified address as instruction (24 instructions)
3. modify register
(gdb) set $v0 = 0x004000000 (gdb) set $epc = 0xbfc00000
4. modify memory
(gdb) set {unsigned int}0x8048a51=0x0 (gdb) set *(unsigned int*)0x8048a54=0x55aa55aa
5. search memory
Usage: find <start> <end> <count> <value> (gdb) define find set $ptr = $arg0 set $cnt = 0 while ( ($ptr<=$arg1) && ($cnt<$arg2) ) if ( *(unsigned int *)$ptr == $arg3 ) x /wx $ptr set $cnt = $cnt + 1 end set $ptr = $ptr + 4 end end
6. breakpoint & watchpoint
(gdb) b *0x80400000 (gdb) watch *(unsigned int *)0xbffff400==0x90909090