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

cmd/compile: add line numbers for values and blocks at HTML SSA output? #17314

Open
dAdAbird opened this issue Oct 1, 2016 · 9 comments
Open
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dAdAbird
Copy link
Contributor

dAdAbird commented Oct 1, 2016

We already have it in the "genssa" section, and it's pretty simplifies understanding what's going on. I propose to do the same for other sections of the output.

Since writing (sourcefile.go:42) will make output noisier it would be better to show just line numbers in the left column and make them gray colored and with smaller font size than the code (so it looks like in editors).

If you ok with that I can show my vision of design for approval and then provide CL.

@quentinmit quentinmit changed the title Proposal: cmd/compile: add line numbers for values and blocks at HTML SSA output proposal: cmd/compile: add line numbers for values and blocks at HTML SSA output Oct 3, 2016
@quentinmit quentinmit added this to the Proposal milestone Oct 3, 2016
@randall77
Copy link
Contributor

I find the html output pretty cluttered already. I feel like adding line numbers would only make that worse. I guess I'm not philosophically opposed, but I'd like to see some more arguments for why it is useful. I've never encountered a situation where line numbers might be useful (except maybe for debugging line number generation).

@dAdAbird
Copy link
Contributor Author

dAdAbird commented Oct 4, 2016

Line numbers may be useful to link SSA instructions with the function code. It gives a better understanding of how the Go code represents in SSA form. Especially, that is actual for people who just start dealing with this.
For example, line numbers in the "genssa" output really help to figure out what asm instructions does when you can see how it relates to your code.

On the other hand, I agree that it'll add more noise into HTML output.
But what if to do something like that:
line numbers proof of concept

@dr2chase
Copy link
Contributor

dr2chase commented Oct 5, 2016

Could it be switchable? There's a mess of Javascript in there already, this might not be too much.

One sometime use of the SSA output is to copy a column out for processing in an editor (e.g., diffing against another compilation of same code), so a mitigating bell/whistle might be a "copy" button for each column, since those line numbers might be mess up the copy (which sometimes requires post-processing anyhow).

@dAdAbird
Copy link
Contributor Author

dAdAbird commented Oct 5, 2016

The other solution is to prevent line numbers from being selected and copied with CSS. Without any JS and additional elements.

screen shot 2016-10-05 at 16 39 28

@dr2chase
Copy link
Contributor

dr2chase commented Oct 5, 2016

Just now realized, what happens with line numbers when we inline functions, and how would we want to express that, assuming we haven't made a mess of that information already in the compiler? Color-coded? Tool-tips for the function name?

Note that once we start inlining calls that contain safepoints, we'll need to get this right anyhow for stack traces and debugging.

@dAdAbird
Copy link
Contributor Author

Yeah, that's a good point.

So, I'd like to add that information into compiler (add CallLine and CallFile values into ssa.Value, ssa.Block and gc.Node types) and add DW_AT_call_file and DW_AT_call_line attributes into DWARF. As you mentioned, we'll need it anyhow.

As for the HTML output, what if to mark inlined instructions with a color and show more info on mouse over. Something like this:
screen shot 2016-10-17 at 19 14 14

@bradfitz
Copy link
Contributor

bradfitz commented Nov 7, 2016

Deferring to @randall77 to decide. Removing proposal label.

@bradfitz bradfitz removed the Proposal label Nov 7, 2016
@bradfitz bradfitz changed the title proposal: cmd/compile: add line numbers for values and blocks at HTML SSA output cmd/compile: add line numbers for values and blocks at HTML SSA output? Nov 7, 2016
@rsc rsc added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Nov 7, 2016
@rsc rsc modified the milestones: Go1.9, Proposal Nov 7, 2016
@randall77
Copy link
Contributor

Adding this is ok, but please put it behind a flag that is off by default.

@josharian josharian modified the milestones: Unplanned, Go1.9 May 11, 2017
@rsc rsc added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels May 22, 2017
@agnivade
Copy link
Contributor

/cc @ysmolsky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

8 participants