public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers
@ 2014-07-09 12:08 jwakely.gcc at gmail dot com
  2014-07-22 18:27 ` [Bug python/17136] " jan.kratochvil at redhat dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jwakely.gcc at gmail dot com @ 2014-07-09 12:08 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 17136
           Summary: 'info type-printers' causes an exception when there
                    are per-objfile printers
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: jwakely.gcc at gmail dot com

Given this type printer defined somewhere like .gdbinit

class Printer(object):
  def __init__ (self):
    self.name = 'Printer'
    self.enabled = True

  class _recognizer(object):
    def recognize(self, type_obj):
      if type_obj.tag == "Foo":
        return "Bar"
      return None

  def instantiate(self):
    return self._recognizer()

if you debug any program then register the type printer with the current
objfile, running 'info type-printers' results in a python exception:

(gdb) start
Temporary breakpoint 1 at 0x4005b4: file bug.cc, line 4.
Starting program: /tmp/a.out 

Temporary breakpoint 1, main () at bug.cc:4
4         return 0;
(gdb) python gdb.types.register_type_printer(gdb.current_objfile(), Printer())
(gdb) info type-printers
Python Exception <type 'exceptions.AttributeError'> 'gdb.Objfile' object has no
attribute 'name': 
Error occurred in Python command: 'gdb.Objfile' object has no attribute 'name'

The exception doesn't happen if the type printer is registered globally, by
passing None instead of gdb.current_objfile().

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
@ 2014-07-22 18:27 ` jan.kratochvil at redhat dot com
  2014-07-24 17:17 ` keiths at redhat dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jan.kratochvil at redhat dot com @ 2014-07-22 18:27 UTC (permalink / raw)
  To: gdb-prs

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

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

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

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
  2014-07-22 18:27 ` [Bug python/17136] " jan.kratochvil at redhat dot com
@ 2014-07-24 17:17 ` keiths at redhat dot com
  2015-05-29 12:06 ` jwakely.gcc at gmail dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: keiths at redhat dot com @ 2014-07-24 17:17 UTC (permalink / raw)
  To: gdb-prs

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

Keith Seitz <keiths at redhat dot com> changed:

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

--- Comment #1 from Keith Seitz <keiths at redhat dot com> ---
I am unable to reproduce this with either 7.7.1.20140611-cvs or git HEAD. What
does your gdb report as its version?

Example of my attempt to reproduce:

$ ./gdb -q -data-directory data-directory gdb
Reading symbols from gdb...done.
Setting up the environment for debugging gdb.
Breakpoint 1 at 0x6f6390: file ../../src/gdb/utils.c, line 829.
Breakpoint 2 at 0x4ead77: file ../../src/gdb/cli/cli-cmds.c, line 219.
(top-gdb) start
Temporary breakpoint 3 at 0x45bdff: file ../../src/gdb/gdb.c, line 29.
Starting program: /home/keiths/sources/gdb/git/releases/7.7/linux/gdb/gdb 
During symbol reading, cannot get low and high bounds for subprogram DIE at
8088.
During symbol reading, Child DIE 0x31a3 and its abstract origin 0x684d have
different tags.
During symbol reading, Child DIE 0x31a3 and its abstract origin 0x684d have
different parents.
During symbol reading, DW_AT_GNU_call_site_target target DIE has invalid low
pc, for referencing DIE 0x4961 [in module
/usr/lib/debug/lib64/ld-2.18.so.debug].
During symbol reading, Multiple children of DIE 0x6253 refer to DIE 0x5df3 as
their abstract origin.
During symbol reading, incomplete CFI data; unspecified registers (e.g., rax)
at 0x3878e0397a.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
During symbol reading, incomplete CFI data; unspecified registers (e.g., rax)
at 0x3878e0397a.

Temporary breakpoint 3, main (argc=1, argv=0x7fffffffdce8)
    at ../../src/gdb/gdb.c:29
29      memset (&args, 0, sizeof args);
(top-gdb) py execfile('/home/keiths/tmp/17136.py')
(top-gdb) py gdb.types.register_type_printer (gdb.current_objfile(), Printer())
(top-gdb) info type-printers 
Global type printers:
  Printer
(top-gdb) 

Do you have a different procedure which tickles the bug?

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
  2014-07-22 18:27 ` [Bug python/17136] " jan.kratochvil at redhat dot com
  2014-07-24 17:17 ` keiths at redhat dot com
@ 2015-05-29 12:06 ` jwakely.gcc at gmail dot com
  2015-05-29 12:11 ` jwakely.gcc at gmail dot com
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jwakely.gcc at gmail dot com @ 2015-05-29 12:06 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
Keith, sorry for not replying to your question, not sure why I didn't see it.

I still see this in Fedora 22 with: GNU gdb (GDB) Fedora 7.9.1-13.fc22

tmp$ cat > p.cc
int main() {
return 0;                                                                    
}
tmp$ 
tmp$ 
tmp$ g++ -g p.cc
tmp$ gdb a.out
GNU gdb (GDB) Fedora 7.9.1-13.fc22
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...done.
(gdb) python
>class Printer(object):
>  def __init__ (self):
>    self.name = 'Printer'
>    self.enabled = True
>
>  class _recognizer(object):
>    def recognize(self, type_obj):
>      if type_obj.tag == "Foo":
>        return "Bar"
>      return None
>
>  def instantiate(self):
>    return self._recognizer()
>end
(gdb) start
Temporary breakpoint 1 at 0x4005ba: file p.cc, line 2.
Starting program: /tmp/a.out 
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.21-5.fc22.x86_64

Temporary breakpoint 1, main () at p.cc:2
2       return 0;
Missing separate debuginfos, use: dnf debuginfo-install
libgcc-5.1.1-1.fc22.x86_64 libstdc++-5.1.1-1.fc22.x86_64
(gdb) python gdb.types.register_type_printer(gdb.current_objfile(), Printer())
(gdb) info type-printers
Python Exception <class 'AttributeError'> 'gdb.Objfile' object has no attribute
'name': 
Error occurred in Python command: 'gdb.Objfile' object has no attribute 'name'
(gdb)

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
                   ` (2 preceding siblings ...)
  2015-05-29 12:06 ` jwakely.gcc at gmail dot com
@ 2015-05-29 12:11 ` jwakely.gcc at gmail dot com
  2015-06-01 19:02 ` dje at google dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jwakely.gcc at gmail dot com @ 2015-05-29 12:11 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
The fix at https://bugzilla.redhat.com/show_bug.cgi?id=1085576 works for me.

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
                   ` (3 preceding siblings ...)
  2015-05-29 12:11 ` jwakely.gcc at gmail dot com
@ 2015-06-01 19:02 ` dje at google dot com
  2015-06-01 19:13 ` dje at google dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dje at google dot com @ 2015-06-01 19:02 UTC (permalink / raw)
  To: gdb-prs

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

dje at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at google dot com

--- Comment #4 from dje at google dot com ---
Hmmm, I would have expected to see objfile.name, or the correct
objfile.filename, in more places in type_printers.py.
Alas instead of being consistent with pretty-printers,
type-printers have invented a new syntax for the info/enable/disable trio.

All the more reason to put all of this under one piece of common code
used by everyone (pretty-printers, type-printers, xmethods, and so on).
See, e.g., https://sourceware.org/ml/gdb-patches/2015-04/msg00006.html

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
                   ` (4 preceding siblings ...)
  2015-06-01 19:02 ` dje at google dot com
@ 2015-06-01 19:13 ` dje at google dot com
  2015-06-01 19:22 ` dje at google dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dje at google dot com @ 2015-06-01 19:13 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from dje at google dot com ---
