public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/17416] New: -var-list-children fails with "set print object on" and invalid/NULL value
@ 2014-09-19 21:24 simon.marchi at ericsson dot com
  2014-09-19 21:25 ` [Bug gdb/17416] " simon.marchi at ericsson dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: simon.marchi at ericsson dot com @ 2014-09-19 21:24 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 17416
           Summary: -var-list-children fails with "set print object on"
                    and invalid/NULL value
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: simon.marchi at ericsson dot com

Created attachment 7796
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7796&action=edit
Test program

When

- "set print object" is on
- The variable object is a pointer to a struct, and it contains an invalid
value (e.g. NULL, or random uninitialized value)
- The variable object (struct) has a child which is also a pointer to a struct.

-var-list-children returns an error. GDB tries to dereference the top-level
pointer to get the value of the child one, in order to go determine the real
type of the pointed object using RTTI. In the process, value_ind in
value_rtti_indirect_type throws an error that is never caught.

What happens then is that the variable object for the child is half-created. If
the top-level pointer is set to a sensible value and we try to do
-var-list-children again, we get a "Duplicate variable object name" error.

The attached test case shows the problem.

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


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

* [Bug gdb/17416] -var-list-children fails with "set print object on" and invalid/NULL value
  2014-09-19 21:24 [Bug gdb/17416] New: -var-list-children fails with "set print object on" and invalid/NULL value simon.marchi at ericsson dot com
@ 2014-09-19 21:25 ` simon.marchi at ericsson dot com
  2015-01-23 18:01 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: simon.marchi at ericsson dot com @ 2014-09-19 21:25 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Simon Marchi <simon.marchi at ericsson dot com> ---
Created attachment 7797
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7797&action=edit
Test case (the .exp)

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


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

* [Bug gdb/17416] -var-list-children fails with "set print object on" and invalid/NULL value
  2014-09-19 21:24 [Bug gdb/17416] New: -var-list-children fails with "set print object on" and invalid/NULL value simon.marchi at ericsson dot com
  2014-09-19 21:25 ` [Bug gdb/17416] " simon.marchi at ericsson dot com
@ 2015-01-23 18:01 ` cvs-commit at gcc dot gnu.org
  2015-01-23 18:08 ` simon.marchi at ericsson dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-01-23 18:01 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Marchi <simark@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f7e5394d614db4456fc0d9598bbfa936cc7941af

commit f7e5394d614db4456fc0d9598bbfa936cc7941af
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Fri Jan 23 12:59:24 2015 -0500

    Catch exception in value_rtti_indirect_type

    In the situation described in bug 17416 [1]:

      * "set print object" is on;
      * The variable object is a pointer to a struct, and it contains an
        invalid value (e.g. NULL, or random uninitialized value);
      * The variable object (struct) has a child which is also a pointer to a
        struct;
      * We try to use "-var-list-children".

    ... an exception thrown in value_ind can propagate too far and leave an
    half-built variable object, leading to a wrong state. This patch adds a
    TRY_CATCH to catch it and makes value_rtti_indirect_type return NULL in
    that case, meaning that the type of the pointed object could not be
    found.

    A test for the fix is also added.

    New in v2:

      * Added test.
      * Restructured "catch" code.
      * Added details about the bug in commit log.

    gdb/Changelog:

        * valops.c (value_rtti_indirect_type): Catch exception thrown by
        value_ind.

    gdb/testsuite/ChangeLog

        * gdb.mi/mi-var-list-children-invalid-grandchild.c: New file.
        * gdb.mi/mi-var-list-children-invalid-grandchild.exp: New file.

    [1] https://sourceware.org/bugzilla/show_bug.cgi?id=17416

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


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

* [Bug gdb/17416] -var-list-children fails with "set print object on" and invalid/NULL value
  2014-09-19 21:24 [Bug gdb/17416] New: -var-list-children fails with "set print object on" and invalid/NULL value simon.marchi at ericsson dot com
  2014-09-19 21:25 ` [Bug gdb/17416] " simon.marchi at ericsson dot com
  2015-01-23 18:01 ` cvs-commit at gcc dot gnu.org
@ 2015-01-23 18:08 ` simon.marchi at ericsson dot com
  2015-05-02 13:32 ` malaperle at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: simon.marchi at ericsson dot com @ 2015-01-23 18:08 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simon.marchi at ericsson dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Simon Marchi <simon.marchi at ericsson dot com> ---
Fixed.

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


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

* [Bug gdb/17416] -var-list-children fails with "set print object on" and invalid/NULL value
  2014-09-19 21:24 [Bug gdb/17416] New: -var-list-children fails with "set print object on" and invalid/NULL value simon.marchi at ericsson dot com
                   ` (2 preceding siblings ...)
  2015-01-23 18:08 ` simon.marchi at ericsson dot com
@ 2015-05-02 13:32 ` malaperle at gmail dot com
  2015-05-03  3:18 ` simon.marchi at polymtl dot ca
  2015-05-03 14:44 ` malaperle at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: malaperle at gmail dot com @ 2015-05-02 13:32 UTC (permalink / raw)
  To: gdb-prs

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

Marc-Andre Laperle <malaperle at gmail dot com> changed:

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

--- Comment #4 from Marc-Andre Laperle <malaperle at gmail dot com> ---
What's the target milestone, 7.9?

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


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

* [Bug gdb/17416] -var-list-children fails with "set print object on" and invalid/NULL value
  2014-09-19 21:24 [Bug gdb/17416] New: -var-list-children fails with "set print object on" and invalid/NULL value simon.marchi at ericsson dot com
                   ` (3 preceding siblings ...)
  2015-05-02 13:32 ` malaperle at gmail dot com
@ 2015-05-03  3:18 ` simon.marchi at polymtl dot ca
  2015-05-03 14:44 ` malaperle at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: simon.marchi at polymtl dot ca @ 2015-05-03  3:18 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simon.marchi at polymtl dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simon.marchi at polymtl dot ca

--- Comment #5 from Simon Marchi <simon.marchi at polymtl dot ca> ---
This was not included in the 7.9 branch, so no it's not in gdb 7.9. If you
want, we could request to include it in 7.9.1 which should be out soon.

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


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

* [Bug gdb/17416] -var-list-children fails with "set print object on" and invalid/NULL value
  2014-09-19 21:24 [Bug gdb/17416] New: -var-list-children fails with "set print object on" and invalid/NULL value simon.marchi at ericsson dot com
                   ` (4 preceding siblings ...)
  2015-05-03  3:18 ` simon.marchi at polymtl dot ca
@ 2015-05-03 14:44 ` malaperle at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: malaperle at gmail dot com @ 2015-05-03 14:44 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from Marc-Andre Laperle <malaperle at gmail dot com> ---
(In reply to Simon Marchi from comment #5)
> This was not included in the 7.9 branch, so no it's not in gdb 7.9. If you
> want, we could request to include it in 7.9.1 which should be out soon.

No it's OK. I thought it was maybe in 7.9 and the field wasn't updated.

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


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

end of thread, other threads:[~2015-05-03 14:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-19 21:24 [Bug gdb/17416] New: -var-list-children fails with "set print object on" and invalid/NULL value simon.marchi at ericsson dot com
2014-09-19 21:25 ` [Bug gdb/17416] " simon.marchi at ericsson dot com
2015-01-23 18:01 ` cvs-commit at gcc dot gnu.org
2015-01-23 18:08 ` simon.marchi at ericsson dot com
2015-05-02 13:32 ` malaperle at gmail dot com
2015-05-03  3:18 ` simon.marchi at polymtl dot ca
2015-05-03 14:44 ` malaperle at gmail dot com

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