Skip to main content

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

21 Amazing Hacks That Make Healthy Lifestyle Easier

21 Amazing Hacks to Make Healthy Lifestyle Easier

  1. Sitting in AC & Feeling Dehydrated:
    AC sucks moisture from atmosphere & then from our bodies. To prevent this place potfull of water in the room & then turn the AC on.
  2. Don't peel of skin of potato, sweet potato, pumpkin, cucumber before cooking them:
    Their peel is super rich in vitamins & minerals. Then what to to for pesticine? For this you can wash them in baking soda solution for 10-15 minutes. This will save your time & effort; also give you extra nutrition.
  3. Not sure if vender have served you fresh sugarcane juice?
    Sugarcane Juice
    Property Fresh Not So Fresh
    Color Light Green Darker
    Frothyness More Almost no Frothy
    Image Fresh Not So Fresh
  4. Cucumber that you have cut turns out to be bitter
    Cut the cucumber from the centre, leave it for 15 sec then cut it.
    cucumber
  5. Do you directly soak Lentils in water & throw that water?
    Never make this mistake, this water if full of micro-nutrients.
    Best way is first wash the lentils, then soak it in water in only as much water as you need for cooking.
    After 6-8 hrs you can directly place it for cooking along with that water. This is smatter idea.
  6. Do you avoid soaking split lentils as their cooking time is low?
    You must soak all lentils, pulses, all variant rice, broken wheat before cooking irrespective of their cooking time.
    This is because all these foods gets nutrition rich 100% only when they are soaked.
  7. Do you add normal tap water extra water while preparing curry?
    Never do it. It will increase cooking time & also make curry hard to digest.
    Instead heat the water, & then add it. This way your curry will be much heather & tastier.
  8. More time you knead the dough, the faster Roti will get digested
    Whenever you begin cooking the meal, always first knead the dough, cover it & then keep aside.
    Then prepare you vegetable, & then prepare chapatis at last. This will result in faster digestible & softer chapatis.
  9. Rice should never be eaten at night
    This is said due to extremely cold potency due to which if consumed at night, it can cause problem.
    Hack is to add bay leaves & black pepper when cooking it for dinner, which balances it out.
  10. Have you ever grind thread mishri & try storing it in air-tight container?
    Later you may find it turns hard-stone line. To avoid this problem, after grinding mishri in grinder, let it cool down, then put it in airtight container.
  11. Whenever you prepare herbal drink like lemon water, aloe-vera juice, or giloy juice
    Make sure that you don't add too much water to it. According to ayurveda the quantity of water should be equal to the herbal juice added or at max double
  12. Are you confused, how long you should stick to one herbal juice option?
    According to ayurveda, one herbal juice should be consumed for at least 48 days (i.e 1 mandala) to experience its benefit.
    It should then be discontinued for about 15-20 days else body will get used to it.
    Then if you need it back, you may start again
  13. First & last meal that you consume after waking up & before sleepings respectively holds special significance
    These meals holds special significance in terms of their absorption & effectiveness.
    So herbal concoction are recommended before breakfast & medicinal herbs are prescribed with milk at night.
  14. Should you eat vegetable dalia for weight loss? Also can I eat it for weight gain?
    Yes to both. Broken dalia roasted in ghee is helpful for weight gain (according to ayurveda).
    However when roasted in cold-pressed oil, it helps to shed off excess weight.
  15. To avoid insect specially in the rainy season, put neem leaves in wheat flour, lentil, pluses.
    Also put neem leaves in your clothes. This will keep germs away
  16. Don't discard left over water when you make panir from milk. It can be used as follows
    • For making dough
    • In making curry
    • Added in soups
    • Wash hair & skinflints
    • Good for plants
    • Drink it as it is if your digestive system is weak. Good for intestine
  17. Curd gone sour?
    Rather then using it for consumption (which may increase pit dosa according to ayurveda due to its hot potency), use if for washing hair, skin
  18. Does your stomach bloat everytime you drink milk? Simple hack is to create forth in the milk by pouring it from one glass to another. This will make milk light to digest. Also good for people who suffer from gas
  19. Do you know how refreshing tender coconut water is?
    Purchase economical coconut opener. Just inset on side & enjoy fresh coconut water.
    alt| alt
  20. Do you experience bloating immediately after a meal?
    Hack is not to get up immediately after eating meal, keep sitting for atleast few minutes after eating food.
    You can also sit in bagra-assan for few minutes, it is very rewarding. You will observe difference in just one sitting like this.
  21. Do you've trouble of too many thoughts while sleeping?
    It totally depends on what your mind consumes. Before going to sleep spend sometime reading a book that'll relax you.

There were 21 life hacks that were mentioned in the video mentioned in bibliography, creater beliefs that above tips can make fitness lifestyle easy.
For detailed understanding you may watch the video mentioned in bibliography.


Bibliography

Comments

Popular posts from this blog

Ubuntu Notes: Set up autossh as systemd useful-reminder commands

 sudo vim /etc/systemd/system/permanentAutossh.service ======================================== [Unit] Description=Keeps a tunnel to myOciFreeNat open After=network-online.target [Service] User=<username> Environment="AUTOSSH_GATETIME=0" ExecStart=/usr/bin/autossh -M 0 -q -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -L 4322:127.0.0.1:5432 -i /<ssh_private_key_file_absolute_path> <username>@<ip_address> -p 22 [Install] WantedBy=multi-user.target ======================================== sudo systemctl daemon-reload sudo systemctl enable permanentAutossh sudo systemctl start permanentAutossh ================== sudo systemctl daemon-reload sudo systemctl restart permanentAutossh sudo systemctl status permanentAutossh ====================== sudo systemctl stop permanentAutossh sudo systemctl disable permanentAutossh sudo rm /etc/systemd/system/permanentAutossh.service

syslog cpp programming: learning using chatGcp

  Introduction to Syslog C++ August 27, 2024 This conversation may reflect the link creator’s personalized data, which isn’t shared and can meaningfully change how the model responds. You said: I am new to syslog in cpp programming n just starting. Can you teach me ChatGPT said: ChatGPT Sure! syslog is a standard for logging system messages in Unix-like operating systems. It provides a way to send log messages to the system log, which can then be collected and analyzed by various tools. Here's a basic guide to get you started with syslog in C++: 1. Include the Necessary Header To use syslog , you need to include the syslog.h header: cpp Copy code # include <syslog.h> 2. Open the Connection to syslog Before sending log messages, you need to open a connection to the syslog system. This is typically done at the start of your program: cpp Copy code openlog ( "your_program_name" , LOG_PID | LOG_CONS, LOG_USER); "your_program_name" : A string representing ...

Ubuntu - C++ Notes: Install & update boost c++ library from git (may contain some error in process mentioned below)

 Boost C++ Library Installation from git in ubuntu: 1. create a directory named boost in your desired location and go to that directory mkdir boost;cd boost; 2. clone boost recursively from git using command git clone --recursive https://github.com/boostorg/boost.git 3. cd boost; sudo ./bootstrap.sh; 4. sudo ./b2; 5. sudo ./b2 install; DONE! --------------------------- Boost C++ Library Update Verson from git in Ubuntu: 1. go to gitDownloads/boost directory cd gitDownloads/boost; 2. git pull; 3. git submodule update --recursive; 4. cd boost; sudo ./bootstrap.sh; 5. sudo ./b2; 6. sudo ./b2 install; DONE!