gpt4 book ai didi

c - 使用 mdbg 调试带有 Windows SDK 7.1 的简​​单 C 代码

转载 作者:太空宇宙 更新时间:2023-11-04 08:45:50 33 4
gpt4 key购买 nike

这听起来很简单,但我就是无法让它发挥作用。我安装了 Windows SDK 7.1 并打开了 Windows SDK 7.1 命令提示符。

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

#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);
}

现在我想调试它。我首先使用以下方法编译它:

cl test.c /Z7

然后,打开:

mdbg test.exe

接下来发生的是:

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

直接跑到终点,根本没有停下来。我什至没有机会设置断点...

我该怎么办?

非常感谢大家。

最佳答案

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

关于c - 使用 mdbg 调试带有 Windows SDK 7.1 的简​​单 C 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21711595/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com