public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] Fix DWARF-3+ DW_AT_accessibility default assumption
@ 2011-01-25 19:38 Jan Kratochvil
  2011-01-26  1:58 ` Jan Kratochvil
  2011-03-08 18:03 ` Jan Kratochvil
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Kratochvil @ 2011-01-25 19:38 UTC (permalink / raw)
  To: gdb-patches

Hi,

GDB regresses on default compiler option -gdwarf-3 on gcc-4.6+ as this gcc
started to omit DW_AT_accessibility for the default value case.  Normal
upstream gcc still has -gdwarf-2 default (Fedora uses -gdwarf-3 default).

No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu.
(There are other regressions to be fixed due to gcc45->gcc46.)

I will check it in in some time.


Thanks,
Jan


-FAIL: gdb.cp/casts.exp: dynamic_cast simple downcast
-FAIL: gdb.cp/casts.exp: dynamic_cast simple downcast to intermediate class
-FAIL: gdb.cp/casts.exp: dynamic_cast unique downcast
-FAIL: gdb.cp/casts.exp: dynamic_cast to sibling
-FAIL: gdb.cp/classes.exp: ptype class default_private_class // wrong access specifier for field: public
-FAIL: gdb.cp/classes.exp: ptype class explicit_private_class // wrong access specifier for field: public
-FAIL: gdb.cp/classes.exp: ptype class mixed_protection_class // wrong access specifier for field: public
-FAIL: gdb.cp/virtfunc.exp: ptype A // wrong access specifier for field: public
-FAIL: gdb.cp/virtfunc.exp: ptype B // wrong access specifier for field: public
-FAIL: gdb.cp/virtfunc.exp: ptype a // wrong access specifier for field: public
-FAIL: gdb.cp/virtfunc.exp: ptype b // wrong access specifier for field: public
-FAIL: gdb.cp/virtfunc.exp: ptype pAa // wrong access specifier for field: public
-FAIL: gdb.cp/virtfunc.exp: ptype pAe // wrong access specifier for field: public
-FAIL: gdb.cp/virtfunc.exp: ptype pBe // wrong access specifier for field: public
-FAIL: gdb.mi/gdb792.exp: list children of class A
-FAIL: gdb.mi/gdb792.exp: list children of A.public
-FAIL: gdb.mi/gdb792.exp: list children of A.private
-FAIL: gdb.mi/gdb792.exp: list children of A.protected
-FAIL: gdb.mi/gdb792.exp: list children of A.protected.b
-FAIL: gdb.mi/gdb792.exp: list children of A.protected.b.public
-FAIL: gdb.mi/gdb792.exp: list children of A.protected.b.private
-FAIL: gdb.mi/gdb792.exp: list children of class C
-FAIL: gdb.python/py-value.exp: python print bool(gdb.parse_and_eval('base').dynamic_cast(gdb.lookup_type('Derived').pointer()))


gdb/
2011-01-25  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix DWARF-3+ DW_AT_accessibility default assumption.
	* dwarf2read.c (dwarf2_add_field): Fix new_field->accessibility for
	cu->header.version >= 3.

--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -6186,13 +6186,25 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
     }
   fip->nfields++;
 
-  /* Handle accessibility and virtuality of field.
-     The default accessibility for members is public, the default
-     accessibility for inheritance is private.  */
-  if (die->tag != DW_TAG_inheritance)
-    new_field->accessibility = DW_ACCESS_public;
+  if (cu->header.version < 3)
+    {
+      /* The default DWARF 2 accessibility for members is public, the default
+	 accessibility for inheritance is private.  */
+
+      if (die->tag != DW_TAG_inheritance)
+	new_field->accessibility = DW_ACCESS_public;
+      else
+	new_field->accessibility = DW_ACCESS_private;
+    }
   else
-    new_field->accessibility = DW_ACCESS_private;
+    {
+      /* DWARF 3 specifies the default accessibility explicitly.  */
+
+      if (die->parent->tag == DW_TAG_class_type)
+	new_field->accessibility = DW_ACCESS_private;
+      else
+	new_field->accessibility = DW_ACCESS_public;
+    }
   new_field->virtuality = DW_VIRTUALITY_none;
 
   attr = dwarf2_attr (die, DW_AT_accessibility, cu);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-21 15:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 19:38 [patch] Fix DWARF-3+ DW_AT_accessibility default assumption Jan Kratochvil
2011-01-26  1:58 ` Jan Kratochvil
2011-03-08 18:03 ` Jan Kratochvil
2011-03-09 11:46   ` revert: " Jan Kratochvil
2011-03-21 15:55     ` reposted: " Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).