[PATCH] Unary plus
Daniel Jacobowitz
drow@false.org
Sun Feb 27 04:22:00 GMT 2005
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
More information about the Gdb-patches
mailing list