Lines Matching refs:query
122 static void vpr_info_dq(const struct ddebug_query *query, const char *msg)
127 if (query->format) {
128 fmtlen = strlen(query->format);
129 while (fmtlen && query->format[fmtlen - 1] == '\n')
135 query->function ?: "",
136 query->filename ?: "",
137 query->module ?: "",
138 fmtlen, query->format ?: "",
139 query->first_lineno, query->last_lineno);
143 * Search the tables for _ddebug's which match the given `query' and
148 static int ddebug_change(const struct ddebug_query *query,
162 if (query->module &&
163 !match_wildcard(query->module, dt->mod_name))
170 if (query->filename &&
171 !match_wildcard(query->filename, dp->filename) &&
172 !match_wildcard(query->filename,
174 !match_wildcard(query->filename,
179 if (query->function &&
180 !match_wildcard(query->function, dp->function))
184 if (query->format) {
185 if (*query->format == '^') {
188 p = strstr(dp->format, query->format+1);
191 } else if (!strstr(dp->format, query->format))
196 if (query->first_lineno &&
197 dp->lineno < query->first_lineno)
199 if (query->last_lineno &&
200 dp->lineno > query->last_lineno)
226 pr_info("no matches for query\n");
311 static int parse_linerange(struct ddebug_query *query, const char *first)
315 if (query->first_lineno || query->last_lineno) {
321 if (parse_lineno(first, &query->first_lineno) < 0)
325 if (parse_lineno(last, &query->last_lineno) < 0)
329 if (query->last_lineno == 0)
330 query->last_lineno = UINT_MAX;
332 if (query->last_lineno < query->first_lineno) {
334 query->last_lineno,
335 query->first_lineno);
339 query->last_lineno = query->first_lineno;
341 vpr_info("parsed line %d-%d\n", query->first_lineno,
342 query->last_lineno);
360 * Parse words[] as a ddebug query specification, which is a series
375 struct ddebug_query *query, const char *modname)
392 rc = check_set(&query->function, arg, "func");
394 if (check_set(&query->filename, arg, "file"))
398 fline = strchr(query->filename, ':');
404 if (check_set(&query->function, fline, "func"))
407 if (parse_linerange(query, fline))
411 rc = check_set(&query->module, arg, "module");
416 rc = check_set(&query->format, arg, "format");
418 if (parse_linerange(query, arg))
427 if (!query->module && modname)
430 * not given in the query itself
432 query->module = modname;
434 vpr_info_dq(query, "parsed");
496 struct ddebug_query query = {};
506 /* check flags 1st (last arg) so query is pairs of spec,val */
511 if (ddebug_parse_query(words, nwords-1, &query, modname)) {
512 pr_err("query parse failed\n");
516 nfound = ddebug_change(&query, &modifiers);
517 vpr_info_dq(&query, nfound ? "applied" : "no-match");
522 /* handle multiple queries in query string, continue on error, return
524 in param (for boot arg) or perhaps in query string.
526 static int ddebug_exec_queries(char *query, const char *modname)
531 for (i = 0; query; query = split) {
532 split = strpbrk(query, ";\n");
536 query = skip_spaces(query);
537 if (!query || !*query || *query == '#')
540 vpr_info("query %d: \"%s\"\n", i, query);
542 rc = ddebug_exec_query(query, modname);
969 return 0; /* query failure shouldnt stop module load */