aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-02-07 19:42:27 +0000
committerTom Tromey <tromey@redhat.com>2012-02-07 19:42:27 +0000
commit64e7d9dddc00228cdbcecdd4c053cf83cf6608b7 (patch)
tree81e5d325950872985aca39c9bf8ea390c04261b1 /gdb/testsuite
parent1d6b2d2b4a864c478fb6a46e15a29859641fe788 (diff)
downloadbinutils-64e7d9dddc00228cdbcecdd4c053cf83cf6608b7.zip
binutils-64e7d9dddc00228cdbcecdd4c053cf83cf6608b7.tar.gz
binutils-64e7d9dddc00228cdbcecdd4c053cf83cf6608b7.tar.bz2
PR python/13599:
* python/py-symbol.c (sympy_line): New function. (symbol_object_getset): Add "line". gdb/doc * gdb.texinfo (Symbols In Python): Document Symbol.line. gdb/testsuite * gdb.python/py-symbol.c (qq): New global. * gdb.python/py-symbol.exp: Add test for frame-less lookup_symbol. * gdb.python/py-symtab.exp: Fix line number.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.python/py-symbol.c2
-rw-r--r--gdb/testsuite/gdb.python/py-symbol.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-symtab.exp5
4 files changed, 16 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index cbaca89..39a952c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2012-01-31 Tom Tromey <tromey@redhat.com>
+
+ * gdb.python/py-symbol.c (qq): New global.
+ * gdb.python/py-symbol.exp: Add test for frame-less
+ lookup_symbol.
+ * gdb.python/py-symtab.exp: Fix line number.
+
2012-02-03 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/mi_task_arg: New testcase.
diff --git a/gdb/testsuite/gdb.python/py-symbol.c b/gdb/testsuite/gdb.python/py-symbol.c
index 72469be..d29849b 100644
--- a/gdb/testsuite/gdb.python/py-symbol.c
+++ b/gdb/testsuite/gdb.python/py-symbol.c
@@ -35,6 +35,8 @@ class SimpleClass
};
#endif
+int qq; /* line of qq */
+
int func (int arg)
{
int i = 2;
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index b0e73c3..154eb37 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -42,6 +42,10 @@ 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\")"
+set qq_line [gdb_get_line_number "line of qq"]
+gdb_test "python print gdb.lookup_symbol('qq')\[0\].line" "$qq_line" \
+ "print line number of qq"
+
if ![runto_main] then {
fail "Can't run to main"
return 0
diff --git a/gdb/testsuite/gdb.python/py-symtab.exp b/gdb/testsuite/gdb.python/py-symtab.exp
index f64cb57..490a891 100644
--- a/gdb/testsuite/gdb.python/py-symtab.exp
+++ b/gdb/testsuite/gdb.python/py-symtab.exp
@@ -43,7 +43,8 @@ if ![runto_main] then {
global hex decimal
# Setup and get the symbol table.
-gdb_breakpoint [gdb_get_line_number "Block break here."]
+set line_no [gdb_get_line_number "Block break here."]
+gdb_breakpoint $line_no
gdb_continue_to_breakpoint "Block break here."
gdb_py_test_silent_cmd "python frame = gdb.selected_frame()" "Get Frame" 0
gdb_py_test_silent_cmd "python sal = frame.find_sal()" "Get block" 0
@@ -52,7 +53,7 @@ gdb_py_test_silent_cmd "python symtab = sal.symtab" "Get block" 0
# Test sal.
gdb_test "python print sal.symtab" ".*gdb.python/py-symbol.c.*" "Test symtab"
gdb_test "python print sal.pc" "${decimal}" "Test sal.pc"
-gdb_test "python print sal.line" "42" "Test sal.line"
+gdb_test "python print sal.line" "$line_no" "Test sal.line"
gdb_test "python print sal.is_valid()" "True" "Test sal.is_valid"
# Test symbol table.