Fix call stacks on cygwin.

This commit is contained in:
Bartosz Taudul 2019-02-02 13:58:17 +01:00
parent e801943b90
commit 9dd869a5eb

View File

@ -45,10 +45,11 @@ void InitCallstack()
CallstackEntryData DecodeCallstackPtr( uint64_t ptr ) CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
{ {
int write;
const auto proc = GetCurrentProcess(); const auto proc = GetCurrentProcess();
#ifndef __CYGWIN__
const auto inlineNum = std::min<DWORD>( MaxCbTrace - 1, SymAddrIncludeInlineTrace( proc, ptr ) ); const auto inlineNum = std::min<DWORD>( MaxCbTrace - 1, SymAddrIncludeInlineTrace( proc, ptr ) );
DWORD ctx, idx; DWORD ctx, idx;
int write;
BOOL doInline = FALSE; BOOL doInline = FALSE;
if( inlineNum != 0 ) doInline = SymQueryInlineTrace( proc, ptr, 0, ptr, ptr, &ctx, &idx ); if( inlineNum != 0 ) doInline = SymQueryInlineTrace( proc, ptr, 0, ptr, ptr, &ctx, &idx );
if( doInline ) if( doInline )
@ -57,6 +58,7 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
cb_num = 1 + inlineNum; cb_num = 1 + inlineNum;
} }
else else
#endif
{ {
write = 0; write = 0;
cb_num = 1; cb_num = 1;
@ -101,6 +103,7 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
cb_data[write].file = file; cb_data[write].file = file;
#ifndef __CYGWIN__
if( doInline ) if( doInline )
{ {
for( DWORD i=0; i<inlineNum; i++ ) for( DWORD i=0; i<inlineNum; i++ )
@ -138,6 +141,7 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr )
ctx++; ctx++;
} }
} }
#endif
return { cb_data, uint8_t( cb_num ) }; return { cb_data, uint8_t( cb_num ) };
} }