diff mbox

Add autocompletion for convenience vars in print and set

Message ID 5384C12C.2020602@broadcom.com
State Not Applicable
Headers show

Commit Message

Andrew Burgess May 27, 2014, 4:45 p.m. UTC
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

Comments

Daniel Gutson May 27, 2014, 8:24 p.m. UTC | #1
On Tue, May 27, 2014 at 1:45 PM, Andrew Burgess <aburgess@broadcom.com> wrote:
> 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

Thanks Andrew!



>
>
>
>
Daniel Gutson Feb. 25, 2016, 9:23 p.m. UTC | #2
(sorry top posting)

Has this patch been applied?

Thanks,

   Daniel.

On Tue, May 27, 2014 at 5:24 PM, Daniel Gutson
<daniel.gutson@tallertechnologies.com> wrote:
> On Tue, May 27, 2014 at 1:45 PM, Andrew Burgess <aburgess@broadcom.com> wrote:
>> 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
>
> Thanks Andrew!
>
>
>
>>
>>
>>
>>
>
>
>
> --
>
> Daniel F. Gutson
> Chief Engineering Officer, SPD
>
>
> San Lorenzo 47, 3rd Floor, Office 5
>
> Córdoba, Argentina
>
>
> Phone: +54 351 4217888 / +54 351 4218211
>
> Skype: dgutson
diff mbox

Patch

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