首页 > 解决方案 > 由于 c++ 析构函数导致 gdb 跳转

问题描述

我的功能如下:

      int ConfigConvTensors(LayerType layer_type, bool batch_processing = false) {
        /* Construct the convolution problem */
2=>     std::list<std::string> input_coupled_vars;
        std::list<std::string> weight_coupled_vars;
        std::list<std::string> output_coupled_vars;
        ...
1=>     someOtherFunction();
        return 1;
3=>   }

使用 gdb 调试时,光标从1->2->3. 我认为这是由于析构函数。但是有没有办法告诉gdb:“不要关心析构函数调试,只管做1->3”?

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49951似乎相关,但我面临这个问题GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2

我使用的命令行:

g++ -o cost-model/src/BASE_base-objects.o -c -O0 -g -std=c++17 $BunchOfLinkerAndIncludeFlags cost-model/src/BASE_base-objects.cpp

标签: c++gdbdestructor

解决方案


看看生成的代码,它可以提供一些关于正在发生的事情的洞察力,可以是某种优化。 https://visualgdb.com/gdbreference/commands/disassemble


推荐阅读