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

Add a flag to enter PDB in post-mortem debugging mode #1272

Merged
merged 1 commit into from Apr 15, 2020

Conversation

adisbladis
Copy link
Member

This is primarily something I want for developing & debugging new plugins.

@grahamc
Copy link
Member

grahamc commented Apr 15, 2020

Looks good, can you add a note in the hacking section of the manual? https://github.com/NixOS/nixops/blob/master/doc/manual/hacking.xml or create a new, "Debugging" section in new rst file in the docs dir

This is primarily something I want for developing & debugging new plugins.
@grahamc
Copy link
Member

grahamc commented Apr 15, 2020

I broke nixops on purpose and got this:

$ nixops --pdb info

Welcome to Python 3.7's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".

help>

is there a way for it to say "got exception: ...info... ... entering debugger" ?

@grahamc
Copy link
Member

grahamc commented Apr 15, 2020

hah.

help() is ... that.

This looks reasonable:

$ nixops --pdb info
Traceback (most recent call last):
  File "/nix/store/nlgrx0cl1l87nx0w660lb3jksn9jdca9-python3-3.7.6/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/nix/store/nlgrx0cl1l87nx0w660lb3jksn9jdca9-python3-3.7.6/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/grahamc/projects/github.com/NixOS/nixops/nixops/__main__.py", line 645, in <module>
    main()
  File "/home/grahamc/projects/github.com/NixOS/nixops/nixops/__main__.py", line 630, in main
    args.op(args)
  File "/home/grahamc/projects/github.com/NixOS/nixops/nixops/script_defs.py", line 207, in op_info
    ohnohelp()
NameError: name 'ohnohelp' is not defined
> /home/grahamc/projects/github.com/NixOS/nixops/nixops/script_defs.py(207)op_info()
-> ohnohelp()
(Pdb)

@grahamc grahamc merged commit ba0c3f6 into NixOS:master Apr 15, 2020
@grahamc grahamc added this to the 2.0 milestone Apr 20, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants