gpt4 book ai didi

debugging - 在 gdb 中附加进程时如何有选择地读取和加载符号?

转载 作者:行者123 更新时间:2023-12-04 12:48:17 26 4
gpt4 key购买 nike

我的二进制文件使用了许多不同的共享库。在使用 gdb 附加进程时,加载和读取所有这些库中的符号大约需要 5 分钟。

有没有办法在使用 gdb 附加进程时有选择地读取和加载符号?

最佳答案

您可以 set auto-solib-add off然后使用 sharedlibrary 命令有选择地加载符号。示例:

$ gdb -e ./a.out
(gdb) set auto-solib-add off
(gdb) file a.out
Reading symbols from a.out...done.
(gdb) start
Temporary breakpoint 1 at 0x4004ba: file sig.c, line 4.
Starting program: /home/a3f/a.out

Temporary breakpoint 1, main () at sig.c:4
4 do();
(gdb) print environ
No symbol "environ" in current context.
(gdb) info shared
From To Syms Read Shared Object Library
0x00007ffff7ddcae0 0x00007ffff7df5130 No /lib64/ld-linux-x86-64.so.2
No linux-vdso.so.1
0x00007ffff7a504a0 0x00007ffff7b7cc73 No /lib/x86_64-linux-gnu/libc.so.6
(gdb) sharedlibrary libc
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.19.so...done.
done.
Loaded symbols for /lib/x86_64-linux-gnu/libc.so.6
(gdb) print environ
$1 = (char **) 0x7fffffffe3b8
(gdb) print _dl_open
No symbol "_dl_open" in current context.
(gdb) sharedlibrary
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/ld-2.19.so...done.
done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
(gdb) print _dl_open
$1 = {void *(const char *, int, const void *, Lmid_t, int, char **, char **)} 0x7ffff7dee350 <_dl_open>

关于debugging - 在 gdb 中附加进程时如何有选择地读取和加载符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42374322/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com