From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Kettenis To: msnyder@redhat.com Cc: ac131313@cygnus.com, gdb-patches@sources.redhat.com Subject: Re: [PATCH] Fix i386 FPU register conversion code Date: Mon, 30 Jul 2001 14:42:00 -0000 Message-id: <200107302124.f6ULOrq08573@delius.kettenis.local> References: <200107281649.f6SGn6w19068@delius.kettenis.local> <3B6316FC.7D86@redhat.com> <200107282053.f6SKrMn19253@delius.kettenis.local> <3B633A59.6030009@cygnus.com> <3B659A3C.6B29011@cygnus.com> X-SW-Source: 2001-07/msg00728.html Date: Mon, 30 Jul 2001 10:32:44 -0700 From: Michael Snyder Andrew Cagney wrote: > > > Hmm, when I added the assertion, I was under the impression that if > > the virtual type wasn't a floating-point type it would be a GDB > > internal error, hence the gdb_assert. However, this is probably not > > entirely true, since I now think that bogus debug information (e.g. a > > stab that says that an integer variable that lives in a > > floating-point register) might trip the assertion. Printing a warning > > and returning without doing anything is probably better. > > By ``nothing'' I guess you mean do something like zero the destination > buffer :-) Right. Silently fix it up, rather than call abort. Some errors don't warrant terminating a possibly long debug session. I attached should address the concerns of both of you. Checked in on head and branch. Mark Index: ChangeLog from Mark Kettenis * i386-tdep.c (i386_register_convert_to_virtual): Replace assertion with a warning if we're asked to convert towards a non-floating-point type. Zero out the the buffer where the data is supposed to be stored in that case. Index: i386-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/i386-tdep.c,v retrieving revision 1.36 diff -u -p -r1.36 i386-tdep.c --- i386-tdep.c 2001/07/28 17:03:38 1.36 +++ i386-tdep.c 2001/07/30 20:54:33 @@ -1046,7 +1046,13 @@ i386_register_convert_to_virtual (int re DOUBLEST d; /* We only support floating-point values. */ - gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); + if (TYPE_CODE (type) != TYPE_CODE_FLT) + { + warning ("Cannot convert floating-point register value " + "to non-floating-point type."); + memset (to, 0, TYPE_LENGTH (type)); + return; + } /* First add the necessary padding. */ memcpy (buf, from, FPU_REG_RAW_SIZE);