Skip to content

Instantly share code, notes, and snippets.

View dr2chase's full-sized avatar
💭
I am working on Go stuff

David Chase dr2chase

💭
I am working on Go stuff
View GitHub Profile
#!/bin/bash
# filter output of multiple benchmarking experiments into a spreadsheet-friendly form
egrep '^[[a-zA-Z/]' "$1" | egrep -v "B/s|old speed" | \
sed -e '1,$s/[^0-9]*s ±[ 0-9]*%//g' | sed -e '1,$s/(p.*)//g' | \
sed -e '1,$s?[-_.a-z/]*git-codereview: changed to branch ?,?g' | \
sed -e '1,$s/ * /,/g' | \
sed -e '1,$s/,~//g' | \
sed -e '1,$s/,[-+][0-9.]*%//g' | \
@dr2chase
dr2chase / javabugdemo.bash
Created May 15, 2017 20:17
Shell script that unpacks and runs a Java bug. Verification does not ensure static correctness of interface types.
echo "interface I1 { }" > I1.java
echo "interface I2 { }" > I2.java
echo "interface I3 { }" > I3.java
echo "class I1I2 implements I1, I2 { }" > I1I2.java_good
echo "class I1I2 implements I1 { }" > I1I2.java_bad
echo "class I1I3I2 implements I1, I3, I2 { }" > I1I3I2.java
cat > tricky.java <<'//EOF'
class tricky {
I2 i2;
@dr2chase
dr2chase / 18597-args-results-in-registers.md
Last active October 5, 2017 17:49
Browsable copy of golang proposal CL 35054

Proposal: Passing Go arguments and results in registers.

Author(s): David Chase

Last updated: 2017-01-10

Discussion at https://golang.org/issue/18597.

Abstract

~/GoogleDrive/work/tmp/ttmp$ dlv debug
Type 'help' for list of commands.
(dlv) b main.foo
Breakpoint 1 set at 0x2058 for main.foo() ./step_hide.go:12
(dlv) c
> main.foo() ./step_hide.go:12 (hits goroutine(11):1 total:3) (PC: 0x2058)
> main.foo() ./step_hide.go:12 (hits goroutine(7):1 total:3) (PC: 0x2058)
> main.foo() ./step_hide.go:12 (hits goroutine(5):1 total:3) (PC: 0x2058)
7:
8: var v int = 99
dlv debug
Type 'help' for list of commands.
(dlv) b step_hide.go:35
Breakpoint 1 set at 0x237c for main.main() ./step_hide.go:35
(dlv) c
> main.main() ./step_hide.go:35 (hits goroutine(1):1 total:1) (PC: 0x237c)
30: x := v
31: y := x * x
32: var z int
33: threads()
package main
import (
"fmt"
"time"
)
var v int = 99
var s string
@dr2chase
dr2chase / duffsteptest_bug.txt
Created June 15, 2016 15:21
Buggy output debugging duffsteptest.go
dlv debug
Type 'help' for list of commands.
(dlv) b main.foo
Breakpoint 1 set at 0x2058 for main.foo() ./code.go:14
(dlv) c
> main.foo() ./code.go:14 (hits goroutine(1):1 total:1) (PC: 0x2058)
9: // Expect to be stopped in fmt.Printf or runtime.duffzero
10: import "fmt"
11:
12: var v int = 99
@dr2chase
dr2chase / duffsteptest_expected.txt
Created June 15, 2016 15:16
Expected output debugging duffsteptest.go
dlv debug
Type 'help' for list of commands.
(dlv) b main.foo
Breakpoint 1 set at 0x2058 for main.foo() ./code.go:14
(dlv) c
> main.foo() ./code.go:14 (hits goroutine(1):1 total:1) (PC: 0x2058)
9: // Expect to be stopped in fmt.Printf or runtime.duffzero
10: import "fmt"
11:
12: var v int = 99
@dr2chase
dr2chase / duffsteptest.go
Last active June 15, 2016 15:15
Test file for delve stepping
package main
// A delve stepping test.
// dlv debug
// b main.foo
// c
// s
// s
// Expect to be stopped in fmt.Printf or runtime.duffzero
import "fmt"