From vova@vbook.fbsd.ru  Fri Nov 21 06:38:47 2003
Return-Path: <vova@vbook.fbsd.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id B13B816A4CE; Fri, 21 Nov 2003 06:38:47 -0800 (PST)
Received: from vbook.fbsd.ru (asplinux.ru [195.133.213.194])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 70A0543F75; Fri, 21 Nov 2003 06:38:46 -0800 (PST)
	(envelope-from vova@vbook.fbsd.ru)
Received: from vova by vbook.fbsd.ru with local (Exim 4.24; FreeBSD)
	id 1ANCRw-0000ln-HW; Fri, 21 Nov 2003 17:39:56 +0300
Message-Id: <E1ANCRw-0000ln-HW@vbook.fbsd.ru>
Date: Fri, 21 Nov 2003 17:39:56 +0300
From: Vladimir Grebenschikov <vova@sw.ru>
Sender: Vladimir Grebenschikov <vova@vbook.fbsd.ru>
Reply-To: Vladimir Grebenschikov <vova@sw.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc: current@freebsd.org
Subject: Problem with GDB on latest -CURRENT
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         59551
>Category:       bin
>Synopsis:       Problem with GDB on latest -CURRENT
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    marcel
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 21 06:40:15 PST 2003
>Closed-Date:    Sun Jan 27 08:31:43 UTC 2008
>Last-Modified:  Sun Jan 27 08:31:43 UTC 2008
>Originator:     Vladimir Grebenschikov
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
SWsoft
>Environment:
System: FreeBSD vbook.fbsd.ru 5.1-CURRENT FreeBSD 5.1-CURRENT #2: Mon Nov 17 08:10:40 MSK 2003 root@walder.asplinux.ru:/ext/obj/ext/current/src/sys/VBOOK i386

% g++ -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.3.3 [FreeBSD] 20031106
% gdb -v
GNU gdb 5.2.1 (FreeBSD)
Copyright 2002 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 "i386-undermydesk-freebsd".

>Description:

FreeBSD gdb fails to show some valid C++ objects

>How-To-Repeat:

% cat str.cpp
#include <string>

using namespace std;

class a
{
public:  string x;
};

int main()
{
  a s;
  s.x = "Test1";
  return 0;
}
% g++ -g -o str str.cpp
%  gdb str
GNU gdb 5.2.1 (FreeBSD)
...
(gdb) b main
Breakpoint 1 at 0x8048665: file str.cpp, line 12.
(gdb) r
Starting program:
/usr/local/home/vova/str 

Breakpoint 1, main () at str.cpp:12
12        a s;
(gdb) n
13        s.x = "Test1";
(gdb) p a
Attempt to use a type name as an expression
(gdb) p s
$1 = {x = {static npos = Error accessing memory address 0x83c451c: Bad address.
(gdb)

>Fix:

gdb53 from ports works as expected:

% gdbada str
GNU gdb 5.3 (FreeBSD)
...
This GDB was configured as "i386-portbld-freebsd5.1"...
(gdb) b main
Breakpoint 1 at 0x8048665: file str.cpp, line 12.
(gdb) r
Starting program:
/usr/local/home/vova/str 

Breakpoint 1, main () at str.cpp:12
12        a s;
(gdb) n
13        s.x = "Test1";
(gdb) p s
$1 = {x = {static npos = 4294967295, _M_dataplus = {<allocator<char>> = {<No
data fields>}, _M_p = 0x281326b8 ""}, static _S_empty_rep_storage = {0, 
      0, 1, 0}}}
(gdb) 

PS:
 Another question, why gdb53-ada present in packages directory as
   ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-current/Latest/gdb.tbz
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->marcel 
Responsible-Changed-By: marcel 
Responsible-Changed-When: Sat Jul 17 01:42:25 GMT 2004 
Responsible-Changed-Why:  
This may be a non-issue with gdb6, but I have to check first... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59551 

From: Craig Rodrigues <rodrigc@crodrigues.org>
To: freebsd-gnats-submit@freebsd.org
Cc: vova@sw.ru, marcel@freebsd.org
Subject: Re: bin/59551: Problem with GDB on latest -CURRENT
Date: Sun, 28 Nov 2004 00:27:03 -0500

 Hi,
 
 I don't see a problem with this testcase with the version of
 gdb in -CURRENT.
 GNU gdb 6.1.1 [FreeBSD]
 
 I think this PR can be closed
 
 -- 
 Craig Rodrigues        
 rodrigc@crodrigues.org
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Sun Jan 27 08:31:19 UTC 2008 
State-Changed-Why:  
This is now believed to be fixed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59551 
>Unformatted:
