Skip to content

Commit 63737fa

Browse files
committed
Fix QDB init args enumeration
1 parent eb6666e commit 63737fa

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

qiling/utils.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,12 +333,22 @@ def select_debugger(options: Union[str, bool]) -> Optional[QlClassInit['QlDebugg
333333
elif dbgtype == QL_DEBUGGER.QDB:
334334
kwargs = {}
335335

336-
if 'rr' in args:
337-
kwargs['rr'] = True
338-
args.remove('rr')
336+
def __int_nothrow(v: str, /) -> Optional[int]:
337+
try:
338+
return int(v, 0)
339+
except ValueError:
340+
return None
339341

340-
if args:
341-
kwargs['init_hook'] = args[0]
342+
# qdb init args are independent and may include any combination of: rr enable, init hook and script
343+
for a in args:
344+
if a == 'rr':
345+
kwargs['rr'] = True
346+
347+
elif __int_nothrow(a) is not None:
348+
kwargs['init_hook'] = a
349+
350+
else:
351+
kwargs['script'] = a
342352

343353
else:
344354
raise QlErrorOutput('Debugger not supported')

0 commit comments

Comments
 (0)