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...
How to Add Self-Signed SSL Certificate in Java Apache Tomee / Tomcat Server and then launch your site in Compute Engine?
Assumptions:
- You already have Linux / Debian Compute Engine installed in your Google Cloud Plateform (GCP) with Java installed in the system.
- You have Downloaded and Installed your required version of Tomee / Tomcat Server and installed this in your Compute Engine
- You have an active external IP Address for your Compute Engine
Prodecure:
1. Set $JAVA_HOME path as your java home directory.
2. Set $CATALINA_BASE path as your Tomee / Tomcat server base directory
3. Type Command in terminal: $JAVA_HOME/bin/keytool -genkey -alias <tomcat> -keyalg RSA
Enter details as asked for like password, your details, etc
4. Type Command: sudo nano $CATALINA_BASE/conf/server.xml
Add following line in your server<!-- Define an SSL Coyote HTTP/1.1 Connector on port 8443 --><Connectorprotocol="org.apache.coyote.http11.Http11NioProtocol"port="8443" maxThreads="200"scheme="https" secure="true" SSLEnabled="true"keystoreFile="${user.home}/.keystore" keystorePass="changeit"clientAuth="false" sslProtocol="TLS"/>
5. Activate TCP Port Number 8443 in your Compute Engine
6. Restart Tomee / Tomcat Server
7. Type command: curl https://localhost:8443
To see the outcome
Or visit in Browser <Your Compute Engine IP Address:8443>
8. Now, in browser, since in https:// it is a self signed certificate, it will show unsafe, back to safety, but you can do proceed with unsafe.
Note: This is more safer than http:// but is giving warning because certificate is my self signed generated using keytool in java bin folder and is not yet certified by any Certifying Autority, hence warning
Work Done
Comments
Post a Comment
If you have any doubts, please let me know.