Problem with GDB on latest -CURRENT

From: Vladimir Grebenschikov <vova_at_sw.ru>
Date: Fri, 21 Nov 2003 17:39:56 +0300
>Submitter-Id:	current-users
>Originator:	Vladimir Grebenschikov
>Organization:	SWsoft
>Confidential:	no 
>Synopsis:	Problem with GDB on latest -CURRENT
>Severity:	non-critical
>Priority:	medium
>Category:	bin
>Class:		sw-bug
>Release:	FreeBSD 5.1-CURRENT i386
>Environment:
System: FreeBSD vbook.fbsd.ru 5.1-CURRENT FreeBSD 5.1-CURRENT #2: Mon Nov 17 08:10:40 MSK 2003 root_at_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
Received on Fri Nov 21 2003 - 05:38:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:30 UTC