logo       

Re: c++/1210: Printing fails/aborts for some attributes (Cannot access memo: msg#00018

Subject: Re: c++/1210: Printing fails/aborts for some attributes (Cannot access memory at address)
The following reply was made to PR c++/1210; it has been noted by GNATS.

From: Michael Bjerking <michaelbjerking@xxxxxxxxxxx>
To: gdb-gnats@xxxxxxxxxxxxxxxxxx
Cc:  
Subject: Re: c++/1210: Printing fails/aborts for some attributes (Cannot
        access memory at address)
Date: Sat, 18 Mar 2006 09:50:03 +0100

 This bug still exist in gdb v6.3.50 and 6.4.50.20060316 !?
 
 Here is output from the testsuite:
 
 mbj@linux:~/gdb-6.4.50.20060316/gdb/testsuite/gdb.cp> runtest
 pr-1210.exp
 WARNING: No tool specified
 Test Run By mbj on Sat Mar 18 09:33:31 2006
 Native configuration is i686-suse-linux
 
                 ===  tests ===
 
 Schedule of variations:
     unix
 
 Running target unix
 Using /usr/share/dejagnu/baseboards/unix.exp as board description file
 for target.
 Using /usr/share/dejagnu/config/unix.exp as generic interface file for
 target.
 Using ./../config/unix.exp as tool-and-target-specific interface file.
 Running ./pr-1210.exp ...
 FAIL: print *obj
 FAIL: print obj->myB
 
                 ===  Summary ===
 
 # of expected passes            1
 # of unexpected failures        2
 ===================================================
 
 
 I have also a very simple example where the problem is accuring:
 
 > cat main.cpp
 #include <iostream>
 
 using namespace std;
 
 class Info {
 public:
     int i_;
     int geti();
 };
 
 class Base {
     int a_;
     double b_;
     Info id_;
 
 public:
     Base() { id_.i_ = 10; }
     int geta() { return a_; }
     double getb() { return b_; }
     Info id() { return id_; }
 };
 
 int
 Info::geti() {
     return i_;
 }
 
 int main()
 {
     Base base;
 
     cout << "Start" << endl;
     cout << base.id().geti() << endl;
     cout << "End" << endl;
 
     return 0;
 }
 ===================================================
 > cat Makefile
 GCC = g++
 CCFLAGS = -g -ggdb
 
 
 
 all: main
 
 main: main.o
         $(GCC) $(CCFLAGS) main.o -o main
 
 main.o: main.cpp
         $(GCC) $(CCFLAGS) -o main.o -c main.cpp
 
 clean:
         rm main.o
         rm main
 ===================================================
 
 mbj@linux:~/moduletesting> gdb main
 GNU gdb 6.4.50.20060316
 Copyright (C) 2006 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you
 are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for
 details.
 This GDB was configured as "--host= --target=i686-pc-linux-gnu"...Using
 host libthread_db library "/lib/tls/libthread_db.so.1".
 
 (gdb) b main
 Breakpoint 1 at 0x80486ee: file main.cpp, line 30.
 (gdb) r
 Starting program: /home/mbj/moduletesting/main
 
 Breakpoint 1, main () at main.cpp:30
 30          Base base;
 (gdb) n
 32          cout << "Start" << endl;
 (gdb) n
 Start
 33          cout << base.id().geti() << endl;
 (gdb) n
 10
 34          cout << "End" << endl;
 (gdb) p base.id().geti()
 Attempt to take address of value not located in memory.
 (gdb)
 
 
 
 
 
 
 
 



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe