Commit Graph

40 Commits

Author SHA1 Message Date
Tom Tromey 74aedc4602 * python/python.c (gdbpy_solib_name): Use gdb_py_longest and
GDB_PY_LL_ARG.
	* python/python-internal.h (GDB_PY_LL_ARG, GDB_PY_LLU_ARG): New
	macros.
	(gdb_py_longest, gdb_py_ulongest): New typedefs.
	(gdb_py_long_from_longest, gdb_py_long_from_ulongest)
	(gdb_py_long_as_ulongest): New defines.
	(gdb_py_object_from_longest, gdb_py_object_from_ulongest)
	(gdb_py_int_as_long): Declare.
	* python/py-value.c (valpy_lazy_string): Use gdb_py_longest,
	GDB_PY_LL_ARG, gdb_py_object_from_longest.
	(valpy_long): Add comment.
	* python/py-utils.c (get_addr_from_python): Use
	gdb_py_long_as_ulongest.  Handle overflow properly.
	(gdb_py_object_from_longest): New function.
	(gdb_py_object_from_ulongest): Likewise.
	(gdb_py_int_as_long): Likewise.
	* python/py-type.c (typy_array): Use gdb_py_int_as_long.
	* python/py-symtab.c (salpy_get_pc): Use
	gdb_py_long_from_ulongest.
	(salpy_get_line): Use PyInt_FromLong.
	* python/py-param.c (set_parameter_value): Use
	gdb_py_int_as_long.
	* python/py-lazy-string.c (stpy_get_address): Use
	gdb_py_long_from_ulongest.
	* python/py-frame.c (frapy_pc): Use gdb_py_long_from_ulongest.
	* python/py-cmd.c (cmdpy_completer): Use gdb_py_int_as_long.
	* python/py-breakpoint.c (bppy_set_thread): Use
	gdb_py_int_as_long.
	(bppy_set_task): Likewise.
	(bppy_set_ignore_count): Likewise.
	(bppy_set_hit_count): Likewise.
	* python/py-block.c (blpy_get_start): Use
	gdb_py_object_from_ulongest.
	(blpy_get_end): Likewise.
	(gdbpy_block_for_pc): Use gdb_py_ulongest and GDB_PY_LLU_ARG.
2011-01-26 20:53:45 +00:00
Tom Tromey d8e227793f gdb
PR python/12367:
	* NEWS: Add item.
	* python/python.c (GdbMethods): Add "newest_frame" method.
	* python/python-internal.h (gdbpy_newest_frame): Declare.
	* python/py-frame.c (gdbpy_newest_frame): New function.
gdb/doc
	* gdb.texinfo (Frames In Python): Document gdb.newest_thread.
gdb/testsuite
	* gdb.python/py-frame.exp: Test gdb.newest_frame.
2011-01-06 21:10:53 +00:00
Michael Snyder 9a2b4c1ba7 2011-01-05 Michael Snyder <msnyder@vmware.com>
* cli/cli-cmds.c: Shorten lines of >= 80 columns.
	* cli/cli-decode.c: Ditto.
	* cli/cli-dump.c: Ditto.
	* cli/cli-logging.c: Ditto.
	* cli/cli-script.c: Ditto.
	* cli/cli-setshow.c: Ditto.
	* common/signals.c: Ditto.
	* mi/mi-cmd-break.c: Ditto.
	* mi/mi-cmd-disas.c: Ditto.
	* mi/mi-cmd-stack.c: Ditto.
	* mi/mi-cmd-var.c: Ditto.
	* mi/mi-cmds.c: Ditto.
	* mi/mi-common.h: Ditto.
	* mi/mi-console.c: Ditto.
	* mi/mi-interp.c: Ditto.
	* mi/mi-main.c: Ditto.
	* osf-share/cma_attr.c: Ditto.
	* osf-share/cma_deb_core.h: Ditto.
	* osf-share/cma_debug_client.h: Ditto.
	* osf-share/cma_handle.h: Ditto.
	* osf-share/cma_mutex.h: Ditto.
	* osf-share/cma_stack_int.h: Ditto.
	* osf-share/cma_tcb_defs.h: Ditto.
	* python/py-auto-load.c: Ditto.
	* python/py-breakpoint.c: Ditto.
	* python/py-cmd.c: Ditto.
	* python/py-frame.c: Ditto.
	* python/py-objfile.c: Ditto.
	* python/py-param.c: Ditto.
	* python/py-progspace.c: Ditto.
	* python/py-symbol.c: Ditto.
	* python/py-value.c: Ditto.
	* python/python-internal.h: Ditto.
	* python/python.c: Ditto.
	* tui/tui-data.c: Ditto.
	* tui/tui-disasm.c: Ditto.
	* tui/tui-hooks.c: Ditto.
	* tui/tui-io.c: Ditto.
	* tui/tui-layout.c: Ditto.
	* tui/tui-regs.c: Ditto.
	* tui/tui-source.c: Ditto.
	* tui/tui-stack.c: Ditto.
	* tui/tui-win.c: Ditto.
	* tui/tui-windata.c: Ditto.
	* tui/tui-winsource.c: Ditto.
2011-01-06 00:57:05 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Tom Tromey 621c83642d gdb
* varobj.c (value_get_print_value): Rearrange.  Pass stream to
	apply_varobj_pretty_printer.
	* c-lang.c: Include exceptions.h.
	(c_get_string): Throw MEMORY_ERROR when appropriate.
	* python/py-prettyprint.c (enum string_repr_result): New.
	(print_stack_unless_memory_error): New function.
	(print_string_repr): Change return type.  Use
	print_stack_unless_memory_error.
	(print_children): Use print_stack_unless_memory_error.
	(apply_val_pretty_printer): Update.  Don't print children if
	string representation threw an exception.
	(apply_varobj_pretty_printer): Add 'stream' argument.  Use
	print_stack_unless_memory_error.
	* python/python.c (gdbpy_gdb_error, gdbpy_gdb_memory_error): New
	globals.
	(_initialize_python): Initialize them.
	* python/python-internal.h (GDB_PY_HANDLE_EXCEPTION): Use
	gdbpy_convert_exception.
	(GDB_PY_SET_HANDLE_EXCEPTION): Likewise.
	(gdbpy_gdb_error, gdbpy_gdb_memory_error): Declare.
	(gdbpy_convert_exception): Declare.
	(apply_varobj_pretty_printer): Update.
	* python/py-utils.c (gdbpy_convert_exception): New function.
