AVSLab / basilisk

Astrodynamics simulation framework
https://hanspeterschaub.info/basilisk
ISC License
132 stars 63 forks source link

Recorders for Some Modules Disrupt Debugging #249

Closed patrickwalton closed 2 weeks ago

patrickwalton commented 1 year ago

Describe the bug In scenarioAttitudeFeedbackRW.py, this line (539): rwMotorLog = rwMotorTorqueConfig.rwMotorTorqueOutMsg.recorder(samplingTime) disrupts debuggers, leading breakpoints past this line to never be reached.

To reproduce Steps to reproduce the behavior:

  1. Open scenarioAttitudeFeedbackRW.py in VSCode or pdb.
  2. Set a breakpoint on line 540.
  3. Run (with debugging in vscode).
  4. The breakpoint will never be reached.

Expected behavior In other example scenarios (such as scenarioTAM.py) I can set a breakpoint on scSim.ExecuteSimulation() and step into the simulation process to observe. I would expect that to work on scenarioAttitudeFeedbackRW.py, but it doesn't, because the breakpoint is never reached.

Screenshots NA

Desktop (please complete the following information):

Additional context NA

patrickwalton commented 1 year ago

I determined it was rwMotorTorque, because breakpoints before that line work and breakpoints after didn't.

I've also confirmed that it doesn't occur in other scenarios. For example, breakpoints in the CSS scenarios work anywhere.

patrickwalton commented 1 year ago

I have found this issue exists in recorders for the following additional modules:

The recorders for the following modules seem to not have this issue:

bbercoviciUspace commented 1 year ago

Hi Patrick,

Have you made sure to compile Basilisk in debug mode prior to running the debugger ? Odd things may happen if one attempts to set breakpoints inside a C or C++ program that is compiled in release mode.

patrickwalton commented 1 year ago

@bbercoviciUspace

Odd things may happen if one attempts to set breakpoints inside a program C or C++ that is compiled in release mode.

Are you referring to breakpoints in C/C++ code? I am only referring to breakpoints in the main Python script.

Does Basilisk need to be compiled in debug mode to support breakpoints in the main Python script? This still seems like undesirable behavior.

barrelofmonkeys92 commented 4 months ago

I'm experiencing the same issue.

Describe the bug I'm attempting to debug a python script (no gdb process attached, no C or C++ debugging), but after calling .record() on any type of OutMsg from a C-language FSW module, my python debugger no longer stops at breakpoints.

To reproduce:

Expected behavior: My debugger should stop at python breakpoints.

Additional Details If I use the breakpoint() python keyword after a .record() call, the debugger will stop there. Thereafter the behavior changes with the IDE: Using pycharm, if I step the script it just continues the process till end. Using VSCode, if I step it runs like a normal debugger, stopping at breakpoints.

System information: OS: Ubuntu 22.04.3 Python version: 3.11

This is making debugging a very tedious process. Please let me know if this is something you've seen before! I can add more clarifying details if needed.