Skip to content

Commit

Permalink
runtime: set invalidptr=1 by default, as documented
Browse files Browse the repository at this point in the history
Also make invalidptr control the recently added GC pointer check,
as documented.

Change-Id: Iccfdf49480219d12be8b33b8f03d8312d8ceabed
Reviewed-on: https://go-review.googlesource.com/12857
Run-TryBot: Russ Cox <[email protected]>
Reviewed-by: Rob Pike <[email protected]>
  • Loading branch information
rsc authored and adg committed Jul 29, 2015
1 parent e4bd8e0 commit d3ffc97
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/runtime/mbitmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func heapBitsForObject(p uintptr) (base uintptr, hbits heapBits, s *mspan) {
// The following ensures that we are rigorous about what data
// structures hold valid pointers.
// TODO(rsc): Check if this still happens.
if true {
if debug.invalidptr != 0 {
// Still happens sometimes. We don't know why.
printlock()
print("runtime:objectstart Span weird: p=", hex(p), " k=", hex(k))
Expand Down
5 changes: 3 additions & 2 deletions src/runtime/runtime1.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,6 @@ type dbgVar struct {
value *int32
}

// TODO(rsc): Make GC respect debug.invalidptr.

// Holds variables parsed from GODEBUG env var,
// except for "memprofilerate" since there is an
// existing int var for that value, which may
Expand Down Expand Up @@ -340,6 +338,9 @@ var dbgvars = []dbgVar{
}

func parsedebugvars() {
// defaults
debug.invalidptr = 1

for p := gogetenv("GODEBUG"); p != ""; {
field := ""
i := index(p, ",")
Expand Down

0 comments on commit d3ffc97

Please sign in to comment.