mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-17 07:40:07 +08:00
gdb/python: Add gdb.InferiorThread.__dict__ attribute
The gdb.Objfile, gdb.Progspace, gdb.Type, and gdb.Inferior Python types already have a __dict__ attribute, which allows users to create user defined attributes within the objects. This is useful if the user wants to cache information within an object. This commit adds the same functionality to the gdb.InferiorThread type. After this commit there is a new gdb.InferiorThread.__dict__ attribute, which is a dictionary. A user can, for example, do this: (gdb) pi >>> t = gdb.selected_thread() >>> t._user_attribute = 123 >>> t._user_attribute 123 >>> There's a new test included. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@@ -356,6 +356,10 @@ struct thread_object
|
||||
|
||||
/* The Inferior object to which this thread belongs. */
|
||||
PyObject *inf_obj;
|
||||
|
||||
/* Dictionary holding user-added attributes. This is the __dict__
|
||||
attribute of the object. */
|
||||
PyObject *dict;
|
||||
};
|
||||
|
||||
struct inferior_object;
|
||||
|
||||
Reference in New Issue
Block a user