RE: How do I patch my binary

Marc Khouzam
2010-11-24T15:01:14Z

> -----Original Message-----
> From: gdb-owner@sourceware.org
> [mailto:gdb-owner@sourceware.org] On Behalf Of Baurzhan Ismagulov
> Sent: Tuesday, November 23, 2010 4:50 PM
> To: gdb@sourceware.org
> Subject: Re: How do I patch my binary
>
> On Tue, Nov 23, 2010 at 04:31:22PM -0500, Marc Khouzam wrote:
> > My hope was that I could modify the source code (outside of
> GDB), recompile
> > the binary and have GDB load and use the new binary,
> without having to restart
> > the program. I couldn't get this to work (using 'set write
> on' and reloading
> > the new binary).
>
> I don't think you can.
>
> Which platform?

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

Thanks

Marc