1
// Copyright 2010 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"
8
#include "signals_GOOS.h"
11
runtime·dumpregs(Ureg *u)
13
runtime·printf("ax %X\n", u->ax);
14
runtime·printf("bx %X\n", u->bx);
15
runtime·printf("cx %X\n", u->cx);
16
runtime·printf("dx %X\n", u->dx);
17
runtime·printf("di %X\n", u->di);
18
runtime·printf("si %X\n", u->si);
19
runtime·printf("bp %X\n", u->bp);
20
runtime·printf("sp %X\n", u->sp);
21
runtime·printf("pc %X\n", u->pc);
22
runtime·printf("flags %X\n", u->flags);
23
runtime·printf("cs %X\n", u->cs);
24
runtime·printf("fs %X\n", u->fs);
25
runtime·printf("gs %X\n", u->gs);
29
runtime·sighandler(void *v, int8 *s, G *gp)
40
len = runtime·findnull((byte*)s);
41
if(len <= 4 || runtime·mcmp((byte*)s, (byte*)"sys:", 4) != 0)
46
for(i=0; i < NSIG; i++) {
47
if(runtime·strstr((byte*)s, (byte*)sig->name)) {
58
if(nsig->flags & SigPanic) {
59
if(gp == nil || m->notesig == 0)
62
// Save error string from sigtramp's stack,
63
// into gsignal->sigcode0, so we can reliably
64
// access it from the panic routines.
67
runtime·memmove((void*)m->notesig, (void*)s, len);
72
// Only push runtime·sigpanic if ureg->pc != 0.
73
// If ureg->pc == 0, probably panicked because of a
74
// call to a nil func. Not pushing that onto sp will
75
// make the trace look like a call to runtime·sigpanic instead.
76
// (Otherwise the trace will end at runtime·sigpanic and we
77
// won't get to see who faulted.)
79
sp = (uintptr*)ureg->sp;
81
ureg->sp = (uint32)sp;
83
ureg->pc = (uintptr)runtime·sigpanic;
87
if(!(nsig->flags & SigThrow))
93
runtime·printf("%s\n", s);
94
runtime·printf("PC=%X\n", ureg->pc);
97
if(runtime·gotraceback(&crash)) {
98
runtime·traceback((void*)ureg->pc, (void*)ureg->sp, 0, gp);
99
runtime·tracebackothers(gp);
100
runtime·dumpregs(ureg);
106
runtime·goexitsall("");
114
runtime·sigenable(uint32 sig)
120
runtime·sigdisable(uint32 sig)
126
runtime·resetcpuprofiler(int32 hz)
128
// TODO: Enable profiling interrupts.