Open spekary opened 8 years ago
Excellent idea! I might take this feature to implement in coming weeks/months. I had a similar idea and went through issues of this project, to see if somebody already came up with something similar and I found this. My idea was to have some json file where you define your watches. Something like this:
{
"a": [
"var1",
"var2",
"var3"
],
"b": [
"var4",
"var5"
]
}
In help menu you would get something along the lines:
-> _ = "breakpoint"
(godebug) h
Commands:
(h) help: Print this help.
(n) next: Run the next line.
(s) step: Run for one step.
(c) continue: Run until the next breakpoint.
(l) list: Show the current line in context of the code around it.
(p) print <expression>: Print a variable or any other Go expression.
(q) quit: Exit the program. Uses os.Exit; deferred functions are not run.
**(a) print variable group**
**(b) print variable group**
Commands may be given by their full name or by their parenthesized abbreviation.
Pressing enter without typing anything repeats the previous command.
But now, I like your idea more! This way you don't have to maintain an external file, no additional command line parameter for file path.
@jeremyschlatter @FiloSottile what is your take on this?
Having to constantly press the p command is getting tiresome. I would like to suggest a couple of features:
1) automatically execute a number of commands after a breakpoint. Commands could be semicolon separated. So like this:
Which would cause the "myInt" variable to be printed, the next line to be executed, the "myInt" variable to be printed again, and then the continue command.
2) Set a mode so that the value of all local variables are automatically printed after a breakpoint, or during stepping.