Commit Graph

202 Commits

Author SHA1 Message Date
Eli Zaretskii 6a1b16642b * python/py-breakpoint.c (gdbpy_initialize_breakpoints): Move the
initialization of the tp_new member to the corresponding
 gdbpy_initialize_* function.
 * python/py-cmd.c (gdbpy_initialize_commands): Likewise.
 * python/py-frame.c (gdbpy_initialize_frames): Likewise.
 * python/py-function.c (gdbpy_initialize_functions): Likewise.
 * python/py-inferior.c (gdbpy_initialize_inferior): Likewise.
 * python/py-param.c (gdbpy_initialize_parameters): Likewise.
2011-08-05 14:24:10 +00:00
Pedro Alves 79a45e254f 2011-08-04 Pedro Alves <pedro@codesourcery.com>
* ui-out.h (uiout): Rename to ...
	(current_uiout): ... this.
	* ui-out.c (uiout): Rename to ...
	(current_uiout): ... this.
	* ada-lang.c (print_it_exception, print_one_exception)
	(print_mention_exception): Adjust.
	* breakpoint.c (watchpoint_check): Adjust.
	(print_breakpoint_location, print_one_breakpoint, breakpoint_1)
	(default_collect_info, watchpoints_info, print_one_catch_fork)
	(print_one_catch_vfork, print_one_catch_syscall)
	(print_one_catch_exec, mention, print_it_ranged_breakpoint)
	(print_one_ranged_breakpoint, print_mention_ranged_breakpoint)
	(print_it_watchpoint, print_mention_watchpoint)
	(print_it_masked_watchpoint, print_mention_masked_watchpoint)
	(print_it_exception_catchpoint, print_one_exception_catchpoint)
	(print_mention_exception_catchpoint, say_where, bkpt_print_it)
	(bkpt_print_mention, momentary_bkpt_print_it)
	(tracepoint_print_mention, update_static_tracepoint)
	(tracepoints_info, save_breakpoints): Adjust.
	* cli-out.c (field_separator): Adjust.
	* cp-abi.c (list_cp_abis, show_cp_abi_cmd): Adjust.
	* exceptions.c (catch_exceptions_with_msg, catch_errors): Adjust.
	* frame.c (get_current_frame): Adjust.
	* infcmd.c (run_command_1, print_return_value): Adjust.
	* inferior.c (inferior_command, info_inferiors_command): Adjust.
	* infrun.c (print_end_stepping_range_reason): Adjust.
	(print_signal_exited_reason, print_exited_reason): Adjust.
	(print_signal_received_reason, print_no_history_reason): Adjust.
	* interps.c (interp_set): Adjust.
	* osdata.c (info_osdata_command): Adjust.
	* progspace.c (maintenance_info_program_spaces_command): Adjust.
	* remote-fileio.c (remote_fileio_request): Adjust.
	* remote.c (show_remote_cmd): Adjust.
	* solib.c (info_sharedlibrary_command): Adjust.
	* source.c (print_source_lines_base): Adjust.
	* stack.c (print_stack_frame): Adjust.
	(do_gdb_disassembly, print_frame_info, print_frame): Adjust.
	* symfile-mem.c (add_vsyscall_page): Adjust.
	* symfile.c (load_progress, generic_load)
	(print_transfer_performance): Adjust.
	* thread.c (info_threads_command, restore_selected_frame)
	(thread_command): Adjust.
	* top.c (make_cleanup_restore_ui_file): Adjust.
	* tracepoint.c (tvariables_info_1, trace_status_mi, tfind_1)
	(print_one_static_tracepoint_marker): Adjust.
	* cli/cli-cmds.c (print_disassembly): Adjust.
	* cli/cli-decode.c (print_doc_line): Adjust.
	* cli/cli-interp.c (safe_execute_command): Adjust.
	* cli/cli-logging.c (set_logging_redirect, pop_output_files)
	(handle_redirections): Adjust.
	* cli/cli-script.c (show_user_1): Adjust.
	* cli/cli-setshow.c (do_setshow_command, cmd_show_list): Adjust.
	* mi/mi-cmd-break.c (breakpoint_notify): Adjust.
	* mi/mi-cmd-disas.c (mi_cmd_disassemble): Adjust.
	* mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_path)
	(mi_cmd_env_dir): Adjust.
	* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file)
	(print_partial_file_name, mi_cmd_file_list_exec_source_files): Adjust.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
	(mi_cmd_stack_info_depth, mi_cmd_stack_list_args)
	(list_args_or_locals): Adjust.
	* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_create)
	(mi_cmd_var_delete, mi_cmd_var_set_format, mi_cmd_var_set_frozen)
	(mi_cmd_var_show_format, mi_cmd_var_info_num_children)
	(mi_cmd_var_list_children, mi_cmd_var_info_type)
	(mi_cmd_var_info_path_expression, mi_cmd_var_info_expression)
	(mi_cmd_var_show_attributes, mi_cmd_var_evaluate_expression)
	(mi_cmd_var_assign, mi_cmd_var_update, varobj_update_one): Adjust.
	* mi/mi-interp.c (mi_on_normal_stop): Adjust.
	* mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_thread_select)
	(mi_cmd_thread_list_ids, mi_cmd_thread_info, print_one_inferior)
	(list_available_thread_groups, mi_cmd_list_thread_groups)
	(mi_cmd_data_list_register_names)
	(mi_cmd_data_list_changed_registers)
	(mi_cmd_data_list_register_values, get_register)
	(mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory)
	(mi_cmd_data_read_memory_bytes, mi_cmd_list_features)
	(mi_cmd_list_target_features, mi_cmd_add_inferior)
	(mi_execute_command, mi_load_progress): Adjust.
	* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Adjust.
	* python/py-auto-load.c (print_script, info_auto_load_scripts):
	Adjust.
	* python/py-breakpoint.c (bppy_get_commands): Adjust.
	* tui/tui-interp.c (tui_command_loop): Adjust.
	* tui/tui-io.c (tui_setup_io, tui_initialize_io): Adjust.
2011-08-04 19:10:14 +00:00
Pedro Alves 3a5c3e2258 2011-07-25 Pedro Alves <pedro@codesourcery.com>
gdb/
	* breakpoint.h (struct breakpoint): Move ops as first field.  Move
	exp_string, exp_string_reparse, exp, exp_valid_block, cond_exp,
	cond_exp_valid_block, val, val_valid, watchpoint_frame,
	watchpoint_thread, watchpoint_triggered ...
	(struct watchpoint): ... to this new struct.
	(is_watchpoint): Declare.
	(install_breakpoint): Add new `internal' parameter.
	* breakpoint.c (is_watchpoint): Delete declaration.
	(set_breakpoint_condition): Handle watchpoints.
	(is_watchpoint): Make public.
	(watchpoint_in_thread_scope): Change parameter type to struct
	watchpoint.
	(watchpoint_del_at_next_stop): Change parameter type to struct
	watchpoint.  Remove assertion.  Adjust.
	(update_watchpoint): Ditto.
	(insert_breakpoints, breakpoint_init_inferior)
	(watchpoints_triggered, watchpoint_check)
	(bpstat_check_watchpoint, bpstat_check_breakpoint_conditions)
	(bpstat_stop_status, print_one_breakpoint_location)
	(print_one_breakpoint_location, watchpoint_locations_match): Cast
	to struct watchpoint as necessary, and adjust.
	(install_breakpoint): Add `internal' argument.  If true, don't
	mention the new breakpoint.  Use set_breakpoint_number.
	(create_fork_vfork_event_catchpoint)
	(create_syscall_event_catchpoint): Adjust.
	(dtor_watchpoint): New.
	(re_set_watchpoint, insert_watchpoint, remove_watchpoint)
	(breakpoint_hit_watchpoint, resources_needed_watchpoint)
	(print_it_watchpoint, print_mention_watchpoint)
	(print_recreate_watchpoint, insert_masked_watchpoint)
	(remove_masked_watchpoint, resources_needed_masked_watchpoint)
	(print_one_detail_masked_watchpoint)
	(print_mention_masked_watchpoint)
	(print_recreate_masked_watchpoint): Cast to struct watchpoint as
	necessary, and adjust.
	(watch_command_1): Allocate and initialize a struct watchpoint
	instead of a struct breakpoint.  Use install_breakpoint.
	(catch_exec_command_1): Adjust.
	(base_breakpoint_dtor): Delete accesses to watchpoint specific
	fields.
	(delete_breakpoint, enable_breakpoint_disp)
	(invalidate_bp_value_on_memory_change): Cast to struct watchpoint
	as necessary, and adjust.
	(initialize_breakpoint_ops): Install dtor_watchpoint as
	watchpoints' dtor method.
	* ada-lang.c (create_ada_exception_catchpoint): Adjust.
	* python/py-breakpoint.c (bppy_get_expression): Use is_watchpoint.
	to struct watchpoint as necessary, and adjust.
2011-07-25 11:23:03 +00:00
Pedro Alves 348d480fa9 2011-07-25 Pedro Alves <pedro@codesourcery.com>
Implement most breakpoint_ops methods for all breakpoint types,
	and move the default handlings to the proper callbacks.

	gdb/
	* breakpoint.c (update_watchpoint): Always call the breakpoint's
	works_in_software_mode method.
	(insert_bp_location): Go through breakpoint_ops->insert_location
	for software and hardware watchpoints.
	(create_internal_breakpoint): Pass bkpt_breakpoint_ops as
	breakpoint_ops.
	(remove_breakpoint_1): Go through breakpoint_ops->remove_location
	for software and hardware watchpoints.
	(print_it_typical): Delete.
	(print_bp_stop_message): Always call the breakpoint_ops->print_it
	method.
	(watchpoint_check): Adjust comment.
	(bpstat_check_location): Simply always call the breakpoint's
	breakpoint_hit method.
	(bpstat_stop_status): Always call the breakpoint's check_status
	method.  Remove special cases for watchpoints and internal event
	breakpoints from here (moved to the check_status implementations).
	(print_one_breakpoint_location): Assume b->ops is never NULL.
	Remove static tracepoint marker id printing from here (moved to
	the print_one_detail callback implementation of tracepoints).
	(init_bp_location): Assert OPS is never NULL.
	(allocate_bp_location): Always call the breakpoint's
	allocate_location method, and remove the default code from here.
	(free_bp_location): Always call the location's dtor method, and
	remove the default code from here.
	(init_raw_breakpoint_without_location): Assert OPS is never NULL.
	(set_raw_breakpoint_without_location): Add new breakpoint_ops
	parameter.  Pass it down.
	(set_raw_breakpoint): Ditto.
	(print_it_catch_fork): Adjust to take a bpstat as argument.
	(catch_fork_breakpoint_ops): Install methods.
	(print_it_catch_vfork): Adjust to take a bpstat as argument.
	(catch_vfork_breakpoint_ops): Install methods.
	(dtor_catch_syscall): Call the base dtor.
	(print_it_catch_syscall): Adjust to take a bpstat as argument.
	(catch_syscall_breakpoint_ops): Install methods.
	(dtor_catch_exec): Call the base dtor.
	(print_it_catch_exec): Adjust to take a bpstat as argument.
	(catch_exec_breakpoint_ops): Install methods.
	(hw_breakpoint_used_count, hw_watchpoint_used_count): Always call
	the breakpoint's resources_needed method, and remove the default
	code from here.
	(set_momentary_breakpoint): Pass bkpt_breakpoint_ops as
	breakpoint_ops.
	(clone_momentary_breakpoint): Clone the original's ops.
	(mention): Always call the breakpoint's print_mention method, and
	remove the default code from here.
	(create_breakpoint_sal): Adjust to pass the ops to
	set_raw_breakpoint rather than setting it manually.
	(create_breakpoint): Assert ops is never NULL.  Adjust to pass the
	ops to set_raw_breakpoint_without_location rather than setting it
	manually.
	(break_command_1): Pass bkpt_breakpoint_ops as breakpoint_ops.
	(print_it_ranged_breakpoint): Adjust to take a bpstat as argument.
	(ranged_breakpoint_ops): Install methods.
	(break_range_command): Adjust to pass the ops to
	set_raw_breakpoint rather than setting it manually.
	(re_set_watchpoint, breakpoint_hit_watchpoint)
	(check_status_watchpoint, resources_needed_watchpoint)
	(works_in_software_mode_watchpoint, print_it_watchpoint)
	(print_mention_watchpoint, print_recreate_watchpoint): New
	functions.
	(watchpoint_breakpoint_ops): Install new methods.
	(print_it_masked_watchpoint): New function.
	(masked_watchpoint_breakpoint_ops): Install new methods.
	(watch_command_1): Adjust to pass the right breakpoint_ops to
	set_raw_breakpoint_without_location rather than setting it
	manually later.  Record the current pspace.
	(print_it_exception_catchpoint): Adjust to take a bpstat as
	argument.
	(gnu_v3_exception_catchpoint_ops): Install new methods.
	(say_where): New function.
	(null_re_set, null_check_status, null_works_in_software_mode)
	(null_resources_needed, null_print_one_detail, bp_location_dtor):
	New functions.
	(bp_location_ops): New global.
	(bkpt_dtor, bkpt_allocate_location, bkpt_re_set)
	(bkpt_insert_location, bkpt_remove_location, bkpt_breakpoint_hit)
	(bkpt_check_status, bkpt_resources_needed)
	(bkpt_works_in_software_mode, bkpt_print_it, bkpt_print_mention)
	(bkpt_print_recreate): New functions.
	(bkpt_breakpoint_ops): New global.
	(tracepoint_re_set, tracepoint_insert_location)
	(tracepoint_remove_location, tracepoint_breakpoint_hit)
	(tracepoint_check_status, tracepoint_works_in_software_mode)
	(tracepoint_print_it, tracepoint_print_one_detail)
	(tracepoint_print_mention, tracepoint_print_recreate): New
	functions.
	(tracepoint_breakpoint_ops): New global.
	(delete_breakpoint): Always call the breakpoint's dtor method, and
	remove the default handling from here.
	(breakpoint_re_set_default): Make static.
	(breakpoint_re_set_one): Always call the breakpoints re_set
	method, and remove the default handling from here.
	(trace_command, ftrace_command, strace_command)
	(create_tracepoint_from_upload): Pass appropriate breakpoints_ops
	to create_breakpoint.
	(save_breakpoints): Always call the breakpoint's print_recreate
	method, and remove the default handling from here.

	* ada-lang.c (dtor_exception): Call the base dtor.
	(re_set_exception): Call the base method.
	(print_it_exception, print_it_catch_exception): Adjust to take a
	bpstat as argument.
	(catch_exception_breakpoint_ops): Install methods.
	(print_it_catch_exception_unhandled): Adjust to take a bpstat as
	argument.
	(catch_exception_unhandled_breakpoint_ops): Install methods.
	(print_it_catch_assert): Adjust to take a bpstat as argument.
	(catch_assert_breakpoint_ops): Install methods.

	* breakpoint.h (struct breakpoint_ops): Adjust the print_it method
	to take a bpstat as argument.
	(enum print_stop_action): Add describing comments to each enum
	value.
	(breakpoint_re_set_default): Delete declaration.
	(null_re_set, null_works_in_software_mode, null_resources_needed)
	(null_check_status, null_print_one_detail): Declare.
	(bkpt_breakpoint_ops): Declare.
	(bkpt_dtor, bkpt_allocate_location, bkpt_re_set)
	(bkpt_insert_location, bkpt_remove_location, bkpt_breakpoint_hit)
	(bkpt_check_status, bkpt_resources_needed)
	(bkpt_works_in_software_mode, bkpt_print_it)
	(null_print_one_detail, bkpt_print_mention, bkpt_print_recreate):
	Declare.

	* mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust to pass
	bkpt_breakpoint_ops.
	* python/py-breakpoint.c (bppy_init): Ditto.
2011-07-25 11:16:49 +00:00
Phil Muldoon 95298e7219 2011-07-22 Phil Muldoon <pmuldoon@redhat.com>
* event-top.c (cli_command_loop): Use get_prompt, get_suffix,
	get_prefix.
	(display_gdb_prompt): Likewise.
	(change_annotation_level): Likewise.
	(push_prompt): Likewise.
	(pop_prompt): Likewise.
	(handle_stop_sig): Use get_prompt with a level.
	* top.c (command_loop): Use get_prompt with a level.
	(set_async_annotation_level): Use set_prompt with a level.
	(get_prefix): New function.
	(set_prefix): Ditto.
	(set_suffix): Ditto.
	(get_suffix): Ditto.
	(get_prompt): Accept a level argument.
	(set_prompt): Accept a level argument.  Free old prompts.  Set
	new_async_prompt if level is 0.
	(init_main): Use set_prompt with a level.  Do not set
	new_async_prompt.
	* event-top.h (PROMPT, SUFFIX, PREFIX): Move to top.c
	* top.h: Declare set_suffix, get_suffix, set_prefix, get_prefix.
	Modify set_prompt, get_prompt to account for levels.
	* tui/tui-interp.c (tui_command_loop): Use get_prompt with a
	level
	* python/python.c (before_prompt_hook): Use set_prompt.
2011-07-22 09:22:50 +00:00
Phil Muldoon d17b6f8101 2011-07-21 Phil Muldoon <pmuldoon@redhat.com>
Tom Tromey  <tromey@redhat.com>

	* top.c (set_prompt): Rewrite to free previous prompt, free
	asynch_new_prompt and set both on new prompts.
	* event-top.c (display_gdb_prompt): Add prompt substitution
	logic.
	* python/python.c (before_prompt_hook): New function.

2011-07-21  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/python.exp: Add prompt substitution tests.

2011-07-21  Phil Muldoon  <pmuldoon@redhat.com>

	* observer.texi (GDB Observers): Add before_prompt observer.
	* gdb.texinfo (Basic Python): Add documentation for prompt
	substitution.
2011-07-21 11:03:48 +00:00
Phil Muldoon 713389e024 2011-07-11 Phil Muldoon <pmuldoon@redhat.com>
PR python/12438
	* python/python.c: Set gdbpy_should_print_stack default to off.
	(set_python): Deprecate maint set python print-stack to
	class_deprecate.
	(_initialize_python): Deprecate maint set/show python print-stack.
	Add new prefix command, python.  Add new setting, print-backtrace.
	* NEWS: Document set python print-stack.  Document default change.

2011-07-11  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/12438
	* gdb.texinfo (Python Commands): Add deprecate note to maint
          set/show python print-stack.  Document set/show python
          print-backtrace.

2011-07-11  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/12438
	* gdb.python/python.exp: Add maint set/show python print-stack
          deprecated tests.  Add set/show python print-backtrace tests.
2011-07-11 13:07:38 +00:00
Phil Muldoon 754eadd19f 2011-07-11 Phil Muldoon <pmuldoon@redhat.com>
* python/py-inferior.c (infpy_dealloc): New function.
        (inferior_to_inferior_object): Return a new object, or a
	new reference to the existing object.
        (find_thread_object): Cleanup references to inferior.
        (delete_thread_object): Ditto.
        * python/py-infthread.c (create_thread_object): Do not increment
	inferior reference count.
2011-07-11 12:10:19 +00:00
Tom Tromey 1c033f8c71 * python/python-internal.h (PY_SSIZE_T_CLEAN): Define. 2011-06-28 13:09:12 +00:00
Tom Tromey 5fe41fbfa2 * valops.c (find_overload_match): Call do_cleanups before early
return.
	* top.c (execute_command): Call do_cleanups before early return.
	(command_loop): Likewise.
	* stack.c (backtrace_command): Make a null cleanup early.  Don't
	conditionally call do_cleanups.
	* python/py-value.c (TRY_CATCH): Move cleanup handling into
	TRY_CATCH.
	* python/py-breakpoint.c (gdbpy_breakpoint_has_py_cond): Rearrange
	so cleanups are always run.
	* mi/mi-cmd-var.c (mi_cmd_var_delete): Reset old_cleanups.
	* findcmd.c (parse_find_args): Call do_cleanups on early return
	path.
	* dbxread.c (elfstab_build_psymtabs): Make a null cleanup early.
	Don't conditionally call do_cleanups.
	* cli/cli-script.c (execute_user_command): Initialize 'old_chain'
	later.
2011-06-27 19:21:51 +00:00
Tom Tromey ddd49eeec4 * varobj.c (update_dynamic_varobj_children): Make 'name' const.
* symtab.h (lookup_struct, lookup_union, lookup_enum): Update.
	* python/python.c (gdbpy_parameter): Make 'arg' const.
	(execute_gdb_command): Likewise.
	(gdbpy_decode_line): Likewise.  Copy it.
	(gdbpy_parse_and_eval): Make 'expr_string' const.  Copy it.
	(gdbpy_write): Make 'arg' const.
	* python/py-type.c (typy_lookup_typename): Make 'type_name'
	const.
	(gdbpy_lookup_type): Likewise.
	* python/py-prettyprint.c (print_children): Make 'name' const.
	* python/py-param.c (parmpy_init): Make 'name' const.  Copy it.
	* python/py-inferior.c (infpy_write_memory): Make 'buf_len' a
	Py_ssize_t.
	* python/py-function.c (fnpy_init): Make 'name' const.
	* python/py-cmd.c (cmdpy_init): Make 'name' const.  Copy it.
	(gdbpy_string_to_argv): Make 'input' const.
	* python/py-breakpoint.c (bppy_init): Make 'spec' const.  Copy
	it.
	* gdbtypes.h (lookup_typename): Update.
	* gdbtypes.c (lookup_typename): Make 'name' const.
	(lookup_struct): Likewise.
	(lookup_union): Likewise.
	(lookup_enum): Likewise.
2011-06-24 19:47:37 +00:00
Tristan Gingold eed8f803b1 2011-06-16 Tristan Gingold <gingold@adacore.com>
* python/py-events.h (gdb_py_events): Make it extern.
	* python/py-evtregistry.c (gdb_py_events): Declare.
2011-06-16 05:54:09 +00:00
Tom Tromey 8cf64490f2 gdb
* python/py-inferior.c (python_inferior_exit): Use inferior's exit
	code fields.
	* python/py-exitedevent.c (create_exited_event_object): Change
	type of 'exit_code'.  Optionally add exit_code attribute.
	(emit_exited_event): Change type of 'exit_code'.
	* python/py-event.h (emit_exited_event): Update.
	* mi/mi-interp.c (mi_inferior_exit): Print exit code.
	* infrun.c (handle_inferior_event): Set exit code fields on
	inferior.
	* inferior.h (struct inferior) <has_exit_code, exit_code>: New
	fields.
	* inferior.c (exit_inferior_1): Initialize new fields.
gdb/doc
	* gdb.texinfo (GDB/MI Async Records): Document 'exit-code' field.
	(Events In Python): Note that exit_code is optional.
2011-06-03 15:32:44 +00:00
Pedro Alves 619cebe87f 2011-05-27 Pedro Alves <pedro@codesourcery.com>
gdb/
	* defs.h (struct thread_info, struct inferior): Delete forward
	declarations.
	* breakpoint.h (struct thread_info): New forward declaration.
	* observer.sh (struct inferior): New forward declaration.
	* python/python-internal.h (struct inferior): New forward
	declaration.
2011-05-27 18:39:49 +00:00
Doug Evans 6d64e6d477 * python/lib/gdb/printing.py (register_pretty_printer): Add missing
entry for RuntimeError to doc string.
2011-05-23 17:38:06 +00:00
Tom Tromey 310afc7652 * python/py-inferior.c (python_inferior_exit): Use
target_gdbarch.
	(python_on_resume): Likewise.
2011-05-19 18:41:23 +00:00
Doug Evans fd20d931f1 * python/py-auto-load.c (source_section_scripts): Mention objfile
name in warning.
2011-05-16 16:33:57 +00:00
Doug Evans 75fc9810e3 * python/py-autoload.c (print_script): Print "Missing" instead of
"No" for missing scripts.
	(info_auto_load_scripts): Tweak "Loaded" column to fit "Missing".

	doc/
	* gdb.texinfo (Auto-loading): Document printing of missing scripts.
2011-05-15 18:46:25 +00:00
Doug Evans dbaefcf757 * NEWS: Mention "info auto-load-scripts".
* python/py-auto-load.c (struct auto_load_pspace_info): New member
	script_not_found_warning_printed.
	(init_loaded_scripts_info): Renamed from create_loaded_scripts_hash,
	all callers updated.  Initialize script_not_found_warning_printed.
	(get_auto_load_pspace_data_for_loading): New function.
	(maybe_add_script): New function.
	(source_section_scripts): Simplify.  Only print one warning regardless
	of the number of auto-load scripts not found.
	(clear_section_scripts): Clear script_not_found_warning_printed.
	(auto_load_objfile_script): Record script in hash table.
	(count_matching_scripts): New function.
	(maybe_print_script): Renamed from maybe_print_section_script, all
	callers updated.  Rewrite to use ui_out_*.
	(info_auto_load_scripts): Renamed from
	maintenance_print_section_scripts, all callers updated.
	(gdbpy_initialize_auto_load): "maintenance print section-scripts"
	renamed as "info auto-load-scripts".

	doc/
	* gdb.texinfo (Auto-loading): Document "info auto-load-scripts".

	testsuite/
	* gdb.python/py-objfile-script.exp: New file.
	* gdb.python/py-objfile-script.c: New file.
	* gdb.python/py-objfile-script-gdb.py: New file.
	* testsuite/gdb.python/py-section-script.exp: Test
	"info auto-load-scripts".
2011-05-13 22:11:47 +00:00
Vladimir Prus f6d903988c * python/py-breakpoint.c (gdbpy_breakpoint_created): Fix
compilation.
2011-04-27 12:04:42 +00:00
Vladimir Prus 8d3788bd59 MI breakpoint notifications.
* annotate.c (breakpoint_changed): Adjust parameter type.
        * breakpoint.c (set_breakpoint_condition): Adjust to change
        in breakpoint_modified type.
        (breakpoint_set_commands): Likewise.
        (do_map_commands_command): Likewise.
        (bpstat_check_breakpoint_conditions): Notify that breakpoint has
        changed after bumping hit count.
        (bpstat_stop_status): Likewise.
        (print_one_breakpoint_location): Don't wrap in tuple here.
        (print_one_breakpoint): Always print individual locations.
        For locations, use unnamed tuple.
        (disable_breakpoints_in_unloaded_shlib): Notify that breakpoint
        has changed.
        (create_catchpoint, create_syscall_event_catchpoint): Call
        breakpoint_created obsever.
        (mention): Don't call breakpoint_created observer.
        (create_breakpoint_sal): Call breakpoint_created observer.
        (create_breakpoint, watch_command_1): Likewise.
        (create_ada_exception_breakpoint): Likewise.
        (delete_breakpoint): Call breakpoint_deleted breakpoint.
        (locations_are_equal): New.
        (update_breakpoint_locations): If locations were changed, notify.
        (set_ignore_count, disable_breakpoint, do_enable_breakpoint):
        Call breakpoint_modified observer.

        * mi/mi-cmd-break.c (breakpoint_notify): Adjust.
        (mi_cmd_break_insert): Don't set observers for modify and delete.
        * mi/mi-interp.c (mi_suppress_breakpoint_notifications): New.
        (mi_breakpoint_created, mi_breakpoint_deleted)
        (mi_breakpoint_modified): New.
        (mi_interpreter_init): Hook the above.
        * mi/mi-main.c (mi_cmd_execute): Disable breakpoint notifications
        while -break-* commands are executing.
        * mi/mi-main.h (mi_suppress_breakpoint_notifications): New.
        * mi/mi-out.c (struct ui_out_data): New field original_buffer.
        (mi_redirect): New.
        (mi_ui_out_impl): Hook in mi_redirect.
        (mi_field_skip): True to the name, skip the field, don't output
        a field with an empty value.

        * python/py-breakpoint.c (gdbpy_breakpoint_created)
        (gdbpy_breakpoint_deleted): Adjust.
        * tui/tui-hooks.c (tui_event_create_breakpoint)
        (tui_event_delete_breakpoint, tui_event_modify_breakpoint): Adjust.
2011-04-27 10:17:39 +00:00
Jan Kratochvil 626e728214 gdb/
Fix Python access to inlined frames.
	* python/py-frame.c (frapy_read_var): Find BLOCK using get_frame_block.
	* python/py-symbol.c (gdbpy_lookup_symbol): Likewise.

gdb/testsuite/
	Fix Python access to inlined frames.
	* gdb.python/py-frame-inline.c: New file.
	* gdb.python/py-frame-inline.exp: New file.
2011-04-17 14:14:23 +00:00
Tom Tromey 58438ac187 * tracepoint.c (scope_info): Update.
* symtab.c (decode_line_spec): Update.
	* python/python.c (gdbpy_decode_line): Update.
	* linespec.h (decode_line_1): Update.
	* linespec.c (decode_line_1): Remove 'not_found_ptr' argument.
	(decode_compound, find_method, symtab_from_filename)
	(decode_variable): Likewise.
	* cli/cli-cmds.c (edit_command): Update.
	(list_command): Update.
	* breakpoint.c (parse_breakpoint_sals): Remove 'not_found_ptr'
	argument.
	(create_breakpoint): Update.
	(until_break_command): Update.
	(addr_string_to_sals): Update.
	(decode_line_spec_1): Update.
2011-04-04 17:41:07 +00:00
Tom Tromey 1dae3efc56 * python/py-prettyprint.c (print_stack_unless_memory_error): Add
missing ">" to message.
2011-03-31 16:25:41 +00:00
Phil Muldoon 057758407c 2011-03-21 Phil Muldoon <pmuldoon@redhat.com>
PR python/12183

	* python/py-function.c (fnpy_call): Treat GdbErrors differently to
	other error classes.  Do not print stack trace.

2011-03-21  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/12183

	* gdb.python/py-function.exp: Add GdbError tests.
2011-03-22 09:38:16 +00:00
Pierre Muller e10abd8fbe * python/py-value.c (valpy_getitem): Fix formatting of error function
call.
2011-03-18 16:09:57 +00:00
Phil Muldoon 99c3dc11e4 2011-03-18 Phil Muldoon <pmuldoon@redhat.com>
PR python/12149

	* python/python.c (gdbpy_write): Accept a stream argument and
	operate to the appropriate stream.
	(gdbpy_flush): Likewise.
	(_initialize_python): Add stream constants.
	(finish_python_initialization): Add GdbOutputErrorFile class.

