From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7310 invoked by alias); 9 Nov 2007 09:43:38 -0000 Received: (qmail 7295 invoked by uid 22791); 9 Nov 2007 09:43:37 -0000 X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 09 Nov 2007 09:43:34 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 7DF76653C1 for ; Fri, 9 Nov 2007 09:43:32 +0000 (UTC) From: Mike Frysinger To: gdb@sourceware.org Subject: misc extended scripting bits Date: Fri, 09 Nov 2007 09:43:00 -0000 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1778681.cv2Uj3bAmo"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200711090443.30594.vapier@gentoo.org> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-11/txt/msg00066.txt.bz2 --nextPart1778681.cv2Uj3bAmo Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-length: 1761 is there a way to do indirection of evaluating statements ? in other words= ,=20 is there an equivalent of the shell "eval" command ? so something like: (gdb) set $cmd =3D "set $a 1" (gdb) eval $cmd (gdb) print $a $a =3D 1 can you do default values with functions ? so instead of checking $argc al= l=20 the time and setting up the values by hand, a simple syntax for populating= =20 args with default values. so this verbose block: define myfunc # myfunc address, [count], [inc] if $argc =3D=3D 1 set $count 10 else set $count $arg1 end if $argc =3D=3D 2 set $inc 1 else set $inc $arg2 end set $i =3D 0 while $i < $count printf "addr =3D %X\n", ($arg0 + $i) set $i +=3D $inc end end would become: define myfunc $arg1=3D10 $arg2=3D1 set $i =3D 0 while $i < $count printf "addr =3D %X\n", ($arg0 + $i) set $i +=3D $inc end end can you change the default "error" message on invalid number of arguments t= o=20 do the help ? i do something like define useful if $argc !=3D 2 help useful else [do stuff here] end end document useful Usage: useful The useful command is useful as it does things with and . end is there a way to hook into the repeat-on-return functionality ? gdb allow= s=20 you to control the repeat-on-return behavior via the "dont-repeat" command,= =20 but there doesnt seem to be a way to detect whether the define is being=20 executed because it was called explicitly or the user is just hitting the=20 return key ... so i'd like to be able to do: define moo if $user_hit_return set $_last_moo +=3D 10 else set $_last_moo =3D $arg0 end printf "ARG0 =3D %x\n", $_last_moo end then i'd get the output: (gdb) moo 5 ARG0 =3D 5 (gdb) ARG0 =3D 15 (gdb) ARG0 =3D 25 -mike --nextPart1778681.cv2Uj3bAmo Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. Content-length: 827 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iQIVAwUARzQrwkFjO5/oN/WBAQKGSBAA0/Ir7GlJc4ukB8bfoYU8uKCG2BpKf1wH dVNbg4Sm9/70L0g/Vp3AjEQ1piUndgelpNiF8NJ82eoFUFUKzMS2qq0/6YaRu5jt B6ECnABwgOTtEjfDAzz6isG3PXTvgzjkpcRfZ88FsDSZTjfOFIK8nds/mycOyKfU 2CUuij1kwCHP4EBdORCZsoNESycu7YnAT6ovJmskUtToIlFoVloP2KWIufjenFPQ jy3FkyMNvEeVcNWwsyzCcUMeZyIS1unypIGKzUG5ReK9HN0ZrUS3lZRF7/9pesoe 8ORd0Ueid36rws4W26epfy6L89AODDiwNITWfq8n4qB1vzdmEVcRhwwcoKAnDTAI nLTJky7fFGB7a+30Hg7Rt9FNglEpvTRAR9Qif9hYJnMCidyko3KFKSsl47d/x2hJ UkMNHMju3p3gSJC8C7EZ4h1QwnpOWSODAPPXosbOzzRV5Mbc8QEqX6HQ1dNghAyz SpBAtzIt7fR7m5ndlpbfjQ+z4IlgNFdCLPryopqifLSN7gUlnIVSF7+S8y7wQZIO TkEzjCKiAeFGv+0gBOowSkAuMihT9MAw+K+8eJRMM/vG61o4F84Bq/5E6I5ukhHU YwG7gLOMQD6d4c4DN1pD+GDvE7EoMDR0EhA1kISQIVoM48VP/f6+av8OUpB5nNLl M6c5cNl8f2s= =ZGil -----END PGP SIGNATURE----- --nextPart1778681.cv2Uj3bAmo--