小编j.D*_*Doe的帖子

与C++和Assembly相关,什么是ebp + 8?

我有以下C++代码:

#include <tuple>
std::tuple<int, bool> foo()
{
    return std::make_tuple(128, true);
}
int main()
{
    auto result = foo();
}
Run Code Online (Sandbox Code Playgroud)

以下是该foo()函数的反汇编版本:

push    ebp
mov     ebp, esp
sub     esp, 24
mov     BYTE PTR [ebp-13], 1  // second argument
mov     DWORD PTR [ebp-12], 128 // first argument
mov     eax, DWORD PTR [ebp+8] // what is this? why we need this here?
sub     esp, 4
lea     edx, [ebp-13]   
push    edx                   // second
lea     edx, [ebp-12]
push    edx                   // first
push    eax                  // …
Run Code Online (Sandbox Code Playgroud)

c++ x86 assembly g++ reverse-engineering

8
推荐指数
1
解决办法
552
查看次数

在汇编中查找 Main

我有简单的 C++ 程序:

#include <iostream>  
using namespace std;  
void main()  
{  
    cout << "Hello, world, from Visual C++!" << endl;  
}
Run Code Online (Sandbox Code Playgroud)

使用以下命令编译:cl /EHsc hello.cpp

我想开始调试可执行文件,如何在调试器中找到该main函数对应的汇编代码?(我使用的是x64dbg)

入口点与 Main 函数不同。我找到了 main 函数,它离入口点不近,我有字符串,我很容易找到它。

有没有任何方法或规则或最佳实践来猜测 main 相应的汇编代码在哪里?

编辑:

我有源代码,但我只是在学习 RE。

c++ debugging assembly reverse-engineering

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

assembly ×2

c++ ×2

reverse-engineering ×2

debugging ×1

g++ ×1

x86 ×1