简体   繁体   中英

computing the actual address from assembly in cmp

I am using gdb in order to debug my code, still a beginner
I wanted to know how to get the actual address
For example, given the following assembly code:
cmp %eax, 0x4(%rbp,%rbx,4)

I want to know what is being compared with %eax, in other words i want to know what is in: 0x4(%rbp,%rbx,4)

If you don't know at&t syntax, switch gdb to intel syntax using set disassembly-flavor intel . Then you will see this expression is really rbp+rbx*4+4 . Then read gdb help and you will find the x (examine memory) command and that you can access registers using $ prefix. Putting all this together, you should type x $rbp+$rbx*4+4 to see the contents.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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