Breakpoints in GDB: Set, Manage, and Use Like a Pro (Linux Debug Guide)
GDB (GNU Debugger) is the go-to tool for debugging C and C++ programs on Linux. One of … Read more
Lynxbee topic
GDB (GNU Debugger) is the go-to tool for debugging C and C++ programs on Linux. One of … Read more
In C programming, a struct groups related variables under a single type name. When passing a struct into a function, you can pass it by value (making a complete copy of the data) or by reference (passing a pointer).
Use Ubuntu’s libusb development package for ordinary application builds, or compile a reviewed upstream release into an isolated prefix when you need a newer or controlled version. Then verify the complete toolchain with pkg-config and a real USB device-enumeration program.
The `curl` command is not the libcurl development kit. Current Ubuntu builds normally need `libcurl4-openssl-dev`, which supplies headers and build metadata. Use pkg-config or CMake’s CURL target so transitive link flags and non-default installation paths remain correct.
The OpenSSL command and runtime library are not enough to compile C/C++ code. Ubuntu puts headers, unversioned linker files, and pkg-config metadata in `libssl-dev`. Install it for the correct architecture, then let pkg-config or CMake supply paths instead of hard-coding `/usr/include`.
`atexit()` registers no-argument callbacks for normal program termination. They run in reverse registration order after `main` returns or `exit()` is called—but not after `_Exit()`, `_exit()`, `abort()`, an unhandled fatal signal, a crash, or a forced kill.
Splint can still expose useful C mistakes through annotations and strict checking, but its last upstream release is from 2007. Use it for legacy compatibility or learning—not as the only security control—and pair it with current compilers, path-sensitive analyzers, sanitizers, tests, and human review.
A POSIX mutex does not make a variable magically private; it gives cooperating threads one serialized critical section and establishes synchronization around protected state. Build a checked C example, understand why the unlocked version is undefined, find races with ThreadSanitizer, and choose between mutexes and atomics.
Build one C executable from multiple translation units without turning the project into a library first. The example separates declarations from definitions, compiles object files independently, links them with GCC, inspects symbols, diagnoses common failures, and automates correct incremental rebuilds.
This modern JNI example replaces removed `javah` instructions with `javac -h`, derives the active JDK include path, compiles position-independent C into a shared library, and verifies both the exported symbol and Java-to-native call.
Linux procfs exposes a live, file-like view of process state without creating ordinary files on disk. This lab starts a harmless C process, captures its PID, inspects the useful `/proc/PID` entries, and cleans up reliably.
A single GCC command hides several distinct transformations, followed later by Linux process startup. Saving each intermediate file makes macros, assembly, ELF objects, linking, and dynamic loading much easier to reason about.
A debugger becomes useful when a crash that looked random becomes one source line, one call path, and one impossible value. Follow a complete GDB investigation from failure to verified fix.
This compiler error means `%` received a floating-point operand. Fix the underlying type choice with integer arithmetic or the appropriate `fmod` function—not a reflexive cast.
A practical look at C’s % operator: when a zero remainder proves divisibility, what negative results mean, and which edge cases need a guard.