From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Snyder To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: [RFC/RFA] gdb extension for Harvard architectures Date: Wed, 03 Oct 2001 16:54:00 -0000 Message-id: <3BBBA4F5.3BC86FF3@cygnus.com> References: <3BB4D843.A92818B9@cygnus.com> <3BB512A9.6050801@cygnus.com> <3BB5195F.6050603@cygnus.com> <3BBB50C0.BD01BF20@cygnus.com> <3BBB5391.4010001@cygnus.com> <3BBB5E0A.14435A06@cygnus.com> <3BBB641D.4090607@cygnus.com> X-SW-Source: 2001-10/msg00075.html Andrew Cagney wrote: > > > Without change. My contention is that the user is almost never going to > >> want to do what you just described. Why make what the user is going to > >> want to do hard? > > > > > > This whole change was prompted by a user's request to be able > > to do just that. Well, actually, he wanted to be able to do > > > > set *(@code short *) myfunction = 0xabcd > > I think everyone is in agreement that not being able to frob an > instruction location is a ``breakage''. Can I guess they entered: > > set *(short *) myfunc = 0xabcd > > I would. And as I'm doing now, I would also be asking why I have to > explicitly specify @code, when the cast operator already knows that my > pointer is designating code space. Your intuition is counter to what GCC actually implements. Your hypothetical user might have the same intuition as you, but if he's using GCC, then his intuition may actually be the source of the bug he's trying to debug. GCC evaluates the expression: x = *(int *) &main; by taking a value from data space. I think GDB should be able to cut and paste the expression from the source code and give the same result that the compiler gives.