diff options
author | Phil Muldoon <pmuldoon@redhat.com> | 2010-11-11 14:11:56 +0000 |
---|---|---|
committer | Phil Muldoon <pmuldoon@redhat.com> | 2010-11-11 14:11:56 +0000 |
commit | 84f4c1fe0525fb92c79216087fd8c1744aafb203 (patch) | |
tree | e0e39dbcff436c9fadf5c6b6b347d46166e8a96b /gdb/testsuite | |
parent | 95a2c8d6f73bc3c7ac6641b2cbe9a7d7deefada8 (diff) | |
download | gdb-84f4c1fe0525fb92c79216087fd8c1744aafb203.zip gdb-84f4c1fe0525fb92c79216087fd8c1744aafb203.tar.gz gdb-84f4c1fe0525fb92c79216087fd8c1744aafb203.tar.bz2 |
2010-11-11 Phil Muldoon <pmuldoon@redhat.com>
* python/py-breakpoint.c (BPPY_REQUIRE_VALID): Check if bp is
NULL.
(BPPY_SET_REQUIRE_VALID): Ditto.
(bpnum_is_valid): Delete function.
(bppy_get_visibility): New function.
(bppy_new): Parse for, and validate internal keyword. Pass
internal keyword to breakpoint or watchpoint functions.
(build_bp_list): New function.
(gdbpy_breakpoints): Rewrite. Use build_bp_list and
iterate_over_breakpoints.
(gdbpy_breakpoint_created): Rewrite. Do not store breakpoints in a
look-aside vector.
(gdbpy_breakpoint_deleted): Rewrite, defer breakpoint management
to internal breakpoint chain.
* breakpoint.c (set_breakpoint_number): New function.
(breakpoint_1): Check if breakpoint number is more than zero.
(set_raw_breakpoint_without_location): Set py_bp_object to NULL.
(create_breakpoint_sal): Take a new parameter called internal.
Call set_breakpoint_number with internal parameter. Do not
mention internal breakpoints. All callers updated.
(create_breakpoint): Ditto.
(create_breakpoints_sal): Ditto.
(watch_command_1): Ditto.
(watch_command_wrapper): Take a new parameter called internal.
All callers updated.
(rwatch_command_wrapper): Ditto.
(awatch_command_wrapper): Ditto.
(save_breakpoints): Update breakpoint save condition check.
(iterate_over_breakpoints): New function.
* breakpoint.h: Add conditional python includes. Add py_bp_object
and comment to struct breakpoint. Update all callers.
* defs.h: Add PyObject definition for GDB builds without Python.
2010-11-11 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Breakpoints In Python): Document "internal"
parameter, and visible attribute.
2010-11-11 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-breakpoint.exp: Add internal watchpoint and
breakpoint tests.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-breakpoint.exp | 39 |
2 files changed, 44 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index dae986b..11b86ad 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-11-11 Phil Muldoon <pmuldoon@redhat.com> + + * gdb.python/py-breakpoint.exp: Add internal watchpoint and + breakpoint tests. + 2010-11-09 Pedro Alves <pedro@codesourcery.com> * gdb.base/watchpoint.exp: Test "watch -location" with an diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp index 7da94c4..d030b55 100644 --- a/gdb/testsuite/gdb.python/py-breakpoint.exp +++ b/gdb/testsuite/gdb.python/py-breakpoint.exp @@ -117,6 +117,33 @@ gdb_test "end" gdb_py_test_silent_cmd "python blist = gdb.breakpoints()" "Get Breakpoint List" 0 gdb_test "python print blist\[len(blist)-1\].commands" "print \"Command for breakpoint has been executed.\".*print result" +# Start with a fresh gdb. +clean_restart ${testfile} + +if ![runto_main] then { + fail "Cannot run to main." + return 0 +} + +# Test invisible breakpooints. +delete_breakpoints +set ibp_location [gdb_get_line_number "Break at multiply."] +gdb_py_test_silent_cmd "python ibp = gdb.Breakpoint(\"$ibp_location\", internal=False)" "Set invisible breakpoint" 0 +gdb_py_test_silent_cmd "python ilist = gdb.breakpoints()" "Get Breakpoint List" 0 +gdb_test "python print ilist\[0\]" "<gdb.Breakpoint object at $hex>" "Check invisible bp obj exists" +gdb_test "python print ilist\[0\].location" "py-breakpoint\.c:$ibp_location*" "Check breakpoint location" +gdb_test "python print ilist\[0\].visible" "True" "Check breakpoint visibility" +gdb_test "info breakpoints" "py-breakpoint\.c:$ibp_location.*" "Check info breakpoints shows visible breakpoints" +delete_breakpoints +gdb_py_test_silent_cmd "python ibp = gdb.Breakpoint(\"$ibp_location\", internal=True)" "Set invisible breakpoint" 0 +gdb_py_test_silent_cmd "python ilist = gdb.breakpoints()" "Get Breakpoint List" 0 +gdb_test "python print ilist\[0\]" "<gdb.Breakpoint object at $hex>" "Check invisible bp obj exists" +gdb_test "python print ilist\[0\].location" "py-breakpoint\.c:$ibp_location*" "Check breakpoint location" +gdb_test "python print ilist\[0\].visible" "False" "Check breakpoint visibility" +gdb_test "info breakpoints" "No breakpoints or watchpoints.*" "Check info breakpoints does not show invisible breakpoints" +gdb_test "maint info breakpoints" "py-breakpoint\.c:$ibp_location.*" "Check maint info breakpoints shows invisible breakpoints" + + # Watchpoints # Start with a fresh gdb. clean_restart ${testfile} @@ -134,5 +161,17 @@ if ![runto_main] then { gdb_py_test_silent_cmd "python wp1 = gdb.Breakpoint (\"result\", type=gdb.BP_WATCHPOINT, wp_class=gdb.WP_WRITE )" "Set watchpoint" 0 gdb_test "continue" ".*\[Ww\]atchpoint.*result.*Old value = 0.*New value = 25.*main.*" "Test watchpoint write" +# Internal breakpoints. +# Start with a fresh gdb. +clean_restart ${testfile} +if ![runto_main] then { + fail "Cannot run to main." + return 0 +} +delete_breakpoints +gdb_py_test_silent_cmd "python wp1 = gdb.Breakpoint (\"result\", type=gdb.BP_WATCHPOINT, wp_class=gdb.WP_WRITE, internal=True )" "Set watchpoint" 0 +gdb_test "info breakpoints" "No breakpoints or watchpoints.*" "Check info breakpoints does not show invisible breakpoints" +gdb_test "maint info breakpoints" ".*hw watchpoint.*result.*" "Check maint info breakpoints shows invisible breakpoints" +gdb_test "continue" ".*\[Ww\]atchpoint.*result.*Old value = 0.*New value = 25.*" "Test watchpoint write" |