public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Insight (probably gdb) crashes on thumb-2 startup assembly code
@ 2011-02-26  7:40 Gene Smith
  2011-02-26 18:57 ` Keith Seitz
  0 siblings, 1 reply; 3+ messages in thread
From: Gene Smith @ 2011-02-26  7:40 UTC (permalink / raw)
  To: insight

When I step into my very early startup code I quickly see this crash in 
gdb or insight:

(gdb) lodnew  #<-- my gdbinit macro to load my code
Loading section .isr_vector, size 0x260 lma 0x0
Loading section .bmark, size 0x24 lma 0x260
Loading section .text, size 0x3888 lma 0x10030000
Loading section .data, size 0x4 lma 0x10033888
Loading section .init_array, size 0x4 lma 0x10040004
Start address 0x0, load size 15124
Transfer rate: 51 KB/sec, 1008 bytes/write.
Loading section .sec1, size 0x10000 lma 0x10030000
Start address 0x0, load size 65536
Transfer rate: 52 KB/sec, 1365 bytes/write.
(gdb) si
0x0000009c in SET_UP ()
(gdb) si
0x0000009e in SET_UP ()
(gdb) si
../../insight_sources/gdb/regcache.c:182: internal-error: register_size: 
Assertion `regnum >= 0 && regnum < (gdbarch_num_regs (gdbarch) + 
gdbarch_num_pseudo_regs (gdbarch))' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)

This is running the insight or gdb built from a recent insight cvs 
snapshot:GNU gdb (GDB) 7.2.50.20110121-cvs
This GDB was configured as "--host=x86_64-unknown-linux-gnu 
--target=arm-none-eabi".

Assembly code associated with C instructions (also thumb-2) has no 
problem, just the startup pure assembly code.

I can step through the same startup code with insight 6.8.1 with no 
crash but it has problems decoding it as thumb-2.

I suspect this is a gdb problem and not really related to insight, but 
thought I would ask here first.

-gene

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

* Re: Insight (probably gdb) crashes on thumb-2 startup assembly code
  2011-02-26  7:40 Insight (probably gdb) crashes on thumb-2 startup assembly code Gene Smith
@ 2011-02-26 18:57 ` Keith Seitz
  2011-02-27 19:44   ` Gene Smith
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2011-02-26 18:57 UTC (permalink / raw)
  To: Gene Smith; +Cc: insight

Hi, Gene,

On 02/25/2011 11:39 PM, Gene Smith wrote:
> ../../insight_sources/gdb/regcache.c:182: internal-error: register_size:
> Assertion `regnum >= 0 && regnum < (gdbarch_num_regs (gdbarch) +
> gdbarch_num_pseudo_regs (gdbarch))' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Quit this debugging session? (y or n)

When you are doing this, do you have ANY windows open (esp the register 
window -- there is some bitrot in there that I have to address)?

If you don't have any other windows open (just console & source), then I 
recommend trying to reproduce with gdb.

Run "[arm-*-]insight -nw" and try it again. If the internal error pops 
up again, it is, as you suspected, a gdb problem. Grab the backtrace 
from the coredump and either file a bug in gdb's bugzilla or ask on the 
gdb@ list.

Keith

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

* Re: Insight (probably gdb) crashes on thumb-2 startup assembly code
  2011-02-26 18:57 ` Keith Seitz
@ 2011-02-27 19:44   ` Gene Smith
  0 siblings, 0 replies; 3+ messages in thread
From: Gene Smith @ 2011-02-27 19:44 UTC (permalink / raw)
  To: insight

Keith Seitz wrote, On 02/26/2011 01:57 PM:
> Hi, Gene,
>
> On 02/25/2011 11:39 PM, Gene Smith wrote:
>> ../../insight_sources/gdb/regcache.c:182: internal-error: register_size:
>> Assertion `regnum >= 0 && regnum < (gdbarch_num_regs (gdbarch) +
>> gdbarch_num_pseudo_regs (gdbarch))' failed.
>> A problem internal to GDB has been detected,
>> further debugging may prove unreliable.
>> Quit this debugging session? (y or n)
>
> When you are doing this, do you have ANY windows open (esp the register
> window -- there is some bitrot in there that I have to address)?

Does it with and without the reg window open.

>
> If you don't have any other windows open (just console & source), then I
> recommend trying to reproduce with gdb.
>
> Run "[arm-*-]insight -nw" and try it again. If the internal error pops
> up again, it is, as you suspected, a gdb problem. Grab the backtrace
> from the coredump and either file a bug in gdb's bugzilla or ask on the
> gdb@ list.

I ran the arm-*-gdb program that is installed when I built insight and 
it also has the problem. Haven't tried the insight -nw since I assume it 
is basically the same.

I was able to "fix" the problem in regcache.c function register_size() 
by commenting out the assert and always setting size to 4 (size of all 
non-fp arm registers). Strangely enough, when I do this the previously 
asserted condition (now signaled by printf) hasn't  occurred.

int
register_size (struct gdbarch *gdbarch, int regnum)
{
   struct regcache_descr *descr = regcache_descr (gdbarch);
   int size;
#if 0 /* original code */
   gdb_assert (regnum >= 0
	      && regnum < (gdbarch_num_regs (gdbarch)
			   + gdbarch_num_pseudo_regs (gdbarch)));
   size = descr->sizeof_register[regnum];
#else /* my "fix" */
   if ( !(regnum >= 0
	      && regnum < (gdbarch_num_regs (gdbarch)
			   + gdbarch_num_pseudo_regs (gdbarch))) )
   {
     printf("Was assert bad regnum = %d\n", regnum);
   }
   size = 4; /* definitely arm specific !! */
#endif
   return size;
}

Also, I just did "cvs update" to the latest insight snapshot. Now 
insight immediately crashes (I see console window appear and then 
disappear when I connect to my remote target, no core file produced). 
But when I run the latest insight snapshot's gdb there is no crash but 
the same assert occurs when I step through startup assembly code.

-gene


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

end of thread, other threads:[~2011-02-27 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-26  7:40 Insight (probably gdb) crashes on thumb-2 startup assembly code Gene Smith
2011-02-26 18:57 ` Keith Seitz
2011-02-27 19:44   ` Gene Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).