Bug 17815 - Make fields of self case-insensitive like other pascal variables
Summary: Make fields of self case-insensitive like other pascal variables
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: pascal (show other bugs)
Version: unknown
: P2 normal
Target Milestone: ---
Assignee: Pierre Muller
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-08 08:19 UTC by Pierre Muller
Modified: 2015-05-02 22:40 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Example source code (219 bytes, text/plain)
2015-01-08 08:19 UTC, Pierre Muller
Details
Fix for PR (691 bytes, patch)
2015-01-08 08:28 UTC, Pierre Muller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Muller 2015-01-08 08:19:11 UTC
Created attachment 8056 [details]
Example source code

In the pascal parser, there is special code
that will try to emulate case-insensivity despite the
fact that pascal is not registered as a 'case-insensitive' language.

# Compile attached source code, using Free Pascal compiler

fpc -gs -Mobjfpc test-class-pascal.pas

# Debug it
gdb ./test-class-pascal
.......
(gdb) b TA__CHECK
Breakpoint 1 at 0x40154c: file test-class-pascal.pas, line 23.
(gdb) r
Starting program: E:\pas\test\test-class-pascal.exe
[New Thread 6700.0x1ae0]

Breakpoint 1, TA__CHECK (B=0x1572ee0, this=<error reading variable>)
    at test-class-pascal.pas:23
23        check:=(x < b.x);
(gdb) p this
$1 = (TA) 0x1572ed0
(gdb) p this^
warning: can't find linker symbol for virtual table for `TA' value
$2 = {<TOBJECT> = {_vptr$ = {0x408014, 0x43}}, X = 67, Y = 33}
(gdb) p X
warning: can't find linker symbol for virtual table for `TA' value
$3 = 67
(gdb) p B.X
warning: can't find linker symbol for virtual table for `TA' value
$4 = -1
(gdb) p b.x
warning: can't find linker symbol for virtual table for `TA' value
$5 = -1
(gdb) p x
Type TA has no component named x.
(gdb)
Comment 1 Pierre Muller 2015-01-08 08:28:16 UTC
Created attachment 8057 [details]
Fix for PR
Comment 2 cvs-commit@gcc.gnu.org 2015-04-21 20:20:39 UTC
The master branch has been updated by Pierre Muller <muller@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8aae434443df61440ff5228f5c8fe3e5d4a38798

commit 8aae434443df61440ff5228f5c8fe3e5d4a38798
Author: Pierre Muller <muller@ics.u-strasbg.fr>
Date:   Tue Apr 21 22:10:08 2015 +0200

    Fix pascal behavior for class fields with testcase
    
      Problem reported as PR pascal/17815
    
    Part 1/3: Remember the case pattern that allowed finding a field of this.
    File gdb/p-exp.y modified
    
      This is the fix in the pascal parser (p-exp.y),
    to avoid the error that GDB does find normal variables
    case insensitively, but not fields of this,
    inside a class or object method.
    
    Part 2/3: Add "class" option for pascal compiler
    File gdb/testsuite/lib/pascal.exp
    
    This part of the patch series is unchanged.
    It adds class option to pascal compiler
    which adds the required command line option to
    accept pascal class types.
    
    Part 3/3:
    New file: gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
    New file: gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas
    
      Here is an updated version of this test, using Pedro's suggestions.
    Test to check that PR 17815 is fixed.
Comment 3 Pierre Muller 2015-04-21 20:30:42 UTC
The commit from 2015-04-21 should fix  this issue.
Comment 4 cvs-commit@gcc.gnu.org 2015-05-02 22:40:12 UTC
The gdb-7.9-branch branch has been updated by Pierre Muller <muller@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6ed34db8858cc18a5a941f32f22bb250017c3d48

commit 6ed34db8858cc18a5a941f32f22bb250017c3d48
Author: Pierre Muller <muller@ics.u-strasbg.fr>
Date:   Sat May 2 18:21:50 2015 +0200

    Subject: [PATCH] Fix pascal behavior for class fields with testcase
    
      Problem reported as PR pascal/17815
    
    Part 1/3: Remember the case pattern that allowed finding a field of this.
    File gdb/p-exp.y modified
    
      This is the fix in the pascal parser (p-exp.y),
    to avoid the error that GDB does find normal variables
    case insensitively, but not fields of this,
    inside a class or object method.
    
    Part 2/3: Add "class" option for pascal compiler
    File gdb/testsuite/lib/pascal.exp
    
    This part of the patch series is unchanged.
    It adds class option to pascal compiler
    which adds the required command line option to
    accept pascal class types.
    
    Part 3/3:
    New file: gdb/testsuite/gdb.pascal/case-insensitive-symbols.exp
    New file: gdb/testsuite/gdb.pascal/case-insensitive-symbols.pas
    
      Here is an updated version of this test, using Pedro's suggestions.
    Test to check that PR 17815 is fixed.