-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: Compiler doesn't expand paths specified in the //line directive #40365
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
Comments
I believe this working as intended; |
Is this about some tool in particular? I think you are getting exactly what you are asking for here, maybe context would help. |
Ok, so generator is responsible for generating full paths inside the //line comments? I thought the compiler could make full path if the filename inside the comment is not already absolute.
go2go and goyacc don't generate full paths, that's why I thought they expect compiler to expand those. |
If that was the case then you couldn't commit the output of the generator. I don't know. |
The issue of full or abbreviated path names has no resolution. Some want the complete path, their counterparts view that as information leakage and ask for options to remove it. The behaviour of //line simply replaces whatever the compiler was going to embed into the dwarf information with the value specified. Note that this information may later be stripped out of the binary. I would like to close this issue as I don't see a bug or a proposal to change the current behaviour (noting the inherent conflict stated above) |
Not insisting on a fix, but current behavior makes it harder to find source of a generated code in debugger. I thought that //line directives are intended to help with that. Given that information can be stripped and full go file names are already in executable, expanding //line filenames doesn't introduce serious leakage? If the issue wasn't raised before, then maybe it's not that important. |
I think the solution isn't to change the compiler, but change the code generator that is making those //lines. |
/cc @randall77 @griesemer |
I agree with @davecheney - whatever is inserting the line directives should be expanding them, if that's what they want. The same thing happens in C. If you have a C file:
If you put that C file in some directory, you will get the path you gave the compiler in the first print (be it |
Closed as answered. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Compiled code containing //line directives. Code has the following structure:
Code is compiled with
go build -gcflags="all=-N -l" .
What did you expect to see?
Debug info contains 2 entries:
path/to/gen/foo
andpath/to/gen/pkg/foo
.What did you see instead?
A single file entry:
The text was updated successfully, but these errors were encountered: