2011-05-08 52 views
3

char_array.c空模塊有228個符號?

char arr[1]; 

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

符號在char_array.exe通過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] "' 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> 

我很驚訝地發現,即使是空PROGRAME像上面有這麼多的符號,爲什麼呢?

+0

除了Erik的長列表之外,printf必須或多或少地包含格式字符串的解釋器以及所有本地數據類型的轉換。此外,如果您擁有所有默認設置,則控制檯將顯示較寬的字符,但您打印的是窄字符,因此必須即時翻譯結果。誰說C比C++更好,因爲你總是可以很容易地看到代碼的作用? :-) – 2011-05-08 10:37:52

回答

5

MSVC的C和C++庫在main和main之前和之後都有很多魔術。此外,您正在使用可啓用各種運行時檢查的交換機進行編譯(這需要例如_RTC *符號)。您還有用於處理例如堆和調試構建錯誤報告機制。 「編譯魔術」術語中的「魔術」(編譯器/工具鏈在幕後爲你做的事情)包括例如

  • ,以檢測堆棧溢出
  • 從Windows獲取各種信息(如GetStartupInfo,​​,GetEnvironmentStrings
  • 初始化內存管理器
  • 設置的調試檢查設置堆棧「曲奇」堆
  • 設置FPU標誌
  • 添加的atexit處理程序

如果您在調試模式下構建此應用程序,並在main開始處設置斷點,您將看到什麼是main調用。通讀例如__tmainCRTStartup及其調用的函數。

+1

你能詳細說說* magic *嗎? – kern 2011-05-08 10:20:15

2

是的,使用/ DEBUG選項進行編譯時,調試器會變得更加智能。他們將更多地瞭解程序中使用的變量和函數,包括CRT使用的變量和函數。

這是設計。一定要發佈程序的發佈版本,不要包含.pdb文件。

+0

符號是唯一有用的地方我能想到的是調試時,但似乎也有其他類型的符號,它們是什麼? – kern 2011-05-10 14:46:06

+0

從DLL導出的函數具有名稱。除了調試信息之外,我能想到的就是這些。 – 2011-05-10 21:21:19

+0

導出的函數名稱不會被'strip'帶走,對嗎? – kern 2011-05-12 14:18:41