[Dwarf-Discuss] OpenMP back-traces

Todd Allen todd.allen at ccur.com
Tue Jan 6 10:05:26 PST 2009

On Tue, Jan 06, 2009 at 10:54:31AM -0500, Andrew Cagney wrote:
> Hi,
> I've been looking at OpenMP and it appears to have a backtrace
> challenge similar to that of nested functions - conceptually the
> OpenMP threads result in a stack tree vis:
> <inner>
>     1          2
>     1          2
>      \          /
>       \       /
>          M
>          M
> <outer>
> Worker thread's 1 and 2 include closure information that let them
> refer to variables on the Main thread's stack.  This is typically
> implemented as disjoint threads vis:
>     M    1    2
>     M    1    2
>      *    *    *
>      *    *    *
> ("*" represents system stack information) and each thread contains
> some sort of thread chain pointer.  In such an implementation, the
> backtrace for thread 1 or 2 would include system frames and not the
> Main's stack as the user expects.  Has any one explored ways to
> describe the stack tree?  Perhaps something similar to
> DW_AT_static_link?

This is an issue for Ada, because Ada tasks have visibility to their containing
constructs, which could be other subprograms, tasks, etc.  As for visiblity into
objects of those containing constructs, we use a DW_AT_static_link, just like we
would for a nested subprogram.

As for walkback support, because we have our own runtime system to create the
tasks and that runtime never would return (it would do system calls to update
anything waiting on the task and then _exit), we were able to fudge the return
address of the runtime routine to point to the place that created the nested

Todd Allen
Concurrent Computer Corporation

More information about the Dwarf-Discuss mailing list