首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用WindowsSDK7.1使用mdbg调试简单C代码

用WindowsSDK7.1使用mdbg调试简单C代码
EN

Stack Overflow用户
提问于 2014-02-11 19:49:37
回答 1查看 230关注 0票数 0

这听起来很简单,但我就是不能让它起作用。我安装了WindowsSDK7.1并打开了WindowsSDK7.1命令提示符。

我有一个代码test.c,如下所示:

代码语言:javascript
复制
#include <stdio.h>
#include <math.h>

void main()
{
    int i;
    for(i=1; i<10; i++)
        printf("Hello world! This is line %d \n", i);
}

现在我想调试它。我第一次编译时使用的是:

代码语言:javascript
复制
cl test.c /Z7

然后,打开:

代码语言:javascript
复制
mdbg test.exe

接下来发生的是:

代码语言:javascript
复制
MDbg (Managed debugger) v4.0.30319.1 (RTMRel.030319-0100) started.
Copyright (C) Microsoft Corporation. All rights reserved.

For information about commands type "help";
to exit program type "quit".
run test.exe
Hello world! This is line 1
Hello world! This is line 2
Hello world! This is line 3
Hello world! This is line 4
Hello world! This is line 5
Hello world! This is line 6
Hello world! This is line 7
Hello world! This is line 8
Hello world! This is line 9
STOP: Process Exited

它直接跑到最后,一点也不停。我甚至没有机会设置断点..。

我该怎么办?

非常感谢大家。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-12 05:34:02

你为此使用了错误的工具。Mdbg (顾名思义)是一个托管调试器,因此它可以使用.NET程序集,并且您正在尝试调试本机应用程序。我建议使用windbgcdb (如果您更喜欢命令行调试器)。这两种工具在Windows中都是免费的-只需安装Windows调试工具即可。他们也有很好的文件。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21711595

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档