Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 151610 - Can not attach to MinGW project on Windows
Can not attach to MinGW project on Windows
Status: VERIFIED FIXED
Product: cnd
Classification: Unclassified
Component: Debugger
6.x
All Windows XP
: P2 (vote)
: 6.x
Assigned To: _ gordonp
issues@cnd
65fixes2-verified
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-28 15:27 UTC by Alexander Pepin
Modified: 2009-06-25 10:59 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
Gdb timed out log (1.27 KB, text/plain)
2008-11-20 13:23 UTC, Alexander Pepin
Details
gdb log for the latest dev build with "-J-Dgdb.logger.level=WARNING" (1.29 KB, text/plain)
2008-11-21 21:04 UTC, Alexander Pepin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pepin 2008-10-28 15:27:50 UTC
Split from issue #151492

Steps to reproduce:
- add MinGW tool collection and set it as default
- create any application which waits for input (e.g. Quote) 
- clean and build it
- run application from IDE
- try to attach to the application process
Result: Attach dialog contains only /usr/bin/ps
Comment 2 Quality Engineering 2008-10-31 04:47:13 UTC
Integrated into 'main-golden', will be available in build *200810310201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/3c35f4b29305
User: Gordon Prieur <gordonp@netbeans.org>
Log: Fixed IZ #151610  Can't attach to MinGW projects on Windows. Also reformatted the file (which has looked ugly since NB switched
tab size from 8 to 4).
Comment 3 Alexander Pepin 2008-11-13 14:49:54 UTC
Fix failed in build 20081113. IMO the problem is that 'ps' is called from cygwin but program is run from MSYS. We should
somehow work with both possibilities or as the first step we could call 'ps' for default tool collection. 
Comment 4 _ gordonp 2008-11-14 22:11:10 UTC
In what way did the fix fail? Did you see the process you wanted to attach to and have the
attach fail? Or did you not see the desired process?

I tested this a lot today (I added the -W flag which shows *all* processes on Windows) and
had no problems attaching. I can run the Cygwin ps and attach to either a Cygwin or MinGW
process.

Actually the only problem I had was when I had a MinGW process and the psys ps didn't show
it (thats when I decided to add the -W flag to the ps command).
Comment 5 Alexander Pepin 2008-11-15 20:32:19 UTC
Gordon, your only problem is the main problem which I'm trying to explain you :)
Short answer is: I can't see MinGW/MSYS processes in Attach debugger dialog.

One more scenario:
- create Quote_1 using cygwin tool collection
- create Quote_2 using MinGW tool collection
- run Quote_1 from IDE
- open Attach Debugger dialog, I can see and attach Quote_1 process
- close Quote_1
- run Quote_2 from IDE
- open Attach Debugger dialog
Result: I can not see Quote_2 process. The only visible process is /usr/bin/ps
Comment 6 _ gordonp 2008-11-19 00:51:07 UTC
Please retest on Windows with a nightly built after 11/18/2008.
Comment 7 _ gordonp 2008-11-19 21:10:49 UTC
A related issue (IZ #125773) was related to many Windows processes not being shown. It was fixed
for Windows by http://hg.netbeans.org/main?cmd=changeset;node=3e580ba55ebf  and
http://hg.netbeans.org/main?cmd=changeset;node=ce719a8ea94e.

With respect to NB65 patch1, all 4 changesets should be delivered in the patch.
Comment 8 _ gordonp 2008-11-19 21:30:49 UTC
Closed too fast. Alexander's 1st email led me to close it. A subsequent email said he
was still having problems...
Comment 9 Alexander Pepin 2008-11-20 13:23:24 UTC
Created attachment 73950 [details]
Gdb timed out log
Comment 10 Alexander Pepin 2008-11-20 14:31:49 UTC
after partial fixing issue #125773 Attach dialog shows all Windows processes but an attempt to attach to desired process
causes IDE hang and appearing of the information window with a message "Gdb timed out attempting to attach tothe
selected process". Gdb log for this state is attached (see above)
 Steps to reproduce:
- open IDE
- add MinGW tool collection
- set "Make Command" to msys make
- set MinGW tool collection as Default
- create Quote project
- clean and build it
- run Quote from IDE, "C:\msys\1.0\bin\sh.exe" terminal window appears
- open Attach to Process dialog
- find 'quote' process there, select it and press OK
Result: IDE hangs for a while then an information window appears with a message "Gdb timed out attempting to attach
tothe selected process".
 
Comment 11 Alexander Pepin 2008-11-21 21:04:26 UTC
Created attachment 74027 [details]
gdb log for the latest dev build with "-J-Dgdb.logger.level=WARNING"
Comment 12 pgebauer 2008-11-24 09:29:20 UTC
The issue didn't pass the nomination process by nomination cut-off date. It has been marked as 65fixes2-candidate.
Comment 13 _ gordonp 2008-12-03 18:11:22 UTC
The gdb command log (attachment ID 74027) shows that an attempt to load symbols for
"C:/working/nb_dev_working/Quote_mw\dist/Debug/MinGW-Windows/quote_mw" was made (token 104)
and the failure for 104 shows .../Quote_mwdist/... which looks like the basedir and build
result were incorrectly concatenated to create an invalid file name. This has been fixed
in  http://hg.netbeans.org/main/rev/b6b6ed87ee55 which guarantees that the path contains
forward slashes (gdb requires forward slashes).

Another problem is that when an attach failure is recognized a warning dialog is posted
using SwingUtilities.invokeLater(). However, the main thread executes more gdb commands,
even though we've failed to attach. So I've added "return"s after the invokeLater calls so
we don't ask gdb for registers. This is resolved by
http://hg.netbeans.org/main?cmd=changeset;node=fe5ed6a732c3.

There was also a error posted from the main start debugger thread (instead of with
SwingUtilities.invokeLater). I put this into an invokeLater so that shouldn't be a
problem. The changeset for this last fix was http://hg.netbeans.org/main?cmd=changeset;node=d24dcc804512.

So I've fixed several minor issues, but none of them address why the gdb binary couldn't
attach to the process and timed out. Please retest and let me know if the timeout is a
repeatable problem. If so, then please attach both another gdb-cmds* log and a process
list (taken outside of the IDE) showing all system processes (ps -W). Also, are you using
the MinGW/msys ps or the Cygwin ps (both should work, but I'd like to know if one vs the
other somehow caused the problem).
Comment 14 _ gordonp 2008-12-03 18:18:52 UTC
Since there were a number of changesets involved in this fix, I'm putting them all into a single
update to make it easier for support to track:

    http://hg.netbeans.org/main?cmd=changeset;node=3c35f4b29305
    http://hg.netbeans.org/main?cmd=changeset;node=edd647b62be9
    http://hg.netbeans.org/main?cmd=changeset;node=3e580ba55ebf 
    http://hg.netbeans.org/main?cmd=changeset;node=ce719a8ea94e
    http://hg.netbeans.org/main?cmd=changeset;node=b6b6ed87ee55
    http://hg.netbeans.org/main?cmd=changeset;node=fe5ed6a732c3
    http://hg.netbeans.org/main?cmd=changeset;node=d24dcc804512

Note: Changeset d24dcc804512 removed the unset private method GdbDebugger.getGdbVersion().
The removal of this method had nothing to do with the fix and doesn't need to be back
ported to patch2.
Comment 15 Alexander Pepin 2008-12-04 18:35:42 UTC
It seems to be an issue with my gdb. I could not attach to process from console either. I reinstalled both MinGW and
gdb-6.8. Now everything is working as expected.

verified in build 20081204
Comment 16 Quality Engineering 2008-12-05 05:59:35 UTC
Integrated into 'main-golden', will be available in build *200812050201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/d24dcc804512
User: Gordon Prieur <gordonp@netbeans.org>
Log: Added another "return" after a debugger startup error. I also moved a DialogDispaly.notify to
be called from SwingUtilities.invokeLater. This *possibly* is the cause of the hang in IZ #151610
(because it required EDT and EDT is blocked by the debuggercore during debugger startup).
Comment 17 jinb 2009-01-08 18:39:16 UTC
Hello,
it impossible to apply mentioned changeset(s) to release65_fixes [ref1] branch because a lot of non-this IZ related
changes were made and other changesets pushed into main [ref2] repository between release65_fixes branching time and
mentioned changeset(s) pushing time. Please provide cumulative changeset/ set of changesets applicable to
release65_fixes branch otherwise this fix will be skipped for current NB65 patch.
This problem is common for following IZs: 151761, 151610, 151577, 133134, 155487 
[ref1]: http://hg.netbeans.org/release65_fixes
[ref2]: http://hg.netbeans.org/main
Comment 18 Alexander Pepin 2009-01-14 14:07:43 UTC
verified in NB6.5 with provided jar files
Comment 19 jinb 2009-01-14 17:43:36 UTC
Cumulative backport of fixes of IZ 151481(rebackport), 151577, 151610, 153473, 151640, 151761, 155487, 151631, 133134
provided by developer.
Backported into release65_fixes branch
http://hg.netbeans.org/release65_fixes/rev/84a0c7175a4b
Comment 20 Alexander Pepin 2009-01-19 15:56:54 UTC
verified in patch2


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo