gpt4 book ai didi

c++ - 如何使用 gdb 查找 g++ 代码中的浮点异常

转载 作者:太空狗 更新时间:2023-10-29 23:38:01 25 4
gpt4 key购买 nike

我有一个无需用户输入即可运行的 g++ 程序。程序在某处中断并显示“浮点异常”。 gdb 能帮我找出代码中的原因吗?怎么办?

最佳答案

您可以在 GDB here 上获得帮助和 at Gnu's site here .

但基础是这样的:

$ gdb ./your_program             // start gdb on the program
> run // run the program
> run argv1 argv2 // or run it with command line arguments
(floating point exception) // let it run until exception occurs
> bt // bt will show the stack trace

这里有一些关于如何确保它在 floating point exceptions 上停止的 gdb 设置。 .

关于c++ - 如何使用 gdb 查找 g++ 代码中的浮点异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2792704/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com