Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Empty structs aren't decoded correctly in function arguments. #59

Open
dallbee opened this issue Apr 14, 2021 · 2 comments
Open

Empty structs aren't decoded correctly in function arguments. #59

dallbee opened this issue Apr 14, 2021 · 2 comments

Comments

@dallbee
Copy link
Contributor

dallbee commented Apr 14, 2021

This is a pretty minor thing, but it confused me enough to make me want to fix it, unless its a harder problem than I'm realizing.

Empty structs are decoded as ..., `` or sometimes as unknown.

I'd be happy to take a stab at this tonight if this is indeed a bug.

Examples:

//go:noinline
func Foo(x struct{}) {
	panic("test")
}

func TestFoo(t *testing.T) {
	Foo(struct{}{})
}

Results in:

1: running [Created by testing.(*T).Run @ testing.go:1238]
    testing testing.go:1143    tRunner.func1.2(*T(#1), func(#2))
    testing testing.go:1146    tRunner.func1(*T(#3))
            panic.go:965       panic(interface{}(#1))
    pp ppl_test.go:16 Foo()
    pp pp_test.go:20 TestFoo(*T(#3))
    testing testing.go:1193    tRunner(*T(#3), func(0x8952b8))
exit status 2

And

//go:noinline
func Foo(x chan struct{}) {
	panic("test")
}

func TestFoo(t *testing.T) {
	Foo(nil)
}

Results in:

1: running [Created by testing.(*T).Run @ testing.go:1238]
    testing testing.go:1143    tRunner.func1.2(*T(#1), func(#2))
    testing testing.go:1146    tRunner.func1(*T(#3))
            panic.go:965       panic(interface{}(#1))
    pp ppl_test.go:16 Foo(chan <unknown>(0x0))
    pp pp_test.go:20 TestFoo(*T(#3))
    testing testing.go:1193    tRunner(*T(#3), func(0x8952b8))
exit status 2
@maruel
Copy link
Owner

maruel commented Apr 15, 2021

I added them to cmd/panic/main.go and the output is so-so from the stdlib. May want to investigate later. I need to fix the CI first though before starting to fix this.

@maruel
Copy link
Owner

maruel commented Jul 11, 2021

CI is fixed. Just need someone to help here.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants