无法在 SASM 中使用调试

问题描述 投票:0回答:0

我正在学习 NASM 并尝试调试此代码:

; jump.asm
extern printf
section .data
    number1 dq 42
    number2 dq 41
    fmt1 db "NUMBER1 >= NUMBER2",10,0
    fmt2 db "NUMBER1 < NUMBER2",10,0
section .bss
section .text
    global main
main:
    mov rbp,rsp
    push rbp
    mov rbp,rsp
    mov rax, [number1]
    mov rbx, [number2]
    cmp rax,rbx
    jge greater
    mov rdi,fmt2
    mov rax,0
    call printf
    jmp exit
greater:
    mov rdi,fmt1
    mov rax,0
    call printf
exit:
    mov rsp,rbp
    pop rbp
    ret

它构建正常,并按预期执行。但是无论我在哪里放置断点并尝试使用 Debug 选项,都会弹出某种错误并且无法进行调试。有人知道该怎么办吗? SASM 构建选项: This! 版本:

snorlax212@snorlax212-pc:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:    22.04
Codename:   jammy
snorlax212@snorlax212-pc:~$ nasm --version
NASM version 2.16.01
snorlax212@snorlax212-pc:~$ gdb --version
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
snorlax212@snorlax212-pc:~$ gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

试图添加 -F dwarf 选项,-m64 -fno-pie 选项 - 没有帮助。

assembly gcc gdb nasm sasm
© www.soinside.com 2019 - 2024. All rights reserved.