@@ -92,6 +92,9 @@ vFile:fstat:
HP/PA running HP-UX hppa*-*-hpux*
Itanium running HP-UX ia64-*-hpux*
+* The remote stub now reports support for fork and vfork events to GDB's
+qSupported query.
+
*** Changes in GDB 7.9
* GDB now supports hardware watchpoints on x86 GNU Hurd.
@@ -35806,6 +35806,18 @@ extensions unless the stub also reports that it supports them by
including @samp{multiprocess+} in its @samp{qSupported} reply.
@xref{multiprocess extensions}, for details.
+@item fork-events
+This feature indicates whether @value{GDBN} supports fork event
+extensions to the remote protocol. @value{GDBN} does not use such
+extensions unless the stub also reports that it supports them by
+including @samp{fork-events+} in its @samp{qSupported} reply.
+
+@item vfork-events
+This feature indicates whether @value{GDBN} supports vfork event
+extensions to the remote protocol. @value{GDBN} does not use such
+extensions unless the stub also reports that it supports them by
+including @samp{vfork-events+} in its @samp{qSupported} reply.
+
@item xmlRegisters
This feature indicates that @value{GDBN} supports the XML target
description. If the stub sees @samp{xmlRegisters=} with target
@@ -5255,6 +5255,22 @@ linux_supports_multi_process (void)
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)
{
@@ -6219,6 +6235,8 @@ static struct target_ops linux_target_ops = {
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
@@ -6295,4 +6313,7 @@ initialize_low (void)
sigaction (SIGCHLD, &sigchld_action, NULL);
initialize_low_arch ();
+
+ /* Enable extended ptrace events. */
+ linux_check_ptrace_features ();
}
@@ -758,6 +758,8 @@ static struct target_ops lynx_target_ops = {
NULL, /* async */
NULL, /* start_non_stop */
NULL, /* supports_multi_process */
+ NULL, /* supports_fork_events */
+ NULL, /* supports_vfork_events */
NULL, /* handle_monitor_command */
};
@@ -57,6 +57,8 @@ static int exit_requested;
int run_once;
int multi_process;
+int report_fork_events;
+int report_vfork_events;
int non_stop;
int swbreak_feature;
int hwbreak_feature;
@@ -1992,6 +1994,18 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
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);
@@ -2042,6 +2056,12 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_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+");
@@ -3390,6 +3410,8 @@ captured_main (int argc, char *argv[])
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;
@@ -277,6 +277,12 @@ struct target_ops
/* 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 *);
@@ -408,6 +414,14 @@ void set_target_ops (struct target_ops *);
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)
@@ -1827,6 +1827,8 @@ static struct target_ops win32_target_ops = {
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 */
@@ -337,7 +337,7 @@ static void linux_test_for_exitkill (int child_pid);
/* Determine ptrace features available on this target. */
-static void
+void
linux_check_ptrace_features (void)
{
int child_pid, ret, status;
@@ -149,6 +149,7 @@ extern void linux_ptrace_attach_fail_reason (pid_t pid, struct buffer *buffer);
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);
@@ -1350,6 +1350,12 @@ enum {
/* 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
};
@@ -4051,6 +4057,10 @@ static const struct protocol_feature remote_protocol_features[] = {
{ "hwbreak", PACKET_DISABLE, remote_supported_packet, PACKET_hwbreak_feature },
{ "vFile:fstat", PACKET_DISABLE, remote_supported_packet,
PACKET_vFile_fstat },
+ { "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;
@@ -4129,6 +4139,12 @@ remote_query_supported (void)
q = remote_query_supported_append (q, "qRelocInsn+");
+ if (rs->extended)
+ {
+ q = remote_query_supported_append (q, "fork-events+");
+ q = remote_query_supported_append (q, "vfork-events+");
+ }
+
q = reconcat (q, "qSupported:", q, (char *) NULL);
putpkt (q);
@@ -12508,7 +12524,8 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (&remote_protocol_packets[PACKET_hwbreak_feature],
"hwbreak-feature", "hwbreak-feature", 0);
- /* Assert that we've registered commands for all packet configs. */
+ /* Assert that we've registered "set remote foo-packet" commands
+ for all packet configs. */
{
int i;
@@ -12527,6 +12544,8 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
case PACKET_DisconnectedTracing_feature:
case PACKET_augmented_libraries_svr4_read_feature:
case PACKET_qCRC:
+ case PACKET_fork_event_feature:
+ case PACKET_vfork_event_feature:
/* Additions to this list need to be well justified:
pre-existing packets are OK; new packets are not. */
excepted = 1;