This is the mail archive of the
mailing list for the GCC project.
Re: mfentry example
- From: Andrew Haley <aph at redhat dot com>
- To: Niklaus <niklaus at gmail dot com>, gcc-help at gcc dot gnu dot org
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 16 Feb 2015 09:52:48 +0000
- Subject: Re: mfentry example
- Authentication-results: sourceware.org; auth=none
- References: <CAN+y=1FxaeqsD6YLLO7oQpsL4KsDqUuiwcky=2BuTAq8F2kM4A at mail dot gmail dot com>
- Reply-to: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
[off-topic for gcc; redirect to gcc-help]
On 15/02/15 22:00, Niklaus wrote:
> I'm trying to do a live update of a function without killing or
> stopping the program. This is a single threaded application which runs
> something similar to the below code. Maximum time is spent in the
> while(1) loop.
> What i want to do is compile with gcc-4.8 with -pg and -mfentry and
> then call function g() and then do the int y=x*3 and everything else.
> I have thought of an idea about registering a sigHandler and then
> setjmp/longjmp to g.. Please note i'm trying to fix some bugs here
> without stopping the process.
> I want to do something akin to Kgraft/Kpatch or Erlang's dynamic
> updation system.
> Can you please help me by throwing some light on this .
OK, I'll bite. You want to be able to break out of a function while
it is running and return to some other function. There's no portable
way to do that is general. However, there are things which are easy,
such as calling the loop body via a function pointer.