<p dir="ltr"><br>
On Aug 22, 2013 1:21 AM, "DINESH KUMAR DWIVEDI" <<a href="mailto:dinesh.d@samsung.com">dinesh.d@samsung.com</a>> wrote:<br>
><br>
> Hi All,<br>
><br>
> I was looking in to PR14569 [<a href="http://llvm.org/bugs/show_bug.cgi?id=14569">http://llvm.org/bugs/show_bug.cgi?id=14569</a>] and here are my findings.<br>
><br>
> GDB uses following attributes while printing function names, in order.<br>
>      1. Linkage Name, if available, gdb demangles it and use it to print function name.<br>
>      2. Name, if available, gdb uses it as it is without demangling it.<br>
>      3. GDB tries to generage name of the function with other information available.<br>
><br>
> In case of clang, for compiler generated functions, [where HasDecl() is false], only Name attribute is being set in debug info.<br>
><br>
> So to fix bug on clang, we can do following.<br>
><br>
> 1. Do not set both name and linkage_name attributes of just set linkage_name attribute. This makes testcase [gdb.cp/virtfunc.cpp] to pass but causes failures in 2 CodeGenCXX tests [debug-info-global-ctor-dtor.cpp and debug-info-thunk.cpp] which expect name attribute with mangled name of the function. I am also not sure, if other tools also depends on name attributes with mangled anme for compiler generated function.</p>

<p dir="ltr">I assume these two CodeGenCXx test cases are just a matter of history and could probably be changed if we decide that linkage name is the right name to use and to drop the plain name entirely. Existing tests don't always represent the immutable truth of required behavior.</p>

<p dir="ltr">><br>
> 2. Set both name and linkage_name attributes. This makes testcase [gdb.cp/virtfunc.cpp] to pass and does not have any side effect on existing clang/ llvm tests. But this will increase debug info size. I suggest to enable this fix if Full Debug Info option is enabled.</p>

<p dir="ltr">I think we already have some size concerns regarding emitting debug info for these thunks, so I'll ask the standard question:</p>
<p dir="ltr">What does GCC (top of trees or latest release) do here? Both names? Neither? Just linkage?</p>
<p dir="ltr">><br>
> I have attached patch using second approach. Please let me know if this is fine.<br>
><br>
> Regards<br>
> Dinesh Dwivedi<br>
><br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
</p>