How can I debug the code?

How can I debug the code?

by Acqua Alta -
Number of replies: 3

Hi,

Moodle version: 3.8
VPL version: 3.3.7 (2020041317)

In a VPL activity, in the "Execution options" screen , in the "Debug script" field, I set the value to "C: Using GDB or ddd if Available". And of course the "Debug" field in the same screen is set to "Yes".

I went to the "Test activity" tab, imported some C code, and I can run it.
However, when trying to debug the script, the debugger is loaded but no code is presented in it. Also, when I choose the "Open program" option in the "File" menu, I don't see my code file available in any of the presented sub-directories.

Did someone encounter this issue? Could someone clarify if that can be fixed and how?

Thanks in advance.




Average of ratings: -
In reply to Acqua Alta

Re: How can I debug the code?

by Juan Carlos Rodríguez-del-Pino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Dear Acqua Alta,
Following your instructions, I have not been able to reproduce the problem. Please, give more details.

Notice that if you are using "execution files" the system removes it before executing the program. You may control this behavior with the "files to keep when running".

Best regards,
Juan Carlos.

Attachment Screenshot_2020-09-10 Pruebas Acqua Alta Edit.png
Average of ratings: Useful (1)
In reply to Juan Carlos Rodríguez-del-Pino

Re: How can I debug the code?

by Acqua Alta -
Hi Juan and שלום to you too smile,
I'm sorry for not replying earlier, even just for saying thanks. Things are hectic nowadays, when learning fully online.

I'm sorry for being clueless, but I still can't get the debugging to work in DDD inside VPL.

* I checked the "vpl_debug.sh" option in "Files to keep when running", but nothing changes when trying to debug the code in VPL.

* I reviewed the "Execution files" area, and the "vpl_debug.sh" file is empty. I don't know which script should be in it, but it seems that it isn't the same script in "vpl_run.sh" file (and that also makes sense), because when doing that the DDD program doesn't even open when trying to debug the code.

For example, that's the script (without the enclosing dash characters) I have in "vpl_run.sh" file, in the specific example that I used today for tests:
----------------------
#!/bin/bash
#load common script and check programs
. common_script.sh
check_program gcc
get_source_files c
#compile

gcc -std=c90 -o vpl_execution $SOURCE_FILES -lm -lutil
----------------------

* When the "vpl_debug.sh" script is empty, DDD can be opened when trying to debug, but DDD displays the following message at its terminal:
----------------------
GNU DDD 3.3.12 (x86_64-pc-linux-gnu), by Dorothea LReading symbols from vpl_progr3rn... (no debugging symbols found).. .done.
----------------------

Could you please help me to understand what needs to be done?
Thanks a lot smile
In reply to Acqua Alta

Re: How can I debug the code?

by Acqua Alta -
Hi Juan,
After writing to you I consulted a teacher who uses VPL, and I think he found the solution.

In Execution files -> vpl_run.sh, he added the "-g" parameter to the gcc command.
This parameter description is "Produce debugging information in the operating system’s native format".

Thanks a lot smile
Average of ratings: Useful (1)