public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17124] New: GDB incorrectly says that std::string::npos is of type string
@ 2014-07-07 18:40 dodji at seketeli dot org
2014-07-07 19:30 ` [Bug c++/17124] " jwakely.gcc at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dodji at seketeli dot org @ 2014-07-07 18:40 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17124
Bug ID: 17124
Summary: GDB incorrectly says that std::string::npos is of type
string
Product: gdb
Version: unknown
Status: NEW
Severity: normal
Priority: P2
Component: c++
Assignee: unassigned at sourceware dot org
Reporter: dodji at seketeli dot org
Created attachment 7683
--> https://sourceware.org/bugzilla/attachment.cgi?id=7683&action=edit
Debug info of the test program
with gdb version "GNU gdb (GDB) Fedora 7.7.90.20140627-8.fc21" and gcc version
"gcc (GCC) 4.9.0 20140604 (Red Hat 4.9.0-8)" (these are from Rawhide), please
consider this little test program in a file named test.cc:
--------------->8<-----------------------
#include <string>
int
main()
{
std::string s = "hah";
return 0;
}
--------------->8<-----------------------
Then compile by typing:
g++ -g -o test test.cc
Then run gdb on it by up to the line containing the "return 0;" statement by
doing:
gdb test
break main
run
next
Then inspect the type of std::string::npos by doing:
ptype std::string::npos
This is what I am getting:
(gdb) ptype std::string::npos
type = std::string
(gdb)
Find attached the debug info of the program "test", that I got by running
eu-readelf --debug-dump=info test > test.debug
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/17124] GDB incorrectly says that std::string::npos is of type string
2014-07-07 18:40 [Bug c++/17124] New: GDB incorrectly says that std::string::npos is of type string dodji at seketeli dot org
@ 2014-07-07 19:30 ` jwakely.gcc at gmail dot com
2015-09-25 11:19 ` bogdan.slusarczyk at aldec dot com.pl
2020-04-05 13:26 ` ssbssa at sourceware dot org
2 siblings, 0 replies; 4+ messages in thread
From: jwakely.gcc at gmail dot com @ 2014-07-07 19:30 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17124
Jonathan Wakely <jwakely.gcc at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jwakely.gcc at gmail dot com
--- Comment #1 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
Reproducible with this smaller program:
typedef unsigned long size_t;
template<typename T>
struct allocator
{
typedef size_t size_type;
};
template<typename T, typename A = allocator<T> >
struct basic_string
{
typedef typename A::size_type size_type;
static const size_type npos = -1;
};
typedef basic_string<char> str;
int main()
{
str s;
return 0;
}
(gdb) ptype str::npos
type = struct basic_string<char, allocator<char> > [with T = char, A =
allocator<char>] {
static size_type npos;
typedef A::size_type size_type;
}
(N.B. I had to call the type 'str' because when I called it 'string' GDB got
confused and "ptype string::npos" gave a syntax error)
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/17124] GDB incorrectly says that std::string::npos is of type string
2014-07-07 18:40 [Bug c++/17124] New: GDB incorrectly says that std::string::npos is of type string dodji at seketeli dot org
2014-07-07 19:30 ` [Bug c++/17124] " jwakely.gcc at gmail dot com
@ 2015-09-25 11:19 ` bogdan.slusarczyk at aldec dot com.pl
2020-04-05 13:26 ` ssbssa at sourceware dot org
2 siblings, 0 replies; 4+ messages in thread
From: bogdan.slusarczyk at aldec dot com.pl @ 2015-09-25 11:19 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17124
Bogdan <bogdan.slusarczyk at aldec dot com.pl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bogdan.slusarczyk at aldec dot com
| |.pl
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/17124] GDB incorrectly says that std::string::npos is of type string
2014-07-07 18:40 [Bug c++/17124] New: GDB incorrectly says that std::string::npos is of type string dodji at seketeli dot org
2014-07-07 19:30 ` [Bug c++/17124] " jwakely.gcc at gmail dot com
2015-09-25 11:19 ` bogdan.slusarczyk at aldec dot com.pl
@ 2020-04-05 13:26 ` ssbssa at sourceware dot org
2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2020-04-05 13:26 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17124
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |8.2
CC| |ssbssa at sourceware dot org
--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
(In reply to Jonathan Wakely from comment #1)
> Reproducible with this smaller program:
>
> typedef unsigned long size_t;
>
> template<typename T>
> struct allocator
> {
> typedef size_t size_type;
> };
>
> template<typename T, typename A = allocator<T> >
> struct basic_string
> {
> typedef typename A::size_type size_type;
> static const size_type npos = -1;
> };
>
> typedef basic_string<char> str;
>
>
> int main()
> {
> str s;
> return 0;
> }
>
>
> (gdb) ptype str::npos
> type = struct basic_string<char, allocator<char> > [with T = char, A =
> allocator<char>] {
> static size_type npos;
>
> typedef A::size_type size_type;
> }
>
> (N.B. I had to call the type 'str' because when I called it 'string' GDB got
> confused and "ptype string::npos" gave a syntax error)
I can reproduce this issue with gdb up to 8.1.1, but it works fine since 8.2:
(gdb) pt str
type = struct basic_string<char, allocator<char> > [with T = char, A =
allocator<char>] {
static size_type npos;
typedef A::size_type size_type;
}
(gdb) pt str::npos
type = const unsigned long
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-05 13:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-07 18:40 [Bug c++/17124] New: GDB incorrectly says that std::string::npos is of type string dodji at seketeli dot org
2014-07-07 19:30 ` [Bug c++/17124] " jwakely.gcc at gmail dot com
2015-09-25 11:19 ` bogdan.slusarczyk at aldec dot com.pl
2020-04-05 13:26 ` ssbssa at sourceware dot org
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).