My (AT&T) assembly (x86-x64) code should increment but doesn't

前端 未结 2 563
醉梦人生
醉梦人生 2020-12-21 06:35

I\'m trying to make a small program in assembly (for AT&T). I\'m trying to get an input from the user in the form of an integer, increment it after that and then output

2条回答
  •  旧巷少年郎
    2020-12-21 07:09

    re: updated code:

    It runs and increments now, however, when the incremented value is outputed, there show up some weird signs after the value.

    Arg-passing registers are call-clobbered. You call printf without putting the format-string into %rdi, which you have to assume holds garbage after scanf returns.

    Single-step your code with a debugger. Use ni to step over calls in gdb. (See the bottom of the x86 tag wiki for GDB tips).

提交回复
热议问题