6

我正在查看 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();
}

这就提出了一个问题:为什么 chrome 似乎在一个仅用于调试而在 chromium 中几乎是空的函数上花费了这么多时间?

4

2 回答 2

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

于 2013-04-30T14:02:12.713 回答
1

此外,该函数实际上是 GDB 的辅助函数,用于帮助调试覆盖。请参阅https://sourceware.org/gdb/onlinedocs/gdb/Automatic-Overlay-Debugging.html

于 2015-02-24T13:54:04.663 回答