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 c++/16597] Segfault when inspecting boost variable


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

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  fe28be73c7c22cc6eb1c3573f1be65c75e37d9b7 (commit)
      from  8056826a68e7cb370425c56703a52af98fa159fe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

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

commit fe28be73c7c22cc6eb1c3573f1be65c75e37d9b7
Author: Keith Seitz <keiths@redhat.com>
Date:   Wed Apr 16 14:12:22 2014 -0700

    PR c++/16597

    If lookup_symbol_file tries to locate a member variable with NULL name:

          /* A simple lookup failed.  Check if the symbol was defined in
             a base class.  */

          cleanup = make_cleanup (null_cleanup, NULL);

          /* Find the name of the class and the name of the method,
             variable, etc.  */
          prefix_len = cp_entire_prefix_len (name);

          /* If no prefix was found, search "this".  */
          if (prefix_len == 0)
            {
              struct type *type;
              struct symbol *this;

             this = lookup_language_this (language_def (language_cplus),
block);
              if (this == NULL)
                {
                  do_cleanups (cleanup);
                  return NULL;
                }

              type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (this)));
              klass = xstrdup (TYPE_NAME (type));
              nested = xstrdup (name);
            }

    TYPE_NAME (type) is NULL, so xstrdup (NULL) and boom!

    This can happen, e.g., with clang++.  See
testsuite/gdb.cp/namelessclass.exp
    or the bugzilla report.

    This patch simply adds a fencepost against this case, allowing the caller
    of lookup_symbol_file to search other blocks for the right symbol.

-----------------------------------------------------------------------

Summary of changes:
 gdb/testsuite/gdb.cp/namelessclass.S   |  890 ++++++++++++++++++++++++++++++++
 gdb/testsuite/gdb.cp/namelessclass.cc  |   46 ++
 gdb/testsuite/gdb.cp/namelessclass.exp |   52 ++
 3 files changed, 988 insertions(+), 0 deletions(-)
 create mode 100644 gdb/testsuite/gdb.cp/namelessclass.S
 create mode 100644 gdb/testsuite/gdb.cp/namelessclass.cc
 create mode 100644 gdb/testsuite/gdb.cp/namelessclass.exp

-- 
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]