Add gdb.Objfile.username.
[deliverable/binutils-gdb.git] / gdb / python / py-objfile.c
index 378db58fea7021467feaba785eae7fb0537a06c6..0aecaf64953eae9d04f380eb0b3e067115f28f45 100644 (file)
@@ -81,6 +81,25 @@ objfpy_get_filename (PyObject *self, void *closure)
   Py_RETURN_NONE;
 }
 
+/* An Objfile method which returns the objfile's file name, as specified
+   by the user, or None.  */
+
+static PyObject *
+objfpy_get_username (PyObject *self, void *closure)
+{
+  objfile_object *obj = (objfile_object *) self;
+
+  if (obj->objfile)
+    {
+      const char *username = obj->objfile->original_name;
+
+      return PyString_Decode (username, strlen (username),
+                             host_charset (), NULL);
+    }
+
+  Py_RETURN_NONE;
+}
+
 /* If SELF is a separate debug-info file, return the "backlink" field.
    Otherwise return None.  */
 
@@ -613,6 +632,8 @@ static PyGetSetDef objfile_getset[] =
     "The __dict__ for this objfile.", &objfile_object_type },
   { "filename", objfpy_get_filename, NULL,
     "The objfile's filename, or None.", NULL },
+  { "username", objfpy_get_username, NULL,
+    "The name of the objfile as provided by the user, or None.", NULL },
   { "owner", objfpy_get_owner, NULL,
     "The objfile owner of separate debug info objfiles, or None.",
     NULL },
This page took 0.03638 seconds and 4 git commands to generate.