insight和ddd的问题的解决
Wednesday, 13. December 2006, 08:04:56
首先解决insight的问题。在term下执行insight -i=console hello(假定要调试的程序文件名为hello),以console方式启动insight(实际上就是启动一个原始的gdb啦),然后...
(gdb) b main Breakpoint 1 at 0x4006b0: file hello.c, line 4. (gdb) r Starting program: /mnt/hda3/root/dbus/hello warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. Error while mapping shared library sections: /lib/libc.so.6: No such file or directory. Error while mapping shared library sections: /lib/ld.so.1: No such file or directory. Breakpoint 1, main () at hello.c:4 4 int a =1; (gdb) s Warning: Cannot insert breakpoint -7. Error accessing memory address 0x302e0: Input/output error. (gdb)
这个hello是我随便写的程序,巨丑陋,具体代码不贴了。在insight的GUI中其实只能在console窗口中看到"Error accessing memory address"的提示,而前面run那里的提示是看不到的。显然,在run的提示中gdb告诉了我为什么只能调试--static编译的程序,因为它没办法正确加载or使用dynamic linker(这个不知道是不是/lib/ld.so.1)顺着这条线索在网上找了n久都没找到解决方法(有人说是名为"_dl_debug_state"的符号的问题,并给了一个补丁——不过那个是对应PPC的)
既然这样,只好从源代码下手了……虽然那27M之巨的源码包的确比较吓人,十分担心可怜的狗剩和可怜的我编译一次会被折磨成什么样子……
Dynamic linker那行提示不止在一个.c里出现,于是想着把提示改得有点不同,重新编译一下看看到底对应的是哪个。
在debian网站下载源码并patch后,./configure,然后make(虽然网站上教育大家最好在新的目录里make,但在我这里make了一半会出错,所以还是直接在原来的目录里面make了)……结果出现了这样的错误
checking system version (for dynamic loading)... ./tcl/unix/configure: line 7061: syntax error near unexpected token `)' ./tcl/unix/configure: line 7061: ` OSF*)'
一开始被这个莫名其妙的错误郁闷了半天,后来还是依靠伟大的google大神找到了答案:
把tcl/unix/configure和tk/unix/configure里面出现的
system=MP-RAS-`awk '{print }' /etc/.relid'`
末尾的'号去掉,改成:
system=MP-RAS-`awk '{print }' /etc/.relid`
然后再make,同时趴在桌子上,一觉睡醒后应该就可以make完了。生成的insight文件在gdb目录下,也很肥大,有17M,可以strip后覆盖掉原来的/usr/bin/insight-bin文件。
这时还不能运行insight,会出现错误提示:
Tcl_Init failed: Can't find a usable init.tcl in the following directories:
{} /usr/share/tcl8.4 /share/tcl8.4 /usr/library /library /tcl8.4.1/library
解决的方法很简单:
#cd /usr/share #ln -s /usr/lib/tcl8.4 .
这样insight就可以运行了,而且振奋人心的是,重新编译后的insight居然完全正常……
ddd的问题没啥好说的,源代码包下回来,./configure,make,然后也可以正常使用了……
insight的源代码编译出来后得到的不只是insight,而且还包括了expect, gdb, run, gdbtui,所以make install的时候要注意。这是我编译出来的package(注意我的prefix=/usr/local):
insight-6.1-mipsel.tar.gz
这个是ddd(prefix=/opt/ddd-3.3.9/,stripped)
ddd-3.3.9-mipsel.tar.gz








mg12 # 24. February 2007, 04:50
不知道 insight 如何?