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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [freebpcmd.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 2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
#   Copyright 2003, 2007, 2008, 2009, 2010 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 is a regression test for the following bug, as of 2003-12-12:
# This is a regression test for the following bug, as of 2003-12-12:
#
#
# Set a breakpoint which will be hit many times.  Attach a complex set
# Set a breakpoint which will be hit many times.  Attach a complex set
# of commands to it, including a "continue" command.  Run the program,
# of commands to it, including a "continue" command.  Run the program,
# so that the breakpoint is hit, its commands get executed, and the
# so that the breakpoint is hit, its commands get executed, and the
# program continues and hits the breakpoint again.  You will see
# program continues and hits the breakpoint again.  You will see
# messages like "warning: Invalid control type in command structure.",
# messages like "warning: Invalid control type in command structure.",
# or maybe GDB will crash.
# or maybe GDB will crash.
#
#
# When the breakpoint is hit, bpstat_stop_status copies the
# When the breakpoint is hit, bpstat_stop_status copies the
# breakpoint's command tree to the bpstat.  bpstat_do_actions then
# breakpoint's command tree to the bpstat.  bpstat_do_actions then
# calls execute_control_command to run the commands.  The 'continue'
# calls execute_control_command to run the commands.  The 'continue'
# command invokes the following chain of calls:
# command invokes the following chain of calls:
#
#
#   continue_command
#   continue_command
#     -> clear_proceed_status
#     -> clear_proceed_status
#       -> bpstat_clear
#       -> bpstat_clear
#         -> free_command_lines
#         -> free_command_lines
#            -> frees the commands we are currently running.
#            -> frees the commands we are currently running.
#
#
# When control does eventually return to execute_control_command, GDB
# When control does eventually return to execute_control_command, GDB
# continues to walk the tree of freed command nodes, resulting in the
# continues to walk the tree of freed command nodes, resulting in the
# error messages and / or crashes.
# error messages and / or crashes.
#
#
# Since this bug depends on storage being reused between the time that
# Since this bug depends on storage being reused between the time that
# we continue and the time that we fall back to bpstat_do_actions, the
# we continue and the time that we fall back to bpstat_do_actions, the
# reproduction recipe is more delicate than I would like.  I welcome
# reproduction recipe is more delicate than I would like.  I welcome
# suggestions for improving this.
# suggestions for improving this.
set prms_id 0
set prms_id 0
set bug_id 0
set bug_id 0
set testfile "freebpcmd"
set testfile "freebpcmd"
set srcfile ${testfile}.c
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set binfile ${objdir}/${subdir}/${testfile}
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     untested freebpcmd.exp
     untested freebpcmd.exp
     return -1
     return -1
}
}
gdb_exit
gdb_exit
gdb_start
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_load ${binfile}
gdb_test "break ${srcfile}:[gdb_get_line_number "euphonium"]" "" "set breakpoint"
gdb_test "break ${srcfile}:[gdb_get_line_number "euphonium"]" "" "set breakpoint"
# The goal of all this is to make sure that there's plenty of memory
# The goal of all this is to make sure that there's plenty of memory
# churn, and different amounts of it each time the inferior stops;
# churn, and different amounts of it each time the inferior stops;
# this seems to make GDB crash more reliably.
# this seems to make GDB crash more reliably.
set lines {{if (i%2) == 0}
set lines {{if (i%2) == 0}
           {echo "even "}
           {echo "even "}
           {print i}
           {print i}
           {else}
           {else}
           {echo "odd "}
           {echo "odd "}
           {print i}
           {print i}
           {end}
           {end}
           {set variable $foo = 0}
           {set variable $foo = 0}
           {set variable $j = 0}
           {set variable $j = 0}
           {while $j < i}
           {while $j < i}
           {set variable $foo += $j}
           {set variable $foo += $j}
           {set variable $j++}
           {set variable $j++}
           {end}
           {end}
           {print $foo}
           {print $foo}
           {if i != 40}
           {if i != 40}
           {c}
           {c}
           {end}
           {end}
           {end}}
           {end}}
send_gdb "commands\n"
send_gdb "commands\n"
for {set i 0} {$i < [llength $lines]} {incr i} {
for {set i 0} {$i < [llength $lines]} {incr i} {
    gdb_expect {
    gdb_expect {
        -re ".*>" {
        -re ".*>" {
            send_gdb "[lindex $lines $i]\n"
            send_gdb "[lindex $lines $i]\n"
        }
        }
        -re "$gdb_prompt $" {
        -re "$gdb_prompt $" {
            set reason "got top-level prompt early"
            set reason "got top-level prompt early"
            break
            break
        }
        }
        timeout {
        timeout {
            set reason "timeout"
            set reason "timeout"
            break
            break
        }
        }
    }
    }
}
}
if {$i >= [llength $lines]} {
if {$i >= [llength $lines]} {
    pass "send breakpoint commands"
    pass "send breakpoint commands"
} else {
} else {
    fail "send breakpoint commands ($reason)"
    fail "send breakpoint commands ($reason)"
}
}
gdb_run_cmd
gdb_run_cmd
set prev_timeout $timeout
set prev_timeout $timeout
set timeout 120
set timeout 120
gdb_test_multiple "" "run program with breakpoint commands" {
gdb_test_multiple "" "run program with breakpoint commands" {
    -re "warning: Invalid control type in command structure" {
    -re "warning: Invalid control type in command structure" {
        kfail "gdb/1489" "run program with breakpoint commands"
        kfail "gdb/1489" "run program with breakpoint commands"
    }
    }
    -re "$gdb_prompt $" {
    -re "$gdb_prompt $" {
        pass "run program with breakpoint commands"
        pass "run program with breakpoint commands"
    }
    }
    eof {
    eof {
        kfail "gdb/1489" "run program with breakpoint commands (GDB died)"
        kfail "gdb/1489" "run program with breakpoint commands (GDB died)"
    }
    }
}
}
set timeout $prev_timeout
set timeout $prev_timeout
 
 

powered by: WebSVN 2.1.0

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