简体   繁体   English

使用 PowerShell(或命令提示符)进行调试

[英]Debugging with PowerShell (or Command Prompt)

I am working on a project with multiple compiled.exe files.我正在处理一个包含多个 compiled.exe 文件的项目。 They are mostly compiled in C++, but we also have JavaScript, XML, XSD, and XSL files.它们大多编译在 C++ 中,但我们也有 JavaScript、XML、XSD 和 XSL 文件。 Debugging JavaScript is fairly straight forward since I can easily open the debugger tool on the browser.调试 JavaScript 相当简单,因为我可以轻松地在浏览器上打开调试器工具。 However, I am unsure how to debug the.exe files compiled in C++.但是,我不确定如何调试在C++中编译的.exe文件。

Since I am on a windows operating system, is there a way to use PowerShell (or Command Prompt) to debug the files?由于我在 windows 操作系统上,有没有办法使用 PowerShell(或命令提示符)来调试文件? I've compiled the files in debug mode in Visual Studio (I'm assuming that is required).我已经在 Visual Studio 中以调试模式编译了这些文件(我假设这是必需的)。 This is not a project that can be debugged in Visual Studio.这不是可以在 Visual Studio 中调试的项目。

An example on debugging a simple program such as "Hello World" would be greatly appreciated.将不胜感激关于调试诸如“Hello World”之类的简单程序的示例。

Not an expert on.exe files, so there could be something I'm missing, but generally speaking if you're compiling C++, they're being compiled to machine code - just a step above binary.不是 .exe 文件的专家,所以我可能会遗漏一些东西,但一般来说,如果您正在编译 C++,它们将被编译为机器代码 - 仅比二进制文件高出一步。 You won't be able to see the functions, variables, classes, etc. because it's all basically binary now.您将看不到函数、变量、类等,因为它们现在基本上都是二进制的。 Compilation is an irreversible process - you can't get the original C++ code back.编译是一个不可逆的过程——你无法取回原来的 C++ 代码。

JavaScript that's shipped to the browser is different in that browsers expect actual JavaScript code, rather than something compiled (though you can still compile JavaScript for an operating system with something like Node.JS).发送到浏览器的 JavaScript 的不同之处在于浏览器期望实际的 JavaScript 代码,而不是编译的代码(尽管您仍然可以为具有 Node.JS 之类的操作系统编译 JavaScript)。

If you're trying to change those executables, you'll need the original source code.如果您试图更改这些可执行文件,您将需要原始源代码。

No, PowerShell can't be used to debug binary files.不,PowerShell 不能用于调试二进制文件。 It can only debug PowerShell scripts.只能调试PowerShell个脚本。

If you compile your applications to produce outputs that can be used for debugging, then it's another matter.如果您编译应用程序以生成可用于调试的输出,那就是另一回事了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM