This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

add -debuginfo packages


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]