[11/11,gdb/testsuite] Don't use readelf in gdb/contrib/cc-with-tweaks.sh
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
Readelf is used in gdb/contrib/cc-with-tweaks.sh to find the .dwo files to put
into a .dwp package.
Usage a more basic method for this: assume a .dwo file for each .o file in the
link line.
Verified using shellcheck.
PR/testsuite 31754
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31754
---
gdb/contrib/cc-with-tweaks.sh | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
@@ -70,7 +70,6 @@ then
fi
OBJCOPY=${OBJCOPY:-objcopy}
-READELF=${READELF:-readelf}
DWZ=${DWZ:-dwz}
DWP=${DWP:-dwp}
@@ -280,14 +279,18 @@ elif [ "$want_multi" = true ]; then
fi
if [ "$want_dwp" = true ]; then
- dwo_files=$($READELF -wi "${output_file}" | grep _dwo_name | \
- sed -e 's/^.*: //' | sort | uniq)
+ dwo_files=()
+ for arg in "$@"; do
+ if echo "$arg" | grep -Eq "\.o$"; then
+ dwo_files=("${dwo_files[@]}" "${arg/.o/.dwo}")
+ fi
+ done
rc=0
- if [ -n "$dwo_files" ]; then
- $DWP -o "${output_file}.dwp" ${dwo_files} > /dev/null
+ if [ ${#dwo_files[@]} -ne 0 ]; then
+ $DWP -o "${output_file}.dwp" "${dwo_files[@]}" > /dev/null
rc=$?
[ $rc != 0 ] && exit $rc
- rm -f ${dwo_files}
+ rm -f "${dwo_files[@]}"
fi
fi