1 // Copyright 2012 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.
7 extern void gothrow(String
) __attribute__((noreturn
));
8 extern void gothrow(String
) __asm__(GOSYM_PREFIX
"runtime.throw");
11 runtime_throw(const char *s
)
13 gothrow(runtime_gostringnocopy((const byte
*)s
));
17 runtime_panicstring(const char *s
)
24 runtime_printf("panic: %s\n", s
);
25 runtime_throw("panic with no g");
28 runtime_printf("panic: %s\n", s
);
29 runtime_throw("panic with no m");
31 if (gp
->m
->curg
!= gp
) {
32 runtime_printf("panic: %s\n", s
);
33 runtime_throw("panic on system stack");
35 if (gp
->m
->mallocing
!= 0) {
36 runtime_printf("panic: %s\n", s
);
37 runtime_throw("panic during malloc");
39 if (gp
->m
->preemptoff
.len
!= 0) {
40 runtime_printf("panic: %s\n", s
);
41 runtime_printf("preempt off reason: %S\n", gp
->m
->preemptoff
);
42 runtime_throw("panic during preemptoff");
44 if (gp
->m
->locks
!= 0) {
45 runtime_printf("panic: %s\n", s
);
46 runtime_throw("panic holding locks");
48 runtime_newErrorCString((uintptr
) s
, &err
);
52 extern void runtime_abort(void) __asm__(GOSYM_PREFIX
"runtime.abort");