Debug Port – What It Is and How to Use It

debugging

I want to explore code paths in Cassandra database, so after getting the code from git and explore it a bit I noticed that it starts a daemon process when I run it from Eclipse. I supposed that when this happens, I can no longer use the IDE to follow where the code is. Due to another problem I created this question and the person who replied talked about a debug port. I'm not familiar with this concept, and after googling it, the best explanation I found was on Wikipedia:

Debug port is a port included in a device to simplify development and
debugging, which is not necessary for normal functioning of it. Debug
ports are usually not removed or disabled to avoid costs of design
changes, and can be used by modders and hackers to get extra
functionality.

Which doesn't provide a lot of information on what a debug port is. Anyone care to clarify, please?

Best Answer

The debug port on the Wikipedia page refers to a physical i/o port-- for example, when you are doing Windows kernel hacking, you might connect the debugger to the target machine through a serial port.

The debug port in the question you reference is a different but related concept. You can start a Java virtual machine so that it listens on a particular TCP/IP network port for a debugger to connect and issue commands to control the JVM to do debugger tasks. A network port is just a 16-bit number. The answer to the referenced question describes how to start Cassandra so its JVM is listening for a debugger. In this case you need to specify the same number for the debug port on the Cassandra command line and when invoking the Eclipse debugger. Then Eclipse will be able to connect to and control the JVM running Cassandra, by issuing commands to that port.

Related Topic