Add coroutine stack size to trace output

This commit is contained in:
Ian McInerney 2024-02-02 11:00:08 +00:00
parent 4a1245e85a
commit 85a2d6178a
2 changed files with 8 additions and 4 deletions

View File

@ -22,7 +22,7 @@
*/ */
#include <advanced_config.h> #include <advanced_config.h>
#include <trace_helpers.h>
#include <config_params.h> #include <config_params.h>
#include <paths.h> #include <paths.h>
@ -466,6 +466,8 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
for( PARAM_CFG* param : configParams ) for( PARAM_CFG* param : configParams )
delete param; delete param;
wxLogTrace( kicadTraceCoroutineStack, wxT( "Using coroutine stack size %d" ), m_CoroutineStackSize );
} }

View File

@ -380,6 +380,8 @@ private:
std::size_t stackSize = m_stacksize; std::size_t stackSize = m_stacksize;
void* sp = nullptr; void* sp = nullptr;
wxLogTrace( kicadTraceCoroutineStack, wxT( "COROUTINE::doCall" ) );
#ifndef LIBCONTEXT_HAS_OWN_STACK #ifndef LIBCONTEXT_HAS_OWN_STACK
assert( !m_stack ); assert( !m_stack );
@ -414,8 +416,6 @@ private:
__tsan_set_fiber_name( m_callee.tsan_fiber, "Coroutine fiber" ); __tsan_set_fiber_name( m_callee.tsan_fiber, "Coroutine fiber" );
#endif #endif
wxLogTrace( kicadTraceCoroutineStack, wxT( "COROUTINE::doCall" ) );
m_callee.ctx = libcontext::make_fcontext( sp, stackSize, callerStub ); m_callee.ctx = libcontext::make_fcontext( sp, stackSize, callerStub );
m_running = true; m_running = true;
@ -461,10 +461,12 @@ private:
{ {
#ifdef _WIN32 #ifdef _WIN32
void* mem = ::VirtualAlloc( 0, aAllocSize, MEM_COMMIT, PAGE_READWRITE ); void* mem = ::VirtualAlloc( 0, aAllocSize, MEM_COMMIT, PAGE_READWRITE );
if( !mem ) if( !mem )
throw std::bad_alloc(); throw std::bad_alloc();
#else #else
void* mem = ::mmap( 0, aAllocSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0 ); void* mem = ::mmap( 0, aAllocSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0 );
if( mem == (void*) -1 ) if( mem == (void*) -1 )
throw std::bad_alloc(); throw std::bad_alloc();
#endif #endif
@ -482,7 +484,7 @@ private:
bool res = ( 0 == ::mprotect( aAddress, aGuardSize, PROT_NONE ) ); bool res = ( 0 == ::mprotect( aAddress, aGuardSize, PROT_NONE ) );
#endif #endif
if( !res ) if( !res )
wxLogTrace( kicadTraceCoroutineStack, wxT( "COROUTINE::GuardMemory has failes" ) ); wxLogTrace( kicadTraceCoroutineStack, wxT( "COROUTINE::GuardMemory has failed" ) );
} }
#endif // LIBCONTEXT_HAS_OWN_STACK #endif // LIBCONTEXT_HAS_OWN_STACK