Skip to main content

Posts

How to use gdb in Ubuntu Terminal

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...

Jamun consumption precautions (discussions with chatGpt)

Query: Jamun: precautions after n before eating ChatGPT said: Here are scientifically backed precautions and considerations before and after eating jamun (Java plum / Syzygium cumini) : ✅ Before Eating Jamun 1. Wash Thoroughly Why: To remove surface dirt, pesticide residues, or microbial contamination. How: Wash under running water or soak in salt water for a few minutes. 2. Check Ripeness Eat only ripe, purple-black jamuns . Raw/unripe fruits can cause throat irritation or stomach upset. 3. Avoid If You Have Certain Conditions Low Blood Sugar (Hypoglycemia): Jamun lowers blood sugar, so avoid or use cautiously if you're already taking antidiabetic meds or have low sugar. Allergy risk: Rare, but check for allergy to Syzygium species. ✅ While Eating 4. Do Not Eat Seeds (Raw) Seeds are medicinal , but raw seeds may not be digestible and should not be chewed or swallowed whole. If used, seed powder (dry, powdered form) is safer and more bioa...

Roasting Maize Safely (discussions with chatGpt)

Query: Is it good to eat maige by cooking it in gas over flame n then eat ChatGPT said: Yes, it's perfectly fine and safe to eat maize (corn) roasted directly over a gas flame , and it’s a common method used in many countries, including India. Here's the science and safety behind it: ✅ Benefits of Roasting Maize Over Flame: No Added Fats or Oil: Roasting doesn’t need oil or butter, making it a low-calorie snack. Preserves Nutrients: Compared to boiling, roasting retains more water-insoluble vitamins like B-complex (thiamine, niacin). Better Flavor: Direct flame gives a smoky, charred flavor due to the Maillard reaction , which enhances taste without chemicals. Kills Germs: The high temperature of flame helps kill most bacteria or parasites present on the surface. ⚠️ Precautions While Roasting Over Gas: Don't Burn It Black: Over-charring can produce polycyclic aromatic hydrocarbons (PAHs) which are harmful in high amounts. Moderat...