gdb/doc
	* gdb.texinfo (Basic Python): Update.  Add xref.
	(Exception Handling): Document new exception classes.
	(Types In Python): Update.
	(Frames In Python): Update.
gdb/testsuite
	* gdb.python/py-prettyprint.c (main): Add new 'ns2' local.
	* gdb.python/py-prettyprint.exp (run_lang_tests): Add test for
	MemoryError.
	* gdb.python/python.exp (gdb_py_test_multiple): Update exception
	type.
	* gdb.python/py-value.exp (test_value_in_inferior): Add test for
	MemoryError.
	(test_subscript_regression): Update exception type.
2010-11-12 20:49:43 +00:00
Joel Brobecker 284a3db383 fix typo in _FILE_OFFSET_BITS comment
This fixes a typo that MichaelS noticed in a patch I submitted and
forgot to fix.

gdb/ChangeLog:

	* (_FILE_OFFSET_BITS): Fix typo in comment.
2010-10-26 18:08:04 +00:00
Joel Brobecker aed1781d40 Fix build failures with python support on sparc-solaris
There were two types of errors, mostly compiler warnings:

  1. _FILE_OFFSET_BITS being redefined in pyconfig.h;
     This is a problem we're familiar with, having seen similar
     issues on GNU/Linux systems. I used a similar solution.

  2. GCC 4.5 complains that calls to PyEval_InitThreads and
     PyEval_ReleaseLock have no effect.  This is because our Python
     is built without thread support, leading us to use the dummy
     #define in python-internal.h which just gets replaced by `0'.
     Since this function returns void (checked versions 2.4 and 2.7),
     I simply removed the 0.

gdb/ChangeLog:

        python/python-internal.h (_FILE_OFFSET_BITS): Undefine.
        (PyEval_InitThreads): Remove duplicate. Define as nothing.
        (PyEval_ReleaseLock): Define as nothing.
2010-10-26 18:06:34 +00:00
Tom Tromey 09ca9e2e34 PR python/11948:
* varobj.c (value_get_print_value): Use val_print_string to print
	lazy strings.
	* python/py-prettyprint.c (print_string_repr): Use
	val_print_string to print lazy strings.  Fix cleanup logic.
	(print_children): Likewise.
	* python/python-internal.h (gdbpy_extract_lazy_string): Update.
	* python/py-lazy-string.c (gdbpy_extract_lazy_string): Rewrite.
	Change return type to 'void', add 'addr' argument.
	* value.h (val_print_string): Update.
	* valprint.c (val_print_string): Add 'encoding' argument.
	* printcmd.c (print_formatted): Update.
	* p-valprint.c (pascal_val_print): Update.
	* m2-valprint.c (print_unpacked_pointer): Update.
	(m2_print_array_contents): Likewise.
	* jv-valprint.c (java_value_print): Update.
	* f-valprint.c (f_val_print): Update.
	* c-valprint.c (c_val_print): Update.
	* auxv.c (fprint_target_auxv): Update.
2010-10-15 18:54:13 +00:00
Tom Tromey 4eb5405278 * python/python-internal.h (gdbpy_get_hook_function): Don't
declare.
2010-08-13 20:50:47 +00:00
Tom Tromey 11763c1856 * configure, config.in: Rebuild.
* configure.ac (HAVE_LIBPYTHON2_7): New define.
	* python/python-internal.h: Handle HAVE_LIBPYTHON2_7.
2010-07-06 19:03:12 +00:00
Joel Brobecker aac63f0f26 Fix build failure with Python installed in non-system location.
The debugger fails to build when configure with --python-python=<path>
where <path> is a non-system location.  The reason is a warning made
fatal due to the definition of _XOPEN_SOURCE inside pyconfig.h.  This
is exactly the same problem as with _POSIX_C_SOURCE, handled in
python-internal.h as follow:

| /* /usr/include/features.h on linux systems will define _POSIX_C_SOURCE
|    if it sees _GNU_SOURCE (which config.h will define).
|    pyconfig.h defines _POSIX_C_SOURCE to a different value than
|    /usr/include/features.h does causing compilation to fail.
|    To work around this, undef _POSIX_C_SOURCE before we include Python.h.  */
| #undef _POSIX_C_SOURCE

This patch fixes this problem the same way.

2010-06-30  Joel Brobecker  <brobecker@adacore.com>

        * python/python-internal.h (_XOPEN_SOURCE): Undefine before
        including Python.h.
2010-06-30 23:12:04 +00:00
Phil Muldoon 595939dea1 2010-06-28 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey  <tromey@redhat.com>
            Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* value.c (pack_unsigned_long): New function.
	(value_from_ulongest): New function.
	* value.h (value_from_ulongest): Declare.
	* python/python.c (_initialize_python): Call
	gdbpy_initialize_thread and gdbpy_initialize_inferior.
	* python/python-internal.h: Define thread_object.
	(gdbpy_inferiors, gdbpy_selected_thread)
	(frame_info_to_frame_object, create_thread_object)
	(find_thread_object, find_inferior_object)
	(gdbpy_initialize_thread, gdbpy_initialize_inferiors)
	(gdbpy_is_value_object, get_addr_from_python): Declare.
	* python/py-value.c (builtin_type_upylong): Define.
	(convert_value_from_python): Add logic for ulongest.
	(gdbpy_is_value_object): New function.
	* python/py-utils.c (get_addr_from_python): New function.
	* python/py-frame.c (frame_info_to_frame_object): Return a PyObject.
	(gdbpy_selected_frame): Use PyObject over frame_info.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-inferior and
	py-infthread.
	(SUBDIR_PYTHON_SRCS): Likewise.
	(py-inferior.o): New Rule.
	(py-infthread.o): New Rule.
	* python/py-inferior.c: New File.
	* python/py-infthread.c: New File.

2010-06-28  Phil Muldoon  <pmuldoon@redhat.com>
	    Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* gdb.texinfo (Inferiors In Python): New node.
	* gdb.texinfo (Threads In Python): New node.

2010-06-28  Phil Muldoon  <pmuldoon@redhat.com>
            Tom Tromey  <tromey@redhat.com>
            Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* gdb.python/py-inferior.c: New File.
	* gdb.python/py-infthread.c: New File.
	* gdb.python/py-inferior.exp: New File.
	* gdb.python/py-infthread.exp: New File.
