Home | History | Annotate | Line # | Download | only in gdb.objc
objcdecode.exp revision 1.1.1.7
      1  1.1.1.7  christos # Copyright 2003-2023 Free Software Foundation, Inc.
      2      1.1  christos 
      3      1.1  christos # This program is free software; you can redistribute it and/or modify
      4      1.1  christos # it under the terms of the GNU General Public License as published by
      5      1.1  christos # the Free Software Foundation; either version 3 of the License, or
      6      1.1  christos # (at your option) any later version.
      7      1.1  christos #
      8      1.1  christos # This program is distributed in the hope that it will be useful,
      9      1.1  christos # but WITHOUT ANY WARRANTY; without even the implied warranty of
     10      1.1  christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11      1.1  christos # GNU General Public License for more details.
     12      1.1  christos #
     13      1.1  christos # You should have received a copy of the GNU General Public License
     14      1.1  christos # along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15      1.1  christos 
     16      1.1  christos # This file tests decoding of Objective-C symbols
     17      1.1  christos 
     18      1.1  christos # This file was written by Adam Fedor (fedor (at) gnu.org)
     19      1.1  christos 
     20      1.1  christos standard_testfile .m
     21      1.1  christos 
     22      1.1  christos #
     23      1.1  christos # Objective-C program compilation isn't standard. We need to figure out
     24      1.1  christos # which libraries to link in. Most of the time it uses pthread
     25      1.1  christos #
     26      1.1  christos if {[gdb_compile_objc "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
     27      1.1  christos   return -1
     28      1.1  christos }
     29      1.1  christos 
     30      1.1  christos proc do_objc_tests {} {
     31      1.1  christos     global subdir
     32      1.1  christos     global srcdir
     33      1.1  christos     global binfile
     34      1.1  christos     global gdb_prompt
     35      1.1  christos 
     36      1.1  christos 
     37      1.1  christos     # Start with a fresh gdb.
     38      1.1  christos 
     39      1.1  christos     gdb_exit
     40      1.1  christos     gdb_start
     41      1.1  christos     gdb_reinitialize_dir $srcdir/$subdir
     42      1.1  christos     gdb_load $binfile
     43      1.1  christos 
     44      1.1  christos }
     45      1.1  christos 
     46      1.1  christos do_objc_tests
     47      1.1  christos 
     48      1.1  christos gdb_test_no_output "set multiple-symbols ask"
     49      1.1  christos 
     50      1.1  christos #
     51      1.1  christos # Break on multiply defined method (PR objc/1236)
     52      1.1  christos #
     53      1.1  christos set name "break on multiply defined method"
     54      1.1  christos gdb_test_multiple "break multipleDef" $name \
     55      1.1  christos {
     56      1.1  christos     -re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] .*${srcfile}:-.Decode multipleDef.\r\n\\\[3\\\] .*${srcfile}:multipleDef\r\n> $" {
     57      1.1  christos 	send_gdb "3\n"
     58      1.1  christos 	exp_continue
     59      1.1  christos     }
     60      1.1  christos     -re "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: .*\r\n$gdb_prompt $" { pass $name }
     61      1.1  christos     -re ".*$gdb_prompt $"   { kfail "gdb/1236" $name }
     62      1.1  christos }
     63      1.1  christos 
     64      1.1  christos set name "continue after break on multiply defined symbol"
     65      1.1  christos gdb_run_cmd
     66      1.1  christos gdb_test_multiple "" $name \
     67      1.1  christos {
     68      1.1  christos     -re "Breakpoint \[0-9\]+, multipleDef \\\(\\\) at .*\r\n$gdb_prompt $" {
     69      1.1  christos 	pass $name
     70      1.1  christos     }
     71      1.1  christos     -re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] -.Decode multipleDef. at .*\r\n\\\[3\\\] multipleDef at .*\r\n> $" {
     72      1.1  christos 	send_gdb "0\n"
     73      1.1  christos 	kfail "gdb/1238" $name
     74      1.1  christos 	# gdb is in a bad state here.
     75      1.1  christos 	# It would be difficult to do any more tests after this.
     76      1.1  christos     }
     77      1.1  christos }
     78