Re: Laziness

Daniel Jacobowitz
2005-10-10T20:50:50Z

On Mon, Oct 10, 2005 at 10:04:09PM +0100, David Lecomber wrote:
> Hi Folks,
>
> Take a simple code with a big array...
>
> #include <stdio.h>
> int main()
> {
> double x[1000][1000];
> printf("hello mum");
> }
>
> and ask gdb to "set print elements 1", then break at the printf, and say
> "output x".

This is an inherent problem with the implementation of "set print
elements". It prints only one _visible_ element, possibly with a
<repeats %u times> marker. Search for that in valprint.c to see how
this works.

Perhaps we should redefine set print elements to only print anything
pertaining to the original number of elements.

> Should we really really be reading all that memory, just to print the
> first element? I mean, not only is that slow, but it imposes a memory
> overhead in the GDB too!

Not really, for the latter complaint; we discard them as they're read
in.

--
Daniel Jacobowitz
CodeSourcery, LLC