aboutsummaryrefslogtreecommitdiff
path: root/gdb/alpha-tdep.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2017-12-15 18:19:42 +0000
committerPedro Alves <palves@redhat.com>2017-12-15 18:19:42 +0000
commit68f81d60196eb201b209873cf53258f13b0046b9 (patch)
treea9542d13ddd8ea99d15f4931911042ed3c26f01f /gdb/alpha-tdep.c
parent1af17fd9cc3a453e55ce5b8f556c51859bf40363 (diff)
downloadgdb-68f81d60196eb201b209873cf53258f13b0046b9.zip
gdb-68f81d60196eb201b209873cf53258f13b0046b9.tar.gz
gdb-68f81d60196eb201b209873cf53258f13b0046b9.tar.bz2
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: 2017-12-15 Richard Henderson <rth@redhat.com> Uros Bizjak <ubizjak@gmail.com> PR gdb/19061 * alpha-tdep.c (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.
Diffstat (limited to 'gdb/alpha-tdep.c')
-rw-r--r--gdb/alpha-tdep.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 21199bd..07144ce 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -767,10 +767,8 @@ static const int stq_c_opcode = 0x2f;
the sequence. */
static std::vector<CORE_ADDR>
-alpha_deal_with_atomic_sequence (struct regcache *regcache)
+alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- struct gdbarch *gdbarch = regcache->arch ();
- CORE_ADDR pc = regcache_read_pc (regcache);
CORE_ADDR breaks[2] = {-1, -1};
CORE_ADDR loc = pc;
CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence. */
@@ -1723,9 +1721,17 @@ alpha_next_pc (struct regcache *regcache, CORE_ADDR pc)
std::vector<CORE_ADDR>
alpha_software_single_step (struct regcache *regcache)
{
- CORE_ADDR pc = alpha_next_pc (regcache, regcache_read_pc (regcache));
+ struct gdbarch *gdbarch = regcache->arch ();
+
+ CORE_ADDR pc = regcache_read_pc (regcache);
+
+ std::vector<CORE_ADDR> next_pcs
+ = alpha_deal_with_atomic_sequence (gdbarch, pc);
+ if (!next_pcs.empty ())
+ return next_pcs;
- return {pc};
+ CORE_ADDR next_pc = alpha_next_pc (regcache, pc);
+ return {next_pc};
}
@@ -1821,7 +1827,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_cannot_step_breakpoint (gdbarch, 1);
/* Handles single stepping of atomic sequences. */
- set_gdbarch_software_single_step (gdbarch, alpha_deal_with_atomic_sequence);
+ set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
/* Hook in ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);