This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/10664] New: gdb.Value.string() doesn't work for character types wider than 1 byte


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]