2010-06-28 21:16:04 +00:00
Doug Evans 967cf47793 Add support for enabling/disabling individual pretty-printers.
* python/py-prettyprint.c (search_pp_list): Skip disabled printers.
	* python/python-internal.h (gdbpy_enabled_cst): Declare.
	* python/python.c (gdbpy_enabled_cst): Define.
	(_initialize_python): Initialize gdbpy_enabled_cst.
	* NEWS: Add entry.

	doc/
	* gdb.texinfo (Python API): New node `Disabling Pretty-Printers'.

	testsuite/
	* gdb.python/py-prettyprint.exp: Add new test for enabled and
	disabled printers.
	* gdb.python/py-prettyprint.py (disable_lookup_function): New function.
	(enable_lookup_function): New function.
2010-06-04 18:18:28 +00:00
Doug Evans 07ca107c2d Add python gdb.GdbError and gdb.string_to_argv.
* NEWS: Document them.
	* python/py-cmd.c (cmdpy_function): Don't print a traceback if
	the exception is gdb.GdbError.  Print a second traceback if there's
	an error computing the error message.
	(gdbpy_string_to_argv): New function.
	* python/py-utils.c (gdbpy_obj_to_string): New function.
	(gdbpy_exception_to_string): New function.
	* python/python-internal.h (gdbpy_string_to_argv): Declare.
	(gdbpy_obj_to_string, gdbpy_exception_to_string): Declare.
	(gdbpy_gdberror_exc): Declare.
	* python/python.c (gdbpy_gdberror_exc): New global.
	(_initialize_python): Initialize gdbpy_gdberror_exc and create
	gdb.GdbError.
	(GdbMethods): Add string_to_argv.

	doc/
	* gdb.texinfo (Exception Handling): Document gdb.GdbError.
	(Commands In Python): Document gdb.string_to_argv.

	testsuite/
	* gdb.python/py-cmd.exp: Add tests for gdb.GdbError and
	gdb.string_to_argv.
2010-05-25 15:27:17 +00:00
Phil Muldoon d7b32ed3ab 2010-04-29 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey  <tromey@redhat.com>
            Thiago Jung Bauermann  <bauerman@br.ibm.com>

       	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-parameter.
        (SUBDIR_PYTHON_SRCS): Likewise.
       	(py-parameter.o): New rule.
       	* python/py-parameter.c: New file.
        * python/python-internal.h (gdbpy_initialize_parameter)
        (gdbpy_parameter, gdbpy_parameter_value)
        (gdbpy_parse_command_name): Declare.
        * python/py-cmd.c (parse_command_name): Rename to
       	gdbpy_parse_command_name.
        (gdbpy_parse_command_name): Accept a starting list parameter and
       	use over cmdlist.
       	(cmdpy_init): Use gdbpy_parse_command_name.
        * python/python.c (parameter_to_python): Rename to
        gdbpy_parameter_to_python.  Accept enum var_types and value.
        (gdbpy_parameter): Use gdbpy_parameter_value.
        (_initialize_python): Call gdbpy_initialize_parameters.

2010-04-29  Phil Muldoon  <pmuldoon@redhat.com>

        * gdb.python/py-param.exp: New File.

2010-04-29  Phil Muldoon  <pmuldoon@redhat.com>
            Tom Tromey  <tromey@redhat.com>
            Thiago Jung Bauermann  <bauerman@br.ibm.com>

        * gdb.texinfo (Parameters In Python): New Node.
2010-04-29 15:45:57 +00:00
Doug Evans 8a1ea21f7e Add support for auto-loading scripts from .debug_gdb_scripts section.
* NEWS: Add entry for .debug_gdb_scripts.
	* Makefile.in SUBDIR_PYTHON_OBS): Add py-auto-load.o.
	(SUBDIR_PYTHON_SRCS): Add py-auto-load.c.
	(py-auto-load.o): New rule.
	* cli/cli-cmds.c (find_and_open_script): Make externally visible.
	* cli/cli-cmds.h (find_and_open_script): Update prototype.
	* python/py-auto-load.c: New file.
	* python/python-internal.h: #include <stdio.h>.
	(set_python_list, show_python_list): Declare.
	(gdbpy_initialize_auto_load): Declare.
	(source_python_script_for_objfile): Declare.
	* python/python.c: Remove #include of observer.h.
	(gdbpy_auto_load): Moved to py-auto-load.c.
	(GDBPY_AUTO_FILENAME): Ditto.
	(gdbpy_new_objfile): Delete.
	(source_python_script_for_objfile): New function.
	(set_python_list, show_python_list): Make externally visible.
	(_initialize_python): Move "auto-load" command to py-auto-load.c
	and observer_attach_new_objfile to py-auto-load.c.

	doc/
	* gdb.texinfo (Python): Move Auto-loading section here ...
	(Python API): from here.
	(Auto-loading): Add docs for .debug_gdb_scripts auto-loaded scripts.
	(Maintenance Commands): Add docs for "maint print section-scripts".

	testsuite/
	* gdb.python/py-section-script.c: New file.
	* gdb.python/py-section-script.exp: New file.
	* gdb.python/py-section-script.py: New file.
2010-04-23 16:20:13 +00:00
Doug Evans fa33c3cd05 * NEWS: Add entry for python program space support.
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-progspace.o.
	(SUBDIR_PYTHON_SRCS): Add py-progspace.c.
	(py-progspace.o): New rule.
	* python/py-prettyprint.c (find_pretty_printer_from_objfiles): New
	function.
	(find_pretty_printer_from_progspace): New function.
	(find_pretty_printer_from_gdb): New function.
	(find_pretty_printer): Rewrite.
	* python/py-progspace.c: New file.
	* python/python-internal.h (program_space): Add forward decl.
	(pspace_to_pspace_object, pspy_get_printers): Declare.
	(gdbpy_initialize_pspace): Declare.
	* python/python.c: #include "progspace.h".
	(gdbpy_get_current_progspace, gdbpy_progspaces): New functions.
	(_initialize_python): Call gdbpy_initialize_pspace.
	(GdbMethods): Add current_progspace, progspaces.

	doc/
	* gdb.texinfo (Python API): Add progspaces section.
	(Selecting Pretty-Printers): Progspace pretty-printers are
	searched too.
	(Progspaces In Python): New section.

	testsuite/
	* gdb.python/py-progspace.c: New file.
	* gdb.python/py-progspace.exp: New file.
2010-04-15 19:54:13 +00:00
Phil Muldoon adc368187c 2010-04-09 Phil Muldoon <pmuldoon@redhat.com>
Thiago Jung Bauermann  <bauerman@br.ibm.com>
   	    Tom Tromey  <tromey@redhat.com>

	* breakpoint.c (condition_command): Simplify.  Move condition
	setting code to ...
	(set_breakpoint_condition): ... here.  New function.
	* breakpoint.h  (set_breakpoint_condition): Declare.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-breakpoint.
	(SUBDIR_PYTHON_SRCS): Likewise.
	(py-breakpoint.o): New rule.
	* python/py-breakpoint.c: New file.
	* python/python-internal.h (gdbpy_breakpoints)
	(gdbpy_initialize_breakpoints): Declare.
	(GDB_PY_SET_HANDLE_EXCEPTION) Define.


2010-04-09  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/py-breakpoint.exp: New File.
	* gdb.python/py-breakpoint.C: Ditto.

2010-04-09  Phil Muldoon  <pmuldoon@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>
   	    Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Breakpoints In Python): New Node.
2010-04-09 09:41:43 +00:00
Pierre Muller 9cb74f47a1 * python/python-internal.h: Include symtab.h. 2010-03-09 17:12:40 +00:00
Phil Muldoon f3e9a8177c 2010-02-24 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* python/python.c (_initialize_python): Call
	gdbpy_initialize_symtabs, gdbpy_initialize_symbols and
	gdbpy_initialize_blocks.
	* python/python-internal.h: Declare struct symbol, block and
	symtab_and_line.  Declare block_object_type and
	symbol_object_type
	(gdbpy_lookup_symbol gdbpy_block_for_pc)
	(symtab_and_line_to_sal_object, symtab_to_symtab_object)
	(symbol_to_symbol_object,  block_to_block_object)
	(gdbpy_initialize_symtabs,gdbpy_initialize_symbols)
	(gdbpy_initialize_blocks ): Declare.
	* python/py-frame.c (frapy_block, frapy_function, frapy_find_sal)
	(frapy_select): Add methods.
	(frapy_read_var): Add symbol branch.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-symbol, py-symtab,
	py-block.
	(SUBDIR_PYTHON_SRCS): Likewise.
	(py-symbol.o): New rule.
	(py-symtab.o): Likewise.
	(py-block.o): Likewise.
	* python/py-symbol.c: New file.
	* python/py-symtab.c: Likewise.
	* python/py-block.c: Likewise.


2010-02-24  Phil Muldoon  <pmuldoon@redhat.com>

	* Makefile.in: Add py-block and py-symbol.
	* gdb.python/py-symbol.exp: New File.
	* gdb.python/py-symtab.exp: New File.
	* gdb.python/py-block.exp: New File.
	* gdb.python/py-symbol.c: New File.
	* gdb.python/py-block.c: New File.


2010-02-24  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Frames In Python): Add block, find_sal, function
	and select method descriptions.
	(Python API): Add Blocks In Python, Symbols in Python and Symbol
	Tables in Python to menu.
	(Blocks In Python): New node.
	(Symbols In Python): New node.
	(Symbol Tables in Python): New node.
2010-02-24 21:18:28 +00:00
Ulrich Weigand 548a926afa * python/python-internal.h [!WITH_THREAD] (PyGILState_Release,
PyThreadState_Swap): Avoid "statement with no effect" warning.
2010-02-17 14:58:54 +00:00
Phil Muldoon be759fcf73 2010-01-13 Phil Muldoon <pmuldoon@redhat.com>
PR python/10705

	* python/python-internal.h: Add lazy_string_object_type
	definition.
	(create_lazy_string_object, gdbpy_initialize_lazy_string)
	(gdbpy_is_lazystring, gdbpy_extract_lazy_string): Define.
	* python/py-value.c (valpy_lazy_string): New function.
	(convert_value_from_python): Add lazy string conversion.
	* python/py-prettyprint.c (pretty_print_one_value): Check if
	return is also a lazy string.
	(print_string_repr): Add lazy string printing branch.
	(print_children): Likewise.
	* python/py-lazy-string.c: New file. Implement lazy strings.
	* python/python.c (_initialize_python): Call
	gdbpy_initialize_lazy_string.
	* varobj.c (value_get_print_value): Add lazy string printing
	branch.  Account for encoding.
	* c-lang.c (c_printstr): Account for new encoding argument.  If
	encoding is NULL, find encoding suited for type, otherwise use
	user encoding.
	* language.h (language_defn): Add encoding argument.
	(LA_PRINT_STRING): Likewise.
	* language.c (unk_lang_printstr): Update to reflect new encoding
	argument to language_defn.
	* ada-lang.h (ada_printstr): Likewise.
	* c-lang.h (c_printstr): Likewise.
	* p-lang.h (pascal_printstr);
	* f-lang.c (f_printstr): Likewise.
	* m2-lang.c (m2_printstr): Likewise.
	* objc-lang.c (objc_printstr): Likewise.
	* p-lang.c (pascal_printstr): Likewise.
	* scm-lang.c (scm_printstr): Likewise.
	* c-valprint.c (c_val_print): Update LA_PRINT_STRING call for
	encoding argument.
	* ada-valprint.c (ada_printstr): Likewise.
	* f-valprint.c (f_val_print): Likewise
	* m2-valprint.c (m2_val_print): Likewise.
	* p-valprint.c (pascal_val_print): Likewise.
	* expprint.c (print_subexp_standard): Likewise.
	* valprint.c (val_print_string): Likewise.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-lazy-string.
	(SUBDIR_PYTHON_SRCS): Likewise.
	(py-lazy-string.o): New rule.

2010-01-13  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Values From Inferior): Document lazy_string value
	method.
	(Python API): Add Lazy strings menu item.
	(Lazy Strings In Python): New node.

2010-01-13  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/py-value.exp (test_lazy_strings): Add lazy string test.
	* gdb.python/py-prettyprint.py (pp_ls): New printer.
	* gdb.python/py-prettyprint.exp (run_lang_tests): Add lazy string
	test.
	* gdb.python/py-prettyprint.c: Define lazystring test structure.
	* gdb.python/py-mi.exp: Add lazy string test.
2010-01-14 08:03:37 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Phil Muldoon fbb8f2990c 2009-07-10 Phil Muldoon <pmuldoon@redhat.com>
* python/python-internal.h (apply_varobj_pretty_printer): Update
	definition.
	(python_string_to_target_python_string): Add definition.
	* python/python-utils.c (unicode_to_encoded_python_string)
	(unicode_to_target_python_string)
	(python_string_to_target_python_string): New Functions.
	* python/python-prettyprint.c (pretty_print_one_value): Likewise.
	(print_string_repr): Refactor to logic to account for PyObject
	returned strings.
	(apply_varobj_pretty_printer): Likewise.
	* python/python-value.c (valpy_string): Parse length keyword. Use
	length keyword in LA_GET_STRING.
	* varobj.c (value_get_print_value): Refactor logic to account for
	PyObject returned strings.
	* c-lang.c (c_get_string): If the length parameter is specified,
	use that. Return value in characters. Update comments.
	* language.h: Update c_get_string prototype comments.

2009-07-10  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Values From Inferior): Add length parameter
	description.

2009-07-10 Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/python-prettyprint.c: Add counted null string
	structure.
	* gdb.python/python-prettyprint.exp: Print null string. Test for
	embedded nulls.
	* gdb.python/python-prettyprint.py (pp_ns): New Function.
	* gdb.python/python-value.exp (test_value_in_inferior): Add
	variable length string fetch tests.
	* gdb.python/python-value.c (main): Add strings for string fetch tests.
2009-07-10 10:35:17 +00:00
Ulrich Weigand d452c4bcef * python/python-internal.h (struct language_defn): Declare.
(python_gdbarch, python_language): Likewise.
	(ensure_python_env): Add prototype.
	(make_cleanup_py_restore_gil): Remove prototype.

	* python/python.c: Include "arch-utils.h", "value.h" and "language.h".
	(python_gdbarch, python_language): New global variables.
	(struct python_env): New data type.
	(ensure_python_env, restore_python_env): New functions.
	(eval_python_from_control_command): Call ensure_python_env to
	install current architecture and language.
	(python_command, gdbpy_new_objfile): Likewise.
	* python/python-cmd.c: Include "arch-utils.h" and "language.h".
	(cmdpy_destroyer, cmdpy_function, cmdpy_completer): Call
	ensure_python_env.
	* python/python-type.c (clean_up_objfile_types): Likewise.
	* python/python-objfile.c: Include "language.h".
	(clean_up_objfile): Call ensure_python_env.
	* python/python-prettyprint.c (apply_val_pretty_printer): Likewise.
	(apply_varobj_pretty_printer): Do not call PyGILState_Ensure.
	* varobj.c (varobj_ensure_python_env): New helper function.
	(varobj_get_display_hint, update_dynamic_varobj_children,
	install_default_visualizer, varobj_set_visualizer, free_variable,
	value_get_print_value): Call it.
	(value_get_print_value): Add varobj argument instead of pretty
	printer argument.  Update all callers.

	* python/python-utils.c (py_gil_restore, make_cleanup_py_restore_gil):
	Remove.

	* value.h (internal_function_fn): Add GDBARCH and LANGUAGE argument.
	(call_internal_function): Likewise.
	* value.c (call_internal_function): Likewise.  Pass to handler.
	* eval.c (evaluate_subexp_standard): Update call.
	* python/python-function.c: Include "language.h".
	(fnpy_call): Add GDBARCH and LANGAUAGE arguments and call
	make_cleanup_python_env.

	* python/python-value.c (builtin_type_pyint, builtin_type_pyfloat,
	builtin_type_pylong, builtin_type_pybool, builtin_type_pychar,
	valpy_str): Use python_gdbarch and python_language instead of
	current_gdbarch and current_language.
	* python/python-type.c (typy_lookup_typename): Likewise.
2009-07-02 17:04:23 +00:00
Tom Tromey b631324398 gdb
2009-05-27  Vladimir Prus  <vladimir@codesourcery.com>
	    Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* mi/mi-main.c (mi_cmd_list_features): List "python" feature.
	* varobj.h (varobj_set_visualizer): Declare.
	(varobj_get_display_hint): Likewise.
	(varobj_update_result_t) <children_changed, value_installed>: New
	fields.
	* mi/mi-cmds.c (mi_cmds): Add var-set-visualizer.
	* mi/mi-cmds.h (mi_cmd_var_set_visualizer,
	mi_cmd_var_set_child_range): Declare.
	* mi/mi-cmd-var.c (mi_cmd_var_set_visualizer): New function.
	(mi_cmd_var_list_children): Emit display hint.
	(varobj_update_one): Emit display hint.  Handle dynamic children.
	* python/python.c (GdbMethods): Add "default_visualizer".
	* python/python-internal.h (apply_varobj_pretty_printer,
	gdbpy_get_varobj_pretty_printer, gdbpy_get_display_hint):
	Declare.
	(gdbpy_default_visualizer): Likewise.
	* varobj.c: Include python.h, python-internal.h.
	(PyObject): New typedef.
	(struct varobj) <children_requested, pretty_printer>: New fields.
	(varobj_create): Call install_default_visualizer.
	(instantiate_pretty_printer): New function.
	(varobj_set_display_format): Update.
	(varobj_get_display_hint): New function.
	(update_dynamic_varobj_children): New function.
	(varobj_get_num_children): Handle dynamic children.
	(varobj_list_children): Likewise.
	(install_new_value): Likewise.
	(varobj_add_child): New function.
	(install_visualizer): Likewise.
	(install_default_visualizer): Likewise.
	(varobj_set_visualizer): Likewise.
	(varobj_update): Handle dynamic children.
	(create_child): Use create_child_with_value.
	(create_child_with_value): New function.
	(value_get_print_value): Call pretty printer.  Add value_formatter
	argument.
	(c_value_of_variable): Update.
	(varobj_invalidate): Always free all_rootvarobj.
	* python/python-prettyprint.c (apply_varobj_pretty_printer): New
	function.
	(gdbpy_get_varobj_pretty_printer): Likewise.
	(gdbpy_default_visualizer): Likewise.

gdb/doc

2009-05-27  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (GDB/MI Miscellaneous Commands): Document "python"
	feature.
	(GDB/MI Variable Objects): Document -var-set-visualizer.

gdb/testsuite

2009-05-27  Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* lib/mi-support.exp (mi_varobj_update_dynamic): New proc.
	(mi_child_regexp): Likewise.
	(mi_list_varobj_children_range): Likewise.
	(mi_get_features): Likewise.
	(mi_list_varobj_children): Rewrite.
	* gdb.python/python-mi.exp: New file.
2009-05-28 01:09:20 +00:00
Tom Tromey a6bac58e84 gdb
2009-05-27  Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>
	    Phil Muldoon  <pmuldoon@redhat.com>
	    Paul Pluzhnikov  <ppluzhnikov@google.com>
	    Vladimir Prus  <vladimir@codesourcery.com>

	* python/python-value.c (value_object_to_value): New function.
	* python/python-internal.h: Include frameobject.h.
	(gdbpy_children_cst, gdbpy_to_string_cst, gdbpy_display_hint_cst):
	Declare.
	(value_object_to_value): Declare.
	* printcmd.c (struct format_data) <raw>: New field.
	(last_format): Default to 0.
	(decode_format): Initialize val.raw.  Handle /r flag.
	(print_command_1): Initialize fmt.raw and opts.raw.
	(output_command): Likewise.
	(x_command): Fix initialization of fmt.format.  Initialize
	fmt.raw.
	(display_command): Initialize fmt.raw.
	(do_one_display): Set opts.raw.
	* python/python.c (gdbpy_to_string_cst, gdbpy_children_cst,
	gdbpy_display_hint_cst): New globals.
	(_initialize_python): Initialize them.  Set gdb.pretty_printers.
	* cp-valprint.c: Include python.h.
	(cp_print_value): Call apply_val_pretty_printer.
	* python/python.h (apply_val_pretty_printer): Declare.
	* stack.c (print_this_frame_argument_p): Remove.
	(print_frame_args): Compute summary flag.  Don't use
	print_this_frame_argument_p.
	* valprint.c: Include python.h.
	(user_print_options): Initialize new fields.
	(scalar_type_p): New function.
	(val_print): Handle 'raw' and 'summary' modes.  Call
	apply_val_pretty_printer.
	(value_print): Handle 'raw' mode.
	* valprint.h (struct value_print_options) <raw, summary>: New
	fields.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add python-prettyprint.o
	(SUBDIR_PYTHON_SRCS): Add python-prettyprint.c.
	(python-prettyprint.o): New target.
	* python/python-prettyprint.c: New file.

gdb/doc

2009-05-27  Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>
	    Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Objfiles In Python): Reference pretty printing.
	(Pretty Printing): New node.
	(Selecting Pretty-Printers): Likewise.
	(Python API): Update.
	(Output Formats): Document /r format.

gdb/testsuite

2009-05-27  Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>
	    Phil Muldoon  <pmuldoon@redhat.com>
	    Paul Pluzhnikov  <ppluzhnikov@google.com>

	* gdb.python/python-prettyprint.exp: New file.
	* gdb.python/python-prettyprint.c: New file.
	* gdb.python/python-prettyprint.py: New file.
	* gdb.base/display.exp: print/r is now valid.
2009-05-28 01:05:14 +00:00
Tom Tromey 2c74e83381 gdb
2009-05-27  Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>
	    Phil Muldoon  <pmuldoon@redhat.com>
	    Paul Pluzhnikov  <ppluzhnikov@google.com>

	* python/python.c (_initialize_python): Call
	gdbpy_initialize_types.
	(GdbMethods): Add "lookup_type".
	* python/python-value.c (value_object) <type>: New field.
	(valpy_dealloc): Decref type.
	(valpy_new): Initialize type.
	(valpy_get_type): New function.
	(value_to_value_object): Initialize type.
	(valpy_cast): New function.
	(value_object_getset): Add "type".
	(value_object_methods): Add "cast".
	* python/python-internal.h (type_to_type_object): Declare.
	(type_object_to_type): Likewise.
	(gdbpy_initialize_types): Likewise.
	(gdbpy_lookup_type): Declare.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add python-type.o.
	(SUBDIR_PYTHON_SRCS): Add python-type.c.
	(python-type.o): New target.
	* python/python-type.c: New file.

gdb/doc

2009-05-27  Thiago Jung Bauermann  <bauerman@br.ibm.com>
	    Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Types In Python): New node.
	(Values From Inferior): "type" is now an attribute.
	(Python API): Update.


gdb/testsuite

2009-05-27  Thiago Jung Bauermann  <bauerman@br.ibm.com>
	    Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <pedro@codesourcery.com>
	    Paul Pluzhnikov  <ppluzhnikov@google.com>

	* gdb.python/python-template.exp: New file.
	* gdb.python/python-template.cc: New file.
	* gdb.python/python.exp (gdb_py_test_multiple): Add two objfile
	tests.
	* gdb.python/python-value.exp (py_objfile_tests): New proc.
	Call it.
	(test_value_after_death): New proc.
	* gdb.python/python-value.c (PTR): New typedef.
	(main): New variable 'x'.
2009-05-28 00:47:20 +00:00
Tom Tromey 89c73adef9 gdb
2009-04-01  Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>
	    Phil Muldoon  <pmuldoon@redhat.com>

	* python/python.c: Include objfiles.h, observer.h.
	(gdbpy_auto_load): New global.
	(gdbpy_current_objfile): Likewise.
	(GDBPY_AUTO_FILENAME): New define.
	(gdbpy_new_objfile): New function.
	(gdbpy_get_current_objfile): Likewise.
	(gdbpy_objfiles): Likewise.
	(_initialize_python): Add "maint set auto-load".  Call
	gdbpy_initialize_objfile.  Attach objfile observer.
	(GdbMethods): New methods current_objfile, objfiles.
	* python/python-objfile.c: New file.
	* python/python-internal.h (objfile_to_objfile_object): Declare.
	(objfpy_get_printers): Likewise.
	(gdbpy_initialize_objfile): Likewise.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add python-objfile.o.
	(SUBDIR_PYTHON_SRCS): Add python-objfile.c.
	(python-objfile.o): New target.

gdb/doc

2009-04-01  Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* gdb.texinfo (Python API): Update.
	(Auto-loading): New node.
	(Objfiles In Python): New node.

gdb/testsuite

2009-04-06  Tom Tromey  <tromey@redhat.com>

	* gdb.python/python.exp (gdb_py_test_multiple): Add two objfile
	tests.
	* gdb.python/python-value.exp (py_objfile_tests): New proc.
	Call it.
2009-05-28 00:40:24 +00:00
Thiago Jung Bauermann f8f6f20b6e gdb/
Expose frames to Python.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add python-frame.o.
	(SUBDIR_PYTHON_SRCS): Add python-frame.c.
	(python-frame.o): New target.
	* python/python-frame.c: New file.
	* python/python-internal.h (gdbpy_frames, gdbpy_newest_frame,
	gdbpy_frame_stop_reason_string, gdbpy_selected_frame,
	gdbpy_initialize_frames): New prototypes.
	* python/python.c (_initialize_python): Call gdbpy_initialize_frames.
	(GdbMethods): Add `selected_frame' and `frame_stop_reason_string'
	entries.
	* stack.c (find_frame_funname): New function, factored out of
	print_frame.
	(print_frame): Call find_frame_funname.
	* stack.h (find_frame_funname): Add prototype.

gdb/doc/
	* gdb.texinfo (Frames in Python): New node.
	(Python API): Update.

gdb/testsuite/
	* gdb.python/python-frame.c: New file.
	* gdb.python/python-frame.exp: New file.
2009-03-30 19:54:33 +00:00
Thiago Jung Bauermann bc3b79fd1a gdb/
2009-03-05  Tom Tromey  <tromey@redhat.com>

	Add support for convenience functions in Python.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add python-function.o.
	(SUBDIR_PYTHON_SRCS): Add python-function.c.
	(python-function.o): New target.
	* eval.c: Include "python/python.h" and <ctype.h>.
	(evaluate_subexp_standard): Handle values of type
	TYPE_CODE_INTERNAL_FUNCTION.
	* gdbtypes.h (type_code): Add TYPE_CODE_INTERNAL_FUNCTION.
	* parse.c (write_exp_string): Remove duplicate word in comment.
	* python/python-function.c: New file.
	* python/python-internal.h (gdbpy_initialize_functions): Add
	prototype.
	* python/python.c (_initialize_python): Call
	gdbpy_initialize_functions.
	* valprint.c (value_check_printable): Handle values of type
	TYPE_CODE_INTERNAL_FUNCTION.
	* value.c: Include "cli/cli-decode.h".
	(internal_function): New struct.
	(functionlist, internal_fn_type): New static variables.
	(lookup_only_internalvar,
	lookup_internalvar): Add const qualifier to name argument.
	(create_internalvar): Likewise.  Initialize new field.
	(set_internal_var): Fix typo in comment.  Don't allow assignment
	to canonical variable.
	(value_create_internal_function, value_internal_function_name,
	call_internal_function, function_command, function_destroyer,
	add_internal_function): New functions.
	(_initialize_values): Create `function' placeholder command.
	Initialize internal_fn_type.
	* value.h (lookup_only_internalvar, create_internalvar,
	lookup_internalvar): Add const qualifier to name argument.
	(internal_function_fn, add_internal_function, call_internal_function,
	value_internal_function_name): Add prototypes.
	(struct internalvar) <canonical>: New field.

gdb/doc/
2008-03-05  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Convenience Vars): Document convenience functions.
	(Functions In Python): New node.
	(Python API): Update.

gdb/testsuite/
2009-03-05  Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* gdb.python/python-function.exp: New file.
2009-03-21 03:03:56 +00:00
Thiago Jung Bauermann d8906c6f0e gdb/
2009-02-06  Tom Tromey  <tromey@redhat.com>

	* Makefile.in (SUBDIR_PYTHON_OBS): Add python-cmd.o.
	(SUBDIR_PYTHON_SRCS): Add python-cmd.c.
	(python-cmd.o): New target.
	* cli/cli-decode.c (set_cmd_completer): Add self parameter to
	completer prototype.
	(add_cmd): Initialize destroyer member of cmd_list_element. Use
	make_symbol_completion_list_fn as completer.
	(delete_cmd): Call destroyer if one is set.
	* cli/cli-decode.h (cmd_list_element): Add cmd parameter to
	completer member.  Add destroyer member.
	(set_cmd_completer): Add self parameter to
	completer prototype.
	* command.h (set_cmd_completer): Add cmd parameter to
	completer prototype.
	* completer.c (noop_completer, filename_completer,
	location_completer, expression_completer, command_completer): Adapt
	to new completer prototype.
	(complete_line_internal): Pass new parameter to completer function.
	* completer.h (noop_completer, filename_completer,
	location_completer, expression_completer, command_completer): Adapt
	prototypes to new completer prototype.
	* interps.c (interpreter_completer): Adapt to new completer
	prototype.
	* python/python-cmd.c: New file.
	* python/python-internal.h (gdbpy_initialize_commands): Add
	prototype.
	(gdbpy_doc_cst): Add forward declaration.
	* python/python.c (gdbpy_doc_cst): Declare.
	(_initialize_python): Call gdbpy_initialize_commands.  Initialize
	gdbpy_doc_cst.
	* symtab.c (make_symbol_completion_list_fn): New function.
	* symtab.h (make_symbol_completion_list_fn): Add prototype.

gdb/doc/
2009-02-06  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Python API): Add entry for Commands In Python.
	(Commands In Python): New node.

gdb/testsuite/
2009-02-06  Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* gdb.python/python-cmd.exp: New file.
2009-02-06 21:33:59 +00:00
Thiago Jung Bauermann b6cb8e7dea gdb/
2009-02-05  Thiago Jung Bauermann  <bauerman@br.ibm.com>
	    Tom Tromey  <tromey@redhat.com>

	* python/python-utils.c (target_string_to_unicode): New function.
	* python/python-internal.h (target_string_to_unicode): New prototype.
	* python/python-value.c (valpy_string): New function.
	(value_object_methods): Add `string' entry.

