Debug information for outlined routine

Hi all,

I would like to know how can I express debug information for an outlined function using llvm debug metadata.

I mean I have a function f() and part of its code is outlined in a new function g() . I would like to generate llvm debug metadata so that when stepping in g() the debugger step in original sources lines from f() routine ?

Thanks for your help

Seb

Hi all,

I would like to know how can I express debug information for an outlined
function using llvm debug metadata.

I mean I have a function f() and part of its code is outlined in a new
function g() . I would like to generate llvm debug metadata so that when
stepping in g() the debugger step in original sources lines from f()
routine ?

Given that LLVM has no current support for outlining I don't think we've
addressed the issue of how to represent that in LLVM's IR metadata (indeed
I don't even know off-hand how DWARF handles this).

Hi David,

Thanks for the quick reply. I guess the problem can become even more complex when more than one routine are outlined from original routine.

In general most OpenMP implementations performs outlining for parallel region. So it is likely that current implementation in LLVM doesn’t support debugging ?

Seb

From: "David Blaikie" <dblaikie@gmail.com>
To: "sebastien deldon (PGI)" <sebastien.deldon@pgroup.com>, "Eric Christopher" <echristo@gmail.com>
Cc: "llvmdev" <llvmdev@cs.uiuc.edu>
Sent: Monday, January 27, 2014 10:12:27 AM
Subject: Re: [LLVMdev] Debug information for outlined routine

Hi all,

I would like to know how can I express debug information for an
outlined function using llvm debug metadata.

I mean I have a function f() and part of its code is outlined in a
new function g() . I would like to generate llvm debug metadata so
that when stepping in g() the debugger step in original sources
lines from f() routine ?

Given that LLVM has no current support for outlining I don't think
we've addressed the issue of how to represent that in LLVM's IR
metadata (indeed I don't even know off-hand how DWARF handles this).

How do we do this for C++ lambdas and friends?

-Hal

> Given that LLVM has no current support for outlining I don't think
> we've addressed the issue of how to represent that in LLVM's IR
> metadata (indeed I don't even know off-hand how DWARF handles this).
>
>
>

How do we do this for C++ lambdas and friends?

Given that lambdas are separate functions (standard "operator()" member
functions of some unnameable type (but we have a name for the purposes of
mangling and debugging ("<lambda:foo.cpp:32>" or something like that, if I
recall correctly))) and the lines of that function just happen to be nested
within the lines of some other function (but debug info doesn't really care
that the outer function has a non-contiguous range of lines anymore than if
you had a bunch of blank lines in your function)

So we can't really draw analogy from there to help with outlining, I don't
think.

Yes I agree with David, I don’t think we can draw analogy between lambda and outlined routines.

Seb

Speaking solely about the DWARF part of the question, DWARF has no explicit outlining support. If I had to do this, and the outlining process can be modeled reasonably as replacing a chunk of source text in the original function with a call, then I’d mark the outlined function as artificial and use the original source lines as the source location for the code in the outlined function. My guess is that would be least likely to confuse a debugger. (It might confuse the user though, if you’re stepping through the caller and your step command defaults to step-over.)

I’ve never looked at OpenMP, can’t speak to that at all.

–paulr

Speaking solely about the DWARF part of the question, DWARF has no explicit
outlining support. If I had to do this, and the outlining process can be
modeled reasonably as replacing a chunk of source text in the original
function with a call, then I’d mark the outlined function as artificial and
use the original source lines as the source location for the code in the
outlined function. My guess is that would be least likely to confuse a
debugger. (It might confuse the user though, if you’re stepping through the
caller and your step command defaults to step-over.)

Again more in the "the debugger should possibly notice this case", but
in general I agree. General outlining could be done via an extension
mechanism since you may want to outline a loop out of multiple
functions for some code uniquing, but you'd probably want to piggy
back on the call site information to make the final determination for
line/etc to show in that case.

*shrug* Commoning of code makes debug info precision hard.

-eric