Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: gdb/testsuite/gdb.python/py-framefilter.exp

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/testsuite/gdb.python/py-framefilter.c ('k') | gdb/testsuite/gdb.python/py-framefilter.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/gdb.python/py-framefilter.exp
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
new file mode 100644
index 0000000000000000000000000000000000000000..0bf108b718e68d97cc85243875166ecb5ed307d0
--- /dev/null
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -0,0 +1,241 @@
+# Copyright (C) 2013 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 3 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, see <http://www.gnu.org/licenses/>.
+
+# This file is part of the GDB testsuite. It tests Python-based
+# frame-filters.
+
+load_lib gdb-python.exp
+
+standard_testfile
+
+# We cannot use prepare_for_testing as we have to set the safe-patch
+# to check objfile and progspace printers.
+if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
+ return -1
+}
+
+# Start with a fresh gdb.
+gdb_exit
+gdb_start
+
+# Skip all tests if Python scripting is not enabled.
+if { [skip_python_tests] } { continue }
+
+# Make the -gdb.py script available to gdb, it is automagically loaded by gdb.
+# Care is taken to put it in the same directory as the binary so that
+# gdb will find it.
+set remote_obj_python_file \
+ [remote_download \
+ host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
+ [standard_output_file ${testfile}-gdb.py]]
+
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
+ "set auto-load safe-path"
+gdb_load ${binfile}
+# Verify gdb loaded the script.
+gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*" \
+ "Test auto-load had loaded python scripts"
+
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ return
+}
+gdb_test_no_output "set python print-stack full" \
+ "Set python print-stack to full"
+
+# Load global frame-filters
+set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
+gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+ "Load python file"
+
+gdb_breakpoint [gdb_get_line_number "Backtrace end breakpoint"]
+gdb_breakpoint [gdb_get_line_number "Inner test breakpoint"]
+gdb_continue_to_breakpoint "Inner test breakpoint"
+
+# Test multiple local blocks.
+gdb_test "bt full no-filters" \
+ ".*#0.*end_func.*h = 9.*f = 42.*g = 19.*bar = $hex \"Inside block x2\".*d = 15.*e = 14.*foo = $hex \"Inside block\".*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*" \
+ "bt full no-filters"
+gdb_test "bt full" \
+ ".*#0.*cnuf_dne.*h = 9.*f = 42.*g = 19.*bar = $hex \"Inside block x2\".*d = 15.*e = 14.*foo = $hex \"Inside block\".*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*" \
+ "bt full with filters"
+
+gdb_continue_to_breakpoint "Backtrace end breakpoint"
+
+# Test set/show
+gdb_test "info frame-filter" \
+ ".*900.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \
+ "info frame filter before setting priority"
+gdb_test "show frame-filter priority global Elider" \
+ "Priority of filter 'Elider' in list 'global' is: 900" \
+ "show frame-filter priority global Elider before setting"
+gdb_test_no_output "set frame-filter priority global Elider 1000" \
+ "set frame-filter priotiy global Elider 1000"
+gdb_test "show frame-filter priority global Elider" \
+ "Priority of filter 'Elider' in list 'global' is: 1000" \
+ "show frame-filter priority global Elider after setting"
+gdb_test "info frame-filter" \
+ ".*1000.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \
+ "info frame filter after setting priority"
+
+# Test enable/disable
+gdb_test "info frame-filter" \
+ ".*1000.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \
+ "info frame filter before disable frame filter"
+gdb_test_no_output "disable frame-filter global Elider" \
+ "disable frame-filter global Elider"
+gdb_test "info frame-filter" \
+ ".*1000.*No.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \
+ "info frame filter after disable frame filter"
+gdb_test_no_output "enable frame-filter global Elider" \
+ "enable frame-filter global Elider"
+gdb_test "info frame-filter" \
+ ".*1000.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \
+ "info frame filter after reenabling frame filter"
+
+# Test no-filters
+gdb_test "bt no-filters" \
+ ".*#0.*end_func.*#22.*in func1.*#27.*in main \\(\\).*" \
+ "bt no-filters"
+
+# Test reverse
+gdb_test "bt" \
+ ".*#0.*cnuf_dne.*#22.*in 1cnuf.*#27.*in niam \\(\\).*" \
+ "bt with frame filters"
+
+# Disable Reverse
+gdb_test_no_output "disable frame-filter global Reverse" \
+ "disable frame-filter global Reverse"
+gdb_test "bt" \
+ ".*#0.*end_func.*#22.*in func1.*#27.*in main \\(\\).*" \
+ "bt with frame-filter Reverse disabled"
+gdb_test "bt -2" \
+ ".*#26.*func5.*#27.*in main \\(\\).*" \
+ "bt -2 with frame-filter Reverse disabled"
+gdb_test "bt 3" \
+ ".*#0.*end_func.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*" \
+ "bt 3 with frame-filter Reverse disabled"
+gdb_test "bt no-filter full" \
+ ".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*" \
+ "bt no-filters full with Reverse disabled"
+gdb_test "bt full" \
+ ".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*#22.*in func1 \\(\\).*#23.*in func2 \\(f=3\\).*elided = $hex \"Elided frame\".*fb = \{nothing = $hex \"Elided Foo Bar\", f = 84, s = 38\}.*bf = $hex.*" \
+ "bt full with Reverse disabled"
+
+# Test set print frame-arguments
+# none
+gdb_test_no_output "set print frame-arguments none" \
+ "turn off frame arguments"
+gdb_test "bt no-filter 1" \
+ "#0.*end_func \\(foo=\.\.\., bar=\.\.\., fb=\.\.\., bf=\.\.\.\\) at .*py-framefilter.c.*" \
+ "bt no-filter 1 no args"
+gdb_test "bt 1" \
+ "#0.*end_func \\(foo=\.\.\., bar=\.\.\., fb=\.\.\., bf=\.\.\.\\) at .*py-framefilter.c.*" \
+ "bt 1 no args"
+
+# scalars
+gdb_test_no_output "set print frame-arguments scalars" \
+ "turn frame arguments to scalars only"
+gdb_test "bt no-filter 1" \
+ "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\.\.\.\\) at .*py-framefilter.c.*" \
+ "bt no-filter 1 scalars"
+gdb_test "bt 1" \
+ "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\.\.\.\\) at .*py-framefilter.c.*" \
+ "bt 1 scalars"
+
+# all
+gdb_test_no_output "set print frame-arguments all" \
+ "turn on frame arguments"
+gdb_test "bt no-filter 1" \
+ "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\{nothing = $hex \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \
+ "bt no-filter 1 all args"
+gdb_test "bt 1" \
+ "#0.*end_func \\(foo=21, bar=$hex \"Param\", fb=$hex, bf=\{nothing = $hex \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \
+ "bt 1 all args"
+
+# set print address off
+gdb_test_no_output "set print address off" \
+ "Turn off address printing"
+gdb_test "bt no-filter 1" \
+ "#0 end_func \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \
+ "bt no-filter 1 no address"
+gdb_test "bt 1" \
+ "#0 end_func \\(foo=21, bar=\"Param\", fb=, bf=\{nothing = \"Foo Bar\", f = 42, s = 19\}\\) at .*py-framefilter.c.*" \
+ "bt 1 no addresss"
+
+remote_file host delete ${remote_python_file}
+
+# Test with no debuginfo
+
+# We cannot use prepare_for_testing as we have to set the safe-patch
+# to check objfile and progspace printers.
+if {[build_executable $testfile.exp $testfile $srcfile {nodebug}] == -1} {
+ return -1
+}
+
+# Start with a fresh gdb.
+gdb_exit
+gdb_start
+
+# Skip all tests if Python scripting is not enabled.
+if { [skip_python_tests] } { continue }
+
+# Make the -gdb.py script available to gdb, it is automagically loaded by gdb.
+# Care is taken to put it in the same directory as the binary so that
+# gdb will find it.
+set remote_obj_python_file \
+ [remote_download \
+ host ${srcdir}/${subdir}/${testfile}-gdb.py.in \
+ [standard_output_file ${testfile}-gdb.py]]
+
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \
+ "set auto-load safe-path for no debug info"
+gdb_load ${binfile}
+
+# Verify gdb loaded the script.
+gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*" \
+ "Set autoload path for no debug info tests"
+if ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ return
+}
+
+gdb_test_no_output "set python print-stack full" \
+ "set python print-stack full for no debuginfo tests"
+
+# Load global frame-filters
+set remote_python_file [gdb_remote_download host \
+ ${srcdir}/${subdir}/${testfile}.py]
+gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
+ "Load python file for no debuginfo tests"
+
+# Disable Reverse
+gdb_test_no_output "disable frame-filter global Reverse" \
+ "disable frame-filter gloval Reverse for no debuginfo"
+gdb_test "bt" \
+ ".*#0..*in main \\(\\).*" \
+ "bt for no debuginfo"
+gdb_test "bt full" \
+ ".*#0..*in main \\(\\).*" \
+ "bt full for no debuginfo"
+gdb_test "bt no-filters" \
+ ".*#0..*in main \\(\\).*" \
+ "bt no filters for no debuginfo"
+gdb_test "bt no-filters full" \
+ ".*#0..*in main \\(\\).*" \
+ "bt no-filters full no debuginfo"
« no previous file with comments | « gdb/testsuite/gdb.python/py-framefilter.c ('k') | gdb/testsuite/gdb.python/py-framefilter.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698