From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id BF8C838618E2 for ; Thu, 18 Mar 2021 16:56:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BF8C838618E2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-ej1-x630.google.com with SMTP id b9so5050314ejc.11 for ; Thu, 18 Mar 2021 09:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=edBSpQO0hr2LMshrNJmhaH4qB53hTauZLbQJ2/pxsUc=; b=VlPT7LSjyfEIiS6W4jASTbjdnyYVlh4vxa7I6f8jB2RyORmdDY2OuS66gq2iEatQSl BGrNvOpWn9gN0pSKygnJIAapyaNxoJZPTxvRjTB7qvhktlPE528qT8r1Ls2VAAAI49zk LUrJLafUgRA9fIS8vvGNaw40Vs3lWOGuSo4HXoPkmuNHbf1bzxDIqfdNTeAH2Pn9f4o0 EMi6M4cKaj8FKNfUYskU6zNyInfr/m9gepSnkNz9He4+mXWRjCF8FTJ3JctaMLDTPLA5 pBytOxHpiNHUGFljLQg0ThIj4eAWATnv3p3pGGKI7wfLuces/k8JL/tDgPbcvUgVLIMp gYkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=edBSpQO0hr2LMshrNJmhaH4qB53hTauZLbQJ2/pxsUc=; b=f2ZCty2c+wrNb7I0wJc6wHbyoxZ0arIDGLXscG1N9LmLG5MP9uSRTaZSRB1KFbV+fA NuL4+EFBxfr7Xb8gnVG31uZ8+L7xtg3IfqOh1Wg0GSBoe5LGHdfMMl8CC+ig5GyL8f68 YzhSBTFUE8lp4dbMxi6lzka+KvhNXPGvvvNAvKB24PaYNMvzl99Xgbh1KMY3Z6Bc0smD k3dFqPQBKervwBNi7FEr8ShlqjDOjpCQqDBZF19366xVzRLNyd9vcdX6H8PGdTqhhC3E yppyjbMFRf798yO5tNDBRuItoL0AtZnlZX/DRFsPE82Aca+Urw+kJsAH4R2Gz6uhAeIg FFxg== X-Gm-Message-State: AOAM531oFgElihkh/UvUfQUGTLe9kJCF/AHDxmxDXbNoZSDBNYb4R1MY z+kGnxVPqZCwaN7twS7aY/P0rGSpqSGFwA== X-Google-Smtp-Source: ABdhPJw7MgTrxp0iylGsB5RzQwsjiSQ+9y4nZe+oESl2l0F9Hzktv7iHBXhQzFo6xWAO3gemOBDccQ== X-Received: by 2002:a17:906:ae88:: with SMTP id md8mr40553528ejb.264.1616086585658; Thu, 18 Mar 2021 09:56:25 -0700 (PDT) Received: from localhost (host165-120-118-227.range165-120.btcentralplus.com. [165.120.118.227]) by smtp.gmail.com with ESMTPSA id cf4sm2582075edb.19.2021.03.18.09.56.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Mar 2021 09:56:25 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: [PUSHED] gdb/doc: fix the example for get_set_string in Python API docs Date: Thu, 18 Mar 2021 16:56:13 +0000 Message-Id: <20210318165613.1991044-1-andrew.burgess@embecosm.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 16:56:28 -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 | 4 ++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/python.texi | 1 + gdb/python/py-param.c | 9 ++++----- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index ba3d2f92a43..9135d415dd1 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -4041,6 +4041,7 @@ self.value = self.saved_value raise gdb.GdbError('Failed to validate') self.saved_value = self.value + return "" @end smallexample @end defun diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c index 49819ce4f10..ab9e883dc2d 100644 --- a/gdb/python/py-param.c +++ b/gdb/python/py-param.c @@ -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) -- 2.25.4