aboutsummaryrefslogtreecommitdiff
path: root/trace
diff options
context:
space:
mode:
Diffstat (limited to 'trace')
-rw-r--r--trace/simple.c19
-rw-r--r--trace/stderr.c17
2 files changed, 33 insertions, 3 deletions
diff --git a/trace/simple.c b/trace/simple.c
index b639dda806..6339152d27 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -324,14 +324,29 @@ void trace_print_events(FILE *stream, fprintf_function stream_printf)
bool trace_event_set_state(const char *name, bool state)
{
unsigned int i;
-
+ unsigned int len;
+ bool wildcard = false;
+ bool matched = false;
+
+ len = strlen(name);
+ if (len > 0 && name[len - 1] == '*') {
+ wildcard = true;
+ len -= 1;
+ }
for (i = 0; i < NR_TRACE_EVENTS; i++) {
+ if (wildcard) {
+ if (!strncmp(trace_list[i].tp_name, name, len)) {
+ trace_list[i].state = state;
+ matched = true;
+ }
+ continue;
+ }
if (!strcmp(trace_list[i].tp_name, name)) {
trace_list[i].state = state;
return true;
}
}
- return false;
+ return matched;
}
/* Helper function to create a thread with signals blocked. Use glib's
diff --git a/trace/stderr.c b/trace/stderr.c
index 7107c4a131..0810d6f956 100644
--- a/trace/stderr.c
+++ b/trace/stderr.c
@@ -15,14 +15,29 @@ void trace_print_events(FILE *stream, fprintf_function stream_printf)
bool trace_event_set_state(const char *name, bool state)
{
unsigned int i;
+ unsigned int len;
+ bool wildcard = false;
+ bool matched = false;
+ len = strlen(name);
+ if (len > 0 && name[len - 1] == '*') {
+ wildcard = true;
+ len -= 1;
+ }
for (i = 0; i < NR_TRACE_EVENTS; i++) {
+ if (wildcard) {
+ if (!strncmp(trace_list[i].tp_name, name, len)) {
+ trace_list[i].state = state;
+ matched = true;
+ }
+ continue;
+ }
if (!strcmp(trace_list[i].tp_name, name)) {
trace_list[i].state = state;
return true;
}
}
- return false;
+ return matched;
}
bool trace_backend_init(const char *events, const char *file)