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 270948 - Netbeans crash while debugging with gdb C++ code with templates
Summary: Netbeans crash while debugging with gdb C++ code with templates
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Maria Tishkova
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-23 14:43 UTC by mne
Modified: 2017-11-26 16:11 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
A gdb debug session which triggers the behavior (123.88 KB, application/octet-stream)
2017-06-23 14:43 UTC, mne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mne 2017-06-23 14:43:08 UTC
Created attachment 164613 [details]
A gdb debug session which triggers the behavior

Product Version: NetBeans IDE 8.2 (Build 201705191307)
Updates: NetBeans IDE is updated to version NetBeans 8.2 Patch 2
Java: 1.8.0_131; Java HotSpot(TM) 64-Bit Server VM 25.131-b11
Runtime: Java(TM) SE Runtime Environment 1.8.0_131-b11
System: Linux version 4.4.0-81-generic running on amd64; UTF-8; en_US (nb)

In some scenarios, complex C++ with templates render gdb to issue a SIGINT to the debugged process, hanging the gui and display repeating various error messages when hitting "Terminate" icon. 

Two messages examples:
--8<
The program is not being run.
The program is not being run.
The program is not being run.
The program is not being run.
>8--

and

--8<
The program is not being run.
No registers.
No registers.
No registers.
>8--

I addition there seem to be a Java exception in:
--8<
java.lang.ArrayIndexOutOfBoundsException: -1
	at java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:387)
	at java.util.concurrent.CopyOnWriteArrayList.remove(CopyOnWriteArrayList.java:494)
	at org.netbeans.modules.cnd.debugger.common2.debugger.breakpoints.NativeBreakpoint.removeChild(NativeBreakpoint.java:530)
	at org.netbeans.modules.cnd.debugger.common2.debugger.breakpoints.NativeBreakpoint.primDelete(NativeBreakpoint.java:1751)
	at org.netbeans.modules.cnd.debugger.common2.debugger.breakpoints.BreakpointManager.deleteHandler(BreakpointManager.java:1487)
	at org.netbeans.modules.cnd.debugger.common2.debugger.NativeDebuggerImpl.preKill(NativeDebuggerImpl.java:1280)
	at org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl.kill(GdbDebuggerImpl.java:708)
	at org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl$6$1.onExit(GdbDebuggerImpl.java:803)
	at org.netbeans.modules.cnd.debugger.gdb2.mi.MICommandManager.dispatch(MICommandManager.java:200)
	at org.netbeans.modules.cnd.debugger.gdb2.mi.MIProxy.dispatch(MIProxy.java:188)
	at org.netbeans.modules.cnd.debugger.gdb2.Gdb$MyMIProxy.dispatch(Gdb.java:697)
	at org.netbeans.modules.cnd.debugger.gdb2.mi.MIProxy.result(MIProxy.java:193)
	at org.netbeans.modules.cnd.debugger.gdb2.mi.MIProxy.processLine(MIProxy.java:157)
	at org.netbeans.modules.cnd.debugger.gdb2.Tap$4.run(Tap.java:369)
Caused: java.lang.Exception: when processing line: 468^exit

	at org.netbeans.modules.cnd.debugger.gdb2.Tap$4.run(Tap.java:371)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
>8--

The reproducing steps are:
- insert one breakpoint so that the all bt frames has debugging symbols up to it
- insert another breakpoint so that when is hit it falls behind the first one but there are some intermediary frames which don't have debugging symbols
- start a debugging session; It should stop at the first breakpoint
- hit "Continue"; Now it should reach the second breakpoint
- now hit a series of "Step over" so that the debugger would reach one of the intermediary frames which don't debugging symbols. I would expect to be informed that the frame is without debugging symbols and possibly draw a button to show dissassembly
- from here the things get wired. Most of the time "Step over" start to behave like "Continue" and runs until the first breakpoint is reached
- finally, after a "Step over" or "Continue" nothing happen (the gui hangs), the variable view is empty and the only option is to hit the "Terminate" button.
- the error window with repeating debugger errors are being displayed.

