ESP32 JTAG
来自Jack's Lab
(版本间的差异)
(→GDB Tips) |
|||
第15行: | 第15行: | ||
== GDB Tips == | == GDB Tips == | ||
− | + | === Display Register === | |
<pre> | <pre> | ||
第22行: | 第22行: | ||
(gdb) i r esp | (gdb) i r esp | ||
(gdb) i r pc | (gdb) i r pc | ||
− | </ | + | </source> |
− | + | === Display Memory === | |
− | < | + | <source lang=bash> |
(gdb) x /wx 0x80040000 # Displays the data at the specified address in hexadecimal | (gdb) x /wx 0x80040000 # Displays the data at the specified address in hexadecimal | ||
(gdb) x /8x $esp | (gdb) x /8x $esp | ||
第33行: | 第33行: | ||
(gdb) x /16s 0x86468700 # Displays the data at the specified address as a string | (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) | (gdb) x /24i 0x8048a51 # Display the data at the specified address as instruction (24 instructions) | ||
− | </ | + | </source> |
− | + | === Modify Register === | |
− | < | + | <source lang=bash> |
(gdb) set $v0 = 0x004000000 | (gdb) set $v0 = 0x004000000 | ||
(gdb) set $epc = 0xbfc00000 | (gdb) set $epc = 0xbfc00000 | ||
− | </ | + | </source> |
− | + | === Modify Memory === | |
− | < | + | <source lang=bash> |
(gdb) set {unsigned int}0x8048a51=0x0 | (gdb) set {unsigned int}0x8048a51=0x0 | ||
(gdb) set *(unsigned int*)0x8048a54=0x55aa55aa | (gdb) set *(unsigned int*)0x8048a54=0x55aa55aa | ||
− | </ | + | </source> |
− | + | === Search Memory === | |
− | < | + | <source lang=bash> |
Usage: find <start> <end> <count> <value> | Usage: find <start> <end> <count> <value> | ||
第68行: | 第68行: | ||
end | end | ||
end | end | ||
− | </ | + | </source> |
− | + | === Breakpoint & Watchpoint === | |
− | < | + | <source lang=bash> |
(gdb) b *0x80400000 | (gdb) b *0x80400000 | ||
(gdb) watch *(unsigned int *)0xbffff400==0x90909090 | (gdb) watch *(unsigned int *)0xbffff400==0x90909090 | ||
− | </ | + | </source> |
<br><br> | <br><br> |
2016年11月6日 (日) 12:54的版本
目录 |
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
3.1 Display Register
(gdb) i r (gdb) i r a # show all registers including float and multimedia (gdb) i r esp (gdb) i r pc </source> === Display Memory === <source lang=bash> (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) </source> === Modify Register === <source lang=bash> (gdb) set $v0 = 0x004000000 (gdb) set $epc = 0xbfc00000 </source> === Modify Memory === <source lang=bash> (gdb) set {unsigned int}0x8048a51=0x0 (gdb) set *(unsigned int*)0x8048a54=0x55aa55aa </source> === Search Memory === <source lang=bash> 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 </source> === Breakpoint & Watchpoint === <source lang=bash> (gdb) b *0x80400000 (gdb) watch *(unsigned int *)0xbffff400==0x90909090 </source> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br> <br><br>