|
From: | Richard Henderson |
Subject: | Re: [PATCH v3 09/49] semihosting: Adjust error checking in common_semi_cb |
Date: | Tue, 7 Jun 2022 10:41:00 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
On 5/23/22 08:35, Richard Henderson wrote:
That implies that our current code is right, in that the way to check for "did the call fail" is to look at the retcode, not the errno (in the same way that if you make a native syscall or library call you look first at its return value, not at errno). There's nothing in the protocol text that makes a guarantee that the errno value is non-0 if and only if the call failed.I admit that I didn't check the gdb code. I looked at our side and saw that when the second result is missing that we'd supply 0, and interpreted "can be omitted" as "will be omitted" on success.
Checking, can->will is actually correct, and gdb will omit the errno parameter on success. https://sourceware.org/git?p=binutils-gdb.git;a=blob;f=gdb/remote-fileio.c;h=fe191fb6069a53a3844656a81e77069afa781946;hb=HEAD#l328 So I think checking err != 0 is a good change. r~
[Prev in Thread] | Current Thread | [Next in Thread] |