1

Before explaining my problem:
My OS is Ubuntu 12.04 LTS 32bits with 4GB RAM.
My IDE is Code::Blocks 12.11(I've had the same problem with 10.05)
I'm using the GNU GCC Compiler with the -g flag and the -std=c++0x flag.

When trying to debug this program:

using namespace std;

#include<iostream>

int main(){

int n=10;

for(int i=1;i<=n;i++){
    int ax=i;
    while(ax) ax--;
    cout<<i;
}


return 0;
}

I can't get anything to happen,if I try the "Run to cursor" command or if I try to use breakpoints. They just get skipped and my program finishes running.

This is what I get in the debugger log:

Building to ensure sources are up-to-date
Selecting target:
Release
Adding source dir: /home/classius/CodeBlocks/Dr/
Adding source dir: /home/classius/CodeBlocks/Dr/
Adding file: /home/classius/CodeBlocks/Dr/bin/Release/Dr
Changing directory to: /home/classius/CodeBlocks/Dr/.
Set variable: LD_LIBRARY_PATH=.:
Starting debugger: /usr/bin/gdb -nx -fullname -quiet -args /home/classius/CodeBlocks/Dr/bin/Release/Dr
done
Registered new type: wxString
Registered new type: STL String Registered new type: STL Vector
Setting breakpoints
Reading symbols from /home/classius/CodeBlocks/Dr/bin/Release/Dr...(no debugging symbols found)...done.
Debugger name and version: GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
No symbol table is loaded. Use the "file" command.
Temporary breakpoint 2 ("/home/classius/CodeBlocks/Dr/main.cpp:10) pending.
[Inferior 1 (process 13381) exited normally]
Debugger finished with status 0

If anyone wants to suggest a solution that implies using the terminal, please do it in the most noob-orieted terms you can find!
PS: How to add breaklines on stack-overflow when asking a question?(Solved-Thanks!)

4

2 回答 2

0

从 /home/classius/CodeBlocks/Dr/bin/Release/Dr...读取符号(未找到调试符号)...完成。

这意味着您在编译期间没有 -g 选项。

更新:

file /home/classius/CodeBlocks/Dr/bin/Release/Dr 

/home/classius/CodeBlocks/Dr/bin/Release/Dr: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x7da8c5cff4af5082d82eecc3ede59a5920b253a0, stripped 

所以它被“剥离”了,这意味着 -g 选项没有真正使用。您可以重新检查您的编译器配置或尝试构建调试版本?

于 2013-10-28T07:05:40.007 回答
0

在设置菜单中选择调试器,然后选择 gdb-cdb 选项卡,然后重置默认值

于 2018-07-01T08:00:48.840 回答