<div dir="ltr"><div>Hi all,</div><div><br></div><div><br>Since yesterday, dwarf4 debug format support is included in dbghelp.<br><br>background<br>----------<br>Wine has been using dwarf2 for years, and hasn't updated to dwarf4 (gcc and most of distros switched more than 10 years ago).<br>As distros have been switching to dwarf5 for 6 months to a year now, it's time to be back on track.<br><br>status<br>------<br>As of today, support for reading and managing dwarf4 debug info is included in dbghelp (as well as dwarf2 and dwarf3).<br>However, by default Wine is still compiled with dwarf2.<br><br>need for help<br>-------------<br>Before enabling dwa, feedback is requested on dwarf4.<br>How can you help:<br>Setup the dwarf4 debug format for wine compilation using:<br>> ./configure CFLAGS="-gdwarf-4 -O2" CROSSCFLAGS="-gdwarf-4 -O2"<br>> make -B<br><br>We need to configure both gcc for ELF compilation, and the cross compiler (hence the two options to configure).<br>And we need to recompile everything.<br><br>improvements<br>------------<br><br>Here's a typical debugging session (compiled with dwarf2):<br><br>[eric:~/work/output-wine/wine64]$ ./wine programs/winedbg/<a href="http://winedbg.exe.so">winedbg.exe.so</a> notepad<br>WineDbg starting on pid 0100<br>RtlDefaultNpAcl () at Z:\home\eric\work\wine\dlls\ntdll\sec.c:1731<br>0x000000007bc50679 RtlDefaultNpAcl+0x2b9 [Z:\home\eric\work\wine\dlls\ntdll\sec.c:1731] in ntdll: ret<br>1731    }<br>Wine-dbg>b CreateWindowExW<br>Breakpoint 1 at 0x000000006eb91448 CreateWindowExW [Z:\home\eric\work\wine\dlls\user32\win.c:1913] in user32<br>Wine-dbg>c<br>Stopped on breakpoint 1 at 0x000000006eb91448 CreateWindowExW [Z:\home\eric\work\wine\dlls\user32\win.c:1913] in user32<br>CreateWindowExW () at Z:\home\eric\work\wine\dlls\user32\win.c:1913<br>1913    {<br>Wine-dbg>bt<br>Backtrace:<br>=>0 0x000000006eb91448 CreateWindowExW(exStyle=<is not available>, className=<is not available>, windowName=<is not available>, style=<is not available>, x=<is not available>, y=<is not available>, width=<is not available>, height=<is not available>, parent=<is not available>, menu=<is not available>, instance=<is no<br>t available>, data=<is not available>) [Z:\home\eric\work\wine\dlls\user32\win.c:1913] in user32 (0x0000000000000559)<br>  1 0x0000000000405008 WinMain+0x3a7(hInstance=0x400000, prev=<is not available>, cmdline=<is not available>, show=0x1) [Z:\home\eric\work\wine\programs\notepad\main.c:792] in notepad (0x0000000000000559)<br>  2 0x0000000000406326 main+0xa5(argc=<is not available>, argv=<is not available>) [Z:\home\eric\work\wine\dlls\msvcrt\crt_winmain.c:53] in notepad (0x0000000000000000)<br>  3 0x0000000000406155 mainCRTStartup+0x64() [Z:\home\eric\work\wine\dlls\msvcrt\crt_main.c:58] in notepad (0x0000000000000000)<br>  4 0x000000007b62c679 BaseThreadInitThunk+0x8(unknown=<is not available>, entry=<is not available>, arg=<is not available>) [Z:\home\eric\work\wine\dlls\kernel32\thread.c:61] in kernel32 (0x0000000000000000)<br>  5 0x000000007bc56c73 RtlUserThreadStart+0x82(entry=0x4060f0, arg=0x3f0000) [Z:\home\eric\work\wine\dlls\ntdll\thread.c:241] in ntdll (0x0000000000000000)<br>Wine-dbg><br><br>Note that most of variables in stack trace are not useful.<br><br>With Wine recompiled with dwarf 4 support, you get:<br>[eric:~/work/output-wine/winedw4-64]$ ./wine programs/winedbg/<a href="http://winedbg.exe.so">winedbg.exe.so</a> notepad<br>WineDbg starting on pid 0104<br>0100:fixme:dbghelp_dwarf:compute_location Only supporting one breg (rcx/330 -> r14/342)<br>RtlDefaultNpAcl () at Z:\home\eric\work\wine\dlls\ntdll\sec.c:1731<br>0x000000007bc50679 RtlDefaultNpAcl+0x2b9 [Z:\home\eric\work\wine\dlls\ntdll\sec.c:1731] in ntdll: ret<br>1731    }<br>Wine-dbg>b CreateWindowExW<br>0100:fixme:dbghelp_dwarf:dwarf2_read_range no entry found<br>0100:fixme:dbghelp_dwarf:dwarf2_read_range no entry found<br>0100:fixme:dbghelp_dwarf:compute_location Only supporting one breg (r8/336 -> r10/338)<br>0100:fixme:dbghelp_dwarf:compute_location Only supporting one breg (rdx/331 -> rcx/330)<br>0100:fixme:dbghelp_dwarf:compute_location Only supporting one breg (r10/338 -> r8/336)<br>0100:fixme:dbghelp_dwarf:compute_location Only supporting one breg (rbx/329 -> r12/340)<br>0100:fixme:dbghelp_dwarf:dwarf2_read_range no entry found<br>Breakpoint 1 at 0x000000006eb91448 CreateWindowExW [Z:\home\eric\work\wine\dlls\user32\win.c:1913] in user32<br>Wine-dbg>c<br>Stopped on breakpoint 1 at 0x000000006eb91448 CreateWindowExW [Z:\home\eric\work\wine\dlls\user32\win.c:1913] in user32<br>CreateWindowExW () at Z:\home\eric\work\wine\dlls\user32\win.c:1913<br>1913    {<br>Wine-dbg>bt<br>Backtrace:<br>=>0 0x000000006eb91448 CreateWindowExW(exStyle=0, className="Notepad", windowName="Notepad", style=0xcf0000, x=0x1, y=0x25, width=0x558, height=0x402, parent=(nil), menu=(nil), instance=0x400000, data=0x0(nil)) [Z:\home\eric\work\wine\dlls\user32\win.c:1913] in user32 (0x0000000000000559)<br>  1 0x0000000000405008 WinMain+0x3a7(hInstance=0x400000, prev=<is not available>, cmdline=<is not available>, show=0x1) [Z:\home\eric\work\wine\programs\notepad\main.c:792] in notepad (0x0000000000000559)<br>  2 0x0000000000406326 main+0xa5(argc=<is not available>, argv=<is not available>) [Z:\home\eric\work\wine\dlls\msvcrt\crt_winmain.c:53] in notepad (0x0000000000000000)<br>  3 0x0000000000406155 mainCRTStartup+0x64() [Z:\home\eric\work\wine\dlls\msvcrt\crt_main.c:58] in notepad (0x0000000000000000)<br>  4 0x000000007b62c679 BaseThreadInitThunk+0x8(unknown=<is not available>, entry=<is not available>, arg=<is not available>) [Z:\home\eric\work\wine\dlls\kernel32\thread.c:61] in kernel32 (0x0000000000000000)<br>  5 0x000000007bc56c73 RtlUserThreadStart+0x82(entry=0x4060f0, arg=0x3f0000) [Z:\home\eric\work\wine\dlls\ntdll\thread.c:241] in ntdll (0x0000000000000000)<br>Wine-dbg><br><br>and a much nicer backtrace regarding parameters.<br><br>When using winedbg's gdb proxy mode:<br>- same lack of values on parameters/local variables in dwarf-2<br>- provides (in this example) the same information as winedbg<br></div><div><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">-- <br>Eric Pouech</div></div></div>