当前位置: 首页>>代码示例>>C++>>正文


C++ qdict_get_int函数代码示例

本文整理汇总了C++中qdict_get_int函数的典型用法代码示例。如果您正苦于以下问题:C++ qdict_get_int函数的具体用法?C++ qdict_get_int怎么用?C++ qdict_get_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了qdict_get_int函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_save_state

void do_save_state(Monitor *mon, const QDict *qdict)
{
  int err;

  if (!(qdict_haskey(qdict, "pid") &&
    qdict_haskey(qdict, "address") &&
    qdict_haskey(qdict, "filepath")) )
  {
#ifdef STATE_VERSION_20
    err = save_state_at_addr(qdict_get_int(qdict, "pid"),
                              qdict_get_int(qdict, "address"),
                              qdict_get_str(qdict, "filepath"));
#else
    err = save_state_at_addr(qdict_get_int(qdict, "pid"), 
                              qdict_get_int(qdict, "address"), 
                              qdict_get_str(qdict, "filepath"), 
                              STATE_SNAPSHOT_TYPE_PROCESS);
#endif // #ifdef STATE_VERSION_20

    if (err) {
      monitor_printf(mon, "Invalid pid or unable to open log file '%s'\n", 
        qdict_get_str(qdict, "filename"));
    }
  }
  else {
    monitor_printf(mon, "save_state command is malformed\n");
  }
}
开发者ID:xqx12,项目名称:decaf-tfd,代码行数:28,代码来源:tfd.c

示例2: do_memory_contaminate

void do_memory_contaminate(Monitor *mon, const QDict *qdict)
{
    uint64_t target_addr = qdict_get_int(qdict, "addr");
    uint64_t target_range = qdict_get_int(qdict, "range");
    uint64_t contaminate_tag = qdict_get_int(qdict, "contaminate");

    monitor_printf(mon, "Start tainting( addr %"PRIx64" range %ld contaminate %ld)\n", target_addr, target_range, contaminate_tag);
    dift_contaminate_memory_or(target_addr, target_range, contaminate_tag & 0xff);
    monitor_printf(mon, "Taint finish\n");
}
开发者ID:misterlihao,项目名称:MBA,代码行数:10,代码来源:dift-commands.c

示例3: test_dispatch_cmd_io

/* test commands that involve both input parameters and return values */
static void test_dispatch_cmd_io(void)
{
    QDict *req = qdict_new();
    QDict *args = qdict_new();
    QDict *args3 = qdict_new();
    QDict *ud1a = qdict_new();
    QDict *ud1b = qdict_new();
    QDict *ret, *ret_dict, *ret_dict_dict, *ret_dict_dict_userdef;
    QDict *ret_dict_dict2, *ret_dict_dict2_userdef;
    QNum *ret3;
    int64_t val;

    qdict_put_int(ud1a, "integer", 42);
    qdict_put_str(ud1a, "string", "hello");
    qdict_put_int(ud1b, "integer", 422);
    qdict_put_str(ud1b, "string", "hello2");
    qdict_put(args, "ud1a", ud1a);
    qdict_put(args, "ud1b", ud1b);
    qdict_put(req, "arguments", args);
    qdict_put_str(req, "execute", "user_def_cmd2");

    ret = qobject_to(QDict, test_qmp_dispatch(req));

    assert(!strcmp(qdict_get_str(ret, "string0"), "blah1"));
    ret_dict = qdict_get_qdict(ret, "dict1");
    assert(!strcmp(qdict_get_str(ret_dict, "string1"), "blah2"));
    ret_dict_dict = qdict_get_qdict(ret_dict, "dict2");
    ret_dict_dict_userdef = qdict_get_qdict(ret_dict_dict, "userdef");
    assert(qdict_get_int(ret_dict_dict_userdef, "integer") == 42);
    assert(!strcmp(qdict_get_str(ret_dict_dict_userdef, "string"), "hello"));
    assert(!strcmp(qdict_get_str(ret_dict_dict, "string"), "blah3"));
    ret_dict_dict2 = qdict_get_qdict(ret_dict, "dict3");
    ret_dict_dict2_userdef = qdict_get_qdict(ret_dict_dict2, "userdef");
    assert(qdict_get_int(ret_dict_dict2_userdef, "integer") == 422);
    assert(!strcmp(qdict_get_str(ret_dict_dict2_userdef, "string"), "hello2"));
    assert(!strcmp(qdict_get_str(ret_dict_dict2, "string"), "blah4"));
    qobject_unref(ret);

    qdict_put_int(args3, "a", 66);
    qdict_put(req, "arguments", args3);
    qdict_put_str(req, "execute", "guest-get-time");

    ret3 = qobject_to(QNum, test_qmp_dispatch(req));
    g_assert(qnum_get_try_int(ret3, &val));
    g_assert_cmpint(val, ==, 66);
    qobject_unref(ret3);

    qobject_unref(req);
}
开发者ID:JayFoxRox,项目名称:xqemu,代码行数:50,代码来源:test-qmp-cmds.c

