I do not have extensive experience with gdb, so I am not sure if what I am asking is even possible, but is it possible to edit the code live with gdb?
When running (after hitting a breakpoint), the disas looks like so:
0x080487d8 <+9>: movl $0x80485e4,0x1c(%esp)
0x080487e0 <+17>: movl $0x8048640,0x20(%esp)
0x080487e8 <+25>: movl $0x804869c,0x24(%esp)
0x080487f0 <+33>: movl $0x8048719,0x28(%esp)
In an attempt to change the address in one of those instructions, I did this:
set (*0x080487e1)=0x5b870408
But instead of simply changing the address as I expected, the new disas looked like this:
0x080487d8 <+9>: movl $0x80485e4,0x1c(%esp)
0x080487e0 <+17>: (bad)
0x080487e1 <+18>: or %al,(%edi,%eax,4)
0x080487e4 <+21>: pop %ebx
0x080487e5 <+22>: xchg %al,(%eax,%ecx,1)
0x080487e8 <+25>: movl $0x804869c,0x24(%esp)
0x080487f0 <+33>: movl $0x8048719,0x28(%esp)
So I have 3 questions: Is what I am trying to do possible? If so, am I doing something wrong? If so, what am I doing wrong and how can I fix it?