Skip to content

Commit

Permalink
Install relenv-dbg entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Oct 23, 2023
1 parent 382193e commit 727855d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ where=src
[options.entry_points]
console_scripts =
relenv-gdb = relenv_gdb.gdbinit:main
relenv-dbg = relenv_gdb.dbg:main

[flake8]
max-line-length = 120
Expand Down
16 changes: 10 additions & 6 deletions src/relenv_gdb/dbg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Use gdb to pull python stack traces a parent process and all of it's children.
"""
import argparse
import os
import pathlib
import pprint
Expand Down Expand Up @@ -86,14 +87,17 @@ def main():
"""
The debug programs entrypoint.
"""
parser = argparse.ArgumentParser(
prog="relenv-dbg",
description="Use gdb to debug python programs running in a relenv",
epilog="",
)
parser.add_argument("pid", type=int)
args = parser.parse_args()
try:
pid = int(sys.argv[1])
except (IndexError, ValueError):
pid = -1
try:
parent = psutil.Process(pid)
parent = psutil.Process(args.pid)
except (ValueError, psutil.NoSuchProcess):
print("Please provide a valid pid as the only argument")
print("Please provide a valid pid")
sys.exit(1)

gdb = find_relenv_gdb()
Expand Down

0 comments on commit 727855d

Please sign in to comment.