|
| 1 | +#ifndef __ELF32_GDB |
| 2 | +#define __ELF32_GDB |
| 3 | + |
| 4 | +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) |
| 5 | +#include <sys/exec_elf.h> |
| 6 | +#else |
| 7 | +#include <elf.h> |
| 8 | +#endif |
| 9 | + |
| 10 | +#include <sys/mman.h> |
| 11 | +#include <sys/stat.h> |
| 12 | +#include <stdint.h> |
| 13 | +#include <stdlib.h> |
| 14 | +#include <string.h> |
| 15 | +#include <unistd.h> |
| 16 | +#include <stdio.h> |
| 17 | +#include <fcntl.h> |
| 18 | + |
| 19 | +typedef unsigned int uint_t; |
| 20 | + |
| 21 | +int ELF_CHK(int); |
| 22 | +Elf32_Off chk_deline_sh(void); |
| 23 | +int inject_sp(void); |
| 24 | + |
| 25 | +char gdb_deinfo[] = "\x87\x00\x00\x00\x02\x00\x00\x00\x00\x00\x04\x01\x3b\x00\x00\x00" |
| 26 | +"\x01\x00\x00\x00\x00\x55\x00\x00\x00\xd4\x83\x04\x08\xf0\x83\x04" |
| 27 | +"\x08\x00\x00\x00\x00\x02\x04\x07\x2e\x00\x00\x00\x02\x01\x08\x47" |
| 28 | +"\x00\x00\x00\x02\x02\x07\x07\x00\x00\x00\x02\x04\x07\x29\x00\x00" |
| 29 | +"\x00\x02\x01\x06\x49\x00\x00\x00\x02\x02\x05\x1a\x00\x00\x00\x03" |
| 30 | +"\x04\x05\x69\x6e\x74\x00\x02\x08\x05\x68\x00\x00\x00\x02\x08\x07" |
| 31 | +"\x24\x00\x00\x00\x02\x04\x05\x6d\x00\x00\x00\x02\x01\x06\x50\x00" |
| 32 | +"\x00\x00\x04\x01\x63\x00\x00\x00\x01\x03\x4f\x00\x00\x00\xd4\x83" |
| 33 | +"\x04\x08\xf0\x83\x04\x08\x00\x00\x00\x00\x00"; |
| 34 | + |
| 35 | +char gdb_deabbrev[] = "\x01\x11\x01\x25\x0e\x13\x0b\x03\x0e\x1b\x0e\x11\x01\x12\x01\x10" |
| 36 | +"\x06\x00\x00\x02\x24\x00\x0b\x0b\x3e\x0b\x03\x0e\x00\x00\x03\x24" |
| 37 | +"\x00\x0b\x0b\x3e\x0b\x03\x08\x00\x00\x04\x2e\x00\x3f\x0c\x03\x0e" |
| 38 | +"\x3a\x0b\x3b\x0b\x49\x13\x11\x01\x12\x01\x40\x06\x00\x00\x00"; |
| 39 | + |
| 40 | +char gdb_destr[] = "\x65\x76\x69\x6c\x2e\x63\x00\x73\x68\x6f\x72\x74\x20\x75\x6e\x73" |
| 41 | +"\x69\x67\x6e\x65\x64\x20\x69\x6e\x74\x00\x73\x68\x6f\x72\x74\x20" |
| 42 | +"\x69\x6e\x74\x00\x6c\x6f\x6e\x67\x20\x6c\x6f\x6e\x67\x20\x75\x6e" |
| 43 | +"\x73\x69\x67\x6e\x65\x64\x20\x69\x6e\x74\x00\x47\x4e\x55\x20\x43" |
| 44 | +"\x20\x34\x2e\x36\x2e\x33\x00\x75\x6e\x73\x69\x67\x6e\x65\x64\x20" |
| 45 | +"\x63\x68\x61\x72\x00\x2f\x68\x6f\x6d\x65\x2f\x6e\x69\x74\x72\x30" |
| 46 | +"\x75\x73\x00\x6d\x61\x69\x6e\x00\x6c\x6f\x6e\x67\x20\x6c\x6f\x6e" |
| 47 | +"\x67\x20\x69\x6e\x74\x00"; |
| 48 | + |
| 49 | +const char gdbdwf_line_header[] = "\x32\x00\x00\x00\x02\x00\x1c\x00\x00\x00\x01\x01\xfb\x0e" |
| 50 | +"\x0d\x45\x4c\x46\x33\x32\xDE\xAD\xC0\xDE\xDE\xAD\x70\x00" |
| 51 | +"\x46\x55\x43\x4b\x21\x00\x31\x33\x70\x00\x00\x05\x02\xd4" |
| 52 | +"\x83\x04\x08\x15\x91\xbc\x59\x02\x02\x00\x01\x01"; |
| 53 | + |
| 54 | +char *elf_epptr; |
| 55 | +Elf32_Ehdr *elf_header; |
| 56 | +Elf32_Shdr *section_header_table; |
| 57 | +Elf32_Phdr *program_header_table; |
| 58 | +Elf32_Shdr *shstrtab_section; |
| 59 | +Elf32_Word deline_sz=0, shstrtab_sz=0; |
| 60 | +Elf32_Off shstrtab_offset=0, deline_offset=0; |
| 61 | + |
| 62 | + |
| 63 | +#endif |
0 commit comments