Skip to content

Commit 952e934

Browse files
committed
Revert "dyndbg: accept query terms like file=bar and module=foo"
This reverts commit 14775b0 as there were still some parsing problems with it, and the follow-on patch for it. Let's revisit it later, just drop it for now. Cc: <jbaron@akamai.com> Cc: Jim Cromie <jim.cromie@gmail.com> Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Fixes: 14775b0 ("dyndbg: accept query terms like file=bar and module=foo") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7f6e1f3 commit 952e934

File tree

2 files changed

+20
-34
lines changed

2 files changed

+20
-34
lines changed

Documentation/admin-guide/dynamic-debug-howto.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ against. Possible keywords are:::
156156
``line-range`` cannot contain space, e.g.
157157
"1-30" is valid range but "1 - 30" is not.
158158

159-
``module=foo`` combined keyword=value form is interchangably accepted
160159

161160
The meanings of each keyword are:
162161

lib/dynamic_debug.c

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,7 @@ static int check_set(const char **dest, char *src, char *name)
353353

354354
/*
355355
* Parse words[] as a ddebug query specification, which is a series
356-
* of (keyword, value) pairs or combined keyword=value terms,
357-
* chosen from these possibilities:
356+
* of (keyword, value) pairs chosen from these possibilities:
358357
*
359358
* func <function-name>
360359
* file <full-pathname>
@@ -373,34 +372,22 @@ static int ddebug_parse_query(char *words[], int nwords,
373372
unsigned int i;
374373
int rc = 0;
375374
char *fline;
376-
char *keyword, *arg;
375+
376+
/* check we have an even number of words */
377+
if (nwords % 2 != 0) {
378+
pr_err("expecting pairs of match-spec <value>\n");
379+
return -EINVAL;
380+
}
377381

378382
if (modname)
379383
/* support $modname.dyndbg=<multiple queries> */
380384
query->module = modname;
381385

382-
for (i = 0; i < nwords; i++) {
383-
/* accept keyword=arg */
384-
vpr_info("%d w:%s\n", i, words[i]);
385-
386-
keyword = words[i];
387-
arg = strchr(keyword, '=');
388-
if (arg) {
389-
*arg++ = '\0';
390-
} else {
391-
i++; /* next word is arg */
392-
if (!(i < nwords)) {
393-
pr_err("missing arg to keyword: %s\n", keyword);
394-
return -EINVAL;
395-
}
396-
arg = words[i];
397-
}
398-
vpr_info("%d key:%s arg:%s\n", i, keyword, arg);
399-
400-
if (!strcmp(keyword, "func")) {
401-
rc = check_set(&query->function, arg, "func");
402-
} else if (!strcmp(keyword, "file")) {
403-
if (check_set(&query->filename, arg, "file"))
386+
for (i = 0; i < nwords; i += 2) {
387+
if (!strcmp(words[i], "func")) {
388+
rc = check_set(&query->function, words[i+1], "func");
389+
} else if (!strcmp(words[i], "file")) {
390+
if (check_set(&query->filename, words[i+1], "file"))
404391
return -EINVAL;
405392

406393
/* tail :$info is function or line-range */
@@ -416,18 +403,18 @@ static int ddebug_parse_query(char *words[], int nwords,
416403
if (parse_linerange(query, fline))
417404
return -EINVAL;
418405
}
419-
} else if (!strcmp(keyword, "module")) {
420-
rc = check_set(&query->module, arg, "module");
421-
} else if (!strcmp(keyword, "format")) {
422-
string_unescape_inplace(arg, UNESCAPE_SPACE |
406+
} else if (!strcmp(words[i], "module")) {
407+
rc = check_set(&query->module, words[i+1], "module");
408+
} else if (!strcmp(words[i], "format")) {
409+
string_unescape_inplace(words[i+1], UNESCAPE_SPACE |
423410
UNESCAPE_OCTAL |
424411
UNESCAPE_SPECIAL);
425-
rc = check_set(&query->format, arg, "format");
426-
} else if (!strcmp(keyword, "line")) {
427-
if (parse_linerange(query, arg))
412+
rc = check_set(&query->format, words[i+1], "format");
413+
} else if (!strcmp(words[i], "line")) {
414+
if (parse_linerange(query, words[i+1]))
428415
return -EINVAL;
429416
} else {
430-
pr_err("unknown keyword \"%s\"\n", keyword);
417+
pr_err("unknown keyword \"%s\"\n", words[i]);
431418
return -EINVAL;
432419
}
433420
if (rc)

0 commit comments

Comments
 (0)