Changing the EAX register with Python

Dan Stromberg drsalists at
Thu Nov 18 23:33:12 CET 2010

Here's -a- way to try - not necessarily the best way:
1) Write a little gcc .c with inline assembler, to make your EAX change
2) Call it from CPython using ctypes

However, by the time you return from the code that makes your change and
resume execution in the CPython interpreter, EAX may well have been changed
to something new.  Accumulators don't often hold the same value for very

On Thu, Nov 18, 2010 at 12:20 PM, dutche <dutche at> wrote:

> Hi folks, I have a unusual question here.
> How can I change the value of EAX register under python under Linux??
> As paimei does under Windows.
> My project is to have a python program that loads a C program and sets
> a breakpoint at some address, and then with this breakpoint I change
> the EAX register and then continue the program execution.
> With Windows and paimei I did that, but under Linux I don't know yet.
> Any ideas?
> Thank you
> --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list