Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] GDB hangs after a series of commands?

I'm working on a custom View in the context of CDI.  I have a valid
MISession, and I'm hammering it with commands:

	CLICommand cli = new CLICommand("test");
	MIOOBRecord oobRecord[] = null;
	for (int i = 0; i < 2000; i++) {
		System.out.println(String.format("%4d - sending", i));
		try {
			miSession.postCommand(cli, MISession.FOREVER);
			System.out.println(String.format("%4d - waiting",
i));
			oobRecord =
cli.getMIInfo().getMIOutput().getMIOOBRecords();
			System.out.println(String.format("%4d - completed",
i));
		} catch (Exception e) {
			System.out.println(String.format("%4d - exception:
", i) + e.getMessage());
		}
	}
	System.out.println("DONE!");


I'm able to go through this loop about 900 times, and then my debug session
will hang.  The last debug output I have is this (the exception is expected
since "test" is not a valid GDB command):

	 890 - sending
	 890 - waiting
	 890 - exception: Undefined command: "test".  Try "help".
	 891 - sending


And now Eclipse is hung.  The call stack looks like this:

	Thread [main] (Suspended)	
		Object.wait(long) line: not available [native method]	
		PipedInputStream.awaitSpace() line: not available	
		PipedInputStream.receive(byte[], int, int) line: not
available	
		PipedOutputStream.write(byte[], int, int) line: not
available	
		PipedOutputStream(OutputStream).write(byte[]) line: not
available	
		MISession.writeToConsole(String) line: 831	
		MISession.postCommand0(Command, long) line: 591	
		MISession.postCommand(Command, long) line: 573	
		MyView.testloop(boolean) line: 602	
		(etc.)


I don't have the PipedOutputStream or PipedInputStream sources, so the
lowest level at which I have visibility is here:

	protected void writeToConsole(String text) {
		OutputStream console = getConsolePipe();
		if (console != null) {
			try {
				console.write(text.getBytes()); // <<<<<<<<
hangs somewhere in here
				console.flush();
			}
			catch(IOException e) {
			}
		}
	}


Does this make sense to anyone?  Aside from "don't do that to GDB", is there
something obvious I'm doing wrong?  Is there some pacing I need to follow
when dealing with MISession?  Is there some way to get more information on
this so I can figure out what's happening?

Thanks!
	-- Steve G.




Back to the top