gdb/doc/
2009-02-05  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Values From Inferior): Document Value.string.
2009-02-05 21:16:09 +00:00
Thiago Jung Bauermann 08c637dee2 gdb/
2009-02-04  Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>
	    Phil Muldoon  <pmuldoon@redhat.com>

	* python/python-internal.h (gdbpy_get_value_from_history): Rename
	prototype to gdbpy_history.
	(gdbpy_is_string): Declare.
	(python_string_to_host_string): Declare.
	* python/python-utils.c (gdbpy_is_string): New function.
	(unicode_to_encoded_string): New function.
	(unicode_to_target_string): Use it.
	(python_string_to_host_string): New function.
	* python/python-value.c (valpy_address): New function.
	(convert_value_from_python): Use gdbpy_is_string.  Change to throw
	Python exception instead of a GDB exception on error.  Properly check
	Python booleans.
	(valpy_getitem): Convert field name to host string.  Handle array
	accesses.  Adapt to new behaviour of convert_value_from_python.
	(valpy_new): Adapt to new behaviour of convert_value_from_python.
	(enum valpy_opcode) <VALPY_LSH, VALPY_RSH, VALPY_BITAND,
	VALPY_BITXOR, VALPY_BITOR>: New constants.
	(valpy_binop): Update.  Adapt to new behaviour of
	convert_value_from_python.
	(valpy_invert): New function.
	(valpy_lsh): Likewise.
	(valpy_rsh): Likewise.
	(valpy_and): Likewise.
	(valpy_or): Likewise.
	(valpy_xor): Likewise.
	(valpy_richcompare): Call convert_value_from_python instead of doing
	conversions itself.
	(is_intlike, valpy_int, valpy_long, valpy_float): New functions.
	(gdbpy_get_value_from_history): Rename
	function to gdbpy_history.
	(gdbpy_initialize_values): Don't set tp_new.
	(value_object_type): Add valpy_new.
	(value_object_methods): Add `address' entry.
	(value_object_as_number): Update for new methods.
	* python/python.c (GdbMethods): Rename entry from
	`get_value_from_history' to `history'.

