本文整理汇总了C++中disassemble函数的典型用法代码示例。如果您正苦于以下问题:C++ disassemble函数的具体用法?C++ disassemble怎么用?C++ disassemble使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了disassemble函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: arch_bfdDisasm
void arch_bfdDisasm(pid_t pid, uint8_t * mem, size_t size, char *instr)
{
while (pthread_mutex_lock(&arch_bfd_mutex)) ;
bfd_init();
char fname[PATH_MAX];
snprintf(fname, sizeof(fname), "/proc/%d/exe", pid);
bfd *bfdh = bfd_openr(fname, NULL);
if (bfdh == NULL) {
LOGMSG(l_WARN, "bfd_openr('/proc/%d/exe') failed", pid);
goto out;
}
if (!bfd_check_format(bfdh, bfd_object)) {
LOGMSG(l_WARN, "bfd_check_format() failed");
goto out;
}
disassembler_ftype disassemble = disassembler(bfdh);
if (disassemble == NULL) {
LOGMSG(l_WARN, "disassembler() failed");
goto out;
}
struct disassemble_info info;
init_disassemble_info(&info, instr, arch_bfdFPrintF);
info.arch = bfd_get_arch(bfdh);
info.mach = bfd_get_mach(bfdh);
info.buffer = mem;
info.buffer_length = size;
info.section = NULL;
info.endian = bfd_little_endian(bfdh) ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
disassemble_init_for_target(&info);
strcpy(instr, "");
if (disassemble(0, &info) <= 0) {
snprintf(instr, _HF_INSTR_SZ, "[DIS-ASM_FAILURE]");
}
out:
bfdh ? bfd_close_all_done(bfdh) : 0;
while (pthread_mutex_unlock(&arch_bfd_mutex)) ;
return;
}
开发者ID:LucaBongiorni,项目名称:honggfuzz,代码行数:46,代码来源:bfd.c
示例17: main
int main(int argc, char *argv[]) {
int byte_count = 0;
char tmpstr[512];
uint8_t *buffer; /* Memory buffer */
FILE *input_file; /* Input file */
uint16_t pc; /* Program counter */
options_t options; /* Command-line options parsing results */
parse_args(argc, argv, &options);
buffer = calloc(1, 65536);
if (NULL == buffer) {
usage_and_exit(3, "Could not allocate disassembly memory buffer.");
}
/* Read file into memory buffer */
input_file = fopen(options.filename, "rb");
if (NULL == input_file) {
version();
fprintf(stderr, "File not found or invalid filename : %s\n", options.filename);
exit(2);
}
byte_count = 0;
while(!feof(input_file) && ((options.org + byte_count) <= 0xFFFFu) && (byte_count < options.max_num_bytes)) {
fread(&buffer[options.org + byte_count], 1, 1, input_file);
byte_count++;
}
fclose(input_file);
/* Disassemble contents of buffer */
emit_header(&options, byte_count);
pc = options.org;
while((pc <= 0xFFFFu) && ((pc - options.org) < byte_count)) {
disassemble(tmpstr, buffer, &options, &pc);
fprintf(stdout, "%s\n", tmpstr);
pc++;
}
free(buffer);
return 0;
}
开发者ID:schloepke,项目名称:dcc6502,代码行数:45,代码来源:dcc6502.c
示例18: disassemble_wrap
struct object*
disassemble_wrap(struct object *proc)
{
if (proc->type->code != PROCEDURE_TYPE) {
printf("Wrong type for disassemble: %s\n", proc->type->name);
exit(1);
}
struct procedure *p = container_of(proc, struct procedure, obj);
if (p->type != COMPOUND) {
printf("Can't disassemble primitive procedures\n");
exit(1);
}
struct compound_proc *cp;
cp = container_of(p, struct compound_proc, proc);
disassemble(cp->code);
return UNSPECIFIC;
}
开发者ID:zbenjamin,项目名称:vmscheme,代码行数:18,代码来源:instruction.c
示例19: get_asm_insns
static void get_asm_insns(uint8_t *image, size_t len, unsigned long base,
int opcodes)
{
int count, i, pc = 0;
char tpath[256];
struct disassemble_info info;
disassembler_ftype disassemble;
bfd *bfdf;
memset(tpath, 0, sizeof(tpath));
get_exec_path(tpath, sizeof(tpath));
bfdf = bfd_openr(tpath, NULL);
assert(bfdf);
assert(bfd_check_format(bfdf, bfd_object));
init_disassemble_info(&info, stdout, (fprintf_ftype) fprintf);
info.arch = bfd_get_arch(bfdf);
info.mach = bfd_get_mach(bfdf);
info.buffer = image;
info.buffer_length = len;
disassemble_init_for_target(&info);
disassemble = disassembler(bfdf);
assert(disassemble);
do {
printf("%4x:\t", pc);
count = disassemble(pc, &info);
if (opcodes) {
printf("\n\t");
for (i = 0; i < count; ++i)
printf("%02x ", (uint8_t) image[pc + i]);
}
printf("\n");
pc += count;
} while(count > 0 && pc < len);
bfd_close(bfdf);
}
开发者ID:908626950,项目名称:linux,代码行数:44,代码来源:bpf_jit_disasm.c
示例20: cmd_dis
int cmd_dis(char **arg)
{
char *off_text = get_arg(arg);
char *len_text = get_arg(arg);
address_t offset = 0;
address_t length = 0x40;
uint8_t *buf;
if (!off_text) {
printc_err("dis: offset must be specified\n");
return -1;
}
if (expr_eval(off_text, &offset) < 0) {
printc_err("dis: can't parse offset: %s\n", off_text);
return -1;
}
if (len_text) {
if (expr_eval(len_text, &length) < 0) {
printc_err("dis: can't parse length: %s\n",
len_text);
return -1;
}
} else if (offset < 0x10000 && offset + length > 0x10000) {
length = 0x10000 - offset;
}
buf = malloc(length);
if (!buf) {
pr_error("dis: couldn't allocate memory");
return -1;
}
if (device_readmem(offset, buf, length) < 0) {
free(buf);
return -1;
}
reader_set_repeat("dis 0x%x 0x%x", offset + length, length);
disassemble(offset, buf, length, device_default->power_buf);
free(buf);
return 0;
}
开发者ID:noccy80,项目名称:mspdebug,代码行数:44,代码来源:devcmd.c
注:本文中的disassemble函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论