This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit/Ada] fix string comparison with string slice


This patch is a minor bug fix. Assuming "String_Var" is a string,
trying to compare a slice of that string with another string
used to fail:

    (gdb) p String_Var (1 .. 3) = "hel"
    Attempt to compare array with non-array

The error was due to the fact that the code doing the comparison
does not know how to handle array references. So the fix was to
dereference any reference before doing the comparison.

2008-01-02  Joel Brobecker  <brobecker@adacore.com>

        * ada-lang.c (ada_value_equal): Dereference reference types when
        comparing arrays.
 
I also wrote a testcase:

2008-01-02  Joel Brobecker  <brobecker@adacore.com>

        * gdb.ada/str_cmp_ref/pck.ads, gdb.ada/str_cmp_ref/foo.adb: 
        New files.
        * gdb.ada/str_cmp_ref.exp: New testcase.

All tested on x86-linux, no regression. Checked in.

Cheers!
-- 
Joel

Attachment: str_ref_cmp.diff
Description: Text document

Attachment: str_ref_cmp-testcase.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]