gdb/doc/
2009-02-04  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Basic Python): Document gdb.history.

gdb/testsuite/
2009-02-04  Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* gdb.python/python-value.exp: Use `gdb.history' instead of
	`gdb.value_from_history'.
	(test_value_numeric_ops): Add test for conversion of enum constant.
	* gdb.python/python-value.c (enum e): New type.
	(evalue): New global.
	(main): Use argv.
2009-02-04 21:55:40 +00:00
Tom Tromey 5171e6b382 * python/python-internal.h (Py_ssize_t): Define as int. 2009-01-05 20:48:51 +00:00
Joel Brobecker 0fb0cc7590 Updated copyright notices for most files. 2009-01-03 05:58:08 +00:00
Tom Tromey f2f35b75ff 2008-12-22 Paul Pluzhnikov <ppluzhnikov@google.com>
* python/python-internal.h (PyEval_ReleaseLock): New define.
2008-12-22 16:25:17 +00:00
Tom Tromey ca30a76297 * python/python-internal.h (PyGILState_Ensure): New define.
(PyGILState_Release): Likewise.
	(PyEval_InitThreads): Likewise.
	(PyThreadState_Swap): Likewise.
	(PyEval_InitThreads): Likewise.
	* python/python.c (_initialize_python): Initialize threads.
	Release GIL.
	(eval_python_from_control_command): Acquire GIL.
	(python_command): Likewise.
	* python/python-internal.h (make_cleanup_py_restore_gil):
	Declare.
	* python/python-utils.c (py_gil_restore): New function.
	(make_cleanup_py_restore_gil): Likewise.
