From 883964a75e8c6531f167391354f1a4d83d203988 Mon Sep 17 00:00:00 2001 From: Siva Chandra Date: Tue, 20 May 2014 06:53:04 -0700 Subject: Xmethod support in Python. * python/py-xmethods.c: New file. * python/py-objfile.c (objfile_object): New field 'xmethods'. (objfpy_dealloc): XDECREF on the new xmethods field. (objfpy_new, objfile_to_objfile_object): Initialize xmethods field. (objfpy_get_xmethods): New function. (objfile_getset): New entry 'xmethods'. * python/py-progspace.c (pspace_object): New field 'xmethods'. (pspy_dealloc): XDECREF on the new xmethods field. (pspy_new, pspace_to_pspace_object): Initialize xmethods field. (pspy_get_xmethods): New function. (pspace_getset): New entry 'xmethods'. * python/python-internal.h: Add declarations for new functions. * python/python.c (_initialize_python): Invoke gdbpy_initialize_xmethods. * python/lib/gdb/__init__.py (xmethods): New attribute. * python/lib/gdb/xmethod.py: New file. * python/lib/gdb/command/xmethods.py: New file. testuite/ * gdb.python/py-xmethods.cc: New testcase to test xmethods. * gdb.python/py-xmethods.exp: New tests to test xmethods. * gdb.python/py-xmethods.py: Python script supporting the new testcase and tests. --- gdb/python/python.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'gdb/python/python.c') diff --git a/gdb/python/python.c b/gdb/python/python.c index cbfa73a..369a249 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -186,7 +186,13 @@ static const struct extension_language_ops python_extension_ops = gdbpy_set_quit_flag, gdbpy_check_quit_flag, - gdbpy_before_prompt_hook + gdbpy_before_prompt_hook, + + gdbpy_clone_xmethod_worker_data, + gdbpy_free_xmethod_worker_data, + gdbpy_get_matching_xmethod_workers, + gdbpy_get_xmethod_arg_types, + gdbpy_invoke_xmethod }; /* Architecture and language to be used in callbacks from @@ -1752,7 +1758,8 @@ message == an error message without a stack will be printed."), || gdbpy_initialize_exited_event () < 0 || gdbpy_initialize_thread_event () < 0 || gdbpy_initialize_new_objfile_event () < 0 - || gdbpy_initialize_arch () < 0) + || gdbpy_initialize_arch () < 0 + || gdbpy_initialize_xmethods () < 0) goto fail; gdbpy_to_string_cst = PyString_FromString ("to_string"); -- cgit v1.1