[PVFS2-developers] redo sm -> c preprocessing
Pete Wyckoff
pw at osc.edu
Wed Mar 23 17:58:23 EST 2005
I've been debugging stuff deep inside msgpairarray. It is implemented
as one of these state machine files that is converted from .sm to .c
before that is compiled for real.
Gdb is driving me nuts. I spent some time trying to figure out how to
convince it that it should look in the .sm file when showing me source
lines, but I have failed.
Instead, I want to redo the .sm -> .c process like the following.
We get rid of .sm files, renaming them to .c in the real source. Then
we change them to add good old CPP directives:
#ifdef STATE_MACHINE_PASS
%%
nested machine pvfs2_msgpairarray_sm(
init,
post,
post_retry,
complete,
completion_fn)
{
state init
{
run msgpairarray_init;
default => post;
}
[..]
}
%%
#else
#include "msgpairarray.sm.c"
#endif
Then we have the state machine compiler read in the C file and spit
out a new .sm.c file into the build directory that contains just its
little rewrite of the state machine declaration into a bunch of C union
definitions.
I can leave in the %% separators to leave the if/else/endif a bit more
flexible, or just teach the SM compiler to look for the new ifdefs and
constrain the C code a bit to match its expectations.
Any suggestions, complaints? I'm ready to do it.
-- Pete
More information about the PVFS2-developers
mailing list