1
// Copyright 2011 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("rax %X\n", r->Rax);
13
runtime·printf("rbx %X\n", r->Rbx);
14
runtime·printf("rcx %X\n", r->Rcx);
15
runtime·printf("rdx %X\n", r->Rdx);
16
runtime·printf("rdi %X\n", r->Rdi);
17
runtime·printf("rsi %X\n", r->Rsi);
18
runtime·printf("rbp %X\n", r->Rbp);
19
runtime·printf("rsp %X\n", r->Rsp);
20
runtime·printf("r8 %X\n", r->R8 );
21
runtime·printf("r9 %X\n", r->R9 );
22
runtime·printf("r10 %X\n", r->R10);
23
runtime·printf("r11 %X\n", r->R11);
24
runtime·printf("r12 %X\n", r->R12);
25
runtime·printf("r13 %X\n", r->R13);
26
runtime·printf("r14 %X\n", r->R14);
27
runtime·printf("r15 %X\n", r->R15);
28
runtime·printf("rip %X\n", r->Rip);
29
runtime·printf("rflags %X\n", r->EFlags);
30
runtime·printf("cs %X\n", (uint64)r->SegCs);
31
runtime·printf("fs %X\n", (uint64)r->SegFs);
32
runtime·printf("gs %X\n", (uint64)r->SegGs);
36
runtime·sighandler(ExceptionRecord *info, Context *r, G *gp)
40
switch(info->ExceptionCode) {
41
case EXCEPTION_BREAKPOINT:
45
if(gp != nil && runtime·issigpanic(info->ExceptionCode)) {
46
// Make it look like a call to the signal func.
47
// Have to pass arguments out of band since
48
// augmenting the stack frame would break
49
// the unwinding code.
50
gp->sig = info->ExceptionCode;
51
gp->sigcode0 = info->ExceptionInformation[0];
52
gp->sigcode1 = info->ExceptionInformation[1];
55
// Only push runtime·sigpanic if r->rip != 0.
56
// If r->rip == 0, probably panicked because of a
57
// call to a nil func. Not pushing that onto sp will
58
// make the trace look like a call to runtime·sigpanic instead.
59
// (Otherwise the trace will end at runtime·sigpanic and we
60
// won't get to see who faulted.)
62
sp = (uintptr*)r->Rsp;
66
r->Rip = (uintptr)runtime·sigpanic;
70
if(runtime·panicking) // traceback already printed
72
runtime·panicking = 1;
74
runtime·printf("Exception %x %p %p\n", info->ExceptionCode,
75
info->ExceptionInformation[0], info->ExceptionInformation[1]);
77
runtime·printf("PC=%X\n", r->Rip);
80
if(runtime·gotraceback()){
81
runtime·traceback((void*)r->Rip, (void*)r->Rsp, 0, gp);
82
runtime·tracebackothers(gp);
91
runtime·sigenable(uint32 sig)
97
runtime·dosigprof(Context *r, G *gp)
99
runtime·sigprof((uint8*)r->Rip, (uint8*)r->Rsp, nil, gp);