[PATCH] Fix for debug info for thunks using mangled name (PR14569)

Dinesh Dwivedi dinesh.d at samsung.com
Fri Aug 23 04:34:01 PDT 2013


Hi David,

GCC does not generate name or linkage_name attribute in such cases. I have not gone through gcc source code but I have check virtfunc.exp with gcc 4.7.3 and 4.8.1 [latest release] and did not find any entry for name or linkage_name attribute for virtual/ non virtual thunk.

I am attaching patch [removed both name and linkage name attributes and updated clang tests]. Please have a look.

Regards
Dinesh Dwivedi

------- Original Message -------
Sender : David Blaikie<dblaikie at gmail.com>
Date : Aug 22, 2013 18:39 (GMT+05:30)
Title : Re: [PATCH] Fix for debug info for thunks using mangled name (PR14569)


On Aug 22, 2013 1:21 AM, "DINESH KUMAR DWIVEDI" <dinesh.d at samsung.com> wrote:
>
> Hi All,
>
> I was looking in to PR14569 [http://llvm.org/bugs/show_bug.cgi?id=14569] and here are my findings.
>
> GDB uses following attributes while printing function names, in order.
>      1. Linkage Name, if available, gdb demangles it and use it to print function name.
>      2. Name, if available, gdb uses it as it is without demangling it.
>      3. GDB tries to generage name of the function with other information available.
>
> In case of clang, for compiler generated functions, [where HasDecl() is false], only Name attribute is being set in debug info.
>
> So to fix bug on clang, we can do following.
>
> 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.
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.
>
> 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.
I think we already have some size concerns regarding emitting debug info for these thunks, so I'll ask the standard question:
What does GCC (top of trees or latest release) do here? Both names? Neither? Just linkage?
>
> I have attached patch using second approach. Please let me know if this is fine.
>
> Regards
> Dinesh Dwivedi
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-PR14569_fix_by_removing_name_attribute.patch
Type: application/octet-stream
Size: 6944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130823/9e597a9f/attachment.obj>


More information about the cfe-commits mailing list