This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/19333] New: Inconsistent printing for pointers
- From: "amirgeva at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Sat, 05 Dec 2015 20:12:30 +0000
- Subject: [Bug c++/19333] New: Inconsistent printing for pointers
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=19333
Bug ID: 19333
Summary: Inconsistent printing for pointers
Product: gdb
Version: 7.10
Status: NEW
Severity: minor
Priority: P2
Component: c++
Assignee: unassigned at sourceware dot org
Reporter: amirgeva at gmail dot com
Target Milestone: ---
Consider the following short program:
#include <map>
int main(int argc, char* argv[])
{
int i=5;
int* p=&i;
std::map<int,int*> m;
m[3]=p;
return 0;
}
If I break on the last line (return 0;) and do the following:
(gdb) print p
$1 = (int *) 0xbffff12c
(gdb) print m
$2 = std::map with 1 elements = {[3] = 0xbffff12c}
Notice that the pointer type information is stripped. Obviously with a simple
map type that's not a real problem, but in large programs with nested data
structures, not having this information can be a problem.
I investigated this and found there are 2 C value print functions (in
c-valprint.c), c_value_print which does print the type, and c_val_print which
is used from the pretty printer and doesn't print the type.
I also found that if I comment out the call to val_print in valprint.c:860 and
replace it with the call to:
LA_VALUE_PRINT (val, stream, options);
I get this problem resolved.
It's not clear why there would be two functions doing basically the same thing,
just with some small differences, but I don't have means to check how such a
change affects other scenarios / languages.
--
You are receiving this mail because:
You are on the CC list for the bug.