This source file includes following definitions.
- runtime·dumpregs
- runtime·sighandler
- runtime·sigenable
- runtime·sigdisable
- runtime·dosigprof
#include "runtime.h"
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
void
runtime·dumpregs(Context *r)
{
runtime·printf("eax %x\n", r->Eax);
runtime·printf("ebx %x\n", r->Ebx);
runtime·printf("ecx %x\n", r->Ecx);
runtime·printf("edx %x\n", r->Edx);
runtime·printf("edi %x\n", r->Edi);
runtime·printf("esi %x\n", r->Esi);
runtime·printf("ebp %x\n", r->Ebp);
runtime·printf("esp %x\n", r->Esp);
runtime·printf("eip %x\n", r->Eip);
runtime·printf("eflags %x\n", r->EFlags);
runtime·printf("cs %x\n", r->SegCs);
runtime·printf("fs %x\n", r->SegFs);
runtime·printf("gs %x\n", r->SegGs);
}
#define DBG_PRINTEXCEPTION_C 0x40010006
uint32
runtime·sighandler(ExceptionRecord *info, Context *r, G *gp)
{
bool crash;
uintptr *sp;
extern byte text[], etext[];
if(info->ExceptionCode == DBG_PRINTEXCEPTION_C) {
return -1;
}
if(r->Eip < (uint32)text || (uint32)etext < r->Eip)
return 0;
switch(info->ExceptionCode) {
case EXCEPTION_BREAKPOINT:
break;
}
if(gp != nil && runtime·issigpanic(info->ExceptionCode)) {
gp->sig = info->ExceptionCode;
gp->sigcode0 = info->ExceptionInformation[0];
gp->sigcode1 = info->ExceptionInformation[1];
gp->sigpc = r->Eip;
if(r->Eip != 0) {
sp = (uintptr*)r->Esp;
*--sp = r->Eip;
r->Esp = (uintptr)sp;
}
r->Eip = (uintptr)runtime·sigpanic;
return -1;
}
if(runtime·panicking)
runtime·exit(2);
runtime·panicking = 1;
runtime·printf("Exception %x %p %p %p\n", info->ExceptionCode,
info->ExceptionInformation[0], info->ExceptionInformation[1], r->Eip);
runtime·printf("PC=%x\n", r->Eip);
if(m->lockedg != nil && m->ncgo > 0 && gp == m->g0) {
runtime·printf("signal arrived during cgo execution\n");
gp = m->lockedg;
}
runtime·printf("\n");
if(runtime·gotraceback(&crash)){
runtime·traceback(r->Eip, r->Esp, 0, gp);
runtime·tracebackothers(gp);
runtime·dumpregs(r);
}
if(crash)
runtime·crash();
runtime·exit(2);
return -1;
}
void
runtime·sigenable(uint32 sig)
{
USED(sig);
}
void
runtime·sigdisable(uint32 sig)
{
USED(sig);
}
void
runtime·dosigprof(Context *r, G *gp, M *mp)
{
runtime·sigprof((uint8*)r->Eip, (uint8*)r->Esp, nil, gp, mp);
}