Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

include extra context in compiler and linker errors #218

Open
mvdan opened this issue Feb 3, 2021 · 5 comments
Open

include extra context in compiler and linker errors #218

mvdan opened this issue Feb 3, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@mvdan
Copy link
Member

mvdan commented Feb 3, 2021

For example, from a recent bug report:

zdzCF.B: relocation target type.path/to/package/types.ZU31i not defined
zdzCF.F: relocation target type.path/to/package/types.ZHdpV not defined
zHIRS.ZCZ_Z.func1: relocation target type.path/to/package/types.ZHdpV not defined
z3hTq.C.func1.2: relocation target type.path/to/package/types.Z8uvN not defined
z3hTq.C.func1.2: relocation target type.path/to/package/types.ZU31i not defined
z3hTq.B.func1.2: relocation target type.path/to/package/types.Z8uvN not defined
z3hTq.B.func1.2: relocation target type.path/to/package/types.ZU31i not defined
exit status 2
exit status 2

If I was debugging this failure manually, I'd have to do a bunch of debugging to figure out what original bit of code the obfuscated names like ZU31i actually refer to.

This is unnecessary, and the errors are unnecessarily hostile to the average user. We should, at least, provide context as to what was the original name of each of these.

We could probably reuse the work from #5 here. We would print the usual build error, and then print its un-garbled version too if any garbled identifiers were found.

@mvdan mvdan added the enhancement New feature or request label Mar 5, 2021
@mvdan mvdan added this to the v0.3.0 milestone Apr 8, 2021
@mvdan
Copy link
Member Author

mvdan commented Apr 17, 2021

Reversing is already good enough to do this. For example, for #315:

$ wgo1 garble build
# github.com/fatedier/frp/client/proxy
E5ewj7pj.go:27: pxy.swzbE4SL.Plugin undefined (type *HliYu5gW.TCPProxyConf has no field or method Plugin)
ck6BOo76.go:1: pxy.swzbE4SL.Plugin undefined (type *HliYu5gW.TCPProxyConf has no field or method Plugin)
ck6BOo76.go:1: pxy.swzbE4SL.PluginParams undefined (type *HliYu5gW.TCPProxyConf has no field or method PluginParams)
M8vRqyjN.go:13: pxy.swzbE4SL.Plugin undefined (type *HliYu5gW.TCPMuxProxyConf has no field or method Plugin)
TQQwyS7C.go:1: pxy.swzbE4SL.Plugin undefined (type *HliYu5gW.TCPMuxProxyConf has no field or method Plugin)
TQQwyS7C.go:1: pxy.swzbE4SL.PluginParams undefined (type *HliYu5gW.TCPMuxProxyConf has no field or method PluginParams)
BXLs4XhX.go:13: pxy.swzbE4SL.Plugin undefined (type *HliYu5gW.HTTPProxyConf has no field or method Plugin)
FJYiROJ6.go:1: pxy.swzbE4SL.Plugin undefined (type *HliYu5gW.HTTPProxyConf has no field or method Plugin)
FJYiROJ6.go:1: pxy.swzbE4SL.PluginParams undefined (type *HliYu5gW.HTTPProxyConf has no field or method PluginParams)
LfBuznMY.go:13: pxy.swzbE4SL.Plugin undefined (type *HliYu5gW.HTTPSProxyConf has no field or method Plugin)
LfBuznMY.go:13: too many errors
exit status 2
exit status 2
$ wgo1 garble build |& wgo1 garble reverse
# github.com/fatedier/frp/client/proxy
E5ewj7pj.go:27: pxy.swzbE4SL.Plugin undefined (type *github.com/fatedier/frp/pkg/config.TCPProxyConf has no field or method Plugin)
github.com/fatedier/frp/client/proxy/proxy.go:136: pxy.swzbE4SL.Plugin undefined (type *github.com/fatedier/frp/pkg/config.TCPProxyConf has no field or method Plugin)
github.com/fatedier/frp/client/proxy/proxy.go:136: pxy.swzbE4SL.PluginParams undefined (type *github.com/fatedier/frp/pkg/config.TCPProxyConf has no field or method PluginParams)
github.com/fatedier/frp/client/proxy/proxy.go:1523: pxy.swzbE4SL.Plugin undefined (type *github.com/fatedier/frp/pkg/config.TCPMuxProxyConf has no field or method Plugin)
github.com/fatedier/frp/client/proxy/proxy.go:165: pxy.swzbE4SL.Plugin undefined (type *github.com/fatedier/frp/pkg/config.TCPMuxProxyConf has no field or method Plugin)
github.com/fatedier/frp/client/proxy/proxy.go:165: pxy.swzbE4SL.PluginParams undefined (type *github.com/fatedier/frp/pkg/config.TCPMuxProxyConf has no field or method PluginParams)
github.com/fatedier/frp/client/proxy/proxy.go:1813: pxy.swzbE4SL.Plugin undefined (type *github.com/fatedier/frp/pkg/config.HTTPProxyConf has no field or method Plugin)
github.com/fatedier/frp/client/proxy/proxy.go:194: pxy.swzbE4SL.Plugin undefined (type *github.com/fatedier/frp/pkg/config.HTTPProxyConf has no field or method Plugin)
github.com/fatedier/frp/client/proxy/proxy.go:194: pxy.swzbE4SL.PluginParams undefined (type *github.com/fatedier/frp/pkg/config.HTTPProxyConf has no field or method PluginParams)
github.com/fatedier/frp/client/proxy/proxy.go:2103: pxy.swzbE4SL.Plugin undefined (type *github.com/fatedier/frp/pkg/config.HTTPSProxyConf has no field or method Plugin)
github.com/fatedier/frp/client/proxy/proxy.go:2103: too many errors
exit status 2
exit status 2

Edit: looks like just the field names aren't reversed, but still, the rest is helpful.

@capnspacehook
Copy link
Contributor

Fields names are reversed as of 0150aa8 right?

@capnspacehook
Copy link
Contributor

Also, is there any reason we wouldn't want to automatically reverse the error message(s) instead of making the user reverse the error messages themselves?

@mvdan
Copy link
Member Author

mvdan commented Apr 23, 2021

Fields names are reversed as of 0150aa8 right?

Yep, I fixed that shortly after posting the comment.

Also, is there any reason we wouldn't want to automatically reverse the error message(s) instead of making the user reverse the error messages themselves?

That's what this issue is about :) My last comment just says that reverse is now good enough that hooking it up to build errors is now possible. Before, we were blocked because reverse wasn't good enough.

@mvdan mvdan removed this from the v0.3.0 milestone May 15, 2021
@mvdan
Copy link
Member Author

mvdan commented May 15, 2021

Dropping this from the milestone because it doesn't seem urgent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants