summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2018-11-09 11:23:07 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2018-11-10 08:50:47 +0100
commit46223dfbf9f66537188cc1ae0cd3a44dd2220df2 (patch)
treecdcec5f59e189df75b6c3d7d60c74eddf2a742d7 /scripts
parent84ee7ded53300ff07181da8bb91daa36dd2f42d6 (diff)
downloadptxdist-46223dfbf9f66537188cc1ae0cd3a44dd2220df2.tar.gz
ptxdist-46223dfbf9f66537188cc1ae0cd3a44dd2220df2.tar.xz
ptxd_install_file: improve debug handling
- don't create debug files if debugging is disabled - print created debug file path - install gdb debug helpers into root/ and debug packages Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/ptxd_make_xpkg_pkg.sh36
1 files changed, 30 insertions, 6 deletions
diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh
index 7152c7c2d..e82fb14b2 100644
--- a/scripts/lib/ptxd_make_xpkg_pkg.sh
+++ b/scripts/lib/ptxd_make_xpkg_pkg.sh
@@ -119,10 +119,12 @@ ptxd_install_setup() {
sdirs=("${nfsroot_dirs[@]}" "${pkg_xpkg_tmp}")
# dirs with separate debug files
- ddirs=("${nfsroot_dirs[@]}")
- if [ "$(ptxd_get_ptxconf PTXCONF_DEBUG_PACKAGES)" = "y" -a \
- "$(ptxd_get_ptxconf PTXCONF_TARGET_DEBUG_OFF)" != "y" ]; then
- ddirs[${#ddirs[@]}]="${pkg_xpkg_dbg_tmp}"
+ ddirs=()
+ if [ "$(ptxd_get_ptxconf PTXCONF_TARGET_DEBUG_OFF)" != "y" ]; then
+ ddirs=("${nfsroot_dirs[@]}")
+ if [ "$(ptxd_get_ptxconf PTXCONF_DEBUG_PACKAGES)" = "y" ]; then
+ ddirs[${#ddirs[@]}]="${pkg_xpkg_dbg_tmp}"
+ fi
fi
mod_nfs="$(printf "0%o" $(( 0${mod} & ~06000 )))" &&
@@ -163,6 +165,9 @@ ptxd_install_setup_src() {
if [ "${src}" = "-" -a -n "${dst}" ]; then
src="${pkg_pkg_dir}${dst}"
+ gdb_src="${pkg_pkg_dir}/usr/share/gdb/auto-load${dst}-gdb"
+ elif [ "${src#${pkg_pkg_dir}}" != "${src}" ]; then
+ gdb_src="${pkg_pkg_dir}/usr/share/gdb/auto-load${src#${pkg_pkg_dir}}-gdb"
fi
ptxd_install_setup || return
@@ -258,6 +263,10 @@ ptxd_install_file_extract_debug() {
local dbg dir
local bid=$(ptxd_extract_build_id)
+ if [ "${#ddirs[*]}" -eq 0 ]; then
+ return
+ fi
+
if [ -z "${bid}" ]; then
dbg="$(dirname "${dst}")/.debug/.$(basename "${dst}").dbg"
else
@@ -280,6 +289,7 @@ ptxd_install_file_extract_debug() {
"${CROSS_OBJCOPY}" ${ptxd_install_file_objcopy_args} "${src}" "${tmp}"
fi
fi &&
+ echo " debug file: ${dbg}" &&
for dir in "${ddirs[@]}"; do
if [ -n "${bid}" -o -e "${dir}${dst}" ]; then
install -D -m 644 "${tmp}" "${dir}/${dbg}"
@@ -340,6 +350,7 @@ ptxd_install_file_impl() {
local strip="$6"
local -a dirs ndirs pdirs sdirs ddirs
local mod_nfs mod_rw
+ local gdb_src
ptxd_install_setup_src &&
echo "\
@@ -348,8 +359,7 @@ install ${cmd}:
dst=${dst}
owner=${usr} ${usr_name}
group=${grp} ${grp_name}
- permissions=${mod}
-" &&
+ permissions=${mod}" &&
ptxd_exist "${src}" &&
rm -f "${dirs[@]/%/${dst}}" &&
@@ -396,6 +406,19 @@ Usually, just remove the 6th parameter and everything works fine.
;;
esac &&
+ if [ "${#ddirs[*]}" -gt 0 -a -n "${gdb_src}" ]; then
+ local gdb_file
+ local ddir="$(dirname "${dst}")"
+ for gdb_file in $(ls "${gdb_src}".* 2>/dev/null); do
+ local gdb_dst="${ddir}/$(basename "${gdb_file}")"
+ echo " debug file: ${gdb_dst}" &&
+ for d in "${ddirs[@]/%/${gdb_dst}}"; do
+ install -m 644 -D "${gdb_file}" "${d}" || break
+ done
+ done
+ fi &&
+ echo "" &&
+
# now change to requested permissions
chmod "${mod_nfs}" "${ndirs[@]/%/${dst}}" &&
chmod "${mod}" "${pdirs[@]/%/${dst}}" &&
@@ -652,6 +675,7 @@ ptxd_install_find() {
local strip="${5}"
local -a dirs ndirs pdirs sdirs ddirs
local mod_nfs mod_rw
+ local gdb_src
if [ -z "${glob}" ]; then
local glob="-o -print"
fi