[gvd-devel] Bug in GVD-1.2.4 handling templates and empty structures

Sergey Koshcheyev serko84@hotmail.com
Fri, 08 Feb 2002 11:12:30 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_724a_305b_6965
Content-Type: text/plain; format=flowed

Actually, I UNsuppress the checks in the code below. Though, I have now 
found that unsuppressing the check on Nesting_Level is not necessary. I 
don't know however what to do on erroneous strings where there is no 
matching delimiter - should the code raise an exception (which one?) or 
should it just silently stop after the last character and pretend nothing 
happened?

I'm attaching the test case you asked for. It declares two variables, D of a 
complex type involving template parameters, and EMPTY - an empty structure. 
GVD 1.2.4 using GDB 5.1 can not graph display either variable, GVD 1.2.4 
using GDB 4.17.gnat.3.13p can not display D.

Sergey Koshcheyev.

>From: Arnaud Charlet <charlet@ACT-Europe.FR>
>To: serko84@hotmail.com
>CC: gvd-devel@lists.act-europe.fr
>Subject: Re: [gvd-devel] Bug in GVD-1.2.4 handling templates and empty 
>structures
>Date: Fri, 8 Feb 2002 09:56:10 +0100
>
>Thanks for the patch, we will review it carefully.
>
>One comment though:
>
> > +   -------------------
> > +   -- Skip_Matching --
> > +   -------------------
> > +
> > +   procedure Skip_Matching
> > +     (Type_Str  : String;
> > +      Index     : in out Natural;
> > +      Opening   : Character;
> > +      Closing   : Character)
> > +   is
> > +      Nesting_Level : Natural := 0;
> > +
> > +      --  To catch out-of-bounds access or too many closing delimiters
> > +      pragma Unsuppress (Range_Check, On => Nesting_Level);
> > +      pragma Unsuppress (Index_Check, On => Type_Str);
>
>This isn't very good coding practice to rely on checks being disabled.
>Instead you should make Nesting_Level an integer and add checks for
>Type_Str (suppressing index_check on an array is very dangerous and can 
>lead
>to SEGVs).
>
>Arno




_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

------=_NextPart_000_724a_305b_6965
Content-Type: text/x-c++src; name="test.cc"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="test.cc"

template <class X> class Xt { };
template <class X, class Y> class Yt { };

template<class S, class T>
class Base { };

template<class T>
class Derived : public Base<int, Xt<T> >, public Yt<Xt<int>, T>
{
private:
    Xt<long> a;
    struct abcd
    {
    }
    b;
};

struct EmptyStruct { };

int main ()
{
    Derived<long> d;
    EmptyStruct empty;
}


------=_NextPart_000_724a_305b_6965--