* [patch] New test for set backtrace related functionality
@ 2004-10-14 22:41 Paul Gilliam
2004-10-14 22:47 ` Paul Gilliam
0 siblings, 1 reply; 10+ messages in thread
From: Paul Gilliam @ 2004-10-14 22:41 UTC (permalink / raw)
To: gdb-patches; +Cc: Andrew Cagney, Michael Chastain
This has been tested on powerpc64-unknown-linux-gnu (in 32-bit mode) and on
i686-pc-linux-gnu
OK to commit?
-=# Paul Gilliam #=-
2004-10-14 Paul Gilliam <pgilliam@us.ibm.com>
* gdb.base/setbacktrace.c gdb.base/setbacktrace.exp: New files.
*** /dev/null 2004-04-15 13:01:52.000000000 -0700
--- gdb.base/setbacktrace.c 2004-10-14 14:08:52.000000000 -0700
***************
*** 0 ****
--- 1,40 ----
+ /* This testcase is part of GDB, the GNU debugger.
+
+ 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. */
+
+ int
+ factorial (int n)
+ {
+ if (n > 0) { /* marker: factorial */
+ return factorial (n - 1) * n; /* marker: factorial recursion */
+ } else {
+ return 1;
+ }
+ }
+
+ int
+ main (int argc, char *argv[])
+ {
+ int depth = 3;
+
+ if (argc > 1) {
+ depth = atoi(argv[1]);
+ }
+
+ return factorial (depth); /* marker: main call */
+ }
*** /dev/null 2004-04-15 13:01:52.000000000 -0700
--- gdb.base/setbacktrace.exp 2004-10-14 14:58:54.728594800 -0700
***************
*** 0 ****
--- 1,147 ----
+ # This file is part of the gdb testsuite.
+
+ # 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.
+
+ # Check backtrace releated features not tested elsewhere in the testsuit:
+ # * Check that we know what backtrace options are available.
+ # * Check that GDB will only backtrace the requested number of frames.
+ # * Check that GDB doesn't backtrace past main unless asked to do so.
+
+ if $tracelevel {
+ strace $tracelevel
+ }
+
+ set prms_id 0
+ set bug_id 0
+
+ set testfile setbacktrace
+ set srcfile ${testfile}.c
+ set escapedsrcfile [string_to_regexp "${srcdir}/${subdir}/${srcfile}"]
+ set binfile ${objdir}/${subdir}/${testfile}
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable
{debug}] != "" } {
+ untested "Couldn't compile ${testfile}.c"
+ return -1
+ }
+
+ set fact_subr_line_nbr [gdb_get_line_number "marker: factorial"]
+ set fact_recur_line_nbr [gdb_get_line_number "marker: factorial recursion"]
+ set main_subr_line_nbr [gdb_get_line_number "marker: main call"]
+
+ # Set how deep should we go and build the expected_frames pattern list.
+ set leadin ".*\[\r\n\]"
+ set subr_depth 20
+ set expected_frames [list "$leadin#0 factorial \\(n=0\\) at
$escapedsrcfile:$fact_subr_line_nbr"]
+ for {set ndx 1} {$ndx <= $subr_depth} {incr ndx} {
+ lappend expected_frames [format "$leadin#%-2d $hex in factorial
\\(n=$ndx\\) at $escapedsrcfile:$fact_recur_line_nbr" $ndx]
+ }
+ lappend expected_frames [format "$leadin#%-2d $hex in main \\(argc=2,
argv=$hex\\) at $escapedsrcfile:$main_subr_line_nbr" [expr $subr_depth + 1]]
+ #for {set ndx 0} {$ndx < [expr $subr_depth + 2]} {incr ndx} {
+ # puts "$ndx: [lindex $expected_frames $ndx]"
+ #}
+
+
+ # get things started
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+ gdb_test "set args $subr_depth"
+
+
+ # Advance to main
+ if { ![runto_main] } then {
+ gdb_suppress_tests;
+ }
+
+
+ # Check that someone has not snuck in an extra backtrace option, if
+ # they do they will need to fix this and any such fix should also be
+ # accompanied by a corresponding SET test.
+ set test "set backtrace"
+ send_gdb "set backtrace\n"
+ set foobar [list \
+ ".*\[\n\r\]+List of set backtrace subcommands:" \
+ ".*\[\n\r\]+set backtrace limit -- Set an upper bound on the number of
backtrace levels" \
+ ".*\[\n\r\]+set backtrace past-main -- Set whether backtraces should
continue past \"main\"" \
+ ".*\[\n\r\]+Type \"help set backtrace\" followed by set backtrace
subcommand name for full documentation." \
+ ".*\[\n\r\]+Command name abbreviations are allowed if unambiguous."]
+ gdb_expect_list $test ".*$gdb_prompt $" $foobar
+
+ # Create a simple stack.
+ gdb_test "break factorial if n == 0"
+ gdb_continue_to_breakpoint "factorial"
+
+ # Check a backtrace to main (ignore any extra).
+ set test "full backtrace"
+ send_gdb "backtrace\n"
+ gdb_expect_list $test ".*$gdb_prompt $" $expected_frames
+
+
+ # Check a backtrace to main (don't ignore any extra).
+ #setup_kfail *-*-* gdb/1760
+ set test "full backtrace (exact)"
+ send_gdb "backtrace\n"
+ gdb_expect_list $test "\[\n\r\]+$gdb_prompt $" $expected_frames
+
+
+ # Check a backtrace short of main.
+ set test "partial backtrace"
+ set partial_depth [expr int($subr_depth / 2)]
+ set partial_frames [lrange $expected_frames 0 [expr $partial_depth - 1]]
+ lappend partial_frames "\[\n\r\]\\(More stack frames follow\\.\\.\\.\\)"
+ #for {set ndx 0} {$ndx < [expr $partial_depth + 2]} {incr ndx} {
+ # puts "$ndx: [lindex $partial_frames $ndx]"
+ #}
+ send_gdb "backtrace $partial_depth\n"
+ gdb_expect_list $test "\[\n\r\]+$gdb_prompt $" $partial_frames
+
+
+ ## Check a backtrace short of main due to limit.
+ set test "partial backtrace (using limit)"
+ set partial_frames [lrange $expected_frames 0 [expr $partial_depth - 1]]
+ lappend partial_frames "^\[\n\r]+Backtrace limit of $partial_depth exceeded"
+ #for {set ndx 0} {$ndx < [llength $partial_frames]} {incr ndx} {
+ # puts "$ndx: [lindex $partial_frames $ndx]"
+ #}
+ gdb_test "set backtrace limit $partial_depth" ".*" "Set the backtrace limit
to $partial_depth"
+ setup_kfail *-*-* gdb/1760
+ send_gdb "backtrace\n"
+ gdb_expect_list $test "\[\r\n]+$gdb_prompt $" $partial_frames
+
+
+ # Check a backtrace past main, specify a backtrace limit so it does not fall
off the end of the stack.
+ set test "backtrace past main"
+ set bt_limit [expr $subr_depth + 3]
+ gdb_test "set backtrace past-main" ".*" "Set the backtrace past-main"
+ gdb_test "set backtrace limit 0" ".*" "Set the backtrace limit to unlimited"
+ set extra_frames [lrange $expected_frames 0 [expr $subr_depth + 2]]
+ lappend extra_frames [format "$leadin#%-2d $hex in \[^ \]+ \\(\[^\\)]*\\)
\[^\r\n]*" [expr $subr_depth + 2]]
+ lappend extra_frames "\\(More stack frames follow\\.\\.\\.\\)"
+ #for {set ndx 0} {$ndx < [llength $extra_frames]} {incr ndx} {
+ # puts "$ndx: [lindex $extra_frames $ndx]"
+ #}
+ send_gdb "backtrace $bt_limit\n"
+ gdb_expect_list $test ".*\[\r\n]+$gdb_prompt $" $extra_frames
+
+
+ # Re-check that bactrace to main.
+
+
+ # Set the backtrace limit.
+
+
+ # Re-set limit to unlimited
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [patch] New test for set backtrace related functionality
2004-10-14 22:41 [patch] New test for set backtrace related functionality Paul Gilliam
@ 2004-10-14 22:47 ` Paul Gilliam
2004-10-21 16:57 ` Paul Gilliam
0 siblings, 1 reply; 10+ messages in thread
From: Paul Gilliam @ 2004-10-14 22:47 UTC (permalink / raw)
To: gdb-patches; +Cc: Andrew Cagney, Michael Chastain
This has been tested on powerpc64-unknown-linux-gnu (in 32-bit mode) and on
i686-pc-linux-gnu
(repost to remove some left over template lines at end)
OK to commit?
-=# Paul Gilliam #=-
2004-10-14 Paul Gilliam <pgilliam@us.ibm.com>
* gdb.base/setbacktrace.c gdb.base/setbacktrace.exp: New files.
*** /dev/null 2004-04-15 13:01:52.000000000 -0700
--- gdb.base/setbacktrace.c 2004-10-14 14:08:52.000000000 -0700
***************
*** 0 ****
--- 1,40 ----
+ /* This testcase is part of GDB, the GNU debugger.
+
+ 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. */
+
+ int
+ factorial (int n)
+ {
+ if (n > 0) { /* marker: factorial */
+ return factorial (n - 1) * n; /* marker: factorial recursion */
+ } else {
+ return 1;
+ }
+ }
+
+ int
+ main (int argc, char *argv[])
+ {
+ int depth = 3;
+
+ if (argc > 1) {
+ depth = atoi(argv[1]);
+ }
+
+ return factorial (depth); /* marker: main call */
+ }
*** /dev/null 2004-04-15 13:01:52.000000000 -0700
--- gdb.base/setbacktrace.exp 2004-10-14 15:43:15.093157912 -0700
***************
*** 0 ****
--- 1,139 ----
+ # This file is part of the gdb testsuite.
+
+ # 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.
+
+ # Check backtrace releated features not tested elsewhere in the testsuit:
+ # * Check that we know what backtrace options are available.
+ # * Check that GDB will only backtrace the requested number of frames.
+ # * Check that GDB doesn't backtrace past main unless asked to do so.
+
+ if $tracelevel {
+ strace $tracelevel
+ }
+
+ set prms_id 0
+ set bug_id 0
+
+ set testfile setbacktrace
+ set srcfile ${testfile}.c
+ set escapedsrcfile [string_to_regexp "${srcdir}/${subdir}/${srcfile}"]
+ set binfile ${objdir}/${subdir}/${testfile}
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable
{debug}] != "" } {
+ untested "Couldn't compile ${testfile}.c"
+ return -1
+ }
+
+ set fact_subr_line_nbr [gdb_get_line_number "marker: factorial"]
+ set fact_recur_line_nbr [gdb_get_line_number "marker: factorial recursion"]
+ set main_subr_line_nbr [gdb_get_line_number "marker: main call"]
+
+ # Set how deep should we go and build the expected_frames pattern list.
+ set leadin ".*\[\r\n\]"
+ set subr_depth 20
+ set expected_frames [list "$leadin#0 factorial \\(n=0\\) at
$escapedsrcfile:$fact_subr_line_nbr"]
+ for {set ndx 1} {$ndx <= $subr_depth} {incr ndx} {
+ lappend expected_frames [format "$leadin#%-2d $hex in factorial
\\(n=$ndx\\) at $escapedsrcfile:$fact_recur_line_nbr" $ndx]
+ }
+ lappend expected_frames [format "$leadin#%-2d $hex in main \\(argc=2,
argv=$hex\\) at $escapedsrcfile:$main_subr_line_nbr" [expr $subr_depth + 1]]
+ #for {set ndx 0} {$ndx < [expr $subr_depth + 2]} {incr ndx} {
+ # puts "$ndx: [lindex $expected_frames $ndx]"
+ #}
+
+
+ # get things started
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+ gdb_test "set args $subr_depth"
+
+
+ # Advance to main
+ if { ![runto_main] } then {
+ gdb_suppress_tests;
+ }
+
+
+ # Check that someone has not snuck in an extra backtrace option, if
+ # they do they will need to fix this and any such fix should also be
+ # accompanied by a corresponding SET test.
+ set test "set backtrace"
+ send_gdb "set backtrace\n"
+ set foobar [list \
+ ".*\[\n\r\]+List of set backtrace subcommands:" \
+ ".*\[\n\r\]+set backtrace limit -- Set an upper bound on the number of
backtrace levels" \
+ ".*\[\n\r\]+set backtrace past-main -- Set whether backtraces should
continue past \"main\"" \
+ ".*\[\n\r\]+Type \"help set backtrace\" followed by set backtrace
subcommand name for full documentation." \
+ ".*\[\n\r\]+Command name abbreviations are allowed if unambiguous."]
+ gdb_expect_list $test ".*$gdb_prompt $" $foobar
+
+ # Create a simple stack.
+ gdb_test "break factorial if n == 0"
+ gdb_continue_to_breakpoint "factorial"
+
+ # Check a backtrace to main (ignore any extra).
+ set test "full backtrace"
+ send_gdb "backtrace\n"
+ gdb_expect_list $test ".*$gdb_prompt $" $expected_frames
+
+
+ # Check a backtrace to main (don't ignore any extra).
+ #setup_kfail *-*-* gdb/1760
+ set test "full backtrace (exact)"
+ send_gdb "backtrace\n"
+ gdb_expect_list $test "\[\n\r\]+$gdb_prompt $" $expected_frames
+
+
+ # Check a backtrace short of main.
+ set test "partial backtrace"
+ set partial_depth [expr int($subr_depth / 2)]
+ set partial_frames [lrange $expected_frames 0 [expr $partial_depth - 1]]
+ lappend partial_frames "\[\n\r\]\\(More stack frames follow\\.\\.\\.\\)"
+ #for {set ndx 0} {$ndx < [expr $partial_depth + 2]} {incr ndx} {
+ # puts "$ndx: [lindex $partial_frames $ndx]"
+ #}
+ send_gdb "backtrace $partial_depth\n"
+ gdb_expect_list $test "\[\n\r\]+$gdb_prompt $" $partial_frames
+
+
+ ## Check a backtrace short of main due to limit.
+ set test "partial backtrace (using limit)"
+ set partial_frames [lrange $expected_frames 0 [expr $partial_depth - 1]]
+ lappend partial_frames "^\[\n\r]+Backtrace limit of $partial_depth exceeded"
+ #for {set ndx 0} {$ndx < [llength $partial_frames]} {incr ndx} {
+ # puts "$ndx: [lindex $partial_frames $ndx]"
+ #}
+ gdb_test "set backtrace limit $partial_depth" ".*" "Set the backtrace limit
to $partial_depth"
+ setup_kfail *-*-* gdb/1760
+ send_gdb "backtrace\n"
+ gdb_expect_list $test "\[\r\n]+$gdb_prompt $" $partial_frames
+
+
+ # Check a backtrace past main, specify a backtrace limit so it does not fall
off the end of the stack.
+ set test "backtrace past main"
+ set bt_limit [expr $subr_depth + 3]
+ gdb_test "set backtrace past-main" ".*" "Set the backtrace past-main"
+ gdb_test "set backtrace limit 0" ".*" "Set the backtrace limit to unlimited"
+ set extra_frames [lrange $expected_frames 0 [expr $subr_depth + 2]]
+ lappend extra_frames [format "$leadin#%-2d $hex in \[^ \]+ \\(\[^\\)]*\\)
\[^\r\n]*" [expr $subr_depth + 2]]
+ lappend extra_frames "\\(More stack frames follow\\.\\.\\.\\)"
+ #for {set ndx 0} {$ndx < [llength $extra_frames]} {incr ndx} {
+ # puts "$ndx: [lindex $extra_frames $ndx]"
+ #}
+ send_gdb "backtrace $bt_limit\n"
+ gdb_expect_list $test ".*\[\r\n]+$gdb_prompt $" $extra_frames
+
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [patch] New test for set backtrace related functionality
2004-10-14 22:47 ` Paul Gilliam
@ 2004-10-21 16:57 ` Paul Gilliam
2004-10-22 15:59 ` Michael Chastain
0 siblings, 1 reply; 10+ messages in thread
From: Paul Gilliam @ 2004-10-21 16:57 UTC (permalink / raw)
To: gdb-patches; +Cc: Michael Chastain
one week ping.
On Thursday 14 October 2004 15:44, Paul Gilliam wrote:
> This has been tested on powerpc64-unknown-linux-gnu (in 32-bit mode) and on
> i686-pc-linux-gnu
> (repost to remove some left over template lines at end)
>
> OK to commit?
>
> -=# Paul Gilliam #=-
>
> 2004-10-14 Paul Gilliam <pgilliam@us.ibm.com>
>
> * gdb.base/setbacktrace.c gdb.base/setbacktrace.exp: New files.
>
> *** /dev/null 2004-04-15 13:01:52.000000000 -0700
> --- gdb.base/setbacktrace.c 2004-10-14 14:08:52.000000000 -0700
> ***************
> *** 0 ****
> --- 1,40 ----
> + /* This testcase is part of GDB, the GNU debugger.
> +
> + 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. */
> +
> + int
> + factorial (int n)
> + {
> + if (n > 0) { /* marker: factorial */
> + return factorial (n - 1) * n; /* marker: factorial recursion */
> + } else {
> + return 1;
> + }
> + }
> +
> + int
> + main (int argc, char *argv[])
> + {
> + int depth = 3;
> +
> + if (argc > 1) {
> + depth = atoi(argv[1]);
> + }
> +
> + return factorial (depth); /* marker: main call */
> + }
> *** /dev/null 2004-04-15 13:01:52.000000000 -0700
> --- gdb.base/setbacktrace.exp 2004-10-14 15:43:15.093157912 -0700
> ***************
> *** 0 ****
> --- 1,139 ----
> + # This file is part of the gdb testsuite.
> +
> + # 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. +
> + # Check backtrace releated features not tested elsewhere in the testsuit:
> + # * Check that we know what backtrace options are available.
> + # * Check that GDB will only backtrace the requested number of frames.
> + # * Check that GDB doesn't backtrace past main unless asked to do so.
> +
> + if $tracelevel {
> + strace $tracelevel
> + }
> +
> + set prms_id 0
> + set bug_id 0
> +
> + set testfile setbacktrace
> + set srcfile ${testfile}.c
> + set escapedsrcfile [string_to_regexp "${srcdir}/${subdir}/${srcfile}"]
> + set binfile ${objdir}/${subdir}/${testfile}
> + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}"
> executable {debug}] != "" } {
> + untested "Couldn't compile ${testfile}.c"
> + return -1
> + }
> +
> + set fact_subr_line_nbr [gdb_get_line_number "marker: factorial"]
> + set fact_recur_line_nbr [gdb_get_line_number "marker: factorial
> recursion"] + set main_subr_line_nbr [gdb_get_line_number "marker: main
> call"] +
> + # Set how deep should we go and build the expected_frames pattern list.
> + set leadin ".*\[\r\n\]"
> + set subr_depth 20
> + set expected_frames [list "$leadin#0 factorial \\(n=0\\) at
> $escapedsrcfile:$fact_subr_line_nbr"]
> + for {set ndx 1} {$ndx <= $subr_depth} {incr ndx} {
> + lappend expected_frames [format "$leadin#%-2d $hex in factorial
> \\(n=$ndx\\) at $escapedsrcfile:$fact_recur_line_nbr" $ndx]
> + }
> + lappend expected_frames [format "$leadin#%-2d $hex in main \\(argc=2,
> argv=$hex\\) at $escapedsrcfile:$main_subr_line_nbr" [expr $subr_depth +
> 1]] + #for {set ndx 0} {$ndx < [expr $subr_depth + 2]} {incr ndx} {
> + # puts "$ndx: [lindex $expected_frames $ndx]"
> + #}
> +
> +
> + # get things started
> + gdb_exit
> + gdb_start
> + gdb_reinitialize_dir $srcdir/$subdir
> + gdb_load ${binfile}
> + gdb_test "set args $subr_depth"
> +
> +
> + # Advance to main
> + if { ![runto_main] } then {
> + gdb_suppress_tests;
> + }
> +
> +
> + # Check that someone has not snuck in an extra backtrace option, if
> + # they do they will need to fix this and any such fix should also be
> + # accompanied by a corresponding SET test.
> + set test "set backtrace"
> + send_gdb "set backtrace\n"
> + set foobar [list \
> + ".*\[\n\r\]+List of set backtrace subcommands:" \
> + ".*\[\n\r\]+set backtrace limit -- Set an upper bound on the number of
> backtrace levels" \
> + ".*\[\n\r\]+set backtrace past-main -- Set whether backtraces should
> continue past \"main\"" \
> + ".*\[\n\r\]+Type \"help set backtrace\" followed by set backtrace
> subcommand name for full documentation." \
> + ".*\[\n\r\]+Command name abbreviations are allowed if unambiguous."]
> + gdb_expect_list $test ".*$gdb_prompt $" $foobar
> +
> + # Create a simple stack.
> + gdb_test "break factorial if n == 0"
> + gdb_continue_to_breakpoint "factorial"
> +
> + # Check a backtrace to main (ignore any extra).
> + set test "full backtrace"
> + send_gdb "backtrace\n"
> + gdb_expect_list $test ".*$gdb_prompt $" $expected_frames
> +
> +
> + # Check a backtrace to main (don't ignore any extra).
> + #setup_kfail *-*-* gdb/1760
> + set test "full backtrace (exact)"
> + send_gdb "backtrace\n"
> + gdb_expect_list $test "\[\n\r\]+$gdb_prompt $" $expected_frames
> +
> +
> + # Check a backtrace short of main.
> + set test "partial backtrace"
> + set partial_depth [expr int($subr_depth / 2)]
> + set partial_frames [lrange $expected_frames 0 [expr $partial_depth - 1]]
> + lappend partial_frames "\[\n\r\]\\(More stack frames follow\\.\\.\\.\\)"
> + #for {set ndx 0} {$ndx < [expr $partial_depth + 2]} {incr ndx} {
> + # puts "$ndx: [lindex $partial_frames $ndx]"
> + #}
> + send_gdb "backtrace $partial_depth\n"
> + gdb_expect_list $test "\[\n\r\]+$gdb_prompt $" $partial_frames
> +
> +
> + ## Check a backtrace short of main due to limit.
> + set test "partial backtrace (using limit)"
> + set partial_frames [lrange $expected_frames 0 [expr $partial_depth - 1]]
> + lappend partial_frames "^\[\n\r]+Backtrace limit of $partial_depth
> exceeded" + #for {set ndx 0} {$ndx < [llength $partial_frames]} {incr ndx}
> { + # puts "$ndx: [lindex $partial_frames $ndx]"
> + #}
> + gdb_test "set backtrace limit $partial_depth" ".*" "Set the backtrace
> limit to $partial_depth"
> + setup_kfail *-*-* gdb/1760
> + send_gdb "backtrace\n"
> + gdb_expect_list $test "\[\r\n]+$gdb_prompt $" $partial_frames
> +
> +
> + # Check a backtrace past main, specify a backtrace limit so it does not
> fall off the end of the stack.
> + set test "backtrace past main"
> + set bt_limit [expr $subr_depth + 3]
> + gdb_test "set backtrace past-main" ".*" "Set the backtrace past-main"
> + gdb_test "set backtrace limit 0" ".*" "Set the backtrace limit to
> unlimited" + set extra_frames [lrange $expected_frames 0 [expr $subr_depth
> + 2]] + lappend extra_frames [format "$leadin#%-2d $hex in \[^ \]+
> \\(\[^\\)]*\\) \[^\r\n]*" [expr $subr_depth + 2]]
> + lappend extra_frames "\\(More stack frames follow\\.\\.\\.\\)"
> + #for {set ndx 0} {$ndx < [llength $extra_frames]} {incr ndx} {
> + # puts "$ndx: [lindex $extra_frames $ndx]"
> + #}
> + send_gdb "backtrace $bt_limit\n"
> + gdb_expect_list $test ".*\[\r\n]+$gdb_prompt $" $extra_frames
> +
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [patch] New test for set backtrace related functionality
2004-10-21 16:57 ` Paul Gilliam
@ 2004-10-22 15:59 ` Michael Chastain
2004-10-22 17:00 ` Paul Gilliam
0 siblings, 1 reply; 10+ messages in thread
From: Michael Chastain @ 2004-10-22 15:59 UTC (permalink / raw)
To: pgilliam, gdb-patches
Paul Gilliam <pgilliam@us.ibm.com> wrote:
> one week ping.
Argh, sorry about that.
Some of the lines in setbacktrace.exp are incorrectly formatted
(weird line wrapping after the '+' markers have been inserted).
you send me a clean copy of the files, by sending them as attachments
perhaps?
Meanwhile I will clean up what I've got and give it a review.
Michael
===
2004-10-14 Paul Gilliam <pgilliam@us.ibm.com>
* gdb.base/setbacktrace.c gdb.base/setbacktrace.exp: New files.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] New test for set backtrace related functionality
2004-10-22 15:59 ` Michael Chastain
@ 2004-10-22 17:00 ` Paul Gilliam
2004-10-22 21:48 ` Michael Chastain
0 siblings, 1 reply; 10+ messages in thread
From: Paul Gilliam @ 2004-10-22 17:00 UTC (permalink / raw)
To: gdb-patches; +Cc: Michael Chastain
[-- Attachment #1: Type: text/plain, Size: 402 bytes --]
On Friday 22 October 2004 08:59, Michael Chastain wrote:
> Paul Gilliam <pgilliam@us.ibm.com> wrote:
> > one week ping.
> ...
> Some of the lines in setbacktrace.exp are incorrectly formatted
> (weird line wrapping after the '+' markers have been inserted).
> you send me a clean copy of the files, by sending them as attachments
> perhaps?
> ...
> Michael
OK, here they are.
Thanks,
-=# Paul #=-
[-- Attachment #2: setbacktrace.c --]
[-- Type: text/x-csrc, Size: 1182 bytes --]
/* This testcase is part of GDB, the GNU debugger.
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. */
int
factorial (int n)
{
if (n > 0) { /* marker: factorial */
return factorial (n - 1) * n; /* marker: factorial recursion */
} else {
return 1;
}
}
int
main (int argc, char *argv[])
{
int depth = 3;
if (argc > 1) {
depth = atoi(argv[1]);
}
return factorial (depth); /* marker: call from main */
}
[-- Attachment #3: setbacktrace.exp --]
[-- Type: text/plain, Size: 5504 bytes --]
# This file is part of the gdb testsuite.
# 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.
# Check backtrace releated features not tested elsewhere in the testsuit:
# * Check that we know what backtrace options are available.
# * Check that GDB will only backtrace the requested number of frames.
# * Check that GDB doesn't backtrace past main unless asked to do so.
if $tracelevel {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile setbacktrace
set srcfile ${testfile}.c
set escapedsrcfile [string_to_regexp "${srcdir}/${subdir}/${srcfile}"]
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "Couldn't compile ${testfile}.c"
return -1
}
set fact_subr_line_nbr [gdb_get_line_number "marker: factorial"]
set fact_recur_line_nbr [gdb_get_line_number "marker: factorial recursion"]
set main_subr_line_nbr [gdb_get_line_number "marker: call from main"]
# Set how deep should we go and build the expected_frames pattern list.
set leadin ".*\[\r\n\]"
set subr_depth 20
set expected_frames [list "$leadin#0 factorial \\(n=0\\) at $escapedsrcfile:$fact_subr_line_nbr"]
for {set ndx 1} {$ndx <= $subr_depth} {incr ndx} {
lappend expected_frames [format "$leadin#%-2d $hex in factorial \\(n=$ndx\\) at $escapedsrcfile:$fact_recur_line_nbr" $ndx]
}
lappend expected_frames [format "$leadin#%-2d $hex in main \\(argc=2, argv=$hex\\) at $escapedsrcfile:$main_subr_line_nbr" [expr $subr_depth + 1]]
#for {set ndx 0} {$ndx < [expr $subr_depth + 2]} {incr ndx} {
# puts "$ndx: [lindex $expected_frames $ndx]"
#}
# get things started
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_test "set args $subr_depth"
# Advance to main
if { ![runto_main] } then {
gdb_suppress_tests;
}
# Check that someone has not snuck in an extra backtrace option, if
# they do they will need to fix this and any such fix should also be
# accompanied by a corresponding SET test.
set test "set backtrace"
send_gdb "set backtrace\n"
set foobar [list \
".*\[\n\r\]+List of set backtrace subcommands:" \
".*\[\n\r\]+set backtrace limit -- Set an upper bound on the number of backtrace levels" \
".*\[\n\r\]+set backtrace past-main -- Set whether backtraces should continue past \"main\"" \
".*\[\n\r\]+Type \"help set backtrace\" followed by set backtrace subcommand name for full documentation." \
".*\[\n\r\]+Command name abbreviations are allowed if unambiguous."]
gdb_expect_list $test ".*$gdb_prompt $" $foobar
# Create a simple stack.
gdb_test "break factorial if n == 0"
gdb_continue_to_breakpoint "factorial"
# Check a backtrace to main (ignore any extra).
set test "full backtrace"
send_gdb "backtrace\n"
gdb_expect_list $test ".*$gdb_prompt $" $expected_frames
# Check a backtrace to main (don't ignore any extra).
#setup_kfail *-*-* gdb/1760
set test "full backtrace (exact)"
send_gdb "backtrace\n"
gdb_expect_list $test "\[\n\r\]+$gdb_prompt $" $expected_frames
# Check a backtrace short of main.
set test "partial backtrace"
set partial_depth [expr int($subr_depth / 2)]
set partial_frames [lrange $expected_frames 0 [expr $partial_depth - 1]]
lappend partial_frames "\[\n\r\]\\(More stack frames follow\\.\\.\\.\\)"
#for {set ndx 0} {$ndx < [expr $partial_depth + 2]} {incr ndx} {
# puts "$ndx: [lindex $partial_frames $ndx]"
#}
send_gdb "backtrace $partial_depth\n"
gdb_expect_list $test "\[\n\r\]+$gdb_prompt $" $partial_frames
## Check a backtrace short of main due to limit.
set test "partial backtrace (using limit)"
set partial_frames [lrange $expected_frames 0 [expr $partial_depth - 1]]
lappend partial_frames "^\[\n\r]+Backtrace limit of $partial_depth exceeded"
#for {set ndx 0} {$ndx < [llength $partial_frames]} {incr ndx} {
# puts "$ndx: [lindex $partial_frames $ndx]"
#}
gdb_test "set backtrace limit $partial_depth" ".*" "Set the backtrace limit to $partial_depth"
setup_kfail *-*-* gdb/1760
send_gdb "backtrace\n"
gdb_expect_list $test "\[\r\n]+$gdb_prompt $" $partial_frames
# Check a backtrace past main, specify a backtrace limit so it does not fall off the end of the stack.
set bt_limit [expr $subr_depth + 3]
gdb_test "set backtrace past-main" ".*" "Set the backtrace past-main"
gdb_test "set backtrace limit 0" ".*" "Set the backtrace limit to unlimited"
set extra_frames [lrange $expected_frames 0 [expr $subr_depth + 2]]
lappend extra_frames [format "$leadin#%-2d $hex in \[^ \]+ \\(\[^\\)]*\\) .*" [expr $subr_depth + 2]]
lappend extra_frames "\\(More stack frames follow\\.\\.\\.\\)"
#for {set ndx 0} {$ndx < [llength $extra_frames]} {incr ndx} {
# puts "$ndx: [lindex $extra_frames $ndx]"
#}
send_gdb "backtrace $bt_limit\n"
gdb_expect_list $test ".*\[\r\n]+$gdb_prompt $" $extra_frames
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [patch] New test for set backtrace related functionality
2004-10-22 17:00 ` Paul Gilliam
@ 2004-10-22 21:48 ` Michael Chastain
2004-10-25 16:32 ` Paul Gilliam
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Michael Chastain @ 2004-10-22 21:48 UTC (permalink / raw)
To: pgilliam, gdb-patches
The design is good, but there are simple implementation nits,
and one implementation problem that I haven't got to the bottom
of yet.
In setbacktrace.c, add a line "#include <stdlib.h>" to get the
declaration of atoi. gcc HEAD does not warn about it today
but it might eventually. :-/
When you name the tests, don't use "(...)" as part of the test name:
set test "set backtrace"
set test "full backtrace"
set test "full backtrace (exact)"
set test "partial backtrace"
set test "partial backtrace (using limit)"
Test names that differ only in that way are hard to talk about.
Similarly, it's bad when one name is a prefix of another name.
How about:
set test "set backtrace"
set test "full backtrace, ignore extra"
set test "full backtrace, exact"
set test "partial backtrace, with argument"
set test "partial backtrace, with limit"
There's a problem with the "partial backtrace (using limit)" test:
set extra_frames [lrange $expected_frames 0 [expr $subr_depth + 2]]
$expected_frames has 22 elements in it, and this call to lrange
asks for elements 0 to 22, which is 23 elements.
Here's the tough problem. I'm getting a weird random timeout on the
"partial backtrace (using limit)" test. In a group of 12
configurations, I saw 2 PASS and 12 FAIL/timeout. I suspect some ".*"
or "[^foo]*" that is too greedy and eating more than it should, leaving
the later bits of the expect_list out to dry. gdb_expect_list is
matching them one at a time so there is no backtracking if an early r.e.
mistakenly eats too much. Specifically, it might be a problem with the
definition of $leadin.
Michael
===
2004-10-14 Paul Gilliam <pgilliam@us.ibm.com>
* gdb.base/setbacktrace.c gdb.base/setbacktrace.exp: New files.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [patch] New test for set backtrace related functionality
2004-10-22 21:48 ` Michael Chastain
@ 2004-10-25 16:32 ` Paul Gilliam
2004-10-26 18:54 ` Paul Gilliam
2004-11-17 22:01 ` Andrew Cagney
2 siblings, 0 replies; 10+ messages in thread
From: Paul Gilliam @ 2004-10-25 16:32 UTC (permalink / raw)
To: gdb-patches; +Cc: Michael Chastain
Michael,
On Friday 22 October 2004 14:48, Michael Chastain wrote:
> The design is good, but there are simple implementation nits,
> and one implementation problem that I haven't got to the bottom
> of yet.
>
> In setbacktrace.c, add a line "#include <stdlib.h>" to get the
> declaration of atoi. gcc HEAD does not warn about it today
> but it might eventually. :-/
>
> When you name the tests, don't use "(...)" as part of the test name:
>
> set test "set backtrace"
> set test "full backtrace"
> set test "full backtrace (exact)"
> set test "partial backtrace"
> set test "partial backtrace (using limit)"
>
> Test names that differ only in that way are hard to talk about.
> Similarly, it's bad when one name is a prefix of another name.
>
> How about:
>
> set test "set backtrace"
> set test "full backtrace, ignore extra"
> set test "full backtrace, exact"
> set test "partial backtrace, with argument"
> set test "partial backtrace, with limit"
Looks good to me.
>
> There's a problem with the "partial backtrace (using limit)" test:
>
> set extra_frames [lrange $expected_frames 0 [expr $subr_depth + 2]]
>
> $expected_frames has 22 elements in it, and this call to lrange
> asks for elements 0 to 22, which is 23 elements.
>
> Here's the tough problem. I'm getting a weird random timeout on the
> "partial backtrace (using limit)" test. In a group of 12
> configurations, I saw 2 PASS and 12 FAIL/timeout. I suspect some ".*"
> or "[^foo]*" that is too greedy and eating more than it should, leaving
> the later bits of the expect_list out to dry. gdb_expect_list is
> matching them one at a time so there is no backtracking if an early r.e.
> mistakenly eats too much. Specifically, it might be a problem with the
> definition of $leadin.
I'll take a close look at this. As a dejagnu/expect tyro, the 'greedy RE'
problem has been a tough one. I hate getting timeouts because they make the
testsuite run so s-l-o-w.
>
> Michael
>
> ===
>
> 2004-10-14 Paul Gilliam <pgilliam@us.ibm.com>
>
> * gdb.base/setbacktrace.c gdb.base/setbacktrace.exp: New files.
Thanks for your review/input: I'll try to turn this around today.
-=# Paul #=-
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] New test for set backtrace related functionality
2004-10-22 21:48 ` Michael Chastain
2004-10-25 16:32 ` Paul Gilliam
@ 2004-10-26 18:54 ` Paul Gilliam
2004-11-08 21:01 ` Paul Gilliam
2004-11-17 22:01 ` Andrew Cagney
2 siblings, 1 reply; 10+ messages in thread
From: Paul Gilliam @ 2004-10-26 18:54 UTC (permalink / raw)
To: Michael Chastain; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 641 bytes --]
Michael,
Here is the latest version of the patch. Sorry I didn't get it turned around
yesterday.
I make a little chage to your suggested test names:
On Friday 22 October 2004 14:48, Michael Chastain wrote:
>
> How about:
>
> set test "set backtrace"
> set test "full backtrace, ignore extra"
> set test "full backtrace, exact"
> set test "partial backtrace, with argument"
> set test "partial backtrace, with limit"
>
set test "partial backtrace, via argument"
set test "partial backtrace, via limit"
I think "via" is better here than "with", but "using" would work well also.
I have attached the new files.
-=# Paul #=-
[-- Attachment #2: setbacktrace.c --]
[-- Type: text/x-csrc, Size: 1198 bytes --]
/* This testcase is part of GDB, the GNU debugger.
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. */
#include <stdlib.h>
int
factorial (int n)
{
if (n > 0) { /* marker: factorial */
return factorial (n - 1) * n; /* marker: factorial recursion */
} else {
return 1;
}
}
int
main (int argc, char *argv[])
{
int depth = 3;
if (argc > 1) {
depth = atoi(argv[1]);
}
return factorial (depth); /* marker: main call */
}
[-- Attachment #3: setbacktrace.exp --]
[-- Type: text/plain, Size: 5550 bytes --]
# This file is part of the gdb testsuite.
# 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.
# Check backtrace releated features not tested elsewhere in the testsuit:
# * Check that we know what backtrace options are available.
# * Check that GDB will only backtrace the requested number of frames.
# * Check that GDB doesn't backtrace past main unless asked to do so.
if $tracelevel {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile setbacktrace
set srcfile ${testfile}.c
set escapedsrcfile [string_to_regexp "${srcdir}/${subdir}/${srcfile}"]
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "Couldn't compile ${testfile}.c"
return -1
}
set fact_subr_line_nbr [gdb_get_line_number "marker: factorial"]
set fact_recur_line_nbr [gdb_get_line_number "marker: factorial recursion"]
set main_subr_line_nbr [gdb_get_line_number "marker: main call"]
# Set how deep should we go and build the expected_frames pattern list.
set leadin "\[^\r\n\]*\[\r\n\]+"
set subr_depth 20
set expected_frames [list "$leadin#0 factorial \\(n=0\\) at $escapedsrcfile:$fact_subr_line_nbr"]
for {set ndx 1} {$ndx <= $subr_depth} {incr ndx} {
lappend expected_frames [format "$leadin#%-2d $hex in factorial \\(n=$ndx\\) at $escapedsrcfile:$fact_recur_line_nbr" $ndx]
}
lappend expected_frames [format "$leadin#%-2d $hex in main \\(argc=2, argv=$hex\\) at $escapedsrcfile:$main_subr_line_nbr" [expr $subr_depth + 1]]
#for {set ndx 0} {$ndx < [expr $subr_depth + 2]} {incr ndx} {
# puts "$ndx: [lindex $expected_frames $ndx]"
#}
# get things started
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_test "set args $subr_depth"
# Advance to main
if { ![runto_main] } then {
gdb_suppress_tests;
}
# Check that someone has not snuck in an extra backtrace option, if
# they do they will need to fix this and any such fix should also be
# accompanied by a corresponding SET test.
set test "set backtrace"
send_gdb "set backtrace\n"
set backtrace_subcommands [list \
"${leadin}List of set backtrace subcommands:" \
"${leadin}set backtrace limit -- Set an upper bound on the number of backtrace levels" \
"${leadin}set backtrace past-main -- Set whether backtraces should continue past \"main\"" \
"${leadin}Type \"help set backtrace\" followed by set backtrace subcommand name for full documentation." \
"${leadin}Command name abbreviations are allowed if unambiguous."]
gdb_expect_list $test ".*$gdb_prompt $" $backtrace_subcommands
# Create a simple stack.
gdb_test "break factorial if n == 0"
gdb_continue_to_breakpoint "factorial"
# Check a backtrace to main (ignore any extra).
set test "full backtrace, ignore extra"
send_gdb "backtrace\n"
gdb_expect_list $test ".*$gdb_prompt $" $expected_frames
# Check a backtrace to main (don't ignore any extra).
#setup_kfail *-*-* gdb/1760
set test "full backtrace, exact"
send_gdb "backtrace\n"
gdb_expect_list $test "\[\n\r\]+$gdb_prompt $" $expected_frames
# Check a backtrace short of main.
set test "partial backtrace, via argument"
set partial_depth [expr int($subr_depth / 2)]
set partial_frames [lrange $expected_frames 0 [expr $partial_depth - 1]]
lappend partial_frames "$leadin\\(More stack frames follow\\.\\.\\.\\)"
#for {set ndx 0} {$ndx < [expr $partial_depth + 2]} {incr ndx} {
# puts "$ndx: [lindex $partial_frames $ndx]"
#}
send_gdb "backtrace $partial_depth\n"
gdb_expect_list $test "$leadin$gdb_prompt $" $partial_frames
## Check a backtrace short of main due to limit.
set test "partial backtrace, via limit"
set partial_frames [lrange $expected_frames 0 [expr $partial_depth - 1]]
lappend partial_frames "^\[\n\r]+Backtrace limit of $partial_depth exceeded"
#for {set ndx 0} {$ndx < [llength $partial_frames]} {incr ndx} {
# puts "$ndx: [lindex $partial_frames $ndx]"
#}
gdb_test "set backtrace limit $partial_depth" ".*" "Set the backtrace limit to $partial_depth"
setup_kfail *-*-* gdb/1760
send_gdb "backtrace\n"
gdb_expect_list $test "\[\r\n]+$gdb_prompt $" $partial_frames
# Check a backtrace past main, specify a backtrace limit so it does not fall off the end of the stack.
set test "backtrace past main"
set bt_limit [expr $subr_depth + 3]
gdb_test "set backtrace past-main" ".*" "Set the backtrace past-main"
gdb_test "set backtrace limit 0" ".*" "Set the backtrace limit to unlimited"
set extra_frames $expected_frames
lappend extra_frames [format "$leadin#%-2d $hex in \[^ \]+ \\(\[^\\)]*\\) \[^\r\n]*" [expr $subr_depth + 2]]
lappend extra_frames "\\(More stack frames follow\\.\\.\\.\\)"
#for {set ndx 0} {$ndx < [llength $extra_frames]} {incr ndx} {
# puts "$ndx: [lindex $extra_frames $ndx]"
#}
send_gdb "backtrace $bt_limit\n"
gdb_expect_list $test "$leadin$gdb_prompt $" $extra_frames
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [patch] New test for set backtrace related functionality
2004-10-26 18:54 ` Paul Gilliam
@ 2004-11-08 21:01 ` Paul Gilliam
0 siblings, 0 replies; 10+ messages in thread
From: Paul Gilliam @ 2004-11-08 21:01 UTC (permalink / raw)
To: gdb-patches; +Cc: Michael Chastain
Michael,
I'ts been two weeks. Please OK this so I can look good on my review 8-)
-=# Paul #=-
On Tuesday 26 October 2004 11:51, Paul Gilliam wrote:
> Michael,
>
> Here is the latest version of the patch. Sorry I didn't get it turned
> around yesterday.
>
> I make a little chage to your suggested test names:
>
> On Friday 22 October 2004 14:48, Michael Chastain wrote:
> > How about:
> >
> > set test "set backtrace"
> > set test "full backtrace, ignore extra"
> > set test "full backtrace, exact"
> > set test "partial backtrace, with argument"
> > set test "partial backtrace, with limit"
>
> set test "partial backtrace, via argument"
> set test "partial backtrace, via limit"
>
> I think "via" is better here than "with", but "using" would work well also.
>
> I have attached the new files.
>
> -=# Paul #=-
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch] New test for set backtrace related functionality
2004-10-22 21:48 ` Michael Chastain
2004-10-25 16:32 ` Paul Gilliam
2004-10-26 18:54 ` Paul Gilliam
@ 2004-11-17 22:01 ` Andrew Cagney
2 siblings, 0 replies; 10+ messages in thread
From: Andrew Cagney @ 2004-11-17 22:01 UTC (permalink / raw)
To: pgilliam; +Cc: Michael Chastain, gdb-patches
> Here's the tough problem. I'm getting a weird random timeout on the
> "partial backtrace (using limit)" test. In a group of 12
> configurations, I saw 2 PASS and 12 FAIL/timeout. I suspect some ".*"
> or "[^foo]*" that is too greedy and eating more than it should, leaving
> the later bits of the expect_list out to dry. gdb_expect_list is
> matching them one at a time so there is no backtracking if an early r.e.
> mistakenly eats too much. Specifically, it might be a problem with the
> definition of $leadin.
Paul, were you able to reproduce this problem?
Andrew
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-11-17 22:01 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-14 22:41 [patch] New test for set backtrace related functionality Paul Gilliam
2004-10-14 22:47 ` Paul Gilliam
2004-10-21 16:57 ` Paul Gilliam
2004-10-22 15:59 ` Michael Chastain
2004-10-22 17:00 ` Paul Gilliam
2004-10-22 21:48 ` Michael Chastain
2004-10-25 16:32 ` Paul Gilliam
2004-10-26 18:54 ` Paul Gilliam
2004-11-08 21:01 ` Paul Gilliam
2004-11-17 22:01 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox