[RFA] Add "fin" alias for "finish"

Joel Brobecker
2008-05-21T04:50:45Z

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

Hello,

I was wondering if others out there were used to using "fin" as
an abbreviation of "finish". Since the addition of the "find" command,
this has become ambiguous, and so now the minimum abbreviation is "fini".
I think it would be nice to keep the "fin" abbreviation, so this patch
adds a new "fin" alias as an abbreviation of the "finish" command.

2008-05-20 Joel Brobecker <brobecker@adacore.com>

* infcmd.c (_initialize_infcmd): Add new "fin" alias for "finish".

2008-05-20 Joel Brobecker <brobecker@adacore.com>

* gdb.base/finish.exp: Test that "fin" works as an abbreviation
of the "finish" command.

And the associated doc update (Hello Eli! :):

2008-05-20 Joel Brobecker <brobecker@adacore.com>

* gdb.texinfo (Continuing and Stepping): Document the new "fin"
abbreviation for "finish".

Tested on x86-linux without any regression. OK to apply?

Thanks,
--
Joel

[-- Attachment #2: fin.diff --]
[-- Type: text/plain, Size: 661 bytes --]

Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.182
diff -u -p -r1.182 infcmd.c
--- infcmd.c 6 May 2008 21:34:59 -0000 1.182
+++ infcmd.c 21 May 2008 04:42:56 -0000
@@ -2251,6 +2251,7 @@ Argument N means do this N times (or til
add_com ("finish", class_run, finish_command, _("\
Execute until selected stack frame returns.\n\
Upon return, the value returned is printed and put in the value history."));
+ add_com_alias ("fin", "finish", class_run, 1);

add_com ("next", class_run, next_command, _("\
Step program, proceeding through subroutine calls.\n\

[-- Attachment #3: fin-tc.diff --]
[-- Type: text/plain, Size: 1018 bytes --]

Index: testsuite/gdb.base/finish.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/finish.exp,v
retrieving revision 1.10
diff -u -p -r1.10 finish.exp
--- testsuite/gdb.base/finish.exp 1 Jan 2008 22:53:19 -0000 1.10
+++ testsuite/gdb.base/finish.exp 21 May 2008 04:43:58 -0000
@@ -97,6 +97,21 @@ proc finish_void { } {
}
}

+# A function that tests that the given ABBREV is a working abbreviation
+# of the "finish" command.
+
+proc finish_abbreviation { abbrev } {
+
+ if { ! [ runto "int_func" ] } then {
+ fail "running to int_func"
+ return -1
+ }
+
+ gdb_test "$abbrev" \
+ "Value returned is .* = 1" \
+ "Testing the \"$abbrev\" abbreviation for \"finish\""
+}
+
proc finish_tests { } {
global gdb_prompt

@@ -113,6 +128,7 @@ proc finish_tests { } {
finish_1 "long_long"
finish_1 "float"
finish_1 "double"
+ finish_abbreviation "fin"
}

# Start with a fresh gdb.

[-- Attachment #4: fin-doc.diff --]
[-- Type: text/plain, Size: 758 bytes --]

Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.495
diff -u -p -r1.495 gdb.texinfo
--- doc/gdb.texinfo 9 May 2008 17:02:01 -0000 1.495
+++ doc/gdb.texinfo 21 May 2008 04:43:39 -0000
@@ -4127,9 +4127,11 @@ Show whether @value{GDBN} will stop in o
source line debug information.

@kindex finish
+@kindex fin @r{(@code{finish})}
@item finish
Continue running until just after function in the selected stack frame
-returns. Print the returned value (if any).
+returns. Print the returned value (if any). This command is abbreviated
+@code{fin}.

Contrast this with the @code{return} command (@pxref{Returning,
,Returning from a Function}).