Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Debug Target does not find GDB #375

Closed
KoeMai opened this issue Apr 7, 2018 · 7 comments
Closed

CMake: Debug Target does not find GDB #375

KoeMai opened this issue Apr 7, 2018 · 7 comments
Assignees
Labels
bug a bug in the product
Projects
Milestone

Comments

@KoeMai
Copy link
Contributor

KoeMai commented Apr 7, 2018

Brief Issue Summary

I try to use the extension in different projects. At the moment the debugging does not work out of the box. If I use the GCC then I get the following message, see figure below. I am not sure if there is a relation between debugger and kit needed. Is there some manual configuration needed? Or should it work out of the box?

Expected:

  1. Debugger should start out of the box (for quick start projects)
  2. Possibility to place a debug configuration name to Kit or Variant, so that it switch automatic debug target dependent parts for different kits/variants on start of debugging.
  3. May be a automatic generation of debug configuration of Kits, so that it use the debugger which is needed by the compiler (GCC, visual studio, cross compiler GCC will not work there are more information needed)

Apparent Behavior:

  1. Select MinGw GCC as kit
  2. Create new executable project with quick start
  3. Build
  4. Run debugger
    unabletoconfiguredebugger

Platform and Versions

  • Operating System: Windows 10
  • CMake Version: 3.10.0
  • VSCode Version: 1.21.1
  • CMake Tools Extension Version: 0.11-beta5
  • Compiler/Toolchain: mingw-w64/msys2 + gcc 6.3
@KoeMai
Copy link
Contributor Author

KoeMai commented Apr 7, 2018

Duplicate of #242.

@KoeMai KoeMai added the bug a bug in the product label Apr 7, 2018
@vector-of-bool vector-of-bool added this to the Backlog milestone Apr 7, 2018
@vector-of-bool vector-of-bool modified the milestones: Backlog, 1.0.0 Apr 23, 2018
@KoeMai
Copy link
Contributor Author

KoeMai commented Apr 24, 2018

I see the missing part. But I am not sure how we want to find gdb.
Below you can see my modification. It works but the kit contains at the moment no debugger path.
This makes it necessary to convert the compiler path to it.

...
const debug_config: vscode.DebugConfiguration = {
  type: is_msvc ? 'cppvsdbg' : 'cppdbg',
  name: `Debug ${target_path}`,
  request: 'launch',
  cwd: '${workspaceRoot}',
  args: [],
  MIMode: mi_mode,
};
if (mi_mode == 'gdb') {
    if(this._kitManager.activeKit!.type == "compilerKit") {
      const kit: CompilerKit = this._kitManager.activeKit as CompilerKit;
      const compilers: {[lang: string]: string} = kit.compilers;
      // \todo error handling for missing "C" compiler
      const gdb = compilers["C"].replace("gcc", "gdb");
      // \todo find gdb path is a user transparent way
      debug_config["miDebuggerPath"] = gdb;
    } else {
      // \todo error handling and handling for toolchain files
    }
...

@vector-of-bool
Copy link
Contributor

I think it's a start. You can more reliably get the compiler path by asking the CMake cache for the compiler, though. It may take a bit more heuristics to find the proper GDB, though. I'll think on it.

@KoeMai
Copy link
Contributor Author

KoeMai commented Apr 29, 2018

Yes that is abetter search place, we can read the compiler back from CMake cache (C-Compiler) and search for a gdb with the same prefix. But we should add the possibility to override the automatic generation by a way to set a configuration name from launch.json. What is your opinion?

@vector-of-bool
Copy link
Contributor

I've been trying thinking about the debugging for a while. launch.json can be used perfectly well with CMakeTools, so I don't think it necessary to read back launch.json when doing quick debugging. I'd say doing automatic gdb discovery would be just fine for quick debugging.

@KoeMai
Copy link
Contributor Author

KoeMai commented Apr 29, 2018

I would not read back Lauch.json I would only allow to configuration are configname in the settings to quicklaunch debuging with the button.

@vector-of-bool vector-of-bool added this to To do in 1.0.0 Apr 30, 2018
@KoeMai KoeMai moved this from To do to In progress in 1.0.0 May 10, 2018
@KoeMai KoeMai self-assigned this May 10, 2018
@KoeMai KoeMai moved this from In progress to Waiting for review in 1.0.0 May 31, 2018
@vector-of-bool vector-of-bool moved this from Waiting for review to Done in 1.0.0 Jun 5, 2018
@KoeMai
Copy link
Contributor Author

KoeMai commented Jun 5, 2018

done

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug a bug in the product
Projects
No open projects
1.0.0
  
Done
Development

No branches or pull requests

2 participants