GNU Binutils with patches for OS216
Revision | bd496067387a9c89a7e62bbba76e784634936932 (tree) |
---|---|
Zeit | 2018-01-04 00:14:12 |
Autor | Richard Henderson <rth@redh...> |
Commiter | Pedro Alves |
Fix PR19061, gdb hangs/spins-on-cpu when debugging any program on Alpha
This fixes PR19061, where gdb hangs/spins-on-cpu when debugging any
program on Alpha.
(This patch is Uros' forward port of the patch from comment #5
of the PR [1].)
Patch was tested on alphaev68-linux-gnu, also tested with gcc's
testsuite, where it fixed all hangs in guality.exp and
simulate-thread.exp testcases.
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=19061#c5
gdb/ChangeLog:
2018-01-03 Richard Henderson <rth@redhat.com>
Uros Bizjak <ubizjak@gmail.com>
PR gdb/19061
* alpha-tdep.c (alpha_deal_with_atomic_sequence): Change
prototype.
(alpha_software_single_step): Call alpha_deal_with_atomic_sequence
here.
(set_gdbarch_software_single_step): Set to
alpha_software_single_step.
* nat/linux-ptrace.h [__alpha__]: Define GDB_ARCH_IS_TRAP_BRKPT
and GDB_ARCH_IS_TRAP_HWBKPT.
@@ -1,3 +1,16 @@ | ||
1 | +2018-01-03 Richard Henderson <rth@redhat.com> | |
2 | + Uros Bizjak <ubizjak@gmail.com> | |
3 | + | |
4 | + PR gdb/19061 | |
5 | + * alpha-tdep.c (alpha_deal_with_atomic_sequence): Change | |
6 | + prototype. | |
7 | + (alpha_software_single_step): Call alpha_deal_with_atomic_sequence | |
8 | + here. | |
9 | + (set_gdbarch_software_single_step): Set to | |
10 | + alpha_software_single_step. | |
11 | + * nat/linux-ptrace.h [__alpha__]: Define GDB_ARCH_IS_TRAP_BRKPT | |
12 | + and GDB_ARCH_IS_TRAP_HWBKPT. | |
13 | + | |
1 | 14 | 2017-10-25 Leszek Swirski <leszeks@google.com> |
2 | 15 | |
3 | 16 | * dwarf2read.c (dwarf2_string_attr): Allow DW_FORM_GNU_str_index. |
@@ -766,10 +766,8 @@ static const int stq_c_opcode = 0x2f; | ||
766 | 766 | the sequence. */ |
767 | 767 | |
768 | 768 | static VEC (CORE_ADDR) * |
769 | -alpha_deal_with_atomic_sequence (struct regcache *regcache) | |
769 | +alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc) | |
770 | 770 | { |
771 | - struct gdbarch *gdbarch = get_regcache_arch (regcache); | |
772 | - CORE_ADDR pc = regcache_read_pc (regcache); | |
773 | 771 | CORE_ADDR breaks[2] = {-1, -1}; |
774 | 772 | CORE_ADDR loc = pc; |
775 | 773 | CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence. */ |
@@ -1721,12 +1719,17 @@ VEC (CORE_ADDR) * | ||
1721 | 1719 | alpha_software_single_step (struct regcache *regcache) |
1722 | 1720 | { |
1723 | 1721 | struct gdbarch *gdbarch = get_regcache_arch (regcache); |
1724 | - CORE_ADDR pc; | |
1725 | - VEC (CORE_ADDR) *next_pcs = NULL; | |
1722 | + CORE_ADDR pc, next_pc; | |
1723 | + VEC (CORE_ADDR) *next_pcs; | |
1726 | 1724 | |
1727 | 1725 | pc = regcache_read_pc (regcache); |
1726 | + next_pcs = alpha_deal_with_atomic_sequence (gdbarch, pc); | |
1727 | + if (next_pcs != NULL) | |
1728 | + return next_pcs; | |
1729 | + | |
1730 | + next_pc = alpha_next_pc (regcache, pc); | |
1728 | 1731 | |
1729 | - VEC_safe_push (CORE_ADDR, next_pcs, alpha_next_pc (regcache, pc)); | |
1732 | + VEC_safe_push (CORE_ADDR, next_pcs, next_pc); | |
1730 | 1733 | return next_pcs; |
1731 | 1734 | } |
1732 | 1735 |
@@ -1826,7 +1829,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) | ||
1826 | 1829 | set_gdbarch_cannot_step_breakpoint (gdbarch, 1); |
1827 | 1830 | |
1828 | 1831 | /* Handles single stepping of atomic sequences. */ |
1829 | - set_gdbarch_software_single_step (gdbarch, alpha_deal_with_atomic_sequence); | |
1832 | + set_gdbarch_software_single_step (gdbarch, alpha_software_single_step); | |
1830 | 1833 | |
1831 | 1834 | /* Hook in ABI-specific overrides, if they have been registered. */ |
1832 | 1835 | gdbarch_init_osabi (info, gdbarch); |
@@ -155,6 +155,8 @@ struct buffer; | ||
155 | 155 | Beginning with Linux 4.6, the MIPS port reports proper TRAP_BRKPT and |
156 | 156 | TRAP_HWBKPT codes, so we also match them. |
157 | 157 | |
158 | + The Alpha kernel uses TRAP_BRKPT for all traps. | |
159 | + | |
158 | 160 | The generic Linux target code should use GDB_ARCH_IS_TRAP_* instead |
159 | 161 | of TRAP_* to abstract out these peculiarities. */ |
160 | 162 | #if defined __i386__ || defined __x86_64__ |
@@ -166,6 +168,9 @@ struct buffer; | ||
166 | 168 | #elif defined __mips__ |
167 | 169 | # define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT) |
168 | 170 | # define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == SI_KERNEL || (X) == TRAP_HWBKPT) |
171 | +#elif defined __alpha__ | |
172 | +# define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT) | |
173 | +# define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_BRKPT) | |
169 | 174 | #else |
170 | 175 | # define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT) |
171 | 176 | # define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT) |