#include "config.h"
#include "go-assert.h"
-#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <unistd.h>
#include <pthread.h>
#include <semaphore.h>
#include <ucontext.h>
typedef struct __go_func_type FuncType;
typedef struct __go_map_type MapType;
+typedef struct Traceback Traceback;
+
/*
* per-cpu declaration.
*/
void* gcnext_segment;
void* gcnext_sp;
void* gcinitial_sp;
- jmp_buf gcregs;
+ ucontext_t gcregs;
byte* entry; // initial function
G* alllink; // on allg
void* param; // passed parameter on wakeup
M* m; // for debuggers, but offset not hard-coded
M* lockedm;
M* idlem;
- // int32 sig;
+ int32 sig;
int32 writenbuf;
byte* writebuf;
- // uintptr sigcode0;
- // uintptr sigcode1;
+ uintptr sigcode0;
+ uintptr sigcode1;
// uintptr sigpc;
uintptr gopc; // pc of go statement that created this goroutine
+ Traceback* traceback;
+
ucontext_t context;
void* stack_context[10];
};
* common functions and data
*/
int32 runtime_findnull(const byte*);
+void runtime_dump(byte*, int32);
/*
* very low level c-called
void runtime_goenvs_unix(void);
void runtime_throw(const char*) __attribute__ ((noreturn));
void runtime_panicstring(const char*) __attribute__ ((noreturn));
+void runtime_prints(const char*);
+void runtime_printf(const char*, ...);
void* runtime_mal(uintptr);
void runtime_schedinit(void);
void runtime_initsig(void);
void runtime_sigenable(uint32 sig);
+int32 runtime_gotraceback(void);
+void runtime_goroutineheader(G*);
+void runtime_goroutinetrailer(G*);
+void runtime_traceback();
+void runtime_tracebackothers(G*);
+void runtime_printtrace(uintptr*, int32);
String runtime_gostringnocopy(const byte*);
void* runtime_mstart(void*);
G* runtime_malg(int32, byte**, size_t*);
void runtime_tsleep(int64);
M* runtime_newm(void);
void runtime_goexit(void);
-void runtime_entersyscall(void) __asm__("libgo_syscall.syscall.Entersyscall");
-void runtime_exitsyscall(void) __asm__("libgo_syscall.syscall.Exitsyscall");
+void runtime_entersyscall(void) __asm__("syscall.Entersyscall");
+void runtime_exitsyscall(void) __asm__("syscall.Exitsyscall");
void siginit(void);
bool __go_sigsend(int32 sig);
int32 runtime_callers(int32, uintptr*, int32);
#endif
/*
+ * Names generated by gccgo.
+ */
+#define runtime_printbool __go_print_bool
+#define runtime_printfloat __go_print_double
+#define runtime_printint __go_print_int64
+#define runtime_printiface __go_print_interface
+#define runtime_printeface __go_print_empty_interface
+#define runtime_printstring __go_print_string
+#define runtime_printpointer __go_print_pointer
+#define runtime_printuint __go_print_uint64
+#define runtime_printslice __go_print_slice
+#define runtime_printcomplex __go_print_complex
+
+/*
* runtime go-called
*/
-void runtime_panic(Eface);
+void runtime_printbool(_Bool);
+void runtime_printfloat(double);
+void runtime_printint(int64);
+void runtime_printiface(Iface);
+void runtime_printeface(Eface);
+void runtime_printstring(String);
+void runtime_printpc(void*);
+void runtime_printpointer(void*);
+void runtime_printuint(uint64);
+void runtime_printhex(uint64);
+void runtime_printslice(Slice);
+void runtime_printcomplex(__complex double);
+
struct __go_func_type;
void reflect_call(const struct __go_func_type *, const void *, _Bool, _Bool,
void **, void **)
- asm ("libgo_reflect.reflect.call");
+ asm ("reflect.call");
/* Functions. */
#define runtime_panic __go_panic
-#define runtime_printf printf
+#define runtime_write(d, v, n) write((d), (v), (n))
#define runtime_malloc(s) __go_alloc(s)
#define runtime_free(p) __go_free(p)
#define runtime_strcmp(s1, s2) __builtin_strcmp((s1), (s2))
/*
* runtime c-called (but written in Go)
*/
-void runtime_newError(String, Eface*);
void runtime_printany(Eface)
- __asm__("libgo_runtime.runtime.Printany");
+ __asm__("runtime.Printany");
void runtime_newTypeAssertionError(const String*, const String*, const String*, const String*, Eface*)
- __asm__("libgo_runtime.runtime.NewTypeAssertionError");
+ __asm__("runtime.NewTypeAssertionError");
void runtime_newErrorString(String, Eface*)
- __asm__("libgo_runtime.runtime.NewErrorString");
+ __asm__("runtime.NewErrorString");
/*
* wrapped for go users
*/
+bool runtime_isInf(float64 f, int32 sign);
+#define runtime_isNaN(f) __builtin_isnan(f)
void runtime_semacquire(uint32 volatile *);
void runtime_semrelease(uint32 volatile *);
-String runtime_signame(int32 sig);
int32 runtime_gomaxprocsfunc(int32 n);
void runtime_procyield(uint32);
void runtime_osyield(void);
-void runtime_LockOSThread(void) __asm__("libgo_runtime.runtime.LockOSThread");
-void runtime_UnlockOSThread(void) __asm__("libgo_runtime.runtime.UnlockOSThread");
+void runtime_LockOSThread(void) __asm__("runtime.LockOSThread");
+void runtime_UnlockOSThread(void) __asm__("runtime.UnlockOSThread");
+
+bool runtime_showframe(const unsigned char*);
uintptr runtime_memlimit(void);
void runtime_setprof(bool);
void runtime_time_scan(void (*)(byte*, int64));
+void runtime_trampoline_scan(void (*)(byte *, int64));
void runtime_setsig(int32, bool, bool);
#define runtime_setitimer setitimer
};
void __go_register_gc_roots(struct root_list*);
+
+// Size of stack space allocated using Go's allocator.
+// This will be 0 when using split stacks, as in that case
+// the stacks are allocated by the splitstack library.
+extern uintptr runtime_stacks_sys;
+
+extern _Bool __go_file_line (uintptr, String*, String*, int *);