Re: PING #2: Re: [PATCH 1/3] gdb: New set/show max-value-size command.

Joel Brobecker
2016-02-01T03:21:54Z

> > gdb/ChangeLog:
> >
> > * value.c (max_value_size): New variable.
> > (MIN_VALUE_FOR_MAX_VALUE_SIZE): New define.
> > (show_max_value_size): New function.
> > (check_type_length_before_alloc): New function.
> > (allocate_value_contents): Call check_type_length_before_alloc.
> > (set_value_enclosing_type): Likewise.
> > (_initialize_values): Add set/show handler for max-value-size.
> > * NEWS: Mention new set/show command.
> >
> > gdb/doc/ChangeLog:
> >
> > * gdb.texinfo (Value Sizes): New section.
> > (Data): Add the 'Value Sizes' node to the menu.
> >
> > gdb/testsuite/ChangeLog:
> >
> > * gdb.base/max-value-size.c: New file.
> > * gdb.base/max-value-size.exp: New file.
> > * gdb.base/huge.exp: Disable max-value-size for this test.

Sorry about the delay in reviewing this. Pre-approved after
a couple of trivial fixes...

> > +++ b/gdb/testsuite/gdb.base/max-value-size.c
> > @@ -0,0 +1,26 @@
> > +/* This testcase is part of GDB, the GNU debugger.
> > +
> > + Copyright (C) 2016 Free Software Foundation, Inc.
> > +
> > + This program is free software; you can redistribute it and/or modify
> > + it under the terms of the GNU General Public License as published by
> > + the Free Software Foundation; either version 3 of the License, or
> > + (at your option) any later version.
> > +
> > + This program is distributed in the hope that it will be useful,
> > + but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > + GNU General Public License for more details.
> > +
> > + You should have received a copy of the GNU General Public License
> > + along with this program. If not, see <http://www.gnu.org/licenses/>. */
> > +
> > +char one;
> > +char ten [10];
> > +char one_hundred [100];

Tiny formatting nit: No space before the '[' in the two lines
above.

> > --- a/gdb/value.c
> > +++ b/gdb/value.c
> > @@ -955,13 +955,86 @@ allocate_value_lazy (struct type *type)
> > return val;
> > }
> >
> > +/* The maximum size, in bytes, that GDB will try to allocate for a value.
> > + The initial value of 64k was not selected for any specific reason, it is
> > + just a reasonable starting point. */
> > +
> > +static int max_value_size = 65536; /* 64k bytes */
> > +
> > +/* It is critical that the MAX_VALUE_SIZE is at least as bit as the size of

bit -> big

That's it. Thanks for this patch!
--
Joel