更新了静态库,现在应用程序在堆栈上的任何内容之前退出。如何调试
我正在 OS X 上开发一个 unix 控制台应用程序。我刚刚更新了三个静态链接库(hdf5 及其依赖项 szip 和 z)。全部重建后,应用程序在启动后立即退出代码 1。我不知道如何在 gdb 中进一步探索这个问题,因为应用程序退出时堆栈上没有任何内容。我确实使用 otool -hv
确认所有库都是为 X86_64 架构构建的。
我可以并且已经通过恢复到以前的库二进制文件来让我的应用程序再次工作,但我想更多地了解应用程序运行的最早阶段发生了什么导致它退出。
GDB 结果如下:
gdb ./build-deb/xapp/xapp
GNU gdb 6.3.50-20050815 (Apple version gdb-1472) (Wed Jul 21 10:53:12 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ..... done
(gdb) run
Starting program: /researchSoftware/app_git/src/build-deb/xapp/xapp
Reading symbols for shared libraries .++++............................................................. done
Program exited with code 01.
(gdb) backtrace
No stack.
I am developing a unix console application on OS X. I just updated three statically linked libraries (hdf5 and its dependents szip and z). After a rebuild all, the application exits code 1 immediately after launch. I'm unaware of how to explore the problem further in gdb because nothing is on the stack by the time the app exits. I did confirm using otool -hv
that all libraries are built for X86_64 architecture.
I can, and have, gotten my app working again by reverting to the previous library binaries, but I'd like to know more about what is going on during the earliest stage of the application run that is causing it to exit.
GDB results below:
gdb ./build-deb/xapp/xapp
GNU gdb 6.3.50-20050815 (Apple version gdb-1472) (Wed Jul 21 10:53:12 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ..... done
(gdb) run
Starting program: /researchSoftware/app_git/src/build-deb/xapp/xapp
Reading symbols for shared libraries .++++............................................................. done
Program exited with code 01.
(gdb) backtrace
No stack.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它看起来像一些名为 exit(1) 或 return 1 的代码,因此我首先在 main 的开头放置一个断点,然后单步执行,直到调用退出处理程序,或在退出处理程序中中断。
It looks like some code called exit(1) or return 1 so I would start by putting a breakpoint at the start of main and stepping until the exit handler gets called, or break in the exit handler.