Here's a practical, minimal guide for using GDB in Ubuntu terminal — from launching to setting breakpoints and navigating your code. 🧰 Step 1: Compile with Debug Symbols Use -g and disable optimizations ( -O0 preferred for debugging): bash Copy Edit g++ -g -O0 -o myprog myprog.cpp 🚀 Step 2: Launch GDB bash Copy Edit gdb ./myprog You'll see a (gdb) prompt. 🎯 Step 3: Set Breakpoints You can set breakpoints in three main ways : ✅ a. At a function gdb Copy Edit (gdb) break main ✅ b. At a specific file and line gdb Copy Edit (gdb) break myprog.cpp:42 ✅ c. At a method in a class gdb Copy Edit (gdb) break MyClass::doSomething If the symbol is mangled (C++), GDB usually demangles automatically, especially if compiled with -g . ▶️ Step 4: Run the Program gdb Copy Edit (gdb) run 🧠Step 5: Navigate Command Meaning next or n Step over current line step or s Step into function call finish Run until current function returns continue or c Continue until...
To install the Apache HTTP Server on Ubuntu, you can follow these steps: 1. Update Your Package List First, update your package list to ensure you have the latest information on available packages: bash Copy code sudo apt update 2. Install Apache Next, install the Apache server with the following command: bash Copy code sudo apt install apache2 3. Start and Enable Apache Once installed, you may want to start Apache and enable it to start automatically on boot: bash Copy code sudo systemctl start apache2 sudo systemctl enable apache2 4. Check Apache Status You can check the status of the Apache service to ensure it is running: bash Copy code sudo systemctl status apache2 If Apache is running correctly, you should see a status that includes active (running) . 5. Test Apache Installation To confirm that Apache was installed and is running properly, open a web browser and enter your server’s IP address or localhost : bash Copy code http://localhost If everything is set up correctly, you s...