Lines Matching defs:query
130 static void vpr_info_dq(const struct ddebug_query *query, const char *msg)
135 if (query->format) {
136 fmtlen = strlen(query->format);
137 while (fmtlen && query->format[fmtlen - 1] == '\n')
143 query->function ?: "",
144 query->filename ?: "",
145 query->module ?: "",
146 fmtlen, query->format ?: "",
147 query->first_lineno, query->last_lineno, query->class_string);
169 * Search the tables for _ddebug's which match the given `query' and
174 static int ddebug_change(const struct ddebug_query *query,
190 if (query->module &&
191 !match_wildcard(query->module, dt->mod_name))
194 if (query->class_string) {
195 map = ddebug_find_valid_class(dt, query->class_string, &valid_class);
199 /* constrain query, do not touch class'd callsites */
206 /* match site against query-class */
211 if (query->filename &&
212 !match_wildcard(query->filename, dp->filename) &&
213 !match_wildcard(query->filename,
215 !match_wildcard(query->filename,
220 if (query->function &&
221 !match_wildcard(query->function, dp->function))
225 if (query->format) {
226 if (*query->format == '^') {
229 p = strstr(dp->format, query->format+1);
232 } else if (!strstr(dp->format, query->format))
237 if (query->first_lineno &&
238 dp->lineno < query->first_lineno)
240 if (query->last_lineno &&
241 dp->lineno > query->last_lineno)
268 pr_info("no matches for query\n");
349 static int parse_linerange(struct ddebug_query *query, const char *first)
353 if (query->first_lineno || query->last_lineno) {
359 if (parse_lineno(first, &query->first_lineno) < 0)
363 if (parse_lineno(last, &query->last_lineno) < 0)
367 if (query->last_lineno == 0)
368 query->last_lineno = UINT_MAX;
370 if (query->last_lineno < query->first_lineno) {
372 query->last_lineno,
373 query->first_lineno);
377 query->last_lineno = query->first_lineno;
379 v3pr_info("parsed line %d-%d\n", query->first_lineno,
380 query->last_lineno);
398 * Parse words[] as a ddebug query specification, which is a series
413 struct ddebug_query *query, const char *modname)
430 rc = check_set(&query->function, arg, "func");
432 if (check_set(&query->filename, arg, "file"))
436 fline = strchr(query->filename, ':');
442 if (check_set(&query->function, fline, "func"))
445 if (parse_linerange(query, fline))
449 rc = check_set(&query->module, arg, "module");
454 rc = check_set(&query->format, arg, "format");
456 if (parse_linerange(query, arg))
459 rc = check_set(&query->class_string, arg, "class");
467 if (!query->module && modname)
470 * not given in the query itself
472 query->module = modname;
474 vpr_info_dq(query, "parsed");
536 struct ddebug_query query = {};
546 /* check flags 1st (last arg) so query is pairs of spec,val */
551 if (ddebug_parse_query(words, nwords-1, &query, modname)) {
552 pr_err("query parse failed\n");
556 nfound = ddebug_change(&query, &modifiers);
557 vpr_info_dq(&query, nfound ? "applied" : "no-match");
562 /* handle multiple queries in query string, continue on error, return
564 in param (for boot arg) or perhaps in query string.
566 static int ddebug_exec_queries(char *query, const char *modname)
571 for (i = 0; query; query = split) {
572 split = strpbrk(query, ";\n");
576 query = skip_spaces(query);
577 if (!query || !*query || *query == '#')
580 vpr_info("query %d: \"%s\" mod:%s\n", i, query, modname ?: "*");
582 rc = ddebug_exec_query(query, modname);
605 char query[QUERY_SIZE];
616 snprintf(query, QUERY_SIZE, "class %s %c%s", map->class_names[bi],
619 ct = ddebug_exec_queries(query, NULL);
1287 return 0; /* query failure shouldn't stop module load */