一行线c - C ++ code在Linux操作系统Ubuntu调试 [英] Line by line c - c++ code debugging in Linux ubuntu

查看:131
本文介绍了一行线c - C ++ code在Linux操作系统Ubuntu调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu使用的gedit和终端运行的程序编码。在使用TURBOC或NetBeans的窗口中的合作,我们可以调试一行code线。我们怎样才能做到这一点在Ubuntu终端?或任何其他的选择吗?

I am coding using gedit in ubuntu and running program in terminal. While working in windows using Turboc or netbeans we can debug code line by line. How can we do it in ubuntu terminal? or any other option?

推荐答案

GDB (GNU调试器)是最好的选择。

gdb (The Gnu debugger) is best choice

的apt-get安装GDB

男人GDB

1.    cc -g file.c             //       compile your program ,this will generate a.out file with required debugging information 

2.    gdb a.out                //        start with gdb

3.    b main                   //        to set break point at main       

4.     run                     //        run now , and it will stop at break point main 

5.     s                       //        option s is to step single line and even step into functions

6.     n                       //        option n is to execute next line and step over functions  

7.     p    variable name      //        to print the value of variable at that particular instance very helpful  

男人GDB 将给予更多的信息

所有有用的gdb命令,并用简单的CPP项目为例,给出这里

All useful gdb commands and an example with simple cpp program are given Here

GDB文档

这篇关于一行线c - C ++ code在Linux操作系统Ubuntu调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