Skip to content

Commit

Permalink
Fix peda.getpid() for remote debugging
Browse files Browse the repository at this point in the history
Fixed peda.getpid() returning None when debugging remote processes, _is_running now returns true for remote processes, commands like telescope, vmmap, context etc. now work fine
  • Loading branch information
red0xff authored Feb 8, 2019
1 parent 2d7afd1 commit bfffa63
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions peda.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,26 +421,6 @@ def getpid(self):
status = self.get_status()
if not status or status == "STOPPED":
return None

if self.is_target_remote(): # remote target
ctx = config.Option.get("context")
config.Option.set("context", None)
try:
out = self.execute_redirect("call getpid()")
except:
pass

config.Option.set("context", ctx)

if out is None:
return None
else:
out = self.execute_redirect("print $")
if out:
return to_int(out.split("=")[1])
else:
return None

pid = gdb.selected_inferior().pid
return int(pid) if pid else None

Expand Down Expand Up @@ -3060,7 +3040,7 @@ def _is_running(self):
"""
pid = peda.getpid()
if pid is None:
text = "not running or target is remote"
text = "not running"
warning_msg(text)
return None
#raise Exception(text)
Expand Down

0 comments on commit bfffa63

Please sign in to comment.