def init_process_dut(contextlist, conf, index, args):
    if "subtype" in conf and conf["subtype"]:
        if conf["subtype"] != "console":
            msg = "Unrecognized process subtype: {}"
            contextlist.logger.error(msg.format(conf["subtype"]))
            raise ResourceInitError("Unrecognized process subtype: {}")
        config = None
        if "application" in conf:
            config = conf["application"]
        contextlist.logger.debug("Starting a remote console")
        dut = DutConsole(name="D%d" % index, conf=config, params=args)
        dut.index = index
    else:
        binary = conf["application"]['bin']
        app_config = conf["application"]
        init_cli_cmds = app_config.get("init_cli_cmds", None)
        post_cli_cmds = app_config.get("post_cli_cmds", None)
        contextlist.logger.debug("Starting process '%s'" % binary)
        dut = DutProcess(name="D%d" % index, config=conf, params=args)
        dut.index = index
        dut.command = binary
        if args.valgrind:
            dut.use_valgrind(args.valgrind_tool,
                             not args.valgrind_text,
                             args.valgrind_console,
                             args.valgrind_track_origins,
                             args.valgrind_extra_params)
        if args.gdb == index:
            dut.use_gdb()
            contextlist.logger.info("GDB is activated for node %i" % index)
        if args.gdbs == index:
            dut.use_gdbs(True, args.gdbs_port)
            contextlist.logger.info("GDBserver is activated for node %i" % index)
        if args.vgdb == index:
            dut.use_vgdb()
            contextlist.logger.info("VGDB is activated for node %i" % index)
        if args.nobuf:
            dut.no_std_buf()
        if init_cli_cmds is not None:
            dut.set_init_cli_cmds(init_cli_cmds)
        if post_cli_cmds is not None:
            dut.set_post_cli_cmds(post_cli_cmds)
    contextlist.duts.append(dut)
    contextlist.dutinformations.append(dut.get_info())