Re: How do I patch my binary

Baurzhan Ismagulov
2010-11-24T15:15:32Z

On Wed, Nov 24, 2010 at 10:00:39AM -0500, Marc Khouzam wrote:
> Linux x86.
>
> I'm trying to do with C/C++ the hot-swap that Java allows.
>
> So, if GDB can't do it on its own, can we involve the compiler/linker
> to make this happen? Is there more complexity with C/C++ than with Java?
>
> The section below of the doc talks about patching, but doesn't describe
> a way to actually do it :-)
> http://sourceware.org/gdb/current/onlinedocs/gdb/Patching.html#Patching

I'm not an expert at that. I've tried set write on, then p *(unsigned
long *)0x8049a5c = 0x4e5f068 -- this does change the value, albeit x/2x
0x08049a57 issued after that shows a bit different value.

If you share the motivation and the details about the extent of the
modifications you want to make, perhaps someone could suggest another
way to do that.

With kind regards,
--
Baurzhan Ismagulov