From patchwork Tue Jun 24 19:01:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Lebar X-Patchwork-Id: 1702 Received: (qmail 1353 invoked by alias); 24 Jun 2014 19:01:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 1332 invoked by uid 89); 24 Jun 2014 19:01:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-lb0-f201.google.com Received: from mail-lb0-f201.google.com (HELO mail-lb0-f201.google.com) (209.85.217.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 24 Jun 2014 19:01:54 +0000 Received: by mail-lb0-f201.google.com with SMTP id u10so109416lbd.4 for ; Tue, 24 Jun 2014 12:01:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=GP55bdBGVzyNd4ZsDLloIjaLLmSYvyy1Gc6BvK1oxfg=; b=Say89tV3ACWiL1j9uAEypt8EKj17kmG2ywgXmhJHS6qfT4kTJiZPUhr6Ko+HTzXPlV 0wBxZkk7XuJrrzlY4XMQV+DahA9YyWylfF8sQXThYqQpqDK2t0zNu5TiQiqJ7QDH0FgG hoDByr3Pf4KZiHiwMa3MYJA2TKRNnImIoIpVuu/p7Jh7bLBcDyRTV8fKc2hvU/od7S1l QwGdBODbzroXamC//HDVsBB3iAV1LNtL8oBnympXuYg+/wuYwJH9pgt2zhG7wRz+4zPX m+0Jrxd6DvHLCZrZqiPXZOlJRBW+nkm4Z0Dd9lL08K4r+ly7CGL0q6j9RBJgVZfVe0Qc FzCA== X-Gm-Message-State: ALoCoQninFjiSpwpIboycggEcqza4wrJS78b1+1tbynFlmH+Yn811RLzxTNxK42pOw8wfEabCUJf X-Received: by 10.194.143.109 with SMTP id sd13mr384256wjb.6.1403636511079; Tue, 24 Jun 2014 12:01:51 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id c50si100626yhl.7.2014.06.24.12.01.51 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jun 2014 12:01:51 -0700 (PDT) Received: from jlebar0.mtv.corp.google.com (jlebar0.mtv.corp.google.com [172.17.132.58]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id DB4045A43E2; Tue, 24 Jun 2014 12:01:50 -0700 (PDT) Received: by jlebar0.mtv.corp.google.com (Postfix, from userid 214119) id 5BC3B1A0903; Tue, 24 Jun 2014 12:01:50 -0700 (PDT) From: Justin Lebar To: gdb-patches@sourceware.org Cc: Justin Lebar Subject: [PATCH] Fix documentation for Type.template_argument. Date: Tue, 24 Jun 2014 12:01:36 -0700 Message-Id: <1403636496-9795-1-git-send-email-jlebar@google.com> 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 * 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..f9e0b0c 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 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.