This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Unary plus


On Wed, Feb 09, 2005 at 10:16:17AM +0000, Nathan Sidwell wrote:
> Hi,
> gdb doesn't parse or evaluate the unary plus operator (but does have one).
> gdb.trace/collection.exp contains such an expression -- 'a[+b]'. This patch
> adds the necessary parsing and evaluation machinery.
> 
> built & tested on i686-px-linux-gnu and an unreleased architecture. ok?

Two comments:

- Could you add a non-tracepoint testcase for this?  I think one good
place would be gdb.cp/userdef.exp.

> ! /* The unary operators +, - and ~.  They free the argument ARG1
> !    (unless it is returned).  */
> ! 
> ! struct value *
> ! value_pos (struct value *arg1)
> ! {
> !   struct type *type;
> ! 
> !   arg1 = coerce_ref (arg1);
> ! 
> !   type = check_typedef (value_type (arg1));
> ! 
> !   if (TYPE_CODE (type) == TYPE_CODE_FLT)
> !     return arg1;

- IIUC, that's not quite right - we need an rvalue here.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]