-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash in exception logging (issue #3)
- Loading branch information
Showing
1 changed file
with
15 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,14 +22,15 @@ COPYRIGHT | |
Please report bugs to [email protected]. | ||
*/ | ||
|
||
static char const szRCSID[] = "$Id: ShowData.cpp 1881 2020-04-09 20:55:12Z Roger $"; | ||
static char const szRCSID[] = "$Id: ShowData.cpp 1915 2020-08-15 14:23:23Z Roger $"; | ||
|
||
#pragma warning( disable: 4786 ) // identifier was truncated to '255' characters | ||
|
||
#include "ShowData.h" | ||
#include "Enumerations.h" | ||
|
||
#include <windows.h> | ||
#include <DbgHelp.h> | ||
|
||
#include <iomanip> | ||
#include <map> | ||
|
@@ -525,7 +526,7 @@ void showFileAttributes( std::ostream & os, ULONG argVal ) | |
} | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
// note: file times are not returned by the commonest Api, NtQueryInformationFile ... | ||
// note: file times are not returned by the commonest Api, NtQueryInformationFile ... | ||
void showPFileBasicInfo( std::ostream & os, HANDLE hProcess, PFILE_BASIC_INFORMATION pFileBasicInfo ) | ||
{ | ||
showPointer(os, hProcess, (ULONG_PTR)pFileBasicInfo); | ||
|
@@ -621,11 +622,19 @@ void showThrowType( std::ostream & os, HANDLE hProcess, ULONG_PTR throwInfo, ULO | |
memset( type_info + sizeof( PVOID ), 0, sizeof( PVOID ) ); | ||
|
||
const std::type_info *pType_info = (const std::type_info *)type_info; | ||
const char* pName = pType_info->name(); | ||
os << " type: " << pName; | ||
const char *decorated_name = pType_info->raw_name(); | ||
|
||
// bit of a fudge: msvc allocates type_info name on first use and therefore we must destroy it. | ||
free( const_cast<char*>( pName ) ); | ||
char buffer[ 1024 ] = ""; | ||
if ((decorated_name[0] == '.') && | ||
UnDecorateSymbolName( decorated_name + 1, buffer, sizeof( buffer ), | ||
UNDNAME_32_BIT_DECODE | UNDNAME_NO_ARGUMENTS ) ) | ||
{ | ||
os << " type: " << buffer; | ||
} | ||
else | ||
{ | ||
os << " raw type: " << decorated_name; | ||
} | ||
} | ||
|
||
|
||
|