c - pusha汇编语言指令

标签 c compiler-construction assembly gdb core

我有一个核心转储,其中堆栈已损坏。 我试着拆开它,发现以下请帮助我分析它..

(gdb) bt
#0  0x55a63c98 in ?? ()
#1  0x00000000 in ?? ()

(gdb) disassemble 0x55a63c90 0x55a63ca8

Dump of assembler code from 0x55a63c90 to 0x55a63ca8:

0x55a63c90:     add    %cl,%dh

0x55a63c92:     cmpsb  %es:(%edi),%ds:(%esi)

0x55a63c93:     push   %ebp

0x55a63c94:     add    %al,(%eax)

0x55a63c96:     add    %al,(%eax)

**0x55a63c98:     pusha**

0x55a63c99:     lret   $0x9

0x55a63c9c:     subb   $0x56,0xd005598(%ebp)

0x55a63ca3:     push   %ebp

0x55a63ca4:     jo     0x55a63cc5

0x55a63ca6:     sahf

0x55a63ca7:     push   %ebp

End of assembler dump.
(gdb) q

这个 pusha 指令可以导致核心转储吗?

最佳答案

*,pusha所做的就是将所有通用寄存器压入堆栈,包括堆栈指针!导致核心转储的是 pusha 之后的指令 lret,它是一个带有堆栈弹出的长返回。返回地址是压入堆栈的最新值,在本例中,它是 esi:edi 中的任何内容(因为它们是 pusha 指令压入的最后一个值),并且很可能指向某个随机位置。

* 除非你用完堆栈空间。

关于c - pusha汇编语言指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2279865/

相关文章:

c++ - 计算嵌入式C中代码块的时钟周期

C 在 Union 中改变值

c++ - 默认参数值错误 [Visual C++ 2008 中的错误?]

c - C 中的数据验证 - 确保输入格式正确

scala - Scala 的模式匹配器执行了多少优化?

python - 编译器 : How to parse function calls and function definitions

assembly - x86组装极限新手查询: "invalid instruction operands"?

assembly - AT&T Assembly Printing 来控制台 Segfault

c - 列 "symbol"显示地址而不是函数名

iphone - 如何在 iOS 设备上编译 ARM 汇编文件和 iOS 模拟器使用常规 C 之间进行选择