New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Probably-false uninit reports on StackWalk64 #567
Comments
From timurrrr@google.com on August 26, 2011 07:24:52 Leaks on a similar program:#include <windows.h> #include <stdio.h> int main() {
|
From bruen...@google.com on August 26, 2011 07:30:50 don't you need to call SymInitialize and SymCleanup? does the leak go away if you do that? |
From timurrrr@google.com on August 26, 2011 07:35:33 MSDN says nothing about it on the StackWalk64 page. The leak is still there if I call these guys. |
From bruen...@google.com on August 26, 2011 07:42:29 The MSDN page is terrible: it doesn't do a good job of telling you how to initialize the frame (your sample does it incorrectly: my understanding is that you need to fill in the values of PC, Frame, and Stack). But for the function pointers it says you could use the dbghelp ones, which to me implies only if you've set up dbghelp already. I've tried using StackWalk64 and it did not work well for me unless I loaded the module symbols up front w/ SymIninitialize(,,TRUE). Xref issue #563 . |
From timurrrr@google.com on August 26, 2011 07:47:46 With (,,TRUE) it gives 400+ uninits like this: and the leak is still there! :) |
From bruen...@google.com on August 26, 2011 07:50:07 (in general) can you include the "Note: instruction:" which can provide a hint as to whether bit granularity is the issue |
From timurrrr@google.com on August 26, 2011 07:59:41 Sure, |
From timurrrr@google.com on August 26, 2011 10:23:09
As of r481 :
#include <windows.h>
#include <dbghelp.h>
#pragma comment(lib, "dbghelp.lib")
#include <stdio.h>
#include
long WINAPI SDEF(EXCEPTION_POINTERS *ep) {
STACKFRAME64 stack_frame;
memset(&stack_frame, 0, sizeof(stack_frame));
stack_frame.AddrPC.Offset = ep->ContextRecord->Eip;
stack_frame.AddrFrame.Offset = ep->ContextRecord->Ebp;
stack_frame.AddrStack.Offset = ep->ContextRecord->Esp;
stack_frame.AddrPC.Mode = AddrModeFlat;
stack_frame.AddrFrame.Mode = AddrModeFlat;
stack_frame.AddrStack.Mode = AddrModeFlat;
while (StackWalk64(IMAGE_FILE_MACHINE_I386, GetCurrentProcess(),
GetCurrentThread(), &stack_frame,
ep->ContextRecord, NULL,
&SymFunctionTableAccess64, &SymGetModuleBase64, NULL)) {
printf("Frame: 0x%08X\n", stack_frame.AddrPC.Offset);
}
return 1;
}
int main() {
SetUnhandledExceptionFilter(&SDEF);
throw std::exception("Woo");
}
Error
#1
: UNINITIALIZED READ: reading 0x0018ea2c-0x0018ea2d 1 byte(s)@0:00:02.162 in thread 4972
Note: instruction: test 0xffffffb4(%ebp) $0x01
0x73f94c40 <dbghelp.dll+0x14c40> dbghelp.dll!SymFromAddrW
0x73f94916 <dbghelp.dll+0x14916> dbghelp.dll!SymFromAddrW
0x73f94f0f <dbghelp.dll+0x14f0f> dbghelp.dll!SymFromAddrW
0x73f965b1 <dbghelp.dll+0x165b1> dbghelp.dll!StackWalk64
0x73f964c8 <dbghelp.dll+0x164c8> dbghelp.dll!StackWalk64
0x004010e4 <test.exe+0x10e4> test.exe!SDEF
c:\sandbox\stackwalk\test.cpp:20
Original issue: http://code.google.com/p/drmemory/issues/detail?id=567
The text was updated successfully, but these errors were encountered: