Skip to contentSkip to conversation

dyndbg: fix parsing file query without a line-range suffix

PATCH In review Shuo Chen 4 participants 4 messages Apr 14, 2021 – Apr 30, 2021

Subsystems (2)
lore
Share & tools
lore

Shuo Chen

author
#0 lore raw

PATCH 1/1 dyndbg: fix parsing file query without a line-range suffix

From: Shuo Chen <[email protected]>

Query like 'file tcp_input.c line 1234 +p' was broken by
commit aaebe329bff0 ("dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100'") because a file name without a ':' now makes the loop in ddebug_parse_query() exits early before parsing the 'line 1234' part. As a result, all pr_debug() in tcp_input.c will be enabled, instead of only the one on line 1234. Changing 'break' to 'continue' fixes this.

Fixes aaebe329bff0 ("dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100'")
---
 lib/dynamic_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dynamic_debug.c +1 -1
index c70d6347afa2..921d0a654243 100644
@@ -396,7 +396,7 @@ static int ddebug_parse_query(char *words[], int nwords,
 			/* tail :$info is function or line-range */
 			fline = strchr(query->filename, ':');
 			if (!fline)
-				break;
+				continue;
 			*fline++ = '\0';
 			if (isalpha(*fline) || *fline == '*' || *fline == '?') {
 				/* take as function name */
Signature · 1 line
2.31.1.295.g9ea45b61b8-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Shuo Chen

From: Shuo Chen <[email protected]>

Query like 'file tcp_input.c line 1234 +p' was broken by
commit aaebe329bff0 ("dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100'") because a file name without a ':' now makes the loop in ddebug_parse_query() exits early before parsing the 'line 1234' part. As a result, all pr_debug() in tcp_input.c will be enabled, instead of only the one on line 1234. Changing 'break' to 'continue' fixes this.

Fixes aaebe329bff0 ("dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100'")
---
 lib/dynamic_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dynamic_debug.c +0 -0
index c70d6347afa2..921d0a654243 100644

lib/dynamic_debug.c static int ddebug_parse_query(char *words[], int nwords, · line 402

Quoted 8 lines
lib/dynamic_debug.c +1 -1
@@ -396,7 +396,7 @@ static int ddebug_parse_query(char *words[], int nwords,
 			/* tail :$info is function or line-range */
 			fline = strchr(query->filename, ':');
 			if (!fline)
-				break;
+				continue;
 			*fline++ = '\0';
 			if (isalpha(*fline) || *fline == '*' || *fline == '?') {
 				/* take as function name */

SGTM, thanks !

maintainer
#2 lore raw
Quoted 35 lines · Eric Dumazet
Quoted 21 lines · Shuo Chen

From: Shuo Chen <[email protected]>

Query like 'file tcp_input.c line 1234 +p' was broken by
commit aaebe329bff0 ("dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100'") because a file name without a ':' now makes the loop in ddebug_parse_query() exits early before parsing the 'line 1234' part. As a result, all pr_debug() in tcp_input.c will be enabled, instead of only the one on line 1234. Changing 'break' to 'continue' fixes this.

Fixes aaebe329bff0 ("dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100'")
---
 lib/dynamic_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dynamic_debug.c +0 -0
index c70d6347afa2..921d0a654243 100644

lib/dynamic_debug.c static int ddebug_parse_query(char *words[], int nwords, · line 402

Quoted 8 lines
lib/dynamic_debug.c +1 -1
@@ -396,7 +396,7 @@ static int ddebug_parse_query(char *words[], int nwords,
 			/* tail :$info is function or line-range */
 			fline = strchr(query->filename, ':');
 			if (!fline)
-				break;
+				continue;
 			*fline++ = '\0';
 			if (isalpha(*fline) || *fline == '*' || *fline == '?') {
 				/* take as function name */

SGTM, thanks !

Quoted 2 lines

Hi Greg,

I acked this previously and is an important fix.
Can you please pick it up if you haven't done so?

Thanks!

-Jason

#3 lore raw
Quoted 38 lines · Jason Baron
Quoted 35 lines · Eric Dumazet
Quoted 21 lines · Shuo Chen

From: Shuo Chen <[email protected]>

Query like 'file tcp_input.c line 1234 +p' was broken by
commit aaebe329bff0 ("dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100'") because a file name without a ':' now makes the loop in ddebug_parse_query() exits early before parsing the 'line 1234' part. As a result, all pr_debug() in tcp_input.c will be enabled, instead of only the one on line 1234. Changing 'break' to 'continue' fixes this.

Fixes aaebe329bff0 ("dyndbg: accept 'file foo.c:func1' and 'file foo.c:10-100'")
---
 lib/dynamic_debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dynamic_debug.c +0 -0
index c70d6347afa2..921d0a654243 100644

lib/dynamic_debug.c static int ddebug_parse_query(char *words[], int nwords, · line 402

Quoted 8 lines
lib/dynamic_debug.c +1 -1
@@ -396,7 +396,7 @@ static int ddebug_parse_query(char *words[], int nwords,
 			/* tail :$info is function or line-range */
 			fline = strchr(query->filename, ':');
 			if (!fline)
-				break;
+				continue;
 			*fline++ = '\0';
 			if (isalpha(*fline) || *fline == '*' || *fline == '?') {
 				/* take as function name */

SGTM, thanks !

Quoted 7 lines
Quoted 2 lines

Hi Greg,

I acked this previously and is an important fix.
Can you please pick it up if you haven't done so?

Will do, sorry for the delay.

greg k-h