Skip to main content

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

It looks like your're using CDI. One thing that can make it hang is if
GDB itself is blocked trying to write to one of its output streams
(stdout and stderr).  Before CDT 7 we never read from stderr, so if
there's periodic output here, GDB eventually locks up.

It's worth finding out what the other end is doing -- attach another
to the gdb eclipse is talking to to find out...

Cheers,
James

On 20 April 2010 17:45, Steve Goodrich <steve.goodrich@xxxxxxxxxx> wrote:
> 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.
>
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>


Back to the top