开发者

An empty module has 228 symbols?

开发者 https://www.devze.com 2023-03-04 15:34 出处:网络
char_array.c: char arr[1]; int main(void) { printf(\"%s\\n\", arr); return 0; } Symbols in char_array.exe dumped by windbg:

char_array.c:

char arr[1]; 

int main(void) { printf("%s\n", arr); return 0; } 

Symbols in char_array.exe dumped by windbg:

0:000> x char_array!*
0040702c char_array!__security_cookie_complement = 0x44bf19b1
00407148 char_array!envp = 0x00000000
00405b08 char_array!uninit_postmsg = char [43] "' is being used without being initialized."
00407168 char_array!_RTC_ErrorReportFunc = 0x00000000
00407150 char_array!managedapp = 0n0
0040716c char_array!_RTC_ErrorReportFuncW = 0x00000000
00407174 char_array!_commode = 0n0
004068d0 char_array!__rtc_taa = <function> *[1]
00407178 char_array!_fmode = 0n0
004065c4 char_array!__rtc_iaa = <function> *[1]
00405000 char_array!__xc_a = <function> *[]
00405000 char_array!__xc_a = <function> *[1]
0040827c char_array!_imp____initenv = 0x10315760
00407030 char_array!mspdbName = 0x00405f88 "MSPDB80.DLL"
00405a98 char_array!_RTC_ErrorMessages = char *[6]
004074f4 char_array!__dyn_tls_init_callback = 0x00000000
00405618 char_array!__xi_z = <function> *[]
00405618 char_array!__xi_z = <function> *[1]
00407004 char_array!_RTC_ErrorLevels = int [5]
00407024 char_array!__native_vcclrit_reason = 0xffffffff
004071e8 char_array!GS_ContextRecord = struct _CONTEXT
00405410 char_array!pcinit = 0x00401240
004071e0 char_array!DebuggerWasPresent = 0n0
004074d0 char_array!__native_startup_lock = 0x00000000
00407170 char_array!_forceCRTManifestRTM = 0n0
00405e68 char_array!_RTC_errlist = char *[5]
00407020 char_array!__native_dllmain_reason = 0xffffffff
00407141 char_array!arr = char [1] ""
00407160 char_array!has_cctor = 0n0
0040715c char_array!mainret = 0n0
00407180 char_array!_newmode = 0n0
004082a8 char_array!_imp___adjust_fdiv = 0x103166cc
004074d4 char_array!__onexitend = 0x00000000
00405ab0 char_array!_RTC_NoFalsePositives = int [6]
00408248 char_array!_imp___onexit = 0x102cf660
0040530c char_array!__xi_a = <function> *[]
0040530c char_array!__xi_a = <function> *[1]
00407154 char_array!argret = 0n0
00406034 char_array!GS_ExceptionPointers = struct _EXCEPTION_POINTERS
0040714c char_array!argv = 0x00000000
004067cc char_array!__rtc_izz = <function> *[1]
00405208 char_array!__xc_z = <function> *[]
00405208 char_array!__xc_z = <function> *[1]
00407184 char_array!mspdb = 0x00000000
00407018 char_array!__globallocalestatus = 0n-2
004074e8 char_array!_adjust_fdiv = 0n0
00406ad8 char_array!__rtc_tzz = <function> *[1]
004064c0 char_array!__safe_se_handler_table = void *[]
00407190 char_array!GS_ExceptionRecord = struct _EXCEPTION_RECORD
00406040 char_array!_load_config_used = struct IMAGE_LOAD_CONFIG_DIRECTORY32_2
0040717c char_array!_dowildcard = 0n0
00405ac8 char_array!stack_premsg = char [28] "Stack around the variable '"
00407158 char_array!startinfo = struct _startupinfo
00407028 char_array!__security_cookie = 0xbb40e64e
00405af8 char_array!uninit_premsg = char [15] "The variable '"
0040701c char_array!__defaultmatherr = 0n1
004074e4 char_array!__onexitbegin = 0x00000000
00405514 char_array!pinit = 0x00401f10
00407164 char_array!wsprintffp = 0x00000000
00407144 char_array!argc = 0n0
00405104 char_array!pcppinit = 0x004012e0
004074c0 char_array!__native_startup_state = __uninitialized (0n0)
00405ae4 char_array!stack_postmsg = char [17] "'开发者_StackOverflow was corrupted."
004022f0 char_array!_FindPESection (unsigned char *, unsigned long)
00401040 char_array!_RTC_CheckEsp (void)
00401f70 char_array!_invoke_watson_if_error (int, wchar_t *, wchar_t *, wchar_t *, unsigned int, unsigned int)
00401790 char_array!failwithmessage (void *, int, int, char *)
00401a40 char_array!_RTC_StackFailure (void *, char *)
00401fd0 char_array!_RTC_Initialize (void)
00401e80 char_array!_RTC_GetErrorFunc (void *)
00401010 char_array!main (void)
00401de0 char_array!_RTC_NumErrors (void)
00401e60 char_array!_RTC_SetErrorFuncW (<function> *)
00401730 char_array!_RTC_Failure (void *, int)
00401670 char_array!DebuggerKnownHandle (void)
00401110 char_array!_RTC_CheckStackVars2 (void *, struct _RTC_framedesc *, struct _RTC_ALLOCA_NODE *)
004019a0 char_array!DebuggerRuntime (unsigned long, int, void *, wchar_t *)
00402150 char_array!atexit (<function> *)
00401e40 char_array!_RTC_SetErrorFunc (<function> *)
00402000 char_array!_RTC_Terminate (void)
00401f10 char_array!__CxxSetUnhandledExceptionFilter (void)
00401e90 char_array!_RTC_GetErrorFuncW (void *)
00402290 char_array!_ValidateImageBase (unsigned char *)
00401340 char_array!mainCRTStartup (void)
00401b40 char_array!_RTC_AllocaFailure (void *, struct _RTC_ALLOCA_NODE *, int)
00401fc0 char_array!_setargv (void)
004015b0 char_array!NtCurrentTeb (void)
004012e0 char_array!pre_cpp_init (void)
00401c80 char_array!_getMemBlockDataString (char *, char *, char *, unsigned int)
00401e10 char_array!_RTC_SetErrorType (_RTC_ErrorNumber, int)
004016a0 char_array!DebuggerProbe (unsigned long)
00401fb0 char_array!_matherr (struct _exception *)
00401360 char_array!__tmainCRTStartup (void)
00402970 char_array!__security_check_cookie (unsigned int)
00401ea0 char_array!__CxxUnhandledExceptionFilter (struct _EXCEPTION_POINTERS *)
00401cf0 char_array!_RTC_UninitUse (char *)
00401220 char_array!_RTC_Shutdown (void)
004024a0 char_array!_except_handler4 (struct _EXCEPTION_RECORD *, struct _EXCEPTION_REGISTRATION_RECORD *, struct _CONTEXT *, void *)
00401df0 char_array!_RTC_GetErrDesc (_RTC_ErrorNumber)
004010d0 char_array!_RTC_AllocaHelper (struct _RTC_ALLOCA_NODE *, unsigned int, struct _RTC_ALLOCA_NODE **)
00401f30 char_array!_setdefaultprecision (void)
00401070 char_array!_RTC_CheckStackVars (void *, struct _RTC_framedesc *)
004015c0 char_array!check_managed_app (void)
004024d0 char_array!_RTC_GetSrcLine (unsigned char *, wchar_t *, unsigned long, int *, wchar_t *, unsigned long)
00402790 char_array!GetPdbDll (void)
00401240 char_array!pre_c_init (void)
00402190 char_array!__security_init_cookie (void)
004029b0 char_array!__report_gsfailure (void)
00402040 char_array!_onexit (<function> *)
004011f0 char_array!_RTC_InitBase (void)
00402370 char_array!_IsNonwritableInCurrentImage (unsigned char *)
004081a8 char_array!_imp__FreeLibrary = <no type information>
00402ac4 char_array!InterlockedExchange = <no type information>
004082a0 char_array!_imp____p__fmode = <no type information>
00408290 char_array!_imp____getmainargs = <no type information>
00405e84 char_array!<CrtImplementationDetails>::NativeDll::ThreadAttach = <no type information>
00402afa char_array!GetProcAddress = <no type information>
0040826c char_array!_imp___initterm_e = <no type information>
00408274 char_array!_imp___CrtDbgReportW = <no type information>
004081d0 char_array!_imp__QueryPerformanceCounter = <no type information>
004081fc char_array!_imp__Sleep = <no type information>
004081f4 char_array!_imp__IsDebuggerPresent = <no type information>
0040216c char_array!_encode_pointer = <no type information>
004081bc char_array!_imp__HeapFree = <no type information>
004081e8 char_array!_imp__WideCharToMultiByte = <no type information>
0040828c char_array!_imp___exit = <no type information>
004081a4 char_array!_imp__TerminateProcess = <no type information>
00402172 char_array!__set_app_type = <no type information>
004081c0 char_array!_imp__GetSystemTimeAsFileTime = <no type information>
004082b4 char_array!_imp___CRT_RTC_INITW = <no type information>
00401038 char_array!printf = <no type information>
0040227e char_array!exit = <no type information>
004082ac char_array!_imp____setusermatherr = <no type information>
00408284 char_array!_imp___cexit = <no type information>
00402aee char_array!MultiByteToWideChar = <no type information>
004081e0 char_array!_imp__lstrlenA = <no type information>
004081cc char_array!_imp__GetTickCount = <no type information>
00402992 char_array!_unlock = <no type information>
004081d4 char_array!_imp__SetUnhandledExceptionFilter = <no type information>
00408294 char_array!_imp___amsg_exit = <no type information>
004081c4 char_array!_imp__GetCurrentProcessId = <no type information>
0040248e char_array!_initterm_e = <no type information>
00402980 char_array!terminate = <no type information>
00408000 char_array!_IMPORT_DESCRIPTOR_MSVCR90D = <no type information>
00405e88 char_array!<CrtImplementationDetails>::NativeDll::ThreadDetach = <no type information>
00408270 char_array!_imp___initterm = <no type information>
00402b00 char_array!LoadLibraryA = <no type information>
0040829c char_array!_imp___encode_pointer = <no type information>
00408208 char_array!KERNEL32_NULL_THUNK_DATA = <no type information>
00402ad6 char_array!IsDebuggerPresent = <no type information>
004081dc char_array!_imp__GetProcAddress = <no type information>
00401f9c char_array!__setusermatherr = <no type information>
00402284 char_array!_CrtSetCheckCount = <no type information>
0040299e char_array!_lock = <no type information>
00408250 char_array!_imp___except_handler4_common = <no type information>
00402b5a char_array!UnhandledExceptionFilter = <no type information>
0040825c char_array!_imp___unlock = <no type information>
00402aca char_array!Sleep = <no type information>
00408260 char_array!_imp___invoke_watson = <no type information>
00402b42 char_array!VirtualQuery = <no type information>
00408280 char_array!_imp__exit = <no type information>
00402abe char_array!_crt_debugger_hook = <no type information>
00408254 char_array!_imp___crt_debugger_hook = <no type information>
00402026 char_array!__p__commode = <no type information>
00402b18 char_array!GetCurrentThreadId = <no type information>
004081ac char_array!_imp__VirtualQuery = <no type information>
00402272 char_array!_XcptFilter = <no type information>
004081a0 char_array!_imp__GetCurrentProcess = <no type information>
0040824c char_array!_imp___lock = <no type information>
00402adc char_array!RaiseException = <no type information>
00408264 char_array!_imp___controlfp_s = <no type information>
004081b4 char_array!_imp__GetProcessHeap = <no type information>
00408268 char_array!_imp_?terminateYAXXZ = <no type information>
00402b3c char_array!GetModuleFileNameW = <no type information>
004081d8 char_array!_imp__LoadLibraryA = <no type information>
00402998 char_array!__dllonexit = <no type information>
004029a4 char_array!_decode_pointer = <no type information>
00402b1e char_array!GetCurrentProcessId = <no type information>
00408278 char_array!_imp___CrtSetCheckCount = <no type information>
004029aa char_array!_except_handler4_common = <no type information>
00402488 char_array!_initterm = <no type information>
00402b30 char_array!HeapAlloc = <no type information>
0040298c char_array!_invoke_watson = <no type information>
00408204 char_array!_imp__UnhandledExceptionFilter = <no type information>
004082b0 char_array!_imp___configthreadlocale = <no type information>
004081ec char_array!_imp__DebugBreak = <no type information>
004082c0 char_array!MSVCR90D_NULL_THUNK_DATA = <no type information>
004081f8 char_array!_imp__InterlockedCompareExchange = <no type information>
00401e96 char_array!_CRT_RTC_INITW = <no type information>
00402b24 char_array!GetSystemTimeAsFileTime = <no type information>
00401f24 char_array!_configthreadlocale = <no type information>
0040217e char_array!__getmainargs = <no type information>
00405e7c char_array!<CrtImplementationDetails>::NativeDll::ProcessDetach = <no type information>
00402ad0 char_array!InterlockedCompareExchange = <no type information>
00402b48 char_array!FreeLibrary = <no type information>
004081f0 char_array!_imp__RaiseException = <no type information>
00402af4 char_array!lstrlenA = <no type information>
00402b2a char_array!HeapFree = <no type information>
00402b36 char_array!GetProcessHeap = <no type information>
00405e80 char_array!<CrtImplementationDetails>::NativeDll::ProcessAttach = <no type information>
00408014 char_array!_IMPORT_DESCRIPTOR_KERNEL32 = <no type information>
00402482 char_array!_CrtDbgReportW = <no type information>
00402b12 char_array!GetTickCount = <no type information>
0040202c char_array!__p__fmode = <no type information>
004081e4 char_array!_imp__MultiByteToWideChar = <no type information>
00402986 char_array!_controlfp_s = <no type information>
004081b8 char_array!_imp__HeapAlloc = <no type information>
00402b06 char_array!SetUnhandledExceptionFilter = <no type information>
00402b4e char_array!TerminateProcess = <no type information>
004082b8 char_array!_imp___decode_pointer = <no type information>
004081c8 char_array!_imp__GetCurrentThreadId = <no type information>
00402178 char_array!_amsg_exit = <no type information>
00405e8c char_array!<CrtImplementationDetails>::NativeDll::ProcessVerifier = <no type information>
00408298 char_array!_imp____set_app_type = <no type information>
00402b54 char_array!GetCurrentProcess = <no type information>
00408288 char_array!_imp___XcptFilter = <no type information>
004082bc char_array!_imp__printf = <no type information>
00402278 char_array!_cexit = <no type information>
00402ae8 char_array!WideCharToMultiByte = <no type information>
00408200 char_array!_imp__InterlockedExchange = <no type information>
00402ae2 char_array!DebugBreak = <no type information>
00402b0c char_array!QueryPerformanceCounter = <no type information>
004082a4 char_array!_imp____p__commode = <no type information>
00408258 char_array!_imp____dllonexit = <no type information>
004081b0 char_array!_imp__GetModuleFileNameW = <no type information>
00408028 char_array!_NULL_IMPORT_DESCRIPTOR = <no type information>
0040226c char_array!_exit = <no type information>

I'm surprised to find that even an empty programe like above has so many symbols,why?


MSVC's C and C++ library does a lot of magic before and after main. Additionally you're compiling with switches that enable various run-time checks (This requires e.g. the _RTC* symbols). You also have imports used to deal with e.g. the heap and the debug build error reporting mechanisms.

The "magic" as in the "compiler magic" term (stuff the compiler/toolchain does for you behind the scenes) includes e.g.

  • Setting up stack "cookies" in order to detect stack overflow
  • Retrieving various info from Windows (e.g. GetStartupInfo, GetCommandLine, GetEnvironmentStrings)
  • Initialize the memory manager
  • Setting up debug checks of the heap
  • Setting up FPU flags
  • Adding atexit handlers

If you build this app in debug mode, and set a breakpoint at the start of main, you'll see what calls main. Read through e.g. __tmainCRTStartup and the functions it calls.


Yes, debuggers get smart when you compile with the /DEBUG option. They'll know a lot more about the variables and functions used in your program, including the ones used by the CRT.

This is by design. Be sure to ship the release build of your program and don't include the .pdb files.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号