From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23650 invoked by alias); 23 Aug 2014 02:27:58 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23631 invoked by uid 89); 23 Aug 2014 02:27:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 X-HELO: layla.krisman.be Received: from layla.krisman.be (HELO layla.krisman.be) (176.31.208.35) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 23 Aug 2014 02:27:52 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (envelope-from ) id 1XL10t-0005Jl-65; Sat, 23 Aug 2014 04:25:07 +0200 From: Gabriel Krisman Bertazi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix PR gdb/17035: "show user" doesn't list user-defined commands that have empty bodies. References: <1408515134-31165-1-git-send-email-gabriel@krisman.be> <53F615D8.5000901@redhat.com> Date: Sat, 23 Aug 2014 02:27:00 -0000 In-Reply-To: <53F615D8.5000901@redhat.com> (Pedro Alves's message of "Thu, 21 Aug 2014 16:52:56 +0100") Message-ID: <878umgaqjk.fsf@krisman.be> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00511.txt.bz2 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Content-length: 1826 Pedro Alves writes: >> c =3D lookup_cmd (&comname, cmdlist, "", 0, 1); >> - /* c->user_commands would be NULL if it's a python/scheme command= . */ >> - if (c->class !=3D class_user || !c->user_commands) >> - error (_("Not a user command.")); >> + if (c->class !=3D class_user) >> + error (_("Not a user command.")); > > Doesn't this mean this reverts part of 7d74f2446, and thus now we'd > show python/scheme commands? > > IIUC 7d74f2446, it looks like gdb.python/py-cmd.exp is missing > a test that makes sure "show user" doesn't list the user-defined python c= ommand. > > (hmm, this "show user" vs "help user-defined" difference isn't very > intuitive) Hello Pedro, Thanks for your review. Indeed, this means we'd start to show python/scheme commands, but I wasn't aware of commit 7d74f2446. I don't see that as a problem, because python/scheme are also user commands (or, at least, are part of class_user class). Considering that "help user-defined" also shows python/scheme commands, I believe it would be more practical to just list them on "show user" (should we update the doc string, as well). Either way, the "Not a user command" error message is quite misleading for python/scheme commands, though. If you disagree, I'd be happy to update the patch to rely on another condition to avoid printing python/scheme commands. c->function.cfunc/sfunc =3D=3D NULL seems to work pretty well to avoid printing python commands. What do you think? > What is this printing now ? Now, it prints: (gdb) show user User command "emptycmd": User command "cmd1": print "Hello" User command "python-hello": User command "user-defined": Using the verification for cfunc/sfunc above, also avoids printing the "user-defined" line. Thanks, --=20 Gabriel Krisman Bertazi --=-=-= Content-Type: application/pgp-signature Content-length: 818 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJT9/wfAAoJEO9pqxSS5VgPd1AP/2BHOsGLm2o7eGy3pgklCP03 BrAzZ5c28Fk1aznwSp6f9TeQ/wkQGj6gI7ZanWjaT35jnZKwR67vJqkXzimcGcT6 damCfH7H9Sj/5qdPMM9fee29O2g3mHgmv7+jg7uGI/15IpwPgJV46cp8rdqJTGDK Z/dOgSNkXIGwFHW1jiY+1bVZLf7B7ZnyCcvPfKwzXn8hMxDApTGldHUl+bLkrKoN h9WsYweLlnkAGsBhYZ/3sCHdydqi/byzM57RPtOnGXqRA/UyQcifp8xPJXTISri6 KMZHF14O8vI9/5wIXBe/4j1nsqQ4DQgcOkUVKLcYfgrORsYEvHql4kwt/FR58Gjo WJoQ7JgT8rLSajLUyBdup1awEcW6GLz1RjLQfZ0ZjjkPHNaCr7g7/uh3Xyk5x4To MnjflfcsedKzlmxkUa97H89WNSpBJFbder6Mk/VXyzNavW2JUEj+jlfln7pBfqUq QXHVYC0L6DXywrNSkRjTwwsowPKCWMWuw7G8ZJBD22NmKae3RpFbTY3Mcs7g0wvw yfWqTaktLNd5v/zEgnwGf4nKzh/J8z+W4qjnuEM066fX5vA+qRhUx83QON/wKyk7 8mjfVDUO9aXWG3TD5LrjZvSTaw0KWg41ETClUKjsxfBOfSEoc/ZL/pcntXQPKIaG bChaU6X0y0TKGc7J8J4a =C7hp -----END PGP SIGNATURE----- --=-=-=--