stas        2002/12/08 22:47:37

  Modified:    src/docs/2.0/devel/debug_c debug_c.pod
  Added:       src/docs/2.0/devel/debug_c/code .debug-modperl-register
  Log:
  add another startup script which allows to break at the very early
  entrance to mod_perl
  
  Revision  Changes    Path
  1.11      +13 -2     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- debug_c.pod       21 Jun 2002 17:26:20 -0000      1.10
  +++ debug_c.pod       9 Dec 2002 06:47:37 -0000       1.11
  @@ -216,13 +216,24 @@
   =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
  +C<modperl_hook_init()> function, which is useful for debugging code at
   the modperl's initialization phase.
   
  +=item * Debugging mod_perl's Hooks Registeration With httpd
  +
  +Similar to the previous startup script, the
  +F<code/.debug-modperl-register> startup script breaks at the
  +C<modperl_register_hooks()>, which is the very first hook called in
  +the mod_perl land. Therefore use this one if you need to start
  +debugging at an even earlier entry point into mod_perl.
  +
  +Refer to the notes inside the script to adjust it for a specific
  +I<httpd.conf> file.
  +
   =item * Debugging mod_perl XS Extensions
   
   The F<code/.debug-modperl-xs> startup script breaks at the
  -mpxs_Apache__Filter_print() function implemented in
  +C<mpxs_Apache__Filter_print()> function implemented in
   I<xs/Apache/Filter/Apache__Filter.h>. This is an example of debugging
   code in XS Extensions. For this particular example the complete test
   case is:
  
  
  
  1.1                  
modperl-docs/src/docs/2.0/devel/debug_c/code/.debug-modperl-register
  
  Index: .debug-modperl-register
  ===================================================================
  # This gdb startup script allows to break at the very first invocation
  # of mod_perl initialization, just after it was loaded. When the
  # perl_module is loaded, and its pointer struct is added via
  # ap_add_module(), the first hook that will be called is
  # modperl_register_hooks().
  #
  # Invoke as:
  # gdb -command=.debug-modperl-register
  #
  # see ADJUST notes for things that may need to be adjusted
  
  define sharedap
      sharedlibrary apr
      sharedlibrary aprutil
      #sharedlibrary mod_ssl.so
  end
  
  define sharedperl
      sharedlibrary libperl
  end
  
  ### Run ###
  
  # ADJUST: the path to the httpd executable if needed
  file ~/httpd/prefork/bin/httpd
  handle SIGPIPE nostop
  handle SIGPIPE pass
  set auto-solib-add 0
  
  tbreak main
  
  # assuming that mod_dso is compiled in
  b load_module 
  
  
  # ADJUST: the httpd.conf file's path if needed
  # ADJUST: add -DPERL_USEITHREADS to debug threaded mpms
  run -d `pwd`/t -f `pwd`/t/conf/httpd.conf \
  -DONE_PROCESS -DNO_DETATCH -DAPACHE2
  
  # skip over 'tbreak main'
  continue
  
  # In order to set the breakpoint in mod_perl.so, we need to get to
  # the point where it's loaded.
  #
  # With static mod_perl, the bp can be set right away
  #
  
  # With DSO mod_perl, mod_dso's load_module() loads the mod_perl.so
  # object and it immediately calls ap_add_module(), which calls
  # modperl_register_hooks(). So if we want to bp at the latter, we need
  # to stop at load_module(), set the 'bp modperl_register_hooks' and
  # then continue.
  
  # Assuming that 'LoadModule perl_module' is the first LoadModule
  # directive in httpd.conf, you need just one 'finish'. If it's not the
  # first you need as many 'finish' commands as the number of
  # 'LoadModule foo' before perl_module, plus one.
  #
  # If mod_perl is compiled statically, everything is already preloaded,
  # so you can set modperl_* the breakpoints right away
  
  b ap_add_module
  continue
  
  sharedlibrary modperl
  b modperl_register_hooks
  continue
  
  #b modperl_hook_init
  #b modperl_config_srv_create
  #b modperl_startup
  #b modperl_init_vhost
  #b modperl_dir_config
  #b modperl_cmd_load_module
  #modperl_config_apply_PerlModule
  
  # 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to