Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48063 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59925 invoked from network); 22 Apr 2010 22:01:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Apr 2010 22:01:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.185 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.185 il-mr1.zend.com Received: from [212.25.124.185] ([212.25.124.185:48204] helo=il-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 53/B0-52392-737C0DB4 for ; Thu, 22 Apr 2010 18:01:28 -0400 Received: from us-gw1.zend.com (unknown [192.168.16.5]) by il-mr1.zend.com (Postfix) with ESMTP id 0208850529 for ; Fri, 23 Apr 2010 00:40:07 +0300 (IDT) Received: from [192.168.16.93] ([192.168.16.93]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 22 Apr 2010 15:01:22 -0700 Message-ID: <4BD0C732.5000400@zend.com> Date: Thu, 22 Apr 2010 15:01:22 -0700 Organization: Zend Technologies User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 To: internals@lists.php.net References: <81.FF.21218.96450DB4@pb1.pair.com> In-Reply-To: <81.FF.21218.96450DB4@pb1.pair.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 22 Apr 2010 22:01:22.0653 (UTC) FILETIME=[586D08D0:01CAE267] Subject: Re: [PHP-DEV] Debugging a PHP Extension via GDB From: stas@zend.com (Stanislav Malyshev) Hi! > So far, I started gdb with "gdb /my/path/to/php" (which has debug > symbols enabled); and then tried to set a breakpoint into my extension via: > > break /path/to/php/extension/objectmonitor/objectmonitor.c:80 > > GDB then asks: > > No source file named /path/to/php/extension/objectmonitor/objectmonitor.c. > Make breakpoint pending on future shared library load? (y or [n]) y That's probably because the module is not loaded yet and for some reason gdb doesn't set the breakpoint correctly when it is (gdb is, unfortunately, very far from perfect when it comes to dealing with dynamic loading). What I would advise is to do this: 1. Set the breakpoint in compile_file() or execute(). If you need to catch earlier phases, you can try php_request_startup(). 2. By that time .so should be in, so try setting the breakpont 3. Continue execution. Alternatively, you could just set the breakpoint in php_dl(), step through it up to a point where your .so loads and add the breakpoint then. It's a bit tedious, but should work. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com