perl-docs-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-docs/src/docs/2.0/devel/debug_c/code .debug-modperl-init
Date Mon, 18 Mar 2002 07:19:18 GMT
stas        02/03/17 23:19:18

  Modified:    src/docs/2.0/devel config.cfg
               src/docs/2.0/devel/core_explained core_explained.pod
               src/docs/2.0/devel/debug_c debug_c.pod
               src/docs/2.0/devel/debug_c/code .debug-modperl-init
  Log:
  - continue work on debug doc
  - add an example of debug-modperl-init
  
  Revision  Changes    Path
  1.4       +23 -26    modperl-docs/src/docs/2.0/devel/config.cfg
  
  Index: config.cfg
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/devel/config.cfg,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- config.cfg	15 Jan 2002 12:34:19 -0000	1.3
  +++ config.cfg	18 Mar 2002 07:19:18 -0000	1.4
  @@ -5,39 +5,36 @@
   
         title => "mod_perl 2.0 Developer's guide",
   
  -      abstract => 'This guide is aimed for mod_perl 2.0 core and 3rd 
  -                   party modules developers.',
  +      abstract => <<EOI,
  +This guide is aimed for mod_perl 2.0 core and 3rd party modules developers.
  +EIO
   
         group    => 'mod_perl 2.0 Core Development',
  -      chapters => [
  -          qw(
  -             core_explained/core_explained.pod
  -             modperl_style/modperl_style.pod
  -             perf_sizeof/perf_sizeof.pod
  -          )
  -      ],
  +      chapters => [qw(
  +          core_explained/core_explained.pod
  +          modperl_style/modperl_style.pod
  +          perf_sizeof/perf_sizeof.pod
  +      )],
   
         group    => '3rd party modules Development with mod_perl 2.0',
  -      chapters => [
  -          qw(
  -             porting_from_1.x/porting_from_1.x.pod
  -             debug_perl/debug_perl.pod
  -             debug_c/debug_c.pod
  -          )
  -      ],
  +      chapters => [qw(
  +          porting_from_1.x/porting_from_1.x.pod
  +          debug_perl/debug_perl.pod
  +          debug_c/debug_c.pod
  +      )],
   
         group    => 'Testing',
  -      chapters => [
  -          qw(
  -             testing/testing.pod
  -          )
  -      ],
  +      chapters => [qw(
  +          testing/testing.pod
  +      )],
   
         group    => 'Help',
  -      chapters => [
  -          qw(
  -             help/help.pod
  -          )
  -      ],
  +      chapters => [qw(
  +          help/help.pod
  +      )],
  +
  +      copy_glob => [qw(
  +          debug_c/code
  +      )],
   
   );
  
  
  
  1.17      +2 -2      modperl-docs/src/docs/2.0/devel/core_explained/core_explained.pod
  
  Index: core_explained.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/devel/core_explained/core_explained.pod,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- core_explained.pod	8 Mar 2002 09:35:17 -0000	1.16
  +++ core_explained.pod	18 Mar 2002 07:19:18 -0000	1.17
  @@ -301,7 +301,7 @@
   
   =head1 mpxs_ vs MPXS_
   
  -<SCRATCH THAT>
  +[SCRATCH THAT]
   If you look at the source code there are functions starting with
   I<mpxs_> and those with I<MPXS_>.
   
  @@ -311,7 +311,7 @@
   I<items>, I<MARK> and I<SP> arguments) or prefixed with I<MPXS_>,
   which are hooked directly into newXS().
   
  -</SCRATCH THAT>
  +[/SCRATCH THAT]
   
   =head1 Gluing Existing APIs
   
  
  
  
  1.4       +68 -9     modperl-docs/src/docs/2.0/devel/debug_c/debug_c.pod
  
  Index: debug_c.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/devel/debug_c/debug_c.pod,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- debug_c.pod	28 Jan 2002 16:23:56 -0000	1.3
  +++ debug_c.pod	18 Mar 2002 07:19:18 -0000	1.4
  @@ -77,8 +77,8 @@
     handle SIGPIPE nostop
     set auto-solib-add 0
     b ap_run_pre_config
  -  run -DONE_PROCESS -d `pwd`/t -f `pwd`/t/conf/httpd.conf \
  -  -DAPACHE2 -DPERL_USEITHREADS
  +  run -d `pwd`/t -f `pwd`/t/conf/httpd.conf \
  +  -DONE_PROCESS -DAPACHE2 -DPERL_USEITHREADS
     sharedlibrary modperl
     b modperl_hook_init
     # start: modperl_hook_init
  @@ -104,20 +104,30 @@
   restarts on the start, we have to I<continue> until we hit
   I<modperl_hook_init> second time, where we can set the breakpoint at
   I<apr_poll>, the very point where httpd polls for new request and run
  -again I<continue> so it'll stop at I<apr_poll>.
  +again I<continue> so it'll stop at I<apr_poll>. This particular script
  +passes over modperl_hook_init(), since we run the C<continue> command
  +a few times to reach the I<apr_poll> breakpoint. See the L<Precooked
  +gdb Startup Scripts|/Precooked_gdb_Startup_Scripts> section for
  +standalone script examples.
   
   When gdb stops at the function I<apr_poll> it's a time to start the
  -client:
  -
  -  % t/TEST -run
  +client, that will issue a request that will exercise the server
  +execution path we want to debug. For example to debug the
  +implementation of C<APR::Pool> we may run:
  +
  +  % t/TEST -run apr/pool
  +
  +which will trigger the run of a handler in
  +I<t/response/TestAPR/pool.pm> which in turn tests the C<APR::Pool>
  +code.
   
   But before that if we want to debug the server response we need to set
   breakpoints in the libraries we want to debug. For example if we want
   to debug the function C<PerlIOAPR_open> which resides in
   I<APR/PerlIO/PerlIO.so> we first load it and then we can set a
   breakpoint in it. Notice that gdb may not be able to load a library if
  -it wasn't referenced by any of the code. In this case we have to
  -require this library at the server startup. In our example we load:
  +it wasn't referenced by any of the code. In this case we have to load
  +this library at the server startup. In our example we load:
   
     PerlModule APR::PerlIO
   
  @@ -126,7 +136,7 @@
   
     gdb> info sharedlibrary
   
  -which will also show which libraries were loaded already.
  +which also shows which libraries are loaded already.
   
   Also notice that you don't have to type the full path of the library
   when trying to load them, even a partial name will suffice. In our
  @@ -153,7 +163,56 @@
   you need to avoid extra typing and mistakes when repeating the same
   debugging process again and again.
   
  +Another important thing is that whenever you want to be able to see
  +the source code for the code you are stepping through, the library or
  +the executable you are in must have the debug symbols present. That
  +means that the code has to be compiled with I<-g> option for the gcc
  +compiler. For example if I want to set a breakpoint in /lib/libc.so, I
  +can do that by loading:
  +
  + gdb> sharedlibrary /lib/libc.so
  +
  +But most likely that this library has the debug symbols stripped off,
  +so while gdb will be able to break at the breakpoint set inside this
  +library, you won't be able to step through the code. In order to do
  +so, recompile the library to add the debug symbols.
  +
  +If debug code in response handler you usually start the client after
  +the server was started, when doing this a lot you may find it annoying
  +to need to wait before the client can be started. Therefore you can
  +use a few tricks to do it in one command. If the server starts fast
  +you can use sleep():
  +
  +  % ddd b-command=.debug-modperl-init & ; \
  +  sleep 2 ; t/TEST -verbose -run apr/pool
  +
  +or to use the C<Apache::Test> framework's C<-ping=block> option:
  +
  +  % ddd -command=.debug-modperl-init & ; \
  +  t/TEST -verbose -run -ping=block apr/pool
  +
  +=head2 Precooked gdb Startup Scripts
  +
  +Here are a few startup scripts you can use with gdb to accomplish one
  +of the common debugging tasks. To execute the startup script, simply run:
  +
  + % gdb -command=.debug-script-filename
  +
  +They can be run under gdb and any of the gdb front-ends. For example
  +to run the scripts under C<ddd> substitute C<gdb> with C<ddd>:
  +
  + % ddd -command=.debug-script-filename
  +
  +=over
  +
  +=item Debugging mod_perl Initialization
  +
  +The F<code/.debug-modperl-init> startup script breaks at the
  +modperl_hook_init() function, which is useful for debugging code at
  +the modperl's initialization phase.
  +
   
  +=back
   
   
   =head1 Obtaining Core Files
  
  
  
  1.2       +21 -4     modperl-docs/src/docs/2.0/devel/debug_c/code/.debug-modperl-init
  
  Index: .debug-modperl-init
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/devel/debug_c/code/.debug-modperl-init,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- .debug-modperl-init	18 Mar 2002 06:58:05 -0000	1.1
  +++ .debug-modperl-init	18 Mar 2002 07:19:18 -0000	1.2
  @@ -1,6 +1,7 @@
  -# This gdb startup script brings you to the modperl_hook_init()
  -# function, useful if you need to debug things at the modperl init
  -# stage. invoke as:
  +# This gdb startup script breaks at the modperl_hook_init() function,
  +# which is useful for debug things at the modperl init phase.
  +#
  +# Invoke as:
   # gdb -command=.debug-modperl-init
   #
   # see ADJUST notes for things that may need to be adjusted
  @@ -26,11 +27,27 @@
       continue
   end
   
  +define sharedap
  +    sharedlibrary apr
  +    sharedlibrary aprutil
  +    #sharedlibrary mod_ssl.so
  +    continue
  +end
  +
  +define sharedperl
  +    sharedlibrary libperl
  +end
  +
   # start the server and run till modperl_hook_init on start
   myrun
   modperl_init
   
  -# uncomment to reach modperl_hook_init on restart
  +# ADJUST: uncomment to reach modperl_hook_init on restart
   #continue
   #continue
   
  +# ADJUST: uncomment if you need to step through the code in apr libs
  +sharedap
  +
  +# ADJUST: uncomment if you need to step through the code in perlib
  +sharedperl
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org


Mime
View raw message