38 #include "elf/common.h" 51 static struct target_desc *tdesc_amd64_linux_no_xml;
56 static unsigned char jump_insn[] = { 0xe9, 0, 0, 0, 0 };
62 <architecture>i386</architecture>\ 63 <osabi>GNU/Linux</osabi>\ 67 static const char *xmltarget_amd64_linux_no_xml =
"@<target>\ 68 <architecture>i386:x86-64</architecture>\ 69 <osabi>GNU/Linux</osabi>\ 74 #include <sys/procfs.h> 78 #ifndef PTRACE_GET_THREAD_AREA 79 #define PTRACE_GET_THREAD_AREA 25 83 #ifndef PTRACE_ARCH_PRCTL 84 #define PTRACE_ARCH_PRCTL 30 90 #define ARCH_SET_GS 0x1001 91 #define ARCH_SET_FS 0x1002 92 #define ARCH_GET_FS 0x1003 93 #define ARCH_GET_GS 0x1004 110 RAX * 8, RCX * 8, RDX * 8, RBX * 8,
111 RSP * 8, RBP * 8, RSI * 8, RDI * 8,
112 RIP * 8, EFLAGS * 8, CS * 8, SS * 8,
113 DS * 8, ES * 8, FS * 8, GS * 8
116 #define I386_NUM_REGS (sizeof (i386_regmap) / sizeof (i386_regmap[0])) 119 #define ORIG_EAX ORIG_RAX 122 static const int x86_64_regmap[] =
124 RAX * 8, RBX * 8, RCX * 8, RDX * 8,
125 RSI * 8, RDI * 8, RBP * 8, RSP * 8,
126 R8 * 8, R9 * 8, R10 * 8, R11 * 8,
127 R12 * 8, R13 * 8, R14 * 8, R15 * 8,
128 RIP * 8, EFLAGS * 8, CS * 8, SS * 8,
129 DS * 8, ES * 8, FS * 8, GS * 8,
130 -1, -1, -1, -1, -1, -1, -1, -1,
131 -1, -1, -1, -1, -1, -1, -1, -1,
132 -1, -1, -1, -1, -1, -1, -1, -1,
134 -1, -1, -1, -1, -1, -1, -1, -1,
136 #ifdef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE 143 -1, -1, -1, -1, -1, -1, -1, -1,
144 -1, -1, -1, -1, -1, -1, -1, -1,
145 -1, -1, -1, -1, -1, -1, -1, -1,
146 -1, -1, -1, -1, -1, -1, -1, -1,
147 -1, -1, -1, -1, -1, -1, -1, -1,
148 -1, -1, -1, -1, -1, -1, -1, -1,
149 -1, -1, -1, -1, -1, -1, -1, -1,
150 -1, -1, -1, -1, -1, -1, -1, -1,
151 -1, -1, -1, -1, -1, -1, -1, -1,
155 #define X86_64_NUM_REGS (sizeof (x86_64_regmap) / sizeof (x86_64_regmap[0])) 156 #define X86_64_USER_REGS (GS + 1) 164 EAX * 4, ECX * 4, EDX * 4, EBX * 4,
165 UESP * 4, EBP * 4, ESI * 4, EDI * 4,
166 EIP * 4, EFL * 4, CS * 4, SS * 4,
167 DS * 4, ES * 4, FS * 4, GS * 4
170 #define I386_NUM_REGS (sizeof (i386_regmap) / sizeof (i386_regmap[0])) 196 lwpid_t lwpid,
int idx,
void **base)
221 unsigned int desc[4];
224 (
void *) (intptr_t) idx, (
unsigned long) &desc) < 0)
228 *base = (
void *) (uintptr_t) desc[1];
261 unsigned int desc[4];
263 const int reg_thread_area = 3;
268 idx = gs >> reg_thread_area;
272 (
void *) (
long) idx, (
unsigned long) &desc) < 0)
312 for (i = 0; i < X86_64_NUM_REGS; i++)
313 if (x86_64_regmap[i] != -1)
316 #ifndef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE 334 memset (buf, 0x00, X86_64_USER_REGS * 8);
341 ((
char *) buf) + ORIG_EAX *
REGSIZE);
352 for (i = 0; i < X86_64_NUM_REGS; i++)
353 if (x86_64_regmap[i] != -1)
356 #ifndef HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE 376 ((
char *) buf) + ORIG_EAX *
REGSIZE);
436 #ifdef HAVE_PTRACE_GETREGS 437 { PTRACE_GETREGS, PTRACE_SETREGS, 0,
sizeof (elf_gregset_t),
443 # ifdef HAVE_PTRACE_GETFPXREGS 444 { PTRACE_GETFPXREGS, PTRACE_SETFPXREGS, 0,
sizeof (elf_fpxregset_t),
449 { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0,
sizeof (elf_fpregset_t),
497 #define x86_breakpoint_len 1 682 unsigned int machine;
691 else if (!is_elf64 &&
sizeof (
void *) == 8)
720 #define I386_LINUX_XSAVE_XCR0_OFFSET 464 726 #ifdef HAVE_PTRACE_GETFPXREGS 738 unsigned int machine;
742 static uint64_t xcr0;
743 struct regset_info *regset;
749 if (
sizeof (
void *) == 4)
752 error (
_(
"Can't debug 64-bit process with 32-bit GDBserver"));
754 else if (machine == EM_X86_64)
755 error (
_(
"Can't debug x86-64 process with 32-bit GDBserver"));
759 #if !defined __x86_64__ && defined HAVE_PTRACE_GETFPXREGS 762 elf_fpxregset_t fpxregs;
764 if (
ptrace (PTRACE_GETFPXREGS, tid, 0, (
long) &fpxregs) < 0)
781 if (machine == EM_X86_64)
782 return tdesc_amd64_linux_no_xml;
793 iov.iov_base = xstateregs;
794 iov.iov_len =
sizeof (xstateregs);
798 (
unsigned int) NT_X86_XSTATE, (long) &iov) < 0)
806 /
sizeof (uint64_t))];
810 regset->fill_function != NULL; regset++)
813 else if (regset->type != GENERAL_REGS)
825 if (machine == EM_X86_64)
894 for (i = 0; i < count; i++)
896 const char *feature = features[i];
900 char *copy =
xstrdup (feature + 13);
903 for (p = strtok (copy,
","); p != NULL; p = strtok (NULL,
","))
905 if (strcmp (p,
"i386") == 0)
928 static struct regs_info amd64_linux_regs_info =
953 return &amd64_linux_regs_info;
981 *sysno = (int) l_sysno;
1003 unsigned char *buf_org = buf;
1008 unsigned long ul = strtoul (op, &endptr, 16);
1017 return buf - buf_org;
1035 unsigned char *jjump_pad_insn,
1041 unsigned char buf[40];
1060 buf[i++] = 0x41; buf[i++] = 0x57;
1061 buf[i++] = 0x41; buf[i++] = 0x56;
1062 buf[i++] = 0x41; buf[i++] = 0x55;
1063 buf[i++] = 0x41; buf[i++] = 0x54;
1064 buf[i++] = 0x41; buf[i++] = 0x53;
1065 buf[i++] = 0x41; buf[i++] = 0x52;
1066 buf[i++] = 0x41; buf[i++] = 0x51;
1067 buf[i++] = 0x41; buf[i++] = 0x50;
1071 memcpy (buf + i, &tpaddr, 8);
1080 memcpy (buf + i, &tpoint, 8);
1084 "64 48 8b 04 25 00 00 00 00");
1091 memcpy (&buf[i], (
void *) &lockaddr, 8);
1110 memcpy (buf + i, &tpoint, 8);
1118 memcpy (buf + i, &collector, 8);
1127 memcpy (buf + i, &lockaddr, 8);
1143 buf[i++] = 0x41; buf[i++] = 0x58;
1144 buf[i++] = 0x41; buf[i++] = 0x59;
1145 buf[i++] = 0x41; buf[i++] = 0x5a;
1146 buf[i++] = 0x41; buf[i++] = 0x5b;
1147 buf[i++] = 0x41; buf[i++] = 0x5c;
1148 buf[i++] = 0x41; buf[i++] = 0x5d;
1149 buf[i++] = 0x41; buf[i++] = 0x5e;
1150 buf[i++] = 0x41; buf[i++] = 0x5f;
1163 *adjusted_insn_addr = buildaddr;
1165 *adjusted_insn_addr_end = buildaddr;
1169 loffset = (tpaddr + orig_size) - (buildaddr +
sizeof (
jump_insn));
1170 if (loffset > INT_MAX || loffset < INT_MIN)
1173 "E.Jump back from jump pad too far from tracepoint " 1174 "(offset 0x%" PRIx64
" > int32).", loffset);
1180 memcpy (buf + 1, &
offset, 4);
1187 loffset = *jump_entry - (tpaddr +
sizeof (
jump_insn));
1188 if (loffset > INT_MAX || loffset < INT_MIN)
1191 "E.Jump pad too far from tracepoint " 1192 "(offset 0x%" PRIx64
" > int32).", loffset);
1199 memcpy (buf + 1, &
offset, 4);
1200 memcpy (jjump_pad_insn, buf,
sizeof (
jump_insn));
1201 *jjump_pad_insn_size =
sizeof (
jump_insn);
1204 *jump_entry = buildaddr;
1224 unsigned char *jjump_pad_insn,
1230 unsigned char buf[0x100];
1240 *((
int *)(buf + i)) = (
int) tpaddr;
1259 memcpy (buf + i, &tpoint, 4);
1274 memcpy (&buf[i], (
void *) &lockaddr, 4);
1294 memcpy (&buf[i], (
void *) &tpoint, 4);
1300 memcpy (buf + 1, &
offset, 4);
1314 memcpy (buf + i, &lockaddr, 4);
1344 *adjusted_insn_addr = buildaddr;
1346 *adjusted_insn_addr_end = buildaddr;
1351 memcpy (buf + 1, &
offset, 4);
1366 "E.Cannot allocate trampoline space needed for fast " 1367 "tracepoints on 4-byte instructions.");
1373 memcpy (buf + 1, &
offset, 4);
1379 memcpy (buf + 2, &
offset, 2);
1388 memcpy (buf + 1, &
offset, 4);
1389 memcpy (jjump_pad_insn, buf,
sizeof (
jump_insn));
1390 *jjump_pad_insn_size =
sizeof (
jump_insn);
1394 *jump_entry = buildaddr;
1407 unsigned char *jjump_pad_insn,
1415 return amd64_install_fast_tracepoint_jump_pad (tpoint, tpaddr,
1416 collector, lockaddr,
1417 orig_size, jump_entry,
1418 trampoline, trampoline_size,
1420 jjump_pad_insn_size,
1422 adjusted_insn_addr_end,
1427 collector, lockaddr,
1428 orig_size, jump_entry,
1429 trampoline, trampoline_size,
1431 jjump_pad_insn_size,
1433 adjusted_insn_addr_end,
1443 static int warned_about_fast_tracepoints = 0;
1468 if (!warned_about_fast_tracepoints)
1470 warning (
"4-byte fast tracepoints not available; %s\n", errbuf);
1471 warned_about_fast_tracepoints = 1;
1503 #define EMIT_ASM(NAME, INSNS) \ 1506 extern unsigned char start_ ## NAME, end_ ## NAME; \ 1507 add_insns (&start_ ## NAME, &end_ ## NAME - &start_ ## NAME); \ 1508 __asm__ ("jmp end_" #NAME "\n" \ 1509 "\t" "start_" #NAME ":" \ 1511 "\t" "end_" #NAME ":"); \ 1516 #define EMIT_ASM32(NAME,INSNS) \ 1519 extern unsigned char start_ ## NAME, end_ ## NAME; \ 1520 add_insns (&start_ ## NAME, &end_ ## NAME - &start_ ## NAME); \ 1521 __asm__ (".code32\n" \ 1522 "\t" "jmp end_" #NAME "\n" \ 1523 "\t" "start_" #NAME ":\n" \ 1525 "\t" "end_" #NAME ":\n" \ 1531 #define EMIT_ASM32(NAME,INSNS) EMIT_ASM(NAME,INSNS) 1538 amd64_emit_prologue (
void)
1542 "movq %rsp,%rbp\n\t" 1543 "sub $0x20,%rsp\n\t" 1544 "movq %rdi,-8(%rbp)\n\t" 1545 "movq %rsi,-16(%rbp)");
1550 amd64_emit_epilogue (
void)
1553 "movq -16(%rbp),%rdi\n\t" 1554 "movq %rax,(%rdi)\n\t" 1561 amd64_emit_add (
void)
1564 "add (%rsp),%rax\n\t" 1565 "lea 0x8(%rsp),%rsp");
1569 amd64_emit_sub (
void)
1572 "sub %rax,(%rsp)\n\t" 1577 amd64_emit_mul (
void)
1583 amd64_emit_lsh (
void)
1589 amd64_emit_rsh_signed (
void)
1595 amd64_emit_rsh_unsigned (
void)
1601 amd64_emit_ext (
int arg)
1626 amd64_emit_log_not (
void)
1629 "test %rax,%rax\n\t" 1635 amd64_emit_bit_and (
void)
1638 "and (%rsp),%rax\n\t" 1639 "lea 0x8(%rsp),%rsp");
1643 amd64_emit_bit_or (
void)
1646 "or (%rsp),%rax\n\t" 1647 "lea 0x8(%rsp),%rsp");
1651 amd64_emit_bit_xor (
void)
1654 "xor (%rsp),%rax\n\t" 1655 "lea 0x8(%rsp),%rsp");
1659 amd64_emit_bit_not (
void)
1662 "xorq $0xffffffffffffffff,%rax");
1666 amd64_emit_equal (
void)
1669 "cmp %rax,(%rsp)\n\t" 1670 "je .Lamd64_equal_true\n\t" 1672 "jmp .Lamd64_equal_end\n\t" 1673 ".Lamd64_equal_true:\n\t" 1675 ".Lamd64_equal_end:\n\t" 1676 "lea 0x8(%rsp),%rsp");
1680 amd64_emit_less_signed (
void)
1683 "cmp %rax,(%rsp)\n\t" 1684 "jl .Lamd64_less_signed_true\n\t" 1686 "jmp .Lamd64_less_signed_end\n\t" 1687 ".Lamd64_less_signed_true:\n\t" 1689 ".Lamd64_less_signed_end:\n\t" 1690 "lea 0x8(%rsp),%rsp");
1694 amd64_emit_less_unsigned (
void)
1697 "cmp %rax,(%rsp)\n\t" 1698 "jb .Lamd64_less_unsigned_true\n\t" 1700 "jmp .Lamd64_less_unsigned_end\n\t" 1701 ".Lamd64_less_unsigned_true:\n\t" 1703 ".Lamd64_less_unsigned_end:\n\t" 1704 "lea 0x8(%rsp),%rsp");
1708 amd64_emit_ref (
int size)
1722 "movl (%rax),%eax");
1726 "movq (%rax),%rax");
1732 amd64_emit_if_goto (
int *offset_p,
int *size_p)
1738 ".byte 0x0f, 0x85, 0x0, 0x0, 0x0, 0x0");
1746 amd64_emit_goto (
int *offset_p,
int *size_p)
1749 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0");
1759 int diff = (to - (from + size));
1760 unsigned char buf[
sizeof (int)];
1768 memcpy (buf, &diff,
sizeof (
int));
1773 amd64_emit_const (
LONGEST num)
1775 unsigned char buf[16];
1780 buf[i++] = 0x48; buf[i++] = 0xb8;
1781 memcpy (&buf[i], &num,
sizeof (num));
1790 unsigned char buf[16];
1800 offset64 = fn - (buildaddr + 1 + 4 );
1804 if (offset64 > INT_MAX || offset64 < INT_MIN)
1811 memcpy (buf + i, &fn, 8);
1818 int offset32 = offset64;
1821 memcpy (buf + i, &offset32, 4);
1830 amd64_emit_reg (
int reg)
1832 unsigned char buf[16];
1840 memcpy (&buf[i], ®,
sizeof (reg));
1848 amd64_emit_pop (
void)
1855 amd64_emit_stack_flush (
void)
1862 amd64_emit_zero_ext (
int arg)
1872 "and $0xffff,%rax");
1876 "mov $0xffffffff,%rcx\n\t" 1885 amd64_emit_swap (
void)
1894 amd64_emit_stack_adjust (
int n)
1896 unsigned char buf[16];
1914 amd64_emit_int_call_1 (
CORE_ADDR fn,
int arg1)
1916 unsigned char buf[16];
1923 memcpy (&buf[i], &arg1,
sizeof (arg1));
1927 amd64_emit_call (fn);
1933 amd64_emit_void_call_2 (
CORE_ADDR fn,
int arg1)
1935 unsigned char buf[16];
1942 memcpy (&buf[i], &arg1,
sizeof (arg1));
1951 amd64_emit_call (fn);
1958 amd64_emit_eq_goto (
int *offset_p,
int *size_p)
1961 "cmp %rax,(%rsp)\n\t" 1962 "jne .Lamd64_eq_fallthru\n\t" 1963 "lea 0x8(%rsp),%rsp\n\t" 1966 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 1967 ".Lamd64_eq_fallthru:\n\t" 1968 "lea 0x8(%rsp),%rsp\n\t" 1978 amd64_emit_ne_goto (
int *offset_p,
int *size_p)
1981 "cmp %rax,(%rsp)\n\t" 1982 "je .Lamd64_ne_fallthru\n\t" 1983 "lea 0x8(%rsp),%rsp\n\t" 1986 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 1987 ".Lamd64_ne_fallthru:\n\t" 1988 "lea 0x8(%rsp),%rsp\n\t" 1998 amd64_emit_lt_goto (
int *offset_p,
int *size_p)
2001 "cmp %rax,(%rsp)\n\t" 2002 "jnl .Lamd64_lt_fallthru\n\t" 2003 "lea 0x8(%rsp),%rsp\n\t" 2006 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 2007 ".Lamd64_lt_fallthru:\n\t" 2008 "lea 0x8(%rsp),%rsp\n\t" 2018 amd64_emit_le_goto (
int *offset_p,
int *size_p)
2021 "cmp %rax,(%rsp)\n\t" 2022 "jnle .Lamd64_le_fallthru\n\t" 2023 "lea 0x8(%rsp),%rsp\n\t" 2026 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 2027 ".Lamd64_le_fallthru:\n\t" 2028 "lea 0x8(%rsp),%rsp\n\t" 2038 amd64_emit_gt_goto (
int *offset_p,
int *size_p)
2041 "cmp %rax,(%rsp)\n\t" 2042 "jng .Lamd64_gt_fallthru\n\t" 2043 "lea 0x8(%rsp),%rsp\n\t" 2046 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 2047 ".Lamd64_gt_fallthru:\n\t" 2048 "lea 0x8(%rsp),%rsp\n\t" 2058 amd64_emit_ge_goto (
int *offset_p,
int *size_p)
2061 "cmp %rax,(%rsp)\n\t" 2062 "jnge .Lamd64_ge_fallthru\n\t" 2063 ".Lamd64_ge_jump:\n\t" 2064 "lea 0x8(%rsp),%rsp\n\t" 2067 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 2068 ".Lamd64_ge_fallthru:\n\t" 2069 "lea 0x8(%rsp),%rsp\n\t" 2080 amd64_emit_prologue,
2081 amd64_emit_epilogue,
2086 amd64_emit_rsh_signed,
2087 amd64_emit_rsh_unsigned,
2095 amd64_emit_less_signed,
2096 amd64_emit_less_unsigned,
2100 amd64_write_goto_address,
2105 amd64_emit_stack_flush,
2106 amd64_emit_zero_ext,
2108 amd64_emit_stack_adjust,
2109 amd64_emit_int_call_1,
2110 amd64_emit_void_call_2,
2136 "mov 12(%ebp),%ecx\n\t" 2137 "mov %eax,(%ecx)\n\t" 2138 "mov %ebx,0x4(%ecx)\n\t" 2149 "add (%esp),%eax\n\t" 2150 "adc 0x4(%esp),%ebx\n\t" 2151 "lea 0x8(%esp),%esp");
2158 "subl %eax,(%esp)\n\t" 2159 "sbbl %ebx,4(%esp)\n\t" 2197 "movl %eax,%ebx\n\t" 2203 "movl %eax,%ebx\n\t" 2208 "movl %eax,%ebx\n\t" 2221 "test %eax,%eax\n\t" 2231 "and (%esp),%eax\n\t" 2232 "and 0x4(%esp),%ebx\n\t" 2233 "lea 0x8(%esp),%esp");
2240 "or (%esp),%eax\n\t" 2241 "or 0x4(%esp),%ebx\n\t" 2242 "lea 0x8(%esp),%esp");
2249 "xor (%esp),%eax\n\t" 2250 "xor 0x4(%esp),%ebx\n\t" 2251 "lea 0x8(%esp),%esp");
2258 "xor $0xffffffff,%eax\n\t" 2259 "xor $0xffffffff,%ebx\n\t");
2266 "cmpl %ebx,4(%esp)\n\t" 2267 "jne .Li386_equal_false\n\t" 2268 "cmpl %eax,(%esp)\n\t" 2269 "je .Li386_equal_true\n\t" 2270 ".Li386_equal_false:\n\t" 2272 "jmp .Li386_equal_end\n\t" 2273 ".Li386_equal_true:\n\t" 2275 ".Li386_equal_end:\n\t" 2277 "lea 0x8(%esp),%esp");
2284 "cmpl %ebx,4(%esp)\n\t" 2285 "jl .Li386_less_signed_true\n\t" 2286 "jne .Li386_less_signed_false\n\t" 2287 "cmpl %eax,(%esp)\n\t" 2288 "jl .Li386_less_signed_true\n\t" 2289 ".Li386_less_signed_false:\n\t" 2291 "jmp .Li386_less_signed_end\n\t" 2292 ".Li386_less_signed_true:\n\t" 2294 ".Li386_less_signed_end:\n\t" 2296 "lea 0x8(%esp),%esp");
2303 "cmpl %ebx,4(%esp)\n\t" 2304 "jb .Li386_less_unsigned_true\n\t" 2305 "jne .Li386_less_unsigned_false\n\t" 2306 "cmpl %eax,(%esp)\n\t" 2307 "jb .Li386_less_unsigned_true\n\t" 2308 ".Li386_less_unsigned_false:\n\t" 2310 "jmp .Li386_less_unsigned_end\n\t" 2311 ".Li386_less_unsigned_true:\n\t" 2313 ".Li386_less_unsigned_end:\n\t" 2315 "lea 0x8(%esp),%esp");
2333 "movl (%eax),%eax");
2337 "movl 4(%eax),%ebx\n\t" 2338 "movl (%eax),%eax");
2353 ".byte 0x0f, 0x85, 0x0, 0x0, 0x0, 0x0");
2366 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0");
2376 int diff = (to - (from + size));
2377 unsigned char buf[
sizeof (int)];
2386 memcpy (buf, &diff,
sizeof (
int));
2393 unsigned char buf[16];
2399 lo = num & 0xffffffff;
2400 memcpy (&buf[i], &lo,
sizeof (lo));
2402 hi = ((num >> 32) & 0xffffffff);
2406 memcpy (&buf[i], &hi,
sizeof (hi));
2411 buf[i++] = 0x31; buf[i++] = 0xdb;
2420 unsigned char buf[16];
2427 offset = ((int) fn) - (buildaddr + 5);
2428 memcpy (buf + 1, &
offset, 4);
2436 unsigned char buf[16];
2445 memcpy (&buf[i], ®,
sizeof (reg));
2450 "mov %eax,4(%esp)\n\t" 2451 "mov 8(%ebp),%eax\n\t" 2456 "lea 0x8(%esp),%esp");
2482 "and $0xff,%eax\n\t" 2487 "and $0xffff,%eax\n\t" 2514 unsigned char buf[16];
2532 unsigned char buf[16];
2545 memcpy (&buf[i], &arg1,
sizeof (arg1));
2552 "lea 0x8(%esp),%esp");
2560 unsigned char buf[16];
2568 "sub $0x10,%esp\n\t" 2572 "mov %eax,4(%esp)\n\t" 2573 "mov %ebx,8(%esp)");
2580 memcpy (&buf[i], &arg1,
sizeof (arg1));
2586 "lea 0x10(%esp),%esp\n\t" 2597 "cmpl %eax,(%esp)\n\t" 2598 "jne .Leq_fallthru\n\t" 2599 "cmpl %ebx,4(%esp)\n\t" 2600 "jne .Leq_fallthru\n\t" 2601 "lea 0x8(%esp),%esp\n\t" 2605 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 2606 ".Leq_fallthru:\n\t" 2607 "lea 0x8(%esp),%esp\n\t" 2622 "cmpl %eax,(%esp)\n\t" 2624 "cmpl %ebx,4(%esp)\n\t" 2625 "je .Lne_fallthru\n\t" 2627 "lea 0x8(%esp),%esp\n\t" 2631 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 2632 ".Lne_fallthru:\n\t" 2633 "lea 0x8(%esp),%esp\n\t" 2647 "cmpl %ebx,4(%esp)\n\t" 2649 "jne .Llt_fallthru\n\t" 2650 "cmpl %eax,(%esp)\n\t" 2651 "jnl .Llt_fallthru\n\t" 2653 "lea 0x8(%esp),%esp\n\t" 2657 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 2658 ".Llt_fallthru:\n\t" 2659 "lea 0x8(%esp),%esp\n\t" 2673 "cmpl %ebx,4(%esp)\n\t" 2675 "jne .Lle_fallthru\n\t" 2676 "cmpl %eax,(%esp)\n\t" 2677 "jnle .Lle_fallthru\n\t" 2679 "lea 0x8(%esp),%esp\n\t" 2683 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 2684 ".Lle_fallthru:\n\t" 2685 "lea 0x8(%esp),%esp\n\t" 2699 "cmpl %ebx,4(%esp)\n\t" 2701 "jne .Lgt_fallthru\n\t" 2702 "cmpl %eax,(%esp)\n\t" 2703 "jng .Lgt_fallthru\n\t" 2705 "lea 0x8(%esp),%esp\n\t" 2709 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 2710 ".Lgt_fallthru:\n\t" 2711 "lea 0x8(%esp),%esp\n\t" 2725 "cmpl %ebx,4(%esp)\n\t" 2727 "jne .Lge_fallthru\n\t" 2728 "cmpl %eax,(%esp)\n\t" 2729 "jnge .Lge_fallthru\n\t" 2731 "lea 0x8(%esp),%esp\n\t" 2735 ".byte 0xe9, 0x0, 0x0, 0x0, 0x0\n\t" 2736 ".Lge_fallthru:\n\t" 2737 "lea 0x8(%esp),%esp\n\t" 2794 return &amd64_emit_ops;
2831 return amd64_get_ipa_tdesc_idx (tdesc);
2897 tdesc_amd64_linux_no_xml->
xmltarget = xmltarget_amd64_linux_no_xml;
const struct target_desc * tdesc
void i387_xsave_to_cache(struct regcache *regcache, const void *buf)
int have_ptrace_getfpxregs
enum target_hw_bp_type raw_bkpt_type_to_target_hw_bp_type(enum raw_bkpt_type raw_type)
unsigned long x86_linux_dr_get_status(void)
struct thread_info * current_thread
void collect_register(struct regcache *regcache, int n, void *buf)
static void i386_emit_bit_or(void)
static void i386_emit_reg(int reg)
static void xfree(T *ptr)
static int x86_stopped_by_watchpoint(void)
struct emit_ops i386_emit_ops
static void x86_store_fpregset(struct regcache *regcache, const void *buf)
static void i386_emit_bit_not(void)
static void i386_write_goto_address(CORE_ADDR from, CORE_ADDR to, int size)
static void x86_fill_fpxregset(struct regcache *regcache, void *buf)
static struct regsets_info x86_regsets_info
static int x86_siginfo_fixup(siginfo_t *ptrace, gdb_byte *inf, int direction)
#define X86_XSTATE_SSE_MASK
void supply_register_by_name(struct regcache *regcache, const char *name, const void *buf)
static void i386_emit_rsh_signed(void)
void i387_fxsave_to_cache(struct regcache *regcache, const void *buf)
static void x86_linux_new_fork(struct process_info *parent, struct process_info *child)
static int push_opcode(unsigned char *buf, const char *op)
void initialize_low_arch(void)
struct aarch64_debug_reg_state debug_reg_state
const struct target_desc * i386_linux_read_description(uint64_t xcr0)
static void i386_emit_stack_flush(void)
void warning(const char *fmt,...)
static long lwpid_of(const thread_info *thread)
void regcache_release(void)
static void x86_fill_xstateregset(struct regcache *regcache, void *buf)
struct lwp_info * find_lwp_pid(ptid_t ptid)
#define EMIT_ASM32(NAME, INSNS)
static void i386_emit_ext(int arg)
void * memset(T *s, int c, size_t n)=delete
static void i386_emit_goto(int *offset_p, int *size_p)
static void x86_store_gregset(struct regcache *regcache, const void *buf)
void i387_fsave_to_cache(struct regcache *regcache, const void *buf)
int have_ptrace_getregset
char * paddress(CORE_ADDR addr)
struct thread_info * find_any_thread_of_pid(int pid)
static void x86_fill_gregset(struct regcache *regcache, void *buf)
static int is_64bit_tdesc(void)
static unsigned char jump_insn[]
int x86_dr_remove_watchpoint(struct x86_debug_reg_state *state, enum target_hw_bp_type type, CORE_ADDR addr, int len)
void i386_emit_eq_goto(int *offset_p, int *size_p)
int x86_dr_stopped_data_address(struct x86_debug_reg_state *state, CORE_ADDR *addr_p)
static void i386_emit_if_goto(int *offset_p, int *size_p)
static struct regset_info x86_regsets[]
#define PTRACE_ARCH_PRCTL
static unsigned char small_jump_insn[]
void x86_linux_dr_set_control(unsigned long control)
static struct emit_ops * x86_emit_ops(void)
struct target_ops * the_target
ps_err_e ps_get_thread_area(struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
static int x86_supports_z_point_type(char z_type)
const struct target_desc * tdesc
#define X86_XSTATE_SIZE(XCR0)
static void i386_emit_int_call_1(CORE_ADDR fn, int arg1)
static void i386_emit_bit_xor(void)
char * xstrdup(const char *s)
struct target_desc * allocate_target_description(void)
int x86_dr_insert_watchpoint(struct x86_debug_reg_state *state, enum target_hw_bp_type type, CORE_ADDR addr, int len)
struct arch_process_info * arch_private
static void i386_emit_call(CORE_ADDR fn)
struct x86_debug_reg_state * x86_debug_reg_state(pid_t pid)
static void i386_emit_lsh(void)
void x86_linux_new_thread(struct lwp_info *lwp)
static int x86_cannot_fetch_register(int regno)
int amd64_linux_siginfo_fixup_common(siginfo_t *ptrace, gdb_byte *inf, int direction, enum amd64_siginfo_fixup_mode mode)
static void i386_emit_add(void)
void collect_register_by_name(struct regcache *regcache, const char *name, void *buf)
static void i386_emit_ref(int size)
CORE_ADDR current_insn_ptr
void copy_target_description(struct target_desc *dest, const struct target_desc *src)
static CORE_ADDR x86_get_pc(struct regcache *regcache)
const struct regs_info * x86_linux_regs_info(void)
process_info * find_process_pid(int pid)
static int i386_install_fast_tracepoint_jump_pad(CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline, ULONGEST *trampoline_size, unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size, CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end, char *err)
static void i386_emit_swap(void)
#define X86_XSTATE_SSE_SIZE
static void x86_set_pc(struct regcache *regcache, CORE_ADDR pc)
#define gdb_assert_not_reached(message)
ptid_t pid_to_ptid(int pid)
static void x86_store_xstateregset(struct regcache *regcache, const void *buf)
static void append_insns(CORE_ADDR *to, size_t len, const unsigned char *buf)
#define get_lwp_thread(lwp)
int register_size(const struct target_desc *tdesc, int n)
void initialize_low_tdesc()
static int x86_get_ipa_tdesc_idx(void)
struct linux_target_ops the_low_target
static int startswith(const char *string, const char *pattern)
static int x86_cannot_store_register(int regno)
void i386_emit_lt_goto(int *offset_p, int *size_p)
static void i386_emit_mul(void)
static void x86_store_fpxregset(struct regcache *regcache, const void *buf)
void x86_linux_dr_set_addr(int regnum, CORE_ADDR addr)
struct process_info * current_process(void)
#define x86_breakpoint_len
void i386_emit_ge_goto(int *offset_p, int *size_p)
struct process_info_private * priv
int x86_dr_stopped_by_watchpoint(struct x86_debug_reg_state *state)
static void x86_fill_fpregset(struct regcache *regcache, void *buf)
static void x86_arch_setup(void)
static int x86_get_min_fast_tracepoint_insn_len(void)
static void i386_emit_const(LONGEST num)
int have_fast_tracepoint_trampoline_buffer(char *buf)
unsigned long long x86_xcr0
void i386_emit_ne_goto(int *offset_p, int *size_p)
int linux_pid_exe_is_elf_64_file(int pid, unsigned int *machine)
int write_inferior_memory(CORE_ADDR memaddr, const unsigned char *myaddr, int len)
void i387_cache_to_xsave(struct regcache *regcache, void *buf)
static void i386_emit_pop(void)
static struct usrregs_info i386_linux_usrregs_info
CORE_ADDR x86_linux_dr_get_addr(int regnum)
static int x86_install_fast_tracepoint_jump_pad(CORE_ADDR tpoint, CORE_ADDR tpaddr, CORE_ADDR collector, CORE_ADDR lockaddr, ULONGEST orig_size, CORE_ADDR *jump_entry, CORE_ADDR *trampoline, ULONGEST *trampoline_size, unsigned char *jjump_pad_insn, ULONGEST *jjump_pad_insn_size, CORE_ADDR *adjusted_insn_addr, CORE_ADDR *adjusted_insn_addr_end, char *err)
void x86_low_init_dregs(struct x86_debug_reg_state *state)
static const gdb_byte x86_breakpoint[]
static int x86_supports_tracepoints(void)
static void i386_emit_zero_ext(int arg)
static void for_each_process(Func func)
void i387_cache_to_fsave(struct regcache *regcache, void *buf)
static void i386_emit_rsh_unsigned(void)
int claim_trampoline_space(ULONGEST used, CORE_ADDR *trampoline)
static CORE_ADDR x86_stopped_data_address(void)
void x86_linux_delete_thread(struct arch_lwp_info *arch_lwp)
static const struct target_desc * x86_linux_read_description(void)
void i387_cache_to_fxsave(struct regcache *regcache, void *buf)
static struct arch_process_info * x86_linux_new_process(void)
static void i386_emit_less_signed(void)
CORE_ADDR get_raw_reg_func_addr(void)
void i386_emit_gt_goto(int *offset_p, int *size_p)
static void i386_emit_less_unsigned(void)
struct x86_dr_low_type x86_dr_low
int(* read_memory)(CORE_ADDR memaddr, unsigned char *myaddr, int len)
static void i386_emit_epilogue(void)
struct regcache * get_thread_regcache(struct thread_info *thread, int fetch)
#define Z_PACKET_ACCESS_WP
static int x86_remove_point(enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp)
unsigned long x86_linux_dr_get_control(void)
static struct target_desc * tdesc_i386_linux_no_xml
static void i386_emit_log_not(void)
int i386_get_ipa_tdesc_idx(const struct target_desc *tdesc)
#define PTRACE_GET_THREAD_AREA
static int x86_supports_range_stepping(void)
unsigned long long ULONGEST
static void i386_emit_stack_adjust(int n)
static void i386_emit_equal(void)
static void x86_linux_update_xmltarget(void)
static struct regs_info i386_linux_regs_info
void i386_emit_le_goto(int *offset_p, int *size_p)
static void i386_emit_bit_and(void)
void debug_printf(const char *fmt,...)
static void x86_get_syscall_trapinfo(struct regcache *regcache, int *sysno)
#define EMIT_ASM(NAME, INSNS)
static int x86_supports_hardware_single_step(void)
static void x86_linux_process_qsupported(char **features, int count)
#define I386_LINUX_XSAVE_XCR0_OFFSET
static void i386_emit_void_call_2(CORE_ADDR fn, int arg1)
void supply_register(struct regcache *regcache, int n, const void *buf)
static void add_insns(unsigned char *start, int len)
static const char * xmltarget_i386_linux_no_xml
static int x86_get_thread_area(int lwpid, CORE_ADDR *addr)
void error(const char *fmt,...)
void x86_linux_prepare_to_resume(struct lwp_info *lwp)
static int x86_breakpoint_at(CORE_ADDR pc)
static void i386_emit_sub(void)
static const gdb_byte * x86_sw_breakpoint_from_kind(int kind, int *size)
int relocate_instruction(CORE_ADDR *to, CORE_ADDR oldloc)
#define Z_PACKET_WRITE_WP
static int x86_insert_point(enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp)
static void x86_linux_delete_process(struct arch_process_info *info)
static void i386_emit_prologue(void)
#define X86_XSTATE_ALL_MASK