Commit Graph

145 Commits

Author SHA1 Message Date
Pedro Alves 0fb4aa4bfc Static tracepoints support, and UST integration.
gdb/gdbserver/
	* configure.ac: Handle --with-ust.  substitute ustlibs and ustinc.
	* mem-break.c (uninsert_all_breakpoints)
	(reinsert_all_breakpoints): New.
	* mem-break.h (reinsert_all_breakpoints, uninsert_all_breakpoints):
	* tracepoint.c (ust_loaded, helper_thread_id, cmd_buf): New.
	(gdb_agent_ust_loaded, helper_thread_id)
	(gdb_agent_helper_thread_id): New macros.
	(struct ipa_sym_addresses): Add addr_ust_loaded,
	addr_helper_thread_id, addr_cmd_buf.
	(symbol_list): Add ust_loaded, helper_thread_id, cmd_buf.
	(in_process_agent_loaded_ust): New.
	(write_e_ust_not_loaded): New.
	(maybe_write_ipa_ust_not_loaded): New.
	(struct collect_static_trace_data_action): New.
	(enum tracepoint_type) <static_tracepoint>: New.
	(struct tracepoint) <handle>: Mention static tracepoints.
	(struct static_tracepoint_ctx): New.
	(CMD_BUF_SIZE): New.
	(add_tracepoint_action): Handle static tracepoint actions.
	(unprobe_marker_at): New.
	(clear_installed_tracepoints): Handle static tracepoints.
	(cmd_qtdp): Handle static tracepoints.
	(probe_marker_at): New.
	(cmd_qtstart): Handle static tracepoints.
	(response_tracepoint): Handle static tracepoints.
	(cmd_qtfstm, cmd_qtsstm, cmd_qtstmat): New.
	(handle_tracepoint_query): Handle qTfSTM, qTsSTM and qTSTMat.
	(get_context_regcache): Handle static tracepoints.
	(do_action_at_tracepoint): Handle static tracepoint actions.
	(traceframe_find_block_type): Handle static trace data blocks.
	(traceframe_read_sdata): New.
	(download_tracepoints): Download static tracepoint actions.
	[HAVE_UST] Include ust/ust.h, dlfcn.h, sys/socket.h, and sys/un.h.
	(GDB_PROBE_NAME): New.
	(ust_ops): New.
	(GET_UST_SYM): New.
	(USTF): New.
	(dlsym_ust): New.
	(ust_marker_to_static_tracepoint): New.
	(gdb_probe): New.
	(collect_ust_data_at_tracepoint): New.
	(gdb_ust_probe): New.
	(UNIX_PATH_MAX, SOCK_DIR): New.
	(gdb_ust_connect_sync_socket): New.
	(resume_thread, stop_thread): New.
	(run_inferior_command): New.
	(init_named_socket): New.
	(gdb_ust_socket_init): New.
	(cstr_to_hexstr): New.
	(next_st): New.
	(first_marker, next_marker): New.
	(response_ust_marker): New.
	(cmd_qtfstm, cmd_qtsstm): New.
	(unprobe_marker_at, probe_marker_at): New.
	(cmd_qtstmat, gdb_ust_thread): New.
	(gdb_ust_init): New.
	(initialize_tracepoint_ftlib): Call gdb_ust_init.
	* linux-amd64-ipa.c [HAVE_UST]: Include ust/processor.h
	(ST_REGENTRY): New.
	(x86_64_st_collect_regmap): New.
	(X86_64_NUM_ST_COLLECT_GREGS): New.
	(AMD64_RIP_REGNUM): New.
	(supply_static_tracepoint_registers): New.
	* linux-i386-ipa.c [HAVE_UST]: Include ust/processor.h
	(ST_REGENTRY): New.
	(i386_st_collect_regmap): New.
	(i386_NUM_ST_COLLECT_GREGS): New.
	(supply_static_tracepoint_registers): New.
	* server.c (handle_query): Handle qXfer:statictrace:read.
	<qSupported>: Report support for StaticTracepoints, and
	qXfer:statictrace:read features.
	* server.h (traceframe_read_sdata)
	(supply_static_tracepoint_registers): Declare.
	* remote-utils.c (convert_int_to_ascii, hexchars, ishex, tohex)
	(unpack_varlen_hex): Include in IPA build.
	* Makefile.in (ustlibs, ustinc): New.
	(IPA_OBJS): Add remote-utils-ipa.o.
	($(IPA_LIB)): Link -ldl and -lpthread.
	(UST_CFLAGS): New.
	(IPAGENT_CFLAGS): Add UST_CFLAGS.
	* config.in, configure: Regenerate.

	gdb/
	* NEWS: Mention new support for static tracepoints.
	(New packets): Mention qTfSTM, qTsSTM, qTSTMat and
	qXfer:statictrace:read.
	(New features in the GDB remote stub, GDBserver): Mention static
	tracepoints support using an UST based backend.
	(New commands): Mention "info static-tracepoint-markers" and
	"strace".
	* breakpoint.c (is_marker_spec): New.
	(is_tracepoint): Handle static tracepoints.
	(validate_commands_for_breakpoint): Static tracepoints can't do
	while-stepping.
	(static_tracepoints_here): New.
	(bpstat_what): Handle static tracepoints.
	(print_one_breakpoint_location, allocate_bp_location, mention):
	Ditto.
	(create_breakpoint_sal): Ditto.
	(decode_static_tracepoint_spec): New.
	(create_breakpoint): Replace `hardwareflag', and `traceflag' with
	`type_wanted'.  Adjust.  Handle static tracepoint marker
	locations.
	(break_command_1): Adjust.
	(update_static_tracepoint): New.
	(update_breakpoint_locations): Handle static tracepoints.
	(breakpoint_re_set_one): Handle static tracepoint marker
	locations.
	(disable_command, enable_command): Handle static tracepoints.
	(trace_command, ftrace_command): Adjust.
	(strace_command): New.
	(create_tracepoint_from_upload): Adjust.
	(save_breakpoints): Handle static tracepoints.
	(_initialize_breakpoint): Install the "strace" command.
	* breakpoint.h (enum bptype): New bp_static_tracepoint type.
	(struct breakpoint): New fields static_trace_marker_id and
	static_trace_marker_id_idx.
	(breakpoints_here_p): Declare.
	(create_breakpoint): Adjust.
	(static_tracepoints_here): Declare.
	* remote.c (struct remote_state) <static_tracepoints>: New field.
	(PACKET_qXfer_statictrace_read, PACKET_StaticTracepoints): New.
	(remote_static_tracepoint_marker_at): New.
	(remote_static_tracepoint_markers_by_strid): New.
	(remote_static_tracepoint_feature): New.
	(remote_disconnected_tracing_feature): Handle "StaticTracepoints".
	(remote_xfer_partial): Handle TARGET_OBJECT_STATIC_TRACE_DATA.
	(remote_supports_static_tracepoints): New.
	(remote_download_tracepoint): Download static tracepoints.
	(init_remote_ops): Install remote_static_tracepoint_marker_at and
	remote_static_tracepoint_markers_by_strid.
	(_initialize_remote): Install set|show remote static-tracepoints,
	and set|show remote read-sdata-object commands.
	* target.c (update_current_target): Inherit and default
	to_static_tracepoint_marker_at, and
	to_static_tracepoint_markers_by_strid.
	* target.h (static_tracepoint_marker): Forward declare.
	(enum target_object): New object TARGET_OBJECT_STATIC_TRACE_DATA.
	(static_tracepoint_marker_p): New typedef.
	(DEF_VEC_P(static_tracepoint_marker_p)): New VEC type.
	(struct target_ops): New fields to_static_tracepoint_marker_at and
	to_static_tracepoint_markers_by_strid.
	(target_static_tracepoint_marker_at)
	(target_static_tracepoint_markers_by_strid): New.
	* tracepoint.c: Include source.h.
	(validate_actionline): Handle $_sdata.
	(struct collection_list): New field strace_data.
	(add_static_trace_data): New.
	(clear_collection_list): Clear strace_data.
	(stringify_collection_list): Account for a possible static trace
	data collection.
	(encode_actions_1): Encode an $_sdata collection.
	(parse_tracepoint_definition): Handle static tracepoints.
	(parse_static_tracepoint_marker_definition): New.
	(release_static_tracepoint_marker): New.
	(print_one_static_tracepoint_marker): New.
	(info_static_tracepoint_markers_command): New.
	(sdata_make_value): New.
	(_initialize_tracepoint): Create the $_sdata convenience variable.
	Add the "info static-tracepoint-markers" command.
	Mention $_sdata in the "collect" command's help output.
	* tracepoint.h (struct static_tracepoint_marker): New.
	(parse_static_tracepoint_marker_definition)
	(release_static_tracepoint_marker): Declare.
	* mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust.
	* python/py-breakpoint.c (bppy_new): Adjust.

	doc/
	* gdb.texinfo (Convenience Variables): Document $_sdata.
	(Commands to Set Tracepoints): Describe static tracepoints.  Add
	`Listing Static Tracepoint Markers' menu entry.  Document
	"strace".
	(Tracepoint Action Lists): Document collecting $_sdata.
	(Listing Static Tracepoint Markers): New subsection.
	(Tracepoints support in gdbserver): Mention static tracepoints.
	(remote packets, enabling and disabling): Mention
	read-sdata-object.
	(General Query Packets) <qSupported>: Document qXfer:sdata:read
	and StaticTracepoint.
	Mention qTfSTM, qTsSTM and qTSTMat as tracepoint packets.
	Document qXfer:sdata:read.
	(Tracepoint packets): Document qTfSTM, qTsSTM and qTSTMat.
2010-07-01 10:36:12 +00:00
Jan Kratochvil 628fe4e4a9 gdb/
Fix PR 9436.
	* breakpoint.c (handle_jit_event): New function.
	(bpstat_what): Remove enum class, kc, ss, sn, sgl, slr, clr, sr, shl,
	jit, err, table and bs_class.  New variables shlib_event, jit_event,
	this_action and bptype.  Change bs_class assignments to this_action
	assignments.  new unhandled bptype internal error.  Move here
	shlib_event and jit_event handling from handle_inferior_event.
	* breakpoint.h (enum bpstat_what_main_action): Extend the comment.
	Reorder items.  Remove BPSTAT_WHAT_CHECK_SHLIBS and
	BPSTAT_WHAT_CHECK_JIT.
	* inferior.h (debug_infrun, stop_on_solib_events): New declarations.
	* infrun.c (debug_infrun, stop_on_solib_events): Remove static.
	(handle_inferior_event): Reinitialize frame and gdbarch after
	bpstat_what call.  Move BPSTAT_WHAT_CHECK_SHLIBS and
	BPSTAT_WHAT_CHECK_JIT handling to bpstat_what.  Reinitialize even
	gdbarch when frame gets reinitialized.

gdb/testsuite/
	Test PR 9436.
	* gdb.base/nostdlib.exp, gdb.base/nostdlib.c: New.
2010-06-24 15:17:32 +00:00
Ulrich Weigand d03285ec7b ChangeLog:
* infrun.c (handle_inferior_event): Handle presence of single-step
	breakpoints for TARGET_WAITKIND_FORKED and TARGET_WAITKIND_VFORKED.
	Cancel single-step breakpoints for TARGET_WAITKIND_EXITED,
	TARGET_WAITKIND_SIGNALED, and TARGET_WAITKIND_EXECD.
	* breakpoint.c (detach_single_step_breakpoints): New function.
	(detach_breakpoints): Call it.
	(cancel_single_step_breakpoints): New function.
	* breakpoint.h (cancel_single_step_breakpoints): Add prototype.

	* spu-tdep.c (spu_memory_remove_breakpoint): New function.
	(spu_gdbarch_init): Install it.

testsuite/ChangeLog:

	* gdb.cell/fork.exp: New file.
	* gdb.cell/fork.c: Likewise.
	* gdb.cell/fork-spu.c: Likewise.
2010-06-23 12:46:37 +00:00
Jan Kratochvil ee55da67fb gdb/
* breakpoint.h (owner): Extend the comment.
2010-06-07 13:39:10 +00:00
Pedro Alves 6149aea959 PR breakpoints/8554.
Implement `save-breakpoints'.

	gdb/
	* breakpoint.c (save_cmdlist): New.
	(breakpoint_set_cmdlist, breakpoint_show_cmdlist): Moved up close
	to save_cmdlist.
	(print_recreate_catch_fork): New.
	(catch_fork_breakpoint_ops): Install it.
	(print_recreate_catch_vfork): New.
	(catch_vfork_breakpoint_ops): Install it.
	(print_recreate_catch_syscall): New.
	(catch_syscall_breakpoint_ops): Install it.
	(print_recreate_catch_exec): New.
	(catch_exec_breakpoint_ops): Install it.
	(print_recreate_exception_catchpoint): New.
	(gnu_v3_exception_catchpoint_ops): Install it.
	(save_breakpoints): New, based on tracepoint_save_command, but
	handle all breakpoint types.
	(save_breakpoints_command): New.
	(tracepoint_save_command): Rename to...
	(save_tracepoints_command): ... this, and reimplement using
	save_breakpoints.
	(save_command): New.
	(_initialize_breakpoints): Install the "save" command prefix.
	Install the "save breakpoints" command.  Make "save-tracepoints" a
	deprecated alias for "save tracepoints".
	* breakpoint.h (struct breakpoint_ops): New field `print_recreate'.
	* ada-lang.c (print_recreate_exception): New.
	(print_recreate_catch_exception): New.
	(catch_exception_breakpoint_ops): Install it.
	(print_recreate_catch_exception_unhandled): New.
	(catch_exception_unhandled_breakpoint_ops): Install it.
	(print_recreate_catch_assert): New.
	(catch_assert_breakpoint_ops): Install it.

	* NEWS: Mention the new `save breakpoints' command.  Mention the
	new `save tracepoints' alias and that `save-tracepoints' is now
	deprecated.

	gdb/doc/
	* gdb.texinfo (Save Breakpoints): New node.
	(save-tracepoints): Rename to ...
	(save tracepoints): ... this.  Mention that `save-tracepoints' is
	a deprecated alias to `save tracepoints'.

	gdb/testsuite/
	* gdb.trace/save-trace.exp: Adjust.
2010-04-19 00:48:44 +00:00
Phil Muldoon adc368187c 2010-04-09 Phil Muldoon <pmuldoon@redhat.com>
Thiago Jung Bauermann  <bauerman@br.ibm.com>
   	    Tom Tromey  <tromey@redhat.com>

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


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

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

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

	* gdb.texinfo (Breakpoints In Python): New Node.
2010-04-09 09:41:43 +00:00
Stan Shebs d77f58beee 2010-04-04 Stan Shebs <stan@codesourcery.com>
Nathan Sidwell  <nathan@codesourcery.com>

	* breakpoint.c (breakpoint_1): Add filter argument, return number of
	breakpoints printed.
	(is_hardware_watchpoint): Make argument const.
	(is_watchpoint): Ditto.
	(is_tracepoint): Merge of tracepoint_type and breakpoint_is_tracepoint,
	use it everywhere.
	(breakpoints_info): Pass NULL to breakpoint_1.
	(maintenance_info_breakpoints): Ditto.
	(watchpoints_info): New function.
	(tracepoints_info): Use breakpoint_1 filter.
	(set_ignore_count): Warn that tracepoint ignore count will be ignored.
	(_initialize_breakpoint): Make "info watchpoints" its own command.
	* breakpoint.h (is_tracepoint): Rename from breakpoint_is_tracepoint.
	* mi/mi-cmd-break.c (mi_cmd_break_commands): Use is_tracepoint.

	* gdb.texinfo (Setting Breakpoints): "info watch" no longer a synonym.
	(Setting Watchpoints): Update description of "info watch".
	(Disabling Breakpoints): Only "info break" lists all.

	* gdb.base/completion.exp: Update for new "info watchpoints".
	* gdb.base/default.exp: Ditto.
	* gdb.base/help.exp: Ditto.
	* gdb.base/watchpoint.exp: Ditto.
	* gdb.trace/infotrace.exp: Update "info tracpoints" output.
2010-04-04 23:47:16 +00:00
Jan Kratochvil 91d91ceba4 gdb/
* breakpoint.c (bpstat_find_step_resume_breakpoint): Remove.
	* breakpoint.h (bpstat_find_step_resume_breakpoint): Remove.
2010-04-04 13:54:51 +00:00
Pedro Alves 5cea2a2659 * breakpoint.h (struct counted_command_line): Moved definition to
breakpoint.c, and forward declare.
	(breakpoint_commands): Declare.
	* breakpoint.c (struct counted_command_line): Moved here.
	(breakpoint_commands): New.
	* tracepoint.c (encode_actions): Use breakpoint_commands.
	* remote.c (remote_download_tracepoint): Ditto.
2010-04-02 01:18:35 +00:00
Tom Tromey aa7d318d60 PR gdb/11327, PR gdb/11328, PR breakpoints/11368:
* infrun.c (handle_inferior_event): Change initialization of
	stop_stack_dummy.
	(handle_inferior_event): Change assignment to stop_stack_dummy.
	(normal_stop): Update use of stop_stack_dummy.
	(struct inferior_status) <stop_stack_dummy>: Change type.
	* inferior.h (stop_stack_dummy): Update.
	* infcmd.c (stop_stack_dummy): Change type.
	* infcall.c (cleanup_delete_std_terminate_breakpoint): New
	function.
	(call_function_by_hand): Call set_std_terminate_breakpoint.
	Rewrite std::terminate handling.
	* breakpoint.h (enum bptype) <bp_std_terminate,
	bp_std_terminate_master>: New.
	(enum stop_stack_kind): New.
	(struct bpstat_what) <call_dummy>: Change type.
	(set_std_terminate_breakpoint, delete_std_terminate_breakpoint):
	Declare.
	* breakpoint.c (create_std_terminate_master_breakpoint): New
	function.
	(update_breakpoints_after_exec): Handle bp_std_terminate_master.
	Call create_std_terminate_master_breakpoint.
	(print_it_typical): Handle new breakpoint kinds.
	(bpstat_stop_status): Handle bp_std_terminate_master.
	(bpstat_what): Correctly set call_dummy field.  Handle
	bp_std_terminate_master and bp_std_terminate.
	(print_one_breakpoint_location): Update.
	(allocate_bp_location): Update.
	(set_std_terminate_breakpoint): New function.
	(delete_std_terminate_breakpoint): Likewise.
	(create_thread_event_breakpoint): Update.
	(delete_command): Update.
	(breakpoint_re_set_one): Update.
	(breakpoint_re_set): Call create_std_terminate_master_breakpoint.
2010-03-25 20:48:53 +00:00
Tom Tromey 95a42b64a1 gdb
PR breakpoints/9352:
	* NEWS: Mention changes to `commands' and `rbreak'.
	* symtab.c (do_end_rbreak_breakpoints): New function.
	(rbreak_command): Call start_rbreak_breakpoints; arrange to call
	end_rbreak_breakpoints.
	* breakpoint.c (breakpoint_count, tracepoint_count): Now static.
	(set_breakpoint_count): Likewise.  Clear last_was_multi.
	(multi_start, multi_end, last_was_multi): New globals.
	(start_rbreak_breakpoints, end_rbreak_breakpoints): New
	functions.
	(struct commands_info): New
	(do_map_commands_command): New function.
	(commands_command_1): New function.
	(commands_command): Use it.
	(commands_from_control_command): Likewise.
	(do_delete_breakpoint): New function.
	(delete_command): Use it.
	(map_breakpoint_numbers): Add 'data' argument.  Pass to callback.
	(do_map_disable_breakpoint): New function.
	(disable_command): Use it.
	(do_map_enable_breakpoint): New function.
	(enable_command): Use it.
	(enable_once_breakpoint): Add argument.
	(enable_once_command): Update.
	(enable_delete_breakpoint): Add argument.
	(enable_delete_command): Update.
	(break_command_really): Set last_was_multi when needed.
	(check_tracepoint_command): Fix formatting.
	(validate_commands_for_breakpoint): New function.
	(breakpoint_set_commands): Use it.
	(tracepoint_save_command): Update.
	* breakpoint.h (start_rbreak_breakpoints, end_rbreak_breakpoints):
	Declare.
gdb/doc
	PR breakpoints/9352:
	* gdb.texinfo (Break Commands): Update.
gdb/testsuite
	PR breakpoints/9352:
	* gdb.base/default.exp: Update.
	* gdb.base/commands.exp: Update.
	* gdb.cp/extern-c.exp: Test setting commands on multiple
	breakpoints at once.
2010-03-24 21:24:09 +00:00
Tom Tromey 9add0f1b43 * breakpoint.h (struct counted_command_line): New struct.
(struct breakpoint) <commands>: Change type.
	(struct bpstats) <commands>: Change type.
	<commands_left>: New field.
	* breakpoint.c (alloc_counted_command_line): New function.
	(incref_counted_command_line): Likewise.
	(decref_counted_command_line): Likewise.
	(do_cleanup_counted_command_line): Likewise.
	(make_cleanup_decref_counted_command_line): Likewise.
	(breakpoint_set_commands): Use decref_counted_command_line and
	alloc_counted_command_line.
	(commands_command): Don't error if breakpoint commands are
	executing.
	(commands_from_control_command): Likewise.
	(bpstat_free): Update.
	(bpstat_copy): Likewise.
	(bpstat_clear_actions): Likewise.
	(bpstat_do_actions_1): Likewise.
	(bpstat_stop_status): Likewise.
	(print_one_breakpoint_location): Likewise.
	(delete_breakpoint): Likewise.
	(bpstat_alloc): Initialize new field.
	(tracepoint_save_command): Update.
	* tracepoint.c (encode_actions): Update.
	(trace_dump_command): Update.
2010-03-24 21:12:18 +00:00
Vladimir Prus a7bdde9e63 Unify actions and commands
* defs.h (read_command_lines, read_command_lines_1): New
	parameters validator and closure.
	* tracepoint.h (struct action_line): Remove.
	* breakpoint.h (struct breakpoint): Remove the 'actions'
	field.
	* defs.h (enum command_control_type): New value
	while_stepping_control.
	(struct command_line): Add comments.
	* breakpoint.c (breakoint_is_tracepoint): New.
	(breakpoint_set_commands): For tracepoints,
	verify the commands are permissible.
	(check_tracepoint_commands): New.
	(commands_command): Require that each new line is validated using
	check_tracepoint_command, if we set commands for a tracepoint.
	(create_tracepoint_from_upload): Likewise.
	(print_one_breakpoint_location): Remove the code to print
	actions specifically.
	(tracepoint_save_command): Relay to print_command_lines.
	* cli/cli-script.c (process_next_line): New parameters validator
	and closure. Handle 'while-stepping'. Call validator if not null.
	(read_command_lines, read_command_lines1): Likewise.
	(recurse_read_control_structure): New parameters validator and
	closure. Handle while_stepping_control.
	(print_command_lines): Handle while-stepping.
	(get_command_line, define_command, document_command): Adjust.
	* remote.c (remote_download_tracepoint): Adjust.
	* tracepoint.c (make_cleanup_free_actions, read_actions)
	(free_actions, do_free_actions_cleanup): Remove.
	(trace_actions_command): Use read_command_lines.
	(validate_actionline): Use error in one place.
	(encode_actions_1): New, extracted from...
	(encode_actions): ...this. Also use cleanups for exception
	safety.
	(trace_dump_command): Adjust.
	* mi/mi-cmd-break (mi_cmd_break_commands): Validate commands if
	it's tracepoint.
2010-03-23 21:32:28 +00:00
Vladimir Prus 8cdf0e1506 Simplify MI breakpoint setting.
* breakpoint.c (break_command_really): Make nonstatic and
    	rename to...
    	(create_breakpoint): ...this. Rename prior function by this name
    	to...
    	(create_breakpoint_sal): ...this.
    	(create_breakpoints): Rename to...
    	(create_breakpoints_sal): ...this.
    	(set_breakpoint): Remove.
    	* breakpoint.h: Adjust to above changes.
    	* mi/mi-cmd-break.c (mi_cmd_break_insert): Simplify.
2010-03-16 08:42:20 +00:00
Pedro Alves 60e1c644b7 gdb/
* breakpoint.c (condition_command): Handle watchpoint conditions.
	(is_hardware_watchpoint): Add comment.
	(is_watchpoint): New.
	(update_watchpoint): Don't reparse the watchpoint's condition
	unless necessary.
	(WP_IGNORE): New.
	(watchpoint_check): Use it.
	(bpstat_check_watchpoint): Handle it.
	(bpstat_check_breakpoint_conditions): Evaluate watchpoint local
	conditions in a frame where it makes sense.
	(watch_command_1): Store the innermost block of the condition
	expression.
	(delete_breakpoint): Delete the watchpoint condition expression.
	* breakpoint.h (struct bp_location) <cond>: Update comment.
	(struct breakpoint): New fields `cond_exp' and
	`cond_exp_valid_block'.

	gdb/testsuite/
	* gdb.base/watch-cond.c, gdb.base/watch-cond.exp: New.
2010-03-10 13:25:40 +00:00
Stan Shebs d5551862df Support disconnected tracing.
* infcmd.c (detach_command): Ask whether to stop tracing.
	* cli/cli-cmds.c (quit_command): Ditto.
	* breakpoint.h (struct breakpoint): New field number_on_target.
	* breakpoint.c (create_tracepoint_from_upload): New function.
	(get_tracepoint_by_number_on_target): New function.
	* remote.c (struct remote): New field disconnected_tracing.
	(remote_disconnected_tracing_feature): New function.
	(remote_protocol_features): Add DisconnectedTracing.
	(struct uploaded_tp): New struct.
	(uploaded_tps): New global.
	(get_uploaded_tp): New function.
	(find_matching_tracepoint): New function.
	(remote_get_tracing_state): New function.
	(remote_start_remote): Call it.
	* tracepoint.c (disconnected_tracing): New global.
	(trace_start_command): Initialize number_on_target.
	(stop_tracing): New function, split out from...
	(trace_stop_command): Call stop_tracing.
	(get_trace_status): New function, split out from...
	(trace_status_command): Call get_trace_status, add info on
	disconnection behavior.
	(disconnect_or_stop_tracing): New function.
	(finish_tfind_command): Translate from number on target.
	(trace_find_tracepoint_command): Translate to number on target.
	(send_disconnected_tracing_value): New function.
	(set_disconnected_tracing): New function.
	(_initialize_tracepoint): Add disconnected-tracing variable.
	* NEWS: Mention disconnected tracing.

	* gdb.texinfo (Starting and Stopping Trace Experiments): Document
	disconnected tracing.
	(Tracepoint Packets): Document new protocol.
2010-01-06 20:31:28 +00:00
Stan Shebs 7a697b8dd7 Add fast tracepoints.
* arch-utils.h (default_fast_tracepoint_valid_at): Declare.
	* arch-utils.c (default_fast_tracepoint_valid_at): New function.
	* breakpoint.h (enum bptype): Add bp_fast_tracepoint.
	* breakpoint.c (tracepoint_type): New function.
	(ALL_TRACEPOINTS): Use it.
	(should_be_inserted): Ditto.
	(bpstat_check_location): Ditto.
	(print_one_breakpoint_location): Ditto.
	(user_settable_breakpoint): Ditto.
	(set_breakpoint_location_function): Ditto.
	(disable_breakpoints_in_shlibs): Ditto.
	(delete_trace_command): Ditto.
	(print_it_typical): Add bp_fast_tracepoint case.
	(bpstat_what): Ditto.
	(print_one_breakpoint_location): Ditto.
	(allocate_bp_location): Ditto.
	(mention): Ditto.
	(breakpoint_re_set_one): Ditto.
	(disable_command): Ditto.
	(enable_command): Ditto.
	(check_fast_tracepoint_sals): New function.
	(break_command_really): Call it.
	(ftrace_command): New function.
	(_initialize_breakpoint): Add ftrace command.
	* gdbarch.sh (fast_tracepoint_valid_at): New.
	* gdbarch.h, gdbarch.c: Regenerate.
	* i386-tdep.c (i386_fast_tracepoint_valid_at): New function.
	(i386_gdbarch_init): Use it.
	* remote.c (struct remote_state): New field fast_tracepoints.
	(PACKET_FastTracepoints): New packet config type.
	(remote_fast_tracepoint_feature): New function.
	(remote_protocol_features): Add FastTracepoints.
	(remote_supports_fast_tracepoints): New function.
	(_initialize_remote): Add FastTracepoints.
	* tracepoint.c (download_tracepoint): Add fast tracepoint option.
	* NEWS: Mention fast tracepoints.

	* gdb.texinfo (Create and Delete Tracepoints): Describe fast
	tracepoints.
	(Tracepoint Packets): Describe remote protocol for fast
	tracepoints.

	* gdb.trace/tracecmd.exp: Test ftrace.
2010-01-06 04:20:27 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Pedro Alves 9093389c0f Make hardware watchpoints work for process record.
* breakpoint.c (hardware_watchpoint_inserted_in_range): New.
	* breakpoint.h (hardware_watchpoint_inserted_in_range): Declare.
	* record.c (record_beneath_to_stopped_by_watchpoint)
	(record_beneath_to_stopped_data_address, record_hw_watchpoint):
	New globals.
	(record_exec_insn): Check for watchpoint hits.
	(tmp_to_stopped_by_watchpoint, tmp_to_stopped_data_address): New
	globals.
	(record_open): Set tmp_to_stopped_by_watchpoint,
	tmp_to_stopped_data_address,
	record_beneath_to_stopped_by_watchpoint and
	record_beneath_to_stopped_data_address.
	(record_wait): Report watchpoint hits to the core.  Update and
	extend comments.
	(record_stopped_by_watchpoint): New.
	(record_stopped_data_address): New.
	(init_record_ops): Install them.
	(init_record_core_ops): Ditto.
2009-11-22 15:38:59 +00:00
Pedro Alves f6bc200880 gdb/
* breakpoint.h (struct breakpoint) <watchpoint_thread>: New field.
	* breakpoint.c (watchpoint_in_thread_scope): New.
	(update_watchpoint): Skip if the local watchpoint's thread doesn't
	match the current thread, or if the current thread is running.
	(watchpoint_check): Ditto.
	(watch_command_1): Set the watchpoint's watchpoint_thread field.

	gdb/testsuite/
	* gdb.threads/local-watch-wrong-thread.c,
	gdb.threads/local-watch-wrong-thread.exp: New files.
2009-11-21 21:17:17 +00:00
Pedro Alves 678229626e * infrun.c (handle_inferior_event): When handling a fork or vfork
event, check if the bpstat causes a stop, instead of if it
	explains the signal.
	* breakpoint.c (bpstat_causes_stop): New.
	* breakpoint.h (bpstat_causes_stop): Declare.
2009-11-15 20:10:34 +00:00
Jan Kratochvil 876fa593f0 gdb/
Performance optimize large bp_location count.
	* breakpoint.c (ALL_BP_LOCATIONS_SAFE): Remove.
	(ALL_BP_LOCATIONS): New parameter BP_TMP.  Use now bp_location and
	bp_location_count.
	(bp_location_chain): Remove variable.
	(bp_location, bp_location_count)
	(bp_location_placed_address_before_address_max)
	(bp_location_shadow_len_after_address_max): New variables.
	(moribund_locations, update_watchpoint): Update the bp_location
	variable name.
	(breakpoint_restore_shadows): Extend the comment.  Move the variable
	b to local blocks.  Move the variables bp_addr, bp_size and bptoffset
	to a local block.  New variables bc_l, bc_r and bc.  New binary search
	for the left range boundary.  New break on reaching the right range
	boundary.  Move shadow existence conditionals to ...
	(bp_location_has_shadow): ... a new function.
	(insert_breakpoint_locations): Replace the temp variable by bp_tmp.
	Use now ALL_BP_LOCATIONS instead of ALL_BP_LOCATIONS_SAFE.
	(remove_breakpoints, remove_hw_watchpoints, reattach_breakpoints)
	(detach_breakpoints): New variable bp_tmp.  Update the ALL_BP_LOCATIONS
	calling convention.
	(update_breakpoints_after_exec): New variable bplocp_tmp.  Update the
	ALL_BP_LOCATIONS calling convention.
	(breakpoint_here_p, software_breakpoint_inserted_here_p)
	(breakpoint_thread_match): New variable bptp_tmp.  Drop the const
	attribute of bpt.  Update the ALL_BP_LOCATIONS calling convention.
	(regular_breakpoint_inserted_here_p): Likewise.  Update the bp_location
	variable name.
	(mark_breakpoints_out, breakpoint_init_inferior): New variable
	bptp_tmp.  Update the ALL_BP_LOCATIONS calling convention.
	(bpstat_stop_status): New variables blp_tmp and update_locations.  Drop
	the const attribute of bl.  Update the ALL_BP_LOCATIONS calling
	convention.  Protect HIT_COUNT increment by an ENABLE_STATE check.
	Delay the update_global_location_list call using update_locations.
	(set_default_breakpoint): Drop the check_duplicates name from comment.
	(disable_breakpoints_in_shlibs, disable_breakpoints_in_unloaded_shlib):
	New variable locp_tmp.  Update the ALL_BP_LOCATIONS calling convention.
	(bp_location_compare, bp_location_compare_for_qsort)
	(bp_location_target_extensions_update): New functions.
	(check_duplicates, check_duplicates_for): Remove, moving their code ...
	(update_global_location_list): ... into this existing function.  Remove
	variables next, loc2, old_locations, ret and ix.  New variables locp,
	loc_first, old_location, old_locp and old_location_count.  Stop using
	global_next, create now the array bp_location, sort it by
	bp_location_compare_for_qsort and call
	bp_location_target_extensions_update.  Change quadratic iteration by
	loc2 into an in-sync scanning by locp and loc2p.  Rename former loc
	usage as old_loc.
	(do_vec_free): Remove.
	(breakpoint_program_space_exit): Update the ALL_BP_LOCATIONS calling
	convention.
	(remove_breakpoints_pid): New variable b_tmp.  Update the
	ALL_BP_LOCATIONS calling convention.
	* breakpoint.h (struct bp_location <global_next>): Remove.
2009-10-25 19:35:26 +00:00
Pedro Alves 6c95b8df7f 2009-10-19 Pedro Alves <pedro@codesourcery.com>
Stan Shebs	<stan@codesourcery.com>

	Add base multi-executable/process support to GDB.

	gdb/
	* Makefile.in (SFILES): Add progspace.c.
	(COMMON_OBS): Add progspace.o.
	* progspace.h: New.
	* progspace.c: New.

	* breakpoint.h (struct bp_target_info) <placed_address_space>: New
	field.
	(struct bp_location) <pspace>: New field.
	(struct breakpoint) <pspace>: New field.
	(bpstat_stop_status, breakpoint_here_p)
	(moribund_breakpoint_here_p, breakpoint_inserted_here_p)
	(regular_breakpoint_inserted_here_p)
	(software_breakpoint_inserted_here_p, breakpoint_thread_match)
	(set_default_breakpoint): Adjust prototypes.
	(remove_breakpoints_pid, breakpoint_program_space_exit): Declare.
	(insert_single_step_breakpoint, deprecated_insert_raw_breakpoint):
	Adjust prototypes.
	* breakpoint.c (executing_startup): Delete.
	(default_breakpoint_sspace): New.
	(breakpoint_restore_shadows): Skip if the address space doesn't
	match.
	(update_watchpoint): Record the frame's program space in the
	breakpoint location.
	(insert_bp_location): Record the address space in target_info.
	Adjust to pass the symbol space to solib_name_from_address.
	(breakpoint_program_space_exit): New.
	(insert_breakpoint_locations): Switch the symbol space and thread
	when inserting breakpoints.  Don't insert breakpoints in a vfork
	parent waiting for vfork done if we're not attached to the vfork
	child.
	(remove_breakpoints_pid): New.
	(reattach_breakpoints): Switch to a thread of PID.  Ignore
	breakpoints of other symbol spaces.
	(create_internal_breakpoint): Store the symbol space in the sal.
	(create_longjmp_master_breakpoint): Iterate over all symbol
	spaces.
	(update_breakpoints_after_exec): Ignore breakpoints for other
	symbol spaces.
	(remove_breakpoint): Rename to ...
	(remove_breakpoint_1): ... this.  Pass the breakpoints symbol
	space to solib_name_from_address.
	(remove_breakpoint): New.
	(mark_breakpoints_out): Ignore breakpoints from other symbol
	spaces.
	(breakpoint_init_inferior): Ditto.
	(breakpoint_here_p): Add an address space argument and adjust to
	use breakpoint_address_match.
	(moribund_breakpoint_here_p): Ditto.
	(regular_breakpoint_inserted_here_p): Ditto.
	(breakpoint_inserted_here_p): Ditto.
	(software_breakpoint_inserted_here_p): Ditto.
	(breakpoint_thread_match): Ditto.
	(bpstat_check_location): Ditto.
	(bpstat_stop_status): Ditto.
	(print_breakpoint_location): If there's a location to print,
	switch the current symbol space.
	(print_one_breakpoint_location): Add `allflag' argument.
	(print_one_breakpoint): Ditto.	Adjust.
	(do_captured_breakpoint_query): Adjust.
	(breakpoint_1): Adjust.
	(breakpoint_has_pc): Also match the symbol space.
	(describe_other_breakpoints): Add a symbol space argument and
	adjust.
	(set_default_breakpoint): Add a symbol space argument.	Set
	default_breakpoint_sspace.
	(breakpoint_address_match): New.
	(check_duplicates_for): Add an address space argument, and adjust.
	(set_raw_breakpoint): Record the symbol space in the location and
	in the breakpoint.
	(set_longjmp_breakpoint): Skip longjmp master breakpoints from
	other symbol spaces.
	(remove_thread_event_breakpoints, remove_solib_event_breakpoints)
	(disable_breakpoints_in_shlibs): Skip breakpoints from other
	symbol spaces.
	(disable_breakpoints_in_unloaded_shlib): Match symbol spaces.
	(create_catchpoint): Set the symbol space in the sal.
	(disable_breakpoints_before_startup): Skip breakpoints from other
	symbol spaces.	Set executing_startup in the current symbol space.
	(enable_breakpoints_after_startup): Clear executing_startup in the
	current symbol space.  Skip breakpoints from other symbol spaces.
	(clone_momentary_breakpoint): Also copy the symbol space.
	(add_location_to_breakpoint): Set the location's symbol space.
	(bp_loc_is_permanent): Switch thread and symbol space.
	(create_breakpoint): Adjust.
	(expand_line_sal_maybe): Expand comment to mention symbol spaces.
	Switch thread and symbol space when reading memory.
	(parse_breakpoint_sals): Set the symbol space in the sal.
	(break_command_really): Ditto.
	(skip_prologue_sal): Switch and space.
	(resolve_sal_pc): Ditto.
	(watch_command_1): Record the symbol space in the sal.
	(create_ada_exception_breakpoint): Adjust.
	(clear_command): Adjust.  Match symbol spaces.
	(update_global_location_list): Use breakpoint_address_match.
	(breakpoint_re_set_one): Switch thread and space.
	(breakpoint_re_set): Save symbol space.
	(breakpoint_re_set_thread): Also reset the symbol space.
	(deprecated_insert_raw_breakpoint): Add an address space argument.
	Adjust.
	(insert_single_step_breakpoint): Ditto.
	(single_step_breakpoint_inserted_here_p): Ditto.
	(clear_syscall_counts): New.
	(_initialize_breakpoint): Install it as inferior_exit observer.

	* exec.h: Include "progspace.h".
	(exec_bfd, exec_bfd_mtime): New defines.
	(exec_close): Declare.
	* exec.c: Include "gdbthread.h" and "progspace.h".
	(exec_bfd, exec_bfd_mtime, current_target_sections_1): Delete.
	(using_exec_ops): New.
	(exec_close_1): Rename to exec_close, and make public.
	(exec_close): Rename to exec_close_1, and adjust all callers.  Add
	description.  Remove target sections and close executables from
	all program spaces.
	(exec_file_attach): Add comment.
	(add_target_sections): Check on `using_exec_ops' to check if the
	target should be pushed.
	(remove_target_sections): Only unpush the target if there are no
	more target sections in any symbol space.
	* gdbcore.h: Include "exec.h".
	(exec_bfd, exec_bfd_mtime): Remove declarations.

	* frame.h (get_frame_program_space, get_frame_address_space)
	(frame_unwind_program_space): Declare.
	* frame.c (struct frame_info) <pspace, aspace>: New fields.
	(create_sentinel_frame): Add program space argument.  Set the
	pspace and aspace fields of the frame object.
	(get_current_frame, create_new_frame): Adjust.
	(get_frame_program_space): New.
	(frame_unwind_program_space): New.
	(get_frame_address_space): New.
	* stack.c (print_frame_info): Adjust.
	(print_frame): Use the frame's program space.

	* gdbthread.h (any_live_thread_of_process): Declare.
	* thread.c (any_live_thread_of_process): New.
	(switch_to_thread): Switch the program space as well.
	(restore_selected_frame): Don't warn if trying to restore frame
	level 0.

	* inferior.h: Include "progspace.h".
	(detach_fork): Declare.
	(struct inferior) <removable, aspace, pspace>
	<vfork_parent, vfork_child, pending_detach>
	<waiting_for_vfork_done>: New fields.
	<terminal_info>: Remove field.
	<data, num_data>: New fields.
	(register_inferior_data, register_inferior_data_with_cleanup)
	(clear_inferior_data, set_inferior_data, inferior_data): Declare.
	(exit_inferior, exit_inferior_silent, exit_inferior_num_silent)
	(inferior_appeared): Declare.
	(find_inferior_pid): Typo.
	(find_inferior_id, find_inferior_for_program_space): Declare.
	(set_current_inferior, save_current_inferior, prune_inferiors)
	(number_of_inferiors): Declare.
	(inferior_list): Declare.
	* inferior.c: Include "gdbcore.h" and "symfile.h".
	(inferior_list): Make public.
	(delete_inferior_1): Always delete thread silently.
	(find_inferior_id): Make public.
	(current_inferior_): New.
	(current_inferior): Use it.
	(set_current_inferior): New.
	(restore_inferior): New.
	(save_current_inferior): New.
	(free_inferior): Free the per-inferior data.
	(add_inferior_silent): Allocate per-inferior data.
	Call inferior_appeared.
	(delete_threads_of_inferior): New.
	(delete_inferior_1): Adjust interface to take an inferior pointer.
	(delete_inferior): Adjust.
	(delete_inferior_silent): Adjust.
	(exit_inferior_1): New.
	(exit_inferior): New.
	(exit_inferior_silent): New.
	(exit_inferior_num_silent): New.
	(detach_inferior): Adjust.
	(inferior_appeared): New.
	(discard_all_inferiors): Adjust.
	(find_inferior_id): Make public.  Assert pid is not zero.
	(find_inferior_for_program_space): New.
	(have_inferiors): Check if we have any inferior with pid not zero.
	(have_live_inferiors): Go over all pushed targets looking for
	process_stratum.
	(prune_inferiors): New.
	(number_of_inferiors): New.
	(print_inferior): Add executable column.  Print vfork parent/child
	relationships.
	(inferior_command): Adjust to cope with not running inferiors.
	(remove_inferior_command): New.
	(add_inferior_command): New.
	(clone_inferior_command): New.
	(struct inferior_data): New.
	(struct inferior_data_registration): New.
	(struct inferior_data_registry): New.
	(inferior_data_registry): New.
	(register_inferior_data_with_cleanup): New.
	(register_inferior_data): New.
	(inferior_alloc_data): New.
	(inferior_free_data): New.
	(clear_inferior_data): New.
	(set_inferior_data): New.
	(inferior_data): New.
	(initialize_inferiors): New.
	(_initialize_inferiors): Register "add-inferior",
	"remove-inferior" and "clone-inferior" commands.

	* objfiles.h: Include "progspace.h".
	(struct objfile) <pspace>: New field.
	(symfile_objfile, object_files): Don't declare.
	(ALL_PSPACE_OBJFILES): New.
	(ALL_PSPACE_OBJFILES_SAFE): New.
	(ALL_OBJFILES, ALL_OBJFILES_SAFE): Adjust.
	(ALL_PSPACE_SYMTABS): New.
	(ALL_PRIMARY_SYMTABS): Adjust.
	(ALL_PSPACE_PRIMARY_SYMTABS): New.
	(ALL_PSYMTABS): Adjust.
	(ALL_PSPACE_PSYMTABS): New.
	* objfiles.c (object_files, symfile_objfile): Delete.
	(struct objfile_sspace_info): New.
	(objfiles_pspace_data): New.
	(objfiles_pspace_data_cleanup): New.
	(get_objfile_pspace_data): New.
	(objfiles_changed_p): Delete.
	(allocate_objfile): Set the objfile's program space.  Adjust to
	reference objfiles_changed_p in pspace data.
	(free_objfile): Adjust to reference objfiles_changed_p in pspace
	data.
	(objfile_relocate): Ditto.
	(update_section_map): Add pspace argument.  Adjust to iterate over
	objfiles in the passed in pspace.
	(find_pc_section): Delete sections and num_sections statics.
	Adjust to refer to program space's objfiles_changed_p.	Adjust to
	refer to sections and num_sections store in the objfile's pspace
	data.
	(objfiles_changed): Adjust to reference objfiles_changed_p in
	pspace data.
	(_initialize_objfiles): New.
	* linespec.c (decode_all_digits, decode_dollar): Set the sal's
	program space.
	* source.c (current_source_pspace): New.
	(get_current_source_symtab_and_line): Set the sal's program space.
	(set_current_source_symtab_and_line): Set current_source_pspace.
	(select_source_symtab): Ditto.	Use ALL_OBJFILES.
	(forget_cached_source_info): Iterate over all program spaces.
	* symfile.c (clear_symtab_users): Adjust.
	* symmisc.c (print_symbol_bcache_statistics): Iterate over all
	program spaces.
	(print_objfile_statistics): Ditto.
	(maintenance_print_msymbols): Ditto.
	(maintenance_print_objfiles): Ditto.
	(maintenance_info_symtabs): Ditto.
	(maintenance_info_psymtabs): Ditto.
	* symtab.h (SYMTAB_PSPACE): New.
	(struct symtab_and_line) <pspace>: New field.
	* symtab.c (init_sal): Clear the sal's program space.
	(find_pc_sect_symtab): Set the sal's program space.  Switch thread
	and space.
	(append_expanded_sal): Add program space argument.  Iterate over
	all program spaces.
	(expand_line_sal): Iterate over all program spaces.  Switch
	program space.

	* target.h (enum target_waitkind) <TARGET_WAITKIND_VFORK_DONE>: New.
	(struct target_ops) <to_thread_address_space>: New field.
	(target_thread_address_space): Define.
	* target.c (target_detach): Only remove breakpoints from the
	inferior we're detaching.
	(target_thread_address_space): New.

	* defs.h (initialize_progspace): Declare.
	* top.c (gdb_init): Call it.

	* solist.h (struct so_list) <sspace>: New field.
	* solib.h (struct program_space): Forward declare.
	(solib_name_from_address): Adjust prototype.
	* solib.c (so_list_head): Replace with a macro referencing the
	program space.
	(update_solib_list): Set the so's program space.
	(solib_name_from_address): Add a program space argument and adjust.

	* solib-svr4.c (struct svr4_info) <pid>: Delete field.
	<interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low>
	<interp_plt_sect_high>: New fields.
	(svr4_info_p, svr4_info): Delete.
	(solib_svr4_sspace_data): New.
	(get_svr4_info): Rewrite.
	(svr4_sspace_data_cleanup): New.
	(open_symbol_file_object): Adjust.
	(svr4_default_sos): Adjust.
	(svr4_fetch_objfile_link_map): Adjust.
	(interp_text_sect_low, interp_text_sect_high, interp_plt_sect_low)
	(interp_plt_sect_high): Delete.
	(svr4_in_dynsym_resolve_code): Adjust.
	(enable_break): Adjust.
	(svr4_clear_solib): Revert bit that removed the svr4_info here,
	and reinstate clearing debug_base, debug_loader_offset_p,
	debug_loader_offset and debug_loader_name.
	(_initialize_svr4_solib): Register solib_svr4_pspace_data.  Don't
	install an inferior_exit observer anymore.

	* printcmd.c (struct display) <pspace>: New field.
	(display_command): Set the display's sspace.
	(do_one_display): Match the display's sspace.
	(display_uses_solib_p): Ditto.

	* linux-fork.c (detach_fork): Moved to infrun.c.
	(_initialize_linux_fork): Moved "detach-on-fork" command to
	infrun.c.
	* infrun.c (detach_fork): Moved from linux-fork.c.
	(proceed_after_vfork_done): New.
	(handle_vfork_child_exec_or_exit): New.
	(follow_exec_mode_replace, follow_exec_mode_keep)
	(follow_exec_mode_names, follow_exec_mode_string)
	(show_follow_exec_mode_string): New.
	(follow_exec): New.  Reinstate the mark_breakpoints_out call.
	Remove shared libraries before attaching new executable.  If user
	wants to keep the inferior, keep it.
	(displaced_step_fixup): Adjust to pass an address space to the
	breakpoints module.
	(resume): Ditto.
	(clear_proceed_status): In all-stop mode, always clear the proceed
	status of all threads.
	(prepare_to_proceed): Adjust to pass an address space to the
	breakpoints module.
	(proceed): Ditto.
	(adjust_pc_after_break): Ditto.
	(handle_inferior_event): When handling a process exit, switch the
	program space to the inferior's that had exited.  Call
	handle_vfork_child_exec_or_exit.  Adjust to pass an address space
	to the breakpoints module.  In non-stop mode, when following a
	fork and detach-fork is off, also resume the other branch.  Handle
	TARGET_WAITKIND_VFORK_DONE.  Set the program space in sals.
	(normal_stop): Prune inferiors.
	(_initialize_infrun): Install the new "follow-exec-mode" command.
	"detach-on-fork" moved here.

	* regcache.h (get_regcache_aspace): Declare.
	* regcache.c (struct regcache) <aspace>: New field.
	(regcache_xmalloc): Clear the aspace.
	(get_regcache_aspace): New.
	(regcache_cpy): Copy the aspace field.
	(regcache_cpy_no_passthrough): Ditto.
	(get_thread_regcache): Fetch the thread's address space from the
	target, and store it in the regcache.

	* infcall.c (call_function_by_hand): Set the sal's pspace.

	* arch-utils.c (default_has_shared_address_space): New.
	* arch-utils.h (default_has_shared_address_space): Declare.

	* gdbarch.sh (has_shared_address_space): New.
	* gdbarch.h, gdbarch.c: Regenerate.

	* linux-tdep.c: Include auxv.h, target.h, elf/common.h.
	(linux_has_shared_address_space): New.
	(_initialize_linux_tdep): Declare.

	* arm-tdep.c (arm_software_single_step): Pass the frame's address
	space to insert_single_step_breakpoint.
	* arm-linux-tdep.c (arm_linux_software_single_step): Pass the
	frame's pspace to breakpoint functions.
	* cris-tdep.c (crisv32_single_step_through_delay): Ditto.
	(cris_software_single_step): Ditto.
	* mips-tdep.c (deal_with_atomic_sequence): Add frame argument.
	Pass the frame's pspace to breakpoint functions.
	(mips_software_single_step): Adjust.
	(mips_single_step_through_delay): Adjust.
	* rs6000-aix-tdep.c (rs6000_software_single_step): Adjust.
	* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust.
	* solib-irix.c (enable_break): Adjust to pass the current frame's
	address space to breakpoint functions.
	* sparc-tdep.c (sparc_software_single_step): Ditto.
	* spu-tdep.c (spu_software_single_step): Ditto.
	* alpha-tdep.c (alpha_software_single_step): Ditto.
	* record.c (record_wait): Adjust to pass an address space to the
	breakpoints module.

	* fork-child.c (fork_inferior): Set the new inferior's program and
	address spaces.
	* inf-ptrace.c (inf_ptrace_follow_fork): Copy the parent's program
	and address spaces.
	(inf_ptrace_attach): Set the inferior's program and address spaces.
	* linux-nat.c: Include "solib.h".
	(linux_child_follow_fork): Manage parent and child's program and
	address spaces.	 Clone the parent's program space if necessary.
	Don't wait for the vfork to be done here.  Refuse to resume if
	following the vfork parent while leaving the child stopped.
	(resume_callback): Don't resume a vfork parent.
	(linux_nat_resume): Also check for pending events in the
	lp->waitstatus field.
	(linux_handle_extended_wait): Report TARGET_WAITKIND_VFORK_DONE
	events to the core.
	(stop_wait_callback): Don't wait for SIGSTOP on vfork parents.
	(cancel_breakpoint): Adjust.
	* linux-thread-db.c (thread_db_wait): Don't remove thread event
	breakpoints here.
	(thread_db_mourn_inferior): Don't mark breakpoints out here.
	Remove thread event breakpoints after mourning.
	* corelow.c: Include progspace.h.
	(core_open): Set the inferior's program and address spaces.
	* remote.c (remote_add_inferior): Set the new inferior's program
	and address spaces.
	(remote_start_remote): Update address spaces.
	(extended_remote_create_inferior_1): Don't init the thread list if
	we already debugging other inferiors.
	* darwin-nat.c (darwin_attach): Set the new inferior's program and
	address spaces.
	* gnu-nat.c (gnu_attach): Ditto.
	* go32-nat.c (go32_create_inferior): Ditto.
	* inf-ttrace.c (inf_ttrace_follow_fork, inf_ttrace_attach): Ditto.
	* monitor.c (monitor_open): Ditto.
	* nto-procfs.c (procfs_attach, procfs_create_inferior): Ditto.
	* procfs.c (do_attach): Ditto.
	* windows-nat.c (do_initial_windows_stuff): Ditto.

	* inflow.c (inferior_process_group)
	(terminal_init_inferior_with_pgrp, terminal_inferior,
	(terminal_ours_1, inflow_inferior_exit, copy_terminal_info)
	(child_terminal_info, new_tty_postfork, set_sigint_trap): Adjust
	to use per-inferior data instead of inferior->terminal_info.
	(inflow_inferior_data): New.
	(inflow_new_inferior): Delete.
	(inflow_inferior_data_cleanup): New.
	(get_inflow_inferior_data): New.

	* mi/mi-interp.c (mi_new_inferior): Rename to...
	(mi_inferior_appeared): ... this.
	(mi_interpreter_init): Adjust.

	* tui/tui-disasm.c: Include "progspace.h".
	(tui_set_disassem_content): Pass an address space to
	breakpoint_here_p.

	* NEWS: Mention multi-program debugging support.  Mention new
	commands "add-inferior", "clone-inferior", "remove-inferior",
	"maint info program-spaces", and new option "set
	follow-exec-mode".

2009-10-19  Pedro Alves	 <pedro@codesourcery.com>
	    Stan Shebs	<stan@codesourcery.com>

	gdb/doc/
	* observer.texi (new_inferior): Rename to...
	(inferior_appeared): ... this.

2009-10-19  Pedro Alves	 <pedro@codesourcery.com>
	    Stan Shebs	<stan@codesourcery.com>

	gdb/testsuite/
	* gdb.base/foll-vfork.exp: Adjust to spell out "follow-fork".
	* gdb.base/foll-exec.exp: Adjust to expect a process id before
	"Executing new program".
	* gdb.base/foll-fork.exp: Adjust to spell out "follow-fork".
	* gdb.base/multi-forks.exp: Ditto.  Adjust to the inferior being
	left listed after having been killed.
	* gdb.base/attach.exp: Adjust to spell out "symbol-file".
	* gdb.base/maint.exp: Adjust test.

	* Makefile.in (ALL_SUBDIRS): Add gdb.multi.
	* gdb.multi/Makefile.in: New.
	* gdb.multi/base.exp: New.
	* gdb.multi/goodbye.c: New.
	* gdb.multi/hangout.c: New.
	* gdb.multi/hello.c: New.
	* gdb.multi/bkpt-multi-exec.c: New.
	* gdb.multi/bkpt-multi-exec.exp: New.
	* gdb.multi/crashme.c: New.

2009-10-19  Pedro Alves	 <pedro@codesourcery.com>
	    Stan Shebs	<stan@codesourcery.com>

	gdb/doc/
	* gdb.texinfo (Inferiors): Rename node to ...
	(Inferiors and Programs): ... this.  Mention running multiple
	programs in the same debug session.
	<info inferiors>: Mention the new 'Executable' column if "info
	inferiors".  Update examples.  Document the "add-inferior",
	"clone-inferior", "remove-inferior" and "maint info
	program-spaces" commands.
	(Process): Rename node to...
	(Forks): ... this.  Document "set|show follow-exec-mode".
2009-10-19 09:51:43 +00:00
Sergio Durigan Junior a96d9b2e9a Implementing catch syscall.
* amd64-linux-tdep.c: Include xml-syscall.h header, define the XML
syscall name for the architecture.
(amd64_linux_get_syscall_number): New function.
(amd64_linux_init_abi): Register the correct functions for syscall
catchpoint; set the correct syscall file name.
* breakpoint.c: New include: xml-syscall.h.
(set_raw_breakpoint_without_location): Setting the parameters
for the catch syscall feature.
(insert_catch_syscall): New.
(remove_catch_syscall): New.
(breakpoint_hit_catch_syscall): New.
(print_it_catch_syscall): New.
(print_one_catch_syscall): New.
(print_mention_catch_syscall): New.
(catch_syscall_breakpoint_ops): New.
(syscall_catchpoint_p): New.
(create_catchpoint_without_mention): New.
(create_catchpoint): Modified in order to use
create_catchpoint_without_mention.
(create_syscall_event_catchpoint): New.
(clean_up_filters): New.
(catch_syscall_split_args): New.
(catch_syscall_command_1): New.
(delete_breakpoint): Add cleanup for catch syscall.
(is_syscall_catchpoint_enabled): New.
(catch_syscall_enabled): New.
(catching_syscall_number): New.
(catch_syscall_completer): New completer function.
(add_catch_command): Add the completer function for catchpoints.
* breakpoint.h (syscalls_to_be_caught): New vector.
(catch_syscall_enabled): New.
(catching_syscall_number): New.
* gdbarch.c: Regenerated.
* gdbarch.h: Regenerated.
* gdbarch.sh: Add syscall catchpoint functions and structures.
(get_syscall_number): New.
(UNKNOWN_SYSCALL): New definition.
* i386-linux-nat.c (i386_linux_resume): Select the proper request
to be made for ptrace() considering if we are catching syscalls
or not.
* i386-linux-tdep.c: Include xml-syscall.h header, define the XML
syscall name for the architecture.
(i386_linux_get_syscall_number): New.
(i386_linux_init_abi): Register the correct functions for syscall
catchpoint; set the correct syscall file name.
* inf-child.c (inf_child_set_syscall_catchpoint): New.
(inf_child_target): Assign default values to target_ops.
* inf-ptrace.c (inf_ptrace_resume): Select the proper request
to be made for ptrace() considering if we are catching syscalls
or not.
* inferior.h (struct inferior): Included new variables
any_syscall_count, syscalls_counts and total_syscalls_count,
used to keep track of requested syscall catchpoints.
* infrun.c (resume): Add syscall catchpoint.
(deal_with_syscall_event): New.
(handle_inferior_event): Add syscall entry/return events.
(inferior_has_called_syscall): New.
* linux-nat.c: Define some helpful variables to track wether we have
support for the needed ptrace option.
(linux_test_for_tracesysgood): New.
(linux_supports_tracesysgood): New.
(linux_enable_tracesysgood): New.
(linux_enable_event_reporting): Save the current used ptrace
options.
(linux_child_post_attach): Calling linux_enable_tracesysgood.
(linux_child_post_startup_inferior): Likewise.
(linux_child_set_syscall_catchpoint): New function.
(linux_handle_extended_wait): Handle the case which the inferior stops
because it has called or returned from a syscall.
(linux_target_install_ops): Install the necessary functions to handle
syscall catchpoints.
* linux-nat.h (struct lwp_info): Include syscall_state into the
structure, which indicates if we are in a syscall entry or return.
* ppc-linux-tdep.c: Include xml-syscall.h header, define the XML
syscall filename for the arch.
(ppc_linux_get_syscall_number): New.
(ppc_linux_init_abi): Register the correct functions for syscall
catchpoint; setting the correct name for the XML syscall file.
* target.c (update_current_target): Update/copy functions related to
syscall catchpoint.
(target_waitstatus_to_string): Add syscall catchpoint entry/return
events.
* target.h (struct target_waitstatus): Add syscall number.
(struct syscall): New struct to hold information about syscalls
in the system.
(struct target_ops): Add ops for syscall catchpoint.
(inferior_has_called_syscall): New.
(target_set_syscall_catchpoint): New.
* xml-support.c (xml_fetch_content_from_file): New function,
transferred from xml-tdesc.c.
* xml-support.h (xml_fetch_content_from_file): New.
* xml-tdesc.c (fetch_xml_from_file): Function removed;
transferred to xml-support.c.
(file_read_description_xml): Updated to use the new
xml_fetch_content_from_file function.
* syscalls/gdb-syscalls.dtd: New definition file for syscall's XML
support.
* syscalls/amd64-linux.xml: New file containing information about
syscalls for GNU/Linux systems that use amd64 architecture.
* syscalls/i386-linux.xml: New file containing information about
syscalls for GNU/Linux systems that use i386 architecture.
* syscalls/ppc-linux.xml: New file containing information about
syscalls for GNU/Linux systems that use PPC architecture.
* syscalls/ppc64-linux.xml: New file containing information about
syscalls for GNU/Linux systems that use PPC64 architecture.
* xml-syscall.c: New file containing functions for manipulating
syscall's XML files.
* xml-syscall.h: New file, exporting the functions above mentioned.
* Makefile.in: Support for relocatable GDB datadir and XML
syscall.
* NEWS: Added information about the catch syscall feature.
* doc/gdb.texinfo (Set Catchpoints): Documentation about the new
feature.
* testsuite/Makefile.in: Inclusion of catch-syscall object.
* testsuite/gdb.base/catch-syscall.c: New file.
* testsuite/gdb.base/catch-syscall.exp: New file.
2009-09-15 03:30:08 +00:00
Doug Evans 4efc650796 Add interface for JIT code generation.
* NEWS: Announce JIT interface.
	* Makefile.in (SFILES): Add jit.c.
	(HFILES_NO_SRCDIR): Add jit.h.
	(COMMON_OBS): Add jit.o.
	* jit.c: New file.
	* jit.h: New file.
	* breakpoint.h (enum bptype): Add bp_jit_event to enum.
	* breakpoint.c:
	(update_breakpoints_after_exec): Delete jit breakpoints after exec.
	(bpstat_what): Update event table for bp_jit_event.
	(print_it_typical): Added case for bp_jit_event.
	(print_one_breakpoint_location): Added case for bp_jit_event.
	(allocate_bp_location): Added case for bp_jit_event.
	(mention): Added case for bp_jit_event.
	(delete_command): Added case for bp_jit_event.
	(breakpoint_re_set_one): Added case for bp_jit_event.
	(breakpoint_re_set): Added call to jit_inferior_created_hook.
	(create_jit_event_breakpoint): New.
	* infrun.c (handle_inferior_event): Add handler for jit event.
	(follow_exec): Add call to jit_inferior_created_hook.
	* doc/gdb.texinfo: Add chapter on JIT interface.
2009-08-20 18:02:48 +00:00
Vladimir Prus 48cb2d8581 Implement -break-commands
* breakpoint.c (get_breakpoint, breakpoint_set_commands): New.
	(commands_command): Use breakpoint_set_commands.
	* breakpoint.h (get_breakpoint, breakpoint_set_commands): Declare.

	* mi/mi-cmds.h (mi_cmd_break_commands): New.
	* mi/mi-cmds.c: Register -break-commands.
	* mi/mi-cmd-break.c (mi_cmd_break_commands, mi_read_next_line)
	(mi_command_line_array, mi_command_line_array_cnt)
	(mi_command_line_array_ptr): New.
2009-08-03 12:39:01 +00:00
Ulrich Weigand 8bea4e01db * breakpoint.h (enum enable_state): Add bp_startup_disabled.
(disable_breakpoints_before_startup): Add prototype.
	(enable_breakpoints_after_startup): Likewise.

	* breakpoint.c (executing_startup): New static variable.
	(describe_other_breakpoints): Handle bp_startup_disabled.
	(check_duplicates_for): Likewise.
	(disable_breakpoints_before_startup): New function.
	(enable_breakpoints_after_startup): New function.
	(create_breakpoint): Mark new breakpoints as bp_startup_disabled
	if executing_startup flag is true.
	(break_command_really): Likewise.
	(breakpoint_re_set_one): Skip bp_startup_disabled breakpoints.
2009-07-31 14:31:16 +00:00
Ulrich Weigand a6d9a66e23 * breakpoint.h (struct breakpoint): New member GDBARCH.
* breakpoint.c: Include "arch-utils.h".
	(set_raw_breakpoint_without_location): Add GDBARCH parameter.
	Use it to set breakpoint architecture.
	(set_raw_breakpoint): Add GDBARCH parameter.
	(create_internal_breakpoint): Likewise.
	(create_catchpoint): Likewise.
	(create_fork_vfork_event_catchpoint): Likewise.
	(create_breakpoint): Likewise.
	(create_breakpoints): Likewise.
	(break_command_really): Likewise.
	(create_ada_exception_breakpoint): Likewise.
	Update local callers to pass architecture:
	(create_internal_breakpoint): Update.
	(create_overlay_event_breakpoint): Update.
	(create_longjmp_master_breakpoint): Update.
	(create_thread_event_breakpoint): Update.
	(create_solib_event_breakpoint): Update.
	(create_catchpoint): Update.
	(create_fork_vfork_event_catchpoint): Update.
	(set_momentary_breakpoint): Update.
	(clone_momentary_breakpoint): Update.
	(create_breakpoint): Update.
	(create_breakpoints): Update.
	(break_command_really): Update.
	(break_command_1): Update.
	(set_breakpoint): Update.
	(watch_command_1): Update.
	(catch_fork_command_1): Update.
	(catch_exec_commnd_1): Update.
	(handle_gnu_v3_exceptions): Update.
	(create_ada_exception_breakpoint): Update.
	(catch_ada_exception_command): Update.
	(catch_assert_command): Update.
	(trace_command): Update.

	* breakpoint.h (struct bp_location): New member GDBARCH.
	* breakpoint.c (get_sal_arch): New function.
	(set_raw_breakpoint): Set location architecture.
	(add_location_to_breakpoint): Likewise.
	(clone_momentary_breakpoint): Likewise.
	(watch_command_1): Likewise.
	(update_watchpoint): Likewise.
	(bp_loc_is_permanent): Use location architecture instead of
	current_gdbarch.
	(adjust_breakpoint_address): Add GDBARCH parameter; use it
	instead of current_gdbarch.
	Update callers of adjust_breakpoint_address to pass
	breakpoint location architecture:
	(set_raw_breakpoint): Update.
	(watch_command_1): Update.

        * tracepoint.c: (collect_symbol): Add GDBARCH parameter, use instead
	of current_gdbarch.
	(add_local_symbols): Add GDBARCH parameter.  Pass to collect_symbol.
	(encode_actions): Pass tracepoint architecture to add_local_symbols
	(encode_actions): Use tracepoint architecture instead of
	current_gdbarch.  Pass it to add_local_symbols and collect_symbol.

	* breakpoint.h (struct breakpoint_ops): Replace last_addr parameter
	of print_one callback with last_loc.
	* breakpoint.c (print_one_breakpoint_location): Replace last_addr
	parameter with last_loc.
	(print_one_breakpoint): Likewise.
	(do_captured_breakpoint_query): Update call.
	(breakpoint_1): Pass last_loc instead of last_addr to
	print_one_breakpoint.  Pass last location architecture instead of
	current_gdbarch to set_next_address.
	Update all implementations of the print_one callback:
	* breakpoint.c (print_one_catch_fork): Update.
	(print_one_catch_vfork): Update.
	(print_one_catch_exec): Update.
	(print_one_exception_catchpoint): Update.
	* ada-lang.c (print_one_exception): Update.
	(print_one_catch_exception): Update.
	(print_one_catch_exception_unhandled): Update.
	(print_one_catch_assert): Update.

	* breakpoint.c (print_one_breakpoint_location): Add PRINT_ADDRESS_BITS
	parameter.  Use it instead of gdbarch_addr_bit (current_gdbarch).
	(print_one_breakpoint): Add PRINT_ADDRESS_BITS parameter and pass it
	to print_one_breakpoint_location.
	(breakpoint_address_bits): New function.
	(do_captured_breakpoint_query): Compute number of address bits to print
	and pass it to print_one_breakpoint.
	(breakpoint_1): Likewise.  Use it instead of current_gdbarch.

	* breakpoint.h (create_thread_event_breakpoint): Add GDBARCH.
	* breakpoint.c (create_thread_event_breakpoint): Likewise.
	Update callers to create_thread_event_breakpoint:
	* aix-thread.c (pd_enable): Update.
	* linux-thread-db.c (enable_thread_event): Update.

	* breakpoint.h (create_solib_event_breakpoint): Add GDBARCH.
	* breakpoint.c (create_solib_event_breakpoint): Likewise.
	Update callers to create_solib_event_breakpoint:
	* solib-frv.c (enable_break, enable_break2): Update.
	* solib-pa64.c (pa64_solib_create_inferior_hook): Update.
	* solib-som.c (som_solib_create_inferior_hook): Update.
	* solib-darwin.c (darwin_solib_create_inferior_hook): Update.
	* solib-svr4.c (enable_break): Update.

	* breakpoint.h (insert_single_step_breakpoint): Add GDBARCH.
	* breakpoint.c (insert_single_step_breakpoint): Likewise.
	Update callers to insert_single_step_breakpoint:
	* alpha-tdep.c (alpha_software_single_step): Update.
	* arm-linux-tdep.c (arm_linux_software_single_step): Update.
	* arm-tdep.c (arm_software_single_step): Update.
	* cris-tdep.c (cris_software_single_step): Update.
	* rs6000-aix-tdep.c (rs6000_software_single_step): Update.
	* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Update.
	* sparc-tdep.c (sparc_software_single_step): Update.
	* spu-tdep.c (spu_software_single_step): Update.
	* mips-tdep.c (deal_with_atomic_sequence): Add GDBARCH parameter.
	Pass it to insert_single_step_breakpoint.
	(mips_software_single_step): Pass architecture to
	deal_with_atomic_sequence and insert_single_step_breakpoint.

	* breakpoint.h (deprecated_insert_raw_breakpoint): Add GDBARCH.
	(deprecated_remove_raw_breakpoint): Likewise.
	* breakpoint.c (deprecated_insert_raw_breakpoint): Add GDBARCH.
	(deprecated_remove_raw_breakpoint): Likewise.
	Update callers to deprecated_insert_raw_breakpoint and
	deprecated_remove_raw_breakpoint:
	* breakpoint.c (single_step_gdbarch): New static variable.
	(insert_single_step_breakpoint): Pass GDBARCH parameter to
	deprecated_insert_raw_breakpoint.  Store it in single_step_gdbarch.
	(remove_single_step_breakpoints): Pass architecture stored in
	single_step_gdbarch to deprecated_remove_raw_breakpoint.
	* rs6000-nat.c (exec_one_dummy_insn): Update.
	* solib-irix.c (enable_break, disable_break): Update.
	* procfs.c (procfs_mourn_inferior): Update.
	(remove_dbx_link_breakpoint): Update.

	* breakpoint.h (set_breakpoint): Add GDBARCH parameter.
	(set_momentary_breakpoint, set_momentary_breakpoint_at_pc): Likewise.
	* breakpoint.c (set_breakpoint): Add GDBARCH parameter.
	(set_momentary_breakpoint, set_momentary_breakpoint_at_pc): Likewise.
	Update callers to set_breakpoint, set_momentary_breakpoint and
	set_momentary_breakpoint_at_pc:
	* breakpoint.c (set_momentary_breakpoint_at_pc): Update.
	(until_break_command): Update.
	* infcall.c (call_function_by_hand): Update.
	* infcmd.c (finish_backward, finish_forward): Update.
	* infrun.c (insert_step_resume_breakpoint_at_sal): Add GDBARCH
	parameter.  Pass it to set_momentary_breakpoint.
	(insert_longjmp_resume_breakpoint): Add GDBARCH parameter.
	Pass it to set_momentary_breakpoint_at_pc.
	(handle_inferior_event): Update.
	(insert_step_resume_breakpoint_at_frame): Update.
	(insert_step_resume_breakpoint_at_caller): Update..
	* mi/mi-cmd-break.c: Include "arch-utils.h".
	(mi_cmd_break_insert): Update.

	* target.h (struct target_ops): Add GDBARCH parameter to
	to_insert_breakpoint, to_remove_breakpoint, to_insert_hw_breakpoint,
	and to_remove_hw_breakpoint members.
	(target_insert_breakpoint, target_remove_breakpoint,
	target_insert_hw_breakpoint, target_remove_hw_breakpoint): Add GDBARCH
	parameter, pass to target routine.
	(memory_remove_breakpoint, memory_insert_breakpoint): Add GDBARCH
	parameter.
	* target.c (debug_to_insert_breakpoint, debug_to_remove_breakpoint,
	debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): Add
	GDBARCH parameter, pass to target routine.
	(update_current_target): Update function signature.
	* breakpoint.c (insert_bp_location, remove_breakpoint,
	deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint):
	Pass architecture to target_ routines.
	Update all implementations of the target breakpoint routines to take
	GDBARCH parameter and use it instead of GDBARCH as appropriate:
	* corelow.c (ignore): Update.
	* exec.c (ignore): Update.
	* mem-break.c (memory_insert_breakpoint): Update.
	(memory_remove_breakpoint): Update.
	* monitor.c (monitor_insert_breakpoint): Update.
	(monitor_remove_breakpoint): Update.
	* record.c (record_insert_breakpoint): Update.
	(record_beneath_to_insert_breakpoint): Update.
	(record_remove_breakpoint): Update.
	(record_beneath_to_remove_breakpoint): Update.
	* remote.c (remote_insert_breakpoint): Update.
	(remote_remove_breakpoint): Update.
	(remote_insert_hw_breakpoint): Update.
	(remote_remove_hw_breakpoint): Update.
	* remote-m32r-sdi.c (m32r_insert_breakpoint): Update.
	(m32r_remove_breakpoint): Update.
	* remote-mips.c (mips_insert_breakpoint): Update.
	(mips_remove_breakpoint): Update.
	* i386-nat.c (i386_insert_hw_breakpoint): Update.
	(i386_remove_hw_breakpoint): Update.
	* nto-procfs.c (procfs_insert_breakpoint):  Update.
	(procfs_remove_breakpoint): Update.
	(procfs_insert_hw_breakpoint): Update.
	(procfs_remove_hw_breakpoint): Update.

doc/ChangeLog:

	* gdbint.texi (Examples of Use of @code{ui_out} functions):
	Update example code extrated from breakpoint.c.
2009-07-02 17:12:28 +00:00
Ulrich Weigand 0fd8e87fea * breakpoint.h (set_longjmp_breakpoint): Add THREAD argument.
(enum bptype): Add bp_longjmp_master.

	* breakpoint.c (create_longjmp_master_breakpoint): New function.
	(update_breakpoints_after_exec): Handle bp_longjmp_master
	breakpoints.  Call create_longjmp_master_breakpoint.
	(print_it_typical, bpstat_stop_status, bpstat_what,
	print_one_breakpoint_location, allocate_bp_location, mention,
	delete_command, breakpoint_re_set_one): Handle bp_longjmp_master.
	(breakpoint_re_set): Call create_longjmp_master_breakpoint.
	(create_longjmp_breakpoint): Delete.
	(set_longjmp_breakpoint): Add THREAD argument.  Reimplement
	to install momentary clones of bp_longjmp_master breakpoints.

	* infcmd.c (step_1): Pass thread to set_longjmp_breakpoint.
2009-06-24 16:41:30 +00:00
Paul Pluzhnikov 69de3c6af9 2009-06-23 Paul Pluzhnikov <ppluzhnikov@google.com>
Revert 2009-05-14 breakpoint commit (no longer needed).
	* breakpoint.h (breakpoint_re_set_objfile): Remove
	* breakpoint.c (breakpoint_re_set_objfile): Likewise
	(create_overlay_event_breakpoint): Remove objfile parameter,
	iterate over all objfiles.
	* objfiles.c (objfile_relocate): Update.
	* symfile.c (new_symfile_objfile): Likewise.
2009-06-23 16:28:45 +00:00
Pedro Alves e58b0e63bb gdb/
* gdbthread.h (struct thread_info): New `pending_follow' field.
	* thread.c (new_thread): New function.
	(add_thread_silent): Use it.
	* breakpoint.c (internal_breakpoint_number): New global, moved
	from inside...
	(create_internal_breakpoint): ... this.
	(clone_momentary_breakpoint): New.
	* breakpoint.h (clone_momentary_breakpoint): Declare.
	* infrun.c (nullify_last_target_wait_ptid): Move declaration
	higher.
	(pending_follow): Delete.
	(follow_fork): Handle pending follow fork event here.  Moved the
	preserving of thread stepping state here.
	(resume): Don't handle pending follow fork events here.  Only
	install the inferior's terminal modes if we're about to resume it.
	(proceed): Handle possible pending follow fork events here.
	(init_wait_for_inferior): No need to clear pending_follow anymore,
	it's gone.
	(handle_inferior_event): Adjust to per-thread `pending_follow'.
	Call `follow_fork' to handle following the fork.  If the
	follow-fork is cancelled, stop stepping.
	* linux-nat.c (linux_child_follow_fork): Adjust to per-thread
	`pending_follow' events.  Remove code that handled preserving the
	thread stepping state.
	* inf-ptrace.c (inf_ptrace_follow_fork): Ditto.
	* inf-ttrace.c (inf_ttrace_follow_fork): Ditto.

gdb/testsuite/
	* gdb.threads/fork-thread-pending.c: New.
	* gdb.threads/fork-thread-pending.exp: New.
2009-05-24 18:00:08 +00:00
Paul Pluzhnikov e62c965a4f 2009-05-14 Paul Pluzhnikov <ppluzhnikov@google.com>
* breakpoint.h: Add breakpoint_re_set_objfile prototype.
	* breakpoint.c (create_overlay_event_breakpoint): Renamed
	from create_overlay_event_breakpoint_1, old
	create_overlay_event_breakpoint deleted.
	(breakpoint_re_set_objfile): Don't rescan all objfiles
	unnecessarily.
	(breakpoint_re_set): New function.
	* symfile.c (new_symfile_objfile): Call breakpoint_re_set_objfile
	instead of breakpoint_re_set.
	* objfiles.c (objfile_relocate): Likewise.
2009-05-14 23:33:08 +00:00
Joel Brobecker 4a306c9a89 Provide support for (Ada) task-specific breakpoints.
* ada-lang.h (ada_get_task_number): Add declaration.
        (breakpoint_ada_task_match): Delete declaration.
        * ada-tasks.c (ada_get_task_number): Make non-static.
        * breakpoint.h (struct breakpoint): Add field "task".
        * breakpoint.c (print_one_breakpoint_location): Add handling of
        task-specific breakpoints.
        (create_breakpoint, create_breakpoints, find_condition_and_thread):
        New parameter "task".
        (break_command_really): Update calls to find_condition_and_thread
        and create_breakpoints.
        (breakpoint_re_set_one): Update call to find_condition_and_thread.
        Set b->task.
2009-03-31 16:44:18 +00:00
Stan Shebs 1042e4c058 2009-03-30 Stan Shebs <stan@codesourcery.com>
Make tracepoints into a type of breakpoint.
	* breakpoint.h (enum bptype): Add bp_tracepoint.
	(struct breakpoint): Add fields step_count, pass_count, actions.
	(get_tracepoint, get_tracepoint_by_number): Declare.
	(all_tracepoints): Declare.
	* breakpoint.c: Include tracepoint.h, readline.h.
	(ALL_TRACEPOINTS): Move here from tracepoint.c.
	(tracepoint_count): Ditto.
	(should_be_inserted): GDB does not insert tracepoints itself.
	(print_it_typical): Add tracepoint case.
	(bpstat_what): Ditto.
	(print_one_breakpoint_location): Ditto, and add printing for
	pass count, step count, and action list.
	(user_settable_breakpoint): Add tracepoint case.
	(allocate_bp_location): Ditto.
	(set_breakpoint_location_function): Ditto.
	(disable_breakpoints_in_shlibs): Ditto.
	(mention): Ditto.
	(break_command_really): Add argument traceflag, use to choose
	basic breakpoint type.
	(break_command_1): Pass extra argument.
	(set_breakpoint, handle_gnu_v3_exceptions): Ditto.
	(breakpoint_re_set_one): Add tracepoint case.
	(disable_command, enable_command): Ditto.
	(set_tracepoint_count): Move here from tracepoint.c.
	(trace_command): Move here from tracepoint.c and use
	break_command_really.
	(tracepoints_info): Move here from tracepoint.c and call
	breakpoints_info.
	(enable_trace_command): Move here from tracepoint.c and call
	enable_command.
	(disable_trace_command): Move here from tracepoint.c and call
	disable_command.
	(delete_trace_command): Move here from tracepoint.c and call
	delete_breakpoint.
	(trace_pass_command): Move here from tracepoint.c.
	(get_tracepoint_by_number): Ditto.
	(tracepoint_save_command): Ditto.
	(get_tracepoint): New function.
	(all_tracepoints): New function.
	(_initialize_breakpoint): Move tracepoint init from tracepoint.c,
	deprecate "enable trace" and "disable trace" commands.
	* tracepoint.h (struct tracepoint): Remove.
	(tracepoint_chain): Remove decl.
	(deprecated_create_tracepoint_hook): Remove decl.
	(deprecated_delete_tracepoint_hook): Remove decl.
	(deprecated_modify_tracepoint_hook): Remove decl.
	(ALL_TRACEPOINTS, ALL_TRACEPOINTS_SAFE): Remove.
	(free_actions): Update signature.
	(validate_actionline): Update signature.
	(end_actions_pseudocommand): Declare.
	(while_stepping_pseudocommand): Declare.
	* tracepoint.c: Include breakpoint.h.
	(tracepoint_chain, tracepoint_count): Remove.
	(free_actions, make_cleanup_free_actions): Update signature.
	(trace_command, set_raw_tracepoint): Remove.
	(trace_mention): Remove.
	(tracepoints_info): Remove.
	(tracepoint_operation, map_args_over_tracepoints): Remove.
	(get_tracepoint_by_number): Remove.
	(enable_trace_command, disable_trace_command): Remove.
	(delete_trace_command, trace_pass_command): Remove.
	(trace_actions_command, read_actions): Update signature.
	(validate_actionline): Update signature, use bp loc.
	(encode_actions): Ditto.
	(download_tracepoint): New function, body of trace_start_command.
	(trace_start_command): Call it, use all_tracepoints.
	(tracepoint_save_command): Remove.
	(tracepoint_dump_command): Use get_tracepoint.
	(end_actions_pseudocommand): Make globally visible.
	(while_stepping_pseudocommand): Ditto.
	(_initialize_tracepoint): Move command definitions to breakpoint.c.

	doc/
	* gdb.texinfo (Tracepoints): Describe tracepoints as a
	special case of breakpoints.
	(Enable and Disable Tracepoints): Mention deprecation.
	(Listing Tracepoints): Update description and example.

	testsuite/
	* gdb.trace/actions.exp: Update to match new info trace format.
	* gdb.trace/deltrace.exp: Ditto.
	* gdb.trace/infotrace.exp: Ditto.
	* gdb.trace/passcount.exp: Ditto.
	* gdb.trace/save-trace.exp: Ditto.
	* gdb.trace/while-stepping.exp: Ditto.
	* gdb.trace/tracecmd.exp: Ditto, plus don't allow pending option.

	gdbtk/
	* generic/gdbtk-bp.c (gdb_actions_command): Update to handle
	tracepoints as breakpoints.
	(gdb_get_tracepoint_info): Ditto, plus use get_tracepoint and
	breakpoint locations.
	(tracepoint_exists): Ditto, plus use all_tracepoints.
2009-03-31 05:08:37 +00:00
Vladimir Prus 41447f92e2 * breakpoint.c (create_breakpoint, create_breakpoints)
(break_command_really, set_breakpoint): New parameter enabled.
	(create_breakpoint, break_command_really): Make breakpoint
	disabled if so requested.
	* breakpoint.h (set_breakpoint): New parameter enabled.
	* mi/mi-cmd-break.c (mi_cmd_break_insert): Handle the -d option.
2009-01-30 18:28:01 +00:00
Joel Brobecker 0fb0cc7590 Updated copyright notices for most files. 2009-01-03 05:58:08 +00:00
Joel Brobecker d81191fc8c Remove the unused BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK.
* breakpoint.h (enum bpstat_what_main_action): Remove
        BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK.
        * breakpoint.c (bpstat_what): Delete catch_shlib_event from enum class.
        Remove the BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK column from
        variable table.
        * infrun.c (wait_for_inferior): Remove handling of
        BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK.
2008-11-22 04:41:45 +00:00
Joel Brobecker 533be4dd37 Remove support for catch load and catch unload commands.
* breakpoint.h (enum bptype): Remove bp_catch_load and bp_catch_unload.
        (struct breakpoint): Remove fields dll_pathname and
        triggered_dll_pathname.
        (bpstat_get_triggered_catchpoints, ep_is_shlib_catchpoint): Delete.
        * breakpoint.c (ep_is_catchpoint): Remove handling of
        bp_catch_load and bp_catch_unload.
        (print_it_typical, bpstat_check_location, bpstat_what)
        (print_one_breakpoint_location, print_one_breakpoint_location)
        (user_settable_breakpoint, allocate_bp_location)
        (set_raw_breakpoint_without_location, mention, delete_breakpoint,
        (breakpoint_re_set_one, disable_command, enable_command): Likewise.
        (ep_is_shlib_catchpoint, bpstat_get_triggered_catchpoints)
        (catch_load_command_1, catch_unload_command_1): Delete.
        (_initialize_breakpoint): Remove the "catch load" and "catch unload"
        command creation.
        * infrun.c (handle_inferior_event): Remove the handling of
        load/unload catchpoint events.
2008-11-16 18:01:46 +00:00
Joel Brobecker fe798b7549 * breakpoint.h (enum bptype): Delete bp_catch_exec.
* breakpoint.c (insert_catchpoint): Remove handling for
        bp_catch_exec breakpoint kinds.
        (insert_bp_location, update_breakpoints_after_exec, remove_breakpoint)
        (ep_is_catchpoint, print_it_typical, bpstat_check_location),
        (bpstat_check_location, bpstat_what, print_one_breakpoint_location)
        (print_one_breakpoint_location, user_settable_breakpoint)
        (breakpoint_address_is_meaningful, adjust_breakpoint_address)
        (allocate_bp_location, mention, breakpoint_re_set_one)
        (disable_command, enable_command): Likewise.
        (create_exec_event_catchpoint): Delete.
        (insert_catch_exec, remove_catch_exec, breakpoint_hit_catch_exec)
        (print_it_catch_exec, print_one_catch_exec, print_mention_catch_exec):
        New functions.
        (catch_exec_breakpoint_ops): New static global.
        (catch_exec_command_1): Use create_catchpoint instead of
        create_exec_event_catchpoint to create the exec catchpoint.
2008-10-30 05:16:24 +00:00
Michael Snyder b2175913c5 2008-10-17 Michael Snyder <msnyder@vmware.com>
Target interface for reverse debugging.
	* target.h (enum target_waitkind):
	Add new wait event, TARGET_WAITKIND_NO_HISTORY.
	(struct target_ops): New method to_can_execute_reverse.
	(target_can_execute_reverse): New macro.
	* target.c (update_current_target): Inherit to_can_execute_reverse.

	Remote interface for reverse debugging.
	* remote.c (remote_can_execute_reverse): New target method.
	(remote_resume): Check for reverse exec direction, and send
	appropriate command to target.
	(remote_wait_as): Check target response for NO_HISTORY status.
	Also check for empty reply (target doesn't understand "bs" or "bc).
	(remote_vcont_resume): Jump out if attempting reverse execution.

	Event handling interface for reverse debugging.
	* infrun.c (execution_direction): New state variable.
	(enum inferior_stop_reason): Add NO_HISTORY reason.
	(handle_inferior_event): Handle TARGET_WAITKIND_NO_HISTORY.
	Handle stepping over a function call in reverse.
	Handle stepping thru a line range in reverse.
	Handle setting a step-resume breakpoint in reverse.
	Handle stepping into a function in reverse.
	Handle stepping between line ranges in reverse.
	(print_stop_reason): Print reason for NO_HISTORY.
	(step_into_function): Rename to handle_step_into_function.
	(handle_step_into_function_backward): New function.
	(set_exec_direction_func, show_exec_direction_func): New funcs.
	(proceed): No need to singlestep over a breakpoint
	when resuming in reverse.

	* inferior.h (enum exec_direction_kind): New enum.
	(execution_direction): Export new execution state variable.

	* breakpoint.c (make_breakpoint_silent): New function.
	* breakpoint.h (make_breakpoint_silent): Export.
	* infcmd.c (finish_command): Check for reverse exec direction.
	(finish_backward): New function, handle finish cmd in reverse.

	User interface for reverse execution.
	* Makefile.in (reverse.c): New file.
	* reverse.c: New file.  User interface for reverse execution.
2008-10-17 19:43:47 +00:00
Joel Brobecker ce78b96d4f * breakpoint.h (enum bptype): New enum bp_catchpoint.
Delete bp_catch_fork and bp_catch_vfork.
        (struct breakpoint_ops): Add new methods "insert", "remove"
        and "breakpoint_hit".
        * breakpoint.c (create_fork_vfork_event_catchpoint)
        (create_fork_event_catchpoint, create_vfork_event_catchpoint): Remove.
        (insert_catchpoint): Remove handling of bp_catch_fork and
        bp_catch_vfork catchpoints, and handle them as bp_catchpoint
        catchpoints instead.
        (insert_bp_location, update_breakpoints_after_exec)
        (remove_breakpoint, bpstat_check_location, bpstat_what)
        (allocate_bp_location): Likewise.
        (print_it_typical, print_one_breakpoint_location, mention): Remove
        handling of bp_catch_fork and bp_catch_vfork breakpoints.
        (ep_is_catchpoint, user_settable_breakpoint)
        (breakpoint_address_is_meaningful, adjust_breakpoint_address)
        (breakpoint_re_set_one, disable_command, enable_command):
        Remove use of bp_catch_fork and bp_catch_vfork.  Add handling of
        bp_catchpoint breakpoints.
        (insert_catch_fork, remove_catch_fork, breakpoint_hit_catch_fork)
        (print_it_catch_fork, print_one_catch_fork, print_mention_catch_fork):
        New functions.
        (catch_fork_breakpoint_ops): New static constant.
        (insert_catch_vfork, remove_catch_vfork, breakpoint_hit_catch_vfork)
        (print_it_catch_vfork, print_one_catch_vfork)
        (print_mention_catch_vfork): New functions.
        (catch_vfork_breakpoint_ops): New static constant.
        (create_catchpoint, create_fork_vfork_event_catchpoint): New functions.
        (catch_fork_command_1): Use create_fork_vfork_event_catchpoint
        to create the fork and vfork catchpoints.
        (gnu_v3_exception_catchpoint_ops): Set new breakpoint_ops fields.
        * ada-lang.c (catch_exception_breakpoint_ops): Set new breakpoint_ops
        fields.
        (catch_exception_unhandled_breakpoint_ops): Likewise.
        (catch_assert_breakpoint_ops): Likewise.
2008-10-16 16:25:04 +00:00
Pedro Alves 1c5cfe8615 gdb/
*	breakpoint.c (breakpoint_init_inferior): Clean up the moribund
	locations list.
	(moribund_breakpoint_here_p): Record the moribund
	location in the moribund_locations vector.
	* breakpoint.h (moribund_breakpoint_here_p): Declare.
	(displaced_step_fixup): Check if the breakpoint the thread was
	trying to step over has been removed since having been placed in
	the displaced stepping queue.
	(adjust_pc_after_break): In non-stop mode, check for a moribund
	breakpoint at the stop pc.
	(handle_inferior_event): Don't retire moribund breakpoints on
	TARGET_WAITKIND_IGNORE.

gdb/testsuite/
	* gdb.mi/mi-nsmoribund.exp, gdb.mi/nsmoribund.c: New test.
2008-10-15 19:15:34 +00:00
Pedro Alves 63c715c603 Remove dead code.
* breakpoint.c (show_breakpoint_hit_counts): Delete.
	(print_one_breakpoint_location): Adjust.
	(breakpoint_clear_ignore_counts): Delete.
	* breakpoint.h (breakpoint_clear_ignore_counts): Remove
	declaration.
	* target.c (generic_mourn_inferior): Don't clear ignore
	counts (never reached).
2008-10-14 20:49:02 +00:00
Pedro Alves 6ca15a4b21 * infrun.c (follow_exec): Don't do a generic mourn. Instead
inline the required bits.
	* breakpoint.h (enum inf_context): Add inf_execd.
2008-09-22 15:26:53 +00:00
Pedro Alves 347bddb745 * inferior.h (stop_bpstat): Delete.
* breakpoint.h (bpstat_do_actions): Remove bpstat* argument.

	* breakpoint.c (bpstat_do_actions): Rename to ...
	(bpstat_do_actions_1): ... this.  Make static.  Change return type
	to int.  Return true if a breakpoint proceeded.
	(bpstat_do_actions): New, as wrapper around bpstat_do_actions_1.
	(delete_breakpoint): Don't reference the global stop_bpstat; it's
	gone.

	* gdbthread.h (struct thread_info): Add stop_bpstat.
	(save_infrun_state, load_infrun_state): Remove stop_bpstat
	argument.
	* thread.c (load_infrun_state, save_infrun_state): Remove
	stop_bpstat argument, and the code referencing it.

	* infcall.c: Include "gdbthread.h".
	(call_function_by_hand): Adjust.
	* exceptions.c: Include "gdbthread.h".
	(throw_exception): Adjust.
	* infcmd.c (stop_bpstat): Delete.
	(continue_command): In all-stop, set the ignore count on the
	thread that reported the stop.  In non-stop, set it on the current
	thread.
	(finish_command_continuation): Adjust.
	(program_info): Adjust.
	* infrun.c (clear_proceed_status): Adjust.
	(context_switch): Don't context-switch stop_bpstat.
	(handle_inferior_event): Adjust.
	(normal_stop): Adjust.
	(save_inferior_status, restore_inferior_status): Adjust.

	* inf-loop.c (inferior_event_handler): Remove parameter to
	bpstat_do_actions call.
	* top.c (command_loop): Remove parameter to bpstat_do_actions
	call.  Call it unconditionally.
	* event-top.c (command_handler): Ditto.
	* python/python.c (execute_gdb_command): Ditto.
2008-09-08 21:46:21 +00:00
Ulrich Weigand 714835d5a6 * breakpoint.h (struct bp_location): Change type of section
member to "struct obj_section *".
	* tracepoint.h (struct tracepoint): Likewise.
	* symtab.h (struct general_symbol_info): Replace bfd_section
	member with obj_section.
	(struct symtab_and_line): Change type of section member to
	"struct obj_section *".
	(SYMBOL_BFD_SECTION): Remove macro, replace by ...
	(SYMBOL_OBJ_SECTION): ... this.

	* minsym.c (prim_record_minimal_symbol_and_info): Record symbol
	section as obj_section instead of bfd_section.

	* ada-lang.c (ada_decode_symbol): Use gsymbol->obj_section
	directly instead of looking of obj_section from bfd_section.

	* objfiles.h (find_pc_sect_section): Remove.
	* objfiles.c (find_pc_sect_section): Remove.
	(find_pc_section): Inline find_pc_sect_section code.

	* symfile.h (find_pc_overlay): Return struct obj_section *.
	(find_pc_mapped_section): Likewise.
	(section_is_overlay, section_is_mapped): Change type of section
	argument to struct obj_section *.
	(pc_in_mapped_range, pc_in_unmapped_range): Likewise.
	(overlay_mapped_address, overlay_unmapped_address): Likewise.
	(symbol_overlayed_address): Likewise.
	* symtab.h (symbol_overlayed_address): Likewise.
	* symfile.c (overlay_is_mapped): Remove.
	(section_is_mapped): Inline overlay_is_mapped code.  Update.
	(overlay_invalidate_all): Update.
	(section_is_overlay): Change section argument to type
	"struct obj_section *".  Use bfd_ methods.
	(pc_in_unmapped_range): Likewise.  Handle relocated sections.
	(pc_in_mapped_range): Likewise.  Handle relocated sections.
	(sections_overlap): Likewise.
	(overlay_unmapped_address): Likewise.
	(overlay_mapped_address): Likewise.
	(symbol_overlayed_address): Likewise.
	(find_pc_overlay): Return struct obj_section *.
	(find_pc_mapped_section): Likewise.
	(list_overlays_command): Update.
	(map_overlay_command, unmap_overlay_command): Update.
	(simple_overlay_update): Update.

	* block.h (blockvector_for_pc_sect): Change section argument
	to type "struct obj_section *".
	(block_for_pc_sect): Likewise.
	* block.c (blockvector_for_pc_sect): Change section argument
	to type "struct obj_section *".
	(block_for_pc_sect): Likewise.
	* symtab.h (find_pc_sect_function, find_pc_sect_psymtab,
	find_pc_sect_symtab, find_pc_sect_psymbol, find_pc_sect_line,
	lookup_minimal_symbol_by_pc_section, find_function_start_pc): Likewise.
	(matching_bfd_sections): Rename to ...
	(matching_obj_sections): ... this.  Update argument types.
	* blockframe.c (find_pc_sect_function): Likewise.
	* breakpoint.c (describe_other_breakpoints): Likewise.
	(breakpoint_has_pc, check_duplicates_for): Likewise.
	* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Likewise.
	(lookup_minimal_symbol_by_pc_section): Likewise.
	* symtab.c (find_pc_sect_psymtab_closer): Likewise.
	(find_pc_sect_psymtab, find_pc_sect_psymbol, find_pc_sect_symtab,
	find_pc_sect_line, find_function_start_pc): Likewise.
	(matching_bfd_sections): Rename to ...
	(matching_obj_sections): ... this.  Update argument types.

	* blockframe.c (find_pc_partial_function): Update to section
	type changes.  No longer call find_pc_sect_section.
	(cache_pc_function_section): Change to type "struct obj_section *".
	* breakpoint.c (resolve_sal_pc): Update to section type changes.
	* exec.c (xfer_memory): Likewise.
	* findvar.c (read_var_value): Likewise.
	* infcmd.c (jump_command): Likewise.
	* linespec.c (minsym_found): Likewise.
	* maint.c (maintenance_translate_address): Likewise.
	* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Likewise.
	(lookup_solib_trampoline_symbol_by_pc): Likewise.
	* parse.c (write_exp_msymbol): Likewise.
	* printcmd.c (build_address_symbolic): Likewise.
	(address_info, sym_info): Likewise.
	* symmisc.c (dump_msymbols, print_symbol): Likewise.
	* symtab.c (fixup_section): Likewise.
	(fixup_symbol_section, fixup_psymbol_section): Likewise.
	(find_pc_line, find_function_start_sal): Likewise.
	* target.c (memory_xfer_partial): Likewise.
	* hppa-hpux-tdep.c (hppa64_hpux_in_solib_call_trampoline): Likewise.
	* spu-tdep.c (spu_overlay_update): Likewise.
2008-09-05 11:37:18 +00:00
Tom Tromey 383f836e20 gdb:
* tui/tui-hooks.c: Include observer.h.
	(tui_event_default, tui_old_event_hooks, tui_event_hooks):
	Remove.
	(tui_bp_created_observer, tui_bp_deleted_observer,
	tui_bp_modified_observer): New globals.
	(tui_install_hooks): Use observers, not events.
	(tui_remove_hooks): Likewise.
	* mi/mi-cmd-break.c: Include observer.h, not gdb-events.h.
	(mi_breakpoint_observers_installed, mi_can_breakpoint_notify): New
	globals.
	(breakpoint_notify): Check mi_can_breakpoint_notify.
	(breakpoint_hooks): Remove.
	(mi_cmd_break_insert): Attach observers.  Don't use events.
	* tracepoint.c: Include observer.h, not gdb-events.h.
	(tracepoint_operation, trace_pass_command): Notify observer.
	* interps.c: Don't include gdb-events.h.
	(clear_interpreter_hooks): Don't call clear_gdb_event_hooks.
	* gdbarch.c: Rebuild.
	* gdbarch.sh: Emit include for observer.h, not gdb-events.h.
	(deprecated_current_gdbarch_select_hack): Notify observer.
	* breakpoint.h: Don't include gdb-events.h.
	* breakpoint.c: Don't include gdb-events.h.
	(condition_command): Notify observer.
	(commands_command): Likewise.
	(commands_from_control_command): Likewise.
	(mention, delete_breakpoint, set_ignore_count): Likewise.
	(disable_breakpoint, do_enable_breakpoint): Likewise.
	* Makefile.in (gdb_events_h): Remove.
	(breakpoint_h): Update.
	(COMMON_OBS): Remove gdb-events.o.
	(gdb-events.o): Remove.
	(breakpoint.o, gdbarch.o, interps.o, tracepoint.o, gdbtk-bp.o,
	gdbtk-hooks.o, mi-cmd-break.o, tui-hooks.o): Update.
	* gdb-events.c: Remove.
	* gdb-events.h: Remove.
	* gdb-events.sh: Remove.
gdb/doc:
	* observer.texi (GDB Observers): Document new observers:
	breakpoint_created, breakpoint_deleted, breakpoint_modified,
	tracepoint_created, tracepoint_deleted, tracepoint_modified,
	architecture_changed.
gdb/gdbtk:
	* generic/gdbtk-hooks.c: Include observer.h, not gdb-events.h.
	(gdbtk_add_hooks): Use observers, not events.
	(gdbtk_architecture_changed): Add argument, for observer.
	* generic/gdbtk-bp.c: Include observer.h.
	(gdb_set_bp): Notify observer.
	(gdb_set_bp_addr): Likewise.
2008-07-25 16:12:03 +00:00
Pedro Alves 3a3e9ee36f Adjust fork/vfork/exec to pass ptids around.
* target.h (struct target_waitstatus): Store related_pid as a ptid.
	(inferior_has_forked, inferior_has_vforked, inferior_has_execd):
	Take a ptid_t.
	* breakpoint.h (struct breakpoint): Change forked_inferior_pid
	type to ptid.
	* breakpoint.c (print_it_typical, bpstat_check_location)
	(print_one_breakpoint_location, set_raw_breakpoint_without_location)
	(create_fork_vfork_event_catchpoint): Adjust.
	* infrun.c (fork_event): Change parent_pid and child_pid types to
	ptid.
	(follow_exec, inferior_has_forked, inferior_has_vforked)
	(inferior_has_execd): Take a ptid_t and don't trim it.
	* linux-thread-db.c (thread_db_wait): Don't trim the returned ptid.
	* linux-nat.c (linux_child_follow_fork): Adjust.
	* inf-ptrace.c (inf_ptrace_wait): Adjust.
	* inf-ttrace.c (inf_ttrace_wait): Adjust.
	* win32-nat.c (get_win32_debug_event): Don't set related_pid.
2008-07-09 22:23:05 +00:00
Pedro Alves 25b22b0a6f * breakpoint.c (mark_breakpoints_out): Make public.
(update_breakpoints_after_exec): Don't call mark_breakpoints_out
	here.  Update comment.
	* breakpoint.h (mark_breakpoints_out): Declare.

	* linux-nat.c (linux_handle_extended_wait): On
	TARGET_WAITKIND_EXECD, call mark_breakpoints_out.
	* inf-ttrace.c (inf_ttrace_wait): Likewise.
2008-07-08 10:59:57 +00:00
Vladimir Prus 20874c92f8 * breakpoint.c (moribund_locations): New.
(bpstat_stop_status): Process moribund locations.
        (update_global_location_list): Add removed
        locations to moribund_locations.
        (breakpoint_retire_moribund): New.
        * breakpoint.h (struct bp_location): New field
        events_till_retirement.
        (breakpoint_retire_moribund): Declare.
        * thread.c (thread_count): New.
        * infrun.c (handle_inferior_event): Call
        breakpoint_retire_moribund.
        * gdbthread.h (thread_count): Declare.
2008-06-28 09:42:15 +00:00