public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11702] New: static const member is not printed
@ 2010-06-13 20:49 jan dot kratochvil at redhat dot com
  2010-06-29 17:09 ` [Bug c++/11702] " dje at google dot com
  2010-06-29 17:11 ` dje at google dot com
  0 siblings, 2 replies; 3+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2010-06-13 20:49 UTC (permalink / raw)
  To: gdb-prs

class C { static const int i = 1; } c;

 <2><37>: Abbrev Number: 3 (DW_TAG_member)
    <38>   DW_AT_name        : i	
    <40>   DW_AT_type        : <0x49>	
    <44>   DW_AT_external    : 1	
    <45>   DW_AT_accessibility: 3	(private)
    <46>   DW_AT_declaration : 1	
    <47>   DW_AT_const_value : 1	

(gdb) ptype c
type = class C {
    static const int i;
}

(gdb) p c
$2 = {static i = <optimized out>}
(gdb) p c.i
field i is nonexistent or has been optimised out

But GDB should print the constant value 1.

enum field_loc_kind
  {
    FIELD_LOC_KIND_BITPOS,      /* bitpos */
    FIELD_LOC_KIND_PHYSADDR,    /* physaddr */
    FIELD_LOC_KIND_PHYSNAME,    /* physname */
    FIELD_LOC_KIND_DWARF_BLOCK  /* dwarf_block */
  };
Some FIELD_LOC_KIND_CONST or an assembled dwarf block is needed in
dwarf2_add_field().

-- 
           Summary: static const member is not printed
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: jan dot kratochvil at redhat dot com
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=11702

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug c++/11702] static const member is not printed
  2010-06-13 20:49 [Bug c++/11702] New: static const member is not printed jan dot kratochvil at redhat dot com
@ 2010-06-29 17:09 ` dje at google dot com
  2010-06-29 17:11 ` dje at google dot com
  1 sibling, 0 replies; 3+ messages in thread
From: dje at google dot com @ 2010-06-29 17:09 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2010-06-29 16:53 -------
Subject: Bug 11702

CVSROOT:	/cvs/src
Module name:	src
Changes by:	devans@sourceware.org	2010-06-29 16:53:10

Modified files:
	gdb            : ChangeLog NEWS dwarf2read.c gdbtypes.c symtab.c 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.cp: m-static.exp m-static.h 

Log message:
	PR c++/11702
	* NEWS: Add entry.
	* dwarf2read.c (dwarf2_add_field): If DW_AT_const_value is present,
	create a symbol for the field and record the value.
	(new_symbol): Handle DW_TAG_member.
	* gdbtypes.c (field_is_static): Remove FIXME.
	* symtab.c (search_symbols): When searching for VARIABLES_DOMAIN,
	only ignore LOC_CONST symbols that are enums.
	
	testsuite/
	Test PR c++/11702.
	* gdb.cp/m-static.exp: Add testcase.
	* gdb.cp/m-static.h (gnu_obj_4): Add initialized static const member.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11950&r2=1.11951
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/NEWS.diff?cvsroot=src&r1=1.388&r2=1.389
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&r1=1.407&r2=1.408
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/gdbtypes.c.diff?cvsroot=src&r1=1.193&r2=1.194
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/symtab.c.diff?cvsroot=src&r1=1.239&r2=1.240
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2363&r2=1.2364
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/m-static.exp.diff?cvsroot=src&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/m-static.h.diff?cvsroot=src&r1=1.2&r2=1.3


------- Additional Comments From dje at google dot com  2010-06-29 17:09 -------
Fixed with this patch:
http://sourceware.org/ml/gdb-patches/2010-06/msg00677.html


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=11702

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug c++/11702] static const member is not printed
  2010-06-13 20:49 [Bug c++/11702] New: static const member is not printed jan dot kratochvil at redhat dot com
  2010-06-29 17:09 ` [Bug c++/11702] " dje at google dot com
@ 2010-06-29 17:11 ` dje at google dot com
  1 sibling, 0 replies; 3+ messages in thread
From: dje at google dot com @ 2010-06-29 17:11 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at google dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11702

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2010-06-29 17:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-13 20:49 [Bug c++/11702] New: static const member is not printed jan dot kratochvil at redhat dot com
2010-06-29 17:09 ` [Bug c++/11702] " dje at google dot com
2010-06-29 17:11 ` dje at google dot com

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