public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  tromey/python-checker: add gdb_python_initialized test case
@ 2013-05-07 18:33 tromey
  0 siblings, 0 replies; 2+ messages in thread
From: tromey @ 2013-05-07 18:33 UTC (permalink / raw)
  To: archer-commits

The branch, tromey/python-checker has been updated
  discards  97555d151da89029f17b7e55bc62ff99ff77a545 (commit)
       via  3174923353fd4cb820e8d7e5fdef43ff99b7f0ed (commit)
      from  97555d151da89029f17b7e55bc62ff99ff77a545 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 3174923353fd4cb820e8d7e5fdef43ff99b7f0ed
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Apr 22 12:11:11 2013 -0600

    add gdb_python_initialized test case
    
    	* gdb.gdb/python-selftest.exp: New file.

-----------------------------------------------------------------------

Summary of changes:
 gdb/testsuite/gdb.gdb/python-selftest.exp |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.gdb/python-selftest.exp b/gdb/testsuite/gdb.gdb/python-selftest.exp
index 71d5b61..1138ec6 100644
--- a/gdb/testsuite/gdb.gdb/python-selftest.exp
+++ b/gdb/testsuite/gdb.gdb/python-selftest.exp
@@ -13,10 +13,6 @@
 # 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 was written by Andrew Cagney (cagney at redhat dot com),
-# derived from xfullpath.exp (written by Joel Brobecker), derived from
-# selftest.exp (written by Rob Savoye).
-
 load_lib selftest-support.exp
 load_lib gdb-python.exp
 


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [SCM]  tromey/python-checker: add gdb_python_initialized test case
@ 2013-04-22 18:28 tromey
  0 siblings, 0 replies; 2+ messages in thread
From: tromey @ 2013-04-22 18:28 UTC (permalink / raw)
  To: archer-commits

The branch, tromey/python-checker has been updated
  discards  fa023ab4689d4a363e0f5c9967fecbb29717566a (commit)
  discards  fe12a8e7fa42bec61e7a6abf77bfbc0de9aa572a (commit)
  discards  7f16ed19218609150579ec82f92c66b9d738b1f7 (commit)
  discards  da487190a16554ea31b742ca14084ee900b31dcb (commit)
  discards  f2438b02cc98b1546a3841961a0fccab305e64ef (commit)
  discards  9c470d286cd4fdaff20def6dda68a06d9cf8a947 (commit)
  discards  c8900023d96f1f829d0fcd795b16cde2c11a5648 (commit)
  discards  d1a094b4ccf0ff51683e20049a93a907907cf7e1 (commit)
  discards  ac6fcd7f576bdbcd02f294bba29a9f0feec88246 (commit)
  discards  ae8d0299e414c8f0c652791cb70e7cd73f9c0835 (commit)
  discards  2779a3998f7a841f219ea25da696b6b606a90b46 (commit)
  discards  2ce0ffee4a83b9e965f6f891ae15ad005331bb53 (commit)
  discards  8d65ef5d84b128321e70aace683d20f359461251 (commit)
  discards  7fde3b789f826efb195a3194fa59a57ee003daa1 (commit)
  discards  d8980c0d080a750e1b5509acace209176d67f9bd (commit)
  discards  f09ac8e4ddb94788f254bd00164f76ec7e2aee44 (commit)
  discards  7b2412d18e4188ddfe97add2a78e11832da1ad0c (commit)
  discards  7fe12f1d9d0440bd8b7195f7ca53b54813fff364 (commit)
  discards  b84683dc77199b1815b7a6819d8b47a0d5861b76 (commit)
  discards  676494ee0576bdad2685db76959b4ff8352b1c70 (commit)
  discards  6d966f5aef5fc0bbebbc66c87f7eb456da9f0bab (commit)
  discards  b839f7ae0424d75acd9640a9c7a2306919d10cb9 (commit)
  discards  d7dd74b3174444dfbc31c95864541e3c86a3dfd3 (commit)
  discards  8e3952ac4b801b7656da99952ef1299729368bef (commit)
       via  97555d151da89029f17b7e55bc62ff99ff77a545 (commit)
       via  7b014fea57c4efd58feed859337e7cbb6e98255b (commit)
       via  5ebb349a9c76f9b94a069808761676af7d5f7bdc (commit)
       via  02e32f49198c48671357b7a5530c6168e1d81f85 (commit)
       via  59010f16b41d4d43ce75031681dc5fc2b729cbe2 (commit)
       via  dacb74ab70be90148b26a99974958066d62b290f (commit)
       via  536776f3624c892c0559a2c0a208ca00d3977e83 (commit)
       via  a5ebe4ba7aff9a183362c05686439929f2f44038 (commit)
       via  6e64e1f8b02f5124ba557cd5e80d3dbc43e6b2fa (commit)
       via  a6162a2bbb686dbb6d7eaf7cc1bc4b0be9a02ccb (commit)
       via  bf352e7752372d2bf6a56284cf8475ce0c474b23 (commit)
       via  d7132a0df4d4a4c450b894ea995322fb6d286b7d (commit)
       via  c0542bf4e2bb06b43716478dc5f518d0574cf4d5 (commit)
       via  fc3f299509b4152002d1cebb59a9d3c0550853f8 (commit)
       via  0a63efb8f35317dec8f2a23c48b3bdd02303c472 (commit)
       via  72160bd8b3af45159f5dcb815f7d111e0e7470b7 (commit)
       via  6180eef24f4f6d1d56276a35c1c0beaa064f8292 (commit)
       via  4092177c7418bf274eb68a916dc914c410ac6cb4 (commit)
       via  3846047ef87507f24a163d9548aaa7076d4eaa05 (commit)
       via  d41b5b6279287713ff8422b1181b374499c9f452 (commit)
       via  d7ebaae39d428938ff9b4bf4db40354ea5cfd268 (commit)
       via  ae6472bbbc457e44b3f65880e24a336f7b993d80 (commit)
       via  548502a238f1d2441df24b58a22270e684ce38d5 (commit)
       via  1551ff30681c01c611ead8adc83a13ad51fec86a (commit)
       via  ab94c68b85c108abc846153ed4d3315df22417e4 (commit)
       via  8091b73a70c56a7be474c23efa2a8ab598a7b186 (commit)
       via  c2dee2f4e0c0665fe308e596969d5bb3076fdc09 (commit)
      from  fa023ab4689d4a363e0f5c9967fecbb29717566a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 97555d151da89029f17b7e55bc62ff99ff77a545
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Apr 22 12:11:11 2013 -0600

    add gdb_python_initialized test case
    
    	* gdb.gdb/python-selftest.exp: New file.

