How to debug a mock

Hello,

I’m developping a mock for my platform following your documentation available here https://docs.microej.com/en/latest/PlatformDeveloperGuide/mock.html and wonder how to debug my mock. Is it possible to do it ?

Best regards,

Jean Morin

1 Like

Hello Jean,

Yes it is possible !

You can follow those steps to debug a mock, assuming that you already have a platform imported in your workspace and a mock of your project:

  • In your platform sources, enable HIL debugging:

    • Open the scripts/hil.xml file

    • Copy the following line.

      <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,suspend=y,server=y,address=8000"/>

    • Add it under the VM lauching HIL Engine part:

  • Increase the connection timeout between the simulator and the HIL engine:

    • Go to Run -> Run Configurations

    • Go to the Simulator section of the Configuration tab and increase the HIL connection timeout:

  • Put a breakpoint in your mock-up code

  • Run your application on the simulator

  • You should get in the Console:

    =============== [ Initialization Stage ] ===============
    =============== [ Launching on Simulator ] ===============
    Listening for transport dt_socket at address: 8000
    
  • Attach a Java standard debug launcher:

    • In the package explorer, select your mock-up project
      • Go to the Run > Debug Configurations... menu

      • Double click on Remote Java Application

      • Let the default options:

      • Click on the Debug button

  • You should get stopped in you mock-up code:

Let me know if you have any troubles completing those steps.

Best regards,

Alex

1 Like