小编Jam*_*234的帖子

处理器如何知道断点?

让我们考虑这个非常简单的程序:

#include<stdio.h>

int main () 
{
    int num1=4, num2=5;
    printf("Welcome\n");
    printf("num1 + num2 = %d\n", num1+num2);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

使用以下方法查看生成的汇编代码时gcc -S prog.c:

    .file   "p.c"
    .def    ___main;    .scl    2;  .type   32; .endef
    .section .rdata,"dr"
LC0:
    .ascii "Welcome\0"
LC1:
    .ascii "num1 + num2 = %d\12\0"
    .text
    .globl  _main
    .def    _main;  .scl    2;  .type   32; .endef
_main:
LFB10:
    .cfi_startproc
    pushl   %ebp
    .cfi_def_cfa_offset 8
    .cfi_offset 5, -8
    movl    %esp, %ebp
    .cfi_def_cfa_register 5
    andl    $-16, %esp
    subl    $32, %esp
    call    ___main
    movl    $4, …
Run Code Online (Sandbox Code Playgroud)

c debugging assembly operating-system exception

9
推荐指数
1
解决办法
315
查看次数

标签 统计

assembly ×1

c ×1

debugging ×1

exception ×1

operating-system ×1