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.
PR c++/16597

[forgot to commit/push these with previous push]

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.
PR gdb/15827

Install some sanity checks that sibling DIE offsets are not beyond the
defined limits of the DWARF input buffer in read_partial_die and skip_one_die.

2014-03-20  Keith Seitz  <keiths@redhat.com>

	PR gdb/15827
	* dwarf2read.c (skip_one_die): Check that all relative-offset
	sibling DIEs fall within range of the current reader's buffer.
	(read_partial_die): Likewise.

2014-03-20  Keith Seitz  <keiths@redhat.com>

	PR gdb/15827
	* gdb.dwarf2/corrupt.c: New file.
	* gdb.dwarf2/corrupt.exp: New file.
Remove unused and incorrect macro TYPE_FN_FIELDS.

	* gdbtypes.h: Remove definition of the macro TYPE_FN_FIELDS.
Add the ChangeLog entry missed in 8000c58e455259951daa4370631aa616b367d1a7.