Cross gcc Mailing List Archive

[Prev][Next][Index][Thread]

Re: Converting C structures to assembler directives



>>>>> "agodwin" == agodwin  <agodwin@piresearch.co.uk> writes on Tue, 29 Oct 1996 16:54:16 -0000:

agodwin> I'm looking for a method of creating an assembler include file (i.e.
agodwin> nothing more complicated than an 'equate' directive) from C structure
agodwin> definitions.

I believe pstruct (distributed w/ perl) will do what you want.  It supports
an offset map that takes C typedef's and outputs offsets in a human
readable form, eg:

    struct floss_config_t {
      unsigned int       eeprom_version                  000     4
      unsigned int       loader_version                  004     4
      unsigned int       gp_board_version                008     4
      unsigned int       rhino_version                   00c     4
      unsigned int       cpus_on_board                   010     4

    ...
    
I think it also can produce #define's or equates.

agodwin> Free and commercial solutions are almost equally OK, but it probably
agodwin> has to run under DOS and NT, not Unix only.

pstruct works by grubbing thru the stabs in the .s file, so it is robust,
but perhaps not portable to NT or DOS.

--tony

References:

Home | Subject Index | Thread Index