Respected GDB community members, Hi, Please find attached a patch. {See: 0001-Fix-to-step-instruction-due-to-P10-prefix-instructio.patch} This is a patch to fix the SIGILL instruction coming in AIX running on a power 10 machine. Consider a program p10-test.c cat ~/p10_test.c #include int global_variable = 2; unsigned long add (unsigned long a) { printf ("%ld is the num \n", a + 0x12345U); return a + 0x12345U; } int main(){ unsigned long local_variable = 1; add (local_variable); printf ("Simple print statement \n"); printf ("Hello Bengaluru \n"); return 0; } The disassembly equivalent of the a + 0x12345U has a paddi instruction. This instruction is 8 bytes as shown in the GDB output of the disassemble of add () in the above code. Breakpoint 2, add (a=1) at /home/buildusr/p10_test.c:6 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) disassemble Dump of assembler code for function add: 0x10000538 <+0>: mflr r0 0x1000053c <+4>: stw r0,8(r1) 0x10000540 <+8>: stw r31,-4(r1) 0x10000544 <+12>: stwu r1,-80(r1) 0x10000548 <+16>: mr r31,r1 0x1000054c <+20>: stw r3,104(r31) => 0x10000550 <+24>: lwz r9,104(r31) 0x10000554 <+28>: paddi r9,r9,74565 0x1000055c <+36>: mr r4,r9 0x10000560 <+40>: lwz r3,64(r2) 0x10000564 <+44>: bl 0x10000648 0x10000568 <+48>: lwz r2,20(r1) 0x1000056c <+52>: lwz r9,104(r31) 0x10000570 <+56>: paddi r9,r9,74565 0x10000578 <+64>: mr r3,r9 0x1000057c <+68>: addi r1,r31,80 0x10000580 <+72>: lwz r0,8(r1) Since during a stepi we are stepping 4 bytes and once we press stepi after we execute instruction at 0x10000554 we get (gdb) si 0x10000554 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) Program received signal SIGILL, Illegal instruction. 0x10000554 in add (a=1) at /home/buildusr/p10_test.c:6 6 printf ("%ld is the num \n", a + 0x12345U); The reason being we stepped into an illegal instruction. In this patch we use (insn & 0xfc000000) == 1 << 26 to check for the p10 instruction and then calculate the location at which stepi needs to be done. The output after we apply this patch is. In 32 bit mode:- stepi jumps 8 bytes when required. Breakpoint 2, add (a=1) at /home/buildusr/p10_test.c:6 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) disassemble Dump of assembler code for function add: 0x10000538 <+0>: mflr r0 0x1000053c <+4>: stw r0,8(r1) 0x10000540 <+8>: stw r31,-4(r1) 0x10000544 <+12>: stwu r1,-80(r1) 0x10000548 <+16>: mr r31,r1 0x1000054c <+20>: stw r3,104(r31) => 0x10000550 <+24>: lwz r9,104(r31) 0x10000554 <+28>: paddi r9,r9,74565 0x1000055c <+36>: mr r4,r9 0x10000560 <+40>: lwz r3,64(r2) 0x10000564 <+44>: bl 0x10000648 0x10000568 <+48>: lwz r2,20(r1) 0x1000056c <+52>: lwz r9,104(r31) 0x10000570 <+56>: paddi r9,r9,74565 0x10000578 <+64>: mr r3,r9 0x1000057c <+68>: addi r1,r31,80 0x10000580 <+72>: lwz r0,8(r1) 0x10000584 <+76>: mtlr r0 0x10000588 <+80>: lwz r31,-4(r1) 0x1000058c <+84>: blr 0x10000590 <+88>: .long 0x0 0x10000594 <+92>: .long 0x2061 0x10000598 <+96>: lwz r0,257(r1) 0x1000059c <+100>: .long 0x0 0x100005a0 <+104>: .long 0x58 0x100005a4 <+108>: .long 0x36164 0x100005a8 <+112>: oris r31,r0,0 End of assembler dump. (gdb) si 0x10000554 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) 0x1000055c 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) 0x10000560 6 printf ("%ld is the num \n", a + 0x12345U); In 64 bit mode:- stepi jumps 8 bytes when required. Breakpoint 1, add (a=1) at /home/buildusr/p10_test.c:6 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) disassemble Dump of assembler code for function add: 0x00000001000006c0 <+0>: mflr r0 0x00000001000006c4 <+4>: std r0,16(r1) 0x00000001000006c8 <+8>: std r31,-8(r1) 0x00000001000006cc <+12>: stdu r1,-128(r1) 0x00000001000006d0 <+16>: mr r31,r1 0x00000001000006d4 <+20>: std r3,176(r31) => 0x00000001000006d8 <+24>: ld r9,176(r31) 0x00000001000006dc <+28>: paddi r9,r9,74565 0x00000001000006e4 <+36>: mr r4,r9 0x00000001000006e8 <+40>: ld r3,120(r2) 0x00000001000006ec <+44>: bl 0x1000007a4 0x00000001000006f0 <+48>: ld r2,40(r1) 0x00000001000006f4 <+52>: ld r9,176(r31) 0x00000001000006f8 <+56>: paddi r9,r9,74565 0x0000000100000700 <+64>: mr r3,r9 0x0000000100000704 <+68>: addi r1,r31,128 0x0000000100000708 <+72>: ld r0,16(r1) 0x000000010000070c <+76>: mtlr r0 0x0000000100000710 <+80>: ld r31,-8(r1) 0x0000000100000714 <+84>: blr 0x0000000100000718 <+88>: .long 0x0 0x000000010000071c <+92>: .long 0x2061 0x0000000100000720 <+96>: lwz r0,257(r1) 0x0000000100000724 <+100>: .long 0x0 0x0000000100000728 <+104>: .long 0x58 0x000000010000072c <+108>: .long 0x36164 0x0000000100000730 <+112>: oris r31,r0,0 End of assembler dump. (gdb) si 0x00000001000006dc 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) 0x00000001000006e4 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) q Setting a breakpoint at that instruction (gdb) b add Breakpoint 1 at 0x100006d8: file /home/buildusr/p10_test.c, line 6. (gdb) r Starting program: /home/buildusr/p10_test_64 Breakpoint 1, add (a=1) at /home/buildusr/p10_test.c:6 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) disassemble Dump of assembler code for function add: 0x00000001000006c0 <+0>: mflr r0 0x00000001000006c4 <+4>: std r0,16(r1) 0x00000001000006c8 <+8>: std r31,-8(r1) 0x00000001000006cc <+12>: stdu r1,-128(r1) 0x00000001000006d0 <+16>: mr r31,r1 0x00000001000006d4 <+20>: std r3,176(r31) => 0x00000001000006d8 <+24>: ld r9,176(r31) 0x00000001000006dc <+28>: paddi r9,r9,74565 0x00000001000006e4 <+36>: mr r4,r9 0x00000001000006e8 <+40>: ld r3,120(r2) 0x00000001000006ec <+44>: bl 0x1000007a4 0x00000001000006f0 <+48>: ld r2,40(r1) 0x00000001000006f4 <+52>: ld r9,176(r31) 0x00000001000006f8 <+56>: paddi r9,r9,74565 0x0000000100000700 <+64>: mr r3,r9 0x0000000100000704 <+68>: addi r1,r31,128 0x0000000100000708 <+72>: ld r0,16(r1) 0x000000010000070c <+76>: mtlr r0 0x0000000100000710 <+80>: ld r31,-8(r1) 0x0000000100000714 <+84>: blr 0x0000000100000718 <+88>: .long 0x0 0x000000010000071c <+92>: .long 0x2061 0x0000000100000720 <+96>: lwz r0,257(r1) 0x0000000100000724 <+100>: .long 0x0 0x0000000100000728 <+104>: .long 0x58 0x000000010000072c <+108>: .long 0x36164 0x0000000100000730 <+112>: oris r31,r0,0 End of assembler dump. (gdb) b *0x00000001000006dc Breakpoint 2 at 0x1000006dc: file /home/buildusr/p10_test.c, line 6. (gdb) b *0x00000001000006e4 Breakpoint 3 at 0x1000006e4: file /home/buildusr/p10_test.c, line 6. (gdb) c Continuing. Breakpoint 2, 0x00000001000006dc in add (a=1) at /home/buildusr/p10_test.c:6 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) c Continuing. Breakpoint 3, 0x00000001000006e4 in add (a=1) at /home/buildusr/p10_test.c:6 6 printf ("%ld is the num \n", a + 0x12345U); (gdb) c Continuing. 74566 is the num Simple print statement Hello Bengaluru [Inferior 1 (process 6685154) exited normally] (gdb) So, I would like your views and guidance on this. Though this patch fixes things in this example we might need to take care many other things which I might not be aware of since this involves step and breakpoint. Kindly let me know what you all think and fix this issue for GDB and AIX. Awaiting a reply, Have a nice day ahead. Thanks and regards, Aditya.