This is the mail archive of the gdb-prs@sourceware.org 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]

[Bug exp/15364] regression with "&&"


https://sourceware.org/bugzilla/show_bug.cgi?id=15364

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Burgess <aburgess@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ac775bf4d35b7a2d5715e0ccf3d648d4670213fd

commit ac775bf4d35b7a2d5715e0ccf3d648d4670213fd
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Tue May 24 16:17:52 2016 +0100

    gdb: Forward VALUE_LVAL when avoiding side effects for STRUCTOP_PTR

    Assume that we have a C program like this:

      struct foo_type
      {
        int var;
      } foo;

      struct foo_type *foo_ptr = &foo;

      int
      main ()
      {
        return foo_ptr->var;
      }

    Then GDB should be able to evaluate the following, however, it currently
    does not:

      (gdb) start
      ...
      (gdb) whatis &(foo_ptr->var)
      Attempt to take address of value not located in memory.

    The problem is that in EVAL_AVOID_SIDE_EFFECTS mode,
    eval.c:evaluate_subexp_standard always returns a not_lval value as the
    result for a STRUCTOP_PTR operation. As a consequence, the rest of
    the code believes that one cannot take the address of the returned
    value.

    This patch fixes STRUCTOP_PTR handling so that the VALUE_LVAL
    attribute for the returned value is properly initialized.  After this
    change, the above session becomes:

      (gdb) start
      ...
      (gdb) whatis &(foo_ptr->var)
      type = int *

    This commit is largely the same as commit 2520f728b710 (Forward
    VALUE_LVAL when avoiding side effects for STRUCTOP_STRUCT) but applied
    to STRUCTOP_PTR rather than STRUCTOP_STRUCT.  Both of these commits are
    building on top of commit ac1ca910d74d (Fixes for PR exp/15364).

    gdb/ChangeLog:

        * eval.c (evaluate_subexp_standard): If EVAL_AVOID_SIDE_EFFECTS
        mode, forward the VALUE_LVAL attribute to the returned value in
        the STRUCTOP_PTR case.

    gdb/testsuite/ChangeLog:

        * gdb.base/whatis.c: Extend the test case.
        * gdb.base/whatis.exp: Add additional tests.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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