Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[lsp4e-dev] How can I use several debuggers at once

Hello everyone,

I am trying to integrate a custom language (let's call it 'CL') within Eclipse IDE.

This language is executed by a Java interpreter thanks to a dedicated launch configuration. I am now trying to implement a debugger. The difficulty is that a program written in CL can execute scripts (a single file) written in any other language (such as Java or Python) and I don't know how I can allow the user to debug them as well.

Ideally, I would like to rely on existing debuggers such as the ones providing by JDT, CDT or PyDev. Concretely, I'd like the user to  be able to:

  1. Create a script in Java/Python/whatever
  2. Add a breakpoint within the file
  3. Create a CL program that uses the script
  4. Launch the program in debug mode
  5. Wait for the breakpoint to be handled by the debugger provided by JDT/PyDev/whatever
  6. Benefit from the Debug perspective to check stacktrace, variables, etc.

For completeness about the way scripts are currently executed:

  • Each script is wrapped as a Java object:
    • for _javascript_s I just load the class from the classpath
    • for Python scripts the Java object uses Py4J to execute the script

I thought about several solutions:

  • relying on JDT/CDT/whatever to launch the script, but that would be a bit cumbersome and sharing data between the Java interpreter and the script would be hard
  • creating kind of a CompositeDebugTarget that would somehow delegate events to available debuggers so that they can handle them but I'm not sure whether it's actually practical

I hope my explanations are clear enough; would you have any idea on how I could achieve this? I am using neither LSP nor the Debug Protocol at the moment but I don't mind switching if it helps solving the issue.

Thanks to whose who took the time to read,

Best regards,
Emmanuel


Back to the top