From: Stefano Sabatini <stefano.sabatini-lala@poste.it>
To: gdb@sourceware.org, gdb Mailing List <gdb@sources.redhat.com>
Subject: Re: C++ and "no data fields" when printing objects
Date: Fri, 03 Apr 2009 07:55:00 -0000 [thread overview]
Message-ID: <20090403075518.GA993@geppetto> (raw)
Message-ID: <20090403075500.6EG0Hkp_CtBvV5UYoqo6EfQfzvU9udE27o8Cfl7wRvk@z> (raw)
In-Reply-To: <20090402185220.GA8273@caradoc.them.org>
On date Thursday 2009-04-02 14:52:20 -0400, Daniel Jacobowitz wrote:
> On Thu, Apr 02, 2009 at 03:28:11PM +0200, Stefano Sabatini wrote:
> > 1) which are the conditions under which the abovementioned problem
> > occurrs (e.g. with shared/static lib, with some arch, only with some
> > compiler+flags/binary format)?
>
> I have no idea; it doesn't happen to me. In your searching did you
> find any bugs in bugzilla describing this problem? If not, do you
> have any test where you can demonstrate it?
OK I found #9222.
And here is how I can reproduce it, I'll try to work out a more
minimal issue case.
---------------8<------------------------------------------------
#include <iostream>
#include <ptlib.h>
#include <ptlib/safecoll.h>
#include <ptlib/pprocess.h>
class Test : public PProcess {
PCLASSINFO(Test, PProcess)
public:
void Main(void);
};
class SafeThing : public PSafeObject {
public:
SafeThing(int bar, int foo) : m_Bar(bar), m_Foo(foo) { }
virtual void PrintOn(ostream &strm) const {
strm << "foo(" << m_Foo << ") "
<< "bar(" << m_Bar << ") ";
}
private:
int m_Bar;
int m_Foo;
};
PCREATE_PROCESS(Test)
void Test::Main(void)
{
PSafePtr<SafeThing> ptr;
cout << "ptr: " << ptr << endl;
if (!!ptr)
cout << *ptr << endl;
return;
}
------------------------------8<-------------------------------
Informations on the system:
stefano@geppetto ~/s/ptlib> uname -a
Linux geppetto 2.6.26-1-686 #1 SMP Sat Oct 18 16:22:25 UTC 2008 i686 GNU/Linux
stefano@geppetto ~/s/ptlib> g++ --version
g++ (Debian 4.3.2-1) 4.3.2
Compilation command performed:
g++ -DPTRACING=1 -D_REENTRANT -D_GNU_SOURCE=1 -fno-exceptions
-I/home/stefano/include -I/usr/include/SDL -g -O0 -ggdb
-L/home/stefano/lib -lpt -lpthread -lsasl2 -lldap -llber -lldap_r
-lssl -lcrypto -lexpat -lSDL -lresolv -ldl psafeptr.cxx -o psafeptr
And here it is my gdb output:
(gdb) show version
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
(gdb) file psafeptr
(gdb) b Test::Main
Breakpoint 9 at 0x8049886: file psafeptr.cxx, line 35.
(gdb) r
[Thread debugging using libthread_db enabled]
[New Thread 0xb74236c0 (LWP 2490)]
[Switching to Thread 0xb74236c0 (LWP 2490)]
Breakpoint 7, main (argc=1, argv=0xbfc45474, envp=0xbfc4547c) at psafeptr.cxx:31
warning: Source file is more recent than executable.
(gdb) n
Breakpoint 8, Test::Main (this=0x9f4f000) at psafeptr.cxx:35
(gdb) p ptr
$15 = {
<> = {<No data fields>}, <No data fields>}
(gdb)
I'm using the latest SVN libpt (but I don't think it depends on the
version used, since it shows up also with a very ancient version of
it), and yes I compiled the lib with -ggdb -00 (compiled with make
debugshared).
Regards.
next prev parent reply other threads:[~2009-04-03 7:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-02 13:28 Stefano Sabatini
2009-04-02 18:52 ` Daniel Jacobowitz
2009-04-03 10:04 ` Stefano Sabatini [this message]
2009-04-03 7:55 ` Stefano Sabatini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090403075518.GA993@geppetto \
--to=stefano.sabatini-lala@poste.it \
--cc=gdb@sources.redhat.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox