Linux Uprobe: A Powerful Tool for Dynamically Tracing User-Space Programs

Linux Uprobe: A Powerful Tool for Dynamically Tracing User-Space Programs

Previously, we introduced kprobes in the Linux kernel, which is a dynamic tracing technology specifically for the Linux kernel space. In this article, we will introduce a similar technology called uprobes (User Space Probe), which, as the name suggests, focuses on dynamic tracing in the Linux user space. It allows developers to set probes at … Read more

Lightweight Logging Tool uLog: Enabling Microcontrollers to Elegantly “Log”

Lightweight Logging Tool uLog: Enabling Microcontrollers to Elegantly "Log"

Summary: uLog is a tool that, once integrated into your embedded project, can immediately print out information such as “Where did I go?” and “Where did it go wrong?” It is compact, low overhead, and user-friendly. What is uLog? uLog is a logging library specifically designed for resource-constrained MCUs (Microcontrollers), consisting of only 1 header … Read more

Common GDB Commands for Linux

Common GDB Commands for Linux

1. Common GDB Commands 1. Basic Commands 1.1. Start Debugging gdb test.elf 1.2. View Disassembly # Set style to view disassembly set disassembly-floavor intel disassemble # Disassemble current instruction disassemble $pc, $pc+0x100 1.3. View Functions info functions 1.4. Print Addresses # Print variable address Print function address print &var print test_function 1.5. GDB Remote Connection … Read more

An Overview of GCC Compiler Optimization

An Overview of GCC Compiler Optimization

GCC (GNU Compiler Collection) is one of the most commonly used C/C++ compilers on Linux, supporting multiple languages and platforms. This article introduces the working principles of GCC, commonly used commands, optimization options, and best practices based on relevant materials. Differences and Connections Between gcc and g++ gcc processes source files in C language by … Read more

backward-cpp: An Open Source Library for C++ Stack Tracing

backward-cpp: An Open Source Library for C++ Stack Tracing

backward-cpp is a library for C++ that helps developers perform stack tracing when a program crashes, providing detailed error information similar to stack trace functionality. This library is commonly used for debugging and error tracking, offering valuable insights when handling crashes and exceptions, helping developers quickly locate and fix issues. 1. Introduction backward-cpp is a … Read more

Debugging C++ Multithreaded Programs with GDB

Debugging C++ Multithreaded Programs with GDB

We are currently in a multi-core era, and multithreaded programs are very common. This article will explore how to debug C++ multithreaded programs. Example Code This article designs a demo multithreaded program where the main thread starts two business threads that execute the functions business_1 and business_2. Each of these functions defines a counter object … Read more

Why Microcontrollers Overlook C++: Five Major Drawbacks

Why Microcontrollers Overlook C++: Five Major Drawbacks

Memory Overhead Issues Virtual Function Table Overhead: Each polymorphic class increases vtable memory usage RTTI Support Cost: Runtime Type Identification consumes additional FLASH space Exception Handling Bloat: The try-catch mechanism significantly increases code size Uncontrollable Performance Constructor Hidden Operations: Static initialization order is uncontrollable Dynamic Memory Allocation Risks: new/delete can lead to fragmentation in a … Read more

IC004 – Constants in C++

IC004 - Constants in C++

Feiyu BLOG 2023.3.31- Information Technology Education Python-Based Teaching Research Topics Academic Level Examination Python Program Design C++ Informatics …… Constants refer to specific numbers or characters used in a program. During the execution of the program, their values cannot be changed. Definition of Constants: Format 1: const type_specifier constant_name For example: const int X=2 indicates … Read more

Linux EtherCAT Debugging Commands

Linux EtherCAT Debugging Commands

View Master Status Obtain the master status and the number of slave device nodes ./ethercat master Example Usage: The master is in idle state, the communication domain is not activated, master data statistics View Slave Information The slaves command is used to view the information of slave device nodes (ESC) mounted on the EtherCAT bus … Read more

Analyzing the Powerful Tool for Linux Kernel Calls: ftrace

Analyzing the Powerful Tool for Linux Kernel Calls: ftrace

More content can be added to the Linux system knowledge base package (tutorials + videos + Q&A). Table of Contents 1. Specifying the ftrace Tracer 2. Setting the Functions to Trace 3. ftrace Switches 4. Viewing the Trace 5. Using trace-cmd 6. Common Options for trace-cmd 6.1. Viewing Available Trace Events 6.2. Tracing Function Calls … Read more