Comments (7)
- Support both a human readable format and a separate machine readable output format (for IDE integration).
What did you have in mind for a machine readable output?
- Standardize when the type name is shown in the human readable format. My first thought is to never show it when using the print command and add a ptype command to print the type of a variable on demand.
Yeah, I definitely agree with this. I think this also extends into any nonessential information we display about variables, i.e. displaying len and cap for slices is most likely unnecessary. Maybe we have a command to display extended information about a variable, including type and any other metadata associated with it.
- Support slice syntax for printing arrays. print x prints the first 64 elements, print x[0] prints the first element, print x[10:12] prints elements 10 to 12 etc.
Absolutely.
- Support pretty-printing for structs. This could be switched off and on.
Good idea, maybe a flag for the print command, or a runtime configuration to enable pretty printing? I'm definitely open to suggestions.
from delve.
What did you have in mind for a machine readable output?
Not sure, maybe json? Something standard so people can focus on integration rather than on how to parse the output.
Good idea, maybe a flag for the print command, or a runtime configuration to enable pretty printing? > I'm definitely open to suggestions.
I like GDB's combo of runtime config + startup script to set the defaults. Opens a lot of doors for customizing other output such as switching to machine readable output, chaning the default number of elements etc.
from delve.
Not sure, maybe json? Something standard so people can focus on integration rather than on how to parse the output.
JSON sounds fine to me.
I like GDB's combo of runtime config + startup script to set the defaults. Opens a lot of doors for customizing other output such as switching to machine readable output, chaning the default number of elements etc.
Currently, there's no real way to configure Delve. I'd definitely like to talk through adding configuration to Delve. A startup script, or some sort of config file in the users home dir paired with maybe a command to set / list runtime variables.
from delve.
+1 on JSON, it's pretty clear - definitely being able to log/redirect output to a file also (cf set logging file ) and enable/disable pagination for human interaction and scripted modes.
from delve.
I also wonder if being able to output runtime/debug and pprof style info directly in delve would be useful. At least a quick hook to dump expvar into json may be worth it even if not the heap/gc/profile hooks.
from delve.
May I suggest https://github.com/kr/pretty as a possible solution for pretty printing structs / maps.
As a small example:
package main
import "github.com/kr/pretty"
func main() {
type (
miniStr struct {
mini string
}
str struct {
payload string
payload2 miniStr
}
)
a := map[string]map[string]str{
"a": map[string]str{
"b": str{
payload: "c",
payload2: miniStr{
mini: "d",
mini2: "e",
},
},
},
"a2": map[string]str{
"b2": str{
payload: "c2",
payload2: miniStr{
mini: "d2",
mini2: "e2",
},
},
},
}
pretty.Printf("%# v\n", a)
}
map[a:map[b:{payload:c payload2:{mini:d mini2:e}}] a2:map[b2:{payload:c2 payload2:{mini:d2 mini2:e2}}]]
map[string]map[string]main.str{
"a": {
"b": {
payload: "c",
payload2: main.miniStr{mini:"d", mini2:"e"},
},
},
"a2": {
"b2": {
payload: "c2",
payload2: main.miniStr{mini:"d2", mini2:"e2"},
},
},
}
from delve.
Moving discussion related issues to mailing list. Please see (https://groups.google.com/forum/#!forum/delve-dev) for further discussion.
from delve.
Related Issues (20)
- support for Termux debugger with the Android
- How build arm version HOT 1
- Support `dlv types` from DAP (the same way `types` is supported in the command line `dlv` REPL)
- polish go1.23 range-over-func UX HOT 1
- Does delve ignore // line instructions during debug HOT 1
- Breakpoints do not work in packages with a TestMain(*testing.M) function HOT 1
- Unable to print a package string const value during a breakpoint HOT 1
- Error clearing stack watchpoint HOT 2
- Add defer functions to follow-calls tracing option
- Breakpoint line numbers not matching HOT 1
- Hitting compile error when launching delve in devbox HOT 4
- `undefined behavior - version of Delve is too old for Go version 1.22.3 (maximum supported version 1.20)` HOT 2
- trace: allow tracing from (or skip tracing on) G-less threads
- panic when data length is greater than memCache size
- Unable to find escape variables when using Delve HOT 7
- Fail to set watchpoint after clearing one of four HOT 3
- Dwarf parsing infinite loop causes OOM HOT 1
- Feature request: restart the current function HOT 6
- Seeing a warning that delve is too old for the latest Go version 1.22.5 HOT 1
- align the output of vars with 'expresson' spec
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delve.