cc-with-tweaks.sh: Use gdb-add-index.sh
authorJan Kratochvil <jan.kratochvil@redhat.com>
Fri, 8 Dec 2017 22:44:10 +0000 (22:44 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 8 Dec 2017 22:44:10 +0000 (22:44 +0000)
commit6432ec65a8822246db5bcede0c6bd3ed0e464a0b
tree7b995610fdf19c5fa515ae252b7952174a21a123
parenta9d44aad42e127adadbad35f23931d8d83aa40c1
cc-with-tweaks.sh: Use gdb-add-index.sh

With DWARF-5 .debug_names, the commands to add the index to the symbol
file are more complicated, as now also .debug_str needs to be
modified.

Currently, contrib/cc-with-tweaks.sh calls objcopy to handle the '-i'
option instead of using contrib/gdb-add-index.sh which basically does
the same.  To help with .debug_names, this commit makes
contrib/cc-with-tweaks.sh reuse contrib/gdb-add-index.sh instead.

A problem this ran into is whether contrib/cc-with-tweaks.sh should
fail or not when no index is produced.

Currently, contrib/cc-with-tweaks.sh is more quiet (=successful) than
contrib/gdb-add-index.sh and so with no further changes testsuite runs
with an index would "regress".  This commit tries to keep the behavior
unchanged.  Some cases still error with:
Ada is not currently supported by the index
But some cases (such as some trivial gdb.dwarf2/ testcases with no DWARF data
to index) produce no index while the testcases still PASS now instead of:
-PASS: gdb.arch/i386-bp_permanent.exp: stack pointer value matches
+gdb compile failed, gdb-add-index.sh: No index was created for gdb/testsuite.unix.-m64/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent
+gdb-add-index.sh: [Was there no debuginfo? Was there already an index?]
+UNTESTED: gdb.arch/i386-bp_permanent.exp: failed to compile

gdb/ChangeLog
2017-12-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Pedro Alves  <palves@redhat.com>

* contrib/cc-with-tweaks.sh: Change interpreter to bash, incl. initial
comment.
(GDB_ADD_INDEX): New variable.
<$want_index>: Call $GDB_ADD_INDEX.
gdb/ChangeLog
gdb/contrib/cc-with-tweaks.sh