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


C++ disassemble函数代码示例

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


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

示例1: AtNonBranch

static VOID AtNonBranch(ADDRINT ip)
{
    
    if (ip >= dl_debug_state_Addr && ip < dl_debug_state_AddrEnd)
    {
        string s = disassemble ((ip),(ip)+15);
        printf ("  instruction in range of interest executed %s\n", s.c_str());
        fflush (stdout);
    }
}
开发者ID:alugupta,项目名称:resilient-systems,代码行数:10,代码来源:branch_target_addr.cpp

示例2: add_msg

bool player::disassemble()
{
    auto loc = game_menus::inv::disassemble( *this );

    if( !loc ) {
        add_msg( _( "Never mind." ) );
        return false;
    }

    return disassemble( loc.obtain( *this ) );
}
开发者ID:AlecWhite,项目名称:Cataclysm-DDA,代码行数:11,代码来源:crafting.cpp

示例3: main

int main(int argc, char** argv)
{
    sl_static_init();
    sl_vm_t* vm = sl_init("disasm");

    if(argc < 1) {
        fprintf(stderr, "Usage: slash-dis <source file>\n");
        exit(1);
    }

    FILE* f = fopen(argv[1], "r");
    if(!f) {
        fprintf(stderr, "Could not open %s for reading.\n", argv[1]);
        exit(1);
    }

    fseek(f, 0, SEEK_END);
    size_t size = ftell(f);
    fseek(f, 0, SEEK_SET);

    char* source = sl_alloc_buffer(vm->arena, size + 1);
    fread(source, size, 1, f);
    fclose(f);

    SLVAL err;
    sl_vm_frame_t frame;
    SL_TRY(frame, SL_UNWIND_ALL, {

        size_t token_count;
        sl_token_t* tokens = sl_lex(vm, (uint8_t*)argv[1], (uint8_t*)source, size, &token_count, 0);

        sl_node_base_t* ast = sl_parse(vm, tokens, token_count, (uint8_t*)argv[1]);

        sl_vm_section_t* section = sl_compile(vm, ast, (uint8_t*)argv[1]);

        disassemble(vm, section);
        while(section_j < section_i) {
            disassemble(vm, section_queue[++section_j]);
        }

    }, err, {
开发者ID:richo,项目名称:slash,代码行数:41,代码来源:slash-disasm.c

示例4: main

int main() {
  unsigned int program[SZ]= {0x20340000, 0x62340000, 0x30050084, 0x50560004,
                             0x10000000};
  print_instruction(0x60320000);
  printf("\n");
  print_instruction(0x800000c8);
  printf("\n\n");

  disassemble(program, SZ);

  return 0;
}
开发者ID:kkhanh89,项目名称:ProjectsInC,代码行数:12,代码来源:student1.c

示例5: main

int main(int argc, char** argv)
{
	if( argc < 2 ) {
		std::cerr << "Missing argument" << std::endl;
		printUsage();
		return 1;
	}

	disassemble(std::string(argv[1]));

	return 0;
}
开发者ID:ChunHungLiu,项目名称:openrw,代码行数:12,代码来源:main.cpp

示例6: emulate

int emulate()
{
   int    rc;
   size_t sz;

   if(!disassemble(&info->vm.cpu.disasm))
      return VM_FAIL;

   rc = emulate_insn(&info->vm.cpu.disasm);
   sz = ud_insn_len(&info->vm.cpu.disasm);

   return emulate_done(rc, sz);
}
开发者ID:Debug-Orz,项目名称:ramooflax,代码行数:13,代码来源:emulate.c

示例7: main

int main() {
  int retval;
  
  retval= disassemble(NULL, 1);
  if (retval != 0) {
    printf("disassemble() returned %d!\n", retval);
    printf("Test failed\n");
    return -1;
  }

  printf("Test finished!\n");
  return 0;
}
开发者ID:Jornason,项目名称:Class-Projects,代码行数:13,代码来源:public02.c

示例8: lcmd

static void lcmd (void)
{
    WORD newptr;
    WORD count;

    if (gethex((WORD *)&newptr))
	listptr = newptr;
    for (count = 0; count < 12; count++)
    {
	printf ("%X: ", listptr);
	listptr += disassemble (listptr);
    }
}
开发者ID:bloovis,项目名称:isis,代码行数:13,代码来源:debug.c

示例9: disas_decode_binary

xed_uint_t disas_decode_binary(const xed_state_t* dstate,
                               const xed_uint8_t* hex_decode_text,
                               const unsigned int bytes,
                               xed_decoded_inst_t* xedd,
                               xed_uint64_t runtime_address) {
    xed_uint64_t t1,t2;
    xed_error_enum_t xed_error;
    xed_bool_t okay;

    if (CLIENT_VERBOSE) {
        print_hex_line(hex_decode_text, bytes);
    }
    t1 = xed_get_time();
    xed_error = xed_decode(xedd, hex_decode_text, bytes);
    t2 = xed_get_time();
    okay = (xed_error == XED_ERROR_NONE);
    if (CLIENT_VERBOSE3) {
        xed_uint64_t delta = t2-t1;
        printf("Decode time = " XED_FMT_LU "\n", delta);
    }
    if (okay)     {

        if (CLIENT_VERBOSE1) {
            char tbuf[XED_TMP_BUF_LEN];
            xed_decoded_inst_dump(xedd,tbuf,XED_TMP_BUF_LEN);
            printf("%s\n",tbuf);
        }
        if (CLIENT_VERBOSE) {
            char buf[XED_TMP_BUF_LEN];
            if (xed_decoded_inst_valid(xedd)) 
            {
                printf( "ICLASS: %s   CATEGORY: %s   EXTENSION: %s  IFORM: %s"
                        "   ISA_SET: %s\n", 
                xed_iclass_enum_t2str(xed_decoded_inst_get_iclass(xedd)),
                xed_category_enum_t2str(xed_decoded_inst_get_category(xedd)),
                xed_extension_enum_t2str(xed_decoded_inst_get_extension(xedd)),
                xed_iform_enum_t2str(xed_decoded_inst_get_iform_enum(xedd)),
                xed_isa_set_enum_t2str(xed_decoded_inst_get_isa_set(xedd)));
            }
            memset(buf,0,XED_TMP_BUF_LEN);
            disassemble(buf,XED_TMP_BUF_LEN, xedd, runtime_address,0);
            printf("SHORT: %s\n", buf);
        }
        return 1;
    }
    else {
        xed_decode_error(0, 0, hex_decode_text, xed_error);
        return 0;
    }
    (void) dstate; // pacify compiler
}
开发者ID:Vectorlee,项目名称:binary_reverse_lib,代码行数:51,代码来源:xed-examples-util.c

示例10: main

int main(int argc, char **argv)
{
	char *finName = 0;
	char *foutName = 0;
	char *assemblyName = 0;

	FILE *fin;
	FILE *fout;

	Instruction text[MAX_CODE_LENGTH+1];

	parseCommandLineArgs(argc, argv, &foutName, &finName,
        "A virtual machine for running p-code.");

    fin = modified_fopen(finName, "r", stdin, NULL);
    fout = modified_fopen(foutName, "w", stdout, NULL);
	
	/* Read instructions into internal buffer */
	int i=0;
	for (;;)
	{
		int items = fscanf(fin, "%d %d %d", &text[i].op, &text[i].l, &text[i].m);
		if(feof(fin))
			break;

        if (items != 3)
        {
            char message[25];
            int c = fgetc(fin);
            sprintf(message, "Illigal character 0x%02x", c);
            die(ERR_ILLIGAL_CHAR, message);
        }
		i++;
		if (i >= MAX_CODE_LENGTH)
        {
            char message[70];
            sprintf(message, "This machine cannot run more "
                    "than %d instructions\n", MAX_CODE_LENGTH);
            die(ERR_CODE_TOO_LARGE, message);
        }
	}
	text[i].op = 0;
	text[i].l = 0;
	text[i].m = 0;

	disassemble(fout, text);
	run(fout, text);

	return EXIT_SUCCESS;
}
开发者ID:cookyt,项目名称:pl0-compiler,代码行数:50,代码来源:main.c

示例11: dik_show_code

static void
dik_show_code(unsigned int *pc)
{
	int i;

	printk("Code:\n");
	for (i = -6; i < 2; i++) {
		unsigned int insn;
		if (__get_user(insn, pc+i))
			break;
		printk("%c", i ? ' ' : '*');
		disassemble(insn);
	}
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:14,代码来源:traps.c

示例12: test_basic_instructions

void test_basic_instructions() {
	asm_p as = &(asm_t){ 0 };
	char* disassembly = NULL;
	as_new(as);
	
	as_clear(as);
		as_syscall(as);
	disassembly = disassemble(as);
	st_check_str(disassembly,
		"syscall \n"
	);
	
	as_clear(as);
		for(size_t i = 0; i < 16; i++)
			as_mov(as, reg(i), imm(0x1122334455667788));
	disassembly = disassemble(as);
	st_check_str(disassembly,
		"movabs rax,0x1122334455667788\n"
		"movabs rcx,0x1122334455667788\n"
		"movabs rdx,0x1122334455667788\n"
		"movabs rbx,0x1122334455667788\n"
		"movabs rsp,0x1122334455667788\n"
		"movabs rbp,0x1122334455667788\n"
		"movabs rsi,0x1122334455667788\n"
		"movabs rdi,0x1122334455667788\n"
		"movabs r8,0x1122334455667788\n"
		"movabs r9,0x1122334455667788\n"
		"movabs r10,0x1122334455667788\n"
		"movabs r11,0x1122334455667788\n"
		"movabs r12,0x1122334455667788\n"
		"movabs r13,0x1122334455667788\n"
		"movabs r14,0x1122334455667788\n"
		"movabs r15,0x1122334455667788\n"
	);
	
	free(disassembly);
}
开发者ID:arkanis,项目名称:lagrange,代码行数:37,代码来源:asm_test.c

示例13: _jit_disassemble

void
_jit_disassemble(jit_state_t *_jit)
{
#if DISASSEMBLER
    if (disasm_bfd) {
#  if defined(__arm__)
	/* FIXME add mapping for prolog switching to arm and possible jump
	 * before first prolog also in arm mode */
	disasm_info.disassembler_options = jit_cpu.thumb ? "force-thumb" : "";
#  endif

	disassemble(_jit->code.ptr, _jit->pc.uc - _jit->code.ptr);
    }
#endif
}
开发者ID:8l,项目名称:bomberjacket,代码行数:15,代码来源:jit_disasm.c

示例14: rowToLine

void SourceWindow::actionExpandRow(int row)
{
    if (row < 0 || isRowExpanded(row) || isRowDisassCode(row))
	return;

    // disassemble
    int line = rowToLine(row);
    const SourceLine& sl = m_sourceCode[line];
    if (!sl.canDisass)
	return;
    if (sl.disass.size() == 0) {
	emit disassemble(m_fileName, line);
    } else {
	expandRow(row);
    }
}
开发者ID:chiky123ser,项目名称:nsga2,代码行数:16,代码来源:sourcewnd.cpp

示例15: msg

void 
CPU::dumpState()
{
	msg("CPU:\n");
	msg("----\n\n");
    msg("%s\n", disassemble());
	msg("Processor port : %02X\n", port);
	msg("Port direction : %02X\n", port_direction);
	msg("      Rdy line : %s\n", rdyLine ? "high" : "low");
	msg("      Irq line : %02X\n", irqLine);
	msg("      Nmi line : %02X %s\n", nmiLine, nmiEdge ? "(negative edge)" : "");
	msg(" no IRQ before : %ull\n", nextPossibleIrqCycle);
	msg(" no NMI before : %ull\n", nextPossibleNmiCycle);
	msg("   IRQ routine : %02X%02X\n", mem->peek(0xFFFF), mem->peek(0xFFFE));
	msg("   NMI routine : %02X%02X\n", mem->peek(0xFFFB), mem->peek(0xFFFA));	
	msg("\n");
}
开发者ID:TheTypoMaster,项目名称:virtualc64,代码行数:17,代码来源:CPU.cpp


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