proc,service: pretty print time.Time variables#2865
Conversation
97277d3 to
8f5ada0
Compare
polinasok
left a comment
There was a problem hiding this comment.
Meta question: this PR manually reconstructs things from the low-level fields. I am assuming somewhere in the standard library this is done as well when time is converted to string. That logic is probably hidden somewhere inside of unexported methods and can't be reused, but but can they at least be referenced beyond only a pointer to time.go? That could be of help in sanity checking the logic.
|
|
||
| wall, _ := constant.Uint64Val(wallv.Value) | ||
| ext, _ := constant.Int64Val(extv.Value) | ||
| _ = ext |
| case reflect.Float64: | ||
| return convertFloatValue(v, 64) | ||
| case reflect.String, reflect.Func: | ||
| case reflect.String, reflect.Func, reflect.Struct: |
There was a problem hiding this comment.
I don't think there's a reason to be more specific.
The work here is done by copying a time.Time object read from the target into a time.Time object allocated by delve, time.go doesn't do this anywhere. The relevant comment is the one inside |
|
@polinasok wrote
Kinda tangential: I'd like to see pretty printers as starlark scripts, contributed to (and ultimately maintained in parallel with) the packages they serve. Ideally with tests to ensure they stay in sync with the go code. This thinking insipired by |
At the moment all starlark scripts are executed client side, meaning that if we did this all the pretty printing would only work on the command line client, which isn't that different from defining a
If we moved starlark evaluation to the backend we wouldn't necessarily be able to access those directories as delve's backend only has access to the executable it's debugging. Also directories that only contain non-go files are stripped from module archives, which means that you wouldn't have access to those files for any package except the packages of the main module and the standard library. |
oof. This sounds like far more work than I'd hoped for.
Any alternatives I'm missing? The reason I prefer scripts over hard-coded functions is that I expect it'd be easier to add additional pretty-printers, and wouldn't require re-building delve. The most immediate use for me would be with |
|
I'm catching up on the discussion still a bit here however I do like the approach of using the scripting interface for the pretty printing... I know it's a lot of work and I'm not suggesting it right now but I really think it's worth a conversation and consideration to take more advantage of the scripting support. |
|
Moving starlark evaluation to the backend is possible, there's going to be some pain points with making
|
|
Let's discuss the general scripting interface in a separate issue. As @aarzilli pointed out, the implication with DAP is unclear. Starlark scripting is too powerful (It's delve RPC-based so you can do more than just pretty printing) for DAP to embrace it without careful design IMO. It's unclear to me, who's responsible for For |
I wouldn't allow call and other commands that resume execution in this context. |
Agreed, this will be a large undertaking if we happen to go for it and would need upfront design, discussion and consideration. |
|
There's still a few outstanding questions from @polinasok, let's move the discussion of using the scripting interface to it's own issue and review this PR as is. |
|
@aarzilli would you mind creating the issue for the scripting changes? |
Oops I didn't see them. |
|
Needs rebase. Also @polinasok can you do another review pass? |
|
Rebased. |
polinasok
left a comment
There was a problem hiding this comment.
Thank you for adding the location logic.
Fixes #999