[PATCH 3/2] gdb/testsuite: improve logging in lib/tuiterm.exp
Simon Marchi
simon.marchi@polymtl.ca
Wed Jan 20 21:18:32 GMT 2021
On 2021-01-11 4:01 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> Here are some examples of the logging found in gdb.log with this patch
> Simon> applied:
>
> Simon> +++ Inserting string '+|'
> Simon> +++ Inserted char '+', cursor: (0, 79) -> (1, 0)
> Simon> +++ Inserted char '|', cursor: (1, 0) -> (1, 1)
> Simon> +++ Inserted string '+|', cursor: (0, 79) -> (1, 1)
> Simon> +++ Cursor Horizontal Absolute (80), cursor: (1, 1) -> (1, 79)
>
> Simon> In the last line, note that the argument is 80 and we move to 79, that's
> Simon> because the position in the argument to the control sequence is 1-based,
> Simon> while our indexing is 0-based.
>
> Seems fine though I have some questions.
>
> Simon> + proc _log { what } {
> Simon> + verbose -log "+++ $what"
>
> wait_for already does logging, but doesn't use -log. Should it? Or
> maybe the new proc should also just use "verbose"?
Hmm right. I would prefer to make it use -log too. That way it ends
up in gdb.log, it's easy to find. I would therefore apply this fixup
to the patch.
>From 8cc1c5239b5f4d64427834a5f4a828777f7cb974 Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@polymtl.ca>
Date: Wed, 20 Jan 2021 16:15:46 -0500
Subject: [PATCH] fixup
Change-Id: I378023066bdeb5cbe2b491e8c2b95bae09d29c3e
---
gdb/testsuite/lib/tuiterm.exp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp
index a77c8d39e546..4160586b615c 100644
--- a/gdb/testsuite/lib/tuiterm.exp
+++ b/gdb/testsuite/lib/tuiterm.exp
@@ -567,17 +567,17 @@ namespace eval Term {
-re "^\[\x07\x08\x0a\x0d\]" {
scan $expect_out(0,string) %c val
set hexval [format "%02x" $val]
- verbose "+++ _ctl_0x${hexval}"
+ _log "wait_for: _ctl_0x${hexval}"
_ctl_0x${hexval}
}
-re "^\x1b(\[0-9a-zA-Z\])" {
- verbose "+++ unsupported escape"
+ _log "wait_for: unsupported escape"
error "unsupported escape"
}
-re "^\x1b\\\[(\[0-9;\]*)(\[a-zA-Z@\])" {
set cmd $expect_out(2,string)
set params [split $expect_out(1,string) ";"]
- verbose "+++ _csi_$cmd <<<$expect_out(1,string)>>>"
+ _log "wait_for: _csi_$cmd <<<$expect_out(1,string)>>>"
eval _csi_$cmd $params
}
-re "^\[^\x07\x08\x0a\x0d\x1b\]+" {
--
2.30.0
More information about the Gdb-patches
mailing list