Reverse engineer FSM

Feb 07, 2008 6 Replies

We have some FSMs that we would like to reverse engineer back to state transition diagrams. Is this possible? Can anyone give me some CASE software recommendations?



I have already looked at Metamill and Umbrello, and neither of these seems to be able to do this.



Many thanks, Paul


I don't think such tools exist. The tool would really depend upon your FSM implementation.

I would recommend adding trace messages in the code to print out the state transitions and the triggering events. Running the system and collecting the trace would give valuable insight into the FSM design.

-- EventStudio 4.0 -

formatting link
Sequence diagram based embedded system design tool

Unusual question. Do you not have the source code anymore ? If not, why not ?

Or is this some post-document exercise ?

-jg

There are some tools for synthesizing state machines from message traces (scenarios). See, for example:

Koskimies, K. and Mäkinen, E. 1994. Automatic synthesis of state machines from trace diagrams. Softw. Pract. Exper. 24, 7 (Jul.

1994), 643-658. DOI=
formatting link

The tool is called SCED, see

formatting link
for documentation and
formatting link
for download.

I have no personal experience with SCED, and it may not be suitable for the OP, as the OP does not say in which form the FSMs are now. I don't think SCED has any facility for reverse engineering C code, so one would first have to extract message/transition traces, as EventHelix suggests, and then enter them as scenarios into SCED, before SCED could generate the state machines.

Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .

Yes, this is a reverse engineering exercise. We have the FSM source code, and would like to generate the State Transition Diagrams. It seems that there is not code/scripts easily available to do this.

Thanks for the reply, Paul

I have a reasonably interesting FSM that I designed and maintain for a product using a large array of record structures. For documentation and reviews, I wrote some code that traversed the FSM and generated output suitable for dot

formatting link
With a few added heuristics to guide the dot input generation, it comes out as a bunch of pages of directed graphs with annotated transitions, etc. You might find this is an efficient way to produce your state transition diagrams.

Pete

For the future, people might be interested in SMC (State Machine Compiler). It produces State-pattern code from the SM description, and is very useful. It is available at sourceforge.net.

Jyrki Saarinen http://koti.welho.com/jsaari88/

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required