Closed schittli closed 3 years ago
Hi Thomas. (still need to get back to the other issue!)
I don't have any immediate ideas, however if knowing at runtime whether the JVM is in debug mode is sufficient, you can do this:
boolean isDebugMode() {
List<String> values = java.lang.management.ManagementFactory.getRuntimeMXBean().getInputArguments();
for(String value : values) {
if(value.startsWith( "-Xrunjdwp:") || value.startsWith("-agentlib:jdwp=")) {
return true;
}
}
return false;
}
}
I do this, for example, to conditionally change caching strategies to make it easier to catch certain classes of bugs.
Hello Scott
thanks a lot for your help!, your isDebugMode()
method works great. I am surprised that not many Java developers miss this kind of information.
On the other issue, yes it is perfectly OK and important to prioritize, I keep my eyes open and test every Manifold update, maybe it gets solved on the fly 😃
Good evening Scott
I hope you're doing well.
I have a question, maybe an idea: Java has since its beginning the problem that it can not detect if a debugger is attached at runtime, therefore there is no (easy) code like
Debugger.IsAttached()
, unfortunately.Would there be an elegant way to use the Manifold preprocessor to detect the attached debugger? Maybe you have an idea :-)
Thanks a lot, kind regards, Thomas