kanje / bosce

boost::statechart extractor
Boost Software License 1.0
27 stars 4 forks source link

Bosce fails to parse my tiny FSM #4

Closed vynilas closed 3 years ago

vynilas commented 3 years ago

Hi Kanje,

Congrats for your very nice bosce tool !

Bosce couldn't parse my tiny FSM that I've been developing last week . More precisely, plantuml failed to generate the diagram description from the bosce output :

syl@spica:~/SPICA/gitSPICA/SPICA_FT/sources/tests/FSM/CFringeSearchSM/tst$ plantuml fsm.pu Error line 42 in file: /home/syl/SPICA/gitSPICA/SPICA_FT/sources/tests/FSM/CFringeSearchSM/tst/fsm.pu Some diagram description contains errors

Here is the link toward my binary if you wish to take a glance at : https://drive.google.com/file/d/1-hIa_3pULtv31acfoJmoE4UeY7Xksu_y/view?usp=sharing

If you need the sources I can provide you with them.

Thanks for your help.

Sylvain

kanje commented 3 years ago

Hey! According to the parsed objdump, you have transitions leaving/entering orthogonal regions, is that right? I think it is not allowed and according to boost docs such code must not compile. And plantuml does not know how to draw it.

If you do not have such transitions, could you please share the code? Maybe there is a bug in how objdump is parsed.

vynilas commented 3 years ago

Hi Kanje,

THANKS for your message !

Yes, I implemented a SM (mySM) which owns an internal state (S1) which contains 2 orthogonal regions (R1) and (R2). When a transition to S1 occurs, R1 and R2 are entered. It does compile, its does work and it is what I mean to do.

I was inspired by boost::stateshart documentation : https://www.boost.org/doc/libs/1_53_0/libs/statechart/doc/tutorial.html#OrthogonalStates

Hence, I do not understand your point, may I ask you further explanations ?

Cheers !

Sylvain

kanje commented 3 years ago

If it does compile and work as expected, then probably the problem is how bosce parses the binary/objdump. Could you please share your statechart code? This would help analysing it further.

vynilas commented 3 years ago

you'll find a tar file containing all the sources here : https://drive.google.com/file/d/14FcEiaENZ4SeS3S_t8YoWD8Vdm9utXZL/view?usp=sharing Just untar then make clean all.

Cheers

kanje commented 3 years ago

I have found and fixed one issue. There was a problem with how template states are handled. Now, the following output is generated for your binary:

@startuml
note "CFringeSearchSM\nGenerated on 22.02.2021" as NoteGenerated #A2F2A2
[*] --> 2
  state "IdleST" as 2 {
  }
  2-->3 : EvTelLost<(Tel::Tel)1>\n
  2-->4 : EvTelLost<(Tel::Tel)2>\n
  state "SearchingST" as 5 {
    [*] --> 3
    state "TelSlewingST<(Tel::Tel)1>" as 3 {
      [*] --> 6
      state "InitRampST<(Tel::Tel)1>" as 6 {
      }
      6-->6 : EvStep\n
      6-->7 : EvTelLost<(Tel::Tel)1>\n
      state "RampingST<(Tel::Tel)1>" as 7 {
      }
      7-->7 : EvStep\n
      7-->8 : EvTelRecov<(Tel::Tel)1>\n
      state "StopRampST<(Tel::Tel)1>" as 8 {
      }
      8-->2 : EvTelRecov<(Tel::Tel)1>\n
      8-->8 : EvTelRecov<(Tel::Tel)1>\n
    }
    --
    [*] --> 4
    state "TelSlewingST<(Tel::Tel)2>" as 4 {
      [*] --> 9
      state "InitRampST<(Tel::Tel)2>" as 9 {
      }
      9-->9 : EvStep\n
      9-->10 : EvTelLost<(Tel::Tel)2>\n
      state "RampingST<(Tel::Tel)2>" as 10 {
      }
      10-->10 : EvStep\n
      10-->11 : EvTelRecov<(Tel::Tel)2>\n
      state "StopRampST<(Tel::Tel)2>" as 11 {
      }
      11-->2 : EvTelRecov<(Tel::Tel)2>\n
      11-->11 : EvTelRecov<(Tel::Tel)2>\n
    }
  }
@enduml

This is the best I can do. It still does not compile, but this apparently is a limitation of plantuml.

vynilas commented 3 years ago

Thanks a lot ! Do you know which software could replace platuml ?

kanje commented 3 years ago

Bosce currently supports only three generators (you can select one with -g): to generate plantuml markup, to generate simple text (not an image) and to list all statechart names. Only plantuml generates images.

If you want to manually draw diagrams, you could also try graphviz. Plantuml actually uses graphviz as its backend, but it is a more low-level tool.

vynilas commented 3 years ago

Thanks Kanje !