• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisionbd496067387a9c89a7e62bbba76e784634936932 (tree)
Zeit2018-01-04 00:14:12
AutorRichard Henderson <rth@redh...>
CommiterPedro Alves

Log Message

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.

Ändern Zusammenfassung

Diff

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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+
114 2017-10-25 Leszek Swirski <leszeks@google.com>
215
316 * dwarf2read.c (dwarf2_string_attr): Allow DW_FORM_GNU_str_index.
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -766,10 +766,8 @@ static const int stq_c_opcode = 0x2f;
766766 the sequence. */
767767
768768 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)
770770 {
771- struct gdbarch *gdbarch = get_regcache_arch (regcache);
772- CORE_ADDR pc = regcache_read_pc (regcache);
773771 CORE_ADDR breaks[2] = {-1, -1};
774772 CORE_ADDR loc = pc;
775773 CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence. */
@@ -1721,12 +1719,17 @@ VEC (CORE_ADDR) *
17211719 alpha_software_single_step (struct regcache *regcache)
17221720 {
17231721 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;
17261724
17271725 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);
17281731
1729- VEC_safe_push (CORE_ADDR, next_pcs, alpha_next_pc (regcache, pc));
1732+ VEC_safe_push (CORE_ADDR, next_pcs, next_pc);
17301733 return next_pcs;
17311734 }
17321735
@@ -1826,7 +1829,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
18261829 set_gdbarch_cannot_step_breakpoint (gdbarch, 1);
18271830
18281831 /* 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);
18301833
18311834 /* Hook in ABI-specific overrides, if they have been registered. */
18321835 gdbarch_init_osabi (info, gdbarch);
--- a/gdb/nat/linux-ptrace.h
+++ b/gdb/nat/linux-ptrace.h
@@ -155,6 +155,8 @@ struct buffer;
155155 Beginning with Linux 4.6, the MIPS port reports proper TRAP_BRKPT and
156156 TRAP_HWBKPT codes, so we also match them.
157157
158+ The Alpha kernel uses TRAP_BRKPT for all traps.
159+
158160 The generic Linux target code should use GDB_ARCH_IS_TRAP_* instead
159161 of TRAP_* to abstract out these peculiarities. */
160162 #if defined __i386__ || defined __x86_64__
@@ -166,6 +168,9 @@ struct buffer;
166168 #elif defined __mips__
167169 # define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == SI_KERNEL || (X) == TRAP_BRKPT)
168170 # 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)
169174 #else
170175 # define GDB_ARCH_IS_TRAP_BRKPT(X) ((X) == TRAP_BRKPT)
171176 # define GDB_ARCH_IS_TRAP_HWBKPT(X) ((X) == TRAP_HWBKPT)