meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| gdb [2017/09/14 11:49] – niziak | gdb [2025/05/28 07:16] (current) – [stepping] niziak | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== GDB ====== | ||
| + | |||
| ====== Starting | ====== Starting | ||
| < | < | ||
| Line 6: | Line 8: | ||
| </ | </ | ||
| + | ====== Symbols and paths ===== | ||
| + | |||
| + | Add symbols: | ||
| + | < | ||
| + | symbol-file / | ||
| + | dir / | ||
| + | </ | ||
| ====== Using ====== | ====== Using ====== | ||
| ==== getting info ==== | ==== getting info ==== | ||
| + | set print pretty on | ||
| * p[rint] < | * p[rint] < | ||
| * p * < | * p * < | ||
| Line 15: | Line 25: | ||
| * p < | * p < | ||
| * p < | * p < | ||
| + | * p ((sturct dummy*)variable)[0] - Dump structure members | ||
| * ptype var | * ptype var | ||
| * x /100bx m - eXamine memory located by variable m, print 100 bytes in hex format | * x /100bx m - eXamine memory located by variable m, print 100 bytes in hex format | ||
| Line 39: | Line 50: | ||
| * cond[ition] 1 < | * cond[ition] 1 < | ||
| * cond 1 - Remove condition from breakpoint 1 | * cond 1 - Remove condition from breakpoint 1 | ||
| + | |||
| + | Add to C code to catch timing critical issues: | ||
| + | <code c> | ||
| + | if (p_queue-> | ||
| + | __BKPT(8); | ||
| + | } | ||
| + | </ | ||
| ==== stepping ==== | ==== stepping ==== | ||
| - | * s [tep] | ||
| - | * c [ontinue] < | ||
| - | * n [ext] - to next line | ||
| - | * fin [ish] - execute until stack frame returns | ||
| - | * u [ntil] <line number> - execute to line (to avoid loops) | ||
| + | * **s** [tep] - step to next **source** line | ||
| + | * **c** [ontinue] < | ||
| + | * **n** [ext] - step (do not enter to subroutines) | ||
| + | * **fin** [ish] - execute until stack frame returns | ||
| + | * **u** [ntil] <line number> - execute to line (to avoid loops) | ||
| + | | ||
| + | Skip current command: | ||
| + | < | ||
| + | tbreak +1 | ||
| + | jump +1 | ||
| + | </ | ||
| ==== infos ==== | ==== infos ==== | ||
| * show debug-file-directory | * show debug-file-directory | ||
| Line 54: | Line 78: | ||
| * thread 4 - switch to thread 4 | * thread 4 - switch to thread 4 | ||
| * print mutex | * print mutex | ||
| + | * info line - print current code line | ||
| + | * frame - print current execution position and code | ||
| ==== OpenOCD ==== | ==== OpenOCD ==== | ||
| Line 109: | Line 135: | ||
| </ | </ | ||
| + | < | ||
| + | # Add GDB access to mem range where VTOR is located | ||
| + | mem 0xE0000000 0xE00FFFFF | ||
| + | |||
| + | define bootapp | ||
| + | monitor reset halt | ||
| + | # Adjust VTOR (Vector table offset register) | ||
| + | set {int}0xE000ED08 = & | ||
| + | # Set SP/PC to the values from the actual vector table | ||
| + | set $sp = *(int*)& | ||
| + | set $pc = *((int*)(& | ||
| + | end | ||
| + | </ | ||
| ==== symbols ==== | ==== symbols ==== | ||
| * set symbol-reloading on | * set symbol-reloading on | ||