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.
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·initsig(int32)
34
runtime·sighandler(ExceptionRecord *info, void *frame, Context *r)
41
switch(info->ExceptionCode) {
42
case EXCEPTION_BREAKPOINT:
43
r->Eip--; // because 8l generates 2 bytes for INT3
47
if((gp = m->curg) != nil && runtime·issigpanic(info->ExceptionCode)) {
48
// Make it look like a call to the signal func.
49
// Have to pass arguments out of band since
50
// augmenting the stack frame would break
51
// the unwinding code.
52
gp->sig = info->ExceptionCode;
53
gp->sigcode0 = info->ExceptionInformation[0];
54
gp->sigcode1 = info->ExceptionInformation[1];
57
// Only push runtime·sigpanic if r->eip != 0.
58
// If r->eip == 0, probably panicked because of a
59
// call to a nil func. Not pushing that onto sp will
60
// make the trace look like a call to runtime·sigpanic instead.
61
// (Otherwise the trace will end at runtime·sigpanic and we
62
// won't get to see who faulted.)
64
sp = (uintptr*)r->Esp;
68
r->Eip = (uintptr)runtime·sigpanic;
72
if(runtime·panicking) // traceback already printed
74
runtime·panicking = 1;
76
runtime·printf("Exception %x %p %p\n", info->ExceptionCode,
77
info->ExceptionInformation[0], info->ExceptionInformation[1]);
79
runtime·printf("PC=%x\n", r->Eip);
82
if(runtime·gotraceback()){
83
runtime·traceback((void*)r->Eip, (void*)r->Esp, 0, m->curg);
84
runtime·tracebackothers(m->curg);