capstone: debug stuff, cleanup

Change-Id: Ia831c20097e86d1f178efb09884a60caa542f12a
This commit is contained in:
Horst Schirmeier
2020-05-23 22:24:48 +02:00
parent 1dd929aad5
commit 73b246c7df

View File

@ -33,6 +33,7 @@ std::map<uint64_t, uint64_t> CapstoneDisassembler::get_symtab_map(uint64_t sect_
std::vector<std::pair<uint64_t, uint64_t> > symbols; std::vector<std::pair<uint64_t, uint64_t> > symbols;
for (ElfReader::container_t::const_iterator it = m_elf->sym_begin(); it != m_elf->sym_end(); ++it) { for (ElfReader::container_t::const_iterator it = m_elf->sym_begin(); it != m_elf->sym_end(); ++it) {
// std::cout << it->getSymbolType() << " " << it->getName() << " (" << it->getDemangledName() << ") " << std::hex << it->getAddress() << " " << std::dec << it->getSize() << "\n";
if (it->getSymbolType() != 2 /*SST_FUNC*/) { if (it->getSymbolType() != 2 /*SST_FUNC*/) {
if (it->getSymbolType() != STT_FUNC && it->getSymbolType() != STT_NOTYPE) { if (it->getSymbolType() != STT_FUNC && it->getSymbolType() != STT_NOTYPE) {
continue; continue;
@ -147,10 +148,10 @@ int CapstoneDisassembler::disassemble_section(Elf_Data *data, Elf32_Shdr *shdr32
// Print assembly // Print assembly
#if 0 #if 0
printf("%s\t%s\n", insn[j].mnemonic, insn[j].op_str); printf("%s\t%s\n", insn[j].mnemonic, insn[j].op_str);
printf("Opcode: %x\t Adress: %lx\t Size: %d\n", opcode, insn[j].address, insn[j].size); printf("Opcode: %x\t Address: %lx\t Size: %d\n", opcode, insn[j].address, insn[j].size);
#endif #endif
// Print all registers accessed by this instruction. // Print all registers accessed by this instruction.
if (cs_regs_access(handle, &insn[j], regs_read, &read_count, regs_write, &write_count) == 0) { if (cs_regs_access(handle, &insn[j], regs_read, &read_count, regs_write, &write_count) == CS_ERR_OK) {
Instr instr; Instr instr;
instr.opcode = opcode; instr.opcode = opcode;
instr.length = insn[j].size; instr.length = insn[j].size;