Commit Graph

313 Commits

Author SHA1 Message Date
Tom Tromey 0b0865da62 * tracepoint.c (print_one_static_tracepoint_marker): Constify.
* symtab.c (iterate_over_some_symtabs): Constify.
	* source.h (symtab_to_fullname): Return 'const char *'.
	* source.c (symtab_to_fullname): Return 'const char *'.
	* python/py-symtab.c (stpy_fullname): Constify.
	* cli/cli-cmds.c (edit_command): Constify.
	* breakpoint.c (print_breakpoint_location)
	(update_static_tracepoint): Constify.
2012-10-18 20:14:45 +00:00
Tom Tromey 801e418523 PR python/14635:
* python/py-symtab.c (del_objfile_sal): Set 'symtab' field
	to Py_None.
testsuite
	* gdb.python/py-symtab.exp: Test sal and symtab destructors.
2012-10-15 15:23:47 +00:00
Tom Tromey 74f910c87c PR python/14634:
* python/py-symbol.c (sympy_dealloc): Check for NULL symbol.
testsuite
	* gdb.python/py-symbol.exp: Test symbol destructor.
2012-10-15 15:20:27 +00:00
Andreas Schwab 810849a34e * python/python.c (finalize_python): Only define if HAVE_PYTHON. 2012-09-21 12:57:34 +00:00
Tom Tromey d7de8e3ce9 * NEWS: Update.
* python/python.c (finalize_python): New function.
	(_initialize_python): Make a final cleanup.
testsuite
	* gdb.python/python.exp: Test atexit.register.
2012-09-20 20:54:11 +00:00
Jan Kratochvil 9a950c7c83 gdb/
Implement auto-load user conveniences suggested by Doug Evans.
	* auto-load.c: Include top.h.
	(file_is_auto_load_safe): New variable advice_printed.  Print advice.
	(_initialize_auto_load): New variable scripts_directory_help.  Mention
	GDBPY_AUTO_FILE_NAME and GDB_AUTO_FILE_NAME for set auto-load
	scripts-directory.  Document in online help one can use also files for
	set auto-load safe-path.
	* python/py-auto-load.c: (GDBPY_AUTO_FILE_NAME): Move it from here ...
	* python/python.h (GDBPY_AUTO_FILE_NAME): ... to here.
2012-09-17 18:26:06 +00:00
Yit Phang Khoo b9516fa158 Refactor Python "gdb" module into a proper Python package, by introducing
a new "_gdb" module for code implemented in C, and using reload/__import__
instead of exec.

gdb/

	* python/lib/gdb/__init__.py: Import * from _gdb.
	(GdbOutputFile, sys.stdout, GdbOutputErrorFile, sys.stderr,
	prompt_hook, sys.argv): Moved from finish_python_initialization.
	(pretty_printers, PYTHONDIR): Moved from _initialize_python.
	(packages, auto_load_packages): New list and function replacing
	module_dict and auto-loading code, using __file__ instead of
	gdb.PYTHONDIR and reload/__import__ instead of exec.
	(GdbSetPythonDirectory): Replacing function of the same name
	from finish_python_initialization, using reload/__import__ instead
	of exec, as well as call auto_load_packages.
	* python/py-prettyprint.c (find_pretty_printer_from_gdb): Check
	gdb_python_module and not gdb_module.
	* python/python-internal.h (gdb_python_module): Declare.
	* python/python.c (gdb_python_module): New global.
	(before_prompt_hook): Check gdb_python_module and not gdb_module.
	(_initialize_python): Rename gdb module to _gdb.
	Move gdb.PYTHONDIR and gdb.pretty_printer to lib/gdb/__init__.py.
	(finish_python_initialization): Move Python code to
	lib/gdb/__init__.py; instead, set up sys.path and import gdb into
	__main__.

gdb/testsuite/

	* gdb.python/python.exp (Test stderr location): Update module
	location of GDB-specific sys.stderr.
	(Test stdout location): Ditto for sys.stdout.
2012-09-13 21:49:32 +00:00
Tom Tromey f10704261b * python/py-newobjfileevent.c (create_new_objfile_event_object):
Don't decref py_objfile.
2012-09-06 20:14:13 +00:00
Yit Phang Khoo e3480f4aa1 Document how to return from "python-interactive" to GDB.
* doc/gdb.texinfo (Python Commands): Update documentation.
	* python/python.c (_initialize_python): Update documentation.
2012-08-23 18:55:25 +00:00
Yit Phang Khoo 037bbc8eea Enable readline in Python in a GDB-specific way and block the
standard Python readline module to prevent conflicts with GDB.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-gdb-readline.o.
	(SUBDIR_PYTHON_SRCS): Add python/py-gdb-readline.c.
	(py-gdb-readline.o): Add rule to compile python/py-gdb-readline.c.
	* python/py-gdb-readline.c: New file.
	* python/python-internal.h (gdbpy_initialize_gdb_readline): New
	prototype.
	* python/python.c (_initialize_python): Call
	gdbpy_initialize_gdb_readline.
2012-08-22 21:04:55 +00:00
Yit Phang Khoo 8315665ec1 Add a new "python-interactive" command that starts a standard
Python interactive prompt with "pi" as alias, and add "py" as
	an alias to "python".
	* NEWS: Mention the new commands.
	* doc/gdb.texinfo (Python Commands): Document the new
	commands.
	* python/python.c (eval_python_command): New function.
	(python_interactive_command): For "python-interactive" with
	arguments, call eval_python_command.  For "python-interactive"
	without arguments, call PyRun_InteractiveLoop.
	(_initialize_python): Add "python-interactive" command with
	"pi" as alias, and add "py" as an alias to "python".
2012-08-22 19:15:15 +00:00
Tom Tromey 522002f96c * defs.h (quit_flag): Don't declare.
(clear_quit_flag, check_quit_flag, set_quit_flag): Declare.
	(QUIT): Use new functions.
	* event-top.c (command_handler): Use clear_quit_flag.
	(handle_sigint): Use set_quit_flag.
	(async_request_quit): Use check_quit_flag.  Don't check
	immediate_quit.
	* exceptions.c (throw_exception): Use clear_quit_flag.
	* main.c (captured_main): Use clear_quit_flag.
	* python/python.c (clear_quit_flag, set_quit_flag)
	(check_quit_flag): New functions.
	* remote-sim.c (gdb_os_poll_quit): Use check_quit_flag,
	clear_quit_flag.
	* remote.c (remote_wait_as): Use check_quit_flag,
	clear_quit_flag.
	(remote_start_remote): Call QUIT.
	* symfile.c (load_progress): Use check_quit_flag.
	* top.c (command_loop): Use clear_quit_flag.
	(command_line_input): Call QUIT.
	* utils.c (quit_flag): Conditionally define.
	(clear_quit_flag, check_quit_flag, set_quit_flag): New
	functions.
	(prompt_for_continue): Call QUIT.  Use quit, not
	async_request_quit.
	* remote-mips.c (mips_expect_timeout): Call QUIT.
	* monitor.c (monitor_expect): Call QUIT.
