public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Modifying a verboten register
@ 2006-05-04 14:45 Shaun Jackman
  2006-05-04 14:52 ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Shaun Jackman @ 2006-05-04 14:45 UTC (permalink / raw)
  To: gdb

Targetted for arm-elf, gdb does not let me modify the cpsr register
outside of a "normal" frame.

(gdb) p/x $cpsr=0x3f
Value being assigned to is no longer active.

I first reported this bug one year ago on 2005-04-20. So first thing
first, a wee anniversary party for the bug. *weeeeeeeeezzzzzzzzzzzzz*
(That was a noise maker.)

Parties aside, the JTAG interface I use (BDI2000) has a command mode
(Telnet interface) that I can use to modify the register. GDB seems to
cache its view of the registers though.

(gdb) p/x $cpsr
$1 = 0xd7

[in a galaxy far, far away]
BDI>rm cpsr 0x3f
BDI>rd cpsr
cpsr: 0x0000003f  63

(gdb) p/x $cpsr
$2 = 0xd7

I don't really expect two separate tools to cooperate to debug the
same core, but I'm scrambling for some (any) workaround to the above
bug. I quite literally see it *every* day. It makes my head hurt.

Cheers,
Shaun

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

* Re: Modifying a verboten register
  2006-05-04 14:45 Modifying a verboten register Shaun Jackman
@ 2006-05-04 14:52 ` Daniel Jacobowitz
  2006-05-04 15:15   ` Shaun Jackman
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-05-04 14:52 UTC (permalink / raw)
  To: Shaun Jackman; +Cc: gdb

On Thu, May 04, 2006 at 08:45:44AM -0600, Shaun Jackman wrote:
> Targetted for arm-elf, gdb does not let me modify the cpsr register
> outside of a "normal" frame.
> 
> (gdb) p/x $cpsr=0x3f
> Value being assigned to is no longer active.

I posted an explanation of this problem on gdb-patches yesterday, as it
happens, with a nasty hack.

> Parties aside, the JTAG interface I use (BDI2000) has a command mode
> (Telnet interface) that I can use to modify the register. GDB seems to
> cache its view of the registers though.

Correct.

> (gdb) p/x $cpsr
> $1 = 0xd7
> 
> [in a galaxy far, far away]
> BDI>rm cpsr 0x3f
> BDI>rd cpsr
> cpsr: 0x0000003f  63

Right here, use the flushregs command in GDB.

> (gdb) p/x $cpsr
> $2 = 0xd7

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: Modifying a verboten register
  2006-05-04 14:52 ` Daniel Jacobowitz
@ 2006-05-04 15:15   ` Shaun Jackman
  2006-05-04 15:21     ` Daniel Jacobowitz
  2006-07-12 23:16     ` Shaun Jackman
  0 siblings, 2 replies; 8+ messages in thread
From: Shaun Jackman @ 2006-05-04 15:15 UTC (permalink / raw)
  To: gdb

On 5/4/06, Daniel Jacobowitz <drow@false.org> wrote:
...
> I posted an explanation of this problem on gdb-patches yesterday, as it
> happens, with a nasty hack.

Wonderful news! Thanks, Daniel.

> Right here, use the flushregs command in GDB.

Great! Thanks for pointing this command out to me. I've used this hack
to modify the $cpsr and $pc to set the core back to a good frame. GDB
still has its old frame in its cache though. Is there a command to
re-read the frame from the new register values?

(gdb) f
#0  0x00000010 in ?? ()
BDI>rm cpsr 0xff
BDI>rm pc 0x200ca9a
(gdb) flushregs
Register cache flushed.
(gdb) p/x $cpsr
$24 = 0xff
(gdb) x/i $pc
0x200ca9a <_vfprintf_r+250>:    ldrb    r2, [r7, #0]
(gdb) f
#0  0x00000010 in ?? ()

Thanks,
Shaun

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

* Re: Modifying a verboten register
  2006-05-04 15:15   ` Shaun Jackman
@ 2006-05-04 15:21     ` Daniel Jacobowitz
  2006-07-12 23:16     ` Shaun Jackman
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2006-05-04 15:21 UTC (permalink / raw)
  To: Shaun Jackman; +Cc: gdb

On Thu, May 04, 2006 at 09:15:10AM -0600, Shaun Jackman wrote:
> >Right here, use the flushregs command in GDB.
> 
> Great! Thanks for pointing this command out to me. I've used this hack
> to modify the $cpsr and $pc to set the core back to a good frame. GDB
> still has its old frame in its cache though. Is there a command to
> re-read the frame from the new register values?

Definitely a bug.

I'm not entirely sure, but if someone wants to experiment, I think that
this would work:

  - Search for every call to registers_changed.
  - Replace it with observer_notify_target_changed (&current_target);
    (or something more specific if the current function takes a
    struct target_ops *, I suppose, but that's not important at the
    moment).
  - Delete any flush_cached_frames calls right before the former
    calls to registers_changed, since they are now unnecessary.

I can't think of any situation where the registers may have changed
without invalidating the frame cache.

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: Modifying a verboten register
  2006-05-04 15:15   ` Shaun Jackman
  2006-05-04 15:21     ` Daniel Jacobowitz
@ 2006-07-12 23:16     ` Shaun Jackman
  2008-02-29 11:13       ` Shaun Jackman
  1 sibling, 1 reply; 8+ messages in thread
From: Shaun Jackman @ 2006-07-12 23:16 UTC (permalink / raw)
  To: gdb

On 5/4/06, Shaun Jackman <sjackman@gmail.com> wrote:
> On 5/4/06, Daniel Jacobowitz <drow@false.org> wrote:
> ...
> > I posted an explanation of this problem on gdb-patches yesterday, as it
> > happens, with a nasty hack.
>
> Wonderful news! Thanks, Daniel.

This patch [1] works for me to work around the `Value being assigned
to is no longer active' bug. Thanks, Daniel.

Cheers,
Shaun

[1] http://sourceware.org/ml/gdb-patches/2006-05/msg00018.html

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

* Re: Modifying a verboten register
  2006-07-12 23:16     ` Shaun Jackman
@ 2008-02-29 11:13       ` Shaun Jackman
  2008-02-29 13:41         ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Shaun Jackman @ 2008-02-29 11:13 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

On Wed, Jul 12, 2006 at 3:16 PM, Shaun Jackman <sjackman@gmail.com> wrote:
> On 5/4/06, Shaun Jackman <sjackman@gmail.com> wrote:
>  > On 5/4/06, Daniel Jacobowitz <drow@false.org> wrote:
>  > ...
>  > > I posted an explanation of this problem on gdb-patches yesterday, as it
>  > > happens, with a nasty hack.
>  >
>  > Wonderful news! Thanks, Daniel.
>
>  This patch [1] works for me to work around the `Value being assigned
>  to is no longer active' bug. Thanks, Daniel.
>
>  Cheers,
>  Shaun
>
>  [1] http://sourceware.org/ml/gdb-patches/2006-05/msg00018.html

Hi Daniel,

Was this patch ever applied to the trunk? I've just checked that the
bug still exists in gdb 6.7. The above patch was from 2006-July circa
gdb 6.5 days.

Cheers,
Shaun

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

* Re: Modifying a verboten register
  2008-02-29 11:13       ` Shaun Jackman
@ 2008-02-29 13:41         ` Daniel Jacobowitz
  2008-02-29 18:22           ` Shaun Jackman
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2008-02-29 13:41 UTC (permalink / raw)
  To: Shaun Jackman; +Cc: gdb

On Thu, Feb 28, 2008 at 08:37:58PM -0800, Shaun Jackman wrote:
> Was this patch ever applied to the trunk? I've just checked that the
> bug still exists in gdb 6.7. The above patch was from 2006-July circa
> gdb 6.5 days.

That patch will not be applied; as I mentioned at the time, it's a
nasty hack.  Unfortunately, no one has had time to work on this
problem.

-- 
Daniel Jacobowitz
CodeSourcery

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

* Re: Modifying a verboten register
  2008-02-29 13:41         ` Daniel Jacobowitz
@ 2008-02-29 18:22           ` Shaun Jackman
  0 siblings, 0 replies; 8+ messages in thread
From: Shaun Jackman @ 2008-02-29 18:22 UTC (permalink / raw)
  To: gdb

On Fri, Feb 29, 2008 at 5:40 AM, Daniel Jacobowitz <drow@false.org> wrote:
> On Thu, Feb 28, 2008 at 08:37:58PM -0800, Shaun Jackman wrote:
>  > Was this patch ever applied to the trunk? I've just checked that the
>  > bug still exists in gdb 6.7. The above patch was from 2006-July circa
>  > gdb 6.5 days.
>
>  That patch will not be applied; as I mentioned at the time, it's a
>  nasty hack.  Unfortunately, no one has had time to work on this
>  problem.

Okay. Well, thanks for the hack in any case.

Cheers,
Shaun

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

end of thread, other threads:[~2008-02-29 18:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-04 14:45 Modifying a verboten register Shaun Jackman
2006-05-04 14:52 ` Daniel Jacobowitz
2006-05-04 15:15   ` Shaun Jackman
2006-05-04 15:21     ` Daniel Jacobowitz
2006-07-12 23:16     ` Shaun Jackman
2008-02-29 11:13       ` Shaun Jackman
2008-02-29 13:41         ` Daniel Jacobowitz
2008-02-29 18:22           ` Shaun Jackman

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).