Linux Shell Script Debugging Techniques (PS4 BASH_XTRACEFD)

Linux Shell Script Debugging Techniques (PS4 BASH_XTRACEFD)

This article continues to share some debugging techniques. 1. Use PS4 for Custom Debug Output You can specify the output format of set -x using the PS4 variable: #!/usr/bin/env bash # ps4.sh # Custom debug prompt export PS4='+ ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' set -x # Now the debug output will show the filename and line number … Read more

Singleton Pattern in Embedded C: Writing ‘Globally Unique’ More Stably

In embedded projects, some resources are inherently unique: watchdog timers, RTCs, system clocks, debug serial ports, loggers, system configuration managers, CRC modules… If these modules are carelessly piled up with global variables, issues such as initialization order chaos, difficult-to-trace write access, and ISR/task concurrency collisions will inevitably arise. The goal of the singleton pattern is … Read more

Common Fault Tolerance Designs in Embedded Code

Click the blue “One Click Linux” in the upper left corner, and select “Set as Favorite“ Get the latest technical articles at the first time ☞【Technical Content】Learning Path for Embedded Driver Engineers ☞【Technical Content】Linux Embedded Knowledge Points – Mind Map – Free Access ☞【Employment】A Comprehensive IoT Project Based on Linux for Your Resume ☞【Employment】Resume Template … Read more

C++ RPC Utility Library Based on rpclib in Occlum Environment

RPC Utils Project Address:View OriginalThis is a C++ RPC utility library based on rpclib in the Occlum environment, providing simplified and user-friendly RPC client and server wrappers. • Compiled rpclib into a static link file using occlum-g++ in the Occlum environment. If used in other environments, it needs to be recompiled. • A quick implementation … Read more

Trice: The Fast Logging Tool for Embedded Development with Near-Zero Overhead

The Core Concept and Advantages of Trice In traditional embedded development, <span>printf</span> or logging functions are often limited due to high resource consumption and slow speed, especially in interrupt scenarios where performance issues may arise.Trice was born to address this, with its core concept of achieving efficient, low-overhead real-time logging and tracing through minimal code … Read more

Reinventing the Wheel: Implementing a Log Submodule in C

Reinventing the Wheel: Implementing a Log Submodule in C

Follow and star our public account for exciting content Source | Online Materials 1. Introduction to log.c log.c is a minimalistic C language logging library developed and maintained by akstuki. The project aims to provide a lightweight and easy-to-integrate solution that allows developers to quickly add logging functionality to their C applications. Despite its small … Read more

Understanding Linux Redirection

Understanding Linux Redirection

Understanding Linux Redirection In Linux systems, redirection is one of the core functionalities of shell scripts and command-line operations. It allows users to flexibly control the flow of standard input (stdin), standard output (stdout), and standard error (stderr) of commands, enabling powerful features such as data piping, logging, and error handling. Redirection not only simplifies … Read more

Stop Using print()! The Python Logging Library is the Ultimate Debugging Tool

Stop Using print()! The Python Logging Library is the Ultimate Debugging Tool

Hello everyone, today we are going to talk about a tool that can directly save you a few strands of hair—the Python logging library. Do you often find yourself in a situation where: halfway through writing code, the logic gets a bit messy, and you accidentally type the familiar <span>print("debug…")</span>? As a result, the more … Read more

Achieving Extreme Performance Logging in Rust

Achieving Extreme Performance Logging in Rust

In high-performance computing fields, such as high-frequency trading (HFT), every nanosecond is crucial. A slight delay can lead to significant opportunity costs. Therefore, developers must scrutinize every aspect of their code to eliminate unnecessary performance overhead. Logging is essential for debugging and monitoring, but if implemented poorly, it can itself become a major performance bottleneck. … Read more

Loguru: A Magical Python Library

Loguru: A Magical Python Library

Greetings, I am known by the same name across the internet [Algorithm Gold]Zero-based transition to AI, multiple algorithm competitions Top[Daily updates for ten thousand days, allowing more people to enjoy the fun of intelligence] Introduction In the world of programming, logging is a fundamental and important task that helps us understand the operational state of … Read more