JM233333's Blog
  • Programming Languages

    • C
    • Python
  • Algorithms and Data Structures

    • Data Structure
    • Fundamental Algorithms
    • Graph Theory
  • GNU Toolchain

    • Bash
    • gdb
  • Development Environment

    • Ubuntu
    • QEMU
  • Development Tools

    • Git
    • VSCode
  • Operating Systems

    • Principles of Operating Systems
    • Xv6
    • Linux Kernel
  • Software Testing and Analysis

    • Software Testing
    • Software Analysis
    • Program Verification
  • LeetCode
  • XJTUOJ
  • System

    • System Performance
  • Programming

    • ...
  • Others

    • ...
  • Paper Reading

    • Model Checking
    • Fuzzing
    • Symbolic Execution
  • 3D Game Programming

    • 3D Mathematics

JM233333

弱小可怜又无助的学术废物
  • Programming Languages

    • C
    • Python
  • Algorithms and Data Structures

    • Data Structure
    • Fundamental Algorithms
    • Graph Theory
  • GNU Toolchain

    • Bash
    • gdb
  • Development Environment

    • Ubuntu
    • QEMU
  • Development Tools

    • Git
    • VSCode
  • Operating Systems

    • Principles of Operating Systems
    • Xv6
    • Linux Kernel
  • Software Testing and Analysis

    • Software Testing
    • Software Analysis
    • Program Verification
  • LeetCode
  • XJTUOJ
  • System

    • System Performance
  • Programming

    • ...
  • Others

    • ...
  • Paper Reading

    • Model Checking
    • Fuzzing
    • Symbolic Execution
  • 3D Game Programming

    • 3D Mathematics
  • principles-of-operating-systems

  • xv6

  • linux-kernel

    • Linux Kernel 00 - Introduction
    • Linux Kernel 01 - Build and Run a Tiny Linux Kernel on QEMU
    • Linux Kernel 01 - Debug the Linux Kernel
      • Prerequisites
      • Preface
      • Debug with GDB
      • Debug with VSCode
      • References
    • Linux Kernel 01 - Kernel Configuration Overview
    • Linux Kernel 02 - Build a More Complete Small-scale Kernel
    • Linux Kernel 02 - System Calls
  • operating-systems
  • linux-kernel
JM233333
2022-08-01
438
1

Linux Kernel 01 - Debug the Linux Kernel

Creative Commons

# Prerequisites


# Preface


# Debug with GDB

TBD.

echo "add-auto-load-safe-path path/to/linux-v.x.y/vmlinux-gdb.py" >> ~/.gdbinit

# Debug with VSCode

Create the file linux-5.15.57/.vscode/launch.json and fill in the following code :

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "kernel-debug",
            "type": "cppdbg",
            "request": "launch",
            "miDebuggerServerAddress": ":1234", // fill in the port corresponding to gdb
            "program": "${workspaceFolder}/vmlinux",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "logging": {
                "engineLogging": false
            },
            "MIMode": "gdb",
        }
    ]
}

# References

  • Linux Kernel Documentation - Debugging kernel and modules via gdb (opens new window)

  • Debugging Linux kernels with Qemu and GDB (opens new window)

  • Teach you how to debug Linux kernel with VSCode + Qemu + GDB (opens new window)


#操作系统#Linux#Linux 内核

← Linux Kernel 01 - Build and Run a Tiny Linux Kernel on QEMU Linux Kernel 01 - Kernel Configuration Overview→

最近更新
01
Linux Kernel 00 - Introduction
08-01
02
Linux Kernel 01 - Build and Run a Tiny Linux Kernel on QEMU
08-01
03
Linux Kernel 02 - Build a More Complete Small-scale Kernel
08-01
更多文章>
Theme by Vdoing | Copyright © 2019-2022 JM233333 | CC BY-NC-SA 4.0
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式