Re: Insight (probably gdb) crashes on thumb-2 startup assembly code
Gene Smith <[email protected]>
| Newsgroups | gmane.comp.debugging.insight |
|---|---|
| Message-ID | <[email protected]> |
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