* [archer] RFA: fix duplicate target-wide-encoding
@ 2009-03-11 21:41 Tom Tromey
2009-03-12 20:30 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2009-03-11 21:41 UTC (permalink / raw)
To: Project Archer
The libstdc++ pretty-printer code has a target-wide-encoding
parameter -- but this is also provided by the charset branch.
This patch removes the python one in favor of the internal one.
Jan, does this look ok for the archer branch?
I assume there is no other branch it ought to go on...
Tom
2009-03-11 Tom Tromey <tromey@redhat.com>
* python/lib/gdb/libstdcxx/v6/printers.py (WideEncoding): Remove.
(target_wide_charset): Likewise.
(StdStringPrinter.to_string): Change encoding lookup.
(build_libstdcxx_dictionary): Update.
diff --git a/gdb/python/lib/gdb/libstdcxx/v6/printers.py b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
index c0dc987..2572731 100644
--- a/gdb/python/lib/gdb/libstdcxx/v6/printers.py
+++ b/gdb/python/lib/gdb/libstdcxx/v6/printers.py
@@ -436,22 +436,6 @@ class StdDequeIteratorPrinter:
def to_string(self):
return self.val['_M_cur'].dereference()
-class WideEncoding (gdb.Parameter):
- """The target wide character set is the encoding used for wchar_t."""
-
- set_doc = "Set the target wide character set."
- show_doc = "Show the target wide character set."
-
- # FIXME: needs a complete method -- but does Parameter support it?
- def __init__ (self):
- super (WideEncoding, self).__init__ ("target-wide-charset",
- gdb.COMMAND_SUPPORT,
- gdb.PARAM_STRING)
- # I think this is ok for most glibc locales.
- self.value = 'UTF-32'
-
-target_wide_charset = WideEncoding()
-
class StdStringPrinter:
"Print a std::basic_string of some kind"
@@ -462,10 +446,8 @@ class StdStringPrinter:
def to_string(self):
# Look up the target encoding as late as possible.
encoding = self.encoding
- if encoding is None:
- encoding = gdb.parameter('target-charset')
- elif isinstance(encoding, WideEncoding):
- encoding = encoding.value
+ if encoding[0] is '@':
+ encoding = gdb.parameter(encoding[1:])
return self.val['_M_dataplus']['_M_p'].string(encoding)
def display_hint (self):
@@ -599,8 +581,8 @@ def build_libstdcxx_dictionary ():
# libstdc++ objects requiring pretty-printing.
# In order from:
# http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/a01847.html
- pretty_printers_dict[re.compile('^std::basic_string<char,.*>$')] = lambda val: StdStringPrinter(None, val)
- pretty_printers_dict[re.compile('^std::basic_string<wchar_t,.*>$')] = lambda val: StdStringPrinter(target_wide_charset, val)
+ pretty_printers_dict[re.compile('^std::basic_string<char,.*>$')] = lambda val: StdStringPrinter('@target-charset', val)
+ pretty_printers_dict[re.compile('^std::basic_string<wchar_t,.*>$')] = lambda val: StdStringPrinter('@target-wide-charset', val)
pretty_printers_dict[re.compile('^std::basic_string<char16_t,.*>$')] = lambda val: StdStringPrinter('UTF-16', val)
pretty_printers_dict[re.compile('^std::basic_string<char32_t,.*>$')] = lambda val: StdStringPrinter('UTF-32', val)
pretty_printers_dict[re.compile('^std::bitset<.*>$')] = StdBitsetPrinter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [archer] RFA: fix duplicate target-wide-encoding
2009-03-11 21:41 [archer] RFA: fix duplicate target-wide-encoding Tom Tromey
@ 2009-03-12 20:30 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2009-03-12 20:30 UTC (permalink / raw)
To: Project Archer
>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:
Tom> The libstdc++ pretty-printer code has a target-wide-encoding
Tom> parameter -- but this is also provided by the charset branch.
Tom> This patch removes the python one in favor of the internal one.
FYI -- Jan ok'd this on irc, so I've pushed it to the archer branch.
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-03-12 20:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-11 21:41 [archer] RFA: fix duplicate target-wide-encoding Tom Tromey
2009-03-12 20:30 ` Tom Tromey
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).