commit 7b014fea57c4efd58feed859337e7cbb6e98255b
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Apr 22 11:50:35 2013 -0600

    consolidate some code in gdb.gdb
    
    This patch consolidates some code in gdb.gdb.  This makes it simpler
    to add new self-tests.
    
    	* lib/selftest-support.exp: New file.
    	* gdb.gdb/complaints.exp: Load selftest-support.exp.  Use
    	do_self_tests.
    	(setup_test, find_gdb): Remove.
    	* gdb.gdb/observer.exp: Load selftest-support.exp.  Use
    	do_self_tests.
    	(setup_test, find_gdb): Remove.
    	(test_observer): Don't call setup_test.  Remove argument.
    	* gdb.gdb/selftest.exp: Load selftest-support.exp.
    	(find_gdb): Remove.
    	* gdb.gdb/complaints.exp: Load selftest-support.exp.  Use
    	do_self_tests.
    	(setup_test, find_gdb): Remove.
    	(test_with_self): Don't call setup_test.  Remove argument.

commit 5ebb349a9c76f9b94a069808761676af7d5f7bdc
Author: Tom Tromey <tromey@redhat.com>
Date:   Fri Apr 19 09:04:08 2013 -0600

    decref fix in python.c
    
    	* python/python.c (finish_python_initialization): Decref
    	'pythondir' on failure path as well.

commit 02e32f49198c48671357b7a5530c6168e1d81f85
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Apr 18 12:51:02 2013 -0600

    fix refcount bug in search_pp_list
    
    The checker noticed a missing decref in search_pp_list.
    
    	* python/py-prettyprint.c (search_pp_list): Decref 'attr'.

commit 59010f16b41d4d43ce75031681dc5fc2b729cbe2
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Apr 18 12:50:46 2013 -0600

    rearrange for some clarity in valpy_get_dynamic_type
    
    The checker noticed some funny code in valpy_get_dynamic_type.  This
    simplifies the code a little and also changes an incref to an xincref;
    the current code could crash if type_to_type_object failed.
    
    	* python/py-value.c (valpy_get_dynamic_type): Simplify
    	dynamic_type assignment.  Use Py_XINCREF.

commit dacb74ab70be90148b26a99974958066d62b290f
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Apr 18 12:32:24 2013 -0600

    fix refcount bug in typy_fields
    
    The checker found a bug in typy_fields -- we leaked a reference in one
    path.
    
    	* python/py-type.c (typy_fields): Unconditionally decref 'r'.

commit 536776f3624c892c0559a2c0a208ca00d3977e83
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Apr 18 11:40:47 2013 -0600

    some py-frame.c changes to make the checker work better
    
    The checker complained about some code in py-frame.c that was simple
    to refactor into a digestible form.
    
    	* python/py-frame.c (frapy_older, frapy_newer, gdbpy_newest_frame)
    	(gdbpy_selected_frame): Move object-construction code
    	out of TRY_CATCH.

