runtime: tweak addfinroots to preserve original pointer

Use local variable so that stack trace will show value of v.

Fixes #4790.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7300106
This commit is contained in:
Russ Cox 2013-02-13 22:31:45 -05:00
parent 0c8ed71079
commit e5dae3baaa
1 changed files with 3 additions and 2 deletions

View File

@ -1255,13 +1255,14 @@ static void
addfinroots(void *v)
{
uintptr size;
void *base;
size = 0;
if(!runtime·mlookup(v, &v, &size, nil) || !runtime·blockspecial(v))
if(!runtime·mlookup(v, &base, &size, nil) || !runtime·blockspecial(base))
runtime·throw("mark - finalizer inconsistency");
// do not mark the finalizer block itself. just mark the things it points at.
addroot((Obj){v, size, 0});
addroot((Obj){base, size, 0});
}
static void