简体   繁体   English

如何获取gdb来分解整个函数?

[英]How can I get gdb to disassemble an entire function?

When I write things in assembly that involve jumps, I do something along the lines of: 当我在汇编中编写涉及跳转的内容时,我会执行以下操作:

fucntion: 
  cmp $1, %rax
  je cond
  mov $0 %rdi
  jmp end
cond:
  mov $1, %rdi
end:
  mov $60, %rax
  syscall

The problem is that when I use gdb and type disas function I will only see function up until cond . 问题是,当我使用gdb并键入disas function function ,直到cond我才会看到该function However, if I were to write a similar c program, jump statements in the disassembled program would look like jmp ADDRESS <function+xx> and typing disas function will show me every line of the function. 但是,如果我要编写类似的c程序,则反汇编程序中的跳转语句将看起来像jmp ADDRESS <function+xx> ,键入disas function将显示该函数的每一行。

How can I get gdb to behave similarly with my assembly programs? 如何使gdb在汇编程序中具有相似的行为? Is there a flag with the assembler or linker that would make the program's jumps look more like the c program? 汇编程序或链接程序中是否有标志,使程序的跳转看起来更像c程序? Or would I have to change the way I write assembly? 还是我必须更改编写汇编的方式? Basically I just want to be able to type disas function and get the entire function outputted. 基本上,我只希望能够输入disas function并输出整个功能。

The proper way is to specify the extent of your function. 正确的方法是指定功能范围。 Append 附加

.size function, . - function

at the end. 在末尾。

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

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