void print_memory(const void *addr, size_t size) { size_t i; i = 0; while (size > 16) { print_hexa((unsigned char*)addr + i, 16); print_raw((unsigned char*)addr + i, 16); size -= 16; i += 16; } print_hexa((unsigned char*)addr + i, size); print_raw((unsigned char*)addr + i, size); }
void my_showmem16(char *str, int size) { print_addr(str); print_hexa(str, size); print_ascii(str, size); my_putchar('\n'); }
int dispvar(char **format, va_list ap) { int wr; t_args *arg; wr = 0; arg = (t_args*)malloc(sizeof(t_args)); *format += 1; if (**format != 0) { init_arg(&arg); while (is_flag(**format)) { check_flags(format, &arg); check_field(format, &arg, ap); check_prec(format, &arg, ap); check_length(format, &arg); } wr += print_char(format, &arg, ap); wr += print_hexa(format, &arg, ap); wr += print_decimal(format, &arg, ap); wr += print_octal(format, &arg, ap); } free(arg); return (wr); }
static int second_try(Elf64_Shdr *shdr, char *strtab, uint8_t *data, int i) { int k; if ((shdr->sh_size != 0 || shdr->sh_type == SHT_SYMTAB || shdr->sh_type == SHT_NOBITS || shdr->sh_type == SHT_STRTAB) && strcmp(".dynstr", &strtab[shdr[i].sh_name]) != 0) return (SUCCESS); k = shdr[i].sh_offset; printf("Contents of section %s:\n", &strtab[shdr[i].sh_name]); while (k < (int)(shdr[i].sh_offset + shdr[i].sh_size)) { print_pos(&strtab[shdr[i].sh_name], shdr + i, k - shdr[i].sh_offset, i); printf(" "); print_hexa(data + k, shdr[i].sh_offset + shdr[i].sh_size - k); print_ascii(data + k, shdr[i].sh_offset + shdr[i].sh_size - k); printf("\n"); k += 16; } return (SUCCESS); }