|C code validation service firstname.lastname@example.org (1996-07-15)|
|Re: C code validation service email@example.com (1996-07-19)|
|getting symbolic C structure offsets (was: Re: C code validation servi firstname.lastname@example.org (Jonathan Thornburg) (1996-07-27)|
|Re: getting symbolic C structure offsets (was: Re: C code validation s email@example.com (1996-07-31)|
|From:||Jonathan Thornburg <firstname.lastname@example.org>|
|Date:||27 Jul 1996 21:42:50 -0400|
|Organization:||U of British Columbia / Physics|
|Summary:||c2ph (comes with perl) gives nice access to C structures|
Stephen Egbert <email@example.com> asked for an
| [...] extended preprocessor (GNU cpp or otherwise) that
| can translate the C-styled structure offset for uses with assembly code
| using symbolic offset.
and our esteemed moderator commented
| I'd think you could hack something up by running the structure def
| through cc -g -S and using a perl script to extract the info from the
| .stabs entries into defines for your assembler code. [...]
I'm not quite sure if this is what Stephen was looking for, but the
very hack our moderator suggested comes as a standard utility with
perl, under the name 'c2ph', a.k.a. 'pstruct'.
As 'pstruct', this prints a nicely formatted table of C structure
types, member names, offsets, and lengths. As 'c2ph', it provides
pack/unpack formats and metainformation so perl code can easily
manipulate in-memory C structures.
From here, it's an SMOP (presumably in perl) to generate symbol
definitions, cpp #defines, or <your favorite syntax> to pass this
information to assembly programs.
- Jonathan Thornburg <firstname.lastname@example.org> (personal E-mail)
U of British Columbia / Physics Dept / <email@example.com>
Return to the
Search the comp.compilers archives again.