Forum: ARM programming with GCC/GNU tools Display registers value - ARM assembly

von Ab A. (abanel88)

Rate this post
not useful
Hi there,
I was wondering If anyone can help me with this. I want to print or 
write to a file and save the values of the registers running a simple 
Hello world program for example. Can somebody guide me what I need to 
know so I can do that? Or print to the monitor the values for example of 
the R0-R4?
Any help or thoughts? Can I do this combining C or C++?

Many thanks!!

von M.K. B. (mkbit)

Rate this post
not useful
You should explain what you want to achieve with your dump of the 
registers. Maybe you try to achieve something else where a different 
approach is more suitable.

Since you are talking about C, C++ the registers are assigned by the 
compiler  so each little change in the code or compiler settings might 
lead to the same data being stored in a different register. Only by 
writing assembler you can control directly which register you use.

Basically you can dump the registers using a debugger by single stepping 
through the assembler instructions and copy the current register value. 
Keep in mind that a simple looking prinft/cout contains lots of 
assembler instructions which might use your registers.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.