Message ID | 1703799036.942375779@f754.i.mail.ru |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0F03938582A6 for <patchwork@sourceware.org>; Thu, 28 Dec 2023 21:31:26 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from f496.i.mail.ru (f496.i.mail.ru [45.84.129.13]) by sourceware.org (Postfix) with ESMTPS id D82513858D39 for <gdb-patches@sourceware.org>; Thu, 28 Dec 2023 21:30:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D82513858D39 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=mail.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mail.ru ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D82513858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.84.129.13 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703799062; cv=none; b=VQOXizsZ4DnTSDxeqw17NbZf/8OCmtq9dbX+CFubxwJs4C4Zgp0tzgyu46d0SXGi2P0hg/UVnv8ZITqBPFNuYgINEKInZEzmEJ8LKUZRW3mOv6Yjm/gQuP5YO0pmLzdKQzPdFmNrNzrGXe+6mrrYFpF9N/Ci6U5/FoqUtWeJKmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703799062; c=relaxed/simple; bh=0m5i3l7quaZo+RtNsl0RkemXtBhSFumNz/PBZerSdkQ=; h=DKIM-Signature:From:To:Subject:MIME-Version:Date:Message-ID; b=D6v3/0Kis50gxKgBRqiIVfpsSGSTykyHUg5leV3QBa6MaDUbS2uIQaWTBAn2ueQU7+TbYbi4SPnGKjB9QPfJtTR2PPfNn776qxwaqa0RJ+D06Fz7K/lN14k3oWWKTeisacdUSsh4dar2rluq9j2KdJ3fJ24UropjxSveNI+UeLo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail4; h=Content-Type:Message-ID:Reply-To:Date:MIME-Version:Subject:To:From:From:Subject:Content-Type:Content-Transfer-Encoding:To:Cc; bh=0m5i3l7quaZo+RtNsl0RkemXtBhSFumNz/PBZerSdkQ=; t=1703799058;x=1703889058; b=W9ezeuj6T4uI8OSLynE0rwy7SbCpAdlyx2Dg7aMIQVF4xpqAzQF2uQbdu5f8SBjJZueCs7QIiejUrTeFcC3xqyZa0o63MfUZvM/PIywdekmqis2JH4xcvgh3ZJRPfTjG7iXnZdkXukStUP/tsZak8q0nz1yc4rBa7+q6MXHilik3PZOcQ/e/GZnASEJJ9/3aoGXvhqgFNgKXE/IHvi2XXOERXz59aYSLg2Ophw6RRj2JeR96iW6vq1R/TejV+TmKK3INIFsSwGj0oz9geJeVZZ8wR5DYpY0jeCUE0LXUxNJT9EelrYJWW6ncS+luCXwZHZ2NAzu2idK4tvl+YgUCyg==; Received: by f496.i.mail.ru with local (envelope-from <klen_s@mail.ru>) id 1rIxxc-0003IJ-Ql for gdb-patches@sourceware.org; Fri, 29 Dec 2023 00:30:37 +0300 Received: by e.mail.ru with HTTP; Fri, 29 Dec 2023 00:30:36 +0300 From: =?utf-8?b?0KHQtdGA0LPQtdC5INCn0LXRgNC90L7Qsg==?= <klen_s@mail.ru> To: gdb-patches@sourceware.org Subject: =?utf-8?q?fix_remote_serial_read?= MIME-Version: 1.0 X-Mailer: Mail.Ru Mailer 1.0 X-SenderField-Remind: 0 Date: Fri, 29 Dec 2023 00:30:36 +0300 X-Priority: 3 (Normal) Message-ID: <1703799036.942375779@f754.i.mail.ru> Content-Type: multipart/alternative; boundary="--ALT--a972Fb7A3D75Af2D342A9Ca4A37937721703799036" Authentication-Results: f496.i.mail.ru; auth=pass smtp.auth=klen_s@mail.ru smtp.mailfrom=klen_s@mail.ru X-Mailru-Src: fe X-7564579A: 646B95376F6C166E X-77F55803: 119C1F4DF6A9251C047F89FE214EBC1534ECC0B46CCC8867F4B12E9C4B10E1258FD872164937FA4CDFB09320F1847CA269D3CBB5C82DC554EAC7B50D08C8338A2C488FB783E17D34 X-7FA49CB5: 70AAF3C13DB70168C09775C1D3CA48CF189A88AE0B35AA59B2086D80B0504778CF19DD082D7633A0ACBFF42033827DA764CD17681C2FEB7A23F8577A6DFFEA7C6E615DF3460F6E48C4224003CC836476ABE134FDCE4E2725BFD28B28ED4578739E625A9149C048EE437C869540D2AB0F6CEA61CADDE926D9B287FD4696A6DC2FA8DF7F3B2552694A4E2F5AFA99E116B42401471946AA11AF176DF2183F8FC7C0BAE5222749FC90208F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB553375669D42CC12651D404A68085284EC935BE8D74732331D75A85E1DF9E95F17B0083B26EA987F6312C9EC599709FD55CB46A62CC0D3CB04F14752D2E47CDBA5A96583C09775C1D3CA48CF3C056C6FCE5AFF8E117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE77E6DCD7A067822DD9FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA71A620F70A64A45A98AA50765F7900637F1CEADB5F7626D0D6D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637BBEA499411984DA1EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A53346059ED001B46213DEACB138518D3C6A7CF929118F39B0F87CCE6106E1FC07E67D4AC08A07B9B067F1C1C3ABB44F3ACB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE2815F1F17DA719077DD89D51EBB77422CCB5A6D6581D03D0776B5B2C279835F17BCBE6708A5A68D02015372BE9702A2E9A097B61DC4DBCD656B73EAEC3A463372A182A65F7B546D89654A9EB877EDC304F6B2146B96E6931B56794A24E1788A702DD379D4D03D9B034778ED071A817552EE4E5D9E54FDA44C41F94D744909CEFEA348C63311430583753FE1607FDC07CC2E138FFB4ACBED X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5+wYjsrrSY/u8Y3PrTqANeitKFiSd6Yd7yPpbiiZ/d5BsxIjK0jGQgCHUM3Ry2Lt2G3MDkMauH3h0dBdQGj+BB/iPzQYh7XS3xyn40EmMxrmzGyQ9/nTnF2emLBAHg//SJzUdJfQ/bjz X-Mailru-MI: 10000000000000800 X-Mailru-Sender: C806E69B0D6DD372E1E39EB98FE7FBCA2F36BA66AE8414A369D3CBB5C82DC55485FFA7B3B3F17FA47326B261E47C33357903AA853BEC14D69B20983E1D819EAB4CAFED6C9326091964046F3F4D75A9D97B479CD2F808C55522B820C1B2086D890DA7A0AF5A3A8387 X-Mras: Ok X-Spam: undefined X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Reply-To: =?utf-8?b?0KHQtdGA0LPQtdC5INCn0LXRgNC90L7Qsg==?= <klen_s@mail.ru> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org |
Series |
fix remote serial read
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | fail | Patch failed to apply |
linaro-tcwg-bot/tcwg_gdb_build--master-arm | fail | Patch failed to apply |
Commit Message
Сергей Чернов
Dec. 28, 2023, 9:30 p.m. UTC
After closing "Bug 30770 - serial.c does not preserve errno correctly" https://sourceware.org/bugzilla/show_bug.cgi?id=30770 remote debugging became impossible due to an attempt to recv() by a call intended for the socket, and not for the character device file. The documentation implicitly states that it is possible to use the read() call to work with a socket. But this does not mean in the general case that it is permissible to use recv in the case of a non-socket. condition: os: Distributor ID: Ubuntu Description: Ubuntu 23.10 Release: 23.10 Codename: mantic libc: ldd (Ubuntu GLIBC 2.38-1ubuntu6) 2.38 kernel: Linux klen-dev-um790pro 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux gdb: build from trank at 15.0.50.20231226-git GDB output: $ arm-kgp-eabi-gdb GNU gdb (Klen's_GNU_package_(KGP)_for_target::arm-kgp-eabi<rmprofile/lto>_host::x86_64-kgp-linux-gnu_znver4-avx512<<ílex>>) 15.0.50.20231226-git .... (gdb) tar ext /dev/ttyACM1 Remote debugging using /dev/ttyACM1 Remote communication error. Target disconnected: error while reading: Socket operation on non-socket. (gdb) after fix gdb work fine $ arm-kgp-eabi-gdb -q (gdb) tar ext /dev/ttyACM0 Remote debugging using /dev/ttyACM0 (gdb) mon swd Target voltage: 0.0V Available Targets: No. Att Driver STM32F40x M4 (gdb) att 1 Attaching to Remote target warning: No executable has been specified and target does not support determining executable automatically. Try using the "file" command. 0x08020c80 in ?? () (gdb) --- gdb/ser-unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.40.1
Comments
>>>>> Сергей Чернов <klen_s@mail.ru> writes: > After closing "Bug 30770 - serial.c does not preserve errno correctly" > https://sourceware.org/bugzilla/show_bug.cgi?id=30770 > remote debugging became impossible due to an attempt to recv() by a call intended for the socket, and not for the character device file. The > documentation implicitly states that it is possible to use the read() call to work with a socket. But this does not mean in the general case that it is > permissible to use recv in the case of a non-socket. This patch wasn't sent in a way that was easy to apply, but I've gone ahead and done it manually. I'm going to push it shortly. Tom
Hello Tom! my git client did not allow me to make a email-like patch automatically (for some reason it works with an error) and I, knowing the format, wrote it by hand... apparently I work no better than him :) Thank you for making the correction to trunk gdb sources, I will be pleased if my name is mentioned :) Every day I develop tools for developing and debugging embedded devices based on cortex-m and little riscv - so I detect errors with GCC and GDB local and remote hardware debugging immediately. At the same time, I have accumulated patches that could be offered to the public. Perhaps it would be nice if we collaborated for the common good. There are ideas on how to improve riscv debugging in the direction of indicating only the actually implemented special registers (SCR) of the processor. I plan to try this and will share the result for discussion. I'm involved in improving the GCC target-port ror RISCV and apparently this could be matched by an improvement in bu/gdb. Best regards Chernov Sergey aka Klen Santakheza >Пятница, 19 января 2024, 21:02 +03:00 от Tom Tromey <tom@tromey.com>: > >>>>>> Сергей Чернов < klen_s@mail.ru > writes: > >> After closing "Bug 30770 - serial.c does not preserve errno correctly" >> https://sourceware.org/bugzilla/show_bug.cgi?id=30770 >> remote debugging became impossible due to an attempt to recv() by a call intended for the socket, and not for the character device file. The >> documentation implicitly states that it is possible to use the read() call to work with a socket. But this does not mean in the general case that it is >> permissible to use recv in the case of a non-socket. >This patch wasn't sent in a way that was easy to apply, but I've gone >ahead and done it manually. I'm going to push it shortly. > >Tom
On 2024-01-20 06:56, Сергей Чернов wrote: > Hello Tom! > > my git client did not allow me to make a email-like patch > automatically (for some reason it works with an error) and I, knowing > the format, wrote it by hand... apparently I work no better than him > :) Would it be possible to know what the problem was? The ideal way to send a patch is git-send-email, which sends the patch through an SMTP server directly as a properly formatted email. But I understand that it's not always trivial to set up. The second best way would be to use git-format-patch to generate a .patch file, and then send that file as an attachment (not copy pasting it in your email client). This doesn't really need any setup, so I don't see any reason why that wouldn't be possible. Simon
>>>>> Сергей Чернов <klen_s@mail.ru> writes: > Every day I develop tools for developing and debugging embedded > devices based on cortex-m and little riscv - so I detect errors with > GCC and GDB local and remote hardware debugging immediately. At the > same time, I have accumulated patches that could be offered to the > public. Perhaps it would be nice if we collaborated for the common > good. Sounds good to me, we're always interested in improvements. You should probably start on the copyright assignment process. This is needed when someone sends more than just a trivial patch. You can email 'assign@gnu.org' to get started on this. Tom
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index 07cd8b7b5b4..57dcf6c7cf3 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -574,7 +574,7 @@ when debugging using remote targets."), int ser_unix_read_prim (struct serial *scb, size_t count) { - int result = recv (scb->fd, scb->buf, count, 0); + int result = read (scb->fd, scb->buf, count); if (result == -1 && errno != EINTR) perror_with_name ("error while reading"); return result;