Re: [PATCH 2/2] Notice architecture changes even when the register window is not open.
"Andrew Burgess" <[email protected]> Fri, 6 Sep 2013 10:19:43 +0100
| Newsgroups | gmane.comp.debugging.insight |
|---|---|
| Message-ID | <[email protected]> |
On 05/09/2013 8:00 PM, Keith Seitz wrote:
> On 09/05/2013 07:27 AM, Andrew Burgess wrote:
>> I think this a bad situation to be in as, the reg-cache would ideally
>> be hidden from the user of "gdb_reginfo", and secondly, we only
>> really need to update the reg-cache once per architecture change, not
>> many times, which could happen if many users are all trying to keep
>> the reg-cache upto date.
>
> Ouch. I believe at the time, this was never considered. I'm not even
> sure if it was possible. Nonetheless, it clearly *is* possible now, so
> thank you for tracking this down.
>
> BTW, what architecture are you using to trigger this bug?
"Just" x86-64. Once the assert in my previous patch is added it's
easy to see a failure. I configure gdb with "--enable-libmcheck
--enable-targets=all".
$ uname -a
Linux HOSTNAME 2.6.18-274.17.1.el5 #1 SMP Wed Jan 4 22:45:44 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
$ cat hello.c
#include <stdio.h>
int
main ()
{
printf ("Hello World\n");
return 0;
}
$ gcc --version
gcc (GCC) 4.7.2
$ gcc -g -o hello.x86 hello.c
$ gdb -i insight
# Then ...
# File > Open > <Select: hello.x86>
# Run Button (Stops at start of main)
# Registers Button (Assert Fires)
With the assertion removed, the original SEGV I saw was triggered
by: once the register window had opened up I modified the contents of
the rsp register to "0x0", hit return, then closed the register window.
Next I clicked the "Next" button (I wanted to see insight handle a SEGV
in the target application), I see a warning that the target has received a
SIGSEGV, click OK, and then insight crashes, also with a SEGV.
Phew! Obviously there's going to be some randomness depending on memory
layout by the compiler, so it's you might not see the exact behaviour I
saw...
HTH
Andrew