Fix GDB crash on inferior calls with self-referencing classes.
	* gnu-v3-abi.c (gnuv3_pass_by_reference): Do not call itself on static
	member fields.

gdb/testsuite/
	Fix GDB crash on inferior calls with self-referencing classes.
	* gdb.dwarf2/dw2-cp-infcall-ref-static.exp: New file.
	* gdb.dwarf2/dw2-cp-infcall-ref-static-main.c: New file.
	* gdb.dwarf2/dw2-cp-infcall-ref-static.S: New file.
This commit is contained in:
Jan Kratochvil
2010-09-29 22:32:52 +00:00
parent abc72ce4c6
commit bceffbf360
6 changed files with 231 additions and 2 deletions

View File

@ -835,9 +835,10 @@ gnuv3_pass_by_reference (struct type *type)
by reference, so does this class. Similarly for members, which
are constructed whenever this class is. We do not need to worry
about recursive loops here, since we are only looking at members
of complete class type. */
of complete class type. Also ignore any static members. */
for (fieldnum = 0; fieldnum < TYPE_NFIELDS (type); fieldnum++)
if (gnuv3_pass_by_reference (TYPE_FIELD_TYPE (type, fieldnum)))
if (! field_is_static (&TYPE_FIELD (type, fieldnum))
&& gnuv3_pass_by_reference (TYPE_FIELD_TYPE (type, fieldnum)))
return 1;
return 0;