delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/04/14:58:36

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Date: Tue, 4 Aug 2009 20:58:20 +0200
Message-ID: <6910a60908041158p10fa632cvc2f21524e33b74ce@mail.gmail.com>
Subject: add -debuginfo packages
From: Reini Urban <rurban AT x-ray DOT at>
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Rather than stripping our exe's and dll's I suggest to strip the debug
info into
seperate /usr/lib/debug/path/file.dbg and package them seperately in -debuginfo
packages such as with fedora.

On any error which requires user-side debugging these symbols can be used
by gdb (--symbols=SYMFILE) easily.

dumper should use them too.
Is this a good idea?

Below is the cygport function which can replace __prepstrip.
I'm just not sure if we should create such an additional package
automatically (sure),
and how to add --exclude=/usr/lib/debug easily to the existing pkg contents.
I'm sure Yaakov has a better idea than my ad-hoc approach I'm thinking of.

__prepdebug() {
	if defined _CYGPORT_RESTRICT_debug_
	then
		inform "Skipping -debuginfo package per request.";
		return 0;
	fi

	local exe d s;

	cd ${D};

	echo "Strip debug info into seperate -debuginfo package:";

	for exe in $(find * -type f -writable -a \( -name '*.dll' -o -name
'*.exe' -o -name '*.so' -o -name '*.oct' -o -name '*.cmxs' \))
	do
		# OCaml bytecode must not be stripped
		if grep -q 'Caml1999X008' ${exe}
		then
			continue
		fi
		# Mono assemblies must not be stripped
		if objdump -p ${exe} 2>&1 | grep -q "DLL Name: mscoree.dll"
		then
			continue
		fi

		# assure this is actually a PE-COFF object
		if objdump -f ${exe} &>/dev/null
		then
			echo "        ${exe}";
			chmod +x ${exe};
                        d=$(dirname ${exe})
                        s=$(basename ${exe} .exe)
                        s=$(basename ${s} .dll)
                        mkdir -p ${D}${debugdir}/${d}
                        objcopy --only-keep-debug ${exe}
${D}${debugdir}/${d}/${s}.dbg
                        objcopy --strip-debug ${exe}
                        objcopy
--add-gnu-debuglink=${debugdir}/${d}/${s}.dbg ${exe}
		fi
	done
}

-- 
Reini Urban
http://phpwiki.org/           http://murbreak.at/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019