本文介绍了gdb正在显示“程序退出”在启动期间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么gdb显示程序在启动时退出,所以之前停在主函数的第一个断点?



一些步骤:

  $ gdb --cd $ programhome -tui -tty $ reservedtty --args myprogram 

b main
r

gdb显示:

 



>我已经尝试在exit()函数处中断,但没有成功。

解决方案

访问辅助终端端口。


$ b gdb正在使用参数 -tty 启动,它将输入/输出切换到另一个tty端口(in该案例伪:pts)。

当两个终端用不同的用户打开时,即使在第一次登录后,用 su 命令,第一个登录的用户需要在两个ttys中保持一致。


Why is gdb showing that the program exited during its startup, so before to stop at the first breakpoint in the main function ?

Some steps:

$ gdb --cd $programhome -tui -tty $reservedtty --args myprogram

b main
r

gdb shows:

Starting program: myprogram
During startup program exited with code 1.

I already tried to break at exit() function, without success.

解决方案

There was a permission issue accessing the secondary terminal port.

The gdb is being started with the parameter -tty which switches the input/output to another tty port (in that case pseudo: pts).

When the two terminals are opened with different users, that problem occurs, even if after the first logon you change the user with su command, the first user logged needed to be the same among the two ttys.

这篇关于gdb正在显示“程序退出”在启动期间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 19:05