$GDB --batch -nx -iex 'set auto-load no' \
-iex 'set debuginfod enabled off' \
- -ex "file $file" -ex "save gdb-index $dwarf5 $dir" || {
+ -ex "file '$file'" -ex "save gdb-index $dwarf5 '$dir'" || {
# Just in case.
status=$?
echo "$myname: gdb error generating index for $file" 1>&2
index="$index5"
section=".debug_names"
fi
- debugstradd=false
- debugstrupdate=false
if test -s "$debugstr"; then
if ! $OBJCOPY --dump-section .debug_str="$debugstrmerge" "$fpath" \
- /dev/null 2>$debugstrerr; then
- cat >&2 $debugstrerr
+ /dev/null 2> "$debugstrerr"; then
+ cat >&2 "$debugstrerr"
exit 1
fi
+ cat "$debugstr" >>"$debugstrmerge"
if grep -q "can't dump section '.debug_str' - it does not exist" \
- $debugstrerr; then
- debugstradd=true
+ "$debugstrerr"; then
+ $OBJCOPY --add-section $section="$index" \
+ --set-section-flags $section=readonly \
+ --add-section .debug_str="$debugstrmerge" \
+ --set-section-flags .debug_str=readonly \
+ "$fpath" "$fpath"
else
- debugstrupdate=true
- cat >&2 $debugstrerr
+ $OBJCOPY --add-section $section="$index" \
+ --set-section-flags $section=readonly \
+ --update-section .debug_str="$debugstrmerge" \
+ "$fpath" "$fpath"
fi
- cat "$debugstr" >>"$debugstrmerge"
+ else
+ $OBJCOPY --add-section $section="$index" \
+ --set-section-flags $section=readonly \
+ "$fpath" "$fpath"
fi
- $OBJCOPY --add-section $section="$index" \
- --set-section-flags $section=readonly \
- $(if $debugstradd; then \
- echo --add-section .debug_str="$debugstrmerge"; \
- echo --set-section-flags .debug_str=readonly; \
- fi; \
- if $debugstrupdate; then \
- echo --update-section .debug_str="$debugstrmerge"; \
- fi) \
- "$fpath" "$fpath"
-
status=$?
else
echo "$myname: No index was created for $fpath" 1>&2