gdb/doc: fix the example for get_set_string in Python API docs

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.
This commit is contained in:
Andrew Burgess 2021-03-18 16:44:14 +00:00
parent 538c15fc2a
commit 763b8efdcc
4 changed files with 14 additions and 5 deletions

View 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)