Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: gdb/python/py-utils.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/python/py-type.c ('k') | gdb/python/py-value.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/python/py-utils.c
diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c
index 3579720674d6ab10fa9eb524247920baa4f84cd7..d5d0e431b55c545e9ef2c4a4394f685366c61b98 100644
--- a/gdb/python/py-utils.c
+++ b/gdb/python/py-utils.c
@@ -139,7 +139,7 @@ unicode_to_target_string (PyObject *unicode_str)
object converted to the target's charset. If an error occurs
during the conversion, NULL will be returned and a python exception
will be set. */
-PyObject *
+static PyObject *
unicode_to_target_python_string (PyObject *unicode_str)
{
return unicode_to_encoded_python_string (unicode_str,
@@ -373,3 +373,23 @@ gdb_py_int_as_long (PyObject *obj, long *result)
*result = PyInt_AsLong (obj);
return ! (*result == -1 && PyErr_Occurred ());
}
+
+
+
+/* Generic implementation of the __dict__ attribute for objects that
+ have a dictionary. The CLOSURE argument should be the type object.
+ This only handles positive values for tp_dictoffset. */
+
+PyObject *
+gdb_py_generic_dict (PyObject *self, void *closure)
+{
+ PyObject *result;
+ PyTypeObject *type_obj = closure;
+ char *raw_ptr;
+
+ raw_ptr = (char *) self + type_obj->tp_dictoffset;
+ result = * (PyObject **) raw_ptr;
+
+ Py_INCREF (result);
+ return result;
+}
« no previous file with comments | « gdb/python/py-type.c ('k') | gdb/python/py-value.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698