(In reply to dje from comment #4)
Filed PR 18476 to cover the "move to common framework" issue.

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
                   ` (5 preceding siblings ...)
  2015-06-01 19:13 ` dje at google dot com
@ 2015-06-01 19:22 ` dje at google dot com
  2015-06-26 13:49 ` jan.kratochvil at redhat dot com
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: dje at google dot com @ 2015-06-01 19:22 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from dje at google dot com ---
(In reply to Jonathan Wakely from comment #3)
> The fix at https://bugzilla.redhat.com/show_bug.cgi?id=1085576 works for me.

The patch can be checked in IMO.
Given that I don't have the time to write a testcase myself
I'm not going to force someone else to.
Another reviewer may require one though.

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
                   ` (6 preceding siblings ...)
  2015-06-01 19:22 ` dje at google dot com
@ 2015-06-26 13:49 ` jan.kratochvil at redhat dot com
  2015-08-06 16:26 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jan.kratochvil at redhat dot com @ 2015-06-26 13:49 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #7 from Jan Kratochvil <jan.kratochvil at redhat dot com> ---
[patch] Fix 'info type-printers' Python error - PR 17136
https://sourceware.org/ml/gdb-patches/2015-06/msg00572.html

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
                   ` (7 preceding siblings ...)
  2015-06-26 13:49 ` jan.kratochvil at redhat dot com
@ 2015-08-06 16:26 ` cvs-commit at gcc dot gnu.org
  2015-08-06 16:30 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-08-06 16:26 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #8 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Doug Evans <devans@sourceware.org>:

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

commit ca0a5f0bd33d0aa17a5cf518e41e47ddfde486ad
Author: Clem Dickey <clemd@acm.org>
Date:   Thu Aug 6 09:24:58 2015 -0700

    PR python/17136

    gdb/ChangeLog:

        * python/lib/gdb/command/type_printers.py (InfoTypePrinter): Fix typo.

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
                   ` (8 preceding siblings ...)
  2015-08-06 16:26 ` cvs-commit at gcc dot gnu.org
@ 2015-08-06 16:30 ` cvs-commit at gcc dot gnu.org
  2015-08-06 16:35 ` dje at google dot com
  2023-03-13 13:41 ` cvs-commit at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-08-06 16:30 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #9 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The gdb-7.10-branch branch has been updated by Doug Evans
<devans@sourceware.org>:

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

commit 17d1595ac5371d06537bc57df86a9f7359e62127
Author: Clem Dickey <clemd@acm.org>
Date:   Thu Aug 6 09:29:03 2015 -0700

    PR python/17136

    gdb/ChangeLog:

        * python/lib/gdb/command/type_printers.py (InfoTypePrinter): Fix typo.

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
                   ` (9 preceding siblings ...)
  2015-08-06 16:30 ` cvs-commit at gcc dot gnu.org
@ 2015-08-06 16:35 ` dje at google dot com
  2023-03-13 13:41 ` cvs-commit at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: dje at google dot com @ 2015-08-06 16:35 UTC (permalink / raw)
  To: gdb-prs

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

dje at google dot com changed:

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

--- Comment #10 from dje at google dot com ---
patch checked into trunk and 7.10 branch

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


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

* [Bug python/17136] 'info type-printers' causes an exception when there are per-objfile printers
  2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
                   ` (10 preceding siblings ...)
  2015-08-06 16:35 ` dje at google dot com
@ 2023-03-13 13:41 ` cvs-commit at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-13 13:41 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #11 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Bruno Larsen <blarsen@sourceware.org>:

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

commit 83b755117d7a13e75877c3f166dfef1d8b69ec75
Author: Bruno Larsen <blarsen@redhat.com>
Date:   Thu Feb 23 13:56:32 2023 +0100

    gdb/testsuite: add regression test for per-objfile typeprinters

    PR python/17136 reported an unhandled exception when using typeprinters
    only valid on some objfiles, rather than being a global typeprinter. The
    fix was accepted without a regression test, and we've been carrying one
    out-of-tree for a while but I think it's worth upstreaming. The code
    itself was developed by Jan Kratochvil.

    Co-Authored-By: Jan Kratochvil <jkratochvil@azul.com>
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17136
    Reviewed-By: Andrew Burgess <aburgess@redhat.com>
    Approved-By: Tom Tromey <tom@tromey.com>

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

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

end of thread, other threads:[~2023-03-13 13:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-09 12:08 [Bug python/17136] New: 'info type-printers' causes an exception when there are per-objfile printers jwakely.gcc at gmail dot com
2014-07-22 18:27 ` [Bug python/17136] " jan.kratochvil at redhat dot com
2014-07-24 17:17 ` keiths at redhat dot com
2015-05-29 12:06 ` jwakely.gcc at gmail dot com
2015-05-29 12:11 ` jwakely.gcc at gmail dot com
2015-06-01 19:02 ` dje at google dot com
2015-06-01 19:13 ` dje at google dot com
2015-06-01 19:22 ` dje at google dot com
2015-06-26 13:49 ` jan.kratochvil at redhat dot com
2015-08-06 16:26 ` cvs-commit at gcc dot gnu.org
2015-08-06 16:30 ` cvs-commit at gcc dot gnu.org
2015-08-06 16:35 ` dje at google dot com
2023-03-13 13:41 ` cvs-commit at gcc dot gnu.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).