Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do code changes while remote-debuging work?

I was doing a remote debug for a sql exception. The jar was present in the remote location. I was doing a remote debug from eclipse. Suddenly, I realised that it was throwing exception for connection.close() without a connection.commit().

So, I dropped the frame in the debug and added the connection.commit(). This worked. The connection was closed.

My question is how is this even possible? The class file was present in the jar and the code change was done locally on my eclipse..!!!

like image 775
Srivats Bharadwaj Avatar asked Aug 04 '26 05:08

Srivats Bharadwaj


1 Answers

Using a debugger in Java is a bidirectional thing. The debugger can send e.g. breakpoints to the running program and the running program can send back e.g. variable contents to the debugger.

When replacing code this code can also be sent to the program running (hot code replacement).

When you restart the debugged program then the changes made by the debugger are lost again.

like image 89
Uwe Plonus Avatar answered Aug 06 '26 20:08

Uwe Plonus