This is the mail archive of the archer@sourceware.org mailing list for the Archer 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]

[python] fix up documentation for Parameters


This patch updates Parameters to use the class' __doc__ as well as the
set_doc and show_doc attributes.  This makes it possible to get nicer
help output in gdb.

Tom

2008-11-21  Tom Tromey  <tromey@redhat.com>

	* python/python-param.c (parmpy_init): Get __doc__ as well.

diff --git a/gdb/python/python-param.c b/gdb/python/python-param.c
index 96c92c8..aad8932 100644
--- a/gdb/python/python-param.c
+++ b/gdb/python/python-param.c
@@ -422,7 +422,7 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
 {
   parmpy_object *obj = (parmpy_object *) self;
   char *name;
-  char *set_doc, *show_doc;
+  char *set_doc, *show_doc, *doc;
   char *cmd_name;
   int parmclass, cmdtype;
   PyObject *enum_values = NULL;
@@ -483,6 +483,7 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
      set/show commands.  So, these are leaked.  */
   set_doc = get_doc_string (self, set_doc_cst);
   show_doc = get_doc_string (self, show_doc_cst);
+  doc = get_doc_string (self, gdbpy_doc_cst);
 
   Py_INCREF (self);
 
@@ -491,13 +492,14 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
       add_setshow_generic (parmclass, (enum command_class) cmdtype,
 			   cmd_name, obj,
 			   set_doc, show_doc,
-			   NULL, set_list, show_list);
+			   doc, set_list, show_list);
     }
   if (except.reason < 0)
     {
       xfree (cmd_name);
       xfree (set_doc);
       xfree (show_doc);
+      xfree (doc);
       Py_DECREF (self);
       PyErr_Format (except.reason == RETURN_QUIT
 		    ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,


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