[PATCH] D7895: Anonymous namespaces are missing import DW_TAG_imported_module.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 10:48:55 PDT 2015


On Tue, Aug 18, 2015 at 10:40 AM, Robinson, Paul <
Paul_Robinson at playstation.sony.com> wrote:

> With my copy of Clang, the two parameters have entirely different types.
>
>
>
> DWARF is describing the mapping of source to object. The two parameters
> have different types. They have separate locations. When you're stopped at
> a place where the parameters are in-scope, the location tells you where to
> find them.  There's no ABI knowledge inherent in any of this.
>

Sorry, I'm clearly doing a bad job of explaining the issues here.

When you have this code (foo, bar, and func) and this code:

foo f;
bar b;
int main() {
}

and you break in main and tell your debugger "print func(f, b)" the
debugger needs to know how to setup the call - where to put the parameters.
The debug info does not tell the debugger this directly, the debugger uses
the debug info and the ABI information to establish this.

The location information of the parameters inside func is
insufficient/irrelevant, because it doesn't necessarily describe the
locations of the parameters during the call itself - LLVM's describes the
location after these parameters have been moved into allocas in the
prologue. The types don't directly describe this (because in part it
depends on where they appear in the function parameter list - whether it's
a register, a stack slot, etc) and don't describe their triviality directly
(they merely describe their member functions and the debugger is left to
figure out that that means the parameter has to be indirected)

Note that the foo parameter, owing to its non-trivial copy ctor doesn't get
passed in registers, instead a pointer (to an unnamed local copy in the
callee- invoking the copy ctor and all (by the debugger)) is passed
instead. But for 'bar' the int member is passed directly in a register.


> --paulr
>
>
>
> *From:* David Blaikie [mailto:dblaikie at gmail.com]
> *Sent:* Tuesday, August 18, 2015 10:36 AM
> *To:* Robinson, Paul
> *Cc:* reviews+D7895+public+7827be49c0b04087 at reviews.llvm.org; Romanova,
> Katya; Eric Christopher; Frédéric Riss; Duncan P. N. Exon Smith;
> llvm-commits
> *Subject:* Re: [PATCH] D7895: Anonymous namespaces are missing import
> DW_TAG_imported_module.
>
>
>
>
>
>
>
> On Tue, Aug 18, 2015 at 10:28 AM, Robinson, Paul <
> Paul_Robinson at playstation.sony.com> wrote:
>
> Sorry I wasn't clear - I was referring to the ABI lowering of C++ by value
> parameters.
>
> struct foo { foo(const foo&); int i; };
> struct bar { int i; };
> void func(foo, bar) { }
>
> foo and bar are passed quite differently in the ABI
>
> And the formal parameters are described quite differently in the DWARF,
>
>
> What differences are you referring to? They're described quite the same.
> The only difference in the two parameters is their DW_AT_location, and you
> can't rely on that for the calling convention - it just describes where to
> find the variable once you're past the prologue. In LLVM, that's often
> /just/ the alloca we copy the value into, not the register the parameter
> was passed in.
>
>
>
>
> meaning the debugger doesn't need special knowledge of the ABI to
> interpret the DWARF correctly.  I still don't see how this is relevant to
> the discussion at hand.
>
> --paulr
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150818/45dc7086/attachment.html>


More information about the llvm-commits mailing list