Skip to content

Commit 98c9254

Browse files
committed
Fix debugger_setup defaults handling
1 parent cc37fea commit 98c9254

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

qiling/utils.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -420,25 +420,21 @@ def component_setup(component_type, component_name, ql):
420420
return ql_get_module_function(f"qiling.{component_type}.{component_name}", function_name)(ql)
421421

422422

423-
def debugger_setup(debugger, ql):
424-
# default remote server
425-
remotedebugsrv = "gdb"
426-
debug_opts = [None, None]
423+
def debugger_setup(options, ql):
424+
if options is True:
425+
options = 'gdb'
427426

428-
if debugger != True and type(debugger) is str:
429-
debug_opts = debugger.split(":")
427+
if type(options) is str:
428+
objname, *args = options.split(':')
430429

431-
if len(debug_opts) == 2 and debug_opts[0] != "qdb":
432-
pass
433-
else:
434-
remotedebugsrv, *debug_opts = debug_opts
430+
if debugger_convert(objname) not in enum_values(QL_DEBUGGER):
431+
raise QlErrorOutput('Debugger not supported')
435432

436-
if debugger_convert(remotedebugsrv) not in enum_values(QL_DEBUGGER):
437-
raise QlErrorOutput("Error: Debugger not supported")
433+
obj = ql_get_module_function(f'qiling.debugger.{objname}.{objname}', f'Ql{str.capitalize(objname)}')
438434

439-
debugsession = ql_get_module_function(f"qiling.debugger.{remotedebugsrv}.{remotedebugsrv}", f"Ql{str.capitalize(remotedebugsrv)}")
435+
return obj(ql, *args)
440436

441-
return debugsession(ql, *debug_opts)
437+
return None
442438

443439
def arch_setup(archtype, ql):
444440
if not ql_is_valid_arch(archtype):

0 commit comments

Comments
 (0)