I was messing around with SoftwarePassport and Amit Singh’s tiny executable to find out why gdb doesn’t breakpoint in those two executables. I thought it was due to incomplete headers, but gdb can’t also breakpoint into nicertiny, which has the segment/section added (otool/otx SoftwarePassport problems can be fixed by manually adding the missing section – there is enough padding space in the header to do that so its developers might want to fix that :-)).
Anyway, I decided to use the int3 trick to see if gdb was able to breakpoint and it worked. But then I wanted to manually fix the code – restore the original byte and point EIP to the correct address – and gdb didn’t allowed me. You get a “Value being assigned to is no longer active.” error message. Web searching for the problem, and there is a small patch at https://bugzilla.redhat.com/attachment.cgi?id=313103&action=diff. I tried it and it works! The problem isn’t exclusive with these two binaries but happens if you stop at the beginning of a function and gdb is missing stack frame information. So it’s a very useful fix 🙂
I have also included in this patch the fix for LIBICONV problem, as described here. If you don’t want to compile gdb yourself, I’m including the (fat) binary, compiled in Snow Leopard, 32/64 bits.