http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56846

--- Comment #2 from npl at chello dot at ---
I cant easily make a simple reproducible testcase as this is a custom realtime
OS for a very specific CPU. And I can only test this example next week at work
where I have hardware to run it.

And I certainly wasnt talking about debugging with gdb (which uses some rather
advanced heuristics AFAIK), but the library funtions within libgcc (unwind.h
header). I reworked your example to show the issue: 

#include <unwind.h>
#include <iostream>

_Unwind_Reason_Code trace_func(struct _Unwind_Context * context, void* arg)
{
  void *ip = (void *)_Unwind_GetIP(context);
  /* I have a check here to test if the ip is the same as last time, else this
would be called endlessly */
  std::cout << "Address: " << ip << std::endl;
  return _URC_NO_REASON;
}


void bar()
{
        std::cout << "This is in bar" << std::endl;
        _Unwind_Backtrace((_Unwind_Trace_Fn)&trace_func, nullptr);
}

void foo() noexcept
{
        bar();
}

int main()
{
        foo();  
        return 0;
}

Reply via email to