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

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

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 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-symbol.c ('k') | gdb/testsuite/gdb.python/py-symtab.exp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/gdb.python/py-symbol.exp
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index aa952fb45b73bd71607a01c4012c3064328a1c40..bc20ee471dbf8e25c13acc8fcc1c8bceb2419656 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -16,26 +16,14 @@
# This file is part of the GDB testsuite. It tests the mechanism
# exposing values to Python.
-if $tracelevel then {
- strace $tracelevel
-}
-
load_lib gdb-python.exp
-set testfile "py-symbol"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "Couldn't compile ${srcfile}"
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
return -1
}
-# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
@@ -46,6 +34,21 @@ gdb_py_test_silent_cmd "python main_func = gdb.lookup_global_symbol(\"main\")" "
gdb_test "python print main_func.is_function" "True" "Test main_func.is_function"
gdb_test "python print gdb.lookup_global_symbol(\"junk\")" "None" "Test lookup_global_symbol(\"junk\")"
+gdb_test "python print gdb.lookup_global_symbol('main').value()" "$hex .main." \
+ "print value of main"
+
+set qq_line [gdb_get_line_number "line of qq"]
+gdb_test "python print gdb.lookup_global_symbol('qq').line" "$qq_line" \
+ "print line number of qq"
+
+gdb_test "python print gdb.lookup_global_symbol('qq').value()" "72" \
+ "print value of qq"
+
+gdb_test "python print gdb.lookup_global_symbol('qq').needs_frame" \
+ "False" \
+ "print whether qq needs a frame"
+
+
if ![runto_main] then {
fail "Can't run to main"
return 0
@@ -88,6 +91,14 @@ gdb_test "python print a\[0\].is_argument" "False" "Test a.is_argument"
gdb_test "python print a\[0\].is_function" "False" "Test a.is_function"
gdb_test "python print a\[0\].addr_class == gdb.SYMBOL_LOC_COMPUTED" "True" "Test a.addr_class"
+gdb_test "python print a\[0\].value()" \
+ "symbol requires a frame to compute its value.*"\
+ "try to print value of a without a frame"
+gdb_test "python print a\[0\].value(frame)" "0" \
+ "print value of a"
+gdb_test "python print a\[0\].needs_frame" "True" \
+ "print whether a needs a frame"
+
# Test is_constant attribute
gdb_py_test_silent_cmd "python t = gdb.lookup_symbol(\"one\")" "Get variable a" 0
gdb_test "python print t\[0\].is_variable" "False" "Test t.is_variable"
« no previous file with comments | « gdb/testsuite/gdb.python/py-symbol.c ('k') | gdb/testsuite/gdb.python/py-symtab.exp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698