GDB+GdbServer: ARM程序调试

GDB+GdbServer: ARM程序调试

嵌入式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

gdbserver多线程进不去

http://sourceware.org/gdb/wiki/FAQ#GDB_does_not_see_any_threads_besides_the_one_in_which_crash_occurred.3B_or_SIGTRAP_kills_my_program_when_I_set_a_breakpoint.

原文地址:https://www.cnblogs.com/jingzhishen/p/5411183.html