public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/10705] New: python traceback on bad string character decoding
@ 2009-09-29 20:00 mjw at redhat dot com
  2009-09-29 20:01 ` [Bug python/10705] " tromey at redhat dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: mjw at redhat dot com @ 2009-09-29 20:00 UTC (permalink / raw)
  To: gdb-prs

GNU gdb (GDB) Fedora (6.8.50.20090302-38.fc11)

In the middle of printing a c++ class which contained a (uninitialized/bad)
string value I got the following python backtrace:
          module_name = Traceback (most recent call last):
          File "/usr/lib/python2.6/site-packages/gdb/libstdcxx/v6/printers.py",
line 453, in to_string
            return self.val['_M_dataplus']['_M_p'].string(encoding)
          File "/usr/lib64/python2.6/encodings/utf_8.py", line 16, in decode
            return codecs.utf_8_decode(input, errors, True)
        UnicodeDecodeError: 'utf8' codec can't decode byte 0x80 in position 0:
unexpected code byte
It would be much nicer if it would just say <can't decode string> or something
similar.

-- 
           Summary: python traceback on bad string character decoding
           Product: gdb
           Version: archer
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: mjw at redhat dot com
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10705] python traceback on bad string character decoding
  2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
@ 2009-09-29 20:01 ` tromey at redhat dot com
  2009-10-01  7:33 ` pmuldoon at redhat dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at redhat dot com @ 2009-09-29 20:01 UTC (permalink / raw)
  To: gdb-prs



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


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10705] python traceback on bad string character decoding
  2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
  2009-09-29 20:01 ` [Bug python/10705] " tromey at redhat dot com
@ 2009-10-01  7:33 ` pmuldoon at redhat dot com
  2009-10-19 20:06 ` tromey at redhat dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pmuldoon at redhat dot com @ 2009-10-01  7:33 UTC (permalink / raw)
  To: gdb-prs



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


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10705] python traceback on bad string character decoding
  2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
  2009-09-29 20:01 ` [Bug python/10705] " tromey at redhat dot com
  2009-10-01  7:33 ` pmuldoon at redhat dot com
@ 2009-10-19 20:06 ` tromey at redhat dot com
  2009-10-20  0:40 ` ppluzhnikov at google dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at redhat dot com @ 2009-10-19 20:06 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From tromey at redhat dot com  2009-10-19 20:06 -------
We could try playing with the "errors" parameter to Value.string.

Long term I think we want to have Value.string (or a replacement if
this cannot be done compatibly) return a Value that wraps a "lazy string".
This would require a small extension to struct value to let us
pass in the encoding (when known).

Additionally we'd want the pretty-printer string-printing code to
then respect "set print repeat", and generally work like the C string printer
when it comes to undecodable characters.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-10-19 20:06:39
               date|                            |


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10705] python traceback on bad string character decoding
  2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
                   ` (2 preceding siblings ...)
  2009-10-19 20:06 ` tromey at redhat dot com
@ 2009-10-20  0:40 ` ppluzhnikov at google dot com
  2009-11-24 17:17 ` tromey at redhat dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ppluzhnikov at google dot com @ 2009-10-20  0:40 UTC (permalink / raw)
  To: gdb-prs



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


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10705] python traceback on bad string character decoding
  2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
                   ` (3 preceding siblings ...)
  2009-10-20  0:40 ` ppluzhnikov at google dot com
@ 2009-11-24 17:17 ` tromey at redhat dot com
  2010-01-14  8:03 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at redhat dot com @ 2009-11-24 17:17 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From tromey at redhat dot com  2009-11-24 17:17 -------
Phil looked at changing struct value, but the val_print code makes
it too big.  We should probably get rid of val_print in favor of
value_print everywhere, but ...

Another approach to this problem would be to make a new Value.lazy_string
method.  This would return a Python object holding a pointer, type,
optional length, and optional encoding.  Then, change the code in
py-prettyprint.c to recognize these objects and print them via the
language string-printing function.  This would solve the immediate problems.
A new method may not be needed, if the new object can be made to look
sufficiently string-like to Python.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10705] python traceback on bad string character decoding
  2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
                   ` (4 preceding siblings ...)
  2009-11-24 17:17 ` tromey at redhat dot com
@ 2010-01-14  8:03 ` cvs-commit at gcc dot gnu dot org
  2010-01-14 19:47 ` tromey at redhat dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2010-01-14  8:03 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2010-01-14 08:03 -------
Subject: Bug 10705

CVSROOT:	/cvs/src
Module name:	src
Changes by:	pmuldoon@sourceware.org	2010-01-14 08:03:38

Modified files:
	gdb            : ChangeLog Makefile.in ada-lang.h ada-valprint.c 
	                 c-lang.c c-lang.h c-valprint.c expprint.c 
	                 f-lang.c f-valprint.c language.c language.h 
	                 m2-lang.c m2-valprint.c objc-lang.c p-lang.c 
	                 p-lang.h p-valprint.c scm-lang.c valprint.c 
	                 varobj.c 
	gdb/doc        : ChangeLog gdb.texinfo 
	gdb/python     : py-prettyprint.c py-value.c python-internal.h 
	                 python.c 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.python: py-mi.exp py-prettyprint.c 
	                          py-prettyprint.exp py-prettyprint.py 
	                          py-value.c py-value.exp 
Added files:
	gdb/python     : py-lazy-string.c 

Log message:
	2010-01-13  Phil Muldoon  <pmuldoon@redhat.com>
	
	PR python/10705
	
	* python/python-internal.h: Add lazy_string_object_type
	definition.
	(create_lazy_string_object, gdbpy_initialize_lazy_string)
	(gdbpy_is_lazystring, gdbpy_extract_lazy_string): Define.
	* python/py-value.c (valpy_lazy_string): New function.
	(convert_value_from_python): Add lazy string conversion.
	* python/py-prettyprint.c (pretty_print_one_value): Check if
	return is also a lazy string.
	(print_string_repr): Add lazy string printing branch.
	(print_children): Likewise.
	* python/py-lazy-string.c: New file. Implement lazy strings.
	* python/python.c (_initialize_python): Call
	gdbpy_initialize_lazy_string.
	* varobj.c (value_get_print_value): Add lazy string printing
	branch.  Account for encoding.
	* c-lang.c (c_printstr): Account for new encoding argument.  If
	encoding is NULL, find encoding suited for type, otherwise use
	user encoding.
	* language.h (language_defn): Add encoding argument.
	(LA_PRINT_STRING): Likewise.
	* language.c (unk_lang_printstr): Update to reflect new encoding
	argument to language_defn.
	* ada-lang.h (ada_printstr): Likewise.
	* c-lang.h (c_printstr): Likewise.
	* p-lang.h (pascal_printstr);
	* f-lang.c (f_printstr): Likewise.
	* m2-lang.c (m2_printstr): Likewise.
	* objc-lang.c (objc_printstr): Likewise.
	* p-lang.c (pascal_printstr): Likewise.
	* scm-lang.c (scm_printstr): Likewise.
	* c-valprint.c (c_val_print): Update LA_PRINT_STRING call for
	encoding argument.
	* ada-valprint.c (ada_printstr): Likewise.
	* f-valprint.c (f_val_print): Likewise
	* m2-valprint.c (m2_val_print): Likewise.
	* p-valprint.c (pascal_val_print): Likewise.
	* expprint.c (print_subexp_standard): Likewise.
	* valprint.c (val_print_string): Likewise.
	* Makefile.in (SUBDIR_PYTHON_OBS): Add py-lazy-string.
	(SUBDIR_PYTHON_SRCS): Likewise.
	(py-lazy-string.o): New rule.
	
	2010-01-13  Phil Muldoon  <pmuldoon@redhat.com>
	
	* gdb.texinfo (Values From Inferior): Document lazy_string value
	method.
	(Python API): Add Lazy strings menu item.
	(Lazy Strings In Python): New node.
	
	2010-01-13  Phil Muldoon  <pmuldoon@redhat.com>
	
	* gdb.python/py-value.exp (test_lazy_strings): Add lazy string test.
	* gdb.python/py-prettyprint.py (pp_ls): New printer.
	* gdb.python/py-prettyprint.exp (run_lang_tests): Add lazy string
	test.
	* gdb.python/py-prettyprint.c: Define lazystring test structure.
	* gdb.python/py-mi.exp: Add lazy string test.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.11242&r2=1.11243
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/Makefile.in.diff?cvsroot=src&r1=1.1108&r2=1.1109
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ada-lang.h.diff?cvsroot=src&r1=1.50&r2=1.51
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ada-valprint.c.diff?cvsroot=src&r1=1.60&r2=1.61
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-lang.c.diff?cvsroot=src&r1=1.79&r2=1.80
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-lang.h.diff?cvsroot=src&r1=1.25&r2=1.26
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-valprint.c.diff?cvsroot=src&r1=1.64&r2=1.65
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/expprint.c.diff?cvsroot=src&r1=1.40&r2=1.41
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/f-lang.c.diff?cvsroot=src&r1=1.58&r2=1.59
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/f-valprint.c.diff?cvsroot=src&r1=1.54&r2=1.55
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/language.c.diff?cvsroot=src&r1=1.93&r2=1.94
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/language.h.diff?cvsroot=src&r1=1.61&r2=1.62
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/m2-lang.c.diff?cvsroot=src&r1=1.53&r2=1.54
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/m2-valprint.c.diff?cvsroot=src&r1=1.25&r2=1.26
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/objc-lang.c.diff?cvsroot=src&r1=1.85&r2=1.86
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/p-lang.c.diff?cvsroot=src&r1=1.49&r2=1.50
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/p-lang.h.diff?cvsroot=src&r1=1.20&r2=1.21
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/p-valprint.c.diff?cvsroot=src&r1=1.66&r2=1.67
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/scm-lang.c.diff?cvsroot=src&r1=1.58&r2=1.59
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/valprint.c.diff?cvsroot=src&r1=1.89&r2=1.90
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/varobj.c.diff?cvsroot=src&r1=1.152&r2=1.153
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/doc/ChangeLog.diff?cvsroot=src&r1=1.993&r2=1.994
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/doc/gdb.texinfo.diff?cvsroot=src&r1=1.657&r2=1.658
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/python/py-lazy-string.c.diff?cvsroot=src&r1=NONE&r2=1.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/python/py-prettyprint.c.diff?cvsroot=src&r1=1.3&r2=1.4
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/python/py-value.c.diff?cvsroot=src&r1=1.6&r2=1.7
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/python/python-internal.h.diff?cvsroot=src&r1=1.18&r2=1.19
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/python/python.c.diff?cvsroot=src&r1=1.22&r2=1.23
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.2081&r2=1.2082
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/py-mi.exp.diff?cvsroot=src&r1=1.4&r2=1.5
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/py-prettyprint.c.diff?cvsroot=src&r1=1.3&r2=1.4
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/py-prettyprint.exp.diff?cvsroot=src&r1=1.5&r2=1.6
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/py-prettyprint.py.diff?cvsroot=src&r1=1.3&r2=1.4
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/py-value.c.diff?cvsroot=src&r1=1.3&r2=1.4
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.python/py-value.exp.diff?cvsroot=src&r1=1.4&r2=1.5



-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10705] python traceback on bad string character decoding
  2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
                   ` (5 preceding siblings ...)
  2010-01-14  8:03 ` cvs-commit at gcc dot gnu dot org
@ 2010-01-14 19:47 ` tromey at redhat dot com
  2010-01-15 23:43 ` pmuldoon at redhat dot com
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at redhat dot com @ 2010-01-14 19:47 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From tromey at redhat dot com  2010-01-14 19:47 -------
Phil checked in the fix.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|6.8                         |7.1


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10705] python traceback on bad string character decoding
  2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
                   ` (7 preceding siblings ...)
  2010-01-15 23:43 ` pmuldoon at redhat dot com
@ 2010-01-15 23:43 ` pmuldoon at redhat dot com
  2010-01-15 23:44 ` pmuldoon at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: pmuldoon at redhat dot com @ 2010-01-15 23:43 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From pmuldoon at redhat dot com  2010-01-15 23:43 -------
Adding GCC libstdc++ printer.py changes link.

http://gcc.gnu.org/viewcvs?view=revision&revision=155951

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


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10705] python traceback on bad string character decoding
  2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
                   ` (6 preceding siblings ...)
  2010-01-14 19:47 ` tromey at redhat dot com
@ 2010-01-15 23:43 ` pmuldoon at redhat dot com
  2010-01-15 23:43 ` pmuldoon at redhat dot com
  2010-01-15 23:44 ` pmuldoon at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: pmuldoon at redhat dot com @ 2010-01-15 23:43 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware dot|pmuldoon at redhat dot com
                   |org                         |
             Status|REOPENED                    |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug python/10705] python traceback on bad string character decoding
  2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
                   ` (8 preceding siblings ...)
  2010-01-15 23:43 ` pmuldoon at redhat dot com
@ 2010-01-15 23:44 ` pmuldoon at redhat dot com
  9 siblings, 0 replies; 11+ messages in thread
From: pmuldoon at redhat dot com @ 2010-01-15 23:44 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From pmuldoon at redhat dot com  2010-01-15 23:44 -------
Re-closing after libstdc++ link.

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


http://sourceware.org/bugzilla/show_bug.cgi?id=10705

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2010-01-15 23:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-29 20:00 [Bug python/10705] New: python traceback on bad string character decoding mjw at redhat dot com
2009-09-29 20:01 ` [Bug python/10705] " tromey at redhat dot com
2009-10-01  7:33 ` pmuldoon at redhat dot com
2009-10-19 20:06 ` tromey at redhat dot com
2009-10-20  0:40 ` ppluzhnikov at google dot com
2009-11-24 17:17 ` tromey at redhat dot com
2010-01-14  8:03 ` cvs-commit at gcc dot gnu dot org
2010-01-14 19:47 ` tromey at redhat dot com
2010-01-15 23:43 ` pmuldoon at redhat dot com
2010-01-15 23:43 ` pmuldoon at redhat dot com
2010-01-15 23:44 ` pmuldoon at redhat 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).