OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.mi/] [mi-watch.exp] - Diff between revs 227 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 227 Rev 816
# Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009, 2010
# Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
# 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 .
#
#
# Test essential Machine interface (MI) operations
# Test essential Machine interface (MI) operations
#
#
# Verify that, using the MI, we can run a simple program and perform basic
# Verify that, using the MI, we can run a simple program and perform basic
# debugging activities like: insert breakpoints, run the program,
# debugging activities like: insert breakpoints, run the program,
# step, next, continue until it ends and, last but not least, quit.
# step, next, continue until it ends and, last but not least, quit.
#
#
# The goal is not to test gdb functionality, which is done by other tests,
# The goal is not to test gdb functionality, which is done by other tests,
# but to verify the correct output response to MI operations.
# but to verify the correct output response to MI operations.
#
#
load_lib mi-support.exp
load_lib mi-support.exp
set MIFLAGS "-i=mi"
set MIFLAGS "-i=mi"
gdb_exit
gdb_exit
if [mi_gdb_start] {
if [mi_gdb_start] {
    continue
    continue
}
}
set testfile "basics"
set testfile "basics"
set srcfile ${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/mi-watch
set binfile ${objdir}/${subdir}/mi-watch
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
     untested mi-watch.exp
     untested mi-watch.exp
     return -1
     return -1
}
}
proc test_watchpoint_creation_and_listing {type} {
proc test_watchpoint_creation_and_listing {type} {
    global mi_gdb_prompt
    global mi_gdb_prompt
    global srcfile
    global srcfile
    global hex
    global hex
    set line_callee4_head [gdb_get_line_number "callee4 ("]
    set line_callee4_head [gdb_get_line_number "callee4 ("]
    set line_callee4_body [expr $line_callee4_head + 2]
    set line_callee4_body [expr $line_callee4_head + 2]
    # Insert a watchpoint and list
    # Insert a watchpoint and list
    # Tests:
    # Tests:
    # -break-watch C
    # -break-watch C
    # -break-list
    # -break-list
    mi_gdb_test "111-break-watch C" \
    mi_gdb_test "111-break-watch C" \
             "111\\^done,wpt=\{number=\"2\",exp=\"C\"\}" \
             "111\\^done,wpt=\{number=\"2\",exp=\"C\"\}" \
             "break-watch operation"
             "break-watch operation"
    mi_gdb_test "222-break-list" \
    mi_gdb_test "222-break-list" \
            "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\",original-location=\"C\"\}\\\]\}" \
            "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\",original-location=\"C\"\}\\\]\}" \
                "list of watchpoints"
                "list of watchpoints"
}
}
# UNUSED at the time
# UNUSED at the time
proc test_awatch_creation_and_listing {type} {
proc test_awatch_creation_and_listing {type} {
    global mi_gdb_prompt
    global mi_gdb_prompt
    global srcfile
    global srcfile
    global hex
    global hex
    set line_main_head [gdb_get_line_number "main ("]
    set line_main_head [gdb_get_line_number "main ("]
    set line_main_body [expr $line_main_head + 2]
    set line_main_body [expr $line_main_head + 2]
    # Insert an access watchpoint and list it
    # Insert an access watchpoint and list it
    # Tests:
    # Tests:
    # -break-watch -a A
    # -break-watch -a A
    # -break-list
    # -break-list
    mi_gdb_test "333-break-watch -a A" \
    mi_gdb_test "333-break-watch -a A" \
             "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \
             "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \
             "break-watch -a operation"
             "break-watch -a operation"
    mi_gdb_test "444-break-list" \
    mi_gdb_test "444-break-list" \
            "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
            "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
                "list of watchpoints awatch"
                "list of watchpoints awatch"
    mi_gdb_test "777-break-delete 3" \
    mi_gdb_test "777-break-delete 3" \
            "777\\^done" \
            "777\\^done" \
            "delete access watchpoint"
            "delete access watchpoint"
}
}
# UNUSED at the time
# UNUSED at the time
proc test_rwatch_creation_and_listing {type} {
proc test_rwatch_creation_and_listing {type} {
    global mi_gdb_prompt
    global mi_gdb_prompt
    global srcfile
    global srcfile
    global hex
    global hex
    set line_main_head [gdb_get_line_number "main ("]
    set line_main_head [gdb_get_line_number "main ("]
    set line_main_body [expr $line_main_head + 2]
    set line_main_body [expr $line_main_head + 2]
    # Insert a read watchpoint and list it.
    # Insert a read watchpoint and list it.
    # Tests:
    # Tests:
    # -break-insert -r B
    # -break-insert -r B
    # -break-list
    # -break-list
    mi_gdb_test "200-break-watch -r C" \
    mi_gdb_test "200-break-watch -r C" \
             "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
             "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
             "break-insert -r operation"
             "break-insert -r operation"
    mi_gdb_test "300-break-list" \
    mi_gdb_test "300-break-list" \
            "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\}\}" \
            "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\}\}" \
                "list of breakpoints"
                "list of breakpoints"
    mi_gdb_test "177-break-delete 4" \
    mi_gdb_test "177-break-delete 4" \
            "177\\^done" \
            "177\\^done" \
            "delete read watchpoint"
            "delete read watchpoint"
}
}
proc test_watchpoint_triggering {type} {
proc test_watchpoint_triggering {type} {
    global mi_gdb_prompt
    global mi_gdb_prompt
    global hex fullname_syntax srcfile
    global hex fullname_syntax srcfile
    set line_callee4_return_0     [gdb_get_line_number "return 0;"]
    set line_callee4_return_0     [gdb_get_line_number "return 0;"]
    set line_callee3_head         [gdb_get_line_number "callee3 ("]
    set line_callee3_head         [gdb_get_line_number "callee3 ("]
    set line_callee3_close_brace  [expr $line_callee3_head + 3]
    set line_callee3_close_brace  [expr $line_callee3_head + 3]
    # Continue execution until the watchpoint is reached,  continue again,
    # Continue execution until the watchpoint is reached,  continue again,
    # to see the watchpoint go out of scope.
    # to see the watchpoint go out of scope.
    # Does:
    # Does:
    # -exec-continue (Here wp triggers)
    # -exec-continue (Here wp triggers)
    # -exec-continue (Here wp goes out of scope)
    # -exec-continue (Here wp goes out of scope)
    mi_execute_to "exec-continue" "watchpoint-trigger" "callee4" "" \
    mi_execute_to "exec-continue" "watchpoint-trigger" "callee4" "" \
        ".*basics.c" $line_callee4_return_0 \
        ".*basics.c" $line_callee4_return_0 \
        {"" "wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\}"} \
        {"" "wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\}"} \
        "watchpoint trigger"
        "watchpoint trigger"
    if { $type == "sw" } {
    if { $type == "sw" } {
      setup_xfail *-*-*
      setup_xfail *-*-*
    }
    }
    mi_execute_to "exec-continue" "watchpoint-scope" "callee3" ".*" \
    mi_execute_to "exec-continue" "watchpoint-scope" "callee3" ".*" \
        ".*basics.c" $line_callee3_close_brace \
        ".*basics.c" $line_callee3_close_brace \
        {"" "wpnum=\"2\""} \
        {"" "wpnum=\"2\""} \
        "watchpoint trigger"
        "watchpoint trigger"
    clear_xfail *-*-*
    clear_xfail *-*-*
}
}
proc test_watchpoint_all {type} {
proc test_watchpoint_all {type} {
    global pf_prefix
    global pf_prefix
    upvar srcdir srcdir
    upvar srcdir srcdir
    upvar subdir subdir
    upvar subdir subdir
    upvar binfile binfile
    upvar binfile binfile
    set old_prefix $pf_prefix
    set old_prefix $pf_prefix
    lappend pf_prefix "$type:"
    lappend pf_prefix "$type:"
    mi_delete_breakpoints
    mi_delete_breakpoints
    mi_gdb_reinitialize_dir $srcdir/$subdir
    mi_gdb_reinitialize_dir $srcdir/$subdir
    mi_gdb_load ${binfile}
    mi_gdb_load ${binfile}
    mi_runto callee4
    mi_runto callee4
    test_watchpoint_creation_and_listing $type
    test_watchpoint_creation_and_listing $type
    #test_rwatch_creation_and_listing $type
    #test_rwatch_creation_and_listing $type
    #test_awatch_creation_and_listing $type
    #test_awatch_creation_and_listing $type
    test_watchpoint_triggering $type
    test_watchpoint_triggering $type
    set pf_prefix $old_prefix
    set pf_prefix $old_prefix
}
}
# Run the tests twice, once using software watchpoints...
# Run the tests twice, once using software watchpoints...
mi_gdb_test "567-gdb-set can-use-hw-watchpoints 0" \
mi_gdb_test "567-gdb-set can-use-hw-watchpoints 0" \
        "567\\^done" \
        "567\\^done" \
        "hw watchpoints toggle (1)"
        "hw watchpoints toggle (1)"
test_watchpoint_all sw
test_watchpoint_all sw
mi_gdb_exit
mi_gdb_exit
# ... and unless requested otherwise...
# ... and unless requested otherwise...
if [target_info exists gdb,no_hardware_watchpoints] {
if [target_info exists gdb,no_hardware_watchpoints] {
    return 0
    return 0
}
}
mi_gdb_start
mi_gdb_start
# ... once using hardware watchpoints (if available).
# ... once using hardware watchpoints (if available).
mi_gdb_test "890-gdb-set can-use-hw-watchpoints 1" \
mi_gdb_test "890-gdb-set can-use-hw-watchpoints 1" \
        "890\\^done" \
        "890\\^done" \
        "hw watchpoints toggle (2)"
        "hw watchpoints toggle (2)"
test_watchpoint_all hw
test_watchpoint_all hw
mi_gdb_exit
mi_gdb_exit
return 0
return 0
 
 

powered by: WebSVN 2.1.0

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