solib-absolute-prefix 和solib-search-path的区别
来源:互联网 发布:网络安全教育心得体会 编辑:程序博客网 时间:2024/05/16 05:55
solib-absolute-prefix 和solib-search-path是 gdb比较常用的选项,用来设置符号文件的位置。
那么,它们有什么区别呢?
solib-absolute-prefix设置的是被搜索文件路径的前缀,solib-search-path设置的是被搜索文件的路径。
solib-search-path可以有多个路径,中间按用:隔开, solib-absolute-prefix的值只能有一个。
下面以一个例子说明。
先载入一个 core dump文件:
- (gdb) core-file core
- [New LWP 489]
- warning: Could not load shared library symbols for 2 libraries, e.g. /mnt/libshared.so.
- Use the "info sharedlibrary" command to see the complete listing.
- Do you need "set solib-search-path" or "set sysroot"?
- Core was generated by `./main'.
- Program terminated with signal 11, Segmentation fault.
- #0 0x2ac02508 in ?? ()
- (gdb) info sharedlibrary
- From To Syms Read Shared Object Library
- No /mnt/libshared.so
- No /lib/libc.so.6
- 0x2ab417e0 0x2ab52bf0 Yes (*) /home/charles/code/gcc-arm-2012.04-linux/arm-linux-gnueabi/libc/lib/ld-linux.so.3
- (*): Shared library is missing debugging information.
假设当前目录下有文件 libshared.so, 可以执行下面的命令:
- (gdb) set solib-search-path .
- Reading symbols from /home/charles/libshared.so...done.
- Loaded symbols for /home/charles/libshared.so
再看下动态库的加载情况:
- (gdb) info sharedlibrary
- From To Syms Read Shared Object Library
- 0x2ac0240c 0x2ac02510 Yes /home/charles/libshared.so
- No /lib/libc.so.6
- 0x2ab417e0 0x2ab52bf0 Yes (*) /home/charles/code/gcc-arm-2012.04-linux/arm-linux-gnueabi/libc/lib/ld-linux.so.3
- (*): Shared library is missing debugging information.
还有一个没有载入。
假设文件 libc.so.6在 /media/DATA/lib/libc.so.6下:
- ~$ ls /media/DATA/lib/ -l
- total 860
- -rw------- 1 charles charles 876656 Nov 18 03:56 libc.so.6
这时,可以用 solib-absolute-path。
- (gdb) set solib-absolute-prefix /media/DATA
- Reading symbols from /media/DATA/lib/libc.so.6...(no debugging symbols found)...done.
- Loaded symbols for /media/DATA/lib/libc.so.6
这时,gdb用前缀 /media/DATA + /lib/libc.so.6,就找到了文件。
/lib 是可执行文件在 目标机上 link libc.so.6的位置。
- (gdb) bt full
- #0 0x2ac02508 in fun () at testsharedlib.c:3
- No locals.
- #1 0x00008570 in main () at main.c:6
- No locals.
- (gdb) l *0x2ac02508
- 0x2ac02508 is in fun (testsharedlib.c:3).
- 1 void fun(void)
- 2 {
- 3 *(int *)0 = 0;
- 4 }
0 0
- solib-absolute-prefix 和solib-search-path的区别
- solib-absolute-prefix 和solib-search-path的区别
- solib-absolute-prefix 和solib-search-path的区别
- solib-absolute-prefix 和solib-search-path的区别
- solib-absolute-prefix 和solib-search-path的区别
- GDB: solib-absolute-prefix vs. solib-search-path
- gdb:加载共享库的符号表 solib-search-path
- get solib maps
- relative 和 absolute 的位置区别
- position:relative和position:absolute的区别
- position属性absolute和relative的区别
- CSS中absolute和relative的区别
- 环境变量Path和Class path的区别
- linear search 和 binary search的区别
- HTML相对路径(Relative Path)和绝对路径(Absolute Path)
- HTML相对路径(Relative Path)和绝对路径(Absolute Path)
- HTML相对路径(Relative Path)和绝对路径(Absolute Path)
- HTML相对路径(Relative Path)和绝对路径(Absolute Path)
- 《Xcode基本用法》手机App图标与开机动画图片的设置
- 二叉查找树的插入与有序输出
- spring+mybatis报错: 使用junit测试通过。。 使用maven打包出错。。
- ArgumentException vs FormatException
- 进程间通信方式
- solib-absolute-prefix 和solib-search-path的区别
- 直接插入排序
- 有些人无法在Google Play上找到我的应用,怎么办?
- 异步I/O的提升应用程序的性能分析
- 小马哥-----高仿红米note刷机 单卡4G版 6589芯片 2015新版机型 主板型号为t8907 W8907 警惕
- NULL和“” 的区别
- 同余定理
- Swift语法基础:16 - Swift的数组, 字典
- 儿童生命过程中的一个秘密——敏感期