commit a5ebe4ba7aff9a183362c05686439929f2f44038
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Apr 18 11:26:10 2013 -0600

    introduce gdb_pymodule_addobject
    
    The checker pointed out that this common idiom in gdb is wrong:
    
    -  Py_INCREF (&arch_object_type);
    -  return PyModule_AddObject (gdb_module, "Architecture",
    -			     (PyObject *) &arch_object_type);
    
    This is buggy because if PyModule_AddObject fails, then the reference
    will not be stolen.  So, the object will be leaked.
    
    This isn't extremely important, as such failures probably won't
    actually happen.  Nevertheless it is better to be clean; and also
    remove false reports from the checker.
    
    This patch does so by introducing a wrapper function for
    PyModule_AddObject that doesn't steal a reference.
    
    	* python/py-arch.c (gdbpy_initialize_arch): Use
    	gdb_pymodule_addobject.
    	* python/py-block.c (gdbpy_initialize_blocks): Use
    	gdb_pymodule_addobject.
    	* python/py-breakpoint.c (gdbpy_initialize_breakpoints): Use
    	gdb_pymodule_addobject.
    	* python/py-cmd.c (gdbpy_initialize_breakpoints): Use
    	gdb_pymodule_addobject.
    	* python/py-event.c (gdbpy_initialize_event_generic): Use
    	gdb_pymodule_addobject.
    	* python/py-evtregistry.c (gdbpy_initialize_eventregistry): Use
    	gdb_pymodule_addobject.
    	* python/py-evts.c (add_new_registry): Use
    	gdb_pymodule_addobject.
    	(gdbpy_initialize_py_events): Likewise.
    	* python/py-finishbreakpoint.c
    	(gdbpy_initialize_finishbreakpoints): Use
    	gdb_pymodule_addobject.
    	* python/py-frame.c (gdbpy_initialize_frames): Use
    	gdb_pymodule_addobject.
    	* python/py-function.c (gdbpy_initialize_functions): Use
    	gdb_pymodule_addobject.
    	* python/py-inferior.c (gdbpy_initialize_inferior): Use
    	gdb_pymodule_addobject.
    	* python/py-infthread.c (gdbpy_initialize_thread): Use
    	gdb_pymodule_addobject.
    	* python/py-objfile.c (gdbpy_initialize_objfile): Use
    	gdb_pymodule_addobject.
    	* python/py-param.c (gdbpy_initialize_parameters): Use
    	gdb_pymodule_addobject.
    	* python/py-progspace.c (gdbpy_initialize_pspace): Use
    	gdb_pymodule_addobject.
    	* python/py-symbol.c (gdbpy_initialize_symbols): Use
    	gdb_pymodule_addobject.
    	* python/py-symtab.c (gdbpy_initialize_symtabs): Use
    	gdb_pymodule_addobject.
    	* python/py-type.c (gdbpy_initialize_types): Use
    	gdb_pymodule_addobject.
    	* python/py-utils.c (gdb_pymodule_addobject): New function.
    	* python/py-value.c (gdbpy_initialize_values): Use
    	gdb_pymodule_addobject.
    	* python/python-internal.h (gdb_pymodule_addobject): Declare.
    	* python/python.c (_initialize_python): Use
    	gdb_pymodule_addobject.

commit 6e64e1f8b02f5124ba557cd5e80d3dbc43e6b2fa
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Apr 18 10:52:17 2013 -0600

    use explicit decrefs rather than cleanups in some cases
    
    The checker doesn't understand cleanups, and probably never will.
    However, in a few places, I think we use cleanups where explicit
    decref calls are just as clean.  So, this patch changes those spots
    and silences the checker.
    
    There are other spots using decref cleanups that can't readily be
    changed.  For example, the pretty-printing code calls into parts of
    gdb that can throw, and so cleanups must be used.
    
    	* python/py-cmd.c (cmdpy_completer): Use explicit decref.
    	* python/py-param.c (get_set_value, get_show_value): Use
    	explicit decrefs.
    	* python/python.c (start_type_printers, apply_type_printers):
    	Use explicit decrefs.

commit a6162a2bbb686dbb6d7eaf7cc1bc4b0be9a02ccb
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Apr 18 08:53:14 2013 -0600

    remove erroneous incref from gdbpy_initialize_py_events
    
    The checker noticed a bogus incref in gdbpy_initialize_py_events.
    
    	* python/py-evts.c (gdbpy_initialize_py_events): Don't
    	incref the module.

commit bf352e7752372d2bf6a56284cf8475ce0c474b23
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Apr 18 07:46:18 2013 -0600

    fix refcounting in gdbpy_run_events
    
    The checker noticed a missing decref in gdbpy_run_events.
    
    	* python/python.c (gdbpy_run_events): Decref the result
    	of PyObject_CallObject.

commit d7132a0df4d4a4c450b894ea995322fb6d286b7d
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 14:43:26 2013 -0600

    make set_sal follow negative result convention
    
    This changes set_sal to follow the "negative means error" convention.
    This lets the checker understand it.
    
    	* python/py-symtab.c (set_sal): Use
    	CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.  Return -1 on error.
    	(symtab_and_line_to_sal_object): Update.

commit c0542bf4e2bb06b43716478dc5f518d0574cf4d5
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 14:35:18 2013 -0600

    add missing decref in py-param.c
    
    The checker found a missing decref in compute_enum_values.
    
    	* python/py-param.c (compute_enum_values): Decref 'item'.

commit fc3f299509b4152002d1cebb59a9d3c0550853f8
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 13:31:38 2013 -0600

    check gdb_python_initialized everywhere
    
    This patch changes the rest of gdb to use gdb_python_initialized.  It
    also changes ensure_python_env to throw an exception if Python is not
    initialized.  In some spots no other checks were needed -- there is no
    way to reach some of the calls to ensure_python_env unless some
    previous call into Python was made.
    
    value_get_print_value had to be reindented, which is why that part of
    the patch looks odd.
    
    	* mi/mi-main.c: Include python-internal.h.
    	(mi_cmd_list_features): Check gdb_python_initialized.
    	* python/py-inferior.c (python_on_normal_stop, python_on_resume)
    	(python_inferior_exit, python_new_objfile, add_thread_object)
    	(delete_thread_object, py_free_inferior): Check
    	gdb_python_initialized.
    	* python/py-prettyprint.c (apply_val_pretty_printer): Check
    	gdb_python_initialized.
    	* python/py-type.c (save_objfile_types): Check
    	gdb_python_initialized.
    	* python/python-internal.h (gdb_python_initialized): Declare.
    	* python/python.c (ensure_python_env): Throw exception if
    	Python not initialized.
    	(before_prompt_hook, source_python_script_for_objfile)
    	(start_type_printers, apply_type_printers,
    	free_type_printers): Check gdb_python_initialized.
    	* varobj.c (varobj_get_display_hint)
    	(dynamic_varobj_has_child_method, update_dynamic_varobj_children)
    	(install_new_value_visualizer, varobj_set_visualizer)
    	(value_get_print_value): Check gdb_python_initialized.

