After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 574212 - gdb ptype command doesn't work with type names containing '::'
gdb ptype command doesn't work with type names containing '::'
Status: RESOLVED WONTFIX
Product: nemiver
Classification: Other
Component: general
trunk
Other Linux
: Normal normal
: ---
Assigned To: Nemiver maintainers
Nemiver maintainers
gnome[unmaintained]
Depends on:
Blocks: 573709
 
 
Reported: 2009-03-05 03:58 UTC by Jonathon Jongsma
Modified: 2020-03-10 11:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to quote arguments to -data-evaluate-expression, and ptype (4.44 KB, patch)
2009-03-05 04:03 UTC, Jonathon Jongsma
committed Details | Review

Description Jonathon Jongsma 2009-03-05 03:58:26 UTC
Log entry from a trying to get the type of std::string::npos:

|{|bool nemiver::GDBMIParser::parse_out_of_band_record(size_t, size_t&, nemiver::Output::OutOfBandRecord&):{
|I|void nemiver::remove_stream_record_trailing_chars(nemiver::common::UString&):nmv-gdbmi-parser.cc:2685:stream record: 'ptype std::string::npos\n' size=25
|}|bool nemiver::GDBMIParser::parse_out_of_band_record(size_t, size_t&, nemiver::Output::OutOfBandRecord&):}elapsed: 3.6108e-05secs
|{|bool nemiver::GDBMIParser::parse_out_of_band_record(size_t, size_t&, nemiver::Output::OutOfBandRecord&):{
|I|void nemiver::remove_stream_record_trailing_chars(nemiver::common::UString&):nmv-gdbmi-parser.cc:2685:stream record: 'No type \"string\" within class or namespace \"std\".\n' size=55
|}|bool nemiver::GDBMIParser::parse_out_of_band_record(size_t, size_t&, nemiver::Output::OutOfBandRecord&):}elapsed: 3.7295e-05secs


however, if we had surrounded std::string::npos with single quotes, gdb would have happily given us its type.  Patch soon.
Comment 1 Jonathon Jongsma 2009-03-05 04:03:17 UTC
Created attachment 130093 [details] [review]
patch to quote arguments to -data-evaluate-expression, and ptype
Comment 2 Jonathon Jongsma 2009-03-10 03:22:45 UTC
pushed
Comment 3 Dodji Seketeli 2009-03-29 13:17:45 UTC
I think this fix leads to subtle regressions.

suppose you have this program:

     1  int
     2  main ()
     3  {
     4      int i = 0;
     5      i++;
     6      i++;
     7  }

Then look at this gdb session:

4           int i = 0;
(gdb) n
5           i++;
(gdb) p i
$1 = 0
(gdb) p 'i'
$2 = 105 'i'
(gdb) ptype i
type = int
(gdb) ptype 'i'
type = char

What happens is that quoting i like in 'i' changes the type of the i expression.
i is of type int, but 'i' is of type char. This leads to subtle bugs in the Nemiver interface if you quote the arguments of either ptype or -data-evaluate-expression. It leads to many regressions actually.

So I reopening the bug and I will revert the changes.

Having '::' to be properly understood by GDB requires a bugfix in GDB, I believe.

I think we should change the title of the bug as well.
Comment 4 Jonathon Jongsma 2009-03-29 13:29:01 UTC
Yes, I think I've seen some regressions as well, so we probably should revert it for now.
Comment 5 Dodji Seketeli 2009-04-03 14:11:45 UTC
Okay, I have reverted the changes of the commit and added a regression test to catch that regression.

The commit hash is 800d796c34aa
Comment 6 Dodji Seketeli 2009-04-03 14:14:00 UTC
Changing the title of the bug from "gdb apparently requires arguments to 'ptype', etc to be quoted" to gdb ptype command doesn't work with type names containing '::'
Comment 7 André Klapper 2020-03-10 11:55:35 UTC
Closing all open Nemiver tasks as this project does not seem to be maintained anymore. Please see https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/235#note_732192 for further information. Thanks!