当前位置:网站首页>Separate save file for debug symbols after strip
Separate save file for debug symbols after strip
2022-06-26 19:42:00 【NoName51C_ T_ O】
Operating system environment
Linux ubuntu 3.2.0-24-generic-pae #37-Ubuntu SMP Wed Apr 25 10:47:59 UTC 2012 i686 i686 i386 GNU/Linux
background :
Generate release Version program , Conduct strip operation , however strip after , The executable program no longer has debugging information and some symbol tables . When something goes wrong , The investigation has brought great difficulties .
As the saying goes :strip The better , When something goes wrong , The worse the headache .
Purpose :
In order to balance , The symbol table is removed , When something goes wrong, you can use the symbol table . The symbol table and executable program are separated .
compiler :
gcc -g test.c -o test
Make a symbol table
objcopy --only-keep-debug test test.dbg
test.dbg: Generated symbol table file
Executable program strip
strip test -o test_release
test_release: after strip The procedure after
already strip Program adds symbol table connection
objcopy --add-gnu-debuglink=test.dbg test_release
test_release: The file already contains the symbol table name connection
here test_release Namely strip Executable program after , When an exception occurs in the program core After the document , take test.dbg Put it in test_release Same directory ,
Can directly gdb test_strip core View segment error location , It's fine too GDB Mount program , This will show more information .
If the library file is strip, You can put debugging information in '/usr/lib/debug'
Where can I put it in gdb In mode , Use command :show debug-file-directory see
Here it is. Ubuntu Tried under the platform . This method can be used for dynamic libraries and executable programs , Static libraries are not allowed strip Of , Because it will work with the final executable program strip.
In the main program of our department , This method should be no problem , Interested colleagues can try , Let the main program also realize this function , Every time release When it comes to programming , At the same time, a symbol table ,
So there won't be any more GDB There's nothing I can do .
边栏推荐
猜你喜欢
随机推荐
Record of user behavior log in SSO microservice Engineering
Filebeat安装及使用
Vscode 基础必备 常用插件
The two files are merged into a third file.
8VC Venture Cup 2017 - Final Round C. Nikita and stack
MySQL - table creation and management
C exercise. Class list plus records, display records and clear records
(几何) 凸包问题
两个文件 合并为第三个文件 。
【推荐收藏】这8个常用缺失值填充技巧一定要掌握
Redis single sign on system + voting system
Reading notes: process consulting III
问题解决:虚拟机无法复制粘贴文件
网上办理中金财富开户安全吗?
[recommended collection] these 8 common missing value filling skills must be mastered
Arduino UNO + DS1302利用31字节静态RAM存储数据并串口打印
手机影像内卷几时休?
Six necessary threat tracking tools for threat hunters
Convex hull problem
Kubernetes 资源拓扑感知调度优化