2008-11-21 14:59:56 +00:00
Thiago Jung Bauermann a08702d647 2008-10-16 Thiago Jung Bauermann <bauerman@br.ibm.com>
Tom Tromey  <tromey@redhat.com>

gdb/
	* Makefile.in (SUBDIR_PYTHON_OBS): Add python-value.o.
	(SUBDIR_PYTHON_SRCS): Add python-value.c.
	(python-value.o): New target.
	* configure.ac (CONFIG_OBS): Add python-value.o.
	(CONFIG_SRCS): Add python/python-value.c
	* configure: Regenerate.
	* python-internal.h (value_object_type): Add external declaration.
	(gdbpy_get_value_from_history, value_to_value_object,
	convert_value_from_python, gdbpy_initialize_values): Add function
	prototype.
	* python/python-value.c: New file.
	* python/python.c (GdbMethods): Add gdbpy_get_value_from_history.
	(_initialize_python): Call gdbpy_initialize_values.
	* python/python.h (values_in_python): Add external declaration.
	* value.c (value_prepend_to_list, value_remove_from_list): New
	functions.
	(preserve_values): Iterate over values_in_python list as well.
	* value.h (value_prepend_to_list, value_remove_from_list): Add
	function prototypes.

gdb/doc/
	* gdb.texinfo. (Values From Inferior): New subsubsection.

