[PATCH] Fix line numbers for code inlined from __nodebug__ functions.

Evgeniy Stepanov eugenis at google.com
Tue Jun 3 01:30:20 PDT 2014


On Mon, Jun 2, 2014 at 10:16 PM, David Blaikie <dblaikie at gmail.com> wrote:
> On Mon, Jun 2, 2014 at 11:02 AM, Evgeniy Stepanov <eugenis at google.com> wrote:
>> On Mon, Jun 2, 2014 at 9:51 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>> What's the user experience today that this is fixing? Is this any different/worse than a whole (non-inlined) function having no line information?
>>
>> Imagine a function with several dozen of SSE intrinsic calls (via
>> _mm_* wrappers). They all get inlined, and none of them has line
>> information.
>>
>> If no code is moved around, they look like they all belong to the
>> nearest line above that has line information. Any code that was moved
>> around (ex. due to being a target of a cold branch), they get
>> essentially random line info.
>>
>> With sanitizers, there is a lot of code motion (all error reports are
>> cold code). As a result, any sanitizer reports on sse intrinsics point
>> to random lines (luckily, inside the same function). Extremely
>> confusing.
>
> Fair enough - why are these intrinsics marked with __nodebug__?
>
>>
>>>
>>> Any idea what GCC does here?
>
> Still curious about this /\

GCC has attribute((__artificial__)) instead of __nodebug__, which,
according to the docs,

This attribute is useful for small inline wrappers that if possible
should appear during debugging as a unit. Depending on the debug info
format it either means marking the function as artificial or using the
caller location for all instructions within the inlined body.

It does not seem to do anything for me with gcc-4.8.2 and gdb-7.7. I
see _mm_* as normal inlined functions, gdb steps into them and,
generally, treats them as normal function calls.

Clang, on the same source, completely dissolves _mm_* functuion body
in the caller, but breaks line numbers. With this patch, everything
works as expected.



More information about the llvm-commits mailing list