aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-01-30 01:37:13 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-01-30 01:37:13 +0000
commit777133fefb9704c957884216e44bf7ba25ca2fae (patch)
treeac10866a1e77c784cb9d48b872fd8013ba124fd0 /libgo/runtime
parent900f0840363c7a110723b18024b361f22b8892b9 (diff)
downloadgcc-777133fefb9704c957884216e44bf7ba25ca2fae.zip
gcc-777133fefb9704c957884216e44bf7ba25ca2fae.tar.gz
gcc-777133fefb9704c957884216e44bf7ba25ca2fae.tar.bz2
libgo: Update Go library to master revision 15502/229081515358.
From-SVN: r195569
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/go-traceback.c6
-rw-r--r--libgo/runtime/panic.c5
-rw-r--r--libgo/runtime/proc.c14
-rw-r--r--libgo/runtime/runtime.c6
-rw-r--r--libgo/runtime/runtime.h6
-rw-r--r--libgo/runtime/time.goc4
6 files changed, 29 insertions, 12 deletions
diff --git a/libgo/runtime/go-traceback.c b/libgo/runtime/go-traceback.c
index 11cc052..30a5ed9 100644
--- a/libgo/runtime/go-traceback.c
+++ b/libgo/runtime/go-traceback.c
@@ -17,11 +17,11 @@ runtime_traceback ()
int32 c;
c = runtime_callers (1, pcbuf, sizeof pcbuf / sizeof pcbuf[0]);
- runtime_printtrace (pcbuf, c);
+ runtime_printtrace (pcbuf, c, true);
}
void
-runtime_printtrace (uintptr *pcbuf, int32 c)
+runtime_printtrace (uintptr *pcbuf, int32 c, bool current)
{
int32 i;
@@ -32,7 +32,7 @@ runtime_printtrace (uintptr *pcbuf, int32 c)
intgo line;
if (__go_file_line (pcbuf[i], &fn, &file, &line)
- && runtime_showframe (fn))
+ && runtime_showframe (fn, current))
{
runtime_printf ("%S\n", fn);
runtime_printf ("\t%S:%D\n", file, (int64) line);
diff --git a/libgo/runtime/panic.c b/libgo/runtime/panic.c
index 23a56f3..7b9b578 100644
--- a/libgo/runtime/panic.c
+++ b/libgo/runtime/panic.c
@@ -86,6 +86,11 @@ runtime_dopanic(int32 unused __attribute__ ((unused)))
void
runtime_throw(const char *s)
{
+ M *mp;
+
+ mp = runtime_m();
+ if(mp->throwing == 0)
+ mp->throwing = 1;
runtime_startpanic();
runtime_printf("fatal error: %s\n", s);
runtime_dopanic(0);
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index e805c90..b2e37f3 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -528,6 +528,7 @@ runtime_main(void)
setmcpumax(runtime_gomaxprocs);
runtime_sched.init = true;
scvg = __go_go(runtime_MHeap_Scavenger, nil);
+ scvg->issystem = true;
main_init();
runtime_sched.init = false;
if(!runtime_sched.lockmain)
@@ -638,12 +639,16 @@ void
runtime_tracebackothers(G * volatile me)
{
G * volatile gp;
- Traceback traceback;
+ Traceback tb;
+ int32 traceback;
- traceback.gp = me;
+ tb.gp = me;
+ traceback = runtime_gotraceback();
for(gp = runtime_allg; gp != nil; gp = gp->alllink) {
if(gp == me || gp->status == Gdead)
continue;
+ if(gp->issystem && traceback < 2)
+ continue;
runtime_printf("\n");
runtime_goroutineheader(gp);
@@ -661,7 +666,7 @@ runtime_tracebackothers(G * volatile me)
continue;
}
- gp->traceback = &traceback;
+ gp->traceback = &tb;
#ifdef USING_SPLIT_STACK
__splitstack_getcontext(&me->stack_context[0]);
@@ -672,7 +677,7 @@ runtime_tracebackothers(G * volatile me)
runtime_gogo(gp);
}
- runtime_printtrace(traceback.pcbuf, traceback.c);
+ runtime_printtrace(tb.pcbuf, tb.c, false);
runtime_goroutinetrailer(gp);
}
}
@@ -975,6 +980,7 @@ top:
if((scvg == nil && runtime_sched.grunning == 0) ||
(scvg != nil && runtime_sched.grunning == 1 && runtime_sched.gwait == 0 &&
(scvg->status == Grunning || scvg->status == Gsyscall))) {
+ m->throwing = -1; // do not dump full stacks
runtime_throw("all goroutines are asleep - deadlock!");
}
diff --git a/libgo/runtime/runtime.c b/libgo/runtime/runtime.c
index b090169..48ece55 100644
--- a/libgo/runtime/runtime.c
+++ b/libgo/runtime/runtime.c
@@ -132,10 +132,12 @@ runtime_cputicks(void)
}
bool
-runtime_showframe(String s)
+runtime_showframe(String s, bool current)
{
static int32 traceback = -1;
-
+
+ if(current && runtime_m()->throwing > 0)
+ return 1;
if(traceback < 0)
traceback = runtime_gotraceback();
return traceback > 1 || (__builtin_memchr(s.str, '.', s.len) != nil && __builtin_memcmp(s.str, "runtime.", 7) != 0);
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index a937503..de72f42 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -178,6 +178,7 @@ struct G
G* schedlink;
bool readyonstop;
bool ispanic;
+ bool issystem;
int8 raceignore; // ignore race detection events
M* m; // for debuggers, but offset not hard-coded
M* lockedm;
@@ -208,6 +209,7 @@ struct M
G* curg; // current running goroutine
int32 id;
int32 mallocing;
+ int32 throwing;
int32 gcing;
int32 locks;
int32 nomemprof;
@@ -389,7 +391,7 @@ void runtime_goroutineheader(G*);
void runtime_goroutinetrailer(G*);
void runtime_traceback();
void runtime_tracebackothers(G*);
-void runtime_printtrace(uintptr*, int32);
+void runtime_printtrace(uintptr*, int32, bool);
String runtime_gostringnocopy(const byte*);
void* runtime_mstart(void*);
G* runtime_malg(int32, byte**, size_t*);
@@ -593,7 +595,7 @@ void runtime_osyield(void);
void runtime_LockOSThread(void) __asm__ (GOSYM_PREFIX "runtime.LockOSThread");
void runtime_UnlockOSThread(void) __asm__ (GOSYM_PREFIX "runtime.UnlockOSThread");
-bool runtime_showframe(String);
+bool runtime_showframe(String, bool);
uintptr runtime_memlimit(void);
diff --git a/libgo/runtime/time.goc b/libgo/runtime/time.goc
index d497361..9a5cbdf 100644
--- a/libgo/runtime/time.goc
+++ b/libgo/runtime/time.goc
@@ -110,8 +110,10 @@ addtimer(Timer *t)
runtime_ready(timers.timerproc);
}
}
- if(timers.timerproc == nil)
+ if(timers.timerproc == nil) {
timers.timerproc = __go_go(timerproc, nil);
+ timers.timerproc->issystem = true;
+ }
}
// Delete timer t from the heap.