2012-11-14 36 views
6

我一直在尋找Chrome的線程堆棧時,我注意到,很多線程有一個類似的痕跡:ovly_debug_event在Chrome中做什麼?

0, wow64cpu.dll!TurboDispatchJumpAddressEnd+0x6c0 
1, wow64cpu.dll!TurboDispatchJumpAddressEnd+0x4a8 
2, wow64.dll!Wow64SystemServiceEx+0x1ce 
3, wow64.dll!Wow64LdrpInitialize+0x429 
4, ntdll.dll!RtlIsDosDeviceName_U+0x24c87 
5, ntdll.dll!LdrInitializeThunk+0xe 
6, ntdll.dll!ZwWaitForSingleObject+0x15 
7, kernel32.dll!WaitForSingleObjectEx+0x43 
8, kernel32.dll!WaitForSingleObject+0x12 
9, chrome.dll!ovly_debug_event+0x16574 
10, chrome.dll!ovly_debug_event+0x14904 
11, chrome.dll!ovly_debug_event+0x14826 
12, chrome.dll!ovly_debug_event+0x16d19 
13, chrome.dll!ovly_debug_event+0x1bea1b 
14, chrome.dll!ovly_debug_event+0xe8ff4 
15, chrome.dll!ovly_debug_event+0x16b50 
16, chrome.dll!ovly_debug_event+0x16ab2 
17, kernel32.dll!BaseThreadInitThunk+0x12 
18, ntdll.dll!RtlInitializeExceptionChain+0x63 
19, ntdll.dll!RtlInitializeExceptionChain+0x36 

鉻源在sel_ldr.c下面的代碼,這似乎宣告ovly_debug_event作爲一個幾乎空函數:

void _ovly_debug_event (void) { 
#ifdef __GNUC__ 
    /* 
    * The asm volatile is here as instructed by the GCC docs. 
    * It's not enough to declare a function noinline. 
    * GCC will still look inside the function to see if it's worth calling. 
    */ 
    __asm__ volatile (""); 
#elif NACL_WINDOWS 
    /* 
    * Visual Studio inlines empty functions even with noinline attribute, 
    * so we need a compile memory barrier to make this function not to be 
    * inlined. Also, it guarantees that nacl_global_xlate_base initialization 
    * is not reordered. This is important for gdb since it sets breakpoint on 
    * this function and reads nacl_global_xlate_base value. 
    */ 
    _ReadWriteBarrier(); 
#endif 
} 

static void StopForDebuggerInit (uintptr_t mem_start) { 
    /* Put xlate_base in a place where gdb can find it. */ 
    nacl_global_xlate_base = mem_start; 

    NaClSandboxMemoryStartForValgrind(mem_start); 

    _ovly_debug_event(); 
} 

這就提出了一個問題:爲什麼鉻似乎花那麼多時間在一個函數,僅用於調試和幾乎是空白的鉻?

回答

4

注意大量的偏移量,例如0x16574進入這個函數。它似乎沒有用於chrome.dll的私有符號,因此調試器正在查找最接近(最好,最近的前一個)公開導出的符號。

換句話說,你不在_ovly_debug_event。你在一個函數被放置在可執行文件後面,但不是公開導出。

要嘗試解決這個問題,如果你想看看有什麼實際發生的情況,你可以添加 http://chromium-browser-symsrv.commondatastorage.googleapis.com 到您的符號路徑。在WinDbg中,該命令將

.sympath + SRV * C:\ tmp目錄* http://chromium-browser-symsrv.commondatastorage.googleapis.com