commit 0a63efb8f35317dec8f2a23c48b3bdd02303c472
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 13:12:59 2013 -0600

    convert python init functions to do error-checking
    
    The checker pointed out that we did not do Python error checking in
    any of our module initialization functions.  There is no deep reason
    for this -- just that it is common in the Python world to work this
    way.  However, it seems cleaner to me to be correct, and it makes the
    checker quieter besides.
    
    This changes nearly all of the Python initialization functions to
    return -1 on error.
    
    This also introduces gdb_python_initialized, which is set to a
    non-zero value if initialization went properly.  A subsequent patch
    will use this to disable Python support if initialization failed.
    
    	* python/py-arch.c (gdbpy_initialize_arch): Return 'int'.
    	Check errors.
    	* python/py-auto-load.c (gdbpy_initialize_auto_load): Return 'int'.
    	* python/py-block.c (gdbpy_initialize_blocks): Return 'int'.
    	Check errors.
    	* python/py-breakpoint.c (gdbpy_initialize_breakpoints): Return 'int'.
    	Check errors.
    	* python/py-cmd.c (gdbpy_initialize_commands): Return 'int'.
    	Check errors.
    	* python/py-event.c (gdbpy_initialize_event): Return 'int'.
    	Check errors.
    	* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Change generated
    	init function to return 'int'.
    	* python/py-evtregistry.c (gdbpy_initialize_eventregistry):
    	Return 'int'.  Check errors.
    	* python/py-evts.c (gdbpy_initialize_py_events): Return 'int'.
    	Check errors.
    	* python/py-finishbreakpoint.c (gdbpy_initialize_finishbreakpoints):
    	Return 'int'.  Check errors.
    	* python/py-frame.c (gdbpy_initialize_frames): Return 'int'.
    	Check errors.
    	* python/py-function.c (gdbpy_initialize_functions): Return 'int'.
    	Check errors.
    	* python/py-gdb-readline.c (gdbpy_initialize_gdb_readline):
    	Check errors.
    	* python/py-inferior.c (gdbpy_initialize_inferior): Return 'int'.
    	Check errors.
    	* python/py-infthread.c (gdbpy_initialize_thread): Return 'int'.
    	Check errors.
    	* python/py-lazy-string.c (gdbpy_initialize_lazy_string): Return 'int'.
    	Check errors.
    	* python/py-objfile.c (gdbpy_initialize_objfile): Return 'int'.
    	Check errors.
    	* python/py-param.c (gdbpy_initialize_parameters): Return 'int'.
    	Check errors.
    	* python/py-progspace.c (gdbpy_initialize_pspace): Return 'int'.
    	Check errors.
    	* python/py-symbol.c (gdbpy_initialize_symbols): Return 'int'.
    	Check errors.
    	* python/py-symtab.c (gdbpy_initialize_symtabs): Return 'int'.
    	Check errors.
    	* python/py-type.c (gdbpy_initialize_types): Return 'int'.
    	Check errors.
    	* python/py-value.c (gdbpy_initialize_values): Return 'int'.
    	Check errors.
    	* python/python-internal.h (gdbpy_initialize_auto_load,
    	gdbpy_initialize_values, gdbpy_initialize_frames,
    	gdbpy_initialize_symtabs, gdbpy_initialize_commands,
    	gdbpy_initialize_symbols, gdbpy_initialize_symtabs,
    	gdbpy_initialize_blocks, gdbpy_initialize_types,
    	gdbpy_initialize_functions, gdbpy_initialize_pspace,
    	gdbpy_initialize_objfile, gdbpy_initialize_breakpoints,
    	gdbpy_initialize_finishbreakpoints,
    	gdbpy_initialize_lazy_string, gdbpy_initialize_parameters,
    	gdbpy_initialize_thread, gdbpy_initialize_inferior,
    	gdbpy_initialize_eventregistry, gdbpy_initialize_event,
    	gdbpy_initialize_py_events, gdbpy_initialize_stop_event,
    	gdbpy_initialize_signal_event,
    	gdbpy_initialize_breakpoint_event,
    	gdbpy_initialize_continue_event,
    	gdbpy_initialize_exited_event, gdbpy_initialize_thread_event,
    	gdbpy_initialize_new_objfile_event, gdbpy_initialize_arch):
    	Update.  Use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.
    	* python/python.c (gdb_python_initialized): New global.
    	(gdbpy_initialize_events): Return 'int'.  Check errors.
    	(_initialize_python): Check errors.  Set
    	gdb_python_initialized.

commit 72160bd8b3af45159f5dcb815f7d111e0e7470b7
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 12:20:47 2013 -0600

    reference count in bpfinishpy_out_of_scope
    
    The checker noticed a missing decref in bpfinishpy_out_of_scope.
    
    	* python/py-finishbreakpoint.c (bpfinishpy_out_of_scope):
    	Decref the reslut of PyObject_CallMethod.