示例4: do_show_disk_taint_map

void do_show_disk_taint_map(struct Monitor *mon, const struct QDict *qdict)
{
    uint64_t target_addr = qdict_get_int(qdict, "addr");
    uint64_t target_length = qdict_get_int(qdict, "len");
    int i;

    monitor_printf(mon, "Taint addr %"PRIx64" length %ld\n", target_addr, target_length);

    for(i = 0 ; i < target_length ; i++) {
        monitor_printf( mon, "%02x, ",
                 dift_get_disk_dirty(target_addr + i));
        if((i & 0xf) == 0xf)
            monitor_printf(mon, "\n");
    }
}
开发者ID:misterlihao,项目名称:MBA,代码行数:15,代码来源:dift-commands.c

示例5: do_tracing

void do_tracing(Monitor *mon, const QDict *qdict)
{
  uint32_t pid = qdict_get_int(qdict, "pid");
  const char *filename = qdict_get_str(qdict, "filepath");

  do_tracing_internal(pid, filename);
}
开发者ID:xqx12,项目名称:decaf-tfd,代码行数:7,代码来源:tfd.c

示例6: do_balloon

/**
 * do_balloon(): Request VM to change its memory allocation
 */
int do_balloon(Monitor *mon, const QDict *params,
	       MonitorCompletion cb, void *opaque)
{
    int64_t target;
    int ret;

    if (kvm_enabled() && !kvm_has_sync_mmu()) {
        qerror_report(QERR_KVM_MISSING_CAP, "synchronous MMU", "balloon");
        return -1;
    }

    target = qdict_get_int(params, "value");
    if (target <= 0) {
        qerror_report(QERR_INVALID_PARAMETER_VALUE, "target", "a size");
        return -1;
    }
    ret = qemu_balloon(target);
    if (ret == 0) {
        qerror_report(QERR_DEVICE_NOT_ACTIVE, "balloon");
        return -1;
    }

    cb(opaque, NULL);
    return 0;
}
开发者ID:AsherBond,项目名称:qemu-kvm,代码行数:28,代码来源:balloon.c

示例7: test_qga_sync

static void test_qga_sync(gconstpointer fix)
{
    const TestFixture *fixture = fix;
    guint32 v, r = g_random_int();
    QDict *ret;

    /*
     * TODO guest-sync is inherently limited: we cannot distinguish
     * failure caused by reacting to garbage on the wire prior to this
     * command, from failure of this actual command. Clients are
     * supposed to be able to send a raw '\xff' byte to at least
     * re-synchronize the server's parser prior to this command, but
     * we are not in a position to test that here because (at least
     * for now) it causes the server to issue an error message about
     * invalid JSON. Testing of '\xff' handling is done in
     * guest-sync-delimited instead.
     */
    ret = qmp_fd(fixture->fd,
                 "{'execute': 'guest-sync', 'arguments': {'id': %u } }",
                 r);

    g_assert_nonnull(ret);
    qmp_assert_no_error(ret);

    v = qdict_get_int(ret, "return");
    g_assert_cmpint(r, ==, v);

    qobject_unref(ret);
}
开发者ID:CTU-IIG,项目名称:qemu,代码行数:29,代码来源:test-qga.c

示例8: test_qga_sync_delimited

static void test_qga_sync_delimited(gconstpointer fix)
{
    const TestFixture *fixture = fix;
    guint32 v, r = g_random_int();
    unsigned char c;
    QDict *ret;
    gchar *cmd;

    cmd = g_strdup_printf("%c{'execute': 'guest-sync-delimited',"
                          " 'arguments': {'id': %u } }", 0xff, r);
    qmp_fd_send(fixture->fd, cmd);
    g_free(cmd);

    v = read(fixture->fd, &c, 1);
    g_assert_cmpint(v, ==, 1);
    g_assert_cmpint(c, ==, 0xff);

    ret = qmp_fd_receive(fixture->fd);
    g_assert_nonnull(ret);
    qmp_assert_no_error(ret);

    v = qdict_get_int(ret, "return");
    g_assert_cmpint(r, ==, v);

    QDECREF(ret);
}
开发者ID:BinaryAnalysisPlatform,项目名称:qemu,代码行数:26,代码来源:test-qga.c

示例9: test_dispatch_cmd_io

/* test commands that involve both input parameters and return values */
static void test_dispatch_cmd_io(void)
{
    QDict *req = qdict_new();
    QDict *args = qdict_new();
    QDict *args3 = qdict_new();
    QDict *ud1a = qdict_new();
    QDict *ud1b = qdict_new();
    QDict *ret, *ret_dict, *ret_dict_dict, *ret_dict_dict_userdef;
    QDict *ret_dict_dict2, *ret_dict_dict2_userdef;
    QInt *ret3;

    qdict_put_obj(ud1a, "integer", QOBJECT(qint_from_int(42)));
    qdict_put_obj(ud1a, "string", QOBJECT(qstring_from_str("hello")));
    qdict_put_obj(ud1b, "integer", QOBJECT(qint_from_int(422)));
    qdict_put_obj(ud1b, "string", QOBJECT(qstring_from_str("hello2")));
    qdict_put_obj(args, "ud1a", QOBJECT(ud1a));
    qdict_put_obj(args, "ud1b", QOBJECT(ud1b));
    qdict_put_obj(req, "arguments", QOBJECT(args));
    qdict_put_obj(req, "execute", QOBJECT(qstring_from_str("user_def_cmd2")));

    ret = qobject_to_qdict(test_qmp_dispatch(req));

    assert(!strcmp(qdict_get_str(ret, "string0"), "blah1"));
    ret_dict = qdict_get_qdict(ret, "dict1");
    assert(!strcmp(qdict_get_str(ret_dict, "string1"), "blah2"));
    ret_dict_dict = qdict_get_qdict(ret_dict, "dict2");
    ret_dict_dict_userdef = qdict_get_qdict(ret_dict_dict, "userdef");
    assert(qdict_get_int(ret_dict_dict_userdef, "integer") == 42);
    assert(!strcmp(qdict_get_str(ret_dict_dict_userdef, "string"), "hello"));
    assert(!strcmp(qdict_get_str(ret_dict_dict, "string"), "blah3"));
    ret_dict_dict2 = qdict_get_qdict(ret_dict, "dict3");
    ret_dict_dict2_userdef = qdict_get_qdict(ret_dict_dict2, "userdef");
    assert(qdict_get_int(ret_dict_dict2_userdef, "integer") == 422);
    assert(!strcmp(qdict_get_str(ret_dict_dict2_userdef, "string"), "hello2"));
    assert(!strcmp(qdict_get_str(ret_dict_dict2, "string"), "blah4"));
    QDECREF(ret);

    qdict_put(args3, "a", qint_from_int(66));
    qdict_put(req, "arguments", args3);
    qdict_put(req, "execute", qstring_from_str("guest-get-time"));

    ret3 = qobject_to_qint(test_qmp_dispatch(req));
    assert(qint_get_int(ret3) == 66);
    QDECREF(ret3);

    QDECREF(req);
}
开发者ID:JunaidLoonat,项目名称:qemu,代码行数:48,代码来源:test-qmp-commands.c

示例10: do_migrate

int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
    MigrationState *s = NULL;
    const char *p;
    int detach = qdict_get_int(qdict, "detach");
    const char *uri = qdict_get_str(qdict, "uri");

    if (current_migration &&
        current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) {
        monitor_printf(mon, "migration already in progress\n");
        return -1;
    }

    if (strstart(uri, "tcp:", &p)) {
        s = tcp_start_outgoing_migration(mon, p, max_throttle, detach,
                                         (int)qdict_get_int(qdict, "blk"), 
                                         (int)qdict_get_int(qdict, "inc"));
#if !defined(WIN32)
    } else if (strstart(uri, "exec:", &p)) {
        s = exec_start_outgoing_migration(mon, p, max_throttle, detach,
                                          (int)qdict_get_int(qdict, "blk"), 
                                          (int)qdict_get_int(qdict, "inc"));
    } else if (strstart(uri, "unix:", &p)) {
        s = unix_start_outgoing_migration(mon, p, max_throttle, detach,
					  (int)qdict_get_int(qdict, "blk"), 
                                          (int)qdict_get_int(qdict, "inc"));
    } else if (strstart(uri, "fd:", &p)) {
        s = fd_start_outgoing_migration(mon, p, max_throttle, detach, 
                                        (int)qdict_get_int(qdict, "blk"), 
                                        (int)qdict_get_int(qdict, "inc"));
#endif
    } else {
        monitor_printf(mon, "unknown migration protocol: %s\n", uri);
        return -1;
    }

    if (s == NULL) {
        monitor_printf(mon, "migration failed\n");
        return -1;
    }

    if (current_migration) {
        current_migration->release(current_migration);
    }

    current_migration = s;
    return 0;
}
开发者ID:iggy,项目名称:qemu,代码行数:48,代码来源:migration.c