Looking in the debug session files, towards the end, there can be seen the message:
--8<
~"\nProgram"                                                                                                                                                                            
~" received signal SIGINT, Interrupt.\n"                                                                                                                                                
>8--.

With Eclipse or plain gdb, the same binaries and breakpoints the debugging session behaves correctly.

The crash was also reported directly from the product here http://statistics.netbeans.org/analytics/exception.do?id=854271 .
Comment 1 mne 2017-10-12 17:09:31 UTC
Hello aganin,

I'm trying to investigate the issue by myself. For this I've cloned the http://hg.netbeans.org/main-silver/ branch (btw, is this the proper branch?!), tried to build the platform from from there I'm stuck. I was looking for documentation or some tutorial but I didn't manage to find something suitable.

Can someone, please, pinpoint some documentation about how to debug a Netbeans module or at least some hints about what shall I try next?

Thanks!
Comment 2 Alexander Simon 2017-10-12 21:33:19 UTC
(In reply to mne from comment #1)
> Hello aganin,
> 
> I'm trying to investigate the issue by myself. For this I've cloned the
> http://hg.netbeans.org/main-silver/ branch (btw, is this the proper
> branch?!), tried to build the platform from from there I'm stuck. I was
> looking for documentation or some tutorial but I didn't manage to find
> something suitable.
> 
> Can someone, please, pinpoint some documentation about how to debug a
> Netbeans module or at least some hints about what shall I try next?
> 
> Thanks!

Hi,
You can try following steps.

Make sure that you have
- JDK 8
- ANT 1.9.6

Build NetBeans by command:

cd main-silver
ant build-nozip

Netbeans will be in folder:
nbbuild/netbeans

Copy nbbuild/netbeans to some folder (for example netbeans-trunk).
Run netbeans-trunk/bin/netbeans
Open 2 projects:
- main-silver/cnd.kit
- main-silver/nbbuild
Open needed C/C++ modules by clicking in C/C++/Libraries (for example C/C++ Debugger Common).
Set needed breakpoints.
Run nbbuild project.

Edit some sources in C/C++ Debugger Common.
Build C/C++ Debugger Common.
Run nbbuild project to check your changes.

Tip. To open sources by stack:
- open window/debugging/analyze stack
- copy stack and paste in analyze stack window
- all lines in the window will be clickable

Alexander
Comment 3 Alexander Simon 2017-10-12 21:48:32 UTC
I forgot one step:
- add Tools/NetBeans Platform in folder main-silver/nbbuild/netbeans with name NetBeans_IDE_CND_Dev
Comment 4 Maria Tishkova 2017-10-25 19:18:29 UTC
Can you try to use latest dev version first& It can be downloaded at http://bits.netbeans.org/dev/nightly/latest/
Comment 5 mne 2017-11-26 14:50:57 UTC
With the latest build (NetBeans IDE Dev (Build 201711260002)) the issue seems fixed. Only the notification about the no-symbols frame debug attempt remained, but this is another issue. There is any Netbeans official release planned?

I've also manage to build Netbeans from main-silver (thanks Alexander Simon) but I'm stuck at "- add Tools/NetBeans Platform in folder main-silver/nbbuild/netbeans with name NetBeans_IDE_CND_Dev" step. Where must I add the "Tools/NetBeans Platform"? If it refers to the Netbeans's menus then there is no "NetBeans Platform" entry in the "Tools" menu.
Comment 6 soldatov 2017-11-26 16:11:02 UTC
(In reply to mne from comment #5)
> With the latest build (NetBeans IDE Dev (Build 201711260002)) the issue
> seems fixed. Only the notification about the no-symbols frame debug attempt
> remained, but this is another issue. There is any Netbeans official release
> planned?
Apache NetBeans mailling list: https://lists.apache.org/list.html?dev@netbeans.apache.org
"IDE release" thread: https://lists.apache.org/thread.html/c9fa3a0e7df6595ff2cf1d87962cb51eac407d17579464208cb46043@%3Cdev.netbeans.apache.org%3E