gpt4 book ai didi

c++ - 在 GDB 中调试生成的代码时显示原始源代码

转载 作者:行者123 更新时间:2023-11-28 05:17:49 25 4
gpt4 key购买 nike

我正在编写一种编译为 C++ 的编程语言,并希望使用 GDB 进行调试。当我调试程序时,我(当然)会看到生成的代码。有没有办法让 GDB 显示创建生成代码的源文件?

最佳答案

Is there a way to hav GDB instead display the source file that created the generated code?

当然:您必须将 #line 指令发送到您生成的 C++ 中,并且您需要将已经预处理过的源代码(您很可能已经这样做了)生成到 中.ii 文件。将 .ii 文件送入 g++ 将抑制预处理,并且 g++ 将尊重它找到并发出的任何 #line 指令适当的源位置调试信息。 Documentation .

关于c++ - 在 GDB 中调试生成的代码时显示原始源代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42234485/

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