Bug 21827

Summary: Regression: gdb command lookup became case-sensitive; but definitions are forced into lowercase
Product: gdb Reporter: Jeremy Nickurak <source-ware>
Component: expAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: brobecker, simark
Priority: P2    
Version: 8.0   
Target Milestone: 8.0.1   
Host: Target:
Build: Last reconfirmed:

Description Jeremy Nickurak 2017-07-24 16:08:49 UTC
Input:

$ echo -e 'define aSDF\n print "in-func" \n end \n aSDF \n aSDF \n asdf"' | gdb

Expected behavior, as correctly observed in 7.x:

* function gets defined
* function gets called twice

$ echo -e 'define aSDF\n print "in-func" \n end \n aSDF \n aSDF \n asdf"' | gdb
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>.
(gdb) >>(gdb) $1 = "in-func"
(gdb) $2 = "in-func"
(gdb) $3 = "in-func"


Observed behavior, incorrect under 8.x:

* function gets defined but converted to lower-case
* calling function capitalized in the same was as it was defined fails

$ echo -e 'define aSDF\n print "in-func" \n end \n aSDF \n aSDF \n asdf"' | gdb
GNU gdb (GDB) Fedora 8.0-13.fc26
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) >>(gdb) Undefined command: "aSDF".  Try "help".
(gdb) Undefined command: "aSDF".  Try "help".
(gdb) $1 = "in-func"
Comment 1 Jeremy Nickurak 2017-07-24 20:02:28 UTC
simark from IRC pointed out this change as the source of the regression via bisection:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=3d7b173c29900879c9a5958dd6029fd36666e57c

As well as this this thread:

https://sourceware.org/ml/gdb-patches/2017-01/msg00157.html

A couple thoughts:

* If this backwards-incompatible change is desired, it should probably be in the release-notes.

* If case-sensitivity is the desired behavior here, one should probably be able to define a command with a specified case. In my example here, I've specified some upper-case letters in the name of my definition, but it was converted to lowercase at define-time.
Comment 2 Jeremy Nickurak 2017-07-24 20:16:34 UTC
Other strange things that come out of this; The following gdb snippet fails unexpectedly:

define myFunction
   print "hello"
end
document myFunction
Just a dummy test function
end

->

Type "apropos word" to search for commands related to "word".
(gdb) define myFunction
Type commands for definition of "myFunction".
End with a line saying just "end".
>   print "hello"
>end
(gdb) document myFunction
Undefined command: "myFunction".  Try "help".
Comment 4 Joel Brobecker 2017-08-29 07:29:31 UTC
Also pushed to the gdb-8.0-branch in time for the 8.0.1 release. So adjusting the target milestone accordingly.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=95eeca3bccb6121c201183e21cb5fc39a6b711a2