This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Unary plus
- From: Daniel Jacobowitz <drow at false dot org>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sat, 26 Feb 2005 19:36:08 -0500
- Subject: Re: [PATCH] Unary plus
- References: <4209E2F1.2000504@codesourcery.com>
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