Skip to content

Commit 81a31f5

Browse files
committed
internal/godebug: add bisect support
CL 491875 introduces a new bisect command, which we plan to document for use by end users to debug semantic changes in the compiler and in GODEBUGs. This CL adds bisect support to GODEBUGs, at least the ones used via internal/godebug. Support for runtime-internal GODEBUGs like panicnil will take a bit more work in followup CLs. The new API in internal/bisect to support stack-based bisecting should be easily reusable in non-GODEBUG settings as well, once we finalize and export the API. Change-Id: I6cf779c775329aceb3f3b2b2b2f221ce8a67deee Reviewed-on: https://go-review.googlesource.com/c/go/+/491975 Reviewed-by: David Chase <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Russ Cox <[email protected]>
1 parent 9389796 commit 81a31f5

File tree

6 files changed

+399
-80
lines changed

6 files changed

+399
-80
lines changed

src/cmd/compile/internal/base/hashdebug.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func (d *HashDebug) DebugHashMatchParam(pkgAndName string, param uint64) bool {
296296

297297
hash := hashOf(pkgAndName, param)
298298
if d.bisect != nil {
299-
if d.bisect.ShouldReport(hash) {
299+
if d.bisect.ShouldPrint(hash) {
300300
d.logDebugHashMatch(d.name, pkgAndName, hash, param)
301301
}
302302
return d.bisect.ShouldEnable(hash)
@@ -324,14 +324,14 @@ func (d *HashDebug) DebugHashMatchPos(pos src.XPos) bool {
324324
func (d *HashDebug) debugHashMatchPos(ctxt *obj.Link, pos src.XPos) bool {
325325
// TODO: When we remove the old d.match code, we can use
326326
// d.bisect.Hash instead of the locked buffer, and we can
327-
// use d.bisect.Visible to decide whether to format a string.
327+
// use d.bisect.MarkerOnly to decide whether to format a string.
328328
d.mu.Lock()
329329
defer d.mu.Unlock()
330330

331331
b := d.bytesForPos(ctxt, pos)
332332
hash := hashOfBytes(b, 0)
333333
if d.bisect != nil {
334-
if d.bisect.ShouldReport(hash) {
334+
if d.bisect.ShouldPrint(hash) {
335335
d.logDebugHashMatchLocked(d.name, string(b), hash, 0)
336336
}
337337
return d.bisect.ShouldEnable(hash)

src/go/build/deps_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ var depsRules = `
6868
< sync/atomic
6969
< internal/race
7070
< sync
71+
< internal/bisect
7172
< internal/godebug
7273
< internal/reflectlite
7374
< errors

0 commit comments

Comments
 (0)