This project has moved and is read-only. For the latest updates, please go here.

Not resolving stack address's for unloaded modules

Feb 18, 2011 at 5:22 PM
Edited Feb 18, 2011 at 5:36 PM

It seems I have found a limitation with this tool.

I have a large application that loads lots of DLLs (via LoadLibrary). When it shutdown it unloads those DLLs (FreeLibrary).  The problem is that some of the memory leaks went through those modules that were unloaded. Bummer. As a result, VLD is unable to decipher the stack frames that went through those modules. For example:

---------- Block 177895 at 0x0000000037D8F970: 3 bytes ----------  
Call Stack:    
e:\app\3dswin\src\util\tstr.cpp (761): CStr::operator=    
e:\app\3dswin\src\core\actiontable.cpp (55): ActionItemImp::ActionItemImp    
e:\app\3dswin\src\core\actiontable.cpp (509): ActionTable::BuildActionTable    
e:\app\3dswin\src\core\actiontable.cpp (532): ActionTable::ActionTable    
0x00000000471E283E (File and line number not available): (Function name unavailable)    
0x00000000471E30BC (File and line number not available): (Function name unavailable)    
e:\app\3dswin\src\app\actionman.cpp (1295): ActionManager::LoadActionTables    
e:\app\3dswin\src\app\app.cpp (2588): App::init    
e:\app\3dswin\src\app\foo.cpp (1356): WinMain

The problem is in: 

 

VOID CallStack::dump (BOOL showinternalframes) const

 

Which calls this code:

 

// Try to get the name of the function containing this program
// counter address.
if (SymFromAddrW(currentprocess, (*this)[frame], &displacement64, functioninfo)) {
      functionname = functioninfo->Name;
}
else {
       functionname = L"(Function name unavailable)";
}

GetLastError informs me that it cannot find the specified module. I'm taking it that it can't find the module at all (because it's unloaded). The symbols for the module are all right next to their modules. So I'm not having a problem with symbols.

So it seems that doing the symbol resolution after I've unloaded my modules is big problem. Does anyone see any alternatives?

Thanks

Chris Johnson

 

 


Feb 18, 2011 at 5:30 PM

Perhaps a fix would be to add a method (that I can call) to tell VLD to perform symbol resolution (i.e. early?). That way I can call that during my shutdown event, before all my modules get unloaded. VLD would have to cache the strings that the symbol resolution would provide. But it could cache that data with everything else, and get freed like everything else too.

Feb 28, 2011 at 9:46 PM

Bump. Anyone want to discuss this?

Mar 2, 2011 at 6:06 PM

I think we should cache callstack info before unloading DLL.

Mar 2, 2011 at 6:19 PM

Can you elaborate on that? Do you mean have the callstacks interpret their data by performing symbol resolution? I mean by this, transforming the callstack numbers into a human readable form of files, functions, and line info.

Mar 3, 2011 at 5:43 PM

Bump?

Mar 3, 2011 at 5:48 PM

Sorry. I'm busy now. Yes, I mean perform symbol resolution when unloading dll that used in callstack's.

Mar 7, 2011 at 6:15 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Apr 4, 2011 at 4:10 PM

Just in case anyone is interested, this has been resolved by version 2.1