* [RFC:avr] use regcache instead of read_register
@ 2003-06-20 6:22 Theodore A. Roth
2003-06-20 14:19 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Theodore A. Roth @ 2003-06-20 6:22 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: TEXT/PLAIN, Size: 487 bytes --]
Hi,
The ARI caught this and it seems like a trivial change. There is a bit of
confusion though in the use of current_regcache since the ARI says this:
current regcache 57 Replace current_regcache with explict parameter
What would that explicit parameter be?
If this patch is ok, it brings the ARI count for the AVR down to 0.
Ted Roth
2003-06-19 Theodore A. Roth <troth@openavr.org>
* avr-tdep.c (avr_read_pc): Use regcache instead of read_register.
(avr_read_sp): Ditto.
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1094 bytes --]
2003-06-19 Theodore A. Roth <troth@openavr.org>
* avr-tdep.c (avr_read_pc): Use regcache instead of read_register.
(avr_read_sp): Ditto.
Index: avr-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/avr-tdep.c,v
retrieving revision 1.64
diff -u -r1.64 avr-tdep.c
--- avr-tdep.c 20 Jun 2003 05:53:42 -0000 1.64
+++ avr-tdep.c 20 Jun 2003 06:09:27 -0000
@@ -324,12 +324,12 @@
avr_read_pc (ptid_t ptid)
{
ptid_t save_ptid;
- CORE_ADDR pc;
+ ULONGEST pc;
CORE_ADDR retval;
save_ptid = inferior_ptid;
inferior_ptid = ptid;
- pc = (int) read_register (AVR_PC_REGNUM);
+ regcache_cooked_read_unsigned (current_regcache, AVR_PC_REGNUM, &pc);
inferior_ptid = save_ptid;
retval = avr_make_iaddr (pc);
return retval;
@@ -349,7 +349,10 @@
static CORE_ADDR
avr_read_sp (void)
{
- return (avr_make_saddr (read_register (AVR_SP_REGNUM)));
+ ULONGEST sp;
+
+ regcache_cooked_read_unsigned (current_regcache, AVR_SP_REGNUM, &sp);
+ return (avr_make_saddr (sp));
}
static int
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFC:avr] use regcache instead of read_register
2003-06-20 6:22 [RFC:avr] use regcache instead of read_register Theodore A. Roth
@ 2003-06-20 14:19 ` Andrew Cagney
2003-06-20 17:09 ` Theodore A. Roth
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2003-06-20 14:19 UTC (permalink / raw)
To: Theodore A. Roth; +Cc: gdb-patches
> Hi,
>
> The ARI caught this and it seems like a trivial change. There is a bit of
> confusion though in the use of current_regcache since the ARI says this:
>
> current regcache 57 Replace current_regcache with explict parameter
>
> What would that explicit parameter be?
>
> If this patch is ok, it brings the ARI count for the AVR down to 0.
The patch is great. Don't be too worried about current_regcache for
the moment.
As for what parameter will be added to read_pc, I can give you several
guesses:
- made redundant by unwind_pc(frame)
- replaced with something that takes the thread id and stop status
The underlying problem is decr pc after break. Cleaning up that also
involves read_pc, write_pc, and the update frame pc hack.
Andrew
> 2003-06-19 Theodore A. Roth <troth@openavr.org>
>
> * avr-tdep.c (avr_read_pc): Use regcache instead of read_register.
> (avr_read_sp): Ditto.
>
>
>
>
> 2003-06-19 Theodore A. Roth <troth@openavr.org>
>
> * avr-tdep.c (avr_read_pc): Use regcache instead of read_register.
> (avr_read_sp): Ditto.
>
> Index: avr-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/avr-tdep.c,v
> retrieving revision 1.64
> diff -u -r1.64 avr-tdep.c
> --- avr-tdep.c 20 Jun 2003 05:53:42 -0000 1.64
> +++ avr-tdep.c 20 Jun 2003 06:09:27 -0000
> @@ -324,12 +324,12 @@
> avr_read_pc (ptid_t ptid)
> {
> ptid_t save_ptid;
> - CORE_ADDR pc;
> + ULONGEST pc;
> CORE_ADDR retval;
>
> save_ptid = inferior_ptid;
> inferior_ptid = ptid;
> - pc = (int) read_register (AVR_PC_REGNUM);
> + regcache_cooked_read_unsigned (current_regcache, AVR_PC_REGNUM, &pc);
> inferior_ptid = save_ptid;
> retval = avr_make_iaddr (pc);
> return retval;
> @@ -349,7 +349,10 @@
> static CORE_ADDR
> avr_read_sp (void)
> {
> - return (avr_make_saddr (read_register (AVR_SP_REGNUM)));
> + ULONGEST sp;
> +
> + regcache_cooked_read_unsigned (current_regcache, AVR_SP_REGNUM, &sp);
> + return (avr_make_saddr (sp));
> }
>
> static int
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFC:avr] use regcache instead of read_register
2003-06-20 14:19 ` Andrew Cagney
@ 2003-06-20 17:09 ` Theodore A. Roth
2003-06-20 17:39 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Theodore A. Roth @ 2003-06-20 17:09 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Fri, 20 Jun 2003, Andrew Cagney wrote:
> > Hi,
> >
> > The ARI caught this and it seems like a trivial change. There is a bit of
> > confusion though in the use of current_regcache since the ARI says this:
> >
> > current regcache 57 Replace current_regcache with explict parameter
> >
> > What would that explicit parameter be?
> >
> > If this patch is ok, it brings the ARI count for the AVR down to 0.
>
> The patch is great. Don't be too worried about current_regcache for
> the moment.
>
> As for what parameter will be added to read_pc, I can give you several
> guesses:
>
> - made redundant by unwind_pc(frame)
> - replaced with something that takes the thread id and stop status
>
> The underlying problem is decr pc after break. Cleaning up that also
> involves read_pc, write_pc, and the update frame pc hack.
>
> Andrew
Thanks.
Committed.
I guess a similar change to d10v_read_pc.
Just noticed that the d10v seems to use d10v_unwind_sp instead of
*_read_sp. Is it a direct replacement to replace *_read_sp with
*_unwind_sp? I didn't see that before I did the commit.
Ted Roth
>
>
> > 2003-06-19 Theodore A. Roth <troth@openavr.org>
> >
> > * avr-tdep.c (avr_read_pc): Use regcache instead of read_register.
> > (avr_read_sp): Ditto.
> >
> >
> >
> >
> > 2003-06-19 Theodore A. Roth <troth@openavr.org>
> >
> > * avr-tdep.c (avr_read_pc): Use regcache instead of read_register.
> > (avr_read_sp): Ditto.
> >
> > Index: avr-tdep.c
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/avr-tdep.c,v
> > retrieving revision 1.64
> > diff -u -r1.64 avr-tdep.c
> > --- avr-tdep.c 20 Jun 2003 05:53:42 -0000 1.64
> > +++ avr-tdep.c 20 Jun 2003 06:09:27 -0000
> > @@ -324,12 +324,12 @@
> > avr_read_pc (ptid_t ptid)
> > {
> > ptid_t save_ptid;
> > - CORE_ADDR pc;
> > + ULONGEST pc;
> > CORE_ADDR retval;
> >
> > save_ptid = inferior_ptid;
> > inferior_ptid = ptid;
> > - pc = (int) read_register (AVR_PC_REGNUM);
> > + regcache_cooked_read_unsigned (current_regcache, AVR_PC_REGNUM, &pc);
> > inferior_ptid = save_ptid;
> > retval = avr_make_iaddr (pc);
> > return retval;
> > @@ -349,7 +349,10 @@
> > static CORE_ADDR
> > avr_read_sp (void)
> > {
> > - return (avr_make_saddr (read_register (AVR_SP_REGNUM)));
> > + ULONGEST sp;
> > +
> > + regcache_cooked_read_unsigned (current_regcache, AVR_SP_REGNUM, &sp);
> > + return (avr_make_saddr (sp));
> > }
> >
> > static int
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFC:avr] use regcache instead of read_register
2003-06-20 17:09 ` Theodore A. Roth
@ 2003-06-20 17:39 ` Andrew Cagney
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2003-06-20 17:39 UTC (permalink / raw)
To: Theodore A. Roth; +Cc: gdb-patches
> I guess a similar change to d10v_read_pc.
>
> Just noticed that the d10v seems to use d10v_unwind_sp instead of
> *_read_sp. Is it a direct replacement to replace *_read_sp with
> *_unwind_sp? I didn't see that before I did the commit.
There's currently a catch.
GDB doesn't have a consistent story over what ``info frame'' and "$sp"
should display for the "sp". Like the old "$fp", it can end up
displaying inconsistent values. I've a partial patch to fix it, need to
go back though. However, in the mean time, you can remove read_sp and
see what happens.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-06-20 17:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-20 6:22 [RFC:avr] use regcache instead of read_register Theodore A. Roth
2003-06-20 14:19 ` Andrew Cagney
2003-06-20 17:09 ` Theodore A. Roth
2003-06-20 17:39 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox