public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "fweimer at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug mi/28711] gdb closes when displaying structs with long field names in eclipse
Date: Fri, 24 Dec 2021 17:03:14 +0000	[thread overview]
Message-ID: <bug-28711-4717-9WIWCubqQX@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28711-4717@http.sourceware.org/bugzilla/>

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

--- Comment #5 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Andrew Burgess from comment #4)
> So what happens is that a lot of input arrives on the read file descriptor
> in one go.  GDB does a fgetc, and glibc then does a read on the file
> descriptor.  I see glibc read up to 1024 bytes.  Clearly, the original bug
> reporter saw much smaller reads from glibs, but that's not really important.
> 
> If the first command that arrives (including the commands final \n
> character) is larger than one read buffer (so for me, larger than 1024
> bytes), then glibc will perform a second read, also of up to 1024 bytes to
> find the rest of the command.
> 
> If we imagine that the final \n character is the first character in the
> second read buffer, and that we get a full 1024 bytes in the second read
> buffer, then GDB has read 1023 bytes more than it actually needed.  As a
> result, the file position of the file descriptor is 1023 bytes ahead of
> where glibc actually thinks it should be in the file.
> 
> But, moving on, GDB processes the first command, which results in some
> output.  GDB wants to print this output, and eventually, this output is sent
> to the output file descriptor via glibc.
> 
> glibc notices that the file position is 1023 bytes ahead of where it should
> be, and so tries to lseek the file position back to the expected location.

This description suggests to me that GDB does not use two different stdio
streams for reading and writing. With one stream, POSIX requires fseek calls
when switching from reading to writing and vice versa. This is obviously a
non-starter for terminal devices because they do not support seeking.

So opening the same terminal device multiple times is the way to go, it's how
stdin, stdout, stderr can coexist on one terminal.

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

  parent reply	other threads:[~2021-12-24 17:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 13:07 [Bug mi/28711] New: " cristian.lupascu at nxp dot com
2021-12-17 16:53 ` [Bug mi/28711] " aburgess at redhat dot com
2021-12-17 16:55 ` aburgess at redhat dot com
2021-12-18 11:39 ` aburgess at redhat dot com
2021-12-20 18:44 ` aburgess at redhat dot com
2021-12-24 17:03 ` fweimer at redhat dot com [this message]
2021-12-26 19:06 ` tromey at sourceware dot org
2021-12-27 10:15   ` Andrew Burgess
2021-12-27 10:15 ` aburgess at redhat dot com
2022-01-17 16:43 ` aburgess at redhat dot com
2022-02-07 10:25 ` cvs-commit at gcc dot gnu.org
2022-02-08 10:16 ` aburgess at redhat dot com
2022-02-09 19:48 ` cristian.lupascu at nxp dot com
2022-02-09 23:42 ` tromey at sourceware dot org
2022-10-31 16:48 ` jonah at kichwacoders dot com
2022-10-31 16:54 ` jonah at kichwacoders dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28711-4717-9WIWCubqQX@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).