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


C++ AsmFormatPluginHelper::decode方法代码示例

本文整理汇总了C++中AsmFormatPluginHelper::decode方法的典型用法代码示例。如果您正苦于以下问题:C++ AsmFormatPluginHelper::decode方法的具体用法?C++ AsmFormatPluginHelper::decode怎么用?C++ AsmFormatPluginHelper::decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AsmFormatPluginHelper的用法示例。


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

示例1: _elf_decode_section

/* elf_decode_section */
static int _elf_decode_section(AsmFormatPlugin * format, AsmSection * section,
        AsmArchInstructionCall ** calls, size_t * calls_cnt)
{
    AsmFormatPluginHelper * helper = format->helper;

    return helper->decode(helper->format, section->offset, section->size,
            section->base, calls, calls_cnt);
}
开发者ID:khorben,项目名称:DeforaOS,代码行数:9,代码来源:elf.c

示例2: _elf_decode_section

/* elf_decode_section */
static int _elf_decode_section(AsmFormatPlugin * format, AsmSection * section,
        AsmArchInstructionCall ** calls, size_t * calls_cnt)
{
    AsmFormatPluginHelper * helper = format->helper;

#ifdef DEBUG
    fprintf(stderr, "DEBUG: %s()\n", __func__);
#endif
    return helper->decode(helper->format, section->offset, section->size,
            section->base, calls, calls_cnt);
}
开发者ID:DeforaOS,项目名称:asm,代码行数:12,代码来源:elf.c

示例3: _dex_decode_section

/* dex_decode_section */
static int _dex_decode_section(AsmFormatPlugin * format, AsmSection * section,
        AsmArchInstructionCall ** calls, size_t * calls_cnt)
{
    AsmFormatPluginHelper * helper = format->helper;
    DexMapCodeItem dmci;
    size_t i;
    off_t seek;
    AsmFunction * f;
    size_t j;
    DexMapTryItem dmti;
    ssize_t s;
    uint32_t u32;
    int32_t s32;
    uint32_t v32;

#ifdef DEBUG
    fprintf(stderr, "DEBUG: %s()\n", __func__);
#endif
    if(helper->seek(helper->format, section->offset, SEEK_SET)
            != section->offset)
        return -1;
    for(i = 0; i < section->size; i++)
    {
        s = sizeof(dmci);
        if(helper->read(helper->format, &dmci, s) != s)
            return -1;
        dmci.registers_size = _htol16(dmci.registers_size);
        dmci.ins_size = _htol16(dmci.ins_size);
        dmci.outs_size = _htol16(dmci.outs_size);
        dmci.tries_size = _htol16(dmci.tries_size);
        dmci.debug_info_off = _htol32(dmci.debug_info_off);
        dmci.insns_size = _htol32(dmci.insns_size);
        seek = helper->seek(helper->format, 0, SEEK_CUR);
        if(helper->decode(helper->format, seek, dmci.insns_size * 2,
                    seek, calls, calls_cnt) != 0)
            return -1;
        /* update the corresponding function offset */
        if((f = helper->get_function_by_id(helper->format, i)) != NULL)
            /* XXX not very optimal */
            helper->set_function(helper->format, i, f->name, seek,
                    dmci.insns_size * 2);
        /* skip padding and try_items */
        seek = (dmci.insns_size & 0x1) == 0x1 ? 2 : 0;
#ifdef DEBUG
        fprintf(stderr, "DEBUG: code item %lu/%lu, offset 0x%lx"
                ", registers 0x%x, size 0x%x, debug @0x%x"
                ", tries 0x%x, seek 0x%lx\n", i, section->size,
                helper->seek(helper->format, 0, SEEK_CUR),
                dmci.registers_size, dmci.insns_size,
                dmci.debug_info_off, dmci.tries_size, seek);
#endif
        if(seek != 0 && helper->seek(helper->format, seek, SEEK_CUR)
                < 0)
            return -1;
        if(dmci.tries_size > 0)
        {
            for(j = 0; j < dmci.tries_size; j++)
            {
                s = sizeof(dmti);
                if(helper->read(helper->format, &dmti, s) != s)
                    return -1;
                dmti.start_addr = _htol32(dmti.start_addr);
                dmti.insn_count = _htol16(dmti.insn_count);
                dmti.handler_off = _htol16(dmti.handler_off);
#ifdef DEBUG
                fprintf(stderr, "DEBUG: start 0x%x,"
                        " insn_count 0x%x,"
                        " handler_off 0x%x\n",
                        dmti.start_addr,
                        dmti.insn_count,
                        dmti.handler_off);
#endif
            }
            /* encoded catch handler */
            /* list size */
            if(_dex_decode_uleb128(format, &u32) != 0)
                return -1;
            for(; u32 > 0; u32--)
            {
                /* handler size */
                if(_dex_decode_sleb128(format, &s32) != 0)
                    return -1;
                /* address pairs */
                for(j = abs(s32); j > 0; j--)
                {
                    if(_dex_decode_uleb128(format, &v32)
                            != 0)
                        return -1;
                    if(_dex_decode_uleb128(format, &v32)
                            != 0)
                        return -1;
                }
                /* catch-all address */
                if(s32 <= 0 && _dex_decode_uleb128(format, &v32)
                        != 0)
                    return -1;
            }
            /* ensure alignment on 4 bytes */
            seek = helper->seek(helper->format, 0, SEEK_CUR);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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