summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-06-29 13:47:36 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-06-29 13:47:36 +0000
commit52d59bef96c881381bce1bcb84a8c08ce48c2544 (patch)
tree156611deb8527ff59940ca5b742f17c303a5a5b2
parentd20fa10417f31b8f4d60b68adce91b91f9d3cd62 (diff)
downloadperl-52d59bef96c881381bce1bcb84a8c08ce48c2544.tar.gz
More on the macro debugging and expansion.
p4raw-id: //depot/perl@19883
-rw-r--r--pod/perlhack.pod21
1 files changed, 17 insertions, 4 deletions
diff --git a/pod/perlhack.pod b/pod/perlhack.pod
index 60653e1fe4..01692806ad 100644
--- a/pod/perlhack.pod
+++ b/pod/perlhack.pod
@@ -1216,6 +1216,14 @@ important ones are explained in L<perlxs> as well. Pay special attention
to L<perlguts/Background and PERL_IMPLICIT_CONTEXT> for information on
the C<[pad]THX_?> macros.
+=head2 The .i Targets
+
+You can expand the macros in a F<foo.c> file by saying
+
+ make foo.i
+
+which will expand the macros using cpp. Don't be scared by the results.
+
=head2 Poking at Perl
To really poke around with Perl, you'll probably want to build Perl for
@@ -1309,8 +1317,11 @@ blessing when stepping through miles of source code.
=item print
Execute the given C code and print its results. B<WARNING>: Perl makes
-heavy use of macros, and F<gdb> is not aware of macros. You'll have to
-substitute them yourself. So, for instance, you can't say
+heavy use of macros, and F<gdb> does not necessarily support macros
+(see later L</"gdb macro support">). You'll have to substitute them
+yourself, or to invoke cpp on the source code files
+(see L</"The .i Targets">)
+So, for instance, you can't say
print SvPV_nolen(sv)
@@ -1320,9 +1331,11 @@ but you have to say
You may find it helpful to have a "macro dictionary", which you can
produce by saying C<cpp -dM perl.c | sort>. Even then, F<cpp> won't
-recursively apply the macros for you.
+recursively apply those macros for you.
+
+=head2 gdb macro support
-B<NOTE>: Recent versions of F<gdb> have fairly good macro support, but
+Recent versions of F<gdb> have fairly good macro support, but
in order to use it you'll need to compile perl with macro definitions
included in the debugging information. Using F<gcc> version 3.1, this
means configuring with C<-Doptimize=-g3>. Other compilers might use a