public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>,
	Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH 6/9] gdb/testsuite/dap: pass around dicts instead of ton objects
Date: Wed, 25 Jan 2023 22:29:06 -0500	[thread overview]
Message-ID: <99e8075c-3f94-5b51-dc43-b74d2ad84cbd@simark.ca> (raw)
In-Reply-To: <87a626tgnj.fsf@tromey.com>



On 1/25/23 17:04, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> Change-Id: I2ca47bea355bf459090bae8680c6a917350b5c3f
> 
> Probably could use a commit message.

Oops, that was a mistake.  I always put at least a little something in
the commit messages, except for the extremely obvious commits.

> The main issue with this is that dicts lose type information from the
> JSON.  So, if we ever need to check the type of some value sent by gdb,
> we won't be able to.

Ah, interesting.

> But I suppose we could always just add some new proc that returns the
> TON form and go from there.  I don't recall if I've needed any such
> tests yet.  Arguably maybe we should write one.

The idea of my change was that we currently did `namespace eval
ton::2dict` pretty much everywhere.  So I thought it would be nice to
make it easier on callers and to the ton::2dict for them, that makes the
tests less verbose.

I think we can indeed add intermediary functions that return ton objects
as needed.  For instance, have dap_request_and_response_ton can do most
of the work, and have dap_request_and_response be a small wrapper around
it to do the ton::2dict.

Based on this, my commit message would be:

    The DAP helper functions generally return TON objects.  However, callers
    almost all immediately use ton::2dict to convert them to dicts, to
    access their contents.  This commits makes things a bit simpler for them
    by having function return dicts directly instead.

    The downside is that the TON objects contain type information.  For
    instance, a "2" in a TCL dict could have been the integer 2 or the
    string "2" in JSON.  By converting to TCL dicts, we lose that
    information.  If some tests specifically want to check the types of some
    fields, I think we can add intermediary functions that return TON
    objects, without having to complicate other callers who don't care.

Simon

  reply	other threads:[~2023-01-26  3:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 18:57 [PATCH 0/9] Fix gdb.dap/basic-dap.exp for PIE Simon Marchi
2023-01-06 18:57 ` [PATCH 1/9] gdb/testsuite/dap: use gdb_assert in gdb.dap/basic-dap.exp Simon Marchi
2023-01-25 21:58   ` Tom Tromey
2023-01-06 18:57 ` [PATCH 2/9] gdb/testsuite/dap: prefix some procs with _ Simon Marchi
2023-01-25 21:59   ` Tom Tromey
2023-01-06 18:57 ` [PATCH 3/9] gdb/testsuite/dap: write requests to gdb.log Simon Marchi
2023-01-25 21:59   ` Tom Tromey
2023-01-25 22:01   ` Tom Tromey
2023-01-26  3:01     ` Simon Marchi
2023-01-06 18:57 ` [PATCH 4/9] gdb/testsuite/dap: make dap_request_and_response not catch / issue test result Simon Marchi
2023-01-06 18:57 ` [PATCH 5/9] gdb/testsuite/dap: remove catch from dap_read_event Simon Marchi
2023-01-06 18:57 ` [PATCH 6/9] gdb/testsuite/dap: pass around dicts instead of ton objects Simon Marchi
2023-01-25 22:04   ` Tom Tromey
2023-01-26  3:29     ` Simon Marchi [this message]
2023-01-26 14:55       ` Tom Tromey
2023-01-06 18:57 ` [PATCH 7/9] gdb/testsuite/dap: rename dap_read_event to dap_wait_for_event_and_check Simon Marchi
2023-01-06 18:57 ` [PATCH 8/9] gdb/testsuite/dap: make dap_wait_for_event_and_check return preceding messages Simon Marchi
2023-01-06 18:57 ` [PATCH 9/9] gdb/testsuite/dap: fix gdb.dap/basic-dap.exp disassembly test for PIE Simon Marchi
2023-01-25 22:10   ` Tom Tromey
2023-01-26  3:40     ` Simon Marchi
2023-01-26 15:08       ` Tom Tromey
2023-01-26 20:21         ` Simon Marchi
2023-01-16 16:07 ` [PATCH 0/9] Fix gdb.dap/basic-dap.exp " Simon Marchi
2023-01-25 22:10   ` Tom Tromey
2023-01-26 20:22     ` Simon Marchi

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=99e8075c-3f94-5b51-dc43-b74d2ad84cbd@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    --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).