Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@broadcom.com>
To: <gdb-patches@sourceware.org>
Cc: <daniel.gutson@tallertechnologies.com>
Subject: Re: [PATCH] Add autocompletion for convenience vars in print and set
Date: Tue, 27 May 2014 16:46:00 -0000	[thread overview]
Message-ID: <5384C12C.2020602@broadcom.com> (raw)
In-Reply-To: <CAF5HaEUosXVSvxJQkEp3DgBYMMKGNXnJ-r4LOQV3PDeqfYnptA@mail.gmail.com>

On 22/05/2014 4:17 PM, Daniel Gutson wrote:
> Second version.
> Comments below:
> 
> On Tue, May 20, 2014 at 1:36 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>>> "Daniel" == Daniel Gutson <daniel.gutson@tallertechnologies.com> writes:
>>
>> Daniel> I could not find any testsuite where to add tests for this; if
>> Daniel> there are, please let me know.
>>
>> See testsuite/gdb.base/completion.exp
> 
> Thanks, I ran all the tests and passed. I did not add a new test
> case though since I didn't check how to add a new convenience var
> and undefine it later from the test framework. (Should I try harder?)

I'm not a maintainer, but you'll probably be asked for some tests of 
this (really useful) feature.

I don't think you need to worry about removing any convenience 
variables you create, each .exp test file starts gdb afresh, 
and sometime (look for clean_restart) gdb is restarted within 
a single .exp file.

For this feature you can probably get away with just adding some 
new tests to the end of the completion.exp file, I've included an
example test in this mail, but you'll probably want some more.

thanks,
Andrew


diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp
index 2608309..c028548 100644
--- a/gdb/testsuite/gdb.base/completion.exp
+++ b/gdb/testsuite/gdb.base/completion.exp
@@ -747,6 +747,27 @@ gdb_test_multiple "" "$test" {
     }
 }
 
+set test "complete '\$cv_'"
+gdb_test_no_output "set \$cv_aaa = 4" \
+    "Create convenience variable \$cv_aaa"
+send_gdb "p \$cv_"
+gdb_test_multiple "" "$test" {
+    -re "^p \\\$cv_" {
+	send_gdb "\t"
+	gdb_test_multiple "" "$test" {
+	    -re "aaa $" {
+		send_gdb "\n"
+		gdb_test_multiple "" "$test" {
+		    -re "\\\$\[0-9\]+ = 4.*$gdb_prompt $" {
+			pass "$test"
+		    }
+		}
+	    }
+	}
+    }
+}
+
+
 # Restore globals modified in this test...
 set timeout $oldtimeout1
 




  parent reply	other threads:[~2014-05-27 16:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 15:51 Daniel Gutson
2014-05-20 15:52 ` Daniel Gutson
2014-05-20 16:36 ` Tom Tromey
2014-05-22 15:17   ` Daniel Gutson
2014-05-27 15:18     ` Daniel Gutson
2014-05-27 16:46     ` Andrew Burgess [this message]
2014-05-27 20:24       ` Daniel Gutson
2016-02-25 21:23         ` Daniel Gutson

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=5384C12C.2020602@broadcom.com \
    --to=aburgess@broadcom.com \
    --cc=daniel.gutson@tallertechnologies.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