Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(201)

Delta Between Two Patch Sets: src/pkg/runtime/mprof.goc

Issue 84100043: code review 84100043: runtime: fix off-by-one in first frame in runtime.Stack
Left Patch Set: Created 9 years, 12 months ago
Right Patch Set: diff -r 4ca10cc10176 https://code.google.com/p/go/ Created 9 years, 12 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/runtime/stack_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Malloc profiling. 5 // Malloc profiling.
6 // Patterned after tcmalloc's algorithms; shorter code. 6 // Patterned after tcmalloc's algorithms; shorter code.
7 7
8 package runtime 8 package runtime
9 #include "runtime.h" 9 #include "runtime.h"
10 #include "arch_GOARCH.h" 10 #include "arch_GOARCH.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 runtime·memmove(r->stk, mp->createstack, sizeof r->stk); 364 runtime·memmove(r->stk, mp->createstack, sizeof r->stk);
365 r++; 365 r++;
366 } 366 }
367 } 367 }
368 } 368 }
369 369
370 func Stack(b Slice, all bool) (n int) { 370 func Stack(b Slice, all bool) (n int) {
371 uintptr pc, sp; 371 uintptr pc, sp;
372 ········ 372 ········
373 sp = runtime·getcallersp(&b); 373 sp = runtime·getcallersp(&b);
374 » pc = (uintptr)runtime·getcallerpc(&b); 374 » pc = (uintptr)runtime·getcallerpc(&b)-1;
375 375
376 if(all) { 376 if(all) {
377 runtime·semacquire(&runtime·worldsema, false); 377 runtime·semacquire(&runtime·worldsema, false);
378 m->gcing = 1; 378 m->gcing = 1;
379 runtime·stoptheworld(); 379 runtime·stoptheworld();
380 } 380 }
381 381
382 if(b.len == 0) 382 if(b.len == 0)
383 n = 0; 383 n = 0;
384 else{ 384 else{
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 runtime·lock(&tracelock); 506 runtime·lock(&tracelock);
507 m->traceback = 2; 507 m->traceback = 2;
508 runtime·printf("tracegc()\n"); 508 runtime·printf("tracegc()\n");
509 // running on m->g0 stack; show all non-g0 goroutines 509 // running on m->g0 stack; show all non-g0 goroutines
510 runtime·tracebackothers(g); 510 runtime·tracebackothers(g);
511 runtime·printf("end tracegc\n"); 511 runtime·printf("end tracegc\n");
512 runtime·printf("\n"); 512 runtime·printf("\n");
513 m->traceback = 0; 513 m->traceback = 0;
514 runtime·unlock(&tracelock); 514 runtime·unlock(&tracelock);
515 } 515 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b