Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "taylor, david" <david.taylor@emc.com>
To: Pedro Alves <palves@redhat.com>,
	"gdb@sourceware.org" <gdb@sourceware.org>
Subject: RE: why I dislike qXfer
Date: Thu, 16 Jun 2016 17:42:00 -0000	[thread overview]
Message-ID: <63F1AEE13FAE864586D589C671A6E18B062D63@MX203CL03.corp.emc.com> (raw)
In-Reply-To: <7ee87c44-2fe7-741b-d134-49e9a56a966c@redhat.com>


> From: Pedro Alves [mailto:palves@redhat.com]
> Sent: Monday, June 13, 2016 2:36 PM
> To: taylor, david; gdb@sourceware.org
> Subject: Re: why I dislike qXfer
> 
> On 06/13/2016 07:15 PM, David Taylor wrote:
> 
> > With the qT{f,s}{STM,P,V} q{f,s}ThreadInfo (and possibly others)
> > interfaces, nothing needs to be precomputed, and I either start at the
> > beginning (f -- first) or where the previous request left off (s --
> > subsequent).
> 
> > I have to store, per connection, my location.  But, there is no random
> > reading.  The next request of that flavor will either start at the
> > beginning (f) or where the last one left off (s).  Reads are sequential.
> 
> If you support non-stop mode, the target is running and list of threads
> changes as gdb is iterating.  The "location" thread can exit and you're left not
> knowing where to continue from, for example.  To get around that, generate
> a stable snapshot when you get the f requests, and serve gdb requests from
> that snapshot.

We are non-stop.  The "location" thread exiting would not be a problem.

Each request, whether first or subsequent would send one or more complete
thread entries.  When sending a reply, you know where in the process
table to start, you skip dead threads, and you fill entries until
after doing the XML escaping and the GDB escaping an additional complete
entry will not fit.  You record where you stopped -- where to resume.

We allow an arbitrary number of GDBs to connect to the GDB stub running
in the OS kernel -- each connection gets a dedicated thread.

Currently, we support 320 threads.  This might well increase in the
future.  With thread name and everything else I want to send back at the
maximum (because that reflects how much space I might need under the
offset & length scheme), I calculate 113 bytes per thread (this counts
<thread> and </thread>) to send back -- before escaping.

So, if I 'snapshot' everything every time I get a packet with an offset of 0,
the buffer would need to be over 32K bytes in size.  I don't want to
increase the GDB stub stack size by this much.  So, that mens either
limiting the number of connections (fixed, pre-allocated buffers) or
using kernel equivalents of malloc and free (which is discouraged) or
coming up with a different approach -- e.g., avoiding the need for the
buffer...

So, in terms of saved state, with the snapshot it is 35-36K bytes, with the
process table index it is 2-8 bytes.

It's too late now, but I would much prefer interfaces something like:

either
    qfXfer:object:read:annex:length
    qsXfer:object:read:annex:length
or
    qfXfer:object:read:annex
    qsXfer:object:read:annex

[If the :length wasn't part of the spec, then send as much
as you want so long as you stay within the maximum packet size.  My
preference would be to leave off the length, but I'd be happy either way.]

David


  reply	other threads:[~2016-06-16 17:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 18:16 David Taylor
2016-06-13 18:35 ` Pedro Alves
2016-06-16 17:42   ` taylor, david [this message]
2016-06-16 18:25     ` Pedro Alves
2016-06-16 20:00       ` taylor, david
2016-06-17 14:33         ` Pedro Alves

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=63F1AEE13FAE864586D589C671A6E18B062D63@MX203CL03.corp.emc.com \
    --to=david.taylor@emc.com \
    --cc=gdb@sourceware.org \
    --cc=palves@redhat.com \
    /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