更新的静态库,现在应用程序在堆栈之前退出。如何调试

时间:2010-09-24 17:11:12

标签: static gdb exit

我正在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.

1 个答案:

答案 0 :(得分:0)

它看起来像一些名为exit(1)的代码或者返回1,所以我首先在main的开头放一个断点,然后逐步调用退出处理程序,或者在退出处理程序中断。