|
|
Classification: |
C++ |
Category: |
Debugging |
Created: |
02/03/2000 |
Modified: |
06/25/2001 |
Number: |
FAQ-0652 |
Platform: |
Not Applicable |
|
Question: I want to know where my function is being called from. How do I get the ARM link register into a C++ variable ?
Answer: Here's a piece of code which does it, using the embedded assembler feature of GCC.
#include #include
RTest test(_L("GETCH"));
GLDEF_C TInt E32Main() { // Must be before any function calls, including C++ constructors TUint32 armLinkRegister; asm("str lr, %0" : : "m" (armLinkRegister));
test.Start(_L("GETCH"));
test.Printf(_L("lr = %X\n"), armLinkRegister);
test.End(); return 0; }
|
|
|