Merge pull request #134 from Redouane555/master

Fixed peda.getpid() when debugging remote processes: drop the code supports very old gdb versions
This commit is contained in:
Long Le 2019-02-10 08:35:22 +07:00 committed by GitHub
commit f76c34d5e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 21 deletions

22
peda.py
View File

@ -421,26 +421,6 @@ class PEDA(object):
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
@ -3060,7 +3040,7 @@ class PEDACmd(object):
"""
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)