2012-08-22 17:48:55 +00:00
Tom Tromey 8e260fc026 * auto-load.c (_initialize_auto_load): Update.
* solib-svr4.c (_initialize_svr4_solib): Update
	* solib-dsbt.c (_initialize_dsbt_solib): Update.
	* solib-darwin.c (_initialize_darwin_solib): Update.
	* registry.h: New file.
	* python/py-progspace.c (gdbpy_initialize_pspace): Update.
	* python/py-inferior.c (gdbpy_initialize_inferior): Update.
	* progspace.h: Include registry.h.  Use DECLARE_REGISTRY.
	(register_program_space_data_with_cleanup)
	(register_program_space_data, program_space_alloc_data)
	(clear_program_space_data, set_program_space_data)
	(program_space_data): Don't declare.
	* progspace.c: Use DEFINE_REGISTRY.
	(struct program_space_data, struct
	program_space_data_registration, struct
	program_space_data_registry, program_space_data_registry)
	(register_program_space_data_with_cleanup)
	(register_program_space_data, program_space_alloc_data)
	(program_space_free_data, clear_program_space_data)
	(set_program_space_data, program_space_data): Remove.
	* objfiles.h: Include registry.h.  Use DECLARE_REGISTRY.
	(struct objfile) <data, num_data>: Replace with REGISTRY_FIELDS.
	(register_objfile_data_with_cleanup, register_objfile_data)
	(clear_objfile_data, set_objfile_data, objfile_data): Don't
	declare.
	* objfiles.c: Use DEFINE_REGISTRY.
	(struct objfile_data, struct objfile_data_registration, struct
	objfile_data_registry, objfile_data_registry)
	(register_objfile_data_with_cleanup, register_objfile_data)
	(objfile_alloc_data, objfile_free_data, clear_objfile_data)
	(set_objfile_data, objfile_data): Remove.
	(_initialize_objfiles): Update.
	* jit.c (_initialize_jit): Update.
	* inflow.c (_initialize_inflow): Update.
	* inferior.h: Include registry.h.  Use DECLARE_REGISTRY.
	(struct inferior) <data, num_data>: Replace with REGISTRY_FIELDS.
	(register_inferior_data_with_cleanup, register_inferior_data)
	(clear_inferior_data, set_inferior_data, inferior_data): Don't
	declare.
	* inferior.c: Use DEFINE_REGISTRY.
	(struct inferior_data, struct inferior_data_registration, struct
	inferior_data_registry, inferior_data_registry)
	(register_inferior_data_with_cleanup, register_inferior_data)
	(inferior_alloc_data, inferior_free_data  clear_inferior_data)
	(set_inferior_data, inferior_data): Remove.
	* auxv.c (_initialize_auxv): Update.
	* ada-lang.c (_initialize_ada_language): Update.
	* breakpoint.c (_initialize_breakpoint): Update.
	* i386-nat.c (i386_use_watchpoints): Update.
2012-08-22 15:17:21 +00:00
Yao Qi 6b1755ce16 gdb/
* gdbtypes.h (enum type_code): Define TYPE_CODE_BITSTRING -1.
	* arm-tdep.c (arm_type_align): Remove code handling TYPE_CODE_BITSTRING.
	* c-typeprint.c (c_type_print_varspec_prefix): Likewise.
	(c_type_print_varspec_suffix): Likewise.
	* eval.c (evaluate_subexp_standard): Likewise.
	* f-typeprint.c (f_type_print_varspec_prefix): Likewise.
	(f_type_print_varspec_suffix): Likewise.
	* gdbtypes.c (is_scalar_type): Likewise.
	(recursive_dump_type): Likewise.
	* infcall.c (value_arg_coerce): Likewise.
	* m2-valprint.c (m2_val_print): Likewise.
	* p-typeprint.c (pascal_type_print_varspec_prefix): Likewise.
	(pascal_type_print_varspec_suffix): Likewise.
	(pascal_type_print_base): Likewise.
	* p-valprint.c (pascal_val_print): Likewise.
	(pascal_val_print): Likewise.
	* valops.c (value_slice): Likewise.
	* valprint.c (scalar_type_p): Likewise.
	* valarith.c (value_bitstring_subscript): Remove.
	(value_concat): Remove code handling TYPE_CODE_BITSTRING.
	Remove comment on TYPE_CODE_BITSTRING.

	* stabsread.c (read_type): Don't set TYPE_CODE (type) to
	TYPE_CODE_BITSTRING.

	* python/py-type.c (pyty_codes): Move ENTRY (TYPE_CODE_BITSTRING) to
	slot 0.

gdb/doc:
	* gdb.texinfo (Types In Python): Mention gdb.TYPE_CODE_BITSTRING
	is deprecated.
2012-08-16 07:36:28 +00:00
Tom Tromey db6573d664 PR python/14387:
* python/py-bpevent.c (create_breakpoint_event_object): Update
	comment.
	* python/py-event.c (evpy_add_attribute): Update comment.
	* python/py-exitedevent.c (create_exited_event_object): Fix
	reference counting and error handling.
	* python/py-newobjfileevent.c (create_new_objfile_event_object):
	Fix reference counting.
	* python/py-signalevent.c (create_signal_event_object): Fix
	reference counting and error handling.
	* python/py-stopevent.c (emit_stop_event): Fix reference
	counting.
	* python/py-threadevent.c (get_event_thread): Return a
	borrowed reference.
	* python/py-type.c (convert_field): Fix reference counting.
2012-08-15 14:22:02 +00:00
Doug Evans a72c32530e Add $_memeq, $_regex, $_streq, $_strlen convenience functions.
* NEWS: Document them.
	* data-directory/Makefile.in (PYTHON_FILES): Add function/__init__.py,
	function/strfns.py.
	* python/py-type.c (typy_array_1): New function.
	(typy_array): Call it.
	(typy_vector): New function.
	(type_object_methods): Add "vector".
	* python/lib/gdb/function/__init__.py: New file.
	* python/lib/gdb/function/strfns.py: New file.

	doc/
	* gdb.texinfo (Convenience Funs): New node.
	(Types In Python): Document Type.vector.

	testsuite/
	* gdb.python/py-strfns.c: New file.
	* gdb.python/py-strfns.exp: New file.
	* gdb.python/py-type.exp (test_fields): Add vector tests.
2012-08-10 20:26:00 +00:00
Siddhesh Poyarekar 200bc880f4 * python/py-type.c (convert_field): Use gdb_py_long_from_longest
for TYPE_FIELD_BITPOS.
	(typy_get_sizeof): Likewise for TYPE_LENGTH.
2012-08-10 18:55:18 +00:00
Jan Kratochvil f66713d24a gdb/
* python/py-inferior.c (infpy_threads): Call update_thread_list ().

gdb/testsuite/
	* gdb.python/py-inferior.c (thread): New function.
	(check_threads): New function.
	(test_threads): New function.
	* gdb.python/py-inferior.exp: Added test.
	Replaced runto with continue to breakpoint.
2012-07-26 19:09:35 +00:00
Siva Chandra Reddy ee0bf529c3 2012-06-26 Siva Chandra Reddy <sivachandra@google.com>
New attribute 'last' for gdb.Symtab_and_line.
        * NEWS (Python Scripting): Add entry about the new attribute.
        * python/py-symtab.c (salpy_get_last): New function which
        implements the get method for the 'last' attribute of
        gdb.Symtab_and_line.
        (sal_object_getset): Add entry for the 'last' attribute.

        doc/
        * gdb.texinfo (Symbol Tables In Python): Add description about
        the new 'last' attribute of gdb.Symtab_and line.

        testsuite/
        * gdb.python/py-symtab.exp: Add tests to test the new attribute
        'last' of gdb.Symtab_and_line.
        * gdb.python/py-symbol.c: Move break point comment to enable
        testing of gdb.Symtab_and_line.last.
