[phc-general] Debugging plugins
Satyam at satyam.com.ar
Fri Aug 4 18:18:47 CEST 2006
I just had the opportunity and the need to try it and it works nicely.
Thanks for the tip
----- Original Message -----
From: "Paul Biggar" <paul.biggar at gmail.com>
To: "Satyam" <Satyam at satyam.com.ar>
Cc: <phc-general at phpcompiler.org>
Sent: Thursday, August 03, 2006 5:54 PM
Subject: Re: [phc-general] Debugging plugins
> Hi Satyam,
> On 8/3/06, Satyam <Satyam at satyam.com.ar> wrote:
>> After years absolutely spoiled by fancy IDEs, I wonder if gdb is the best
>> there is and, even if so, how could I go onto debug a plugin which is not
>> loaded at the time the program starts. I can get used to gdb, like in
>> good old days of command lines (after all I even punched cards) but how
>> could I put breakpoints in my plugin before it is plugged escapes me.
>> all these is assuming the symbols are being generated, which I don't know
>> they are or how to do it if they are not.
> Assuming both the application and the plugins are compiled with
> debugging symbols, there is no reason you can't use gdb. phc is
> compiled with -g (enable debugging symbols) by default. To enable this
> in your plugins, follow this example to debug the
> source_vs_semantic_values test plugin, distributed with phc in the
> plugins/tests/ directory:
> ./phc_compile_plugin -g -o source_vs_semantic_values.so
> Here is a sample gdb session:
> pbiggar at godiva ~/svn/postgrad/projects/phc/trunk/src $ gdb phc
> GNU gdb 6.4-debian
> Copyright 2005 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you
> welcome to change it and/or distribute copies of it under certain
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB. Type "show warranty" for
> This GDB was configured as "i486-linux-gnu"...Using host libthread_db
> library "/lib/tls/i686/cmov/libthread_db.so.1".
> (gdb) b source_vs_semantic_values.cpp:33
> No source file named source_vs_semantic_values.cpp.
> Make breakpoint pending on future shared library load? (y or [n]) y
> Breakpoint 1 (source_vs_semantic_values.cpp:33) pending.
> (gdb) run --run plugins/tests/source_vs_semantic_values.so
> Starting program:
> /home/pbiggar/svn/postgrad/projects/phc/trunk/src/phc --run
> [Thread debugging using libthread_db enabled]
> [New Thread -1225374016 (LWP 7507)]
> warning: Lowest section in /usr/lib/libicudata.so.34 is .hash at 00000094
> Breakpoint 2 at 0xb7efb26c: file source_vs_semantic_values.cpp, line 33.
> Pending breakpoint "source_vs_semantic_values.cpp:33" resolved
> $success = true;
> [Switching to Thread -1225374016 (LWP 7507)]
> Breakpoint 2, Get_source_and_semantic_values::print_comparison
> type=0x8241148, value=0x8265130, source=0x8258010)
> at source_vs_semantic_values.cpp:41
> 41 source->c_str(),
> source->c_str(), source->c_str());
> Note that gdb is incredible, and defers the breakpoint until the
> plugin is loaded.
>> By the way, if anyone has any sugestion for debugger, I have a Debian
>> on a i86 machine.
> Eclipse has a very nice debugger, and it can use gdb if you use the
> CDT tools. I havent used this with phc, but I tried briefly debugging
> gcc with it, which proved more than my machine could take. It
> shouldn't have any problem with phc, however. I'm not sure what
> version is in the debian repositories, but it's probably worth using
> the calisto release 3.2 of eclipse, rather than an older version
> through apt.
> Another alternative is ddd, which uses gdb aswell.
> Paul Biggar
> paul.biggar at gmail.com
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.394 / Virus Database: 268.10.5/406 - Release Date: 02/08/2006
More information about the phc-general