使用 GDB 调试 Ruby 程序 错误:此表达式的计算要求程序具有函数"malloc"



错误消息:evaluation of this expression requires the program to have a function "malloc".

> gdb /Users/jani/.rbenv/versions/2.0.0-p247/bin/ruby  27300
GNU gdb (GDB) 7.6.1
This GDB was configured as "x86_64-apple-darwin13.0.0".
Reading symbols from /Users/jani/.rbenv/versions/2.0.0-p247/bin/ruby...done.
Attaching to program: /Users/jani/.rbenv/versions/2.0.0-p247/bin/ruby, process 27300
[New Thread 0x1703 of process 27300]
0x0000000101fdfacf in ?? ()
(gdb) ruby_eval("puts 1")
evaluation of this expression requires the program to have a function "malloc".

有人知道吗?

从 gdb 调用"下级函数调用"(ruby_eval("put 1")位)需要 gdb 在目标进程中分配一些内存,因此它可以在其中放置堆栈帧、参数等。 为此, gdb 通常会让劣质进程运行 C 库 malloc(3) 函数。 如果 gdb 找不到 malloc,则无法调用下级函数。

相关内容

最新更新