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 5e4f15f
Show file tree
Hide file tree
Showing 2 changed files with 9 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
14 changes: 8 additions & 6 deletions src/relenv_gdb/dbg.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,16 @@ 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 5e4f15f

Please sign in to comment.