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]

Re: [RFA] Add handling of null Ada arrays


>   At least in pascal language it is quite
> common to use things like 
> type
>   BigArray = Array [1..0xffffffff] of integer;
> if you want to be sure that you will never get into 
> troubles due to range checking...

That's ... strange :).

>   Of course you cannot allocate a pointer to such a type
> directly, and it would eat up a lot of memory space.

Right. If you did that in Ada, you would immediately trigger
an exception. In fact, I believe that GNAT detects static cases
like this and replaces the code with an exception raise.

How does the above work in Pascal? If the program hasn't "allocated
a pointer to such type", does it mean that the size of the array is
dynamic and grown as needed? I think it's be interesting to understand
how it works underneath if we want to improve the situation for Pascal
too.

On my end, my Pascal days are long behind me (I think the last time
I wrote some Pascal was in 92 or 93), but I thought that Pascal arrays
were allocated when declared and that the bounds could not be changed
after...

> But this kind of types always gave problems inside gdb, because when
> you wanted to look at the value gdb would try to copy the whole
> array...  even if cases where it would only display the first
> elements, which is kind of silly, no?

We had the exact same issue with Ada, actually. Paul Hilfinger
fixed it for us.

The good news is that my patch should avoid GDB trying to allocate
0xffffffff bytes for your array, which usually leads to a debugger
crash ;-).

-- 
Joel


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