From: Aaron Griffith Date: Mon, 9 Jun 2025 19:19:41 +0000 (-0400) Subject: gdb: fix size of z80 "add ii,rr" and "ld (ii+d),n" instructions X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d3355989230b25a617461641e607e0a38344830;p=thirdparty%2Fbinutils-gdb.git gdb: fix size of z80 "add ii,rr" and "ld (ii+d),n" instructions The tables in z80-tdep.c previously either gave these instructions the wrong size, or failed to recognize them by using the wrong masks, or both. The fixed instructions alongside their representation in octal are: * add ii,rr: [0335] 00r1 (where r & 1 == 1) [0375] 00r1 * ld (ii+d,n): [0335] 0066 [0375] 0066 Prefix bytes inside [] do not count towards instruction length in these tables. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33066 Approved-By: Tom Tromey --- diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c index bfa52dd0df1..5fc71fac6d6 100644 --- a/gdb/z80-tdep.c +++ b/gdb/z80-tdep.c @@ -1331,14 +1331,14 @@ ez80_ddfd_insn_table[] = { 0007, 0307, 2, insn_default }, //"ld rr,(ii+d)" { 0061, 0377, 2, insn_default }, //"ld ii,(ii+d)" /* common instructions */ - { 0011, 0367, 2, insn_default }, //"add ii,rr" + { 0011, 0317, 1, insn_default }, //"add ii,rr" { 0041, 0377, 3, insn_default }, //"ld ii,nn" { 0042, 0367, 3, insn_default }, //"ld (nn),ii", "ld ii,(nn)" { 0043, 0367, 1, insn_default }, //"inc ii", "dec ii" { 0044, 0366, 1, insn_default }, //"inc/dec iih/iil" { 0046, 0367, 2, insn_default }, //"ld iih,n", "ld iil,n" { 0064, 0376, 2, insn_default }, //"inc (ii+d)", "dec (ii+d)" - { 0066, 0377, 2, insn_default }, //"ld (ii+d),n" + { 0066, 0377, 3, insn_default }, //"ld (ii+d),n" { 0166, 0377, 0, insn_default }, //not an instruction { 0160, 0370, 2, insn_default }, //"ld (ii+d),r" { 0104, 0306, 1, insn_default }, //"ld r,iih", "ld r,iil" @@ -1360,7 +1360,7 @@ ez80_adl_ddfd_insn_table[] = { { 0007, 0307, 2, insn_default }, //"ld rr,(ii+d)" { 0061, 0377, 2, insn_default }, //"ld ii,(ii+d)" - { 0011, 0367, 1, insn_default }, //"add ii,rr" + { 0011, 0317, 1, insn_default }, //"add ii,rr" { 0041, 0377, 4, insn_default }, //"ld ii,nn" { 0042, 0367, 4, insn_default }, //"ld (nn),ii", "ld ii,(nn)" { 0043, 0367, 1, insn_default }, //"inc ii", "dec ii"