在 Visual Studio 代码中运行 asm

5 x86 assembly att visual-studio-code

Visual Studio 代码(mac)中是否有某种插件可以运行基本程序集,例如以下内容:

.section .text
.globl _start
_start:
    movl $1, %eax
    movl $0, %ebx
    int $0x80
Run Code Online (Sandbox Code Playgroud)

实际上,目前我正在通过 ssh 连接到 linux 服务器以运行此程序集,但我希望可以从 VS 代码中构建/链接/执行此程序集,也许使用插件。

小智 1

您可以创建一个任务来汇编和链接您的代码,之后,您可以使用gdb 扩展来调试您的代码。

为了使此过程更快,如果您不知道如何操作,可以使用.vscode 文件夹

由于您使用的是 AT&T 语法,因此需要使用 Gas 选项来运行代码。

如果您仍然没有 gdb,您可以打开终端并执行:来安装它brew install gdb