commit 6180eef24f4f6d1d56276a35c1c0beaa064f8292
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 12:05:32 2013 -0600

    fix bug in gdbpy_initialize_event_generic
    
    The checker noticed that gdbpy_initialize_event_generic could do an
    extra decref of 'type' if PyType_Ready failed.  This fixes the bug.
    
    	* python/py-event.c (gdbpy_initialize_event_generic): Return
    	early if PyType_Ready fails.

commit 4092177c7418bf274eb68a916dc914c410ac6cb4
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 10:29:30 2013 -0600

    add gdb_assert_not_reached
    
    This patch adds a gdb_assert_not_reached to a switch in
    make_fielditem.  This avoids a checker complaint.
    
    	* python/py-type.c (make_fielditem): Add gdb_assert_not_reached
    	as 'default' in the switch.

commit 3846047ef87507f24a163d9548aaa7076d4eaa05
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 10:23:52 2013 -0600

    fix get_addr_from_python
    
    get_addr_from_python confused the checker and so I decided to change
    it to a form that it found more palatable.  In particular now it
    returns a negative value on error (using
    CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION), and it can no longer throw
    a gdb exception.  This let me hoist calls to it out of some
    TRY_CATCHes.
    
    	* python/py-inferior.c (gdbpy_inferiors): Update.  Hoist
    	get_addr_from_python calls out of TRY_CATCH.
    	(infpy_write_memory, infpy_search_memory): Likewise.
    	* python/py-utils.c (get_addr_from_python): Return negative
    	value on error.  Use TRY_CATCH.
    	* python/python-internal.h (get_addr_from_python): Use
    	CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.

commit d41b5b6279287713ff8422b1181b374499c9f452
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 09:31:55 2013 -0600

    add decref in evpy_emit_event
    
    The checker noticed a missing decref in evpy_emit_event.
    
    	* python/py-event.c (evpy_emit_event): Decref the
    	result of PyObject_CallFunctionObjArgs.

commit d7ebaae39d428938ff9b4bf4db40354ea5cfd268
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 09:12:51 2013 -0600

    use iterator protocol and avoid refcount bugs
    
    The checker pointed out some refcounting bugs in cmdpy_completer.
    And, while looking at it, I noticed that it was not using the iterator
    protocol.  I couldn't think of a reason why not; and using an iterator
    cleaned up the code, so this patch does that.
    
    	* python/py-cmd.c (cmdpy_completer): Use iterator protocol.
    	Correctly decref.

commit ae6472bbbc457e44b3f65880e24a336f7b993d80
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 08:56:13 2013 -0600

    add decref to cmdpy_init
    
    The checker pointed out some missing decrefs in cmdpy_init.
    This patch adds them.
    
    	* python/py-cmd.c (cmdpy_init): Decref 'ds_obj'.

commit 548502a238f1d2441df24b58a22270e684ce38d5
Author: Tom Tromey <tromey@redhat.com>
Date:   Wed Apr 17 08:52:35 2013 -0600

    introduce and use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
    
    The checker provides an attribute that indicates that a function sets
    the Python exception if it returns a negative value.  This patch
    introduces a new macro for this attribute and changes gdb to use it
    where appropriate.
    
    	* python/py-event.h (gdbpy_initialize_event_generic): Use
    	CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.
    	* python/py-evts.c (add_new_registry): Use
    	CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.
    	* python/python-internal.h
    	(CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION): New macro.

commit 1551ff30681c01c611ead8adc83a13ad51fec86a
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Mar 4 08:45:17 2013 -0700

    use CPYCHECKER_SETS_EXCEPTION
    
    The checker defines an attribute that can be used to indicate that a
    function sets the Python exception.
    
    This patch introduces a new macro for this attribute and changes gdb
    to use it.  I also changed gdbpy_convert_exception to return 'void'.
    This is friendlier to the checker, which didn't recognize our current
    convention; but also turns out to clean up the code a little.
    
    	* python/py-arch.c (archpy_disassemble): Update.
    	* python/py-type.c (typy_get_composite, typy_lookup_typename)
    	(typy_lookup_type): Use GDB_PY_HANDLE_EXCEPTION.
    	* python/py-utils.c (gdbpy_convert_exception): Return 'void'.
    	* python/python-internal.h (CPYCHECKER_SETS_EXCEPTION): New
    	macro.
    	(GDB_PY_HANDLE_EXCEPTION): Update.
    	(gdbpy_convert_exception): Update.  Use CPYCHECKER_SETS_EXCEPTION.

commit ab94c68b85c108abc846153ed4d3315df22417e4
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Mar 4 07:45:33 2013 -0700

    remove unused declaration
    
    I happened to notice that we declare but do not define
    events_object_type.  This removes it.
    
    	* python/python-internal.h (events_object_type): Remove.

commit 8091b73a70c56a7be474c23efa2a8ab598a7b186
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Apr 22 12:23:48 2013 -0600

    add CPYCHECKER_STEALS_REFERENCE_TO_ARG
    
    The checker provides an attribute that can be used to indicate that a
    function steals a reference to an argument.  This patch adds a macro
    for this attribute to gdb and changes one spot to use it.
    
            * python/py-event.h (evpy_emit_event): Use
            CPYCHECKER_STEALS_REFERENCE_TO_ARG.
            * python/python-internal.h (CPYCHECKER_STEALS_REFERENCE_TO_ARG):
            New macro.

