public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug varobj/11868] New: Don't call pretty printers for local variables that are not yet constructed
@ 2010-08-02  7:40 jens dot elmenthaler at verigy dot com
  2010-08-02 13:37 ` [Bug varobj/11868] " marc dot khouzam at ericsson dot com
  0 siblings, 1 reply; 11+ messages in thread
From: jens dot elmenthaler at verigy dot com @ 2010-08-02  7:40 UTC (permalink / raw)
  To: gdb-prs

I have enabled the python pretty printers for varobjs (-var-enable-pretty-
printing in the beginning of the MI session). If running into breakpoints at 
the first line of a method that contains local variables of a non-trivial 
type, I run into all types of errors, ranging from python exceptions 
to "Cannot access memory at address ...". The reason is that their constructor 
is called in a soure line behind the breakpoint, such that data members are 
not yet initialized. In many cases (consider a collection with pointer 
members "start" and "end"), a large amount of garbage data is read 
(unnecessary response time), that might even be unaccessible (unnecessary 
errors).

My gdb frontend (Eclipse DSF GDB) does not actually crash or hang. It's just 
that running the python pretty printer on tons of unitiliazed data with all 
those errors really is a usability problem for frontends that use the varobjs.

I don't think the writers of a python pretty printer have the chance to 
workaround, nor do I think they should. I know the argument that the pretty 
printer also has to work in case of a programming error in C/C++ code. But I 
don't think a user should suffer is debugged code as well as the provided 
pretty printers are clean.

As far I as know, the debug info generated by gcc provides the information in 
which line a local variable is constructed.

-- 
           Summary: Don't call pretty printers for local variables that are
                    not yet constructed
           Product: gdb
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: varobj
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: jens dot elmenthaler at verigy dot com
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=11868

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug varobj/11868] Don't call pretty printers for local variables that are not yet constructed
  2010-08-02  7:40 [Bug varobj/11868] New: Don't call pretty printers for local variables that are not yet constructed jens dot elmenthaler at verigy dot com
@ 2010-08-02 13:37 ` marc dot khouzam at ericsson dot com
  0 siblings, 0 replies; 11+ messages in thread
From: marc dot khouzam at ericsson dot com @ 2010-08-02 13:37 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marc dot khouzam at ericsson
                   |                            |dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11868

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug varobj/11868] Don't call pretty printers for local variables that are not yet constructed
       [not found] <bug-11868-4717@http.sourceware.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2023-08-31 17:19 ` tromey at sourceware dot org
@ 2023-08-31 17:20 ` tromey at sourceware dot org
  8 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2023-08-31 17:20 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=11868

--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
*** Bug 12555 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug varobj/11868] Don't call pretty printers for local variables that are not yet constructed
       [not found] <bug-11868-4717@http.sourceware.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2023-08-31 16:52 ` tromey at sourceware dot org
@ 2023-08-31 17:19 ` tromey at sourceware dot org
  2023-08-31 17:20 ` tromey at sourceware dot org
  8 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2023-08-31 17:19 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=11868

Tom Tromey <tromey at sourceware dot org> changed:

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

--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
*** Bug 21208 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug varobj/11868] Don't call pretty printers for local variables that are not yet constructed
       [not found] <bug-11868-4717@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2023-08-31 16:34 ` tromey at sourceware dot org
@ 2023-08-31 16:52 ` tromey at sourceware dot org
  2023-08-31 17:19 ` tromey at sourceware dot org
  2023-08-31 17:20 ` tromey at sourceware dot org
  8 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2023-08-31 16:52 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=11868

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |17joshuanewcomb at gmail dot com

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
*** Bug 22487 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug varobj/11868] Don't call pretty printers for local variables that are not yet constructed
       [not found] <bug-11868-4717@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2012-06-03 10:45 ` asmwarrior at gmail dot com
@ 2023-08-31 16:34 ` tromey at sourceware dot org
  2023-08-31 16:52 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: tromey at sourceware dot org @ 2023-08-31 16:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=11868

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
Comparing lines doesn't really work with optimizations.
There's not really a good way to handle this problem.
We've left it up to the printers but perhaps throwing
a memory exception could propagate to gdb, and it could
do something smarter.  Though of course printers can
catch that and still behave badly.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug varobj/11868] Don't call pretty printers for local variables that are not yet constructed
       [not found] <bug-11868-4717@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2012-06-02  7:08 ` asmwarrior at gmail dot com
@ 2012-06-03 10:45 ` asmwarrior at gmail dot com
  2023-08-31 16:34 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: asmwarrior at gmail dot com @ 2012-06-03 10:45 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=11868

--- Comment #3 from asmwarrior <asmwarrior at gmail dot com> 2012-06-03 10:44:45 UTC ---
Hi, Jens, I have a word around to filter out the local variables by compare the
current line and the declaration line of the local variable.

see: http://sourceware.org/bugzilla/show_bug.cgi?id=12127

-- 
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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug varobj/11868] Don't call pretty printers for local variables that are not yet constructed
       [not found] <bug-11868-4717@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-06-02  6:54 ` xunxun1982 at gmail dot com
@ 2012-06-02  7:08 ` asmwarrior at gmail dot com
  2012-06-03 10:45 ` asmwarrior at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: asmwarrior at gmail dot com @ 2012-06-02  7:08 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=11868

asmwarrior <asmwarrior at gmail dot com> changed:

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

-- 
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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug varobj/11868] Don't call pretty printers for local variables that are not yet constructed
       [not found] <bug-11868-4717@http.sourceware.org/bugzilla/>
  2011-11-10 21:48 ` tromey at redhat dot com
  2011-11-15 15:55 ` jens.elmenthaler at verigy dot com
@ 2012-06-02  6:54 ` xunxun1982 at gmail dot com
  2012-06-02  7:08 ` asmwarrior at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: xunxun1982 at gmail dot com @ 2012-06-02  6:54 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=11868

xunxun <xunxun1982 at gmail dot com> changed:

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

-- 
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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug varobj/11868] Don't call pretty printers for local variables that are not yet constructed
       [not found] <bug-11868-4717@http.sourceware.org/bugzilla/>
  2011-11-10 21:48 ` tromey at redhat dot com
@ 2011-11-15 15:55 ` jens.elmenthaler at verigy dot com
  2012-06-02  6:54 ` xunxun1982 at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: jens.elmenthaler at verigy dot com @ 2011-11-15 15:55 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=11868

--- Comment #2 from Jens Elmenthaler <jens.elmenthaler at verigy dot com> 2011-11-15 15:52:54 UTC ---
(In reply to comment #1)
> We changed how errors are propagated from printers to varobj,
> which should help this problem a bit -- you should get a more
> sensible display from properly written printers.
> Could you try this?
Yes, I just installed gdb 7.3.1 and will use it the next days.

> FWIW, I think trying to circumvent pretty-printing based on
> checking line numbers to see if initialization has occurred is
> likely to be fragile.  First, in the presence of optimization,
> this information is not really reliable.  Second, the same effect
> can be seen via data corruption anyway -- so it is better instead
> to try to come up with a solution that is robust in the presence
> of errors.
You are possibly right, relying on the line numbers will not really improve
robustness. I'm fine if you close this bug. There or other bugzillas to address
individual stability problems with one or the other command. In the case they
are missing, I will formulate them under the assumption that pretty printing
must never make gdb crash or hang, even if the pretty printer developer did a
mistake.

-- 
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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug varobj/11868] Don't call pretty printers for local variables that are not yet constructed
       [not found] <bug-11868-4717@http.sourceware.org/bugzilla/>
@ 2011-11-10 21:48 ` tromey at redhat dot com
  2011-11-15 15:55 ` jens.elmenthaler at verigy dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: tromey at redhat dot com @ 2011-11-10 21:48 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=11868

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011-11-10
                 CC|                            |tromey at redhat dot com
     Ever Confirmed|0                           |1

--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2011-11-10 21:47:54 UTC ---
We changed how errors are propagated from printers to varobj,
which should help this problem a bit -- you should get a more
sensible display from properly written printers.

Could you try this?

FWIW, I think trying to circumvent pretty-printing based on
checking line numbers to see if initialization has occurred is
likely to be fragile.  First, in the presence of optimization,
this information is not really reliable.  Second, the same effect
can be seen via data corruption anyway -- so it is better instead
to try to come up with a solution that is robust in the presence
of errors.

-- 
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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-08-31 17:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-02  7:40 [Bug varobj/11868] New: Don't call pretty printers for local variables that are not yet constructed jens dot elmenthaler at verigy dot com
2010-08-02 13:37 ` [Bug varobj/11868] " marc dot khouzam at ericsson dot com
     [not found] <bug-11868-4717@http.sourceware.org/bugzilla/>
2011-11-10 21:48 ` tromey at redhat dot com
2011-11-15 15:55 ` jens.elmenthaler at verigy dot com
2012-06-02  6:54 ` xunxun1982 at gmail dot com
2012-06-02  7:08 ` asmwarrior at gmail dot com
2012-06-03 10:45 ` asmwarrior at gmail dot com
2023-08-31 16:34 ` tromey at sourceware dot org
2023-08-31 16:52 ` tromey at sourceware dot org
2023-08-31 17:19 ` tromey at sourceware dot org
2023-08-31 17:20 ` tromey 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).