Asterisk before an address and push instructions, where is it being pushed to?

匆匆过客 提交于 2019-12-08 12:18:57

问题


I am working on an assignment where I need to understand the compiled C Program using GDB. I'm trying to follow the instructions but am having difficulty understanding exactly what the jmp command is doing when it is jumping to an address preceded by *. I've looked where the address is located but it falls between two words. After the jump, there is a push command of a hex value. I'm only assuming that this is basically like using a pointer and the push command overwrites the byte value with hex value being pushed onto it. I'm not sure how far off I am. Here is a portion of the code I'm looking at. Since it is compiled, I've been using the x/10i $pc command (changing the amount of instructions to display depending on where I am) to view the next instructions in line.

=> 0x08048334 <+0>:     jmp    *0x8049798
   0x0804833a <+6>:     push   $0x10
   0x0804833f <+11>:    jmp    0x8048304

The second jmp proceeds to begin a chain of similar events. This is the address location that the jmp is pointing to. This is the only time I see this address in the byte-dump of the compiled C file:

 8049795:   83 04 08 3a             addl   $0x3a,(%eax,%ecx,1)
 8049799:   83 04 08 4a             addl   $0x4a,(%eax,%ecx,1)

I'd appreciate some helpful insight on if the value is actually be placed into memory location 8049798 and if so, what is it changing it to?


回答1:


I'm trying to follow the instructions but am having difficulty understanding exactly what the jmp command is doing

It appears that you are looking at the PLT jump stub. You can find detailed description here (look for "lazy binding optimization"), but this a very advanced topic, and you likely shouldn't be trying to understand that code (at least not yet).

This instruction:

jmp    *0x8049798

means: read value at location 0x8049798 and jump there.



来源:https://stackoverflow.com/questions/47025995/asterisk-before-an-address-and-push-instructions-where-is-it-being-pushed-to

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!