eecs280staff / tutorials

Tools and tutorials
https://eecs280staff.github.io/tutorials/
Other
5 stars 4 forks source link

EECS 281 / make debug #89

Closed awdeorio closed 1 year ago

awdeorio commented 1 year ago

It's an easy mistake to make for EECS 281 students to fail to include debugging symbols in VS Code because make will compile the release target, not the debug target. Furthermore, launch.json needs to be configurede to run main_debug not main.

awdeorio commented 1 year ago

CC @zjweiss

zjweiss commented 1 year ago

Makes sense to me.

The make debug build should include the debugging symbols. I can tweak the 281_setup.md, to explain that to students.

I agree that launch.json should compile main_debug, and not main. Do we provide students with a template launch.json?

zjweiss commented 1 year ago

I see #88 is suggesting making a template launch.json.

awdeorio commented 1 year ago

I agree that launch.json should compile main_debug, and not main. Do we provide students with a template launch.json?

launch.json doesn't compile anything. While it is possible to configure VS Code to compile something for you, we don't include that in the instructions.

launch.json does include the path to the executable. In EECS 281, it's an anti-pattern to use the default release target because it lacks debugging symbols. The pattern we need is:

  1. Compile with make debug, not make
  2. Set your program to ${workspaceFolder}/X_debug, not ${workspaceFolder}/X
zjweiss commented 1 year ago

Working on this in #108.

zjweiss commented 1 year ago

I am not completely familiar with using VS Code for C++ development, but from reading the setup_vscode.html guide, I want to confirm that students need to compile the code by typing make/make debug into the terminal, and then they can click the "debug icon" in VS Code, correct?

awdeorio commented 1 year ago

I am not completely familiar with using VS Code for C++ development, but from reading the setup_vscode.html guide, I want to confirm that students need to compile the code by typing make/make debug into the terminal, and then they can click the "debug icon" in VS Code, correct?

Yes, and they need to use main_debug (or whatever *_debug) in this step.