aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiancarlo Frix <gfrix@rocketsoftware.com>2020-12-06 14:30:53 +0400
committerJoel Brobecker <brobecker@adacore.com>2020-12-06 14:30:53 +0400
commit47c4623c7587a0008597a4a10a7f32bbac1f7ad4 (patch)
tree3635a19482020049d708fbfd98044752c8781ea1
parentbc6989cbd3aa046fa35914466c9aa34d5550f7c2 (diff)
downloadgdb-47c4623c7587a0008597a4a10a7f32bbac1f7ad4.zip
gdb-47c4623c7587a0008597a4a10a7f32bbac1f7ad4.tar.gz
gdb-47c4623c7587a0008597a4a10a7f32bbac1f7ad4.tar.bz2
s390: Fix BC instruction breakpoint handling
This fixes a long-lived bug in the s390 port. When trying to step over a breakpoint set on a BC (branch on condition) instruction with displaced stepping on IBM Z, gdb would incorrectly adjust the pc regardless of whether or not the branch was taken. Since the branch target is an absolute address, this would cause the inferior to jump around wildly whenever the branch was taken, either crashing it or causing it to behave unpredictably. It turns out that the logic to handle BC instructions correctly was in the code, but that the enum value representing its opcode has always been incorrect. This patch corrects the enum value to the actual opcode, fixing the stepping problem. The enum value is also used in the prologue analysis code, so this also fixes a minor bug where more of the prologue would be read than was necessary. gdb/ChangeLog: PR breakpoints/27009 * s390-tdep.h (op_bc): Correct BC opcode value.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/s390-tdep.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e2bb19d..6d30484 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-12-06 Giancarlo Frix <gfrix@rocketsoftware.com> (tiny change)
+
+ PR breakpoints/27009
+ * s390-tdep.h (op_bc): Correct BC opcode value.
+
2020-12-04 Shahab Vahedi <shahab@synopsys.com>
PR tdep/27015
diff --git a/gdb/s390-tdep.h b/gdb/s390-tdep.h
index c0ea9cf..fc8918f 100644
--- a/gdb/s390-tdep.h
+++ b/gdb/s390-tdep.h
@@ -117,7 +117,7 @@ enum
op_basr = 0x0d,
op_bas = 0x4d,
op_bcr = 0x07,
- op_bc = 0x0d,
+ op_bc = 0x47,
op_bctr = 0x06,
op_bctgr = 0xb946,
op_bct = 0x46,