commit c2dee2f4e0c0665fe308e596969d5bb3076fdc09
Author: Tom Tromey <tromey@redhat.com>
Date:   Mon Apr 22 12:23:19 2013 -0600

    fix py-evtregistry.c refcount bug
    
    The checker found a refcounting bug in py-evtregistry.c.
    
    	* py-evtregistry.c (create_event_object): Decref
    	eventregistry_object if PyList_New fails.

-----------------------------------------------------------------------

Summary of changes:
 gdb/testsuite/gdb.gdb/complaints.exp               |  126 +-----------------
 gdb/testsuite/gdb.gdb/observer.exp                 |  125 +-----------------
 gdb/testsuite/gdb.gdb/python-selftest.exp          |   34 +++++
 gdb/testsuite/gdb.gdb/selftest.exp                 |   24 +----
 gdb/testsuite/gdb.gdb/xfullpath.exp                |  125 +-----------------
 .../xfullpath.exp => lib/selftest-support.exp}     |  138 +++++++-------------
 6 files changed, 96 insertions(+), 476 deletions(-)
 create mode 100644 gdb/testsuite/gdb.gdb/python-selftest.exp
 copy gdb/testsuite/{gdb.gdb/xfullpath.exp => lib/selftest-support.exp} (55%)

First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp
index f298725..932dfd5 100644
--- a/gdb/testsuite/gdb.gdb/complaints.exp
+++ b/gdb/testsuite/gdb.gdb/complaints.exp
@@ -17,6 +17,7 @@
 # derived from xfullpath.exp (written by Joel Brobecker), derived from
 # selftest.exp (written by Rob Savoye).
 
