entlicher commented on a change in pull request #2913:
URL: https://github.com/apache/netbeans/pull/2913#discussion_r620652894
##########
File path:
java/java.nativeimage.debugger/src/org/netbeans/modules/java/nativeimage/debugger/api/NIDebugRunner.java
##########
@@ -68,18 +72,55 @@ public static NIDebugger start(File niFile, List<String>
arguments, String debug
JPDABreakpointsHandler breakpointsHandler = new
JPDABreakpointsHandler(niFile, debugger);
File workingDirectory = new File(System.getProperty("user.dir"));
List<String> command = arguments.isEmpty() ?
Collections.singletonList(niFile.getAbsolutePath()) :
join(niFile.getAbsolutePath(), arguments);
+ DialogDisplayer displayer = DialogDisplayer.getDefault(); // The
launcher might provide a special displayer in the lookup. This is why we grab
it eagerly.
debugger.start(
command,
workingDirectory,
debuggerCommand,
COMMAND_DEBUG + " " + niFile.getName(),
executionDescriptor,
- startedEngine).thenRun(() -> {
+ (engine) -> {
+ checkVersion(debugger.getVersion(), displayer);
+ if (startedEngine != null) {
+ startedEngine.accept(engine);
+ }
+ }).thenRun(() -> {
breakpointsHandler.dispose();
});
return debugger;
}
+ @NbBundle.Messages("MSG_GDBVersionBug=gdb bug #26139 will affect the
debugging.\nWe recommend to upgrade to version 10.1 or newer.")
+ private static void checkVersion(String version, DialogDisplayer
displayer) {
+ String gdbVersion = "GNU gdb";
+ int i = version.indexOf(gdbVersion);
+ if (i >= 0) {
+ i += gdbVersion.length();
+ i = skipParanthesis(version, i);
+ int eol = version.indexOf("\\n", i);
+ if (eol > 0) {
+ String v = version.substring(i, eol).trim();
+ if (v.startsWith("8.") && !v.startsWith("8.0") ||
v.startsWith("9.")) {
+ NotifyDescriptor descriptor = new
NotifyDescriptor.Message(Bundle.MSG_GDBVersionBug(),
NotifyDescriptor.WARNING_MESSAGE);
+ displayer.notifyLater(descriptor);
+ }
+ }
+ }
Review comment:
I belive it's O.K. When the version is not detected, then the versioning
is different, or the vendor is different. We do not want to disturb users with
false positives. We notify about the GDB bug only when we successfully detect
the versions that are affected by that bug.
##########
File path:
java/java.nativeimage.debugger/src/org/netbeans/modules/java/nativeimage/debugger/api/NIDebugRunner.java
##########
@@ -68,18 +72,55 @@ public static NIDebugger start(File niFile, List<String>
arguments, String debug
JPDABreakpointsHandler breakpointsHandler = new
JPDABreakpointsHandler(niFile, debugger);
File workingDirectory = new File(System.getProperty("user.dir"));
List<String> command = arguments.isEmpty() ?
Collections.singletonList(niFile.getAbsolutePath()) :
join(niFile.getAbsolutePath(), arguments);
+ DialogDisplayer displayer = DialogDisplayer.getDefault(); // The
launcher might provide a special displayer in the lookup. This is why we grab
it eagerly.
debugger.start(
command,
workingDirectory,
debuggerCommand,
COMMAND_DEBUG + " " + niFile.getName(),
executionDescriptor,
- startedEngine).thenRun(() -> {
+ (engine) -> {
+ checkVersion(debugger.getVersion(), displayer);
+ if (startedEngine != null) {
+ startedEngine.accept(engine);
+ }
+ }).thenRun(() -> {
breakpointsHandler.dispose();
});
return debugger;
}
+ @NbBundle.Messages("MSG_GDBVersionBug=gdb bug #26139 will affect the
debugging.\nWe recommend to upgrade to version 10.1 or newer.")
+ private static void checkVersion(String version, DialogDisplayer
displayer) {
+ String gdbVersion = "GNU gdb";
+ int i = version.indexOf(gdbVersion);
+ if (i >= 0) {
+ i += gdbVersion.length();
+ i = skipParanthesis(version, i);
+ int eol = version.indexOf("\\n", i);
+ if (eol > 0) {
+ String v = version.substring(i, eol).trim();
+ if (v.startsWith("8.") && !v.startsWith("8.0") ||
v.startsWith("9.")) {
+ NotifyDescriptor descriptor = new
NotifyDescriptor.Message(Bundle.MSG_GDBVersionBug(),
NotifyDescriptor.WARNING_MESSAGE);
+ displayer.notifyLater(descriptor);
+ }
+ }
+ }
Review comment:
I believe it's O.K. When the version is not detected, then the
versioning is different, or the vendor is different. We do not want to disturb
users with false positives. We notify about the GDB bug only when we
successfully detect the versions that are affected by that bug.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists