+2015-05-12 Don Breazeal <donb@codesourcery.com>
+
+ * nat/linux-ptrace.c (linux_check_ptrace_features): Change
+ from static to extern.
+ * nat/linux-ptrace.h (linux_check_ptrace_features): Declare.
+ * remote.c (anonymous enum): <PACKET_fork_event_feature,
+ * PACKET_vfork_event_feature>: New enumeration constants.
+ (remote_protocol_features): Add table entries for new packets.
+ (remote_query_supported): Add new feature queries to qSupported
+ packet.
+
2015-05-12 Gary Benson <gbenson@redhat.com>
* remote.c (remote_add_inferior): Call exec_file_locate_attach
+2015-05-12 Don Breazeal <donb@codesourcery.com>
+
+ * linux-low.c (linux_supports_fork_events): New function.
+ (linux_supports_vfork_events): New function.
+ (linux_target_ops): Initialize new structure members.
+ (initialize_low): Call linux_check_ptrace_features.
+ * lynx-low.c (lynx_target_ops): Initialize new structure
+ members.
+ * server.c (report_fork_events, report_vfork_events):
+ New global flags.
+ (handle_query): Add new features to qSupported packet and
+ response.
+ (captured_main): Initialize new global variables.
+ * target.h (struct target_ops) <supports_fork_events>:
+ New member.
+ <supports_vfork_events>: New member.
+ (target_supports_fork_events): New macro.
+ (target_supports_vfork_events): New macro.
+ * win32-low.c (win32_target_ops): Initialize new structure
+ members.
+
2015-05-12 Gary Benson <gbenson@redhat.com>
* server.c (handle_qxfer_exec_file): Use current process
return 1;
}
+/* Check if fork events are supported. */
+
+static int
+linux_supports_fork_events (void)
+{
+ return linux_supports_tracefork ();
+}
+
+/* Check if vfork events are supported. */
+
+static int
+linux_supports_vfork_events (void)
+{
+ return linux_supports_tracefork ();
+}
+
static int
linux_supports_disable_randomization (void)
{
linux_async,
linux_start_non_stop,
linux_supports_multi_process,
+ linux_supports_fork_events,
+ linux_supports_vfork_events,
#ifdef USE_THREAD_DB
thread_db_handle_monitor_command,
#else
sigaction (SIGCHLD, &sigchld_action, NULL);
initialize_low_arch ();
+
+ linux_check_ptrace_features ();
}
NULL, /* async */
NULL, /* start_non_stop */
NULL, /* supports_multi_process */
+ NULL, /* supports_fork_events */
+ NULL, /* supports_vfork_events */
NULL, /* handle_monitor_command */
};
int run_once;
int multi_process;
+int report_fork_events;
+int report_vfork_events;
int non_stop;
int swbreak_feature;
int hwbreak_feature;
if (target_supports_stopped_by_hw_breakpoint ())
hwbreak_feature = 1;
}
+ else if (strcmp (p, "fork-events+") == 0)
+ {
+ /* GDB supports and wants fork events if possible. */
+ if (target_supports_fork_events ())
+ report_fork_events = 1;
+ }
+ else if (strcmp (p, "vfork-events+") == 0)
+ {
+ /* GDB supports and wants vfork events if possible. */
+ if (target_supports_vfork_events ())
+ report_vfork_events = 1;
+ }
else
target_process_qsupported (p);
if (target_supports_multi_process ())
strcat (own_buf, ";multiprocess+");
+ if (target_supports_fork_events ())
+ strcat (own_buf, ";fork-events+");
+
+ if (target_supports_vfork_events ())
+ strcat (own_buf, ";vfork-events+");
+
if (target_supports_non_stop ())
strcat (own_buf, ";QNonStop+");
noack_mode = 0;
multi_process = 0;
+ report_fork_events = 0;
+ report_vfork_events = 0;
/* Be sure we're out of tfind mode. */
current_traceframe = -1;
cont_thread = null_ptid;
/* Returns true if the target supports multi-process debugging. */
int (*supports_multi_process) (void);
+ /* Returns true if fork events are supported. */
+ int (*supports_fork_events) (void);
+
+ /* Returns true if vfork events are supported. */
+ int (*supports_vfork_events) (void);
+
/* If not NULL, target-specific routine to process monitor command.
Returns 1 if handled, or 0 to perform default processing. */
int (*handle_monitor_command) (char *);
int kill_inferior (int);
+#define target_supports_fork_events() \
+ (the_target->supports_fork_events ? \
+ (*the_target->supports_fork_events) () : 0)
+
+#define target_supports_vfork_events() \
+ (the_target->supports_vfork_events ? \
+ (*the_target->supports_vfork_events) () : 0)
+
#define detach_inferior(pid) \
(*the_target->detach) (pid)
NULL, /* async */
NULL, /* start_non_stop */
NULL, /* supports_multi_process */
+ NULL, /* supports_fork_events */
+ NULL, /* supports_vfork_events */
NULL, /* handle_monitor_command */
NULL, /* core_of_thread */
NULL, /* read_loadmap */
/* Determine ptrace features available on this target. */
-static void
+void
linux_check_ptrace_features (void)
{
int child_pid, ret, status;
extern char *linux_ptrace_attach_fail_reason_string (ptid_t ptid, int err);
extern void linux_ptrace_init_warnings (void);
+extern void linux_check_ptrace_features (void);
extern void linux_enable_event_reporting (pid_t pid, int attached);
extern void linux_disable_event_reporting (pid_t pid);
extern int linux_supports_tracefork (void);
/* Support for hwbreak+ feature. */
PACKET_hwbreak_feature,
+ /* Support for fork events. */
+ PACKET_fork_event_feature,
+
+ /* Support for vfork events. */
+ PACKET_vfork_event_feature,
+
PACKET_MAX
};
PACKET_Qbtrace_conf_bts_size },
{ "swbreak", PACKET_DISABLE, remote_supported_packet, PACKET_swbreak_feature },
{ "hwbreak", PACKET_DISABLE, remote_supported_packet, PACKET_hwbreak_feature },
+ { "fork-events", PACKET_DISABLE, remote_supported_packet,
+ PACKET_fork_event_feature },
+ { "vfork-events", PACKET_DISABLE, remote_supported_packet,
+ PACKET_vfork_event_feature },
};
static char *remote_support_xml;
q = remote_query_supported_append (q, "qRelocInsn+");
+ if (rs->extended)
+ {
+ if (packet_set_cmd_state (PACKET_fork_event_feature)
+ != AUTO_BOOLEAN_FALSE)
+ q = remote_query_supported_append (q, "fork-events+");
+ if (packet_set_cmd_state (PACKET_vfork_event_feature)
+ != AUTO_BOOLEAN_FALSE)
+ q = remote_query_supported_append (q, "vfork-events+");
+ }
+
q = reconcat (q, "qSupported:", q, (char *) NULL);
putpkt (q);
add_packet_config_cmd (&remote_protocol_packets[PACKET_hwbreak_feature],
"hwbreak-feature", "hwbreak-feature", 0);
+ add_packet_config_cmd (&remote_protocol_packets[PACKET_fork_event_feature],
+ "fork-event-feature", "fork-event-feature", 0);
+
+ add_packet_config_cmd (&remote_protocol_packets[PACKET_vfork_event_feature],
+ "vfork-event-feature", "vfork-event-feature", 0);
+
/* Assert that we've registered "set remote foo-packet" commands
for all packet configs. */
{