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

Feature Request: Auto-print after breakpoint #71

Open
spekary opened this issue Dec 22, 2015 · 1 comment
Open

Feature Request: Auto-print after breakpoint #71

spekary opened this issue Dec 22, 2015 · 1 comment

Comments

@spekary
Copy link

spekary commented Dec 22, 2015

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:
_ = "breakpoint; p myInt; n; p myInt; c"

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.

  1. Set a mode so that the value of all local variables are automatically printed after a breakpoint, or during stepping.
@danielmanesku
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants