This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2] Fix documentation for Type.template_argument.
- From: Justin Lebar <jlebar at google dot com>
- To: gdb-patches at sourceware dot org
- Cc: Justin Lebar <jlebar at google dot com>
- Date: Tue, 24 Jun 2014 15:38:44 -0700
- Subject: [PATCH v2] Fix documentation for Type.template_argument.
- Authentication-results: sourceware.org; auth=none
In the Python API, Type.template_argument(n) returns either a gdb.Type
or a gdb.Value, depending on whether the n'th template argument is a C++
type or a C++ value.
Also add a note that Type.template_argument(n) throws an exception if n
is out of range (as opposed to, say, returning None).
There's one piece of the documentation I still don't understand:
> If block is given, then name is looked up in that scope. Otherwise, it
> is searched for globally.
What is 'name', exactly, and why are we looking it up? I'd be happy to
fix this up if we could clarify this, but otherwise this patch stands on
its own.
2014-06-18 Justin Lebar <jlebar@google.com>
* python.texi (Types In Python): Type.template_argument(n) returns a
gdb.Value or a gdb.Type and throws an exception if n is out of
range.
---
gdb/doc/python.texi | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 4688783..266af80 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -1048,11 +1048,12 @@ exception.
@defun Type.template_argument (n @r{[}, block@r{]})
If this @code{gdb.Type} is an instantiation of a template, this will
-return a new @code{gdb.Type} which represents the type of the
-@var{n}th template argument.
+return a new @code{gdb.Value} or @code{gdb.Type} which represents the
+value of the @var{n}th template argument (indexed starting at 0).
-If this @code{gdb.Type} is not a template type, this will throw an
-exception. Ordinarily, only C@t{++} code will have template types.
+If this @code{gdb.Type} is not a template type, or if the type has fewer
+than @var{n} template arguments, this will throw an exception.
+Ordinarily, only C@t{++} code will have template types.
If @var{block} is given, then @var{name} is looked up in that scope.
Otherwise, it is searched for globally.
--
2.0.0.526.g5318336