[llvm-dev] Dwarf - 5 features in clang and llvm

Ron Brender via llvm-dev llvm-dev at lists.llvm.org
Wed Sep 11 07:33:12 PDT 2019


>The 'func()' gets inlined, so according to the DWARF standard the call-site debug info >should not be created for calls to inlined functions.

While it is true that DW_TAG_call_site is not appropriate for an inlined 
call, it is worth noting that the occurrence of inlined code should 
(can) be described by DW_TAG_inlined_subroutine (see section 3.3 and 
especially 3.3.8.2 Concrete Instances of the DWARF V5 standard). It is 
the intent of the standard that when stopped at code in an inlined 
function that a debugger be able to provide a more-or-less "normal" call 
stack traceback reflecting the logical presence of the call. Assuming 
the compiler has provided a full description, of course. (If the call is 
completely optimized away then there is nothing to describe so neither 
DW_TAG_call_site nor DW_TAG_inlined_subroutine is appropriate.)

Ron Brender, Editor
DWARF Standard Committee

On 9/11/2019 7:46 AM, Djordje Todorovic via llvm-dev wrote:
> Hi Sourabh,
>
>> #include <iostream>
>> int func(int* ptr){
>>          std::cout << *ptr;
>>          return *ptr + 5;
>> }
>> int main(int argc, char** argv){
>>          int a = 4;
>>          int* ptr_a = &a;
>>          int b = func(ptr_a);
>>          return 0;
>> }
> The 'func()' gets inlined, so according to the DWARF standard the call-site debug info should not be created for calls to inlined functions.
>
>> @Djorde DW_TAG_call_site are supported using late MIR approach, are the new Call Site related development will be supported via MIR. or their will be a frontend level debug metadata support will be added.
> The new work is also implemented on the MIR level.
>
> Best,
> Djordje
>
> On 11.9.19. 13:07, Sourabh Singh Tomar wrote:
>> Hello Djordje, Vedant,
>>
>> Thanks a lot for sharing information.
>>
>> I have a doubt, please consider the following simple test case-
>> #include <iostream>
>> int func(int* ptr){
>>          std::cout << *ptr;
>>          return *ptr + 5;
>> }
>> int main(int argc, char** argv){
>>          int a = 4;
>>          int* ptr_a = &a;
>>          int b = func(ptr_a);
>>          return 0;
>> }
>> commandline used --
>> bash$ clang++ -Xclang -femit-debug-entry-values -O2 -ggdb test.cpp
>>
>> For this case-- these Tags are not emitted
>> DW_TAG_call_site, DW_TAG_call_site_paramter ..
>> only DW_AT_GNU_all_call_sites attribute is present.
>>
>> + @Djorde DW_TAG_call_site are supported using late MIR approach, are the new Call Site related development will be supported via MIR. or their will be a frontend level debug metadata support will be added.
>>
>> Thanks!
>> Sourabh.
>>
>>
>>
>> On Wed, Sep 11, 2019 at 12:02 PM Djordje Todorovic <djordje.todorovic at rt-rk.com <mailto:djordje.todorovic at rt-rk.com>> wrote:
>>
>>      Great to see this! :)
>>
>>      Best,
>>      Djordje
>>
>>      On 10.9.19. 21:16, Vedant Kumar wrote:
>>      >
>>      >
>>      >> On Sep 10, 2019, at 6:15 AM, Djordje Todorovic via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> <mailto:llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>>> wrote:
>>      >>
>>      >> Hi Sourabh,
>>      >>
>>      >> Support for call-site related DWARF 5 tag/attributes is implemented very late, in the LLVM middle-end.
>>      >> Please note that there is also the IR-level flag (DIFlagAllCallsDescribed) that lowers to
>>      >> the DW_AT_call_all_calls.
>>      >>
>>      >> There is also support for call-site-parameter (DW_TAG_call_site_parameter) and the debug entry values
>>      >> (DW_OP_entry_value) related DWARF 5 symbols, but it is restricted by the CC1 option ‘-femit-debug-entry-values’,
>>      >> since the LLDB is still missing support for that.
>>      >
>>      > Not for too long ;)
>>      >
>>      > See https://reviews.llvm.org/D67410 & https://reviews.llvm.org/D67376
>>      >
>>      > best,
>>      > vedant
>>      >
>>      >>
>>      >> Best regards,
>>      >> Djordje
>>      >>
>>      >> On 10.9.19. 13:58, Sourabh Singh Tomar via llvm-dev wrote:
>>      >>> Hello All,
>>      >>>
>>      >>> I was working on some dwarf-5 features and debugging optimized code support in clang and llvm.
>>      >>>
>>      >>> Noticed that, DW_TAG_call_site is supported in llvm middle-end. but clang is not emitting these.
>>      >>>
>>      >>> I was hoping, if someone could provide current status of these features and current status of dwarf-5 features in clang and llvm.
>>      >>> That will be immensely helpful.
>>      >>>
>>      >>> Thanks!
>>      >>> Sourabh.
>>      >>>
>>      >>> _______________________________________________
>>      >>> LLVM Developers mailing list
>>      >>> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> <mailto:llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>>
>>      >>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>      >>>
>>      >> _______________________________________________
>>      >> LLVM Developers mailing list
>>      >> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> <mailto:llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>>
>>      >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>      >
>>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


-- 
--
Ron Brender
Whose favorite airplane is N6119A, a 1979 Cessna T210.



More information about the llvm-dev mailing list