Bug 3412

Summary: Frysk throws a lot of StringIndexOutOfBoundsException and gives no response in GUI.
Product: frysk Reporter: Yong Zheng <zhengyzy>
Component: generalAssignee: Andrew Cagney <cagney>
Status: RESOLVED FIXED    
Severity: normal CC: mcvet, pmuldoon, qiyaoltc, woodzltc
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: X86_64 Target:
Build: Last reconfirmed:
Project(s) to access: ssh public key:
Bug Depends on:    
Bug Blocks: 1633, 2127    
Attachments: the test case for this bug.

Description Yong Zheng 2006-10-23 08:00:47 UTC
On X86_64, take the followings to reproduce the bug:
1) compile the attached .c file into executable program
2) run the above executable progam
3) start up FryskGui and choose the "Debug an Existing Process" in "Frysk
Startup Manager"
4) Click the "Click Here to Select a Process" and choose the program started at
the step 2)

then, you will get a lot of exception like the following and GUI will give no
response.

java.lang.StringIndexOutOfBoundsException
   at java.lang.String.substring(libgcj.so.7)
   at frysk.dom.cparser.CDTParser$ParserCallBack.enterInclusion(FryskGui)
   at
org.eclipse.cdt.internal.core.parser.scanner2.ScannerCallbackManager.popCallbacks(FryskGui)
   at
org.eclipse.cdt.internal.core.parser.scanner2.Scanner2.beforeSecondFetchToken(FryskGui)
   at org.eclipse.cdt.internal.core.parser.scanner2.BaseScanner.nextToken(FryskGui)
   at org.eclipse.cdt.internal.core.parser.Parser.fetchToken(FryskGui)
   at org.eclipse.cdt.internal.core.parser.Parser.LA(FryskGui)
   at org.eclipse.cdt.internal.core.parser.Parser.LT(FryskGui)
   at org.eclipse.cdt.internal.core.parser.Parser.errorHandling(FryskGui)
   at
org.eclipse.cdt.internal.core.parser.Parser.failParseWithErrorHandling(FryskGui)
   at org.eclipse.cdt.internal.core.parser.Parser.translationUnit(FryskGui)
   at org.eclipse.cdt.internal.core.parser.Parser.parse(FryskGui)
   at frysk.dom.cparser.CDTParser.parse(FryskGui)
   at frysk.dom.DOMFactory.createDOM(FryskGui)
   at frysk.gui.srcwin.SourceWindowFactory.finishSourceWin(FryskGui)
   at frysk.gui.srcwin.SourceWindowFactory$2.run(FryskGui)
   at org.gnu.glib.CustomEvents.runEvents(libgtkjava-2.8.so)
   at org.gnu.gtk.Gtk.gtk_main(libgtkjava-2.8.so)
   at frysk.gui.Gui.gui(FryskGui)
   at frysk.gui.FryskGui.main(FryskGui)
Comment 1 Yong Zheng 2006-10-23 08:02:22 UTC
Created attachment 1385 [details]
the test case for this bug.

Compile the program through:
gcc -g -o daemon daemon.c
Comment 2 Rick Moseley 2006-11-22 23:09:37 UTC
This has been fixed in the current CVS head.  It turns out there are multiple
versions of unistd.h and it was trying to get added to the DOM multiple times. 
A check added in enterInclusion in CDTParser.java has fixed this.