Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Bizarre internal errors in regcache
@ 2002-08-26 11:55 Daniel Jacobowitz
  2002-08-26 12:51 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-08-26 11:55 UTC (permalink / raw)
  To: gdb

I see this error on my laptop but not on my desktop; both current trees,
both rebuilt from scratch, both i386-linux.  Any ideas?

info source
Current source file is ../../../src-gdb/gdb/testsuite/gdb.asm/asmsrc1.s
Located in /home/drow/src/gdb/src-gdb/gdb/testsuite/gdb.asm/asmsrc1.s
Contains 63 lines.
Source language is asm.
Compiled with stabs debugging format.
Does not include preprocessor macro info.
(gdb) PASS: gdb.asm/asm-source.exp: info source asmsrc1.s
finish
Run till exit from #0  foo3 () at ../../../src-gdb/gdb/testsuite/gdb.asm/asmsrc1.s:44
foo2 () at ../../../src-gdb/gdb/testsuite/gdb.asm/asmsrc2.s:13
13		gdbasm_call foo3
../../src-gdb/gdb/regcache.c:472: gdb-internal-error: set_register_cached: Assertion `regnum < current_regcache->descr->nr_raw_registers' failed.
An internal GDB error was detected.  This may make further
debugging unreliable.  Quit this debugging session? (y or n) ERROR: Got interactive prompt.
UNRESOLVED: gdb.asm/asm-source.exp: finish from foo3
n
info source
Create a core file containing the current state of GDB? (y or n) ERROR: Got interactive prompt.
UNRESOLVED: gdb.asm/asm-source.exp: info source asmsrc2.s
n
info sources
Please answer y or n.
Create a core file containing the current state of GDB? (y or n) (gdb) FAIL: gdb.asm/asm-source.exp: info sources

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bizarre internal errors in regcache
  2002-08-26 11:55 Bizarre internal errors in regcache Daniel Jacobowitz
@ 2002-08-26 12:51 ` Daniel Jacobowitz
  2002-08-26 13:28   ` Mark Kettenis
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-08-26 12:51 UTC (permalink / raw)
  To: Mark Kettenis, gdb

On Mon, Aug 26, 2002 at 02:56:39PM -0400, Daniel Jacobowitz wrote:
> I see this error on my laptop but not on my desktop; both current trees,
> both rebuilt from scratch, both i386-linux.  Any ideas?
> 
> info source
> Current source file is ../../../src-gdb/gdb/testsuite/gdb.asm/asmsrc1.s
> Located in /home/drow/src/gdb/src-gdb/gdb/testsuite/gdb.asm/asmsrc1.s
> Contains 63 lines.
> Source language is asm.
> Compiled with stabs debugging format.
> Does not include preprocessor macro info.
> (gdb) PASS: gdb.asm/asm-source.exp: info source asmsrc1.s
> finish
> Run till exit from #0  foo3 () at ../../../src-gdb/gdb/testsuite/gdb.asm/asmsrc1.s:44
> foo2 () at ../../../src-gdb/gdb/testsuite/gdb.asm/asmsrc2.s:13
> 13		gdbasm_call foo3
> ../../src-gdb/gdb/regcache.c:472: gdb-internal-error: set_register_cached: Assertion `regnum < current_regcache->descr->nr_raw_registers' failed.
> An internal GDB error was detected.  This may make further
> debugging unreliable.  Quit this debugging session? (y or n) ERROR: Got interactive prompt.
> UNRESOLVED: gdb.asm/asm-source.exp: finish from foo3
> n
> info source
> Create a core file containing the current state of GDB? (y or n) ERROR: Got interactive prompt.
> UNRESOLVED: gdb.asm/asm-source.exp: info source asmsrc2.s
> n
> info sources
> Please answer y or n.
> Create a core file containing the current state of GDB? (y or n) (gdb) FAIL: gdb.asm/asm-source.exp: info sources

My desktop has SSE, my laptop doesn't, it seems.  We can't call
supply_register on an MMX register if we don't have any. 
dummy_sse_registers seems to be the culprit.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bizarre internal errors in regcache
  2002-08-26 12:51 ` Daniel Jacobowitz
@ 2002-08-26 13:28   ` Mark Kettenis
  2002-08-26 13:54     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Kettenis @ 2002-08-26 13:28 UTC (permalink / raw)
  To: drow; +Cc: gdb

   Date: Mon, 26 Aug 2002 15:52:47 -0400
   From: Daniel Jacobowitz <drow@mvista.com>

   On Mon, Aug 26, 2002 at 02:56:39PM -0400, Daniel Jacobowitz wrote:
   > I see this error on my laptop but not on my desktop; both current trees,
   > both rebuilt from scratch, both i386-linux.  Any ideas?

   [ snip ]

   My desktop has SSE, my laptop doesn't, it seems.  We can't call
   supply_register on an MMX register if we don't have any. 
   dummy_sse_registers seems to be the culprit.

Hmm, and my desktop sort of pretends it has the SSE registers.

