| # Copyright 2003 Free Software Foundation, Inc. |
| |
| # This program is free software; you can redistribute it and/or modify |
| # it under the terms of the GNU General Public License as published by |
| # the Free Software Foundation; either version 2 of the License, or |
| # (at your option) any later version. |
| # |
| # This program is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| # GNU General Public License for more details. |
| # |
| # You should have received a copy of the GNU General Public License |
| # along with this program; if not, write to the Free Software |
| # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| |
| if $tracelevel then { |
| strace $tracelevel |
| } |
| |
| set prms_id 0 |
| set bug_id 0 |
| |
| set testfile "objc-prog" |
| set srcfile ${testfile}.m |
| set binfile ${objdir}/${subdir}/${testfile} |
| |
| if { [gdb_compile "${srcdir}/${subdir}/$srcfile" "${binfile}" executable {debug additional_flags=-framework\ Foundation}] != "" } { |
| gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." |
| } |
| |
| # Start with a fresh gdb |
| |
| gdb_exit |
| gdb_start |
| gdb_reinitialize_dir $srcdir/$subdir |
| gdb_load ${binfile} |
| |
| # |
| # The following tests inspired by radar 3347273, |
| # |
| gdb_test "break [gdb_get_line_number "Whatever, just a place to break and examine SELF"]" \ |
| "Breakpoint \[0-9\] at $hex.*line $decimal\\." \ |
| "breakpoint on function randomFunc" |
| |
| send_gdb "run\n" |
| gdb_expect { |
| -re ".*Starting program: ${binfile}.*Reading symbols for shared libraries.*Breakpoint 1, .*MyClass randomFunc.*$gdb_prompt $" { |
| pass "run program" |
| } |
| -re "$gdb_prompt $" { |
| fail "run program" |
| } |
| timeout { |
| fail "(timeout) run program" |
| } |
| } |
| |
| gdb_test "cond 1 ((int)\[object isKindOfClass:(id)\[NSString class\]\])" \ |
| "" \ |
| "set break point conditon to isKindOfClass of NSString" |
| |
| gdb_test "info break" \ |
| "Num Type.*stop only if .*object isKindOfClass.*breakpoint already hit 1 time" \ |
| "info break" |
| |
| |
| gdb_exit |
| return 0 |