Giter VIP home page Giter VIP logo

Comments (1)

feicong avatar feicong commented on August 28, 2024

在进入foo()这个调用时,call指令会将下一乖指令的地址压入堆栈,进入调用后,push rbpmov rbp, rsp后,[rbp + 0x8]指向的是call后的返回地址。

你不清楚一个问题时,最好的方法是自己运行调试,看结果:


(lldb) po *(unsigned long long*)($rbp+ 0x8)
4294971239

(lldb) p/x *(unsigned long long*)($rbp+ 0x8)
(unsigned long long) $5 = 0x0000000100000f67
(lldb) disas -a 0x0000000100000f67
hello`main:
    0x100000f30 <+0>:  push   rbp
    0x100000f31 <+1>:  mov    rbp, rsp
    0x100000f34 <+4>:  sub    rsp, 0x8
    0x100000f38 <+8>:  mov    edi, 0x1
    0x100000f3d <+13>: mov    esi, 0x2
    0x100000f42 <+18>: mov    edx, 0x3
    0x100000f47 <+23>: mov    ecx, 0x4
    0x100000f4c <+28>: mov    r8d, 0x5
    0x100000f52 <+34>: mov    r9d, 0x6
    0x100000f58 <+40>: push   0xb
    0x100000f5a <+42>: push   0xa
    0x100000f5c <+44>: push   0x9
    0x100000f5e <+46>: push   0x8
    0x100000f60 <+48>: push   0x7
    0x100000f62 <+50>: call   0x100000f00               ; foo
    0x100000f67 <+55>: add    rsp, 0x30
    0x100000f6b <+59>: mov    rcx, rax
    0x100000f6e <+62>: lea    rdi, [rip + 0x31]         ; "%lld\n"
    0x100000f75 <+69>: xor    eax, eax
    0x100000f77 <+71>: mov    rsi, rcx
    0x100000f7a <+74>: call   0x100000f84               ; symbol stub for: printf
    0x100000f7f <+79>: xor    eax, eax
    0x100000f81 <+81>: pop    rbp
    0x100000f82 <+82>: ret

from macbook.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.