example
hylai@APC002 /cygdrive/d/mycode/patch $ nds32le-elf-gdb.exe GNU gdb (2012-03-16) 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i686-mingw32 --target=nds32le-elf". source E:\Andestech\AndeSight200MCU\toolchains\nds32le-elf-newlib-v2\bin\.Andes dbinit (gdb) target remote:1234 Remote debugging using :1234 0x00016e02 in ?? () core0(gdb) target remote:1234 A program is being debugged already. Kill it? (y or n) y
Remote debugging using :1234 0x00016da6 in ?? () core0(gdb) file mainprog.adx A program is being debugged already. Are you sure you want to change the file? (y or n) y Reading symbols from d:\mycode\patch\mainprog.adx...done. core0(gdb) load Loading section .nds32_init, size 0x4 lma 0x500000 Loading section .init, size 0xc lma 0x500004 Loading section .text, size 0x9518 lma 0x500010 Loading section .rodata, size 0x338 lma 0x509528 Loading section .eh_frame, size 0x34 lma 0x509860 Loading section .ctors, size 0x4 lma 0x509894 Loading section .dtors, size 0x4 lma 0x509898 Loading section .jcr, size 0x4 lma 0x50989c Loading section .data, size 0x870 lma 0x5098a0 Loading section .sdata_w, size 0x38 lma 0x50a110 Loading section .sdata_b, size 0x3 lma 0x50a148 Loading section FUNC_TABLE, size 0xc lma 0x510000 Start address 0x500010, load size 41303 Transfer rate: 433 KB/sec, 2950 bytes/write. core0(gdb) file patch.adx A program is being debugged already. Are you sure you want to change the file? (y or n) y
Load new symbol table from "d:\mycode\patch\patch.adx"? (y or n) y Reading symbols from d:\mycode\patch\patch.adx...done. core0(gdb) load Loading section FUNC_TABLE, size 0xc lma 0x510000 Loading section FUNC_PATCH, size 0x38 lma 0x510020 Start address 0x500010, load size 68 Transfer rate: 544 bits in <1 sec, 34 bytes/write. core0(gdb) file mainprog.adx A program is being debugged already. Are you sure you want to change the file? (y or n) y
Load new symbol table from "d:\mycode\patch\mainprog.adx"? (y or n) y Reading symbols from d:\mycode\patch\mainprog.adx...done. core0(gdb)add-symbol-file patch.adx 0x500000 -s FUNC_TABLE 0x510000 -s FUNC_PATCH 0x510020 add symbol table from file "patch.adx" at .text_addr = 0x500000 FUNC_TABLE_addr = 0x510000 FUNC_PATCH_addr = 0x510020 (y or n) y Reading symbols from d:\mycode\patch\patch.adx...warning: Lowest section in d:\ ycode\patch\patch.adx is FUNC_TABLE at 00510000 warning: section .text not found in d:\mycode\patch\patch.adx done. core0(gdb) set $pc=0x500000 core0(gdb) b main Breakpoint 1 at 0x50010c: file ../main.c, line 20. core0(gdb) c Continuing.
Breakpoint 1, main () at ../main.c:20 20 printf("func1(30)=%d\n",jump_table.func_a(30)); core0(gdb) s func1 (x=30) at ../main.c:28 28 return x*num1; core0(gdb) n 29 } core0(gdb) s main () at ../main.c:21 21 printf("func2(30)=%d\n",jump_table.func_b(30)); core0(gdb) s func2 (x=30) at ../patchprog.c:24 24 return x*num2*100; core0(gdb)
|