+load_lib selftest-support.exp
 
 # are we on a target board
 if { [is_remote target] || ![isnative] } then {
@@ -28,79 +29,6 @@ if [target_info exists gdb,noinferiorio] {
     return
 }
 
-proc setup_test { executable } {
-    global gdb_prompt
-    global timeout
-    global INTERNAL_GDBFLAGS
-
-    # load yourself into the debugger
-    # This can take a relatively long time, particularly for testing where
-    # the executable is being accessed over a network, or where gdb does not
-    # support partial symbols for a particular target and has to load the
-    # entire symbol table.  Set the timeout to 10 minutes, which should be
-    # adequate for most environments (it *has* timed out with 5 min on a
-    # SPARCstation SLC under moderate load, so this isn't unreasonable).
-    # After gdb is started, set the timeout to 30 seconds for the duration
-    # of this test, and then back to the original value.
-
-    set oldtimeout $timeout
-    set timeout 600
-    verbose "Timeout is now $timeout seconds" 2
-
-    global gdb_file_cmd_debug_info
-    set gdb_file_cmd_debug_info "unset"
-
-    set result [gdb_load $executable]
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-
-    if { $result != 0 } then {
-	return -1
-    }
-
-    if { $gdb_file_cmd_debug_info != "debug" } then {
-	untested "No debug information, skipping testcase."
-	return -1
-    }
-
-    # Set a breakpoint at main
-    gdb_test "break captured_command_loop" \
-            "Breakpoint.*at.* file.*, line.*" \
-            "breakpoint in captured_command_loop"
-
-    # run yourself
-    # It may take a very long time for the inferior gdb to start (lynx),
-    # so we bump it back up for the duration of this command.
-    set timeout 600
-
-    set description "run until breakpoint at captured_command_loop"
-    gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
-        -re "Starting program.*Breakpoint \[0-9\]+,.*captured_command_loop .data.* at .*main.c:.*$gdb_prompt $" {
-            pass "$description"
-        }
-        -re "Starting program.*Breakpoint \[0-9\]+,.*captured_command_loop .data.*$gdb_prompt $" {
-            xfail "$description (line numbers scrambled?)"
-        }
-        -re "vfork: No more processes.*$gdb_prompt $" {
-            fail "$description (out of virtual memory)"
-            set timeout $oldtimeout
-            verbose "Timeout is now $timeout seconds" 2
-            return -1
-        }
-        -re ".*$gdb_prompt $" {
-            fail "$description"
-            set timeout $oldtimeout
-            verbose "Timeout is now $timeout seconds" 2
-            return -1
-        }
-    }
-
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-
-    return 0
-}
-
 proc test_initial_complaints { } {
 
     global gdb_prompt
@@ -221,51 +149,9 @@ proc test_empty_complaints { } {
     return 0
 }
 
-# Find a pathname to a file that we would execute if the shell was asked
-# to run $arg using the current PATH.
-
-proc find_gdb { arg } {
-
-    # If the arg directly specifies an existing executable file, then
-    # simply use it.
-
-    if [file executable $arg] then {
-	return $arg
-    }
-
-    set result [which $arg]
-    if [string match "/" [ string range $result 0 0 ]] then {
-	return $result
-    }
-
-    # If everything fails, just return the unqualified pathname as default
-    # and hope for best.
-
-    return $arg
-}
-
-# Run the test with self.
-# Copy the file executable file in case this OS doesn't like to edit its own
-# text space.
-
-set GDB_FULLPATH [find_gdb $GDB]
-
-# Remove any old copy lying around.
-remote_file host delete x$tool
-
-gdb_start
-
-set file [remote_download host $GDB_FULLPATH x$tool]
-
-set setup_result [setup_test $file ]
-if {$setup_result <0} then {
-    return -1
+do_self_tests captured_command_loop {
+    test_initial_complaints
+    test_serial_complaints
+    test_short_complaints
+    test_empty_complaints
 }
-
-test_initial_complaints
-test_serial_complaints
-test_short_complaints
-test_empty_complaints
-
-gdb_exit;
-catch "remote_file host delete $file";
diff --git a/gdb/testsuite/gdb.gdb/observer.exp b/gdb/testsuite/gdb.gdb/observer.exp
index 9397146..32030d8 100644
--- a/gdb/testsuite/gdb.gdb/observer.exp
+++ b/gdb/testsuite/gdb.gdb/observer.exp
@@ -16,85 +16,13 @@
 # This file was written by Joel Brobecker (brobecker@gnat.com), derived
 # from xfullpath.exp.
 
+load_lib selftest-support.exp
 
 # are we on a target board
 if { [is_remote target] || ![isnative] } then {
     return
 }
 
-proc setup_test { executable } {
-    global gdb_prompt
-    global timeout
-    global INTERNAL_GDBFLAGS
-
-    # load yourself into the debugger
-    # This can take a relatively long time, particularly for testing where
-    # the executable is being accessed over a network, or where gdb does not
-    # support partial symbols for a particular target and has to load the
-    # entire symbol table.  Set the timeout to 10 minutes, which should be
-    # adequate for most environments (it *has* timed out with 5 min on a
-    # SPARCstation SLC under moderate load, so this isn't unreasonable).
-    # After gdb is started, set the timeout to 30 seconds for the duration
-    # of this test, and then back to the original value.
-
-    set oldtimeout $timeout
-    set timeout 600
-    verbose "Timeout is now $timeout seconds" 2
-
-    global gdb_file_cmd_debug_info
-    set gdb_file_cmd_debug_info "unset"
-
-    set result [gdb_load $executable]
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-
-    if { $result != 0 } then {
-	return -1
-    }
-
-    if { $gdb_file_cmd_debug_info != "debug" } then {
-	untested "No debug information, skipping testcase."
-	return -1
-    }
-
-    # Set a breakpoint at main
-    gdb_test "break captured_main" \
-            "Breakpoint.*at.* file.*, line.*" \
-            "breakpoint in captured_main"
-
-    # run yourself
-    # It may take a very long time for the inferior gdb to start (lynx),
-    # so we bump it back up for the duration of this command.
-    set timeout 600
-
-    set description "run until breakpoint at captured_main"
-    gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
-        -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" {
-            pass "$description"
-        }
-        -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.*$gdb_prompt $" {
-            xfail "$description (line numbers scrambled?)"
-        }
-        -re "vfork: No more processes.*$gdb_prompt $" {
-            fail "$description (out of virtual memory)"
-            set timeout $oldtimeout
-            verbose "Timeout is now $timeout seconds" 2
-            return -1
-        }
-        -re ".*$gdb_prompt $" {
-            fail "$description"
-            set timeout $oldtimeout
-            verbose "Timeout is now $timeout seconds" 2
-            return -1
-        }
-    }
-
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-
-    return 0
-}
-
 proc attach_first_observer { message } {
     gdb_test_no_output "set \$first_obs = observer_attach_test_notification (&observer_test_first_notification_function)" \
 	"$message; attach first observer"
@@ -160,13 +88,7 @@ proc test_notifications { first second third message args } {
     check_counters $first $second $third $message
 }
 
-proc test_observer { executable } {
-
-    set setup_result [setup_test $executable]
-    if {$setup_result <0} then {
-        return -1
-    }
-
+proc test_observer {} {
     # First, try sending a notification without any observer attached.
     test_notifications 0 0 0 "no observer attached"
 
@@ -223,45 +145,4 @@ proc test_observer { executable } {
     return 0
 }
 
-# Find a pathname to a file that we would execute if the shell was asked
-# to run $arg using the current PATH.
-
-proc find_gdb { arg } {
-
-    # If the arg directly specifies an existing executable file, then
-    # simply use it.
-
-    if [file executable $arg] then {
-	return $arg
-    }
-
-    set result [which $arg]
-    if [string match "/" [ string range $result 0 0 ]] then {
-	return $result
-    }
-
-    # If everything fails, just return the unqualified pathname as default
-    # and hope for best.
-
-    return $arg
-}
-
-# Run the test with self.
-# Copy the file executable file in case this OS doesn't like to edit its own
-# text space.
-
-set GDB_FULLPATH [find_gdb $GDB]
-
-# Remove any old copy lying around.
-remote_file host delete x$tool
-
-gdb_start
-set file [remote_download host $GDB_FULLPATH x$tool]
-set result [test_observer $file];
-gdb_exit;
-catch "remote_file host delete $file";
-
-if {$result <0} then {
-    warning "Couldn't test self"
-    return -1
-}
+do_self_tests captured_main test_observer
diff --git a/gdb/testsuite/gdb.gdb/python-selftest.exp b/gdb/testsuite/gdb.gdb/python-selftest.exp
new file mode 100644
index 0000000..71d5b61
--- /dev/null
+++ b/gdb/testsuite/gdb.gdb/python-selftest.exp
@@ -0,0 +1,34 @@
+# Copyright 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 was written by Andrew Cagney (cagney at redhat dot com),
+# derived from xfullpath.exp (written by Joel Brobecker), derived from
+# selftest.exp (written by Rob Savoye).
+
+load_lib selftest-support.exp
+load_lib gdb-python.exp
+
+proc selftest_python {} {
+    if {[skip_python_tests]} {
+	return -1
+    }
+
+    gdb_test_no_output "set variable gdb_python_initialized = 0"
+    gdb_test "call catch_command_errors(execute_command, \"python print 5\", 0, RETURN_MASK_ALL)" \
+	"Python not initialized.* = 0"
+    return 0
+}
+
+do_self_tests captured_command_loop selftest_python
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
index 55e13cf..b3350fa 100644
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -15,6 +15,7 @@
 
 # This file was written by Rob Savoye. (rob@cygnus.com)
 
+load_lib selftest-support.exp
 
 # are we on a target board
 if { [is_remote target] || ![isnative] } then {
@@ -468,29 +469,6 @@ proc test_with_self { executable } {
     return 0
 }
 
-# Find a pathname to a file that we would execute if the shell was asked
-# to run $arg using the current PATH.
-
-proc find_gdb { arg } {
-
-    # If the arg directly specifies an existing executable file, then
-    # simply use it.
-
-    if [file executable $arg] then {
-	return $arg
-    }
-
-    set result [which $arg]
-    if [string match "/" [ string range $result 0 0 ]] then {
-	return $result
-    }
-
-    # If everything fails, just return the unqualified pathname as default
-    # and hope for best.
-
-    return $arg
-}
-
 # Run the test with self.
 # Copy the file executable file in case this OS doesn't like to edit its own
 # text space.
diff --git a/gdb/testsuite/gdb.gdb/xfullpath.exp b/gdb/testsuite/gdb.gdb/xfullpath.exp
index 9516a4f..5bc01c6 100644
--- a/gdb/testsuite/gdb.gdb/xfullpath.exp
+++ b/gdb/testsuite/gdb.gdb/xfullpath.exp
@@ -16,92 +16,14 @@
 # This file was written by Joel Brobecker. (brobecker@gnat.com), derived
 # from selftest.exp, written by Rob Savoye.
 
+load_lib selftest-support.exp
 
 # are we on a target board
 if { [is_remote target] || ![isnative] } then {
     return
 }
 
-proc setup_test { executable } {
-    global gdb_prompt
-    global timeout
-    global INTERNAL_GDBFLAGS
-
-    # load yourself into the debugger
-    # This can take a relatively long time, particularly for testing where
-    # the executable is being accessed over a network, or where gdb does not
-    # support partial symbols for a particular target and has to load the
-    # entire symbol table.  Set the timeout to 10 minutes, which should be
-    # adequate for most environments (it *has* timed out with 5 min on a
-    # SPARCstation SLC under moderate load, so this isn't unreasonable).
-    # After gdb is started, set the timeout to 30 seconds for the duration
-    # of this test, and then back to the original value.
-
-    set oldtimeout $timeout
-    set timeout 600
-    verbose "Timeout is now $timeout seconds" 2
-
-    global gdb_file_cmd_debug_info
-    set gdb_file_cmd_debug_info "unset"
-
-    set result [gdb_load $executable]
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-
-    if { $result != 0 } then {
-	return -1
-    }
-
-    if { $gdb_file_cmd_debug_info != "debug" } then {
-	untested "No debug information, skipping testcase."
-	return -1
-    }
-
-    # Set a breakpoint at main
-    gdb_test "break captured_main" \
-            "Breakpoint.*at.* file.*, line.*" \
-            "breakpoint in captured_main"
-
-    # run yourself
-    # It may take a very long time for the inferior gdb to start (lynx),
-    # so we bump it back up for the duration of this command.
-    set timeout 600
-
-    set description "run until breakpoint at captured_main"
-    gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
-        -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" {
-            pass "$description"
-        }
-        -re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.*$gdb_prompt $" {
-            xfail "$description (line numbers scrambled?)"
-        }
-        -re "vfork: No more processes.*$gdb_prompt $" {
-            fail "$description (out of virtual memory)"
-            set timeout $oldtimeout
-            verbose "Timeout is now $timeout seconds" 2
-            return -1
-        }
-        -re ".*$gdb_prompt $" {
-            fail "$description"
-            set timeout $oldtimeout
-            verbose "Timeout is now $timeout seconds" 2
-            return -1
-        }
-    }
-
-    set timeout $oldtimeout
-    verbose "Timeout is now $timeout seconds" 2
-
-    return 0
-}
-
-proc test_with_self { executable } {
-
-    set setup_result [setup_test $executable]
-    if {$setup_result <0} then {
-        return -1
-    }
-
+proc test_with_self {} {
     # A file which contains a directory prefix
     gdb_test "print gdb_realpath (\"./xfullpath.exp\")" \
              ".\[0-9\]+ =.*\".*/xfullpath.exp\"" \
@@ -140,45 +62,4 @@ proc test_with_self { executable } {
     return 0
 }
 
-# Find a pathname to a file that we would execute if the shell was asked
-# to run $arg using the current PATH.
-
-proc find_gdb { arg } {
-
-    # If the arg directly specifies an existing executable file, then
-    # simply use it.
-
-    if [file executable $arg] then {
-	return $arg
-    }
-
-    set result [which $arg]


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-07 18:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-07 18:33 [SCM] tromey/python-checker: add gdb_python_initialized test case tromey
  -- strict thread matches above, loose matches on Subject: below --
2013-04-22 18:28 tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).