gdb-add-index may trigger debuginfod's first-use notice. The notice
is misleading in this case. It instructs the user to modify .gdbinit
in order to permanently enable/disable debuginfod but gdb-add-index
invokes gdb with -nx which ignores .gdbinit.
Additionally debuginfod is not needed for gdb-add-index since the
symbol file is given as an argument and should already be present
locally.
Fix this by disabling debuginfod when gdb-add-index invokes gdb.
trap "rm -f $tmp_files" 0
$GDB --batch -nx -iex 'set auto-load no' \
+ -iex 'set debuginfod enabled off' \
-ex "file $file" -ex "save gdb-index $dwarf5 $dir" || {
# Just in case.
status=$?