Skip to content

Debug Test Case

Marcelo Fornet edited this page May 23, 2020 · 7 revisions

To debug a program, you should use an existing vscode extension that provides debugging functionalities for your current language. Since it is expected that programs reads from standard input, you should add to the configuration the file you want to read from. acmX provides a way to select this test case easily.

C++

  1. Install CodeLLDB
  2. Download custom launch.json and tasks.json
  3. Create folder .vscode in your current problem/contest workspace and copy those file there.

Make sure you use your preferred compilation line in tasks.json. It is important that main solution is compiled with debug enabled, to this pass flag -g or --debug.

Automatic debugging setup

To add launch.json and tasks.json automatically to all the new problem and contests workspace you can add them as a template:

  1. Copy launch.json and tasks.json to a common place (for example):
~/.acmx/templates/launch.json
~/.acmx/templates/tasks.json
  1. Open User Settings and modify "acmx.configuration.launch" and "acmx.configuration.tasks" to point respectively to each file.

From now on they will be added on every workspace you create from acmX.

Select Test Case

  1. Right click on the file testname.in
  2. Click in Select Test Case

This will change the "stdio" entry at launch.json.

Note: Current implementation uses regular expression so it is not supported at the moment selecting a test case automatically for general launch.json, but you should be able to edit it manually.

Debugging in other languages

Check for current debuggers extensions at the marketplace