From patchwork Tue Jun 24 22:38:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Lebar X-Patchwork-Id: 1706 Received: (qmail 10515 invoked by alias); 24 Jun 2014 22:38:50 -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 10503 invoked by uid 89); 24 Jun 2014 22:38:49 -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-yk0-f202.google.com Received: from mail-yk0-f202.google.com (HELO mail-yk0-f202.google.com) (209.85.160.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 24 Jun 2014 22:38:48 +0000 Received: by mail-yk0-f202.google.com with SMTP id 19so33680ykq.1 for ; Tue, 24 Jun 2014 15:38:47 -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=v/wBgPbHJjKhZUd4VZ8PxfJGLEBh7ogBOuvxZUSlbfY=; b=hgoOAUsBEafRqq4KM0N4oob34BLKSqRY1ProduM24ppWmunGOBTm4QpRGEoOlr7NQ4 fQQtr5iBqbOPIJ7TjWg6+7FBQx4XCzGFvNkkcyhztX0mgT1sjuXfTPshwHHV2OtT1sgR LWgiUDNRwTnsgAC4a47GooLCtJbZj16SBr1GgC2mkVWSuDn37yBjOCI91zFenRhfMmYQ RSNMNyIfgnpVynC4FY/e9x2XHd5Wk8sQD+rA3aSR3XKeyUose5xUCPeokKxfNYmsLjWT D3XgS1ynMijUlXzrX7jA+by0pSF1pMtYE7Dqhv5KfFR3WAMKnbi1vMucuaomrnClxI9J QzeQ== X-Gm-Message-State: ALoCoQlfqI0+LZy+owbmn3pVKGjVdF0G9trz2IObpLmk+mVslpaZ/2EQw6cqlAw3j549G1Kz+Zfa X-Received: by 10.58.29.67 with SMTP id i3mr2129328veh.3.1403649526912; Tue, 24 Jun 2014 15:38:46 -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 o69si147879yhp.6.2014.06.24.15.38.46 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jun 2014 15:38:46 -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 B857A5A4837; Tue, 24 Jun 2014 15:38:46 -0700 (PDT) Received: by jlebar0.mtv.corp.google.com (Postfix, from userid 214119) id 581A91A0BFE; Tue, 24 Jun 2014 15:38:46 -0700 (PDT) From: Justin Lebar To: gdb-patches@sourceware.org Cc: Justin Lebar Subject: [PATCH v2] Fix documentation for Type.template_argument. Date: Tue, 24 Jun 2014 15:38:44 -0700 Message-Id: <1403649524-10769-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..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.