public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Clem Dickey <clemd@acm.org>, Jonathan Wakely <jwakely@redhat.com>
Subject: [patch] Fix 'info type-printers' Python error - PR 17136
Date: Fri, 26 Jun 2015 13:49:00 -0000	[thread overview]
Message-ID: <20150626134907.GA23742@host1.jankratochvil.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

Hi,

by Clem Dickey and Jonathan Wakely:

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

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

(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'
->
(gdb) info type-printers 
Type printers for /lib64/libstdc++.so.6:
  basic_string_view<C>
  deque<T>
...
  unordered_set<T>
  vector<T>

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

Doug: https://sourceware.org/bugzilla/show_bug.cgi?id=17136#c6
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.


Jan

[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 831 bytes --]

2015-06-26  Clem Dickey <clemd@acm.org>

	Fix 'info type-printers' Python error.
	* python/lib/gdb/command/type_printers.py (InfoTypePrinter): Fix typo.

diff --git a/gdb/python/lib/gdb/command/type_printers.py b/gdb/python/lib/gdb/command/type_printers.py
index 0ef7686..1203989 100644
--- a/gdb/python/lib/gdb/command/type_printers.py
+++ b/gdb/python/lib/gdb/command/type_printers.py
@@ -47,7 +47,7 @@ class InfoTypePrinter(gdb.Command):
         sep = ''
         for objfile in gdb.objfiles():
             if objfile.type_printers:
-                print ("%sType printers for %s:" % (sep, objfile.name))
+                print ("%sType printers for %s:" % (sep, objfile.filename))
                 self.list_type_printers(objfile.type_printers)
                 sep = '\n'
         if gdb.current_progspace().type_printers:

             reply	other threads:[~2015-06-26 13:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26 13:49 Jan Kratochvil [this message]
2015-06-27 19:57 ` Jan Kratochvil
2015-08-06 16:31 ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150626134907.GA23742@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=clemd@acm.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jwakely@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).