diff options
author | Siva Chandra Reddy <sivachandra@sourceware.org> | 2012-05-03 07:07:26 +0000 |
---|---|---|
committer | Siva Chandra Reddy <sivachandra@sourceware.org> | 2012-05-03 07:07:26 +0000 |
commit | a20ee7a4a9d43404d9c566453ba6c9578adc3596 (patch) | |
tree | ad28669e5464e65e747e23099c0c793830d9b9ab /gdb/testsuite | |
parent | bf2f0858b16a808a504f519e22b8f14aaa76cc10 (diff) | |
download | gdb-a20ee7a4a9d43404d9c566453ba6c9578adc3596.zip gdb-a20ee7a4a9d43404d9c566453ba6c9578adc3596.tar.gz gdb-a20ee7a4a9d43404d9c566453ba6c9578adc3596.tar.bz2 |
2012-05-03 Siva Chandra Reddy <sivachandra@google.com>
Add two new methods global_block and static_block to gdb.Symtab
objects.
* NEWS (Python scripting): Add entry about the new methods.
* python/py-symtab.c (stpy_global_block): New function which
implements the gdb.Symtab.global_block() method.
(stpy_static_block): New function which implements the
gdb.Symtab.static_block() method.
(symtab_object_methods): Add entries for the two new methods.
* testsuite/gdb.python/py-symbol.exp: Add tests to test the new
methods gdb.Symtab.global_block() and gdb.Symtab.static_block().
* tessuite/gdb.python/py-symbol.c: Add new struct to help test
gdb.Symtab.static_block().
* doc/gdb.texinfo (Symbol Tables In Python): Add documentation
about the new methods global_block and static_block on
gdb.Symtab objects.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-symbol.c | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-symtab.exp | 11 |
3 files changed, 24 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 568b00e..c89e6b9 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2012-05-03 Siva Chandra Reddy <sivachandra@google.com> + + * gdb.python/py-symbol.exp: Add tests to test the new methods + gdb.Symtab.global_block() and gdb.Symtab.static_block(). + * gdb.python/py-symbol.c: Add new struct to help test + gdb.Symtab.static_block(). + 2012-05-03 Doug Evans <dje@google.com> * gdb.dwarf2/pr13961.S: Add file and source location, but leave diff --git a/gdb/testsuite/gdb.python/py-symbol.c b/gdb/testsuite/gdb.python/py-symbol.c index 4c1c26d..8c6cdb1 100644 --- a/gdb/testsuite/gdb.python/py-symbol.c +++ b/gdb/testsuite/gdb.python/py-symbol.c @@ -44,6 +44,11 @@ int func (int arg) return arg; /* Block break here. */ } +struct simple_struct +{ + int a; +}; + int main (int argc, char *argv[]) { #ifdef __cplusplus @@ -51,6 +56,7 @@ int main (int argc, char *argv[]) #endif int a = 0; int result; + struct simple_struct ss = { 10 }; enum tag {one, two, three}; enum tag t = one; diff --git a/gdb/testsuite/gdb.python/py-symtab.exp b/gdb/testsuite/gdb.python/py-symtab.exp index 490a891..6eec611 100644 --- a/gdb/testsuite/gdb.python/py-symtab.exp +++ b/gdb/testsuite/gdb.python/py-symtab.exp @@ -49,6 +49,11 @@ 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 gdb_py_test_silent_cmd "python symtab = sal.symtab" "Get block" 0 +gdb_py_test_silent_cmd "python global_block = symtab.global_block()" "Get global block" 0 +gdb_py_test_silent_cmd "python static_block = symtab.static_block()" "Get static block" 0 +gdb_py_test_silent_cmd "python global_symbols = \[\]; static_symbols = \[\]" "Set up symbol name lists" 0 +gdb_py_test_silent_cmd "python for sym in global_block: global_symbols.append(sym.name)" "Get global symbol names" 0 +gdb_py_test_silent_cmd "python for sym in static_block: static_symbols.append(sym.name)" "Get static symbol names" 0 # Test sal. gdb_test "python print sal.symtab" ".*gdb.python/py-symbol.c.*" "Test symtab" @@ -61,6 +66,12 @@ gdb_test "python print symtab.filename" ".*gdb.python/py-symbol.c.*" "Test symta gdb_test "python print symtab.objfile" "<gdb.Objfile object at ${hex}>" "Test symtab.objfile" gdb_test "python print symtab.fullname()" "testsuite/gdb.python/py-symbol.c.*" "Test symtab.fullname" gdb_test "python print symtab.is_valid()" "True" "Test symtab.is_valid()" +gdb_test "python print \"qq\" in global_symbols" "True" "Test qq in global symbols" +gdb_test "python print \"func\" in global_symbols" "True" "Test func in global symbols" +gdb_test "python print \"main\" in global_symbols" "True" "Test main in global symbols" +gdb_test "python print \"int\" in static_symbols" "True" "Test int in static symbols" +gdb_test "python print \"char\" in static_symbols" "True" "Test char in static symbols" +gdb_test "python print \"simple_struct\" in static_symbols" "True" "Test simple_struct in static symbols" # Test is_valid when the objfile is unloaded. This must be the last # test as it unloads the object file in GDB. |