嵌入式arm linux環境中gdb+gdbserver調試
編譯過程中碰到的問題:
嵌入式 編譯gdb源碼時出現“set but not used [-Werror=unused-but-set-variable]”問題的解決辦
gdbserver: linux-x86-low.c error: sys/reg.h: No such file or directory
gdbserver 調試時gdb運行c時崩潰不能正常調試
當使用gdb+gdbserver方式調試動態程序時,出現如下錯誤:
GDB: Unable to find dynamic linker breakpoint function.
解決方法:
set sysroot /absolute/path/to/copy/of/target/root/filesystem
我的方式:
set sysroot /workteam/yinguicai/data/rootfs/20a target remote 10.15.3.199:1234 handle SIG32 nostop noprint handle SIG33 nostop noprint
注意:如果是可執行程序是靜態編輯則沒有這個告警,但依然解決不了watch問題
(gdb) p &n $2 = (int *) 0xbefdec70 (gdb) dis (gdb) watch *((int *) 0xbefdec70) Hardware watchpoint 2: *((int *) 0xbefdec70) (gdb) c Continuing. Warning: Could not insert hardware watchpoint 2. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints.
交叉編譯GDB工具, 使GDB運行在嵌入式板子上
Child terminated with signal = 5
Child terminated with signal = 0x5 (SIGTRAP)
GDBserver exiting
yinguicai@Cpl-IBP-Product:~/data/nfs$ ./arm-linux-gdb hicore_20a
GNU gdb (GDB) 7.3
Copyright (C) 2011 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=x86_64-unknown-linux-gnu --target=arm-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /data1/data_yinguicai/nfs/hicore_20a...done.
warning: Remote failure reply: E01
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x400a8e50 in ?? ()
(gdb) c
Continuing.
Cannot access memory at address 0x0
warning: Could not load shared library symbols for 9 libraries, e.g. /lib/libcrypt.so.0.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
^C
Program received signal SIGINT, Interrupt.
0x40278f60 in ?? ()
(gdb) b gui_toplevel_handle_msg_syserror
Function "gui_toplevel_handle_msg_syserror" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (gui_toplevel_handle_msg_syserror) pending.
(gdb) c
Continuing.
Cannot access memory at address 0x0
^C
Program received signal SIGINT, Interrupt.
0x40278f60 in ?? ()
(gdb) b displaySingleAudio
Cannot access memory at address 0x0
Breakpoint 2 at 0x17767c: file dataManagement/audio/wavLoader.c, line 244.
(gdb) c
Continuing.
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
The program no longer exists.
(gdb) bt
No stack.
(gdb) q