2012-06-27 00:21:21 +00:00
Michael Eager adb4fe3b30 PR14291: KeyboardInterrupt not caught for Python output 2012-06-25 16:53:20 +00:00
Yao Qi 972daa01e2 gdb:
* corefile.c (write_memory_with_notification): New.
	* gdbcore.h: Declare write_memory_with_notification.
	* ada-lang.c (ada_value_assign): Replace 'write_memory' and
	'observer_notify_memory_changed' with 'write_memory_with_notification'.
	* valops.c (value_assign): Likewise.
	* python/py-inferior.c (infpy_write_memory): Call
	'write_memory_with_notification'.
2012-06-24 07:28:10 +00:00
Yao Qi 2678e2af1f * python/py-inferior.c: Update comments of infpy_read_memory
and infpy_write_memory.

gdb/doc:

        * gdb.texinfo (Inferiors In Python): Replace "gdb.read_memory"
        and "gdb.write_memory" with "Inferior.read_memory" and
        "Inferior.write_memory".
2012-06-20 04:02:22 +00:00
Tom Tromey 49c4e619f8 * ada-lang.c (ada_make_symbol_completion_list): Return a VEC.
* breakpoint.c (catch_syscall_completer): Return a VEC.
	* cli/cli-cmds.c (complete_command): Update.
	* cli/cli-decode.c (complete_on_cmdlist): Return a VEC.
	(complete_on_enum): Likewise.
	* command.h: Include gdb_vecs.h.
	(completer_ftype): Change return type.
	(complete_on_cmdlist, complete_on_enum): Likewise.
	* completer.c (noop_completer, filename_completer)
	(location_completer): Return a VEC.
	(add_struct_fields): Remove 'nextp' argument.  Change 'output'
	to a VEC.
	(expression_completer, complete_line_internal, complete_line)
	(command_completer): Return a VEC.
	(gdb_completion_word_break_characters, line_completion_function):
	Update.
	* completer.h: Include gdb_vecs.h.
	(complete_line, noop_completer, filename_completer)
	(expression_completer, location_completer, command_completer):
	Update.
	* f-lang.c (f_word_break_characters): Return a VEC.
	* interps.c (interpreter_completer): Return a VEC.
	* language.h (struct language_defn)
	<la_make_symbol_completion_list>: Return a VEC.
	* python/py-cmd.c (cmdpy_completer): Return a VEC.
	* symtab.c (free_completion_list): Take a VEC.
	(return_val_size, return_val_index): Remove.
	(return_val): Now a VEC.
	(completion_list_add_name): Update.
	(default_make_symbol_completion_list_break_on)
	(default_make_symbol_completion_list, make_symbol_completion_list)
	(make_symbol_completion_list_fn, make_file_symbol_completion_list):
	Return a VEC.
	(add_filename_to_list): Update.
	(struct add_partial_filename_data) <list_used, list_alloced>: Remove.
	<list>: Now a VEC.
	(maybe_add_partial_symtab_filename): Update.
	(make_source_files_completion_list): Return a VEC.
	* symtab.h (default_make_symbol_completion_list_break_on)
	(default_make_symbol_completion_list, make_symbol_completion_list)
	(make_symbol_completion_list_fn, make_file_symbol_completion_list)
	(make_source_files_completion_list): Update.
2012-06-13 15:47:16 +00:00
Tom Tromey 625e8578d7 * breakpoint.c (add_catch_command): Use completer_ftype.
* breakpoint.h: Include command.h.
	(add_catch_command): Use completer_ftype.
	* cli/cli-decode.c (set_cmd_completer): Use completer_ftype.
	* cli/cli-decode.h (struct cmd_list_element) <completer>:
	Use completer_ftype.
	* command.h (completer_ftype): New typedef.
	(set_cmd_completer): Use it.
	* python/py-cmd.c (struct cmdpy_completer) <completer>: Use
	completer_ftype.
2012-06-13 15:41:24 +00:00
Pedro Alves a493e3e2e4 gdb/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

gdb/gdbserver/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

include/gdb/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        * gdb/signals.def: Replace TARGET_SIGNAL_ with GDB_SIGNAL_
	throughout.

sim/arm/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/avr/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/common/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/cr16/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/d10v/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/erc32/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/m32c/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/ppc/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/rl78/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.

sim/rx/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

        Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.
2012-05-24 16:51:47 +00:00
Pedro Alves 2ea286498f gdb/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

	Replace target_signal with gdb_signal throughout.

gdb/gdbserver/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

	Replace target_signal with gdb_signal throughout.

include/gdb/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

	Replace target_signal with gdb_signal throughout.

sim/common/
2012-05-24  Pedro Alves  <palves@redhat.com>

	PR gdb/7205

	Replace target_signal with gdb_signal throughout.
2012-05-24 16:39:15 +00:00
Sergio Durigan Junior 22e048c9dd 2012-05-18 Sergio Durigan Junior <sergiodj@redhat.com>
* ada-lang.c:
	* ada-tasks.c:
	* ada-varobj.c:
	* amd64-darwin-tdep.c:
	* arm-symbian-tdep.c:
	* arm-tdep.c:
	* avr-tdep.c:
	* ax-gdb.c:
	* bfin-linux-tdep.c:
	* breakpoint.c:
	* c-valprint.c:
	* cli/cli-cmds.c:
	* coffread.c:
	* cp-support.c:
	* cris-tdep.c:
	* dwarf2-frame-tailcall.c:
	* dwarf2-frame.c:
	* dwarf2expr.c:
	* dwarf2loc.c:
	* dwarf2read.c:
	* elfread.c:
	* eval.c:
	* expprint.c:
	* f-valprint.c:
	* frv-tdep.c:
	* h8300-tdep.c:
	* hppa-hpux-tdep.c:
	* hppa-tdep.c:
	* hppanbsd-tdep.c:
	* i386-nto-tdep.c:
	* i386-tdep.c:
	* i387-tdep.c:
	* ia64-tdep.c:
	* jit.c:
	* linespec.c:
	* linux-tdep.c:
	* lm32-tdep.c:
	* m2-valprint.c:
	* m32c-tdep.c:
	* m32r-rom.c:
	* m32r-tdep.c:
	* m68k-tdep.c:
	* m68klinux-tdep.c:
	* mi/mi-main.c:
	* microblaze-tdep.c:
	* mips-linux-tdep.c:
	* mips-tdep.c:
	* mn10300-tdep.c:
	* p-valprint.c:
	* parse.c:
	* ppc-linux-tdep.c:
	* ppc-sysv-tdep.c:
	* printcmd.c:
	* python/py-finishbreakpoint.c:
	* python/py-inferior.c:
	* python/py-infthread.c:
	* python/py-type.c:
	* python/python.c:
	* remote-fileio.c:
	* remote-m32r-sdi.c:
	* remote-mips.c:
	* reverse.c:
	* rl78-tdep.c:
	* rs6000-aix-tdep.c:
	* rs6000-tdep.c:
	* s390-tdep.c:
	* score-tdep.c:
	* sh64-tdep.c:
	* skip.c:
	* solib-darwin.c:
	* solib-dsbt.c:
	* solib-frv.c:
	* sparc-tdep.c:
	* spu-multiarch.c:
	* spu-tdep.c:
	* stack.c:
	* symfile.c:
	* symtab.c:
	* tic6x-tdep.c:
	* tracepoint.c:
	* v850-tdep.c:
	* valarith.c:
	* valprint.c:
	* value.c:
	* xcoffread.c:
	* xtensa-tdep.c:
	* ada-lang.c:
	* ada-tasks.c:
	* ada-varobj.c:
	* amd64-darwin-tdep.c:
	* arm-symbian-tdep.c:
	* arm-tdep.c: Delete unused variables.
2012-05-18 21:02:52 +00:00
Maciej W. Rozycki 6a3a010ba6 gdb/
* breakpoint.h (bp_location): Add related_address member.
	* inferior.h (get_return_value): Take a pointer to struct value
	instead of struct type for the function requested.
	* value.h (using_struct_return): Likewise.
	* gdbarch.sh (return_value): Take a pointer to struct value
	instead of struct type for the function requested.
	* breakpoint.c (set_breakpoint_location_function): Initialize
	related_address for bp_gnu_ifunc_resolver breakpoints.
	* elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the
	requested function's address to gdbarch_return_value.
	* eval.c (evaluate_subexp_standard): Pass the requested
	function's address to using_struct_return.
	* infcall.c (call_function_by_hand): Pass the requested
	function's address to using_struct_return and
	gdbarch_return_value.
	* infcmd.c (get_return_value): Take a pointer to struct value
	instead of struct type for the function requested.
	(print_return_value): Update accordingly.
	(finish_command_continuation): Likewise.
	* stack.c (return_command): Pass the requested function's
	address to using_struct_return and gdbarch_return_value.
	* value.c (using_struct_return): Take a pointer to struct value
	instead of struct type for the function requested.  Pass the
	requested function's address to gdbarch_return_value.
	* python/py-finishbreakpoint.c (finish_breakpoint_object):
	New function_value member, replacing function_type.
	(bpfinishpy_dealloc): Update accordingly.
	(bpfinishpy_pre_stop_hook): Likewise.
	(bpfinishpy_init): Likewise.  Record the requested function's
	address.
	* mips-tdep.c (mips_fval_reg): New enum.
	(mips_o32_push_dummy_call): For MIPS16 FP doubles do not swap
	words put in GP registers.
	(mips_o64_push_dummy_call): Update a comment.
	(mips_o32_return_value): Take a pointer to struct value instead
	of struct type for the function requested and use it to check if
	using the MIPS16 calling convention.  Return the designated
	general purpose registers for floating-point values returned in
	MIPS16 mode.
	(mips_o64_return_value): Likewise.
	* ppc-tdep.h (ppc_sysv_abi_return_value): Update prototype.
	(ppc_sysv_abi_broken_return_value): Likewise.
	(ppc64_sysv_abi_return_value): Likewise.
	* alpha-tdep.c (alpha_return_value): Take a pointer to struct
	value instead of struct type for the function requested.
	* amd64-tdep.c (amd64_return_value): Likewise.
	* amd64-windows-tdep.c (amd64_windows_return_value): Likewise.
	* arm-tdep.c (arm_return_value): Likewise.
	* avr-tdep.c (avr_return_value): Likewise.
	* bfin-tdep.c (bfin_return_value): Likewise.
	* cris-tdep.c (cris_return_value): Likewise.
	* frv-tdep.c (frv_return_value): Likewise.
	* h8300-tdep.c (h8300_return_value): Likewise.
	(h8300h_return_value): Likewise.
	* hppa-tdep.c (hppa32_return_value): Likewise.
	(hppa64_return_value): Likewise.
	* i386-tdep.c (i386_return_value): Likewise.
	* ia64-tdep.c (ia64_return_value): Likewise.
	* iq2000-tdep.c (iq2000_return_value): Likewise.
	* lm32-tdep.c (lm32_return_value): Likewise.
	* m32c-tdep.c (m32c_return_value): Likewise.
	* m32r-tdep.c (m32r_return_value): Likewise.
	* m68hc11-tdep.c (m68hc11_return_value): Likewise.
	* m68k-tdep.c (m68k_return_value): Likewise.
	(m68k_svr4_return_value): Likewise.
	* m88k-tdep.c (m88k_return_value): Likewise.
	* mep-tdep.c (mep_return_value): Likewise.
	* microblaze-tdep.c (microblaze_return_value): Likewise.
	* mn10300-tdep.c (mn10300_return_value): Likewise.
	* moxie-tdep.c (moxie_return_value): Likewise.
	* mt-tdep.c (mt_return_value): Likewise.
	* ppc-linux-tdep.c (ppc_linux_return_value): Likewise.
	* ppc-sysv-tdep.c (ppc_sysv_abi_return_value): Likewise.
	(ppc_sysv_abi_broken_return_value): Likewise.
	(ppc64_sysv_abi_return_value): Likewise.
	* ppcnbsd-tdep.c (ppcnbsd_return_value): Likewise.
	* rl78-tdep.c (rl78_return_value): Likewise.
	* rs6000-aix-tdep.c (rs6000_return_value): Likewise.
	* rx-tdep.c (rx_return_value): Likewise.
	* s390-tdep.c (s390_return_value): Likewise.
	* score-tdep.c (score_return_value): Likewise.
	* sh-tdep.c (sh_return_value_nofpu): Likewise.
	(sh_return_value_fpu): Likewise.
	* sh64-tdep.c (sh64_return_value): Likewise.
	* sparc-tdep.c (sparc32_return_value): Likewise.
	* sparc64-tdep.c (sparc64_return_value): Likewise.
	* spu-tdep.c (spu_return_value): Likewise.
	* tic6x-tdep.c (tic6x_return_value): Likewise.
	* v850-tdep.c (v850_return_value): Likewise.
	* vax-tdep.c (vax_return_value): Likewise.
	* xstormy16-tdep.c (xstormy16_return_value): Likewise.
	* xtensa-tdep.c (xtensa_return_value): Likewise.
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.

	gdb/testsuite/
	* gdb.base/return-nodebug.exp: Also test float and double types.
2012-05-16 14:35:09 +00:00
Tom Tromey 29ca12b317 * python/python.c (gdbpy_find_pc_line): Use gdb_py_ulongest. 2012-05-15 20:26:10 +00:00
Stan Shebs e7e0cddfb0 2012-05-14 Stan Shebs <stan@codesourcery.com>
Add dynamic printf.
	* breakpoint.h (enum bptype): New type bp_dprintf.
	(struct breakpoint): New field extra_string.
	(struct breakpoint_ops): Add arg to create_breakpoints_sal.
	(create_breakpoint): Add extra_string arg.
	* breakpoint.c (dprintf_breakpoint_ops): New.
	(is_breakpoint): Add bp_dprintf.
	(bpstat_what): Add dprintf case.
	(bptype_string): Ditto.
	(print_one_breakpoint_location): Ditto.
	(init_bp_location): Ditto.
	(bkpt_print_mention): Ditto.
	(dprintf_style_enums): New array.
	(dprintf_style): New global.
	(dprintf_function): New global.
	(dprintf_channel): New global.
	(update_dprintf_command_list): New function.
	(update_dprintf_commands): New function.
	(init_breakpoint_sal): Add extra_string argument, handle it.
	(create_breakpoint_sal): Add extra_string argument.
	(create_breakpoints_sal): Add extra_string argument, update callers.
	(find_condition_and_thread): Add extra argument.
	(create_breakpoint): Add extra_string argument, record it.
	(dprintf_command): New function.
	(break_command_1): Add arg to create_breakpoint call.
	(handle_gnu_v3_exceptions): Ditto.
	(trace_command): Ditto.
	(ftrace_command): Ditto.
	(strace_command): Ditto.
	(bkpt_print_mention): Add dprintf case.
	(create_breakpoint_sal_default): Add extra_string argument.
	(_initialize_breakpoint): Add new commands.
	* mi/mi-cmd-break.c (mi_cmd_break_insert): Add arg to call.
	* python/py-breakpoint.c (bppy_init): Ditto.
	* python/py-finishbreakpoint.c (bpfinishpy_init): Ditto.

	* gdb.texinfo (Dynamic Printf): New subsection.

	* gdb.base/dprintf.c: New file.
	* gdb.base/dprintf.exp: New file.
2012-05-14 15:38:41 +00:00
Siva Chandra Reddy 9f676e6662 2012-05-14 Siva Chandra Reddy <sivachandra@google.com>
* python/python.c (gdbpy_find_pc_line): Use ULONGEST instead of
	unsigned long long.
2012-05-14 03:06:47 +00:00
Siva Chandra Reddy 7efc75aaf9 2012-05-13 Siva Chandra Reddy <sivachandra@google.com>
Add a new function gdb.find_pc_line to the Python API.
	* NEWS (Python Scripting): Add entry about the new function.
	* python/python.c (gdbpy_find_pc_line): New function which
	implements gdb.find_pc_line.
	(GdbMethods): Add entry for the new function.

	doc/
	* gdb.texinfo (Basic Python): Add description about the function
	gdb.find_pc_line

	testsuite/
	* gdb.python/python.c: Add a new breakpoint comment.
	* gdb.python/python.exp: Add tests to test gdb.find_pc_line.
2012-05-13 11:33:44 +00:00
Tom Tromey 8157b174fd * tracepoint.c (scope_info): Update.
* symtab.c (lookup_block_symbol, iterate_over_symbols)
	(find_pc_sect_symtab, search_symbols)
	(default_make_symbol_completion_list_break_on)
	(make_file_symbol_completion_list): Update.
	* symmisc.c (dump_symtab_1): Update.
	* stack.c (print_frame_args, iterate_over_block_locals)
	(print_frame_labels, iterate_over_block_arg_vars): Update.
	* python/py-block.c (block_object) <dict>: Remove.
	<block>: New field.
	<iter>: Change type.
	(blpy_iter): Update.
	(blpy_block_syms_iternext): Update.
	* psymtab.c (map_block): Use block iterators.
	* objfiles.c (objfile_relocate1): Use ALL_DICT_SYMBOLS.
	* mi/mi-cmd-stack.c (list_args_or_locals): Update.
	* mdebugread.c (parse_symbol, mylookup_symbol): Update.
	* infrun.c (check_exception_resume): Update.
	* cp-support.c (make_symbol_overload_list_block): Update.
	* coffread.c (patch_opaque_types): Update.
	* buildsym.c (finish_block, end_symtab): Use ALL_DICT_SYMBOLS.
	* block.h (struct block_iterator): New.
	(block_iterator_first, block_iterator_next, block_iter_name_first)
	(block_iter_name_next, block_iter_match_first)
	(block_iter_match_next): Declare.
	(ALL_BLOCK_SYMBOLS): Redefine.
	* block.c (block_iterator_first, block_iterator_next)
	(block_iter_name_first, block_iter_name_next)
	(block_iter_match_first, block_iter_match_next): New functions.
	* ada-lang.c (ada_add_block_symbols)
	(ada_make_symbol_completion_list): Use block iterator.
2012-05-10 19:50:09 +00:00
Siva Chandra Reddy a20ee7a4a9 2012-05-03 Siva Chandra Reddy <sivachandra@google.com>
Add two new methods global_block and static_block to gdb.Symtab
	objects.
	* NEWS (Python scripting): Add entry about the new methods.
	* python/py-symtab.c (stpy_global_block): New function which
	implements the gdb.Symtab.global_block() method.
	(stpy_static_block): New function which implements the
	gdb.Symtab.static_block() method.
	(symtab_object_methods): Add entries for the two new methods.

	* testsuite/gdb.python/py-symbol.exp: Add tests to test the new
	methods gdb.Symtab.global_block() and gdb.Symtab.static_block().
	* tessuite/gdb.python/py-symbol.c: Add new struct to help test
	gdb.Symtab.static_block().

	* doc/gdb.texinfo (Symbol Tables In Python): Add documentation
	about the new methods global_block and static_block on
	gdb.Symtab objects.
2012-05-03 07:07:26 +00:00
Jan Kratochvil 4fb2c64af1 gdb/
Fix compilation compatibility with python-2.4
	* python/py-type.c (convert_field): Cast ADDRSTRING for
	PyObject_SetAttrString as non-const.  New comment.
2012-04-20 07:17:58 +00:00
Jan Kratochvil 14e75d8ea4 gdb/
PR symtab/7259:
	* ada-exp.y (convert_char_literal): Use TYPE_FIELD_ENUMVAL.
	* ada-lang.c (ada_discrete_type_high_bound)
	(ada_discrete_type_low_bound): Use TYPE_FIELD_ENUMVAL for
	TYPE_CODE_ENUM.
	(ada_identical_enum_types_p): Use TYPE_FIELD_ENUMVAL.
	(pos_atr, value_val_atr): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM.
	* ada-typeprint.c (print_enum_type): Change variable lastval to LONGEST.
	Use TYPE_FIELD_ENUMVAL.
	* ada-valprint.c (print_optional_low_bound, ada_print_scalar)
	(ada_val_print_1): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM.
	* c-typeprint.c (c_type_print_base): Move variable lastval to inner
	block, change it to LONGEST.  Use TYPE_FIELD_ENUMVAL for
	TYPE_CODE_ENUM.
	* coffread.c (coff_read_enum_type): Use SET_FIELD_ENUMVAL.
	* dwarf2read.c (process_enumeration_scope): Likewise.
	* gdb-gdb.py (TypeFlagsPrinter): Use field.enumval instead of
	field.bitpos.
	(class StructMainTypePrettyPrinter): Support also
	FIELD_LOC_KIND_ENUMVAL.
	* gdbtypes.c (get_discrete_bounds): Use TYPE_FIELD_ENUMVAL for
	TYPE_CODE_ENUM.
	(recursive_dump_type): Use TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM.
	(copy_type_recursive): Support also FIELD_LOC_KIND_ENUMVAL.
	* gdbtypes.h (enum field_loc_kind): New FIELD_LOC_KIND_ENUMVAL.
	(struct main_type.flds_bnds.fields.loc): Adjust bitpos comment.  New
	field enumval.
	(struct main_type.flds_bnds.bields): Adjust loc_kind and bitsize to
	accommodate enumval.
	(struct call_site): Adjust loc_kind to accommodate enumval.
	(FIELD_ENUMVAL, FIELD_ENUMVAL_LVAL, SET_FIELD_ENUMVAL)
	(TYPE_FIELD_ENUMVAL): New macros.
	* m2-typeprint.c (m2_enum): Use TYPE_FIELD_ENUMVAL.
	* mdebugread.c (parse_symbol): Use TYPE_FIELD_ENUMVAL for
	TYPE_CODE_ENUM.
	* p-typeprint.c (pascal_type_print_base): Likewise.
	* python/lib/gdb/printing.py (class FlagEnumerationPrinter): Use
	enumval.
	* python/lib/gdb/types.py (make_enum_dict): Likewise.
	* python/py-type.c (convert_field): New variable addrstring.  Use
	TYPE_FIELD_ENUMVAL for TYPE_CODE_ENUM.
	(check_types_equal): Support also FIELD_LOC_KIND_ENUMVAL.
	* stabsread.c (read_enum_type): Use SET_FIELD_ENUMVAL.
	* typepint.c (print_type_scalar): Use TYPE_FIELD_ENUMVAL for
	TYPE_CODE_ENUM.
	* valprint.c (generic_val_print): Likewise.

