Home > Development Tools > sublime > body text

How to configure sublimegdb

下次还敢
Release: 2024-04-03 14:27:21
Original
854 people have browsed it

SublimeGDB 的配置

如何在 Sublime Text 中配置 SublimeGDB?

配置 SublimeGDB 涉及以下步骤:

1. 安装 SublimeGDB 包

  • 打开 Sublime Text 的包管理器(Ctrl+Shift+P)。
  • 搜索并安装 SublimeGDB。

2. 安装 GNU 调试器 (GDB)

  • 确保已在系统中安装了 GDB。
  • Windows:下载 MinGW 或 Cygwin 并安装 GDB。
  • macOS:通过 Homebrew(brew install gdb)或 MacPorts(sudo port install gdb)安装 GDB。
  • Linux:通过包管理器(如 sudo apt-get installgdb)安装 GDB。

3. 配置 SublimeGDB 设置

  • 打开 Sublime Text 的设置文件(Ctrl+,)。
  • 添加以下内容:
<code>"sublimegdb": {
  "gdb_path": "/path/to/gdb"
}</code>
Copy after login
  • gdb_path 替换为 GDB 的安装路径。

4. 配置构建系统

  • 创建或打开项目文件夹,然后右键单击并选择“构建系统”->“新建构建系统”。
  • 粘贴以下内容:
<code>{
  "cmd": ["gdb", "-q", "$file"],
  "file_regex": "^(.*):(\\d+):(\\d+)$",
  "selector": "source.c, source.cpp"
}</code>
Copy after login
  • $file 替换为调试器命令的正确占位符(通常为 %f)。
  • file_regex 替换为与调试输出匹配的正则表达式。

5. 设置断点

  • 打开要调试的文件并转到要设置断点的行。
  • 右键单击行号并选择“Toggle Breakpoint”。

6. 启动调试会话

  • 按 F5(Windows/Linux)或 Cmd+F5(macOS)启动调试会话。

The above is the detailed content of How to configure sublimegdb. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!