OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [gdb/] [testsuite/] [gdb.objc/] [basicclass.exp] - Diff between revs 24 and 33

Only display areas with differences | Details | Blame | View Log

Rev 24 Rev 33
# Copyright 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
# Copyright 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .
# along with this program.  If not, see .
# This file was written by Adam Fedor (fedor@gnu.org)
# This file was written by Adam Fedor (fedor@gnu.org)
if $tracelevel then {
if $tracelevel then {
        strace $tracelevel
        strace $tracelevel
}
}
set testfile "basicclass"
set testfile "basicclass"
set srcfile ${testfile}.m
set srcfile ${testfile}.m
set binfile ${objdir}/${subdir}/${testfile}
set binfile ${objdir}/${subdir}/${testfile}
#
#
# Objective-C program compilation isn't standard. We need to figure out
# Objective-C program compilation isn't standard. We need to figure out
# which libraries to link in. Most of the time it uses pthread
# which libraries to link in. Most of the time it uses pthread
#
#
if {[gdb_compile_objc "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
if {[gdb_compile_objc "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ]] != "" } {
  return -1
  return -1
}
}
#
#
# Deduce language of main()
# Deduce language of main()
#
#
proc deduce_language_of_main {} {
proc deduce_language_of_main {} {
    global gdb_prompt
    global gdb_prompt
    # See what language gdb thinks main() is, prior to reading full symbols.
    # See what language gdb thinks main() is, prior to reading full symbols.
    # I think this fails for COFF targets.
    # I think this fails for COFF targets.
    send_gdb "show language\n"
    send_gdb "show language\n"
    gdb_expect {
    gdb_expect {
        -re ".* source language is \"auto; currently objective-c\".*$gdb_prompt $" {
        -re ".* source language is \"auto; currently objective-c\".*$gdb_prompt $" {
            pass "deduced language is Objective-C, before full symbols"
            pass "deduced language is Objective-C, before full symbols"
        }
        }
        -re ".*$gdb_prompt $" {
        -re ".*$gdb_prompt $" {
            fail "source language not correct for Objective-C (psymtabs only)"
            fail "source language not correct for Objective-C (psymtabs only)"
            return
            return
        }
        }
        timeout {
        timeout {
            fail "can't show language (timeout)"
            fail "can't show language (timeout)"
            return
            return
        }
        }
    }
    }
    runto_main
    runto_main
    # See if our idea of the language has changed.
    # See if our idea of the language has changed.
    send_gdb "show language\n"
    send_gdb "show language\n"
    gdb_expect {
    gdb_expect {
        -re ".* source language is \"auto; currently objective-c\".*$gdb_prompt $" {
        -re ".* source language is \"auto; currently objective-c\".*$gdb_prompt $" {
            pass "deduced language is Objective-C, after full symbols"
            pass "deduced language is Objective-C, after full symbols"
        }
        }
        -re ".*$gdb_prompt $" {
        -re ".*$gdb_prompt $" {
            fail "source language not correct for Objective-C (full symbols)"
            fail "source language not correct for Objective-C (full symbols)"
            return
            return
        }
        }
        timeout {
        timeout {
            fail "can't show language (timeout)"
            fail "can't show language (timeout)"
            return
            return
        }
        }
    }
    }
}
}
proc do_objc_tests {} {
proc do_objc_tests {} {
    global prms_id
    global prms_id
    global bug_id
    global bug_id
    global subdir
    global subdir
    global objdir
    global objdir
    global srcdir
    global srcdir
    global binfile
    global binfile
    global gdb_prompt
    global gdb_prompt
    set prms_id 0
    set prms_id 0
    set bug_id 0
    set bug_id 0
    # Start with a fresh gdb.
    # Start with a fresh gdb.
    gdb_exit
    gdb_exit
    gdb_start
    gdb_start
    gdb_reinitialize_dir $srcdir/$subdir
    gdb_reinitialize_dir $srcdir/$subdir
    gdb_load $binfile
    gdb_load $binfile
    deduce_language_of_main
    deduce_language_of_main
}
}
do_objc_tests
do_objc_tests
#
#
# Breakpoint tests
# Breakpoint tests
#
#
gdb_test "break doIt" \
gdb_test "break doIt" \
    "Breakpoint.*at.* file .*$srcfile, line.29.*" \
    "Breakpoint.*at.* file .*$srcfile, line.29.*" \
    "breakpoint method"
    "breakpoint method"
gdb_test "break takeArg:" \
gdb_test "break takeArg:" \
    "Breakpoint.*at.* file .*$srcfile, line.34.*" \
    "Breakpoint.*at.* file .*$srcfile, line.34.*" \
    "breakpoint method with colon"
    "breakpoint method with colon"
gdb_test "break newWithArg:" \
gdb_test "break newWithArg:" \
    "Breakpoint.*at.* file .*$srcfile, line.22.*" \
    "Breakpoint.*at.* file .*$srcfile, line.22.*" \
    "breakpoint class method with colon"
    "breakpoint class method with colon"
#
#
# Continue until breakpoint (test re-setting breakpoint)
# Continue until breakpoint (test re-setting breakpoint)
#
#
gdb_test continue \
gdb_test continue \
    "Continuing\\..*Breakpoint \[0-9\]+, -.BasicClass takeArg:. \\(self=.*, _cmd=.*, arg=.*\\) at .*$srcfile:34.*" \
    "Continuing\\..*Breakpoint \[0-9\]+, -.BasicClass takeArg:. \\(self=.*, _cmd=.*, arg=.*\\) at .*$srcfile:34.*" \
    "continue until method breakpoint"
    "continue until method breakpoint"
#
#
# Test resetting breakpoints when re-running program
# Test resetting breakpoints when re-running program
#
#
gdb_run_cmd
gdb_run_cmd
gdb_expect {
gdb_expect {
    -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:.*$gdb_prompt $"\
    -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:.*$gdb_prompt $"\
                            { pass "resetting breakpoints when rerunning" }
                            { pass "resetting breakpoints when rerunning" }
    -re ".*$gdb_prompt $"       { fail "resetting breakpoints when rerunning" }
    -re ".*$gdb_prompt $"       { fail "resetting breakpoints when rerunning" }
    timeout                 { fail "resetting breakpoints when rerunning" }
    timeout                 { fail "resetting breakpoints when rerunning" }
}
}
#
#
# Continue until breakpoint (test re-setting breakpoint)
# Continue until breakpoint (test re-setting breakpoint)
#
#
gdb_test continue \
gdb_test continue \
    "Continuing\\..*Breakpoint \[0-9\]+, -.BasicClass takeArg:. \\(self=.*, _cmd=.*, arg=.*\\) at .*$srcfile:34.*" \
    "Continuing\\..*Breakpoint \[0-9\]+, -.BasicClass takeArg:. \\(self=.*, _cmd=.*, arg=.*\\) at .*$srcfile:34.*" \
    "continue until method breakpoint"
    "continue until method breakpoint"
#
#
# Test printing objects
# Test printing objects
#
#
gdb_test "print object" \
gdb_test "print object" \
    "\\$\[0-9\] = .*0x0" \
    "\\$\[0-9\] = .*0x0" \
    " print an ivar of self"
    " print an ivar of self"
gdb_test "print self" \
gdb_test "print self" \
    "\\$\[0-9\] = \\(.*BasicClass \\*\\) 0x\[0-9a-f\]+" \
    "\\$\[0-9\] = \\(.*BasicClass \\*\\) 0x\[0-9a-f\]+" \
    " print self"
    " print self"
gdb_test "print \*self" \
gdb_test "print \*self" \
    "\\$\[0-9\] = \{{?isa = 0x\[0-9a-f\]+}?, object = 0x0\}" \
    "\\$\[0-9\] = \{{?isa = 0x\[0-9a-f\]+}?, object = 0x0\}" \
    " print contents of self"
    " print contents of self"
#
#
# Break in a category
# Break in a category
#
#
gdb_test "break hiddenMethod" \
gdb_test "break hiddenMethod" \
    "Breakpoint.*at.* file .*$srcfile, line.61." \
    "Breakpoint.*at.* file .*$srcfile, line.61." \
    "breakpoint in category method"
    "breakpoint in category method"
#
#
# Continue until breakpoint (test re-setting category breakpoint)
# Continue until breakpoint (test re-setting category breakpoint)
#
#
gdb_test continue \
gdb_test continue \
    "Continuing\\..*Breakpoint \[0-9\]+, -.BasicClass\\(Private\\) hiddenMethod. \\(self=.*, _cmd=.*\\) at .*$srcfile:61.*" \
    "Continuing\\..*Breakpoint \[0-9\]+, -.BasicClass\\(Private\\) hiddenMethod. \\(self=.*, _cmd=.*\\) at .*$srcfile:61.*" \
     "continue until category method"
     "continue until category method"
#
#
# Test calling Objective-C methods
# Test calling Objective-C methods
#
#
gdb_test "print \[self printHi\]" \
gdb_test "print \[self printHi\]" \
    "Hi.*\\$\[0-9\] = \\(.*objc_object \\*\\) 0x\[0-9a-f\]+" \
    "Hi.*\\$\[0-9\] = \\(.*objc_object \\*\\) 0x\[0-9a-f\]+" \
    "Call an Objective-C method with no arguments"
    "Call an Objective-C method with no arguments"
gdb_test "print \[self printNumber: 42\]" \
gdb_test "print \[self printNumber: 42\]" \
    "42.*\\$\[0-9\] = 43" \
    "42.*\\$\[0-9\] = 43" \
    "Call an Objective-C method with one argument"
    "Call an Objective-C method with one argument"
#
#
# Test printing the object description
# Test printing the object description
#
#
gdb_test "print-object object" \
gdb_test "print-object object" \
    "BasicClass gdb test object" \
    "BasicClass gdb test object" \
    "Use of the print-object command"
    "Use of the print-object command"
gdb_test "po self" \
gdb_test "po self" \
    "BasicClass gdb test object" \
    "BasicClass gdb test object" \
    "Use of the po (print-object) command"
    "Use of the po (print-object) command"
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.