cvs commit: modperl-docs/src/docs/2.0/devel/debug_c debug_c.pod

2002-06-21 Thread stas
stas2002/06/21 10:26:20

  Modified:src/docs/2.0/devel/debug_c debug_c.pod
  Log:
  yay, gdb knows to expand C macros now. log notes about this and make's
  macro expansion techniques
  
  Revision  ChangesPath
  1.10  +66 -0 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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- debug_c.pod   13 Jun 2002 11:14:18 -  1.9
  +++ debug_c.pod   21 Jun 2002 17:26:20 -  1.10
  @@ -716,6 +716,72 @@
   from reaping it.  So, you could hit the clients/threads limit if you
   segfault a lot.
   
  +=head1 Expanding C Macros
  +
  +Perl, mod_perl and httpd C code makes an extensive use of C macros,
  +which sometimes use many other macros in their definitions, so it
  +becomes quite a task to figure out how to figure out what a certain
  +macro expands to, especially when the macro expands to different
  +values in differnt environments. Luckily there are ways to automate
  +the expansion process.
  +
  +=head2 Expanding C Macros with Cmake
  +
  +The mod_perl IMakefile's include a rule for macro expansions which
  +you can find by looking for the Cc.i. rule. To expand all macros in
  +a certain C file, you should run Cmake filename.c, which will create
  +Ifilename.i with all macros expanded in it. For example to create
  +Iapr_perlio.i with all macros used in Iapr_perlio.c:
  +
  +  % cd modperl-2.0/xs/APR/PerlIO
  +  % make apr_perlio.i
  +
  +the Iapr_perlio.i file now lists all the macros:
  +
  +  % less apr_perlio.i
  +  # 1 apr_perlio.c
  +  # 1 built-in
  +  #define __VERSION__ 3.1.1 (Mandrake Linux 8.3 3.1.1-0.4mdk)
  +  ...
  +
  +=head2 Expanding C Macros with Cgdb
  +
  +With gcc-3.1 or higher and gdb-5.2-dev or higher you can expand macros
  +in gdb, when you step through the code. e.g.:
  +
  +  (gdb) macro expand pTHX_
  +  expands to:  PerlInterpreter *my_perl __attribute__((unused)),
  +  (gdb) macro expand PL_dirty
  +  expands to: (*Perl_Tdirty_ptr(my_perl))
  +
  +For each library that you want to use this feature with you have to
  +compile it with:
  +
  +  CFLAGS=-gdwarf-2 -g3
  +
  +or whatever is appropriate for your system, refer to the gcc manpage
  +for more info.
  +
  +To compile perl with this debug feature, pass C-Doptimize='-gdwarf-2
  +-g3' to C./Configure. For Apache run:
  +
  +  CFLAGS=-gdwarf-2 -g3 ./configure [...]
  +
  +for mod_perl you don't have to do anything, as it'll pick the
  +C$Config{optimize} Perl flags automatically, if Perl is compiled
  +with C-DDEBUGGING (which is implied on most systems, if you use
  +C-Doptimize='-g' or similar.)
  +
  +Notice that this will make your libraries Bhuge! e.g. on Linux 2.4
  +Perl 5.8.0's normal Ilibperl.so is about 0.8MB on linux, compiled
  +with C-Doptimize='-g' about 2.7MB and with C-Doptimize='-gdwarf-2
  +-g3' 12.5MB. Chttpd is also becomes about 10 times bigger with this
  +feature enabled. Imod_perl.so instead of 0.2k becomes 11MB. You get
  +the idea. Of course since you may want this only during the
  +development/debugging, that shouldn't be a problem.
  +
  +The complete details are at:
  +http://sources.redhat.com/gdb/current/onlinedocs/gdb_10.html#SEC69
   
   =head1 Maintainers
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: modperl-docs/src/docs/2.0/devel/debug_c debug_c.pod

2002-01-28 Thread stas
stas02/01/28 08:23:56

  Modified:src/docs/2.0/devel/debug_c debug_c.pod
  Log:
  - use `pwd` instead of real path, easier to re-use!
  
  Revision  ChangesPath
  1.3   +2 -3  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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- debug_c.pod   15 Jan 2002 12:34:19 -  1.2
  +++ debug_c.pod   28 Jan 2002 16:23:56 -  1.3
  @@ -40,8 +40,7 @@
   To automate things you can put those in the I.gdb-jump-to-init file:
   
 b apr_dso_load
  -  run -DONE_PROCESS -d /home/stas/apache.org/modperl-perlmodule/t \
  -  -f /home/stas/apache.org/modperl-perlmodule/t/conf/httpd.conf
  +  run -DONE_PROCESS -d `pwd`/t -f `pwd`/t/conf/httpd.conf
 finish
 b modperl_hook_init
 continue
  @@ -49,7 +48,7 @@
   and then start the debugger with:
   
 % gdb /home/stas/httpd-2.0/bin/httpd -command \
  -  /home/stas/apache.org/modperl-perlmodule/t/.gdb-jump-to-init
  +  `pwd`/t/.gdb-jump-to-init
   
   =head2 Starting the Server Fast under gdb
   
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]