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

How about adding debug commands such likes continue or run? #47

Open
jkryanchou opened this issue Dec 22, 2017 · 7 comments
Open

How about adding debug commands such likes continue or run? #47

jkryanchou opened this issue Dec 22, 2017 · 7 comments

Comments

@jkryanchou
Copy link

jkryanchou commented Dec 22, 2017

Sorry for not providing details. Here are what I mentioned. Wish to add some debug related commands for us to debug as python(ipdb) or ruby(pry)


     5:   "github.com/d4l3k/go-pry/pry"
     6: )
     7:
     8: func main() {
     9:   a := 1
 => 10:   pry.Pry()
    11:   fmt.Println("A", a)
    12: }
    13:

[31] go-pry> a = 2
=> 2
[32] go-pry>

I modify the var a value to 2, and willing to execute next or continue commands to continue the program.

Is there any methods to add those to go-pry? I have noticed what you have mentioned below it just has wrap go commands. So i thought it is impossible to add those commands.

@d4l3k
Copy link
Owner

d4l3k commented Jan 1, 2018

This is just a wrapper around the go command so all the standard commands should just work. Have you found something that doesn't work?

If so, please provide the logs and how to reproduce.

@jkryanchou
Copy link
Author

@d413k Hi, I add more details about my confusion on using go-pry. wish that features could be added into go-pry

@d4l3k
Copy link
Owner

d4l3k commented Jan 5, 2018

I'm pretty sure you can just do

a = 1
exit

And have it continue as you've described

@jkryanchou
Copy link
Author

@d4l3k Modify a =2 and press exit command? It doesn't work.

@cosmos72
Copy link

cosmos72 commented May 2, 2018

I guess @jkryanchou was proposing to enhance gopry with the typical debugger functionality "next",
which executes one statement, then stops execution and returns to debugger prompt
(or, in this case, gopry prompt) waiting for further commands from the user.

If I understand correctly how gopry is implemented, adding this feature seems difficult: it would require injecting gopry.Pry() or something similar after every statement in the code, in order to trasfer control to gopry after every statement, and let it decide whether to resume execution or show a prompt.

@d4l3k
Copy link
Owner

d4l3k commented May 2, 2018

Yep. It'd be pretty painful

@d4l3k d4l3k mentioned this issue May 2, 2018
@jkryanchou
Copy link
Author

@d4l3k OK, I got it.

@d4l3k d4l3k changed the title How about adding debug commands such likes countinue or run? How about adding debug commands such likes continue or run? May 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants