ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

四.使用vscode调试xv6内核

2022-09-10 19:32:13  阅读:269  来源: 互联网

标签:launch vscode com gdb xv6 json 内核 true


资料来源:

1.南京大学操作系统课程第18课:https://www.bilibili.com/medialist/play/202224425?from=space&business=space_collection&business_id=192498&desc=0
下方的评论:
  https://zhuanlan.zhihu.com/p/501901665
  https://www.bilibili.com/video/BV1Lv411g7EV/?spm_id_from=333.824.b_636f6d6d656e74.32

一.相关插件

1.vscode远程连接到自己xv6目录

2.下载相关扩展

3.创建launch.json和task.json文件

(1)launch.json 

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "debug xv6",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/kernel/kernel",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "miDebuggerServerAddress": "localhost:25000",
            "miDebuggerPath": "/usr/bin/gdb-multiarch",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "pretty printing",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "logging": {
                 "engineLogging": true,
                 "programOutput": true,
            },
            "preLaunchTask": "xv6build",
        }
    ]
}

(2)task.json

// xv6-riscv/.vscode/tasks.json
{
  "version": "2.0.0",
  "tasks": [
      {
          "label": "xv6build",
          "type": "shell",
          "isBackground": true,
          "command": "make qemu-gdb",
          "problemMatcher": [
              {
                  "pattern": [
                      {
                          "regexp": ".",
                          "file": 1,
                          "location": 2,
                          "message": 3
                      }
                  ],
                  "background": {
                      "beginsPattern": ".*Now run 'gdb' in another window.",
                      // 要对应编译成功后,一句echo的内容. 此处对应 Makefile Line:170
                      "endsPattern": "."
                  }
              }
          ]
      }
  ]
}

(3)在命令行中执行make qemu-gdb查看端口

 

(4).gitinit文件相关行注释

(5)launch.json文件相关行修改

 

(6)关闭所有终端,新建一个新的终端,在main中添加断点,按F5开始调试

 

标签:launch,vscode,com,gdb,xv6,json,内核,true
来源: https://www.cnblogs.com/zhihaospace/p/16277330.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有