Skip to content

Commit 486e14d

Browse files
committed
Pythonic defaults handling
1 parent 04149c3 commit 486e14d

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

qiling/debugger/gdb/gdb.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,17 @@
3535

3636
class QlGdb(QlDebugger, object):
3737
"""docstring for Debugsession"""
38-
def __init__(self, ql, ip, port):
38+
def __init__(self, ql: Qiling, ip: str = '127.0.01', port: int = 9999):
3939
super(QlGdb, self).__init__(ql)
40+
4041
self.ql = ql
4142
self.last_pkt = None
42-
self.exe_abspath = (os.path.abspath(self.ql.argv[0]))
43-
self.rootfs_abspath = (os.path.abspath(self.ql.rootfs))
43+
self.exe_abspath = os.path.abspath(self.ql.argv[0])
44+
self.rootfs_abspath = os.path.abspath(self.ql.rootfs)
4445
self.gdb = QlGdbUtils()
4546

46-
if ip == None:
47-
ip = '127.0.0.1'
48-
49-
if port == None:
50-
port = 9999
51-
else:
52-
port = int(port)
47+
if type(port) is str:
48+
port = int(port, 0)
5349

5450
self.ip = ip
5551
self.port = port

0 commit comments

Comments
 (0)