From: <db...@CT...> - 2003-08-04 14:15:39
|
Did you try sending Control-C with \r ? might be a buffering thing .. "Andrew & Laurie White" <and...@ve...> To: <exp...@li...> Sent by: cc: exp...@li...urc Subject: [Expectperl-discuss] expect issues with eforge.net gdb 08/04/2003 03:47 AM Hello I am trying to use expect perl to control a gdb session running an application. I can easily communicate with gdb when attaching to the pid of the application initially. However, when I do a continue and the application is now running again, I can't seem to get it to respond when I send the gdb expect object a control-c. In "real-life" that's how one can get control back to the keyboard of the debugger. My kludge which still doesn't work, is to send a SIGINT signal to the process directly. Problem is that when gdb responds, the gdb->expect("SIGINT") never sees the response because it's after the kill 2, $targetpid command. Something of a race.... My theory why this doesn't work is that gdb is doing things with the terminal that the gdb object is referring to. Has anyone worked with gdb before using expect? my code is summarized below $gdb = new Expect; .... $gdb->spawn("gdb", ($target)); $gdb->expect (10, "\(gdb\)", etc....); $gdb->send("attach $targetpid\r"); $gdb->expect (10, "\(gdb\)", etc....); $gdb->send("continue\r"); $gdb->expect(10, "Continue", etc....); taget app is now in control. in this case it's a network server. ... $gdb->send("\cC"); #seems to hang here and never gets to the expect. i confirmed with gdb->debug(2) #my sneaking suspicion is i am sending controlc to gdb but it's not the correct place to send it # really i need to send to the target (which isn't an object) $gdb->expect (10, "\(gdb\)", etc....); kludge (that doesn't work either but does get a response equivalent to sending controlC) $gdb = new Expect; .... $gdb->spawn("gdb", ($target)); $gdb->expect (10, "\(gdb\)", etc....); $gdb->send("attach $targetpid\r"); $gdb->expect (10, "\(gdb\)", etc....); $gdb->send("continue\r"); $gdb->expect(10, "Continue", etc....); taget app is now in control. in this case it's a network server. ... kill 2, $targetgdb->expect (10, "\(gdb\)", etc....); $gdb->expect (10, "\(gdb\)", etc....); #never sees the gdb process output even though it scrolls across the screen. thanks. aw ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ Expectperl-discuss mailing list Exp...@li... https://lists.sourceforge.net/lists/listinfo/expectperl-discuss |