This patch allows a Python value to become "callable", and to execute any underlying function by means of an inferior function call. This is implemented purely as a function that is registered within the call field on the PyTypeObject. When a Python value is now called, the arguments are converted into a list of values. This value list, along with the value representing the function, is passed to the call_method_by_hand function. Example Given this function: int func1(int a, int b) { return a+b; } And loading this function into a value as shown (purely by demonstration, how the function is loaded into a value is up to you): p/x func1 0x40048 python some_value = gdb.history(0) Results in: python print some_value(10,20) 30 This can also be applied within pretty printers. There is a test that demonstrates how to perform these calls within a pretty printer included with the patch. This function does not test the sanity, or the number of arguments, or type checks the arguments before the function is passed to call_function_by_hand. It simply assembles the arguments, converts them from Python, passes them to the call function and then converts any GDB exceptions to Python exceptions. Regards Phil ChangeLog 2009-09-09 Phil Muldoon * python/python-value.c (valpy_call): New function. (value_object_type): Register valpy_call as tp_call function. Documentation ChangeLog 2009-09-09 Phil Muldoon * gdb.texinfo (Values From Inferior): Document inferior function calls on Python values. Testsuite ChangeLog 2009-09-09 Phil Muldoon * gdb.python/python-value.c (func1): New function for inferior function call test. (func2): Likewise. * gdb.python/python-prettyprint.c (InferiorCall): New Class for pretty printer test. * gdb.python/python-prettyprint.py (pp_inferiorcall): New printer. (register_pretty_printers): Register pp_inferiorcall. * gdb.python/python-prettyprint.exp (run_lang_tests): Add inferior function call tests. * gdb.python/python-value.exp (test_inferior_function_call): New function.