| # Copyright 2004 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 |
| |
| if [target_info exists noobjc64] { |
| verbose "Disable Objective-C tests on 64-bit PowerPC." |
| return |
| } |
| |
| 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." |
| } |
| |
| gdb_exit |
| gdb_start |
| gdb_reinitialize_dir $srcdir/$subdir |
| gdb_load ${binfile} |
| |
| # The FSF gdb's rbreak command doesn't correctly match ObjC class |
| # functions right now (2004-04-29); we have a local mod to |
| # symtab.c:rbreak_command to handle this. Make sure that mod isn't lost |
| # in merges. |
| |
| set timeout 5 |
| |
| gdb_test "rbreak WithArg" \ |
| "Breakpoint $decimal.*at.* file.*objc-prog.m.*Breakpoint $decimal.*at.* file.*objc-prog.m.*" \ |
| "rbreak Arg matches at least two functions" |
| |
| gdb_test "run" ".*Breakpoint $decimal, ..MyClass newWithArg.*" "Run to first rbreak-set bp" |
| |
| gdb_test "next" ".*" "step #1 in newWithArg:" |
| gdb_test "next" ".*" "step #2 in newWithArg:" |
| gdb_test "step" "-.MyClass takeArg:.*" "step into ObjC member function" |
| gdb_test "fin" "Run till exit.*Value returned is .*struct objc_object.*" "finish out of ObjC member function" |
| |
| gdb_exit |
| return 0 |