gdb/testsuite/
	PR symtab/7259:
	* gdb.base/enumval.c: New test case.
	* gdb.base/enumval.exp: New test case.
	* gdb.python/py-type.exp (test_enums): Use field.enumval instead of
	field.bitpos.
2012-04-18 06:46:47 +00:00
Jan Kratochvil 4dc84fd109 gdb/
New option "set debug auto-load".
	* NEWS: New commands "set debug auto-load" and "show debug auto-load".
	* auto-load.c (debug_auto_load, show_debug_auto_load: New.
	(auto_load_safe_path_vec_update)
	(filename_is_in_auto_load_safe_path_vec): Call fprintf_unfiltered
	if DEBUG_AUTO_LOAD.
	(file_is_auto_load_safe): New parameters debug_fmt and ....
	Call fprintf_unfiltered if DEBUG_AUTO_LOAD.
	(source_gdb_script_for_objfile): Extend the file_is_auto_load_safe
	caller by explanatory string.
	(_initialize_auto_load): Register "set debug auto-load".
	* auto-load.h (file_is_auto_load_safe): New parameters debug_fmt
	and ....
	* linux-thread-db.c (try_thread_db_load_from_pdir_1)
	(try_thread_db_load_from_dir): Extend the file_is_auto_load_safe caller
	by explanatory string.
	* main.c (captured_main): Likewise.
	* python/py-auto-load.c (gdbpy_load_auto_script_for_objfile)
	(source_section_scripts): Likewise.

gdb/doc/
	New option "set debug auto-load".
	* gdb.texinfo (Auto-loading): New menu item for auto-load verbose mode.
	(auto-load verbose mode): New node.
2012-04-17 15:56:21 +00:00
Jan Kratochvil bccbefd2aa gdb/
New option "set auto-load safe-path".
	* NEWS: New commands "set auto-load safe-path"
	and "show auto-load safe-path".
	* auto-load.c: Include gdb_vecs.h, readline/tilde.h and completer.h.
	(auto_load_safe_path, auto_load_safe_path_vec)
	(auto_load_safe_path_vec_update, set_auto_load_safe_path)
	(show_auto_load_safe_path, add_auto_load_safe_path, filename_is_in_dir)
	(filename_is_in_auto_load_safe_path_vec, file_is_auto_load_safe): New.
	(source_gdb_script_for_objfile): New variable is_safe.  Call
	file_is_auto_load_safe.  Return if it is not.
	(struct loaded_script): New field loaded.
	(maybe_add_script): Add parameter loaded.  Initialize SLOT with it.
	(print_script): Use LOADED indicator instead of FULL_PATH.  Change
	output "Missing" to "No".
	(_initialize_auto_load): New variable cmd.  Initialize
	auto_load_safe_path.  Register "set auto-load safe-path",
	"show auto-load safe-path" and "add-auto-load-safe-path".
	* auto-load.h (maybe_add_script): Add parameter loaded.
	(file_is_auto_load_safe): New declaration.
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: New parameters --with-auto-load-safe-path
	and --without-auto-load-safe-path.
	* linux-thread-db.c (try_thread_db_load_from_pdir_1)
	(try_thread_db_load_from_dir): Check file_is_auto_load_safe first.
	* main.c (captured_main): Check file_is_auto_load_safe for
	LOCAL_GDBINIT.
	* python/py-auto-load.c (gdbpy_load_auto_script_for_objfile): New
	variable is_safe.  Call file_is_auto_load_safe.  Return if it is not.
	(source_section_scripts): Call file_is_auto_load_safe.  Return if it is
	not.

gdb/doc/
	New option "set auto-load safe-path".
	* gdb.texinfo (Auto-loading): Extend the "show auto-load"
	and "info auto-load" examples for safe-path.  Put there also references
	for "set auto-load safe-path" and "show auto-load safe-path".
	New menu item for Auto-loading safe path.
	(Auto-loading safe path): New node.
	(Python Auto-loading): Update the expected output from "Missing"
	to "No".

gdb/testsuite/
	New option "set auto-load safe-path".
	* gdb.python/py-objfile-script.exp (set auto-load safe-path): New.
	* gdb.python/py-section-script.exp (set auto-load safe-path): New.
2012-04-17 15:54:35 +00:00
Jan Kratochvil bf88dd6849 gdb/
auto-load: Implementation.
	* NEWS: New descriptions for "info auto-load",
	"info auto-load gdb-scripts", "info auto-load python-scripts",
	"info auto-load local-gdbinit" and "info auto-load libthread-db".
	Deprecate "info auto-load-scripts", "set auto-load-scripts on|off"
	and "show auto-load-scripts".  New description for "set auto-load",
	"show auto-load", "set auto-load gdb-scripts",
	"show auto-load gdb-scripts", "set auto-load python-scripts",
	"show auto-load python-scripts", "set auto-load local-gdbinit",
	"show auto-load local-gdbinit", "set auto-load libthread-db" and
	"show auto-load libthread-db".
	* auto-load.c: Remove include python/python-internal.h.  Add includes
	exceptions.h, cli/cli-script.h, gdbcmd.h, cli/cli-decode.h and
	cli/cli-setshow.h.
	(GDB_AUTO_FILE_NAME, source_gdb_script_for_objfile)
	(auto_load_gdb_scripts, show_auto_load_gdb_scripts): New.
	(gdbpy_global_auto_load): Rename to ...
	(global_auto_load): ... here.
	(auto_load_local_gdbinit, auto_load_local_gdbinit_pathname)
	(auto_load_local_gdbinit_loaded, show_auto_load_local_gdbinit)
	(script_language_gdb, source_gdb_script_for_objfile): New.
	(struct loaded_script): New field language.
	(hash_loaded_script_entry, eq_loaded_script_entry): Calculate also
	LANGUAGE.
	(maybe_add_script): Add parameter language.  Drop redundant
	entry.full_path initialization.  Initialize entry.language and
	(*slot)->language.
	(auto_load_objfile_script): Change parameter suffix to language.
	Remove the call of maybe_add_script.
	Call language->source_script_for_objfile.
	(load_auto_scripts_for_objfile, struct collect_matching_scripts_data):
	New.
	(collect_matching_scripts): Adjust it for
	struct collect_matching_scripts_data.
	(auto_load_info_scripts_pattern_nl): New variable.
	(info_auto_load_scripts): Rename to ...
	(auto_load_info_scripts): ... here, add parameter language.  Adjust it
	for struct collect_matching_scripts_data.
	(info_auto_load_gdb_scripts, info_auto_load_local_gdbinit)
	(set_auto_load_cmd, auto_load_set_cmdlist_get, show_auto_load_cmd)
	(auto_load_show_cmdlist_get, info_auto_load_cmd)
	(auto_load_info_cmdlist_get): New.
	(_initialize_auto_load): Move add_info of "auto-load-scripts" to
	python/py-auto-load.c.  New installment for "set auto-load gdb-scripts",
	"info auto-load gdb-scripts", "set auto-load local-gdbinit" and
	"info auto-load local-gdbinit".
	* auto-load.h (struct script_language): New.
	(gdbpy_global_auto_load): Rename to ...
	(global_auto_load): ... here.
	(auto_load_local_gdbinit, auto_load_local_gdbinit_pathname)
	(auto_load_local_gdbinit_loaded): New declarations.
	(maybe_add_script): New parameter language.
	(auto_load_objfile_script): Change parameter suffix to language.
	(load_auto_scripts_for_objfile, auto_load_info_scripts_pattern_nl)
	(auto_load_info_scripts, auto_load_set_cmdlist_get)
	(auto_load_show_cmdlist_get, auto_load_info_cmdlist_get): New
	declarations.
	* linux-thread-db.c: Include auto-load.h and ctype.h.
	(auto_load_thread_db, show_auto_load_thread_db): New.
	(struct thread_db_info): New field filename.
	(delete_thread_db_info): Call xfree for FILENAME.
	(try_thread_db_load): Initialize FILENAME.
	(try_thread_db_load_from_pdir, try_thread_db_load_from_dir): Return
	if !AUTO_LOAD_THREAD_DB.
	(info_auto_load_libthread_db_compare, info_auto_load_libthread_db): New.
	(_initialize_thread_db): Install auto_load_thread_db
	as "set auto-load libthread-db" and install info_auto_load_libthread_db
	as "info auto-load libthread-db".
	* main.c (captured_main): Rename gdbpy_global_auto_load to
	global_auto_load.  Initialize AUTO_LOAD_LOCAL_GDBINIT_PATHNAME and
	AUTO_LOAD_LOCAL_GDBINIT_LOADED.
	(print_gdb_help): Extend the help for 'local init file'.
	* python/py-auto-load.c: Remove a comment about gdb scripts extension.
	(GDBPY_AUTO_SECTION_NAME): Extend the comment it is Python specific.
	(auto_load_scripts): Rename to ...
	(auto_load_python_scripts): ... here, update the comment.
	(gdbpy_load_auto_script_for_objfile): New declaration.
	(show_auto_load_python_scripts, script_language_python)
	(gdbpy_load_auto_script_for_objfile): New.
	(source_section_scripts): Refactor the code.
	(load_auto_scripts_for_objfile): Rename to ...
	(gdbpy_load_auto_scripts_for_objfile): ... here, update the
	auto_load_objfile_script caller, drop GDBPY_GLOBAL_AUTO_LOAD checking.
	(info_auto_load_python_scripts): New.
	(gdbpy_initialize_auto_load): New variables cmd and cmd_name.
	Rename "set auto-load-scripts" to "set auto-load python-scripts".
	Register "set auto-load-scripts" as its deprecated alias.  Register
	"info auto-load python-scripts".  Register "info auto-load-scripts" as
	its deprecated alias.
	(load_auto_scripts_for_objfile): Rename to ...
	(gdbpy_load_auto_scripts_for_objfile): ... here.
	* python/python.h (load_auto_scripts_for_objfile): Rename to ...
	(gdbpy_load_auto_scripts_for_objfile): ... here.

gdb/doc/
	auto-load: Implementation.
	* gdb.texinfo (Mode Options): New anchor for -nx.
	(Startup): New anchors for Option -init-eval-command,
	Home Directory Init File
	and Init File in the Current Directory during Startup.
	Mention set auto-load local-gdbinit with a reference.
	Change the sample code to "set auto-load python-scripts".
	(Threads): New anchor set libthread-db-search-path.
	Provide references to libthread_db.so.1 file.
	(Controlling GDB): New menu item for Auto-loading.
	(Auto-loading, Init File in the Current Directory)
	(libthread_db.so.1 file, objfile-gdb.gdb file): New nodes.
	(Python): Rename the menu item Auto-loading to Python Auto-loading.
	(Writing a Pretty-Printer, Objfiles In Python): Update the renamed
	reference.
	(Auto-loading): Rename to ...
	(Python Auto-loading): ... here.  Change "set auto-load-scripts" to
	"set auto-load python-scripts", new anchor for it.  Change
	"show auto-load-scripts" to "show auto-load python-scripts", new anchor
	for it.  Change "info auto-load-scripts"
	to "info auto-load python-scripts", new anchor for it.  Change "scripts"
	to "Python scripts".

gdb/testsuite/
	auto-load: Implementation.
	* gdb.base/help.exp (test set height): Increase the height.
	* gdb.python/py-objfile-script.exp (info auto-load-scripts): Change
	to ...
	(info auto-load python-scripts): ... here.
	* gdb.python/py-section-script.exp (info auto-load-scripts *): Change
	to ...
	(info auto-load python-scripts *): ... here.
2012-04-17 15:51:48 +00:00
Jan Kratochvil e2207b9a28 gdb/
auto-load: Move files.
	* Makefile.in (SFILES): Add auto-load.c.
	(HFILES_NO_SRCDIR): Add auto-load.h.
	(COMMON_OBS): Add auto-load.o.
	(distclean): Change .gdbinit for gdb-gdb.gdb.
	* auto-load.c: New file, with parts from python/py-auto-load.c.
	* auto-load.h: New file, with parts from python/python.h.
	* configure: Regenerate.
	* configure.ac (AC_OUTPUT): Change .gdbinit for gdb-gdb.gdb.
	* gdb-gdb.gdb.in: New file, renamed from gdbinit.in.
	* gdbinit.in: Remove file, rename it to gdb-gdb.gdb.in.
	* main.c: Include auto-load.h.
	* python/py-auto-load.c: Move include filenames.h, gdb_regex.h,
	command.h, observer.h and progspace.h to auto-load.c.  Add include
	auto-load.h.
	(gdbpy_global_auto_load, struct auto_load_pspace_info)
	(struct loaded_script, auto_load_pspace_data)
	(auto_load_pspace_data_cleanup, get_auto_load_pspace_data)
	(hash_loaded_script_entry, eq_loaded_script_entry)
	(init_loaded_scripts_info, get_auto_load_pspace_data_for_loading)
	(maybe_add_script): Move to auto-load.c.
	(source_section_scripts): Change maybe_add_script parameters passing,
	use script_not_found_warning_print.
	(clear_section_scripts, auto_load_objfile_script)
	(auto_load_new_objfile, loaded_script_ptr)
	(DEF_VEC_P (loaded_script_ptr), collect_matching_scripts, print_script)
	(sort_scripts_by_name, info_auto_load_scripts): Move to auto-load.c.
	(gdbpy_initialize_auto_load): Move auto_load_pspace_data,
	auto_load_new_objfile and info_auto_load_scripts initizations to
	auto-load.c.
	* python/python.h (gdbpy_global_auto_load): Move to auto-load.h.
2012-04-17 15:49:16 +00:00
Siva Chandra Reddy 06fc020f10 2012-04-02 Siva Chandra Reddy <sivachandra@google.com>
New command 'explore' which helps explore values and types in
	scope.
	* NEWS: Add an entry about the new 'explore' command.
	* data-directory/Makefile.in: Add gdb/command/explore.py
	* python/lib/gdb/command/explore.py: Implemention of the 'explore'
	command using the GDB Python API.

	* doc/gdb.texinfo (Examining Data): Document the 'explore'
	command.

	* testsuite/gdb.python/Makefile.in: Add py-explore to EXECUTABLES.
	* testsuite/gdb.python/py-explore.c: C program used for testing
	the new 'explore' command on C constructs.
	* testsuite/gdb.python/py-explore.cc: C++ program used for testing
	the new 'explore' command on C++ constructs.
	* testsuite/gdb-python/py-explore.exp: Tests for the new 'explore'
	command on C constructs.
	* testsuite/gdb-python/py-explore-cc.exp: Tests for the new
	'explore' command on C++ constructs.
2012-04-11 05:50:44 +00:00
Tom Tromey 9bc3523d11 * python/python.c (gdbpy_decode_line): Move cleanup creation out
of TRY_CATCH.  Fix error handling.
	* python/py-value.c (convert_value_from_python): Move 'old'
	declaration to innermost scope.
2012-03-30 20:05:55 +00:00
Tom Tromey cc0265cdda * python/py-inferior.c (infpy_read_memory): Remove cleanups and
explicitly free 'buffer' on exit paths.  Decref 'membuf_object'
	before returning.
2012-03-28 17:38:08 +00:00
Siva Chandra Reddy 7b282c5acc 2012-03-14 Siva Chandra <sivachandra@google.com>
Python scripting: Add new method Value.referenced_value to
        gdb.Value which can dereference pointer as well as reference
        values.
        * NEWS: Add entry under 'Python scripting' about the new method
        Value.referenced_value on gdb.Value objects.
        * python/py-value.c (valpy_referenced_value): New function
        defining a new method on gdb.Value objects which can dereference
        pointer and reference values.
        * testsuite/gdb.python/py-value.cc: Add test case for
        testing the methodology exposing C++ values to Python.
        * testsuite/gdb.python/py-value-cc.exp: Add tests testing the
        methodology exposing C++ values to Python.
        * testsuite/gdb.python/Makefile.in: Add py-value-cc to
        EXECUTABLES.
        * docs/gdb.texinfo (Python API/Values From Inferior): Add
        description about the new method Value.referenced_value.  Add
        description on how Value.dereference is different (and similar)
        to Value.referenced_value.
2012-03-22 08:10:44 +00:00
Jan Kratochvil e97a38f76e gdb/
Code cleanup.
	* python/py-auto-load.c (source_section_scripts): New variable back_to.
	Turn fclose and xfree calls into make_cleanup_fclose and make_cleanup
	with xfree.
	(auto_load_objfile_script): Turn fclose into make_cleanup_fclose.
2012-03-19 18:23:52 +00:00
Pedro Alves 44f238bb63 2012-03-13 Hui Zhu <teawater@gmail.com>
Pedro Alves  <palves@redhat.com>

	* breakpoint.c (init_breakpoint_sal): New flags parameter.  Handle
	CREATE_BREAKPOINT_FLAGS_INSERTED.
	(create_breakpoint_sal, create_breakpoints_sal)
	(base_breakpoint_create_breakpoints_sal)
	(tracepoint_create_breakpoints_sal)
	(strace_marker_create_breakpoints_sal): New flags parameter.  Pass
	down.
	(break_command_1, handle_gnu_v3_exceptions, trace_command)
	(ftrace_command, strace_command): Adjust.
	(create_tracepoint_from_upload): Pass
	CREATE_BREAKPOINT_FLAGS_INSERTED.
	* breakpoint.h (enum breakpoint_create_flags): New.
	(create_breakpoint): New flags parameter.
	* mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust.
	* python/py-breakpoint.c (bppy_init): Adjust.
	* python/py-finishbreakpoint.c (bpfinishpy_init): Adjust.
	* spu-tdep.c (spu_catch_start): Adjust.
2012-03-13 13:30:42 +00:00
Pedro Alves 49a8461db8 2012-03-01 Pedro Alves <palves@redhat.com>
* python/py-breakpoint.c: Include python.h.
	* python/py-continueevent.c (create_continue_event_object): Make
	static.
	* python/py-lazy-string.c (stpy_get_type): Make static.
	* python/py-newobjfileevent.c (create_new_objfile_event_object):
	Make static.
	* python/py-utils.c (unicode_to_target_python_string): Make
	static.
	* python/py-value.c: Include python.h.
2012-03-01 21:06:54 +00:00
Doug Evans 7d74f2446c * NEWS: Mention new python command class gdb.COMMAND_USER.
* cli/cli-cmds.c (show_user): Print error when used on a python
	command.
	(init_cli_cmds): Update documentation strings for "show user" and
	"set/show max-user-call-depth" to clarify that it does not apply to
	python commands.
	* python/py-cmd.c (cmdpy_init): Treat class_user as a valid class in
	error check.
	(gdbpy_initialize_commands): Add COMMAND_USER as a constant in
	gdb python api.
	* top.c (execute_command): Only execute a user-defined command as a
	legacy macro if c->user_commands is set.

	doc/
	* gdb.texinfo (Commands In Python): Put example python macro in
	COMMAND_USER category rather than COMMAND_OBSCURE.
	Document gdb.COMMAND_USER.
	(User-defined Commands): Update documentation to clarify
	"set/show max-user-call-depth" and "show user" don't apply to python
	commands.  Update documentation to clarify "help user-defined" may
	also include python commands defined as COMMAND_USER.

	testsuite/
	* gdb.python/py-cmd.exp: Add test to verify that python commands can
	be put in the user-defined category and that the commands appear in
	"help user-defined".
2012-03-01 19:30:25 +00:00
Tom Tromey 2e8265fd8b PR python/12070:
* python/py-event.c (event_object_getset): New global.
	(event_object_type): Reference it.
	* python/py-type.c (field_object_getset): New global.
	(field_object_type): Reference it.
	* python/python-internal.h (gdb_py_generic_dict): Declare.
	* python/py-utils.c (gdb_py_generic_dict): New function.
testsuite/gdb
	* gdb.python/py-events.py (exit_handler): Add test for 'dir'.
	* gdb.python/py-events.exp: Check 'dir' output.
	* gdb.python/py-type.exp (test_fields): Add test for 'dir'.
2012-02-17 19:24:27 +00:00
Tom Tromey c691065997 * python/py-symbol.c (sympy_value): Use _(). 2012-02-15 17:51:04 +00:00