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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.trace/] [limits.exp] - Diff between revs 107 and 1765

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

Rev 107 Rev 1765
# Copyright (C) 1998 Free Software Foundation, Inc.
# Copyright (C) 1998 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 2 of the License, or
# the Free Software Foundation; either version 2 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, write to the Free Software
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please email any bugs, comments, and/or additions to this file to:
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
# bug-gdb@prep.ai.mit.edu
if [istarget "m68k-*-elf"] then {
if [istarget "m68k-*-elf"] then {
    pass "Test not supported on this target"
    pass "Test not supported on this target"
    return;
    return;
}
}
load_lib "trace-support.exp"
load_lib "trace-support.exp"
if $tracelevel then {
if $tracelevel then {
        strace $tracelevel
        strace $tracelevel
}
}
set prms_id 0
set prms_id 0
set bug_id 0
set bug_id 0
set testfile "limits"
set testfile "limits"
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 \
if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
        executable {debug additional_flags=-w}] != "" } {
        executable {debug additional_flags=-w}] != "" } {
    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
}
# Tests:
# Tests:
# 1) Meet and exceed artificial limit on number of tracepoints
# 1) Meet and exceed artificial limit on number of tracepoints
# 2) Meet and exceed artificial limit on number of memranges
# 2) Meet and exceed artificial limit on number of memranges
# 3) Meet and exceed artificial limit on bytes  of bytecode data
# 3) Meet and exceed artificial limit on bytes  of bytecode data
# [NOTE: number four is moved out into its own separate test module.]
# [NOTE: number four is moved out into its own separate test module.]
# 4) Meet and exceed artificial limit on bytes  of trace buffer storage
# 4) Meet and exceed artificial limit on bytes  of trace buffer storage
#    (circular and non-circular modes).  However note that a more
#    (circular and non-circular modes).  However note that a more
#    thorough test of the circular mode can be made separately.
#    thorough test of the circular mode can be made separately.
set cr "\[\r\n\]+"
set cr "\[\r\n\]+"
proc gdb_tracepoint_limit_test { } {
proc gdb_tracepoint_limit_test { } {
    global gdb_prompt
    global gdb_prompt
    global cr
    global cr
    # Make sure we're in a sane starting state.
    # Make sure we're in a sane starting state.
    gdb_test "tstop" "" ""
    gdb_test "tstop" "" ""
    gdb_test "tfind none" "" ""
    gdb_test "tfind none" "" ""
    gdb_delete_tracepoints
    gdb_delete_tracepoints
    # Set three tracepoints
    # Set three tracepoints
    gdb_test "trace foo" \
    gdb_test "trace foo" \
            "Tracepoint \[0-9\]+ at .*" \
            "Tracepoint \[0-9\]+ at .*" \
            "tracepoint limit test: set first tracepoint"
            "tracepoint limit test: set first tracepoint"
    gdb_test "trace bar" \
    gdb_test "trace bar" \
            "Tracepoint \[0-9\]+ at .*" \
            "Tracepoint \[0-9\]+ at .*" \
            "tracepoint limit test: set second tracepoint"
            "tracepoint limit test: set second tracepoint"
    gdb_test "trace baz" \
    gdb_test "trace baz" \
            "Tracepoint \[0-9\]+ at .*" \
            "Tracepoint \[0-9\]+ at .*" \
            "tracepoint limit test: set third tracepoint"
            "tracepoint limit test: set third tracepoint"
    # Set secret artificial tracepoint limit to four
    # Set secret artificial tracepoint limit to four
    gdb_test "maint packet QTLimit:tp:4" \
    gdb_test "maint packet QTLimit:tp:4" \
            "received: .OK." \
            "received: .OK." \
            "tracepoint limit test: set limit to four"
            "tracepoint limit test: set limit to four"
    # Now sending three tracepoints should succeed.
    # Now sending three tracepoints should succeed.
    send_gdb "tstart\n"
    send_gdb "tstart\n"
    gdb_expect {
    gdb_expect {
        -re "$cr$gdb_prompt" {
        -re "$cr$gdb_prompt" {
            pass "tracepoint limit test: send fewer than limit"
            pass "tracepoint limit test: send fewer than limit"
        }
        }
        default {
        default {
            fail "tracepoint limit test: send fewer than limit"
            fail "tracepoint limit test: send fewer than limit"
        }
        }
    }
    }
    # Set secret artificial tracepoint limit to three
    # Set secret artificial tracepoint limit to three
    gdb_test "maint packet QTLimit:tp:3" \
    gdb_test "maint packet QTLimit:tp:3" \
            "received: .OK." \
            "received: .OK." \
            "tracepoint limit test: set limit to three"
            "tracepoint limit test: set limit to three"
    # Now sending three tracepoints should still succeed.
    # Now sending three tracepoints should still succeed.
    send_gdb "tstart\n"
    send_gdb "tstart\n"
    gdb_expect {
    gdb_expect {
        -re "$cr$gdb_prompt" {
        -re "$cr$gdb_prompt" {
            pass "tracepoint limit test: send equal to limit"
            pass "tracepoint limit test: send equal to limit"
        }
        }
        default {
        default {
            fail "tracepoint limit test: send equal to limit"
            fail "tracepoint limit test: send equal to limit"
        }
        }
    }
    }
    # Set secret artificial tracepoint limit to two
    # Set secret artificial tracepoint limit to two
    gdb_test "maint packet QTLimit:tp:2" \
    gdb_test "maint packet QTLimit:tp:2" \
            "received: .OK." \
            "received: .OK." \
            "tracepoint limit test: set limit to two"
            "tracepoint limit test: set limit to two"
    # Now sending three tracepoints should fail.
    # Now sending three tracepoints should fail.
    gdb_test "tstart" \
    gdb_test "tstart" \
            ".*\[Ee\]rror.*" \
            ".*\[Ee\]rror.*" \
            "tracepoint limit test: send more than limit"
            "tracepoint limit test: send more than limit"
    # Clean up:
    # Clean up:
    gdb_test "tstop" "" ""
    gdb_test "tstop" "" ""
    gdb_test "maint packet QTLimit:tp:FFFFFFFF" "" ""
    gdb_test "maint packet QTLimit:tp:FFFFFFFF" "" ""
}
}
proc gdb_memrange_limit_test { } {
proc gdb_memrange_limit_test { } {
    global gdb_prompt
    global gdb_prompt
    global cr
    global cr
    # Make sure we're in a sane starting state.
    # Make sure we're in a sane starting state.
    gdb_test "tstop" "" ""
    gdb_test "tstop" "" ""
    gdb_test "tfind none" "" ""
    gdb_test "tfind none" "" ""
    gdb_delete_tracepoints
    gdb_delete_tracepoints
    # Set three tracepoints, and make 'em collect memranges
    # Set three tracepoints, and make 'em collect memranges
    gdb_test "trace foo" \
    gdb_test "trace foo" \
            "Tracepoint \[0-9\]+ at .*" \
            "Tracepoint \[0-9\]+ at .*" \
            "memrange limit test: set first tracepoint"
            "memrange limit test: set first tracepoint"
    gdb_trace_setactions "memrange limit test: set first actions" \
    gdb_trace_setactions "memrange limit test: set first actions" \
            "" \
            "" \
            "collect \$arg" "^$"
            "collect \$arg" "^$"
    gdb_test "trace bar" \
    gdb_test "trace bar" \
            "Tracepoint \[0-9\]+ at .*" \
            "Tracepoint \[0-9\]+ at .*" \
            "memrange limit test: set second tracepoint"
            "memrange limit test: set second tracepoint"
    gdb_trace_setactions "memrange limit test: set second actions" \
    gdb_trace_setactions "memrange limit test: set second actions" \
            "" \
            "" \
            "collect \$arg" "^$"
            "collect \$arg" "^$"
    gdb_test "trace baz" \
    gdb_test "trace baz" \
            "Tracepoint \[0-9\]+ at .*" \
            "Tracepoint \[0-9\]+ at .*" \
            "memrange limit test: set third tracepoint"
            "memrange limit test: set third tracepoint"
    gdb_trace_setactions "memrange limit test: set third actions" \
    gdb_trace_setactions "memrange limit test: set third actions" \
            "" \
            "" \
            "collect \$arg" "^$"
            "collect \$arg" "^$"
    # Set secret artificial memrange limit to four
    # Set secret artificial memrange limit to four
    gdb_test "maint packet QTLimit:memrange:4" \
    gdb_test "maint packet QTLimit:memrange:4" \
            "received: .OK." \
            "received: .OK." \
            "memrange limit test: set limit to four"
            "memrange limit test: set limit to four"
    # Now sending three memranges should still succeed.
    # Now sending three memranges should still succeed.
    send_gdb "tstart\n"
    send_gdb "tstart\n"
    gdb_expect {
    gdb_expect {
        -re "$cr$gdb_prompt" {
        -re "$cr$gdb_prompt" {
            pass "memrange limit test: send fewer than limit"
            pass "memrange limit test: send fewer than limit"
        }
        }
        default {
        default {
            fail "memrange limit test: send fewer than limit"
            fail "memrange limit test: send fewer than limit"
        }
        }
    }
    }
    # Set secret artificial memrange limit to three
    # Set secret artificial memrange limit to three
    gdb_test "maint packet QTLimit:memrange:3" \
    gdb_test "maint packet QTLimit:memrange:3" \
            "received: .OK." \
            "received: .OK." \
            "memrange limit test: set limit to three"
            "memrange limit test: set limit to three"
    # Now sending three memranges should still succeed.
    # Now sending three memranges should still succeed.
    send_gdb "tstart\n"
    send_gdb "tstart\n"
    gdb_expect {
    gdb_expect {
        -re "$cr$gdb_prompt" {
        -re "$cr$gdb_prompt" {
            pass "memrange limit test: send equal to limit"
            pass "memrange limit test: send equal to limit"
        }
        }
        default {
        default {
            fail "memrange limit test: send equal to limit"
            fail "memrange limit test: send equal to limit"
        }
        }
    }
    }
    # Set secret artificial memrange limit to two
    # Set secret artificial memrange limit to two
    gdb_test "maint packet QTLimit:memrange:2" \
    gdb_test "maint packet QTLimit:memrange:2" \
            "received: .OK." \
            "received: .OK." \
            "memrange limit test: set limit to two"
            "memrange limit test: set limit to two"
    # Now sending three memranges should fail.
    # Now sending three memranges should fail.
    gdb_test "tstart" \
    gdb_test "tstart" \
            ".*\[Ee\]rror.*" \
            ".*\[Ee\]rror.*" \
            "memrange limit test: send more than limit"
            "memrange limit test: send more than limit"
    # Clean up:
    # Clean up:
    gdb_test "tstop" "" ""
    gdb_test "tstop" "" ""
    gdb_test "maint packet QTLimit:memrange:FFFFFFFF" "" ""
    gdb_test "maint packet QTLimit:memrange:FFFFFFFF" "" ""
}
}
proc gdb_bytecode_limit_test { } {
proc gdb_bytecode_limit_test { } {
    global gdb_prompt
    global gdb_prompt
    global cr
    global cr
    # Make sure we're in a sane starting state.
    # Make sure we're in a sane starting state.
    gdb_test "tstop" "" ""
    gdb_test "tstop" "" ""
    gdb_test "tfind none" "" ""
    gdb_test "tfind none" "" ""
    gdb_delete_tracepoints
    gdb_delete_tracepoints
    # Set three tracepoints
    # Set three tracepoints
    gdb_test "trace foo" \
    gdb_test "trace foo" \
            "Tracepoint \[0-9\]+ at .*" \
            "Tracepoint \[0-9\]+ at .*" \
            "bytecode limit test: set first tracepoint"
            "bytecode limit test: set first tracepoint"
    gdb_trace_setactions "bytecode limit test: set first actions" \
    gdb_trace_setactions "bytecode limit test: set first actions" \
            "" \
            "" \
            "collect x + n" "^$"
            "collect x + n" "^$"
    gdb_test "trace bar" \
    gdb_test "trace bar" \
            "Tracepoint \[0-9\]+ at .*" \
            "Tracepoint \[0-9\]+ at .*" \
            "bytecode limit test: set second tracepoint"
            "bytecode limit test: set second tracepoint"
    gdb_trace_setactions "bytecode limit test: set second actions" \
    gdb_trace_setactions "bytecode limit test: set second actions" \
            "" \
            "" \
            "collect y + n" "^$"
            "collect y + n" "^$"
    gdb_test "trace baz" \
    gdb_test "trace baz" \
            "Tracepoint \[0-9\]+ at .*" \
            "Tracepoint \[0-9\]+ at .*" \
            "bytecode limit test: set third tracepoint"
            "bytecode limit test: set third tracepoint"
    gdb_trace_setactions "bytecode limit test: set third actions" \
    gdb_trace_setactions "bytecode limit test: set third actions" \
            "" \
            "" \
            "collect z + n" "^$"
            "collect z + n" "^$"
    # Set secret artificial bytecode limit to a large number
    # Set secret artificial bytecode limit to a large number
    gdb_test "maint packet QTLimit:bytecode:400" \
    gdb_test "maint packet QTLimit:bytecode:400" \
            "received: .OK." \
            "received: .OK." \
            "bytecode limit test: set limit to large"
            "bytecode limit test: set limit to large"
    # Now sending three bytecodes should still succeed.
    # Now sending three bytecodes should still succeed.
    send_gdb "tstart\n"
    send_gdb "tstart\n"
    gdb_expect {
    gdb_expect {
        -re "$cr$gdb_prompt" {
        -re "$cr$gdb_prompt" {
            pass "bytecode limit test: send fewer than limit"
            pass "bytecode limit test: send fewer than limit"
        }
        }
        default {
        default {
            fail "bytecode limit test: send fewer than limit"
            fail "bytecode limit test: send fewer than limit"
        }
        }
    }
    }
    # Set secret artificial bytecode limit to a small number
    # Set secret artificial bytecode limit to a small number
    gdb_test "maint packet QTLimit:bytecode:40" \
    gdb_test "maint packet QTLimit:bytecode:40" \
            "received: .OK." \
            "received: .OK." \
            "bytecode limit test: set limit to small"
            "bytecode limit test: set limit to small"
    # Now sending three bytecodes should fail.
    # Now sending three bytecodes should fail.
    gdb_test "tstart" \
    gdb_test "tstart" \
            ".*\[Ee\]rror.*" \
            ".*\[Ee\]rror.*" \
            "bytecode limit test: send more than limit"
            "bytecode limit test: send more than limit"
    # Clean up:
    # Clean up:
    gdb_test "tstop" "" ""
    gdb_test "tstop" "" ""
    gdb_test "maint packet QTLimit:bytecode:FFFFFFFF" "" ""
    gdb_test "maint packet QTLimit:bytecode:FFFFFFFF" "" ""
}
}
proc gdb_trace_limits_tests { } {
proc gdb_trace_limits_tests { } {
    global gdb_prompt
    global gdb_prompt
    # We generously give ourselves one "pass" if we successfully
    # We generously give ourselves one "pass" if we successfully
    # detect that this test cannot be run on this target!
    # detect that this test cannot be run on this target!
    if { ![gdb_target_supports_trace] } then {
    if { ![gdb_target_supports_trace] } then {
        pass "Current target does not supporst trace"
        pass "Current target does not supporst trace"
        return 1;
        return 1;
    }
    }
    if [gdb_test "maint packet QTLimit:tp:ffffffff" \
    if [gdb_test "maint packet QTLimit:tp:ffffffff" \
            "received: .OK." ""] then {
            "received: .OK." ""] then {
        pass "This test cannot be run on this target"
        pass "This test cannot be run on this target"
        return 1;
        return 1;
    }
    }
    if [gdb_test "maint packet QTLimit:memrange:ffffffff" \
    if [gdb_test "maint packet QTLimit:memrange:ffffffff" \
            "received: .OK." ""] then {
            "received: .OK." ""] then {
        pass "This test cannot be run on this target"
        pass "This test cannot be run on this target"
        return 1;
        return 1;
    }
    }
    if [gdb_test "maint packet QTLimit:bytecode:ffffffff" \
    if [gdb_test "maint packet QTLimit:bytecode:ffffffff" \
            "received: .OK." ""] then {
            "received: .OK." ""] then {
        pass "This test cannot be run on this target"
        pass "This test cannot be run on this target"
        return;
        return;
    }
    }
    gdb_tracepoint_limit_test
    gdb_tracepoint_limit_test
    gdb_memrange_limit_test
    gdb_memrange_limit_test
    gdb_bytecode_limit_test
    gdb_bytecode_limit_test
}
}
# 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
if [target_info exists gdb_stub] {
if [target_info exists gdb_stub] {
    gdb_step_for_stub;
    gdb_step_for_stub;
}
}
# Body of test encased in a proc so we can return prematurely.
# Body of test encased in a proc so we can return prematurely.
gdb_trace_limits_tests
gdb_trace_limits_tests
 
 

powered by: WebSVN 2.1.0

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