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 204711

Summary: NetBeans does not terminate GDB after debugging is complete
Product: cnd Reporter: nessup
Component: DebuggerAssignee: Egor Ushakov <gorrus>
Status: RESOLVED FIXED    
Severity: normal CC: apepin, jsprenkle, mmirilovic, soldatov
Priority: P3    
Version: 7.0.1   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:
Attachments: gdb log

Description nessup 2011-11-05 17:43:04 UTC
Product Version = NetBeans IDE 7.0.1 (Build 201107282000)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_01
Runtime = Java HotSpot(TM) 64-Bit Server VM 21.1-b02

It seems that, after my program exists gracefully (or not), an instance of gdb is left running in memory. Unless I terminate this rogue instance of GDB, NB debugging refuses to work entirely. Although I can get around the issue by manually SIGTERMing GDB after each program exit, it gets annoying after a while. Any solutions here? I am running GDB with the  -J-Dgdb.breakpoints.shortpaths=true flag. I would provide a NB log if I knew how.

Thanks,
--Dany.
Comment 1 Egor Ushakov 2011-11-07 10:40:31 UTC
are you using cygwin or mingw?
Comment 2 nessup 2011-11-08 17:11:21 UTC
Cygwin. Thanks, --Dany.
Comment 3 Egor Ushakov 2011-12-07 15:04:03 UTC
could you please:
1. attach gdb log from such session (http://wiki.netbeans.org/GdbLog)
2. try NB7.1rc2 http://dlc.sun.com.edgesuite.net/netbeans/7.1/rc2/

Thanks
Comment 4 dimstef 2011-12-23 11:37:55 UTC
I have the same problem too. I also tried NetBeans 7.1rc2, but there is no difference. My configuration is Win7 x64 NetBeans 7.0.1 CygWin.
Please Help!!!

dimstef
Comment 5 Egor Ushakov 2011-12-23 11:40:43 UTC
(In reply to comment #4)
> I have the same problem too. I also tried NetBeans 7.1rc2, but there is no
> difference. My configuration is Win7 x64 NetBeans 7.0.1 CygWin.
> Please Help!!!
> 
> dimstef

could you please attach gdb log?
Comment 6 dimstef 2011-12-28 09:16:43 UTC
First of all let me thank you for your immediate apply.
The gdb log I take from the Debugger Console is the following:

==============================================================
=thread-group-added,id="i1"
~"GNU gdb (GDB) 7.3.50.20111026-cvs (cygwin-special)\n"
~"Copyright (C) 2011 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-cygwin\".\nFor bug reporting instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>.\n"
&"C:\\\\Users\\\\dimstef/.gdbinit: No such file or directory.\n"
(gdb) 
2-list-features
3-gdb-set print repeat 0
4-gdb-set backtrace limit 1024
5-gdb-set print elements 0
6-file-symbol-file "D:/Users/dimitris/My Documents/EAP/Enotites/PLSDE/Project/acotcop/acotcop.exe"
7-file-exec-and-symbols  "D:\\Users\\dimitris\\My Documents\\EAP\\Enotites\\PLSDE\\Project\\acotcop\\acotcop.exe"
2^done,features=["frozen-varobjs","pending-breakpoints","thread-info","data-read-memory-bytes","breakpoint-notifications","ada-task-info"]
(gdb) 
3^done
(gdb) 
4^done
(gdb) 
5^done
(gdb) 
6^done
(gdb) 
7^done
(gdb) 
8-file-list-exec-source-file
9cd D:\Users\dimitris\My Documents\EAP\Enotites\PLSDE\Project\acotcop
10-exec-arguments 
8^done,line="310",file="main.c",fullname="/cygdrive/d/Users/dimitris/My Documents/EAP/Enotites/PLSDE/Project/acotcop/main.c",macro-info="0"
(gdb) 
11-break-insert -f "main.c:340"
1
12-break-insert -t _start
&"cd D:\\Users\\dimitris\\My Documents\\EAP\\Enotites\\PLSDE\\Project\\acotcop\n"
~"Working directory /cygdrive/d/Users/dimitris/My Documents/EAP/Enotites/PLSDE/Project/acotcop.\n"
9^done
(gdb) 
10^done
(gdb) 
11^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x004020b5",func="main",file="main.c",fullname="/cygdrive/d/Users/dimitris/My Documents/EAP/Enotites/PLSDE/Project/acotcop/main.c",line="340",times="0",original-location="main.c:340"}
(gdb) 
&"\n"
1^done
(gdb) 
12^error,msg="Function \"_start\" not defined."
(gdb) 
No command for record 1^done
13-break-insert -t main
13^done,bkpt={number="2",type="breakpoint",disp="del",enabled="y",addr="0x00402018",func="main",file="main.c",fullname="/cygdrive/d/Users/dimitris/My Documents/EAP/Enotites/PLSDE/Project/acotcop/main.c",line="319",times="0",original-location="main"}
(gdb) 
14-exec-run
=thread-group-started,id="i1",pid="1920"
=thread-created,id="1",group-id="i1"
~"[New Thread 1920.0xf34]\n"
14^running
*running,thread-id="all"
(gdb) 
=library-loaded,id="/cygdrive/c/Windows/system32/ntdll.dll",target-name="/cygdrive/c/Windows/system32/ntdll.dll",host-name="/cygdrive/c/Windows/system32/ntdll.dll",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/cygdrive/c/Windows/syswow64/kernel32.dll",target-name="/cygdrive/c/Windows/syswow64/kernel32.dll",host-name="/cygdrive/c/Windows/syswow64/kernel32.dll",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/cygdrive/c/Windows/syswow64/KERNELBASE.dll",target-name="/cygdrive/c/Windows/syswow64/KERNELBASE.dll",host-name="/cygdrive/c/Windows/syswow64/KERNELBASE.dll",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/cygdrive/c/cygwin/bin/cygwin1.dll",target-name="/cygdrive/c/cygwin/bin/cygwin1.dll",host-name="/cygdrive/c/cygwin/bin/cygwin1.dll",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/cygdrive/c/Windows/syswow64/ADVAPI32.DLL",target-name="/cygdrive/c/Windows/syswow64/ADVAPI32.DLL",host-name="/cygdrive/c/Windows/syswow64/ADVAPI32.DLL",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/cygdrive/c/Windows/syswow64/msvcrt.dll",target-name="/cygdrive/c/Windows/syswow64/msvcrt.dll",host-name="/cygdrive/c/Windows/syswow64/msvcrt.dll",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/cygdrive/c/Windows/SysWOW64/sechost.dll",target-name="/cygdrive/c/Windows/SysWOW64/sechost.dll",host-name="/cygdrive/c/Windows/SysWOW64/sechost.dll",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/cygdrive/c/Windows/syswow64/RPCRT4.dll",target-name="/cygdrive/c/Windows/syswow64/RPCRT4.dll",host-name="/cygdrive/c/Windows/syswow64/RPCRT4.dll",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/cygdrive/c/Windows/syswow64/SspiCli.dll",target-name="/cygdrive/c/Windows/syswow64/SspiCli.dll",host-name="/cygdrive/c/Windows/syswow64/SspiCli.dll",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/cygdrive/c/Windows/syswow64/CRYPTBASE.dll",target-name="/cygdrive/c/Windows/syswow64/CRYPTBASE.dll",host-name="/cygdrive/c/Windows/syswow64/CRYPTBASE.dll",symbols-loaded="0",thread-group="i1"
=thread-created,id="2",group-id="i1"
~"[New Thread 1920.0xc7c]\n"
*running,thread-id="all"
=breakpoint-modified,bkpt={number="2",type="breakpoint",disp="del",enabled="y",addr="0x00402018",func="main",file="main.c",fullname="/cygdrive/d/Users/dimitris/My Documents/EAP/Enotites/PLSDE/Project/acotcop/main.c",line="319",times="1",original-location="main"}
*stopped,reason="breakpoint-hit",disp="del",bkptno="2",frame={addr="0x00402018",func="main",args=[{name="argc",value="1"},{name="argv",value="0xf99eb0"}],file="main.c",fullname="/cygdrive/d/Users/dimitris/My Documents/EAP/Enotites/PLSDE/Project/acotcop/main.c",line="319"},thread-id="1",stopped-threads="all"
=breakpoint-deleted,id="2"
(gdb) 
15info threads
&"info threads\n"
~"  Id   Target Id         Frame \n"
~"  2    Thread 1920.0xc7c 0x77a9f8f5 in ntdll!RtlUpdateClonedSRWLock () from /cygdrive/c/Windows/system32/ntdll.dll\n"
~"* 1    Thread 1920.0xf34 main (argc=1, argv=0xf99eb0) at main.c:319\n"
15^done
(gdb) 
No answer for: 14-exec-run
16-exec-continue
16^running
*running,thread-id="all"
(gdb) 
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x004020b5",func="main",file="main.c",fullname="/cygdrive/d/Users/dimitris/My Documents/EAP/Enotites/PLSDE/Project/acotcop/main.c",line="340",times="1",original-location="main.c:340"}
*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x004020b5",func="main",args=[{name="argc",value="1"},{name="argv",value="0xf99eb0"}],file="main.c",fullname="/cygdrive/d/Users/dimitris/My Documents/EAP/Enotites/PLSDE/Project/acotcop/main.c",line="341"},thread-id="1",stopped-threads="all"
(gdb) 
17-stack-list-frames
17^done,stack=[frame={level="0",addr="0x004020b5",func="main",file="main.c",fullname="/cygdrive/d/Users/dimitris/My Documents/EAP/Enotites/PLSDE/Project/acotcop/main.c",line="341"}]
(gdb) 
No answer for: 16-exec-continue
18-stack-list-arguments 1
19-var-update --all-values * 
18^done,stack-args=[frame={level="0",args=[{name="argc",value="1"},{name="argv",value="0xf99eb0"}]}]
(gdb) 
19^done,changelist=[]
(gdb) 
20-stack-list-locals --simple-values
20^done,locals=[{name="error",type="int",value="0"}]
(gdb) 
21-var-create - @ error
22-var-create - @ argc
23-var-create - @ argv
24-var-update --all-values * 
21^done,name="var1",numchild="0",value="0",type="int",thread-id="1",has_more="0"
(gdb) 
22^done,name="var2",numchild="0",value="1",type="int",thread-id="1",has_more="0"
(gdb) 
23^done,name="var3",numchild="1",value="0xf99eb0",type="char **",thread-id="1",has_more="0"
(gdb) 
24^done,changelist=[]
(gdb) 
25-var-show-attributes "var1"
25^done,attr="editable"
(gdb) 
26-var-show-attributes "var2"
27-var-show-attributes "var3"
28-var-evaluate-expression var1
26^done,attr="editable"
(gdb) 
27^done,attr="editable"
(gdb) 
29-var-evaluate-expression var2
30-var-evaluate-expression var3
28^done,value="0"
(gdb) 
29^done,value="1"
(gdb) 
30^done,value="0xf99eb0"
(gdb) 
==============================================================
Let me note here that the above is what I take when I create a breakpoint at the very last command line of the program (at the "return" of the main function), since, if I let it finish, everything disappears in the debugging console, so there is nothing to copy from. Is there any other method for debugging messages copying?

I would appreciate your answer.
Thanks in advance
Dimitris
Comment 7 Egor Ushakov 2011-12-28 10:24:08 UTC
(In reply to comment #6)
> Let me note here that the above is what I take when I create a breakpoint at
> the very last command line of the program (at the "return" of the main
> function), since, if I let it finish, everything disappears in the debugging
> console, so there is nothing to copy from. Is there any other method for
> debugging messages copying?

Thanks for the log, investigating it at the moment!
The full log is saved in a temporary files folder and is not deleted until you close the IDE, see more information on how to find it here: http://wiki.netbeans.org/GdbLog
Comment 8 Egor Ushakov 2011-12-28 14:03:04 UTC
should be fixed in:
http://hg.netbeans.org/cnd-main/rev/2bca5f6761d4
Comment 9 Quality Engineering 2011-12-29 13:59:03 UTC
Integrated into 'main-golden', will be available in build *201112290601* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/2bca5f6761d4
User: Egor Ushakov <gorrus@netbeans.org>
Log: fixed #204711 (NetBeans does not terminate GDB after debugging is complete)
Comment 10 Egor Ushakov 2012-01-16 13:36:37 UTC
this fix is causing NPE in bug 207277
Comment 11 Egor Ushakov 2012-01-16 13:36:48 UTC
*** Bug 207277 has been marked as a duplicate of this bug. ***
Comment 12 Egor Ushakov 2012-01-16 15:09:16 UTC
this bug is fixed
Comment 13 soldatov 2012-01-17 14:23:43 UTC
verified in latest build. -1 in Sessions tab before fix and valid PID now
Comment 14 Egor Ushakov 2012-01-17 14:31:58 UTC
integrated into release71_fixes:
http://hg.netbeans.org/releases/rev/7b187a450161
Comment 15 soldatov 2012-02-17 08:47:11 UTC
verified in NetBeans IDE 7.1 (Build 201112071828)
Comment 16 soldatov 2012-02-17 09:47:24 UTC
Verified in NetBeans 7.1 with updates from 201202141941
Comment 17 jsprenkle 2013-07-29 18:50:18 UTC
This bug appears to have resurfaced in version 7.3.1

Product Version: NetBeans IDE 7.3.1 (Build 201306052037)
Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Comment 18 Egor Ushakov 2013-08-02 13:17:21 UTC
Please specify what cygwin or mingw version you're using and attach gdblog file (http://wiki.netbeans.org/GdbLog)
Comment 19 jsprenkle 2013-08-02 16:56:28 UTC
g++.exe version 4.8.0 rev2 built by MinGW-builds project.

After hitting stop button in netbeans the program 'gdborig.exe' is still found running in the task list.

I can't capture any gdb output after the program is stopped. The gdb console is cleared when the stop button is pressed.
Comment 20 Egor Ushakov 2013-08-02 17:50:36 UTC
thanks for the info, please attach gdb console content right before you press stop, that should be enough
Comment 21 jsprenkle 2013-08-02 19:04:40 UTC
Created attachment 138210 [details]
gdb log

gdb does not exit when debugger is stopped
Comment 22 Egor Ushakov 2013-08-26 12:23:13 UTC
(In reply to jsprenkle from comment #21)
Last described situation seems to be the same as in the bug 186336, to confirm that please verify that pause does not work. We use the same technique for pause and kill. If pause does not work, then add comments to the bug 186336, otherwise reopen this bug. Thanks.