public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/10664] New: gdb.Value.string() doesn't work for character types wider than 1 byte
@ 2009-09-18 21:34 jason dot orendorff at gmail dot com
  2009-09-18 22:11 ` [Bug python/10664] " jason dot orendorff at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jason dot orendorff at gmail dot com @ 2009-09-18 21:34 UTC (permalink / raw)
  To: gdb-prs

I think the bug is in gdb/python/python-value.c, in valpy_string:

  TRY_CATCH (except, RETURN_MASK_ALL)
    {
      LA_GET_STRING (value, &buffer, &length, &la_encoding);
    }
  GDB_PY_HANDLE_EXCEPTION (except);

  encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding;
  unicode = PyUnicode_Decode (buffer, length, encoding, errors);

PyUnicode_Decode expects `length` to be a byte count. But of LA_GET_STRING,
language.h says, "On completion, *LENGTH will hold the size of the string in
characters."

-- 
           Summary: gdb.Value.string() doesn't work for character types
                    wider than 1 byte
           Product: gdb
           Version: archer
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: jason dot orendorff at gmail dot com
                CC: gdb-prs at sourceware dot org


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

------- 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] 5+ messages in thread

* [Bug python/10664] gdb.Value.string() doesn't work for character types wider than 1 byte
  2009-09-18 21:34 [Bug python/10664] New: gdb.Value.string() doesn't work for character types wider than 1 byte jason dot orendorff at gmail dot com
@ 2009-09-18 22:11 ` jason dot orendorff at gmail dot com
  2009-09-21 15:29 ` tromey at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jason dot orendorff at gmail dot com @ 2009-09-18 22:11 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From jason dot orendorff at gmail dot com  2009-09-18 22:11 -------
Created an attachment (id=4215)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=4215&action=view)
fix

This fixes it for me.

-- 


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

------- 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] 5+ messages in thread

* [Bug python/10664] gdb.Value.string() doesn't work for character types wider than 1 byte
  2009-09-18 21:34 [Bug python/10664] New: gdb.Value.string() doesn't work for character types wider than 1 byte jason dot orendorff at gmail dot com
  2009-09-18 22:11 ` [Bug python/10664] " jason dot orendorff at gmail dot com
@ 2009-09-21 15:29 ` tromey at redhat dot com
  2009-09-25 21:40 ` cvs-commit at gcc dot gnu dot org
  2009-09-25 21:41 ` tromey at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at redhat dot com @ 2009-09-21 15:29 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From tromey at redhat dot com  2009-09-21 15:29 -------
I have a different patch for this.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware dot|tromey at redhat dot com
                   |org                         |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-09-21 15:29:31
               date|                            |


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

------- 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] 5+ messages in thread

* [Bug python/10664] gdb.Value.string() doesn't work for character types wider than 1 byte
  2009-09-18 21:34 [Bug python/10664] New: gdb.Value.string() doesn't work for character types wider than 1 byte jason dot orendorff at gmail dot com
  2009-09-18 22:11 ` [Bug python/10664] " jason dot orendorff at gmail dot com
  2009-09-21 15:29 ` tromey at redhat dot com
@ 2009-09-25 21:40 ` cvs-commit at gcc dot gnu dot org
  2009-09-25 21:41 ` tromey at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2009-09-25 21:40 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2009-09-25 21:40 -------
Subject: Bug 10664

CVSROOT:	/cvs/src
Module name:	src
Changes by:	tromey@sourceware.org	2009-09-25 21:39:53

Modified files:
	gdb            : ChangeLog c-lang.c c-lang.h c-valprint.c 
	                 language.c language.h 
	gdb/python     : py-value.c 
	gdb/testsuite  : ChangeLog 
	gdb/testsuite/gdb.base: charset.exp 

Log message:
	gdb
	PR python/10664:
	* language.h (struct language_defn) <la_get_string>: Add
	'char_type' argument.
	(LA_GET_STRING): Likewise.
	(default_get_string, c_get_string): Update.
	* language.c (default_get_string): Add 'char_type' argument.
	* c-valprint.c (c_textual_element_type): Rename from
	textual_element_type.  No longer static.  Update callers.
	* c-lang.h (c_textual_element_type): Declare.
	* c-lang.c (c_get_string): Add 'char_type' argument.
	gdb/testsuite
	PR python/10664:
	* gdb.base/charset.exp: Test utf-16 strings with Python.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.10905&r2=1.10906
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-lang.c.diff?cvsroot=src&r1=1.77&r2=1.78
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-lang.h.diff?cvsroot=src&r1=1.23&r2=1.24
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/c-valprint.c.diff?cvsroot=src&r1=1.61&r2=1.62
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/language.c.diff?cvsroot=src&r1=1.90&r2=1.91
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/language.h.diff?cvsroot=src&r1=1.59&r2=1.60
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/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/ChangeLog.diff?cvsroot=src&r1=1.1967&r2=1.1968
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/charset.exp.diff?cvsroot=src&r1=1.17&r2=1.18



-- 


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

------- 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] 5+ messages in thread

* [Bug python/10664] gdb.Value.string() doesn't work for character types wider than 1 byte
  2009-09-18 21:34 [Bug python/10664] New: gdb.Value.string() doesn't work for character types wider than 1 byte jason dot orendorff at gmail dot com
                   ` (2 preceding siblings ...)
  2009-09-25 21:40 ` cvs-commit at gcc dot gnu dot org
@ 2009-09-25 21:41 ` tromey at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at redhat dot com @ 2009-09-25 21:41 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From tromey at redhat dot com  2009-09-25 21:41 -------
I've checked in a fix for this.
It is currently on cvs trunk; not sure whether I will port it to the 7.0 branch.

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


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

------- 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] 5+ messages in thread

end of thread, other threads:[~2009-09-25 21:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-18 21:34 [Bug python/10664] New: gdb.Value.string() doesn't work for character types wider than 1 byte jason dot orendorff at gmail dot com
2009-09-18 22:11 ` [Bug python/10664] " jason dot orendorff at gmail dot com
2009-09-21 15:29 ` tromey at redhat dot com
2009-09-25 21:40 ` cvs-commit at gcc dot gnu dot org
2009-09-25 21:41 ` tromey 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).