Embedded Linux
  • Cover
  • Summary
  • About This Training
    • Objectives
    • Skills
    • Prerequisites
    • Requirements
  • Once Upon A Time ...
  • Embedded Linux
  • Build Systems
    • Yocto Board Support Package
      • Yocto
      • Compilation
        • Make
        • Bitbake
        • Script
      • Building Blocks
      • SDK
      • Extra Packages
      • Kernel
        • Patch
        • Building
        • Headers
      • Modules
        • Cross Compilation
        • Native
      • Filesystem
      • Flashing
    • Distributions
      • CentOS
      • Google Brillo
      • Jubilinux
      • Kali
      • Ostro
      • Ubilinux
      • Debian
  • Boot Loaders
    • U-Boot
  • Initialization
    • Upgrade
    • Boot Up
    • Dual Boot
    • Root Directory
    • Display Message
    • Modules
    • Filesystem
    • Memory
    • Backup
    • Recovery
    • Reboot
    • Processes
  • User Space
    • Virtual Network Computing
    • Text Editors
    • Services
    • Logs
    • Package Management Systems
      • Open Package Management
      • Python Package Index
      • Nicely Package Make
      • Advanced Packaging Tool
      • Manual
      • Conda
    • Libraries
      • Mraa
      • Upm
      • OpenCv
      • Temboo
      • Libiio
    • Frameworks
      • Cylon JS
      • Johnny Five
      • ROS
      • Gobot
      • Pixhawk
      • Artoo
      • Bower
      • Zetta
      • Miscellaneous
  • Subsystems
    • X File Systems
    • Pin Muxing
    • Virtual File System
    • Memory
    • Input
    • General Purpose Input Output
    • Serial
    • Bluetooth
      • Advanced Audio Distribution Profile
        • Bluez
        • Gstreamer
        • Alsa
      • Human Interface Device Game Controller
      • Serial Port Protocol
      • Arduino
    • WiFi
    • Audio
    • Camera
    • Block
    • Universal Serial Bus
      • Human Interface Device Mini Keyboard
      • Python USB
    • Inter Integrated Circuit
    • Inter Process Communication
    • Peripheral Component Interconnect
    • Clock
    • Modems
    • Networking
    • Power
    • Thermal
    • Graphics
    • LED
    • LIDAR
    • Printer
    • Serial Peripheral Interface
  • Application Development
    • C
    • C++
    • Cross Compile
    • Containers
    • Python
    • NodeJS
    • Cloud9
    • Data
    • Drone Code
    • Speech
      • Python
    • Radio Frequency
    • Bots
    • Artificial Intelligence
      • WitAi
      • MycroftAi
    • Games
    • Vision
      • Bar Codes
      • Google Cloud Vision API
    • Messaging
    • Entertainment
    • Home Assistants
    • Dashboards
    • IRC
    • Location
    • Facial Recognition
    • Software Defined Radio
    • REST
    • Notes
    • Security
    • HAM Radio
    • Automotive
    • Digital Signage
    • Photography
  • Debug
  • Wrap-Up
    • Online Training
    • Challenge
    • Tbd
  • SandBox
Powered by GitBook
On this page
  • Kernel Configuration
  • Kernel Integration
  • Linux Debug Filesystem
  • Linux Magic System Request Key Hacks
  • Ftrace
  • Applications / Libraries
  • Programs

Debug

PreviousPhotographyNextWrap-Up

Last updated 7 years ago

Debugging is the process of finding and resolving or defects that prevent correct operation of computer software or a system. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge in another.

Kernel Configuration

    Kernel hacking

        -*- Kernel debugging
        [*]   Magic SysRq key
        -*-   Debug filesystem
        [*]   Detect Soft Lockups
        [ ]   Collect scheduler statistics
        [*]   Debug slab memory allocations
        [*]     Memory leak debugging
        [*]   Mutex debugging, deadlock detection
        [*]   Spinlock debugging
        [*]   Sleep-inside-spinlock checking
        [ ]   kobject debugging
        [ ]   Highmem debugging
        [ ]   Compile the kernel with debug info

Kernel Integration

Linux Debug Filesystem

    root@edison:~# mount -t debugfs none /sys/kernel/debug
    mount: none is already mounted or /sys/kernel/debug busy
           none is already mounted on /tmp/temptmpfs
    root@edison:~# ls /sys/kernel/debug/
    asoc                  gpio_debug            pmu_sync_d0ix
    bdi                   hid                   pwm
    bluetooth             hsu                   regmap
    boot_params           ieee80211             regulator
    c_states_stat         ignore_add            remoteproc
    cstate_ignore_add     ignore_remove         s3_ctrl
    cstate_ignore_remove  iio                   sched_features
    debug_feature         intel_scu_oshob       soc_thermal
    disable_emmc_ipanic   kprobes               sst
    dma_buf               mce                   suspend_stats
    dri                   mid_pmu_states        tracing
    dump_cmd              mmc0                  usb
    dump_output           mmc1                  wakeup_sources
    dwc3-device.1         mmc2                  watchdog
    dynamic_debug         pmic_ccsm             x86
    emmc_ipanic           pmu_force_d0i0
    gpio                  pmu_force_d0i3
    root@edison:~#

Linux Magic System Request Key Hacks

Ftrace

    root@edison:~# cd /sys/kernel/debug/tracing
    root@edison:/sys/kernel/debug/tracing# cat available_tracers 
    blk function_graph wakeup_rt wakeup preemptirqsoff preemptoff irqsoff function nop
    root@edison:/sys/kernel/debug/tracing# echo function > current_tracer
    root@edison:/sys/kernel/debug/tracing# cat current_tracer
    function

Applications / Libraries

Programs

None

Debugfs exists as a simple way for kernel developers to make information available to user space. Unlike /proc, which is only meant for information about a process, or sysfs, which has strict one-value-per-file rules, debugfs has no rules at all.

It is a 'magical' key combo you can hit which the kernel will respond to regardless of whatever else it is doing, unless it is completely locked up.

Wikipedia
Ubuntu Kernel Debugging Tricks
Wikipedia
Linux Kernel Documentation Debugfs
Linux Kernel Debugfs
Documentation
Linux Magic System Request Key Hacks
Debugging the kernel using Ftrace - Part 1