gdb-index-nodebug.exp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright 2021-2022 Free Software Foundation, Inc.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 3 of the License, or
  5. # (at your option) any later version.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. load_lib dwarf.exp
  15. standard_testfile main.c
  16. if {[prepare_for_testing "failed to prepare" "${testfile}" \
  17. [list ${srcfile}] {nodebug}]} {
  18. return -1
  19. }
  20. set have_index [have_index $binfile]
  21. set have_index_re \
  22. [list \
  23. "Error while writing index for \[^\r\n\]*:" \
  24. "Cannot use an index to create the index"]
  25. set have_index_re [join $have_index_re]
  26. set readnow_p [readnow]
  27. set index_file ${testfile}.gdb-index
  28. # The bug was that gdb would crash here.
  29. set cmd "save gdb-index [file dirname ${index_file}]"
  30. gdb_test_multiple $cmd "try to save gdb index" {
  31. -re -wrap $have_index_re {
  32. if { $have_index != "" || $readnow_p } {
  33. unsupported $gdb_test_name
  34. } else {
  35. fail $gdb_test_name
  36. }
  37. }
  38. -re -wrap "^$cmd" {
  39. pass $gdb_test_name
  40. }
  41. }