From Fedora Project Wiki
(Initial version)
 
 
Line 1: Line 1:
{{admon/important | Comments and Explanations | The page source contains comments providing guidance to fill out each section. They are invisible when viewing this page. To read it, choose the "view source" link.<br/> '''Copy the source to a ''new page'' before making changes!  DO NOT EDIT THIS TEMPLATE FOR YOUR CHANGE PROPOSAL.'''}}
+
= MinGW MiniDebugInfo =
 
 
<!-- Self Contained or System Wide Change Proposal?
 
Use this guide to determine to which category your proposed change belongs to.
 
 
 
Self Contained Changes are:
 
* changes to isolated/leaf package without the impact on other packages/rest of the distribution
 
* limited scope changes without the impact on other packages/rest of the distribution
 
* coordinated effort within SIG with limited impact outside SIG functional area, accepted by the SIG
 
 
 
System Wide Changes are:
 
* changes that does not fit Self Contained Changes category touching
 
* changes that require coordination within the distribution (for example mass rebuilds, release engineering or other teams effort etc.)
 
* changing system defaults
 
 
 
For Self Contained Changes, sections marked as "REQUIRED FOR SYSTEM WIDE CHANGES" are OPTIONAL but FESCo/Wrangler can request more details (especially in case the change proposal category is
 
improper or updated to System Wide category). For System Wide Changes all fields on this form are required for FESCo acceptance (when applies). 
 
 
 
We request that you maintain the same order of sections so that all of the change proposal pages are uniform.
 
-->
 
 
 
<!-- The actual name of your proposed change page should look something like: Changes/Your_Change_Proposal_Name.  This keeps all change proposals in the same namespace -->
 
 
 
<!-- The actual name of your proposed change page should look something like: Changes/Your_Change_Proposal_Name.  This keeps all change proposals in the same namespace -->
 
= Change Proposal Name <!-- The name of your change proposal --> =
 
  
 
== Summary ==
 
== Summary ==

Latest revision as of 09:40, 30 August 2017

MinGW MiniDebugInfo

Summary

Analogously to the MiniDebugInfo change for native packages, install minimal debuginfos by default also for MinGW packages.

Owner

  • Name: Sandro Mani
  • Email: <manisandro@gmail.com>
  • Release notes owner:

Current status

  • Targeted release: Fedora 28
  • Last updated: 2017-08-30
  • Tracker bug: <will be assigned by the Wrangler>

Detailed Description

Currently the debuginfo data of MinGW binaries is completely stripped from the binary and placed in the respective .debuginfo file. This change proposes keeping the PE symbols in the binary, similarly to what was done for native binaries.

The change basically involves changing mingw-find-debuginfo.sh as follows:

diff --git a/mingw-filesystem/mingw-find-debuginfo.sh b/mingw-filesystem/mingw-find-debuginfo.sh
index de6dee1..261385f 100755
--- a/mingw-filesystem/mingw-find-debuginfo.sh
+++ b/mingw-filesystem/mingw-find-debuginfo.sh
@@ -25,7 +25,10 @@ do
        echo extracting debug info from $f
        mingw-objcopy --only-keep-debug $f $f.debug || :
        pushd `dirname $f`
-       mingw-objcopy --add-gnu-debuglink=`basename $f.debug` --strip-unneeded `basename $f` || :
+       keep_symbols=`mktemp`
+  mingw-nm $f.debug --format=sysv --defined-only | awk -F \| '{ if ($4 ~ "Function") print $1 }' | sort > "$keep_symbols"
+       mingw-objcopy --add-gnu-debuglink=`basename $f.debug` --strip-unneeded `basename $f` --keep-symbols="$keep_symbols" || :
+       rm -f "$keep_symbols"
        popd
 done

A test with some packages in this COPR repo shows that the price is a size increase of in average 17%:

Binary Stripped size Size with symbols Relative size change
libgio-2.0-0.dll 1412 1656 117.28%
libglib-2.0-0.dll 1092 1184 108.42%
libgmodule-2.0-0.dll 28 32 114.29%
libgobject-2.0-0.dll 312 352 112.82%
libgiomm-2.4-1.dll 1284 1732 134.89%
libglibmm-2.4-1.dll 432 588 136.11%
Qt5Concurrent.dll 36 44 122.22%
Qt5Core.dll 4884 5508 112.78%
Qt5DBus.dll 548 652 118.99%
Qt5Gui.dll 4408 5208 118.15%
Qt5Network.dll 1568 1892 120.66%
Qt5OpenGL.dll 328 404 123.17%
Qt5PrintSupport.dll 376 448 119.15%
Qt5Sql.dll 268 312 116.42%
Qt5Test.dll 252 284 112.70%
Qt5Widgets.dll 5716 6768 118.40%
Qt5Xml.dll 216 268 124.07%


Benefit to Fedora

Make it easier to debug Windows applications cross-compiled from Fedora, in particular: - A convenient way to manage crash reporting is to ship gdb with the application, and in case of a crash, attach it to the dying process, collect a stacktrace, and ask the user to send it to the developer. For the developer it helps plenty if the stacktrace already contained symbol names, instead of being number-only. - If you need to live-debug a deployed system, it is not always easy to obtain the correct debuginfo packages and install them along the binaries.


Scope

  • Proposal owners:

- Change mingw-binutils toalso install a generic mingw-nm, which will be used by mingw-find-debuginfo.sh - Change mingw-find-debuginfo.sh as outlined above - Rebuild all mingw packages

  • Other developers: N/A (not a System Wide Change)
  • Policies and guidelines: N/A (not a System Wide Change)
  • Trademark approval: N/A (not needed for this Change)

Upgrade/compatibility impact

N/A (not a System Wide Change)

How To Test

1. Wait for the packages rebuilt with the new mingw-find-debuginfo.sh to land, or use the test packages in this COPR repo. 2. Make a Windows application using the binaries with minidebug infos crash 3. The stacktrace should contain function names, i.e.

#0  0x000000000040157d in foo() ()
#1  0x00000000004015b5 in main () 

as opposed to being number only:

#0  0x000000000040157d in ?? ()
#1  0x00000000004015b5 in ?? ()
#2  0x00000000004013f7 in ?? ()
#3  0x000000000040152b in ?? ()
#4  0x0000000076af652d in KERNEL32!BaseThreadInitThunk ()
   from C:\Windows\system32\kernel32.dll
#5  0x0000000076d2c521 in ntdll!RtlUserThreadStart ()
   from C:\Windows\SYSTEM32\ntdll.dll
#6  0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)


User Experience

N/A (not a System Wide Change)

Dependencies

N/A (not a System Wide Change)

Contingency Plan

  • Contingency mechanism: N/A (not a System Wide Change)
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? N/A (not a System Wide Change), Yes/No
  • Blocks product? none

Documentation

N/A (not a System Wide Change)

Release Notes

MinGW binaries contain symbol names by default for easier debugging.