* [RFA] Update D10V target to use new Harvardized type casts.
@ 2001-11-05 12:15 Michael Snyder
2001-11-05 14:48 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2001-11-05 12:15 UTC (permalink / raw)
To: gdb-patches; +Cc: cagney, jimb
This one-line change lets the D10V back-end recognize the new
Harvardized type casts eg. "(@code int *)", so that a pointer
can be forced into the address space of choice.
The exact same change can be used for (most) other Harvard back-ends.
2001-11-14 Michael Snyder <msnyder@redhat.com>
* d10v-tdep.c (d10v_pointer_to_address): Use new type flag
TYPE_FLAG_CODE_SPACE to recognize a pointer that has been cast
into the instruction address space.
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.25
diff -p -r1.25 d10v-tdep.c
*** d10v-tdep.c 2001/10/15 18:18:29 1.25
--- d10v-tdep.c 2001/11/14 20:56:37
*************** d10v_pointer_to_address (struct type *ty
*** 413,419 ****
/* Is it a code address? */
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
! || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
return d10v_make_iaddr (addr);
else
return d10v_make_daddr (addr);
--- 413,420 ----
/* Is it a code address? */
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
! || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD ||
! (TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_CODE_SPACE) != 0)
return d10v_make_iaddr (addr);
else
return d10v_make_daddr (addr);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [RFA] Update D10V target to use new Harvardized type casts.
2001-11-05 12:15 [RFA] Update D10V target to use new Harvardized type casts Michael Snyder
@ 2001-11-05 14:48 ` Andrew Cagney
2001-11-05 15:37 ` Michael Snyder
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2001-11-05 14:48 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches, cagney, jimb
> This one-line change lets the D10V back-end recognize the new
> Harvardized type casts eg. "(@code int *)", so that a pointer
> can be forced into the address space of choice.
>
> The exact same change can be used for (most) other Harvard back-ends.
(I quit as d10v maintainer :-)
Yes, looks ok.
One thought, though, should that test:
... == FUNC || ... == METHOD || ... == CODE_SPACE
be abstracted out? Every harvard target I've looked at has had that
same test.
Andrew
> 2001-11-14 Michael Snyder <msnyder@redhat.com>
>
> * d10v-tdep.c (d10v_pointer_to_address): Use new type flag
> TYPE_FLAG_CODE_SPACE to recognize a pointer that has been cast
> into the instruction address space.
>
> Index: d10v-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
> retrieving revision 1.25
> diff -p -r1.25 d10v-tdep.c
> *** d10v-tdep.c 2001/10/15 18:18:29 1.25
> --- d10v-tdep.c 2001/11/14 20:56:37
> *************** d10v_pointer_to_address (struct type *ty
> *** 413,419 ****
>
> /* Is it a code address? */
> if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
> ! || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
> return d10v_make_iaddr (addr);
> else
> return d10v_make_daddr (addr);
> --- 413,420 ----
>
> /* Is it a code address? */
> if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
> ! || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD ||
> ! (TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_CODE_SPACE) != 0)
> return d10v_make_iaddr (addr);
> else
> return d10v_make_daddr (addr);
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] Update D10V target to use new Harvardized type casts.
2001-11-05 14:48 ` Andrew Cagney
@ 2001-11-05 15:37 ` Michael Snyder
2001-11-05 15:52 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2001-11-05 15:37 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches, cagney, jimb
Andrew Cagney wrote:
>
> > This one-line change lets the D10V back-end recognize the new
> > Harvardized type casts eg. "(@code int *)", so that a pointer
> > can be forced into the address space of choice.
> >
> > The exact same change can be used for (most) other Harvard back-ends.
>
> (I quit as d10v maintainer :-)
>
> Yes, looks ok.
Committed.
> One thought, though, should that test:
>
> ... == FUNC || ... == METHOD || ... == CODE_SPACE
>
> be abstracted out? Every harvard target I've looked at has had that
> same test.
Possible. Although it's only a few lines, so far they have shaken out
as pretty generically useful. Can't think where they would go though...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] Update D10V target to use new Harvardized type casts.
2001-11-05 15:37 ` Michael Snyder
@ 2001-11-05 15:52 ` Andrew Cagney
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2001-11-05 15:52 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches, cagney, jimb
>> One thought, though, should that test:
>>
>> ... == FUNC || ... == METHOD || ... == CODE_SPACE
>>
>> be abstracted out? Every harvard target I've looked at has had that
>> same test.
>
>
> Possible. Although it's only a few lines, so far they have shaken out
> as pretty generically useful. Can't think where they would go though...
I'd guess a simple predicate function in gdbtypes.h + gdbtypes.c. The
reason for suggesting it is that I've been tweeking random targets so
that they get the lines right.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-11-15 2:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-05 12:15 [RFA] Update D10V target to use new Harvardized type casts Michael Snyder
2001-11-05 14:48 ` Andrew Cagney
2001-11-05 15:37 ` Michael Snyder
2001-11-05 15:52 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox