Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124667 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id DC0FF1A00B7 for ; Sun, 28 Jul 2024 21:24:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722201941; bh=8XMONfDVLj8I9B/VN5JdIwbeE60ShKDR9rhqYGhMlKw=; h=Date:From:To:Subject:From; b=nE4wvdqbpeNm1NxQRkwFrVB9LsGTj9KNzESfr92Tg8iE4mjLt5QW+nqGMbvQKepkf ntcXJaQE90S7gndMZE1NX9mxXDXCbE3AfPu3/8DcKaCk21ZqnVx3YovyY6mxt2dTt5 xaXxLEmRyZ3I7JaZTOf+f6CoLi6yrswkQ4uYyYOpJxi/5OoyCASWViCCeGxsmFD35I xugf6QmksCNhqfJWUpngF2tymI7cKvHlahr3KSKjgsOUPP/OgJ/iTZto/uLn/zNRmp ONjmENzeYpK8HgDPv8AegUp0XbslKMPL5nhRTh6mMFJaCeq008XQ4ZJ1SeeyKiNjro EvB+ueSIU79SQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E2FDA180051 for ; Sun, 28 Jul 2024 21:25:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout8-smtp.messagingengine.com (fout8-smtp.messagingengine.com [103.168.172.151]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 28 Jul 2024 21:25:38 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.nyi.internal (Postfix) with ESMTP id 3C5781380147 for ; Sun, 28 Jul 2024 17:24:01 -0400 (EDT) Received: from imap49 ([10.202.2.99]) by compute3.internal (MEProxy); Sun, 28 Jul 2024 17:24:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm1; t=1722201841; x=1722288241; bh=8XMONfDVLj8I9B/VN5JdIwbeE60ShKDR 9rhqYGhMlKw=; b=bSf68XC41GxxcS3SoSYjtm3IISK8Q9nIeAVyUGwTTXu7o+O7 xqNTgGs8ONKRitWtCp+mKlLRO3EuqBVM5ty34bMRTukCdAPyJtbE0NVAndy0aRZa K0mfMpqtUH+Q+dAI7ACoUziyra8xTfBecqWhz9VkDEOKysn7ZbFTqOMl1Wgo/h09 mOeUtbXgfqkvwebDFibubp5g1iASW5pHZj9zKXFTJlFwc91NvMN0nL+cnZEfgqmq au8SlBHvVcQU2FhKHh5lXo4oamSXlZRLUwO4gXNAfd2EOMbGhCMEPnVVYyw81zjg 7r9+8Oj4RcvSw6jSBeoFogufYUDmMl6ysmqUSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1722201841; x=1722288241; bh=8XMONfDVLj8I9B/VN5JdIwbeE60ShKDR9rh qYGhMlKw=; b=rgVqy5jCxwJ1fjr/OK0bxoTyvDvD96UYdL+QAx39qGsbcr2m2YK SYdFgN+7KjZM1I6swbsebrW2zNdhovrh+x3DKlzNLb7vvdqTg7Ei5A2Gfo8KC61F EjUbBaQhV9Lbe8yNGA1xg5fo4umOGPPhjxnHQnxXiQLCYtuB31HDKwmbR1d1iSnz jkpD+olaJEodk4MATztrQpZSF4z46ylw72lXAq5Q1wOkA5mIMgiPy9hPPfYe+EXQ 9A+SipnXxBxtZOm7da/FRElcrbea9U0k8Fo/IgxzmUy5YC6xBprBkPq1+B7Da4mR vzoOCMjUQ2Bd06A98P3ece2pSR4lxFoGbNw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrjedtgdduiedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfffhffvufgtsegrtderre erreejnecuhfhrohhmpedftfhosgcunfgrnhguvghrshdfuceorhhosgessghothhtlhgv ugdrtghouggvsheqnecuggftrfgrthhtvghrnheptdelheellefgtddvheehtefgleefgf elgefgledvjeetfeehvdfgleelgfdthefgnecuffhomhgrihhnpegrshgtihhinhgvmhgr rdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprhhosgessghothhtlhgvugdrtghouggvshdpnhgspghrtghpthhtoheptd X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id C72D515A0092; Sun, 28 Jul 2024 17:24:00 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-582-g5a02f8850-fm-20240719.002-g5a02f885 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Message-ID: Date: Sun, 28 Jul 2024 23:22:57 +0200 To: internals@lists.php.net Subject: [PHP-DEV] Debugging tools Content-Type: multipart/alternative; boundary=650207af99d64543907c6f075f015d44 From: rob@bottled.codes ("Rob Landers") --650207af99d64543907c6f075f015d44 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello internals I've always found tooling to be one of the biggest accelerators for unde= rstanding what is going on in a codebase, assuming you know how to use t= hem. If you've ever tried modifying the language AST and friends, you kn= ow this can be extremely tricky at times. For those that want to hack on the languages itself, I've been working o= n an AST debugging tool running on top of GDB. This allows you to hack o= n the language, recompile, and see how it affects the PHP compilation. U= nder the hood, it is really just automated breakpoints and outputting us= efulish details... it's not too special. Most of the complexity comes in= outputting something that makes sense to a human. Here's a brief animation of it working: https://asciinema.org/a/u9oOUvX5= eoha93YJWJ5gX2gCb (yes, I'm manually stepping through the code, but this= sped up) There's still a long way to go here, but it really helps to see the yacc= rules matching and being applied, or AST being skipped and causing a me= mory leak. You can even break into a normal gdb session at any point, if= needed. I plan to open this up on GitHub within the next couple of weeks. There = are some parts that are still a mess that I want to clean up before shar= ing the code with the world (and a few bugs in the AST view), as well as= adding opcodes output. So, far, I've used it to hunt down my own bugs and grok newer features, = like property hooks (you can see that one here: https://asciinema.org/a/= OPZzW2oBr2o8AuOu9YbsBBGap). Does anything like this exist currently? Would anyone else find this use= ful? =E2=80=94 Rob --650207af99d64543907c6f075f015d44 Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hello inte= rnals

I've always found tooling to be one o= f the biggest accelerators for understanding what is going on in a codeb= ase, assuming you know how to use them. If you've ever tried modifying t= he language AST and friends, you know this can be extremely tricky at ti= mes.

For those that want to hack on the lan= guages itself, I've been working on an AST debugging tool running on top= of GDB. This allows you to hack on the language, recompile, and see how= it affects the PHP compilation. Under the hood, it is really just autom= ated breakpoints and outputting usefulish details... it's not too specia= l. Most of the complexity comes in outputting something that makes sense= to a human.

Here's a brief animation of it= working: https://asciinema.org/a/u9oOUvX5eoha93YJWJ5gX2gCb (yes, I'= m manually stepping through the code, but this sped up)
There's still a long way to go here, but it really helps to= see the yacc rules matching and being applied, or AST being skipped and= causing a memory leak. You can even break into a normal gdb session at = any point, if needed.

I plan to open this u= p on GitHub within the next couple of weeks. There are some parts that a= re still a mess that I want to clean up before sharing the code with the= world (and a few bugs in the AST view), as well as adding opcodes outpu= t.

So, far, I've used it to hunt down my ow= n bugs and grok newer features, like property hooks (you can see that on= e here: https://asciinema.org/a/OPZzW2oBr2o8AuOu9YbsBBGap).

Does anything like this exist currently? Would anyone el= se find this useful?

=E2= =80=94 Rob
--650207af99d64543907c6f075f015d44--