Fwd: [Mingw-w64-public] MingW64 doesn't generate line numbers debugging information for lambdas

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This message better belongs here I guess.



-------- 转发的消息 --------
主题: [Mingw-w64-public] MingW64 doesn't generate line numbers debugging
information for lambdas
日期: Tue, 18 Feb 2020 13:44:04 +0300
发件人: Artem Razin <artem.razin@xxxxxxxxx>
回复地址: mingw-w64-public@xxxxxxxxxxxxxxxxxxxxx
收件人: mingw-w64-public@xxxxxxxxxxxxxxxxxxxxx

Hi,

I hope this is the right place to ask about DWARF and mingw64.

First of all, here the version I use:

g++.EXE (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I've developed a debugger (Deleaker, a memory profiler for Windows)
that supports range of debugging information formats, including DWARF.
Recently I've experienced strange thing: mingw64 doesn't emit
information about line numbers for lambdas.

Here what I compiled:

void CallLambda(void (*lambda)());

int main()
{
    for (int i = 0; i < 10000; i++)
        CallLambda([]()-> void        // <-- line #27
        {
            CallLambda([]()-> void
            {
                new int;
                new int;
            });
        });

    return 0;
}

void CallLambda(void (*lambda)())
{
    lambda(); // <-- line #138
}

My debugger hooks calls of operator new and saves call stacks. Later
entries are resolved.

Here the call stack:

libstdc++-6.dll!Znwy + 0x17 bytes 000000006fd07287
main.exe!0000000000401571 (for another new int here the address
main.exe!000000000040157b)
main.exe!0000000000401594
main.exe!_Z10CallLambdaPFvvE Line 138 + 0x10 bytes 00000000004019f8
main.exe!00000000004015cd
main.exe!00000000004015e6
main.exe!_Z10CallLambdaPFvvE Line 138 + 0x10 bytes 00000000004019f8
main.exe!main Line 25 + 0x2c bytes 000000000040162f

I dumped the DWARF debugging information and found the only place that
corresponds to both addresses 0x401571 and 0x40157b:

< 4><0x00005b48>          DW_TAG_structure_type
                            DW_AT_name                  <lambda()>
                            DW_AT_decl_file             0x00000001
I:/Projects/deleaker/branches/branch_2020_02_10_leak_in_lambda/deleaker2/TestProjects/MingwTest/main.cpp
                            DW_AT_decl_line             0x0000001b
...
< 5><0x00005b6e>            DW_TAG_subprogram
...
                              DW_AT_low_pc                0x00401560
                              DW_AT_high_pc
<offset-from-lowpc>39

Here the entire output:
https://gist.github.com/ArtemRazin/515f81d5825608b87fbceaee89d81503

So it seems that the information is not enough to locate line numbers
for 0x401571 and 0x40157b: parent node DW_TAG_structure_type contains
DW_AT_decl_line = 0x0000001b = 27.

I believe I missed something.

Thank you!

-- 
Best regards,
Artem A. Razin


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux