@@ -51,6 +51,9 @@ void tracecmd_record_ref(struct tep_record *record);
void tracecmd_set_debug(bool set_debug);
bool tracecmd_get_debug(void);
+void tracecmd_set_notimeout(bool set_notimeout);
+bool tracecmd_get_notimeout(void);
+
bool tracecmd_is_version_supported(unsigned int version);
int tracecmd_default_file_version(void);
@@ -461,7 +461,7 @@ static int tracecmd_msg_recv_wait(int fd, struct tracecmd_msg *msg)
pfd.fd = fd;
pfd.events = POLLIN;
- ret = poll(&pfd, 1, tracecmd_get_debug() ? -1 : msg_wait_to);
+ ret = poll(&pfd, 1, tracecmd_get_notimeout() ? -1 : msg_wait_to);
if (ret < 0)
return -errno;
else if (ret == 0)
@@ -30,6 +30,7 @@
#define PROC_STACK_FILE "/proc/sys/kernel/stack_tracer_enabled"
static bool debug;
+static bool notimeout;
static int log_level = TEP_LOG_INFO;
static FILE *logfp;
@@ -110,6 +111,30 @@ bool tracecmd_get_debug(void)
return debug;
}
+/**
+ * tracecmd_set_notimeout - Do not timeout waiting for responses
+ * @set_notimeout: True or false to set notimeout mode.
+ *
+ * If @set_notimeout is true, then the library will not fail waiting for
+ * responses. This is useful when running the code under gdb.
+ * Note, if debug is set, then this makes no difference as it will always
+ * not timeout.
+ */
+void tracecmd_set_notimeout(bool set_notimeout)
+{
+ notimeout = set_notimeout;
+}
+
+/**
+ * tracecmd_get_notimeout - Get setting of notimeout of tracecmd library
+ * Returns true, if the tracecmd library has notimeout set.
+ *
+ */
+bool tracecmd_get_notimeout(void)
+{
+ return notimeout || debug;
+}
+
void tracecmd_parse_cmdlines(struct tep_handle *pevent,
char *file, int size __maybe_unused)
{
@@ -391,7 +391,8 @@ busy:
enum {
OPT_verbose = 254,
- DO_DEBUG = 255
+ OPT_debug = 255,
+ OPT_notimeout = 256,
};
void trace_agent(int argc, char **argv)
@@ -413,7 +414,8 @@ void trace_agent(int argc, char **argv)
static struct option long_options[] = {
{"port", required_argument, NULL, 'p'},
{"help", no_argument, NULL, '?'},
- {"debug", no_argument, NULL, DO_DEBUG},
+ {"debug", no_argument, NULL, OPT_debug},
+ {"notimeout", no_argument, NULL, OPT_notimeout},
{"verbose", optional_argument, NULL, OPT_verbose},
{NULL, 0, NULL, 0}
};
@@ -445,9 +447,12 @@ void trace_agent(int argc, char **argv)
die("Failed to allocate guest instance");
break;
- case DO_DEBUG:
+ case OPT_debug:
tracecmd_set_debug(true);
break;
+ case OPT_notimeout:
+ tracecmd_set_notimeout(true);
+ break;
case OPT_verbose:
if (trace_set_verbose(optarg) < 0)
die("invalid verbose level %s", optarg);
@@ -5738,7 +5738,8 @@ enum {
OPT_poll = 259,
OPT_name = 260,
OPT_proxy = 261,
- OPT_temp = 262
+ OPT_temp = 262,
+ OPT_notimeout = 264,
};
void trace_stop(int argc, char **argv)
@@ -6149,6 +6150,7 @@ static void parse_record_options(int argc,
{"cmdlines-size", required_argument, NULL, OPT_cmdlines_size},
{"no-filter", no_argument, NULL, OPT_no_filter},
{"debug", no_argument, NULL, OPT_debug},
+ {"notimeout", no_argument, NULL, OPT_notimeout},
{"quiet", no_argument, NULL, OPT_quiet},
{"help", no_argument, NULL, '?'},
{"proc-map", no_argument, NULL, OPT_procmap},
@@ -6617,6 +6619,9 @@ static void parse_record_options(int argc,
case OPT_debug:
tracecmd_set_debug(true);
break;
+ case OPT_notimeout:
+ tracecmd_set_notimeout(true);
+ break;
case OPT_module:
check_instance_die(ctx->instance, "--module");
if (ctx->instance->filter_mod)