示例11: set_table_lookup

void set_table_lookup(Monitor *mon, const QDict *qdict)
{
  if (qdict_get_int(qdict, "state")) {
    tracing_table_lookup = 1;
    monitor_printf(default_mon, "Table lookup on.\n");
  }
  else {
    tracing_table_lookup = 0;
    monitor_printf(default_mon, "Table lookup off.\n");
  }
}
开发者ID:xqx12,项目名称:decaf-tfd,代码行数:11,代码来源:tfd.c

示例12: do_get_physic_address

void do_get_physic_address(struct Monitor *mon, const struct QDict *qdict)
{
    uint64_t target_cr3		= qdict_get_int(qdict, "cr3");
    uint64_t target_addr    = qdict_get_int(qdict, "addr");
    X86CPU *cpu				= X86_CPU(ENV_GET_CPU((CPUArchState*)mba_mon_get_cpu()));
    hwaddr page             = target_addr & TARGET_PAGE_MASK;
	
    //XXX([email protected]):Only one phase copied. Should be fully copied to resist changes.
    X86CPU copied_cpu;
    memcpy(&copied_cpu, cpu, sizeof(copied_cpu));
    copied_cpu.env.cr[3] = target_cr3;
    
    hwaddr phys_page = cpu_get_phys_page_debug((CPUState*)&copied_cpu, page);
    if (phys_page == -1) {
        monitor_printf(mon, "Cannot find physic page\n");
		return;
    }

    hwaddr phys_addr = phys_page + (target_addr & ~TARGET_PAGE_MASK);
    monitor_printf(mon, "physic address = %p\n", (void*)phys_addr);
}
开发者ID:misterlihao,项目名称:MBA,代码行数:21,代码来源:dift-commands.c

示例13: hmp_migrationmode

void hmp_migrationmode(Monitor *mon, const QDict *qdict)
{
    S390StAttribState *sas = s390_get_stattrib_device();
    S390StAttribClass *sac = S390_STATTRIB_GET_CLASS(sas);
    uint64_t what = qdict_get_int(qdict, "mode");
    int r;

    r = sac->set_migrationmode(sas, what);
    if (r < 0) {
        monitor_printf(mon, "Error: %s", strerror(-r));
    }
}
开发者ID:Biamp-Systems,项目名称:mb-qemu,代码行数:12,代码来源:s390-stattrib.c

示例14: do_show_memory_taint_map

void do_show_memory_taint_map(struct Monitor *mon, const struct QDict *qdict)
{
    uint64_t target_addr = qdict_get_int(qdict, "addr");
    uint64_t target_length = qdict_get_int(qdict, "len");
    int i;
    uint8_t* buf = (uint8_t*)malloc(target_length); 
    cpu_physical_memory_read(target_addr, buf, target_length);
    if(buf == NULL){
        monitor_printf(mon, "Cannot allocate memory for do_show_memory_taint_map()\n");
        return;
    }

    monitor_printf(mon, "Taint addr %"PRIx64" length %ld\n", target_addr, target_length);

    for(i = 0 ; i < target_length ; i++) {
        monitor_printf( mon, "%02x|%02x, ",
                buf[i], dift_get_memory_dirty(target_addr + i));
        if((i & 0xf) == 0xf)
            monitor_printf(mon, "\n");
    }
}
开发者ID:misterlihao,项目名称:MBA,代码行数:21,代码来源:dift-commands.c

示例15: qdict_get_int_test

static void qdict_get_int_test(void)
{
    int ret;
    const int value = 100;
    const char *key = "int";
    QDict *tests_dict = qdict_new();

    qdict_put(tests_dict, key, qint_from_int(value));

    ret = qdict_get_int(tests_dict, key);
    g_assert(ret == value);

    QDECREF(tests_dict);
}
开发者ID:AmesianX,项目名称:panda,代码行数:14,代码来源:check-qdict.c


注:本文中的qdict_get_int函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。