Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
21 years ago

Help! trace back utility for NiOS

Hi:

Can someone please let me know whether there is a traceback utility in NiOS? I want to print the function call

trace in run-time, just like gdb but without using NiOS console. I want this function call trace to be printed on

my UART? Is there an existing function that i can call to print the stack trace or if anyone has a handy piece of

code, can you please share.

Also, if interrupts are enabled will it also print the ISR routine and the execution path during which the

interrupt happened?

BTW, there is no operating system in the system i use and its my own micro kernel, while loop checking for

events that happens during interrupt context and processing them.

Thanks and Regards,

Balaji

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If you have compiled with a frame pointer then you may be able to build your own on top of the GCC function __builtin_return_address.

    This probably won't be able to trace back through interrupts as they use a different format of stack frame.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your reply, can you please let me know if there is an example code around? And what is the compiler option

    to enable frame pointer, i'm not optimising the code, will not framepointer be already there?

    Thanks and Regards,

    Balaji
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Sorry, no example designs for this.

    See the GCC documentation for details of how to enable the frame pointer. I think it's something like -fno-omit-frame-pointer but I probably spelt that wrong.