Discussion:
[Bug c++/15440] New: set print object produces values not matching inferior
jan.kratochvil at redhat dot com
2013-05-07 17:59:46 UTC
Permalink
http://sourceware.org/bugzilla/show_bug.cgi?id=15440

Bug #: 15440
Summary: set print object produces values not matching inferior
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: c++
AssignedTo: ***@sourceware.org
ReportedBy: ***@redhat.com
Classification: Unclassified
Target: x86_64-unknown-linux-gnu


#include <stdio.h>
class C {
public:
int i=1;
virtual void m() {}
};
class D : public C {
public:
int i=2;
} d;
C *cp = &d;
int main() {
printf("%d\n",cp->i);
}


(gdb) start
13 printf("%d\n",cp->i);
(gdb) p cp->i
$1 = 1
(gdb) set print object on
(gdb) p cp->i
$2 = 2
^^^ = GDB output
(gdb) next
1
^^ = inferior output
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
tromey at redhat dot com
2013-06-13 20:40:33 UTC
Permalink
http://sourceware.org/bugzilla/show_bug.cgi?id=15440

Tom Tromey <tromey at redhat dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at redhat dot com

--- Comment #1 from Tom Tromey <tromey at redhat dot com> ---
I assume this is because "set print object on" inexplicably
affects expression evaluation, not just printing.
That seems wrong to me.
I think we should introduce a new setting, like
"set print object print-only" and make it the default.
--
You are receiving this mail because:
You are on the CC list for the bug.
jan.kratochvil at redhat dot com
2013-06-13 20:43:29 UTC
Permalink
http://sourceware.org/bugzilla/show_bug.cgi?id=15440

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |jan.kratochvil at redhat dot com

--- Comment #2 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
Why is there a problem fixing "set print object"?
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at redhat dot com
2013-06-13 20:59:00 UTC
Permalink
http://sourceware.org/bugzilla/show_bug.cgi?id=15440

--- Comment #3 from Tom Tromey <tromey at redhat dot com> ---
I don't have a problem with it. I anticipate that perhaps others
will, though, since it is a behavior change, and the behavior dates
back many years. I suppose we could give it a try and see if anyone
complains.
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at redhat dot com
2013-10-31 19:48:01 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=15440

Tom Tromey <tromey at redhat dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Blocks| |16106
--
You are receiving this mail because:
You are on the CC list for the bug.
vanyacpp at gmail dot com
2018-07-12 17:12:50 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=15440

Ivan Sorokin <vanyacpp at gmail dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |vanyacpp at gmail dot com

--- Comment #4 from Ivan Sorokin <vanyacpp at gmail dot com> ---
I encountered this issue today. Code written by a junior had an unintentional
duplicate variable in both base and derived classes. The behavior of the
debugger was quite confusing. It took me sometime to understand what was going
on.

Any progress on the issue?

Please note that most IDEs "set print object" by default. And I guess even
among those who don't use IDE enabling "set print object" is quite common.
--
You are receiving this mail because:
You are on the CC list for the bug.
Continue reading on narkive:
Loading...