This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 79435 - *Gdb-lite* Exception: java.io.IOException: gdb: not found
Summary: *Gdb-lite* Exception: java.io.IOException: gdb: not found
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Nikolay Molchanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-29 16:07 UTC by Nikolay Molchanov
Modified: 2007-09-06 18:06 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolay Molchanov 2006-06-29 16:07:09 UTC
The problem was reported by Maxim Kartashev:

-----------------------------------------------------------------------------
- The following error is issued when I'm trying to debug the app:
      Start debugger
      # Exception: java.lang.Exception: Command "gdb--nw--interpreter=mi" 
      failed:
      java.io.IOException: gdb: not found
  (I would expect a message box saying smth like 
   "gdb not found on this system. You can specify its location this way: ...")
------------------------------------------------------------------------------
Comment 1 Nikolay Molchanov 2006-06-29 16:10:20 UTC
The description is correct. Users can specify gdb using "Project Properties -> 
Debugging", and there should be error dialog to explain how to do it. 
Comment 2 _ gordonp 2006-07-10 15:42:15 UTC
Since Nik changed this to "started" I'm assuming he should also have it
assigned to him...
Comment 3 Nikolay Molchanov 2006-07-10 19:56:43 UTC
The suggested fix is to improve the error handler in GdbProxy:

1. Catch this exception in GdbProxy in method startDebugging(), 
and pop-up a standard modal error dialog, with an error message 
like this one:

  Cannot start debugger "gdb". Path or file name is not correct.
  Please, use Project Properties to set correct PATH and debugger name.

                            [  Ok ]

2. User clicks "Ok" and method startDebugging() returns an error message
as result.

Note:

Probably it would be more useful if there will be 2 buttons:
                [ Ok ]     [ Cancel ]
and button "Ok" would open Project Properties dialog, but we decided that
it is a "too complicated" solution.

Comment 4 Nikolay Molchanov 2006-07-11 02:08:34 UTC
The suggested fix is implemented and integrated in "dev" release.
Here is the main part of the code changes:

Tag: cnd-nb50-dev
User: NikMolchanov
Date: 2006/07/10 16:41:10

Modified:
   cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbProxyCL.java

Log:
 Fix for  IZ 77324 *Gdb-lite* Exception: java.io.IOException: gdb: not found
 If debugger is not started
 - pop-up error dialog to explain the problem
 - close external terminal
 - close Debugger Console.

File Changes:

Directory: /cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/
==============================================================

File [changed]: GdbProxyCL.java
Url:
http://cnd.netbeans.org/source/browse/cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbProxyCL.java?r1=1.1.2.26&r2=1.1.2.27
Delta lines:  +41 -11
---------------------
--- GdbProxyCL.java	29 Jun 2006 22:33:05 -0000	1.1.2.26
+++ GdbProxyCL.java	10 Jul 2006 23:41:08 -0000	1.1.2.27
@@ -19,6 +19,9 @@
 import java.util.Map;
 import java.util.Vector;
 
+import org.openide.DialogDisplayer;
+import org.openide.NotifyDescriptor;
+
 /**
  * Class GdbProxyCL is a Controller component of gdb driver
  * The main part of the knowledge about the debugger UI is concentrated in this
class.
@@ -140,7 +143,29 @@
                 mergeEnv(debuggerEnvironment), // IZ 77324 environment is not
set properly
                 workingDirectory
                 );
-        if (reply == null) debuggerStatus = STARTING;
+        if (reply != null) {
+            // Pop-up error dialog
+            String recommendation = "\nPlease, use Project Properties to set
correct PATH and debugger name."; //FIXUP
+            String title = "Error: Cannot start debugger"; //FIXUP
+            NotifyDescriptor d =
+                    new NotifyDescriptor.Confirmation(reply + recommendation, 
+                    title,
+                    NotifyDescriptor.OK_CANCEL_OPTION);
+            if (DialogDisplayer.getDefault().notify(d) ==
NotifyDescriptor.OK_OPTION) {
+                // open Project Properties dialog?
+            }
+            // close terminal
+            if (externalTerminalPID != null) {
+                // Kill external terminal
+                String cmd = "kill -9 " + externalTerminalPID; // NOI18N
+                String dir = "/tmp"; // NOI18N
+                gdbProxy.gdbProxyML.executeExternalCommand(cmd, dir, 0);
+            }
+            // close console
+            gdbProxy.gdbProxyVL.closeDebuggerConsole();
+        } else {
+            debuggerStatus = STARTING;
+        }
         programStatus = NOT_STARTED;
         return (reply);
     }