gdb/doc: fix the example for get_set_string in Python API docs
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 18 Mar 2021 16:44:14 +0000 (16:44 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 18 Mar 2021 16:55:37 +0000 (16:55 +0000)
The small example for gdb.Parameter.get_set_string does not return a
string.  The documentation is very clear that this method must return
a string, and indeed, inspecting the code in gdb/python/py-param.c
shows that a string return value is required (if an exception is not
thrown).

While inspecting the code in gdb/python/py-param.c I noticed that the
comment for the C++ code that invokes the Python get_set_string method
is wrong, so I updated that too.

gdb/ChangeLog:

* python/py-param.c (get_set_value): Update header comment.

gdb/doc/ChangeLog:

* python.texinfo (Parameters In Python): Return empty string in
small example code.

gdb/ChangeLog
gdb/doc/ChangeLog
gdb/doc/python.texi
gdb/python/py-param.c

index a606f54009c70d9fe940830eaea699979b7395f3..09cfe0f6723dc2b16c6c19cf06d22e37dc6e7a8b 100644 (file)
@@ -1,3 +1,7 @@
+2021-03-18  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * python/py-param.c (get_set_value): Update header comment.
+
 2021-03-17  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * infrun.c (check_multi_target_resumption): Remove argument to
index add31a0cc394773c1f21423d033ae9984ccd6178..625aa29728d927f86216840192b1b95608215086 100644 (file)
@@ -1,3 +1,8 @@
+2021-03-18  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * python.texinfo (Parameters In Python): Return empty string in
+       small example code.
+
 2021-02-24  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gdb.texinfo (Files): Document new 'maint info target-sections'
index ba3d2f92a431a3c7e4876bfd66088559a5e36b1b..9135d415dd110aece4875c37ce43b0d43fad9aa6 100644 (file)
@@ -4041,6 +4041,7 @@ class ExampleParam (gdb.Parameter):
         self.value = self.saved_value
         raise gdb.GdbError('Failed to validate')
       self.saved_value = self.value
+      return ""
 @end smallexample
 @end defun
 
index 49819ce4f109202b599a8b71949bafb988272da3..ab9e883dc2d64d34b58375edb3eca84befe911e9 100644 (file)
@@ -368,11 +368,10 @@ call_doc_function (PyObject *obj, PyObject *method, PyObject *arg)
 }
 
 /* A callback function that is registered against the respective
-   add_setshow_* set_doc prototype.  This function will either call
-   the Python function "get_set_string" or extract the Python
-   attribute "set_doc" and return the contents as a string.  If
-   neither exist, insert a string indicating the Parameter is not
-   documented.  */
+   add_setshow_* set_doc prototype.  This function calls the Python function
+   "get_set_string" if it exists, which will return a string.  That string
+   is then printed.  If "get_set_string" does not exist, or returns an
+   empty string, then nothing is printed.  */
 static void
 get_set_value (const char *args, int from_tty,
               struct cmd_list_element *c)
This page took 0.046512 seconds and 4 git commands to generate.