public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/18073] New: gdb.Type.fields() throws an exception when called on a function type
@ 2015-03-02 19:01 pipcet at gmail dot com
  2015-03-02 20:25 ` [Bug python/18073] " pipcet at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pipcet at gmail dot com @ 2015-03-02 19:01 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 18073
           Summary: gdb.Type.fields() throws an exception when called on a
                    function type
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: pipcet at gmail dot com

Created attachment 8160
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8160&action=edit
patch

I'd like to submit the following obvious patch. It makes the python
gdb.Type.fields function return fields for function types, rather than throwing
an exception.

I do not know enough about gdb types to know whether there are any other type
codes that .fields() might validly get called on. (I do know that both the
python and the guile interface to types appear to be broken right now, which is
an unfortunate coincidence.)

diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c
index a3da678..aed6b03 100644
--- a/gdb/python/py-type.c
+++ b/gdb/python/py-type.c
@@ -486,10 +486,11 @@ typy_get_composite (struct type *type)
      exception.  */
   if (TYPE_CODE (type) != TYPE_CODE_STRUCT
       && TYPE_CODE (type) != TYPE_CODE_UNION
-      && TYPE_CODE (type) != TYPE_CODE_ENUM)
+      && TYPE_CODE (type) != TYPE_CODE_ENUM
+      && TYPE_CODE (type) != TYPE_CODE_FUNC)
     {
       PyErr_SetString (PyExc_TypeError,
-               "Type is not a structure, union, or enum type.");
+               "Type is not a structure, union, enum, or function type.");
       return NULL;
     }

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


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

* [Bug python/18073] gdb.Type.fields() throws an exception when called on a function type
  2015-03-02 19:01 [Bug python/18073] New: gdb.Type.fields() throws an exception when called on a function type pipcet at gmail dot com
@ 2015-03-02 20:25 ` pipcet at gmail dot com
  2015-09-30 18:41 ` munsal at nestlabs dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pipcet at gmail dot com @ 2015-03-02 20:25 UTC (permalink / raw)
  To: gdb-prs

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

pipcet at gmail dot com changed:

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

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


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

* [Bug python/18073] gdb.Type.fields() throws an exception when called on a function type
  2015-03-02 19:01 [Bug python/18073] New: gdb.Type.fields() throws an exception when called on a function type pipcet at gmail dot com
  2015-03-02 20:25 ` [Bug python/18073] " pipcet at gmail dot com
@ 2015-09-30 18:41 ` munsal at nestlabs dot com
  2015-10-21 19:59 ` cvs-commit at gcc dot gnu.org
  2015-10-21 20:03 ` simon.marchi at ericsson dot com
  3 siblings, 0 replies; 5+ messages in thread
From: munsal at nestlabs dot com @ 2015-09-30 18:41 UTC (permalink / raw)
  To: gdb-prs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 3660 bytes --]

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

Martin Ãœnsal <munsal at nestlabs dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |munsal at nestlabs dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.
>From gdb-prs-return-18653-listarch-gdb-prs=sources.redhat.com@sourceware.org Wed Sep 30 19:20:02 2015
Return-Path: <gdb-prs-return-18653-listarch-gdb-prs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-prs@sources.redhat.com
Received: (qmail 123236 invoked by alias); 30 Sep 2015 19:20:02 -0000
Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-prs.sourceware.org>
List-Subscribe: <mailto:gdb-prs-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-prs/>
List-Post: <mailto:gdb-prs@sourceware.org>
List-Help: <mailto:gdb-prs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: gdb-prs-owner@sourceware.org
Delivered-To: mailing list gdb-prs@sourceware.org
Received: (qmail 123203 invoked by uid 48); 30 Sep 2015 19:20:01 -0000
From: "oarias at knights dot ucf.edu" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/19033] New: [msp430-elf] Failure to read line numbers
Date: Wed, 30 Sep 2015 19:20:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gdb
X-Bugzilla-Component: gdb
X-Bugzilla-Version: 7.10
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: oarias at knights dot ucf.edu
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at sourceware dot org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status
 bug_severity priority component assigned_to reporter target_milestone
 attachments.created
Message-ID: <bug-19033-4717@http.sourceware.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://sourceware.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-q3/txt/msg00357.txt.bz2
Content-length: 1261

https://sourceware.org/bugzilla/show_bug.cgi?id\x19033

            Bug ID: 19033
           Summary: [msp430-elf] Failure to read line numbers
           Product: gdb
           Version: 7.10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: oarias at knights dot ucf.edu
  Target Milestone: ---

Created attachment 8654
  --> https://sourceware.org/bugzilla/attachment.cgi?id†54&actioníit
Source file

Greetings,

I have been experimenting with the msp430-elf port of GDB and I have run into
the situation where it is unable to read line numbers for some functions. Both
readelf and objdump are able to see the line numbers, however gdb does not
populate the necessary entries.

Attached to this report is the test source file, a compiled binary, the linker
script used and the gdb log with readelf information appended. The compiler
command issued was

$ msp430-elf-gcc -o test.elf -mmcu=msp430f2013 -O0 -g test.c

Using gcc 5.2.0, binutils 2.25.1 and newlib 2.2.0.20150824.

Please let me know if more information is needed. Thank you.

Cheers,
Orlando.

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


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

* [Bug python/18073] gdb.Type.fields() throws an exception when called on a function type
  2015-03-02 19:01 [Bug python/18073] New: gdb.Type.fields() throws an exception when called on a function type pipcet at gmail dot com
  2015-03-02 20:25 ` [Bug python/18073] " pipcet at gmail dot com
  2015-09-30 18:41 ` munsal at nestlabs dot com
@ 2015-10-21 19:59 ` cvs-commit at gcc dot gnu.org
  2015-10-21 20:03 ` simon.marchi at ericsson dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-10-21 19:59 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 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=bed91f4da252b5f30d3cb4fd9f9febd61ad9560d

commit bed91f4da252b5f30d3cb4fd9f9febd61ad9560d
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Wed Oct 21 15:57:22 2015 -0400

    Fix accessing a function's fields (parameters) from Python (PR 18073)

    Since 7.4, gdb doesn't allow calling .fields() on a function type, even
    though the documentation states it should return a list corresponding to
    the function's parameters.  This patch restores the intended behaviour
    and adds a test for it.

    Reg-tested on Arch Linux x86-64.

    gdb/ChangeLog:

        PR python/18073
        * python/py-type.c (typy_get_composite): Allow returning a
        function type.

    gdb/testsuite/ChangeLog:

        PR python/18073
        * gdb.python/py-type.c (C::a_method): New.
        (C::a_const_method): New.
        (C::a_static_method): New.
        (a_function): New.
        * gdb.python/py-type.exp (test_fields): Test getting fields
        from function and method.

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


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

* [Bug python/18073] gdb.Type.fields() throws an exception when called on a function type
  2015-03-02 19:01 [Bug python/18073] New: gdb.Type.fields() throws an exception when called on a function type pipcet at gmail dot com
                   ` (2 preceding siblings ...)
  2015-10-21 19:59 ` cvs-commit at gcc dot gnu.org
@ 2015-10-21 20:03 ` simon.marchi at ericsson dot com
  3 siblings, 0 replies; 5+ messages in thread
From: simon.marchi at ericsson dot com @ 2015-10-21 20:03 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |simon.marchi at ericsson dot com
         Resolution|---                         |FIXED

--- Comment #2 from Simon Marchi <simon.marchi at ericsson dot com> ---
This should be fixed in master.  Thanks for reporting and providing the fix!

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


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

end of thread, other threads:[~2015-10-21 20:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02 19:01 [Bug python/18073] New: gdb.Type.fields() throws an exception when called on a function type pipcet at gmail dot com
2015-03-02 20:25 ` [Bug python/18073] " pipcet at gmail dot com
2015-09-30 18:41 ` munsal at nestlabs dot com
2015-10-21 19:59 ` cvs-commit at gcc dot gnu.org
2015-10-21 20:03 ` simon.marchi at ericsson 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).