1
// Copyright 2009 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
6
#include "defs_GOOS_GOARCH.h"
10
runtime·dumpregs(Context *r)
12
runtime·printf("eax %x\n", r->Eax);
13
runtime·printf("ebx %x\n", r->Ebx);
14
runtime·printf("ecx %x\n", r->Ecx);
15
runtime·printf("edx %x\n", r->Edx);
16
runtime·printf("edi %x\n", r->Edi);
17
runtime·printf("esi %x\n", r->Esi);
18
runtime·printf("ebp %x\n", r->Ebp);
19
runtime·printf("esp %x\n", r->Esp);
20
runtime·printf("eip %x\n", r->Eip);
21
runtime·printf("eflags %x\n", r->EFlags);
22
runtime·printf("cs %x\n", r->SegCs);
23
runtime·printf("fs %x\n", r->SegFs);
24
runtime·printf("gs %x\n", r->SegGs);
28
runtime·sighandler(ExceptionRecord *info, Context *r, G *gp)
32
switch(info->ExceptionCode) {
33
case EXCEPTION_BREAKPOINT:
34
r->Eip--; // because 8l generates 2 bytes for INT3
38
if(gp != nil && runtime·issigpanic(info->ExceptionCode)) {
39
// Make it look like a call to the signal func.
40
// Have to pass arguments out of band since
41
// augmenting the stack frame would break
42
// the unwinding code.
43
gp->sig = info->ExceptionCode;
44
gp->sigcode0 = info->ExceptionInformation[0];
45
gp->sigcode1 = info->ExceptionInformation[1];
48
// Only push runtime·sigpanic if r->eip != 0.
49
// If r->eip == 0, probably panicked because of a
50
// call to a nil func. Not pushing that onto sp will
51
// make the trace look like a call to runtime·sigpanic instead.
52
// (Otherwise the trace will end at runtime·sigpanic and we
53
// won't get to see who faulted.)
55
sp = (uintptr*)r->Esp;
59
r->Eip = (uintptr)runtime·sigpanic;
63
if(runtime·panicking) // traceback already printed
65
runtime·panicking = 1;
67
runtime·printf("Exception %x %p %p\n", info->ExceptionCode,
68
info->ExceptionInformation[0], info->ExceptionInformation[1]);
70
runtime·printf("PC=%x\n", r->Eip);
73
if(runtime·gotraceback()){
74
runtime·traceback((void*)r->Eip, (void*)r->Esp, 0, m->curg);
75
runtime·tracebackothers(m->curg);
84
runtime·sigenable(uint32 sig)
90
runtime·dosigprof(Context *r, G *gp)
92
runtime·sigprof((uint8*)r->Eip, (uint8*)r->Esp, nil, gp);