gdb/testsuite/
	* gdb.python/python-value.c: New file.
	* gdb.python/python-value.exp: New file.
2008-10-16 03:54:00 +00:00
Thiago Jung Bauermann d57a3c85f6 Initial python support.
gdb/
2008-08-06  Vladimir Prus  <vladimir@codesourcery.com>
	    Tom Tromey  <tromey@redhat.com>
	    Thiago Jung Bauermann  <bauerman@br.ibm.com>
	    Doug Evans  <dje@google.com>

	* Makefile.in (SUBDIR_PYTHON_OBS, SUBDIR_PYTHON_SRCS,
	SUBDIR_PYTHON_DEPS, SUBDIR_PYTHON_LDFLAGS, SUBDIR_PYTHON_CFLAGS,
	PYTHON_CFLAGS): New.
	(python_h, python_internal_h): New.
	(cli-script.o): Depend on python.h
	(python.o, python-utils.o): New.
	* cli/cli-script.c (print_command_lines): Handle python_control.
	(execute_control_command): Handle python_control.
	(execute_control_command_untraced): New function.
	(while_command): Call execute_control_command_untraced.
	(if_command): Likewise.
	(get_command_line): Remove static attribute.
	(read_next_line): Handle "python".
	(recurse_read_control_structure): Handle python_control.
	(read_command_lines): Handle python_control.
	Include python.h.
	* cli/cli-script.h (get_command_line): Add prototype.
	(execute_control_command_untraced): Likewise.
	* configure.ac: Add --with-python.
	* defs.h (enum command_control_type) <python_control>: New
	constant.
	* python/python-internal.h: New file.
	* python/python.c: New file.
	* python/python.h: New file.
	* python/python-utils.c: New file.
	* NEWS: Mention Python scripting support and its new commands.

gdb/doc/
2008-08-06  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Extending GDB): New chapter.
	(Sequences): Demoted chapter, now a section under the new
	Extending GDB chapter.
	(Python): New section.

gdb/testsuite/
2008-08-06  Tom Tromey  <tromey@redhat.com>

	* gdb.python/python.exp: New file.
2008-08-06 19:41:33 +00:00