调试 c++已发布软件的核心文件
我正在尝试找到一种方法来调试从我的软件发布版本(使用 gcc 编译的 c++ 代码)发送给我的核心文件。理想情况下,我希望能够部署发布版本,并保留手头的调试版本以用于调试,因此我有符号表等。
我的问题是(据我所知)调试和发布版本不是保证是相同的 - 因此当我启动 gdb 并指向我的调试可执行文件时,现场的核心文件可能看起来像垃圾。
有没有办法解决这个问题(这是问题)而不影响我发布的软件的大小或性能?这是一个大型应用程序,调试版本的性能可能无法被客户接受。我已经查看了构建一次(调试)的建议,然后删除符号表并将其作为发布版本发布,但我会看到这种方法对性能的影响,不是吗?
有没有人对他们已经尝试过或当前使用的解决此问题的方法有建议? 谢谢!
I'm trying to find a way to debug core files sent to me from released versions of my software (c++ code compiled with gcc). Ideally, I'd like to be able to deploy release builds, and keep debug builds on hand to use for debugging, so I have symbol tables, etc.
My problem is that (as I understand it) the debug and release builds are not guaranteed to be the same - so a core file from the field may just look like garbage when I fire up gdb and point to my debug executable.
Is there a way around this (and here's the catch) without impacting size or performance of my released software? It's a large application, and performance of the debug build is probably not acceptable to customers. I've looked at suggestions to build once (debug), then strip symbol tables and ship that as the release build, but I'm going to see a performance hit with that approach, won't I?
Does anyone have suggestions for things they've tried or currently use that address this problem?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在打开优化的情况下进行编译和链接,并且仍然生成调试符号 (
-O3 -g
),然后提取调试符号。这样,您就可以拥有调试符号,但可以在没有它们的情况下进行交付,并且不会出现性能损失或其他问题。请参阅 如何在构建目标之外生成 gcc 调试符号? 如何做到这一点。You can compile and link with optimization turned on and still generate debug symbols (
-O3 -g
) and then extract the debug symbols. This way you'd have the debug symbols around but can ship without them, and you won't have a performance penalty or something. See How to generate gcc debug symbol outside the build target? on how to do that.