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...
Assumptions:
1. You are using Linux / Debian Server
2. You are using Compute Engine
3. You are using Google Domains
4. Set $JAVA_HOME=<path to your java base directory>
5. Set $CATALINA_BASE=<path to your Tomcat / Tomee base directory>
-------------------------------------------------------------------------------------
Procedure:
1. Visit site https://certbot.eff.org/
2. In selection option,
a) My website running on <none of the above>
b) Operating system using <as per your operating system>, <Debian 10 in my case>
3. Type command sudo apt-get install certbot
4. Type command sudo certbot certonly --standalone
5. Your certificate will be downloaded and installed in /etc/letsencrypt folder
6. Your certificate files are as follows:
/etc/letsencrypt/live/<your domain name>/cert.pem
/etc/letsencrypt/live/<your domain name>/chain.pem
/etc/letsencrypt/live/<your domain name>/fullchain.pem
/etc/letsencrypt/live/<your domain name>/privkey.pem
7. Change permissions of these file if needed as it have default root access only so that Tomcat/ Tomee user can acces them
8. Type command sudo nano $CATALINA_BASE/conf/server.xml
9. Provide following lines in server.xml
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="/etc/letsencrypt/live/<your domain name>/privkey.pem"
certificateFile="/etc/letsencrypt/live/<your domain name>/cert.pem"
certificateChainFile="/etc/letsencrypt/live/<your domain name>/chain.pem"
type="RSA" />
</SSLHostConfig>
</Connector>
10. // restart tomc(at/ee) server
11. Check your working https:// website in your domain name
Work Done
Comments
Post a Comment
If you have any doubts, please let me know.