一个c语言程序的debug

一个c语言程序的debug,第1张

#include <stdioh>

#include <stdlibh> 

typedef struct Dunode{

    int data;

    struct Dunode prior, next;

} Dunode, Dunodeptr;

Dunodeptr CreateNode(int j, Dunodeptr pri, Dunodeptr n){

    Dunodeptr i = (Dunodeptr)malloc(sizeof(Dunode));

    if (i){

        i->prior = pri;

        i->next = n;

        //原没有此项,在此添加

        i->data = j;

    }

    //原没有返回值,在此添加

    return i;

}

void print(Dunodeptr h){

    Dunodeptr i;

    i = h;

    while (i != NULL){

        printf("%d", i->data);

        i = i->next;

    }

}

int main(){

    Dunodeptr n1, n2, n3, n4;

    n1 = CreateNode(1, NULL, NULL);

    n2 = n1->next = CreateNode(2, n1, NULL);

    n3 = n2->next = CreateNode(3, n2, NULL);

    n4 = n3->next = CreateNode(4, n3, NULL);

    print(n1);

}

最基本的 *** 作是:

1首先在一个java文件中设断点,然后debug as-->open debug Dialog,然后在对话框

中选类后--> Run

程序走到断点处就会转到debug视图下。

2F5键与F6键均为单步调试,F5是step into,也就是进入本行代码中执行,F6是step over

也就是执行本行代码,跳到下一行,

3F7是跳出函数

4F8是执行到最后。

1Step Into (also F5) 跳入

2Step Over (also F6) 跳过

3Step Return (also F7) 执行完当前method,然后return跳出此method

4step Filter 逐步过滤 一直执行直到遇到未经过滤的位置或断点(设置Filter:window-

preferences-java-Debug-step Filtering)

5resume 重新开始执行debug,一直运行直到遇到breakpoint

6hit count 设置执行次数 适合程序中的for循环(设置 breakpoint view-右键hit count)

7inspect 检查 运算。执行一个表达式显示执行值

8watch 实时地监视变量的变化

9我们常说的断点(breakpoints)是指line breakpoints,除了line breakpoints,还有其他的断点

类型:field(watchpoint)breakpoint,method breakpoint,exception breakpoint

10field breakpoint 也叫watchpoint(监视点) 当成员变量被读取或修改时暂挂

11添加method breakpoint 进入/离开此方法时暂挂(Run-method breakpoint)

12添加Exception breakpoint 捕抓到Execption时暂挂(待续)

断点属性:

1hit count 执行多少次数后暂挂 用于循环

2enable condition 遇到符合你输入条件(为ture\改变时)就暂挂

3suspend thread 多线程时暂挂此线程

4suspend VM 暂挂虚拟机

13variables 视图里的变量可以改变变量值,在variables 视图选择变量点击右键--change

value一次来进行快速调试。

14debug 过程中修改了某些code后--〉save&build-->resume-->重新暂挂于断点

方法/步骤

打开MyEclipse,打开其中任意项目并打开一个类双击左侧使出现圆点

然后启动tomcat,运行的该圆点处的时候,程序就会停下来

以上就是关于一个c语言程序的debug全部的内容,包括:一个c语言程序的debug、eclipse debug调试,在代码中的那个跟踪光标没有了,怎么设置、如何使用myeclipse中debug功能调试程序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/10119567.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-05
下一篇2023-05-05

发表评论

登录后才能评论

评论列表(0条)

    保存