public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 2/9] gdb/testsuite/dap: prefix some procs with _
Date: Fri,  6 Jan 2023 13:57:22 -0500	[thread overview]
Message-ID: <20230106185729.42372-3-simon.marchi@efficios.com> (raw)
In-Reply-To: <20230106185729.42372-1-simon.marchi@efficios.com>

Prefix some procs that are only used internally with an underscore, to
make it clear they are internal.  If they need to be used by some test
later, we can always un-prefix them.

Change-Id: Iacb8e77363b5d1f8b98d9ba5a6d115aee5c8925d
---
 gdb/testsuite/lib/dap-support.exp | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/gdb/testsuite/lib/dap-support.exp b/gdb/testsuite/lib/dap-support.exp
index adf332cd7a5..a91b5533643 100644
--- a/gdb/testsuite/lib/dap-support.exp
+++ b/gdb/testsuite/lib/dap-support.exp
@@ -98,7 +98,7 @@ proc dap_to_ton {obj} {
 }
 
 # Format the object OBJ, in TON format, as JSON and send it to gdb.
-proc dap_send_ton {obj} {
+proc _dap_send_ton {obj} {
     set json [namespace eval ton::2json $obj]
     # FIXME this is wrong for non-ASCII characters.
     set len [string length $json]
@@ -111,7 +111,7 @@ proc dap_send_ton {obj} {
 # omitted.  The sequence number of the request is automatically added,
 # and this is also the return value.  OBJ is assumed to already be in
 # TON form.
-proc dap_send_request {command {obj {}}} {
+proc _dap_send_request {command {obj {}}} {
     # We can construct this directly as a TON object.
     set result $::dap_seq
     incr ::dap_seq
@@ -120,13 +120,13 @@ proc dap_send_request {command {obj {}}} {
     if {$obj != ""} {
 	append req " arguments \[$obj\]"
     }
-    dap_send_ton $req
+    _dap_send_ton $req
     return $result
 }
 
 # Read a JSON response from gdb.  This will return a TON object on
 # success, or throw an exception on error.
-proc dap_read_json {} {
+proc _dap_read_json {} {
     set length ""
     gdb_expect {
 	-re "^Content-Length: (\[0-9\]+)\r\n" {
@@ -181,10 +181,10 @@ proc dap_read_json {} {
 # emitted.  The objects are in TON format.  If a response object is
 # seen but has the wrong sequence number or command, throw an
 # exception
-proc dap_read_response {cmd num} {
+proc _dap_read_response {cmd num} {
     set result {}
     while 1 {
-	set obj [dap_read_json]
+	set obj [_dap_read_json]
 	set d [namespace eval ton::2dict $obj]
 	if {[dict get $d type] == "response"} {
 	    if {[dict get $d request_seq] != $num} {
@@ -200,14 +200,14 @@ proc dap_read_response {cmd num} {
     }
 }
 
-# A wrapper for dap_send_request and dap_read_response.  This sends a
+# A wrapper for _dap_send_request and _dap_read_response.  This sends a
 # request to gdb and returns the result.  NAME is used to issue a pass
 # or fail; on failure, this always returns an empty string.
 proc dap_request_and_response {name command {obj {}}} {
     set result {}
     if {[catch {
-	set seq [dap_send_request $command $obj]
-	set result [dap_read_response $command $seq]
+	set seq [_dap_send_request $command $obj]
+	set result [_dap_read_response $command $seq]
     } text]} {
 	verbose "reason: $text"
 	fail $name
@@ -239,7 +239,7 @@ proc dap_check_request_and_response {name command {obj {}}} {
 # desired.  Callers not caring about this should probably use
 # dap_launch.  Returns the empty string on failure.  NAME is used as
 # the test name.
-proc dap_initialize {name} {
+proc _dap_initialize {name} {
     if {[dap_gdb_start]} {
 	return ""
     }
@@ -254,7 +254,7 @@ proc dap_initialize {name} {
 # reasonable default but can be overridden in case a test needs to
 # launch gdb more than once.
 proc dap_launch {file {name startup}} {
-    if {[dap_initialize "$name - initialize"] == ""} {
+    if {[_dap_initialize "$name - initialize"] == ""} {
 	return ""
     }
     return [dap_check_request_and_response "$name - launch" launch \
@@ -303,7 +303,7 @@ proc _dap_read_event {type} {
     while 1 {
 	# We don't do any extra error checking here for the time
 	# being; we'll just get a timeout thrown instead.
-	set obj [dap_read_json]
+	set obj [_dap_read_json]
 	set d [namespace eval ton::2dict $obj]
 	if {[dict get $d type] == "event"
 	    && [dict get $d event] == $type} {
-- 
2.38.1


  parent reply	other threads:[~2023-01-06 18:57 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 ` Simon Marchi [this message]
2023-01-25 21:59   ` [PATCH 2/9] gdb/testsuite/dap: prefix some procs with _ 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
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=20230106185729.42372-3-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --cc=gdb-patches@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).