Anyway, I'm pretty certain that the problem is caused by the fact that
the binary produced by the gdb.asm test isn't branded.  Therefore GDB
doesn't select the Linux OS/ABI but the generic OS/ABI which doesn't
include the SSE regs.  Since you're running on Linux, the native code
tries to supply these registers anyway.  i387_supply_fxsave() does
deal with this gracefully, but dummy_sse_regs() doesn't.

Can you try the attached patch?

Note that I'm still open to suggestions on what registers to include
in any of the i386 OS/ABI variants.  Ideally we would let the user
choose somehow.  For now I selected something that most closely
resembles what we did in previous GDB releases, although there are
some differences.  For example, on Linux, you'll always get the SSE
registers now.

Any thoughts?

Mark

Index: i386-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
retrieving revision 1.40
diff -u -p -r1.40 i386-linux-nat.c
--- i386-linux-nat.c 15 Jun 2002 16:43:54 -0000 1.40
+++ i386-linux-nat.c 26 Aug 2002 20:11:48 -0000
@@ -540,15 +540,17 @@ store_fpxregs (int tid, int regno)
 static void
 dummy_sse_values (void)
 {
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
   /* C doesn't have a syntax for NaN's, so write it out as an array of
      longs.  */
   static long dummy[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff };
   static long mxcsr = 0x1f80;
   int reg;
 
-  for (reg = 0; reg < 8; reg++)
+  for (reg = 0; reg < tdep->num_xmm_regs; reg++)
     supply_register (XMM0_REGNUM + reg, (char *) dummy);
-  supply_register (MXCSR_REGNUM, (char *) &mxcsr);
+  if (tdep->num_xmm_regs > 0)
+    supply_register (MXCSR_REGNUM, (char *) &mxcsr);
 }
 
 #else


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bizarre internal errors in regcache
  2002-08-26 13:28   ` Mark Kettenis
@ 2002-08-26 13:54     ` Daniel Jacobowitz
  2002-09-01 15:12       ` [PATCH] " Mark Kettenis
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-08-26 13:54 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb

On Mon, Aug 26, 2002 at 10:28:08PM +0200, Mark Kettenis wrote:
>    Date: Mon, 26 Aug 2002 15:52:47 -0400
>    From: Daniel Jacobowitz <drow@mvista.com>
> 
>    On Mon, Aug 26, 2002 at 02:56:39PM -0400, Daniel Jacobowitz wrote:
>    > I see this error on my laptop but not on my desktop; both current trees,
>    > both rebuilt from scratch, both i386-linux.  Any ideas?
> 
>    [ snip ]
> 
>    My desktop has SSE, my laptop doesn't, it seems.  We can't call
>    supply_register on an MMX register if we don't have any. 
>    dummy_sse_registers seems to be the culprit.
> 
> Hmm, and my desktop sort of pretends it has the SSE registers.
> 
> Anyway, I'm pretty certain that the problem is caused by the fact that
> the binary produced by the gdb.asm test isn't branded.  Therefore GDB
> doesn't select the Linux OS/ABI but the generic OS/ABI which doesn't
> include the SSE regs.  Since you're running on Linux, the native code
> tries to supply these registers anyway.  i387_supply_fxsave() does
> deal with this gracefully, but dummy_sse_regs() doesn't.
> 
> Can you try the attached patch?

That patch does it for me.  This also shows up on core dumps, if you
don't include a binary, which is where I first noticed it.


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Re: Bizarre internal errors in regcache
  2002-08-26 13:54     ` Daniel Jacobowitz
@ 2002-09-01 15:12       ` Mark Kettenis
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Kettenis @ 2002-09-01 15:12 UTC (permalink / raw)
  To: drow; +Cc: gdb, gdb-patches

Ok, I checked in that patch, attached here with ChangeLog entry.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* i386-linux-nat.c (dummy_sse_values): Only try to fill in the SSE
	registers if the target really has them.

Index: i386-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
retrieving revision 1.41
diff -u -p -r1.41 i386-linux-nat.c
--- i386-linux-nat.c 27 Aug 2002 22:37:06 -0000 1.41
+++ i386-linux-nat.c 1 Sep 2002 22:04:40 -0000
@@ -541,15 +541,17 @@ store_fpxregs (int tid, int regno)
 static void
 dummy_sse_values (void)
 {
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
   /* C doesn't have a syntax for NaN's, so write it out as an array of
      longs.  */
   static long dummy[4] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff };
   static long mxcsr = 0x1f80;
   int reg;
 
-  for (reg = 0; reg < 8; reg++)
+  for (reg = 0; reg < tdep->num_xmm_regs; reg++)
     supply_register (XMM0_REGNUM + reg, (char *) dummy);
-  supply_register (MXCSR_REGNUM, (char *) &mxcsr);
+  if (tdep->num_xmm_regs > 0)
+    supply_register (MXCSR_REGNUM, (char *) &mxcsr);
 }
 
 #else


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-09-01 22:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-26 11:55 Bizarre internal errors in regcache Daniel Jacobowitz
2002-08-26 12:51 ` Daniel Jacobowitz
2002-08-26 13:28   ` Mark Kettenis
2002-08-26 13:54     ` Daniel Jacobowitz
2002-09-01 15:12       ` [PATCH] " Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox