I compile the following program with Visual C++ 10:
include <Windows.h>
int _tmain(int /*argc*/, _TCHAR* /*argv*/[])
{
Sleep( 0 );
return 0;
}
and look into disassembly. There're lots of C++ runtime functions in the program image. Some functions are located densely - ret
of some function is followed by the first instruction of the next function. For example,
` __declspec(noreturn) void __cdecl __report_gsfailure(ULONGLONG StackCookie)`
ends at address 004013B7
(there's a ret
instruction) and address 004013B8
contains some other function for which the debugger can't find the source. Meanwhile
BOOL __cdecl _ValidateImageBase(PBYTE pImageBase)
ends at address 00401554
but the next function
PIMAGE_SECTION_HEADER __cdecl _FindPESection( PBYTE pImageBase, DWORD_PTR rva )
starts at address 00401560
and there're multiple int 3
instructions between the latter two addresses.
Why the difference? Why some functions are put densely and others are separated with unreachable code?