2011-03-18  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/12149

	* gdb.texinfo (Basic Python): Update gdb.write and flush text.


2011-03-18  Phil Muldoon  <pmuldoon@redhat.com>

        PR python/12149

	* gdb.python/python.exp: Add gdb.write tests.
2011-03-18 08:44:47 +00:00
Phil Muldoon 29703da4b1 2011-03-17 Phil Muldoon <pmuldoon@redhat.com>
* python/py-symtab.c: Populate symtab_object_methods,
	    sal_object_methods.
	    (stpy_is_valid): New function.
	    (salpy_is_valid): Ditto.
	    * python/py-symbol.c: Declare symbol_object_methods.
	    Populate.
	    (sympy_is_valid): New function.
	    * python/py-objfile.c: Declare objfile_object_methods.
	    Populate.
	    (objfpy_is_valid): New function.
	    * python/py-inferior.c: Populate inferior_object_methods.
	    (infpy_is_valid): New function.
	    * python/py-infthread.c: Populate thread_object_methods.
	    (thpy_is_valid): New function.
	    * python/py-block.c: Declare block_object_methods.
	    Populate.  Declare
	    block_iterator_object_methods.  Populate.
	    (blpy_is_valid): New function.
	    (blpy_iter_is_valid): Ditto.

2010-03-17  Phil Muldoon  <pmuldoon@redhat.com>

	    * gdb.python/Makefile.in: Add py-objfile.
	    * gdb.python/py-objfile.exp: New file.
	    * gdb.python/py-objfile.c: New file.
	    * gdb.python/py-block.exp: Add is_valid tests.
	    * gdb.python/py-inferior.exp: Ditto.
	    * gdb.python/py-infthread.exp: Ditto.
	    * gdb.python/py-symbol.exp: Ditto.
	    * gdb.python/py-symtab.exp: Ditto.

2011-03-17  Phil Muldoon  <pmuldoon@redhat.com>

	    * gdb.texinfo (Blocks In Python): Add is_valid method
              description.
	      (Inferiors In Python): Likewise.
	      (Threads In Python): Likewise.
	      (Symbols In Python): Likewise.
	      (Objfiles In Python): Likewise.
	      (Symbol Tables In Python): Likewise.
2011-03-17 09:36:17 +00:00
Pierre Muller 2021ad3a8c Fix ARI warning about function names in first column.
Put prototype declaration on same line as return type.
	* objc-exp.y: Ditto.
	* p-exp.y: Ditto.
	* python/py-stopevent.h: Ditto.
	For long function names, split parameters to allow function name
	on same line as return type.
	* solib-pa64.c: Ditto.
	* varobj.c: Ditto.
	* varobj.h: Ditto.
	For long function declaration, use single line.
	* hppa-tdep.h: Ditto.
	* inferior.h: Ditto.
2011-03-14 16:55:04 +00:00
Phil Muldoon 7371cf6d8d 2011-03-14 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Breakpoints In Python): Add description and
              example
	      of Python stop function operation.

2010-03-14  Phil Muldoon  <pmuldoon@redhat.com>

	    * gdb.python/py-breakpoint.exp: Add Python stop operations
              tests.

2011-03-14  Phil Muldoon  <pmuldoon@redhat.com>

	    * python/python.h: Declare gdbpy_should_stop and
	    gdbpy_breakpoint_has_py_cond.
	    * python/python.c: Add python.h to includes.  Remove
	    python.h from
	    HAVE_PYTHON definition
	    (gdbpy_should_stop): New dummy function.
	    (gdbpy_breakpoint_has_py_cond): New dummy function.
	    * python/py-breakpoint.c (bppy_init): Rewrite to allow
	    sub-classing capabilities.
	    (gdbpy_should_stop): New function.
	    (gdbpy_breakpoint_has_py_cond): New function.
	    (local_setattro): New function.
	    * breakpoint.c (condition_command): Add check for Python
	    'stop'
	    operation.
	    (bpstat_check_breakpoint_conditions): Execute Python
	    'stop'
	    operation function as part of stop/continue tests.
2011-03-14 16:09:55 +00:00
Pierre Muller eeae04df52 Fix ARI warning about functions without parameters that do not
use (void).
	* breakpoint.c (all_tracepoints): Replace () by (void).
	* f-exp.y (match_string_literal): Ditto.
	(yylex): Ditto.
	* m2-exp.y (yylex): Ditto.
	* mep-tdep.c (current_me_module): Ditto.
	(current_options): Ditto.
	(current_cop_data_bus_width): Ditto.
	(current_cr_names): Ditto.
	(current_cr_is_float): Ditto.
	(current_ccr_names): Ditto.
	* objc-exp.y (yylex): Ditto.
	* p-exp.y (yylex): Ditto.
	* remote.c (send_interrupt_sequence): Ditto.
	* tracepoint.c (current_trace_status): Ditto.
	* python/py-evts.c (gdbpy_initialize_py_events): Ditto.
	* python/py-prettyprint.c (push_dummy_python_frame): Ditto.
2011-03-14 15:43:51 +00:00
Michael Snyder f3be5b6431 2011-03-11 Michael Snyder <msnyder@vmware.com>
* python/py-breakpoint.c (bppy_set_condition): Stop memory leak.
2011-03-11 22:01:30 +00:00
Michael Snyder 4c2d572468 2011-02-27 Michael Snyder <msnyder@vmware.com>
* python/py-breakpoint.c (bppy_get_commands): Fix memory leak.
2011-03-11 21:34:34 +00:00
Phil Muldoon ecec24e64a 2011-03-10 Phil Muldoon <pmuldoon@redhat.com>
* python/py-param.c (add_setshow_generic): Add set/show callback
	parameters.  Register Python object context.
	(get_show_value): New function.
	(get_set_value): New function.
	(call_doc_function): New function.
	(get_doc_string): Move behind get_show_value/get_set_value.

2011-03-10  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.texinfo (Parameters In Python): Document get_set_string and
	get_show_string methods.

2011-03-10  Phil Muldoon  <pmuldoon@redhat.com>

	* gdb.python/py-parameter.exp: Update tests to the new Python
	parameter API. Add "no documentation" test.  Add deprecated API
	backward compatibility test.
2011-03-10 12:29:08 +00:00
Michael Snyder 2d5657570d 2011-03-02 Michael Snyder <msnyder@vmware.com>
* python/py-inferior.c (build_inferior_list): Error out if
	PyList_Append fails.
	(gdbpy_inferiors): Error out if build_inferior_list fails.
2011-03-02 21:19:54 +00:00
Michael Snyder 63360adcb4 2011-03-01 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>
* python/py-prettyprint.c (apply_val_pretty_printer): Remove
	superfluous null check.
2011-03-01 21:54:53 +00:00
Michael Snyder 6e9130cf1b 2011-03-01 Michael Snyder <msnyder@vmware.com>
* python/py-prettyprint.c (apply_val_pretty_printer): VAL may
	be null.
2011-03-01 21:03:22 +00:00
Michael Snyder bfffb7e32f 2011-02-28 Michael Snyder <msnyder@vmware.com>
* python/py-utils.c (gdbpy_obj_to_string): Delete unused variable.
2011-03-01 19:00:16 +00:00
Tom Tromey fb6a3ed393 * python/python.c (gdbpy_value_cst): New global.
(_initialize_python): Initialize it.
	* python/python-internal.h (gdbpy_value_cst): Declare.
	* python/py-value.c (convert_value_from_python): Use
	gdbpy_value_cst.
2011-02-28 19:38:34 +00:00
Michael Snyder e463f58791 2011-02-28 Michael Snyder <msnyder@vmware.com>
* python/py-cmd.c (cmdpy_init): Fix memory leak.
2011-02-28 18:55:22 +00:00
Michael Snyder 92e961922a 2011-02-28 Michael Snyder <msnyder@vmware.com>
* python/py-param.c (set_parameter_value): Add missing
	break statement.
2011-02-28 18:28:19 +00:00
Michael Snyder b021a22166 2011-02-25 Michael Snyder <msnyder@vmware.com>
* arm-tdep.c: Fix typos in comments.
	* bsd-uthread.c: Ditto.
	* completer.c: Ditto.
	* corelow.c: Ditto.
	* cp-namespace.c: Ditto.
	* cp-support.c: Ditto.
	* cris-tdep.c: Ditto.
	* dbxread.c: Ditto.
	* dwarf2read.c: Ditto.
	* frame.h: Ditto.
	* gdbtypes.h: Ditto.
	* inferior.h: Ditto.
	* mdebugread.c: Ditto.
	* mips-tdep.c: Ditto.
	* ppc-linux-nat.c: Ditto.
	* ppc-linux-tdep.c: Ditto.
	* printcmd.c: Ditto.
	* sol-thread.c: Ditto.
	* solib-frv.c: Ditto.
	* solist.h: Ditto.
	* sparc64-tdep.c: Ditto.
	* spu-tdep.c: Ditto.
	* stabsread.c: Ditto.
	* symfile.c: Ditto.
	* valops.c: Ditto.
	* varobj.c: Ditto.
	* vax-nat.c: Ditto.
	* python/py-block.c: Ditto.
	* python/py-symbol.c: Ditto.
	* python/py-symtab.c: Ditto.
	* python/py-value.c: Ditto.
	* tui/tui-win.c: Ditto.
2011-02-26 02:07:10 +00:00
Doug Evans 6e6fbe60bc Add gdb.lookup_global_symbol python function.
* NEWS: Add entry.
	* python/py-symbol.c (gdbpy_lookup_global_symbol): New function.
	* python/python-internal.h (gdbpy_lookup_global_symbol): Declare it.
	* python/python.c (GdbMethods): Add entry for lookup_global_symbol.

	doc/
	* gdb.texinfo (Symbols In Python): Document lookup_global_symbol.
	Clarify behaviour of lookup_symbol when `block' argument is omitted,
	add description of result, fix @defun formatting.

	testsuite/
	* gdb.python/py-symbol.exp: Test lookup_global_symbol.
2011-02-22 22:48:12 +00:00
Pedro Alves 4e07d55ffb Base support for <unavailable> value contents.
gdb/
	* value.h (value_bytes_available): Declare.
	(mark_value_bytes_unavailable): Declare.
	* value.c (struct range): New struct.
	(range_s): New typedef.
	(ranges_overlap): New function.
	(range_lessthan): New function.
	(ranges_contain_p): New function.
	(struct value) <unavailable>: New field.
	(value_bytes_available): New function.
	(mark_value_bytes_unavailable): New function.
	(require_not_optimized_out): Constify parameter.
	(require_available): New function.
	(value_contents_all, value_contents): Require all bytes be
	available.
	(value_free): Free `unavailable'.
	(value_copy): Copy `unavailable'.
	* valprint.h (val_print_unavailable): Declare.
	* valprint.c (valprint_check_validity): Rename `offset' parameter
	to `embedded_offset'.  If printing a scalar, check whether the
	value chunk is available.
	(val_print_unavailable): New.
	(val_print_scalar_formatted): Check whether the value is
	available.
	* python/py-prettyprint.c (apply_val_pretty_printer): Refuse
	pretty-printing unavailable values.
2011-02-14 11:10:53 +00:00
Hui Zhu c17a9e4688 Add the file that prev commit forget. 2011-02-05 05:27:23 +00:00
Sami Wagiaalla 505500db28 Add Python support for GDB events.
2011-02-04  Sami Wagiaalla  <swagiaal@redhat.com>

	* gdb.python/py-evthreads.c: New file.
	* gdb.python/py-evthreads.exp: New file.
	* gdb.python/py-events.py: New file.
	* gdb.python/py-events.exp: New file.
	* gdb.python/py-events.c: New file.

2011-02-04  Sami Wagiaalla  <swagiaal@redhat.com>
                Oguz Kayral <oguzkayral@gmail.com>

	* python/py-inferior.c (python_on_normal_stop): New function.
	(python_on_resume): New function.
	(python_inferior_exit): New function.
	(gdbpy_initialize_inferior): Add normal_stop, target_resumed, and
	inferior_exit observers.
	* python/py-evtregistry.c: New file.
	* python/py-threadevent.c : New file.
	* python/py-event.c: New file.
	* python/py-evts.c: New file.
	* python/py-continueevent.c: New file.
	* python/py-bpevent.c: New file.
	* python/py-signalevent.c: New file.
	* python/py-exetiedevent.c: New file.
	* python/py-breakpoint.c (gdbpy_breakpoint_from_bpstats): New function.
	Move struct breakpoint_object from here...
	* python/python-internal.h: ... to here.
	* python/py-event.h: New file.
	* python/py-events.h: New file.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-breakpointstopevent.o,
	py-continueevent.o, py-event.o, py-eventregistry.o, py-events.o,
	py-exitedevent.o, py-signalstopevent.o, and py-stopevent.o.
	(SUBDIR_PYTHON_SRCS): Add py-breakpointstopevent.c,
	py-continueevent.c, py-event.c, py-eventregistry.c, py-events.c,
	py-exitedevent.c, py-signalstopevent.c, and py-stopevent.c.
	Add build rules for all the above.
2011-02-04 21:54:16 +00:00
Tom Tromey 47a80e9093 PR python/12216:
* python/python.c (execute_gdb_command): Call
	prevent_dont_repeat.
	* top.c (suppress_dont_repeat): New global.
	(dont_repeat): Use it.
	(prevent_dont_repeat): New function.
	* command.h (prevent_dont_repeat): Declare.
2011-01-31 16:52:35 +00:00
Tom Tromey 45a4356715 * infcmd.c (finish_backward): Use breakpoint_set_silent.
* python/py-breakpoint.c (bppy_set_silent): Use
	breakpoint_set_silent.
	(bppy_set_thread): Use breakpoint_set_thread.
	(bppy_set_task): Use breakpoint_set_task.
	* breakpoint.h (breakpoint_set_silent, breakpoint_set_thread)
	(breakpoint_set_task): Declare.
	(make_breakpoint_silent): Remove.
	* breakpoint.c (breakpoint_set_silent): New function.
	(breakpoint_set_thread): Likewise.
	(breakpoint_set_task): Likewise.
	(make_breakpoint_silent): Remove.
2011-01-31 15:16:59 +00:00
Joel Brobecker 9c4ea6c5a9 allow building GDB with Python support on MinGW
This makes several adjustements to the configure python-config.py
scripts to deal with the differences between a Unix install of Python
and a Windows install of Python (as downloaded from the Python website).

Differences:

  - The Python executable is directly in the python prefix directory
    as opposed to inside the bin/ subdirectory.

  - The name of the python library is does not have a dot in the version
    number: On Unix, we have libpython2.7, while on Windows, it's
    libpython27.  So the regexp extracting the python version from
    the Python lib filename had to be adjusted slightly.

    Also, the tests checking the name of the libpython had to be
    adjusted to allow for that.

  - There are no link options following the -lpython<version> switch
    on Windows, but the regexp extracting the python version was
    using it as a delimiter.  It had to be removed.

  - python-config.py does not work on Windows, mostly because
    some sysconfig variables are missing.  They are not necessary
    so the script was adapted to skip them if not defined.

  - The paths returned by python-config.py follow the Windows filename
    convention in terms of the directory separator, and this is causing
    trouble when the build environment is cygwin (while the compiler
    and Python are MinGW).  We could have fixed that in the configure
    script, but it felt simpler to do so in python-config.py

gdb/ChangeLog:

        * configure.ac: Add handling of Python distribution on Windows.
        * python-config.py: If the LIBS, SYSLIBS, LIBPL and/or LINKFORSHARED
        sysconfig variables are not defined, then do not use them.
        On Windows, if LIBPL is not defined, then use prefix + '/libs'
        instead.  On Windows, return all paths using forward-slashes
        rather than backslashes.
2011-01-31 04:42:08 +00:00
Joel Brobecker ac534cba29 do not use python<version> subdir when including Python .h file
This is preparation work for being able to build GDB with Python
support on MinGW.

So far, the "python<version>" subdirectory needs to be specified
when including a Python header file.  In order to do that, we have
some special configury that tweaks the include path returned by
python-config.py such that the use of the subdirectory in the include
is necessary.  This was done in order to protect ourselves from
possible filename conflicts, since some of the filenames chosen by
Python were a little generic.

The problem is that this cannot work with a standard Python install
on MinGW systems.  On such systems, the .h files are located in
<python_prefix>/include.  So, in preparation for allowing us to build
GDB on MinGW with Python support enabled, this patch changes the
requirement to provide the "python<version>" subdirectory in the
include directive.

The positive consequence is that we no longer need to have a set
of #include directives for each version of Python, since the include
directive is now the same for all versions of Python.  However, the
downside is that we are losing the level of protection we were trying
to achieve by forcing the subdirectory in the include directive.
In order to reduce a bit the consequences of a possible conflict,
this patch also changes the location where the -I/path/to/python
switch goes, to be last in the list (suggested by Doug Evans).

One last change is the fact that we are now including Python.h
and all other Python include headers using angle brackets rather
than double-quotes.  This fixes a problem on case-insensitive
systems where #include "Python.h" causes our gdb/python/python.h
header to be included instead of Python's <Python.h> header.

gdb/ChangeLog:

	* configure.ac: Remove fallback behavior for building
	against Python.  Remove tweaking of Python include path.
	Add PYTHON_CPPFLAGS and PYTHON_LIBS substitution.
	(AC_TRY_LIBPYTHON):  Adjust program used in linking test.
	If link is successful, set PYTHON_CPPFLAGS and PYTHON_LIBS.
	Always restore CPPFLAGS and LIBS after linking test.
	* configure: Regenerated.
	* Makefile.in (INTERNAL_CPPFLAGS): Add @PYTHON_CPPFLAGS@.
	(INSTALLED_LIBS, CLIBS): Add @PYTHON_LIBS@.
	* python/python-internal.h: Adjust includes of Python .h files.
2011-01-31 04:41:27 +00:00