public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug remote/31193] New: remote serial device read fall
@ 2023-12-27 11:22 klen_s at mail dot ru
  2023-12-27 16:50 ` [Bug remote/31193] " tromey at sourceware dot org
  2023-12-28  9:20 ` klen_s at mail dot ru
  0 siblings, 2 replies; 3+ messages in thread
From: klen_s at mail dot ru @ 2023-12-27 11:22 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31193

            Bug ID: 31193
           Summary: remote serial device read fall
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: remote
          Assignee: unassigned at sourceware dot org
          Reporter: klen_s at mail dot ru
  Target Milestone: ---

Created attachment 15271
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15271&action=edit
propsed patch

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
 1      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)


propsed patch

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;

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug remote/31193] remote serial device read fall
  2023-12-27 11:22 [Bug remote/31193] New: remote serial device read fall klen_s at mail dot ru
@ 2023-12-27 16:50 ` tromey at sourceware dot org
  2023-12-28  9:20 ` klen_s at mail dot ru
  1 sibling, 0 replies; 3+ messages in thread
From: tromey at sourceware dot org @ 2023-12-27 16:50 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31193

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-12-27
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
Oops, sorry about that.
Can you 'git send-email' the patch (with explanation in the commit)
to the gdb-patches list?
(gdb doesn't generally do patch review in bugzilla...)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug remote/31193] remote serial device read fall
  2023-12-27 11:22 [Bug remote/31193] New: remote serial device read fall klen_s at mail dot ru
  2023-12-27 16:50 ` [Bug remote/31193] " tromey at sourceware dot org
@ 2023-12-28  9:20 ` klen_s at mail dot ru
  1 sibling, 0 replies; 3+ messages in thread
From: klen_s at mail dot ru @ 2023-12-28  9:20 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31193

--- Comment #2 from Chernov Sergey aka Klen <klen_s at mail dot ru> ---
Yes, I'll do that a little later.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2023-12-28  9:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-27 11:22 [Bug remote/31193] New: remote serial device read fall klen_s at mail dot ru
2023-12-27 16:50 ` [Bug remote/31193] " tromey at sourceware dot org
2023-12-28  9:20 ` klen_s at mail dot ru

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).