All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libevl 1/2] tests: ptrace-sync: skip SOH and STX in pipe message
@ 2026-01-24 11:42 Junxiao Chang
  2026-01-23 13:22 ` Philippe Gerum
  2026-01-24 11:42 ` [PATCH libevl 2/2] tests: ptrace-sync: only integrate ptrace-sync in debug build Junxiao Chang
  0 siblings, 2 replies; 5+ messages in thread
From: Junxiao Chang @ 2026-01-24 11:42 UTC (permalink / raw)
  To: xenomai; +Cc: yuan1.wang, junxiao.chang

Sometimes there might be SOH(Start of Heading) or STX(Start of
Text) in be beginning of message. It needs to be skipped, or else
regex function might return wrong result.

This issue could be reproduced with gdb 15.0.50 in ubuntu 24.04.

Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
---
 tests/ptrace-sync.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/ptrace-sync.c b/tests/ptrace-sync.c
index ec6fbb3..68ce353 100644
--- a/tests/ptrace-sync.c
+++ b/tests/ptrace-sync.c
@@ -40,6 +40,8 @@
  */
 
 #define CONCURRENCY  2
+#define SOH          1
+#define STX          2
 
 static struct evl_sem handshake;
 static struct evl_event barrier;
@@ -153,6 +155,7 @@ static int consume_and_match(FILE *fp, const char *expect, bool verbose)
 	int ret = EXIT_FAILURE;
 	char buf[BUFSIZ], *p;
 	regex_t re;
+	size_t len;
 
 	if (verbose)
 		fprintf(stderr, "EXPECT {{ %s }}\n", expect);
@@ -166,8 +169,14 @@ static int consume_and_match(FILE *fp, const char *expect, bool verbose)
 		alarm(0);
 
 		if (p) {
+			len = strlen(p);
+			if (len > 1 && (p[0] == SOH || p[0] == STX)) {
+				/* Ignore SOH(start of header) or STX(start of Text */
+				p++;
+				len--;
+			}
 			if (verbose) {
-				fprintf(stderr, "<- {{ \"%.*s\" }}\n", (int)(strlen(p) - 1), p);
+				fprintf(stderr, "<- {{ \"%.*s\" }}\n", (int)(len - 1), p);
 				fflush(stderr);
 			}
 			if (!regexec(&re, p, 0, NULL, 0)) {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-26  0:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-24 11:42 [PATCH libevl 1/2] tests: ptrace-sync: skip SOH and STX in pipe message Junxiao Chang
2026-01-23 13:22 ` Philippe Gerum
2026-01-24 11:42 ` [PATCH libevl 2/2] tests: ptrace-sync: only integrate ptrace-sync in debug build Junxiao Chang
2026-01-23 13:28   ` Philippe Gerum
2026-01-26  0:15     ` Chang, Junxiao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.