当前位置:网站首页>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 .
边栏推荐
猜你喜欢
随机推荐
Arduino UNO + DS1302利用31字节静态RAM存储数据并串口打印
Wechat applet custom pop-up components
Tiktok practice ~ search page ~ video details
Can I open an account online? Is it safe?
【Mysql系列】工作常用sql集锦(持续更新)
When does the mobile phone video roll off?
BOM and DOM operations
郭明錤:苹果 AR / MR 头显是其有史以来设计最复杂的产品,将于 2023 年 1 月发布
To: Apple CEO Cook: great ideas come from constantly rejecting the status quo
9. Intelligent transportation project (2)
手机影像内卷几时休?
Reading notes: process consulting III
Selection of database paradigm and main code
Project practice 6: distributed transaction Seata
Some basic mistakes
项目实战五:搭建ELk日志收集系统
Boot indicator monitoring
论数据库的传统与未来之争之溯源溯本----AWS系列专栏
Guomingyu: Apple's AR / MR head mounted display is the most complicated product in its history and will be released in January 2023
Minimum spanning tree, shortest path, topology sorting, critical path









