???C++?????洢???
???????????? ???????[ 2013/2/21 10:18:34 ] ????????
???????????????????????????????е???????????????????C++???????WinDbg??????????C++?????????洢????
??????????????????C++??????洢???? ?????????????????
#include <iostream>
using namespace std;
const char* global_const_string = "hello world";
int global_int = 20;
static int global_static_int = 30;
int main()
{
static int local_static_int = 100;
int local_int = 200;
int* pValue = new int(300);
cout << global_const_string << global_int
<< global_static_int << local_static_int
<< local_int << *pValue;
delete pValue;
system("pause");
return 0;
}
??????????????????????????????????????????????е?????????????????????????????????????????new??????????????????η???????????????洢????
?????????????WinDbg???????????????????????consoleTest.exe.
?????????????????consoleTest.exe?????????????????????????????????address????
* 400000 401000 1000 MEM_IMAGE MEM_COMMIT PAGE_READONLY Image "ConsoleTest.exe"
|- 401000 41d000 1c000 MEM_IMAGE MEM_COMMIT PAGE_EXECUTE_READ Image "ConsoleTest.exe"
|- 41d000 422000 5000 MEM_IMAGE MEM_COMMIT PAGE_READONLY Image "ConsoleTest.exe"
|- 422000 426000 4000 MEM_IMAGE MEM_COMMIT PAGE_WRITECOPY Image "ConsoleTest.exe"
|- 426000 427000 1000 MEM_IMAGE MEM_COMMIT PAGE_READONLY Image "ConsoleTest.exe"
???????????consoleTest.exe?????????е?????????0x400000???????????????!dh 0x400000?????????????????????????????????ó?????????
??????? 400000 - 401000 : PE???????????????
??????? 401000 - 41d000 : .text?? ?????????????У?????????
??????? 41d000 - 422000 : .rdata?? ??????????? ??????????
??????? 422000 - 426000 : .data?? ??????д???????????????д????
??????? 426000 - 427000 : .rsrc?? ???????????????????
???????!address -f:stack????????????????
0:000> !address -f:stack
BaseAddr EndAddr+1 RgnSize Type State Protect Usage
-------------------------------------------------------------------------------------------
40000 13d000 fd000 MEM_PRIVATE MEM_RESERVE Stack [8b0.1d0; ~0]
13d000 13e000 1000 MEM_PRIVATE MEM_COMMIT PAGE_READWRITE|PAGE_GUARD Stack [8b0.1d0; ~0]
13e000 140000 2000 MEM_PRIVATE MEM_COMMIT PAGE_READWRITE Stack [8b0.1d0; ~0]
????????????????????????????????13e000 - 140000
?????????????????????????????????洢???????x consoletest!global*????????????г???????consoletest?????global????????????
0:000> x consoletest!global*
00422000 ConsoleTest!global_const_string = 0x0041d1dc "hello world"
00422004 ConsoleTest!global_int = 0n20
00422008 ConsoleTest!global_static_int = 0n30
004238a0 ConsoleTest!global_locale = 0x00000000
??????

???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11