This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Small fixes for gdb.Frame.
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: archer ml <archer at sourceware dot org>
- Date: Wed, 28 Jan 2009 01:15:48 -0200
- Subject: Small fixes for gdb.Frame.
Hi,
Some methods of Frame were returning an 8-bit string instead of a
Unicode string. Also, shortened the name of the method
'address_in_block' to 'addr_in_block'. Committed.
--
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center
2009-01-26 Thiago Jung Bauermann <bauerman@br.ibm.com>
* gdb/python/python-frame.c (frapy_name): Return a Unicode string
instead of an 8-bit string.
(frapy_frame_stop_reason_string): Likewise.
(frapy_address_in_block): Rename to frapy_addr_in_block.
(frame_object_methods): Rename `address_in_block' entry to `addr_in_block'.
* gdb/python/lib/gdb/command/backtrace.py (describe): Update to call
`addr_in_block'.
diff --git a/gdb/python/lib/gdb/command/backtrace.py b/gdb/python/lib/gdb/command/backtrace.py
index 957b306..97c76d1 100644
--- a/gdb/python/lib/gdb/command/backtrace.py
+++ b/gdb/python/lib/gdb/command/backtrace.py
@@ -92,7 +92,7 @@ class FrameWrapper:
stream.write (" 0x%08x in" % pc)
stream.write (" " + name + " (")
- func = gdb.find_pc_function (self.frame.address_in_block ())
+ func = gdb.find_pc_function (self.frame.addr_in_block ())
self.print_frame_args (stream, func)
stream.write (")")
diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 9269b34..8bc66cd 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
@@ -139,7 +139,7 @@ frapy_name (PyObject *self, PyObject *args)
GDB_PY_HANDLE_EXCEPTION (except);
if (name)
- result = PyString_Decode (name, strlen (name), host_charset (), NULL);
+ result = target_string_to_unicode (name, strlen (name));
else
{
result = Py_None;
@@ -204,7 +204,7 @@ frapy_pc (PyObject *self, PyObject *args)
}
static PyObject *
-frapy_address_in_block (PyObject *self, PyObject *args)
+frapy_addr_in_block (PyObject *self, PyObject *args)
{
CORE_ADDR pc = 0; /* Initialize to appease gcc warning. */
struct frame_info *frame;
@@ -457,7 +457,7 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
}
str = frame_stop_reason_string (reason);
- return PyString_Decode (str, strlen (str), host_charset (), NULL);
+ return PyUnicode_Decode (str, strlen (str), host_charset (), NULL);
}
void
@@ -503,7 +503,7 @@ static PyMethodDef frame_object_methods[] = {
{ "unwind_stop_reason", frapy_unwind_stop_reason, METH_NOARGS,
"Return the function name of the frame." },
{ "pc", frapy_pc, METH_NOARGS, "Return the frame's resume address." },
- { "address_in_block", frapy_address_in_block, METH_NOARGS,
+ { "addr_in_block", frapy_addr_in_block, METH_NOARGS,
"Return an address which falls within the frame's code block." },
{ "older", frapy_older, METH_NOARGS,
"Return the frame immediately older (outer) to this frame." },