我想从gdb加载共享库(.so),我找到了这个命令:
(gdb) call dlopen("path/to/lib.so",..)但是它不起作用,我把我的程序和-ldl链接起来。
我得到的错误是:
No symbol "dlopen" in current context我错过了什么?
发布于 2017-02-23 00:45:56
我找到了一个命令来解决这个主题的一半问题。我解释:首先,您应该将共享对象加载到进程中:
(gdb) set environment LD_PRELOAD /usr/lib/libdl.so在此之后,我们将文件定义为debbuging
(gdb) file pgm为了测试,我们将断点放在main (即
(gdb) break main现在,我们运行程序
(gdb) run我们称之为dlopen
(gdb) call dlopen("/path/to/lib.so",2)到目前为止,它是工作,但当我放上最后一个命令时,我有:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7de7f09 in ?? () from /lib64/ld-linux-x86-64.so.2
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on".
Evaluation of the expression containing the function
(_gdb_expr) will be abandoned.
When the function is done executing, GDB will silently stop.当我将'unwindonsignal‘修改为(on/off)时,没有任何变化
这次我忘了什么?
https://stackoverflow.com/questions/42294396
复制相似问题