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

* Re: [patch] Fix DWARF-3+ DW_AT_accessibility default assumption
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Kratochvil @ 2011-01-26  1:58 UTC (permalink / raw)
  To: gdb-patches

On Tue, 25 Jan 2011 20:37:48 +0100, Jan Kratochvil wrote:
> 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).

More info at:
https://bugzilla.redhat.com/show_bug.cgi?id=672157
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45124


Regards,
Jan

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

* Re: [patch] Fix DWARF-3+ DW_AT_accessibility default assumption
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2011-03-08 18:03 UTC (permalink / raw)
  To: gdb-patches

On Tue, 25 Jan 2011 20:37:48 +0100, Jan Kratochvil wrote:
> 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).
[...]
> I will check it in in some time.
[...]
> 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.

Checked in.  Dealing with testsuite results on FSF GDB was difficult.
	http://sourceware.org/ml/gdb-cvs/2011-03/msg00115.html


Thanks,
Jan

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

* revert: Re: [patch] Fix DWARF-3+ DW_AT_accessibility default assumption
  2011-03-08 18:03 ` Jan Kratochvil
@ 2011-03-09 11:46   ` Jan Kratochvil
  2011-03-21 15:55     ` reposted: " Jan Kratochvil
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2011-03-09 11:46 UTC (permalink / raw)
  To: gdb-patches

On Tue, 08 Mar 2011 18:55:50 +0100, Jan Kratochvil wrote:
> Checked in.  Dealing with testsuite results on FSF GDB was difficult.
> 	http://sourceware.org/ml/gdb-cvs/2011-03/msg00115.html

Reverted.  It broke compatibility with `gcc-4.5 -gdwarf-3'.

gcc-4.5 violates DWARF:
 <1><2d>: Abbrev Number: 2 (DW_TAG_class_type)
    <2e>   DW_AT_name        : C        
    <30>   DW_AT_byte_size   : 4        
 <2><37>: Abbrev Number: 3 (DW_TAG_member)
    <38>   DW_AT_name        : (indirect string, offset: 0x0): public_  
    <3e>   DW_AT_type        : <0x44>   
    <42>   DW_AT_data_member_location: 0        

DWARF-4 specifies:
An inheritance entry may have a DW_AT_accessibility attribute. If no
accessibility attribute is present, private access is assumed for an entry of a
class and public access is assumed for an entry of an interface, struct or
union.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45124


There will probably need to be a DW_AT_producer check.


Sorry,
Jan


http://sourceware.org/ml/gdb-cvs/2011-03/msg00128.html

--- src/gdb/ChangeLog	2011/03/09 06:24:05	1.12775
+++ src/gdb/ChangeLog	2011/03/09 07:07:53	1.12776
@@ -1,3 +1,11 @@
+2011-03-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Revert:
+	2011-03-08  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.
+
 2011-03-09  Yao Qi  <yao@codesourcery.com>
 
 	* common/Makefile.in: Remove.
--- src/gdb/dwarf2read.c	2011/03/08 17:54:44	1.507
+++ src/gdb/dwarf2read.c	2011/03/09 07:07:55	1.508
@@ -6238,25 +6238,13 @@
     }
   fip->nfields++;
 
-  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;
-    }
+  /* 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;
   else
-    {
-      /* 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->accessibility = DW_ACCESS_private;
   new_field->virtuality = DW_VIRTUALITY_none;
 
   attr = dwarf2_attr (die, DW_AT_accessibility, cu);

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

* reposted: Re: revert: Re: [patch] Fix DWARF-3+ DW_AT_accessibility default assumption
  2011-03-09 11:46   ` revert: " Jan Kratochvil
@ 2011-03-21 15:55     ` Jan Kratochvil
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kratochvil @ 2011-03-21 15:55 UTC (permalink / raw)
  To: gdb-patches

repost in a new thread:
	[patch] DWARF-3+ DW_AT_accessibility defaults #2 (GCC PR debug/45124)
	http://sourceware.org/ml/gdb-patches/2011-03/msg00956.html

^ 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).