Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [REPOST][PATCH] H8/300: sim: testsuite: Use the correct file descriptor for stdout
@ 2026-08-27  8:31 Jan Dubiec
  2026-09-03 16:59 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Dubiec @ 2026-08-27  8:31 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jan Dubiec, Andrew Burgess

This is obviously a typo, because the file descriptor for stdout is 1
on both Linux and Windows. As a result, the test cases returned nothing
on Windows, i.e. neither "pass" nor "fail".

It works on Linux, however, because file descriptors 0-2 usually all
refer to the same underlying device, which is opened for bidirectional
I/O. File descriptor 1 may be line- or block-buffered by libc, but once
the data is actually written to the kernel, it ultimately goes to the
same underlying bidirectional pseudo-terminal device.
---
 sim/testsuite/h8300/testutils.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sim/testsuite/h8300/testutils.inc b/sim/testsuite/h8300/testutils.inc
index 63d27d45c14..1e2c7c31c7b 100644
--- a/sim/testsuite/h8300/testutils.inc
+++ b/sim/testsuite/h8300/testutils.inc
@@ -85,7 +85,7 @@ _main:
 
 ; Output "pass\n"
 	.macro pass
-	mov.w	#0, r0		; fd == stdout
+	mov.w	#1, r0		; fd == stdout
 .if (sim_cpu == h8300)
 	mov.w	#pass_str, r1	; buf == "pass\n"
 	mov.w	#5, r2		; len == 5
@@ -98,7 +98,7 @@ _main:
 
 ; Output "fail\n"
 	.macro fail
-	mov.w	#0, r0		; fd == stdout
+	mov.w	#1, r0		; fd == stdout
 .if (sim_cpu == h8300)
 	mov.w	#fail_str, r1	; buf == "fail\n"
 	mov.w	#5, r2		; len == 5
-- 
2.55.0

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

* Re: [REPOST][PATCH] H8/300: sim: testsuite: Use the correct file descriptor for stdout
  2026-08-27  8:31 [REPOST][PATCH] H8/300: sim: testsuite: Use the correct file descriptor for stdout Jan Dubiec
@ 2026-09-03 16:59 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2026-09-03 16:59 UTC (permalink / raw)
  To: Jan Dubiec; +Cc: gdb-patches, Andrew Burgess

>>>>> "Jan" == Jan Dubiec <jdx@o2.pl> writes:

Jan> This is obviously a typo, because the file descriptor for stdout is 1
Jan> on both Linux and Windows. As a result, the test cases returned nothing
Jan> on Windows, i.e. neither "pass" nor "fail".

Jan> It works on Linux, however, because file descriptors 0-2 usually all
Jan> refer to the same underlying device, which is opened for bidirectional
Jan> I/O. File descriptor 1 may be line- or block-buffered by libc, but once
Jan> the data is actually written to the kernel, it ultimately goes to the
Jan> same underlying bidirectional pseudo-terminal device.

LGTM.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

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

end of thread, other threads:[~2026-09-03 16:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-27  8:31 [REPOST][PATCH] H8/300: sim: testsuite: Use the correct file descriptor for stdout Jan Dubiec
2026-09-03 16:59 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox