public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Farre <simon.farre.cx@gmail.com>
To: Simon Farre <simon.farre.cx@gmail.com>
Cc: gdb-patches@sourceware.org, Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH v4] gdb/DAP Introduce new methods to to Pretty Printers
Date: Tue, 27 Jun 2023 14:41:05 +0200	[thread overview]
Message-ID: <b874ad10-6049-fa28-0a3d-7206aac19960@gmail.com> (raw)
In-Reply-To: <20230626153108.193139-1-simon.farre.cx@gmail.com>

I just thought of something that I think we've both misunderstood about 
(well, at least I did) "Lifetime of Objects References" section in the 
DAP specification.

To quote the section:

"To simplify the management of object references in debug adapters, 
their lifetime is limited to the current suspended state.
Once execution resumes, object references become invalid and DAP clients 
must not use them.
When execution is paused again, object references no longer refer to the 
same objects.
This means that a debug adapter can easily use sequentially assigned 
integers for different objects and reset the counter to 1 when execution 
resumes."

This doesn't mean that *we* can't cache variables (or variable 
references) on the GDB side. Because *we* are not the client (in this 
scenario, we would be the "server",
seeing as how the DAP is designed to be like a stateless protocol kind 
of like http) we can do whatever we want in our DAP-interpreter. It's 
only the *client* that can't rely
on a variablesReference to mean the same thing between suspended states. 
This opens up for the possibility of, when building the stack metadata, 
such as locals, args,
frames, perhaps the user visited older frames and retrieved the scopes 
etc - this could be cached until next suspension and if it's invalid at 
that point, throw it away, if not,
serve it all up again.

The question is, is the added complexity of caching variables (like I 
did for my DA) worth it, if the Pretty Printer API is smart enough and 
performant enough? Probably not, it's probably not likely at all that 
it's worth it.
And by "smart enough" and "performant enough" I specifically mean a 
pretty printer API, where sub-regions, sub-ranges of variables can be 
fetched quickly, which this patch provides.


  reply	other threads:[~2023-06-27 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 15:31 Simon Farre
2023-06-27 12:41 ` Simon Farre [this message]
2023-09-11 18:07 ` Tom Tromey

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=b874ad10-6049-fa28-0a3d-7206aac19960@gmail.com \
    --to=simon.farre.cx@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).