MCPcopy Index your code
hub / github.com/qilingframework/qiling / select_debugger

Function select_debugger

qiling/utils.py:332–373  ·  view source on GitHub ↗
(options: Union[str, bool])

Source from the content-addressed store, hash-verified

330
331
332def select_debugger(options: Union[str, bool]) -> Optional[QlClassInit['QlDebugger']]:
333 if options is True:
334 options = 'gdb'
335
336 if type(options) is str:
337 objname, *args = options.split(':')
338 dbgtype = debugger_convert(objname)
339
340 if dbgtype == QL_DEBUGGER.GDB:
341 kwargs = dict(zip(('ip', 'port'), args))
342
343 elif dbgtype == QL_DEBUGGER.QDB:
344 kwargs = {}
345
346 def __int_nothrow(v: str, /) -> Optional[int]:
347 try:
348 return int(v, 0)
349 except ValueError:
350 return None
351
352 # qdb init args are independent and may include any combination of: rr enable, init hook and script
353 arg_init_hook = []
354 for arg in args:
355 if arg == 'rr':
356 kwargs['rr'] = True
357
358 elif __int_nothrow(arg) is not None:
359 arg_init_hook.append(arg)
360
361 else:
362 kwargs['script'] = arg
363 else:
364 kwargs['init_hook'] = arg_init_hook
365
366 else:
367 raise QlErrorOutput('Debugger not supported')
368
369 obj = ql_get_module_function(f'.debugger.{objname}.{objname}', f'Ql{str.capitalize(objname)}')
370
371 return partial(obj, **kwargs)
372
373 return None
374
375
376def select_arch(archtype: QL_ARCH, cputype: Optional[QL_CPU], endian: QL_ENDIAN, thumb: bool) -> QlClassInit['QlArch']:

Callers 1

runMethod · 0.85

Calls 5

debugger_convertFunction · 0.85
__int_nothrowFunction · 0.85
QlErrorOutputClass · 0.85
ql_get_module_functionFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected