MCPcopy Create free account
hub / github.com/qilingframework/qiling / profile_setup

Function profile_setup

qiling/utils.py:419–448  ·  view source on GitHub ↗
(ostype: QL_OS, user_config: Optional[Union[str, dict]])

Source from the content-addressed store, hash-verified

417
418
419def profile_setup(ostype: QL_OS, user_config: Optional[Union[str, dict]]):
420 # mcu uses a yaml-based config
421 if ostype is QL_OS.MCU:
422 import yaml
423
424 if user_config:
425 with open(user_config) as f:
426 config = yaml.load(f, Loader=yaml.SafeLoader)
427 else:
428 config = {}
429
430 else:
431 # patch 'getint' to convert integers of all bases
432 int_converter = partial(int, base=0)
433 config = ConfigParser(converters={'int': int_converter})
434
435 qiling_home = Path(inspect.getfile(profile_setup)).parent
436 os_profile = qiling_home / 'profiles' / f'{ostype.name.lower()}.ql'
437
438 # read default profile first
439 config.read(os_profile)
440
441 # user-specified profile adds or overrides existing setting
442 if isinstance(user_config, dict):
443 config.read_dict(user_config)
444
445 elif user_config:
446 config.read(user_config)
447
448 return config
449
450
451# verify if emulator returns properly

Callers 1

__init__Method · 0.85

Calls 2

loadMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected