* dwarf2read.c (dwarf2_compute_name): Check that the first
authorDaniel Jacobowitz <drow@false.org>
Wed, 8 Sep 2010 23:34:11 +0000 (23:34 +0000)
committerDaniel Jacobowitz <drow@false.org>
Wed, 8 Sep 2010 23:34:11 +0000 (23:34 +0000)
argument is a pointer.

gdb/ChangeLog
gdb/dwarf2read.c

index 63814faa07f54fd37e4d9e7f19a776196b75be56..ece5ab70dc8929d940cfe1d09be66fd23561e299 100644 (file)
@@ -1,3 +1,8 @@
+2010-09-08  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * dwarf2read.c (dwarf2_compute_name): Check that the first
+       argument is a pointer.
+
 2010-09-08  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * dwarf2read.c (read_func_scope, read_structure_type)
index cfe42d62333fefe0b3e23ec58326466a8f388d96..f727c9dd3f6cdc6374734afbdf1ad28cecf93fcc 100644 (file)
@@ -4848,8 +4848,14 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
                }
              else if (cu->language == language_cplus)
                {
+                 /* Assume that an artificial first parameter is
+                    "this", but do not crash if it is not.  RealView
+                    marks unnamed (and thus unused) parameters as
+                    artificial; there is no way to differentiate
+                    the two cases.  */
                  if (TYPE_NFIELDS (type) > 0
                      && TYPE_FIELD_ARTIFICIAL (type, 0)
+                     && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_PTR
                      && TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0))))
                    fputs_unfiltered (" const", buf);
                }