aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/hashmap.c
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2012-11-30 10:29:41 +0400
committerDmitriy Vyukov <dvyukov@google.com>2012-11-30 10:29:41 +0400
commit0ce96f9ef4533430634fe4329b640176074ef9c4 (patch)
treefbb5d8af81e28fea273b39c772987b790e0e666b /src/pkg/runtime/hashmap.c
parentc3c107f67c86e9e0bf03f831be4f9417c75463a4 (diff)
downloadgo-0ce96f9ef4533430634fe4329b640176074ef9c4.tar.xz
runtime: better stack traces in race reports
When a race happens inside of runtime (chan, slice, etc), currently reports contain only user file:line. If the line contains a complex expression, it's difficult to figure out where the race exactly. This change adds one more top frame with exact runtime function (e.g. runtime.chansend, runtime.mapaccess). R=golang-dev CC=golang-dev https://golang.org/cl/6851125
Diffstat (limited to 'src/pkg/runtime/hashmap.c')
-rw-r--r--src/pkg/runtime/hashmap.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/pkg/runtime/hashmap.c b/src/pkg/runtime/hashmap.c
index 4869669b6e..60c592184e 100644
--- a/src/pkg/runtime/hashmap.c
+++ b/src/pkg/runtime/hashmap.c
@@ -842,7 +842,7 @@ runtime·mapaccess1(MapType *t, Hmap *h, ...)
bool pres;
if(raceenabled && h != nil)
- runtime·racereadpc(h, runtime·getcallerpc(&t));
+ runtime·racereadpc(h, runtime·getcallerpc(&t), runtime·mapaccess1);
ak = (byte*)(&h + 1);
av = ak + ROUND(t->key->size, Structrnd);
@@ -870,7 +870,7 @@ runtime·mapaccess2(MapType *t, Hmap *h, ...)
byte *ak, *av, *ap;
if(raceenabled && h != nil)
- runtime·racereadpc(h, runtime·getcallerpc(&t));
+ runtime·racereadpc(h, runtime·getcallerpc(&t), runtime·mapaccess2);
ak = (byte*)(&h + 1);
av = ak + ROUND(t->key->size, Structrnd);
@@ -901,7 +901,7 @@ reflect·mapaccess(MapType *t, Hmap *h, uintptr key, uintptr val, bool pres)
byte *ak, *av;
if(raceenabled && h != nil)
- runtime·racereadpc(h, runtime·getcallerpc(&t));
+ runtime·racereadpc(h, runtime·getcallerpc(&t), reflect·mapaccess);
if(t->key->size <= sizeof(key))
ak = (byte*)&key;
@@ -974,7 +974,7 @@ runtime·mapassign1(MapType *t, Hmap *h, ...)
runtime·panicstring("assignment to entry in nil map");
if(raceenabled)
- runtime·racewritepc(h, runtime·getcallerpc(&t));
+ runtime·racewritepc(h, runtime·getcallerpc(&t), runtime·mapassign1);
ak = (byte*)(&h + 1);
av = ak + ROUND(t->key->size, t->elem->align);
@@ -992,7 +992,7 @@ runtime·mapdelete(MapType *t, Hmap *h, ...)
runtime·panicstring("deletion of entry in nil map");
if(raceenabled)
- runtime·racewritepc(h, runtime·getcallerpc(&t));
+ runtime·racewritepc(h, runtime·getcallerpc(&t), runtime·mapdelete);
ak = (byte*)(&h + 1);
runtime·mapassign(t, h, ak, nil);
@@ -1017,7 +1017,7 @@ reflect·mapassign(MapType *t, Hmap *h, uintptr key, uintptr val, bool pres)
if(h == nil)
runtime·panicstring("assignment to entry in nil map");
if(raceenabled)
- runtime·racewritepc(h, runtime·getcallerpc(&t));
+ runtime·racewritepc(h, runtime·getcallerpc(&t), reflect·mapassign);
if(t->key->size <= sizeof(key))
ak = (byte*)&key;
else
@@ -1040,7 +1040,7 @@ runtime·mapiterinit(MapType *t, Hmap *h, struct hash_iter *it)
return;
}
if(raceenabled)
- runtime·racereadpc(h, runtime·getcallerpc(&t));
+ runtime·racereadpc(h, runtime·getcallerpc(&t), runtime·mapiterinit);
hash_iter_init(t, h, it);
it->data = hash_next(it);
if(debug) {
@@ -1085,7 +1085,7 @@ void
runtime·mapiternext(struct hash_iter *it)
{
if(raceenabled)
- runtime·racereadpc(it->h, runtime·getcallerpc(&it));
+ runtime·racereadpc(it->h, runtime·getcallerpc(&it), runtime·mapiternext);
if(runtime·gcwaiting)
runtime·gosched();
@@ -1190,7 +1190,7 @@ reflect·maplen(Hmap *h, intgo len)
else {
len = h->count;
if(raceenabled)
- runtime·racereadpc(h, runtime·getcallerpc(&h));
+ runtime·racereadpc(h, runtime·getcallerpc(&h), reflect·maplen);
}
FLUSH(&len);
}