This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Patch for cp-valprint.c
- From: Tom Tromey <tromey at redhat dot com>
- To: Chris Moller <cmoller at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 22 Jan 2010 15:07:01 -0700
- Subject: Re: Patch for cp-valprint.c
- References: <4B59DF28.4090306@redhat.com>
- Reply-to: tromey at redhat dot com
>>>>> "Chris" == Chris Moller <cmoller@redhat.com> writes:
Chris> While working on something else, I found the following:
Chris> /* FIXME (alloca): unsafe if baseclass is really really large. */
Chris> gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
Chris> The attached patch replaces that with a xmalloc/xfree pair.
Please send unidiff or context diffs.
I just put "diff -u -N" into my ~/.cvsrc. I've never regretted it.
>> buf = xmalloc (TYPE_LENGTH (baseclass));
>> if (buf) {
>> xfree (buf);
>> buf = NULL;
In gdb you can't generally do pairings like this, due to exceptions.
Instead, you must make a cleanup.
Also, you don't need to check the argument to xfree; xfree handles NULL
pointers fine.
Chris> -FAIL: gdb.base/solib-display.exp: after rerun
Chris> -FAIL: gdb.base/solib-display.exp: after rerun (GDB internal error)
Chris> -PASS: gdb.base/solib-display.exp: break 25
Chris> -FAIL: gdb.base/solib-display.exp: continue (GDB internal error)
Chris> -PASS: gdb.base/solib-display.exp: display main_global
Chris> -PASS: gdb.base/solib-display.exp: display a_local
Chris> -PASS: gdb.base/solib-display.exp: display a_static
Chris> -PASS: gdb.base/solib-display.exp: break 25
Chris> -FAIL: gdb.base/solib-display.exp: continue
Chris> +ERROR: Process no longer exists
Chris> +UNRESOLVED: gdb.base/solib-display.exp: after rerun
Chris> +WARNING: remote_expect statement without a default case?!
Chris> +FAIL: gdb.base/solib-display.exp: Can't run to main (3)
Jan has a patch pending for this.
I don't know about the other changes offhand. Sometimes I re-run the
test suite to see if problems just go away... though I think Jan has put
some work into making this happen less.
Tom