On 20 Mar 2008, at 01:23, Michael G Schwern wrote:
I have a project to make the functions of a C program available to
Perl for unit testing purposes. A lot of them use structs like so...
[snip]
I saw Tim's response. SWIG may well be the sensible route.
However, two more data points: I once wrote code which (from memory)
parsed embedded debug information out of object files built with -g
that turned C structure offsets into a pack/unpack spec.
Unfortunately, having searched for the last 10 minutes I can't find
that code - but, if my memory is working, it is possible.
Also there was a guy at YAPC::EU who was using Perl to test C by
driving gdb using expect. His test harness would start his program,
run it to a breakpoint, display some variables, verify their values
and continue. It was, absolutely, a crazy scheme but also a technique
that would never have occurred to me and which he seemed to be able to
get working pretty well.
--
Andy Armstrong, Hexten