From: Manu <ma...@wa...> - 2003-12-25 08:11:42
|
I wrote: > I've noticed a different behavior between MinGW's GDB 5.2.1 > and GDB 6.0 when running a console program. Yes indeed: Manu@TBIRD1000 /c/Dev/Visual-MinGW/Projects/Samples/Console/Hello $ gdb50201 -q hello (gdb) show new-console Creation of new console when creating child process is on. ^^^^^^ GDB5.2.1 (gdb) q Manu@TBIRD1000 /c/Dev/Visual-MinGW/Projects/Samples/Console/Hello $ gdb -q hello (gdb) show new-console Creation of new console when creating child process is off. ^^^^^^ GDB 6.0 (gdb) q Thanks to Al Stevens: http://sources.redhat.com/ml/gdb-patches/2002-09/msg00445.html Manu. > The 5.2.1 creates a console window, the program's output goes to > that console, which seems correct. > The 6.0 doesn't show a console, worse, the program's output doesn't > show up at the right time, but just before the program exits. > > 0/ Sample program: > -------------------- > /******************************************************** > * A simple Hello World. > * > * The stdio header declares standard input/output routines like printf. > * The main() procedure is the program entry point. > * > ********************************************************/ > #include <stdio.h> > > int main(){ > /* Writes a string in the DOS box. */ > printf("Hello world !"); > return 0; /* Program termination. */ > } > > > 1/ Sample session with gdb 5.2.1: > ---------------------------------- > Manu@TBIRD1000 /c/Dev/Visual-MinGW/Projects/Samples/Console/Hello > $ gdb50201 -nw -q -f "C:\Dev\Visual-MinGW\Projects\Samples\Console\Hello\hello. > exe" > (gdb) b main.c:11 > Breakpoint 1 at 0x4012fc: file main.c, line 11. > (gdb) run > Starting program: C:\Dev\Visual-MinGW\Projects\Samples\Console\Hello\hello.exe > > Breakpoint 1, main () at main.c:12 > C:/Dev/Visual-MinGW/Projects/Samples/Console/Hello/main.c:12:349:beg:0x4012fc > > (gdb) info terminal > Inferior's terminal status (currently saved by GDB): > File descriptor flags = O_RDONLY > ^^^^^^ GDB has saved a terminal info. > > (gdb) s > ^^^^^^ The "Hello world!" outputs in the console window, which is correct. > > C:/Dev/Visual-MinGW/Projects/Samples/Console/Hello/main.c:13:376:beg:0x40130c > (gdb) s > C:/Dev/Visual-MinGW/Projects/Samples/Console/Hello/main.c:14:415:beg:0x401311 > (gdb) s > 0x0040122d in __mingw_CRTStartup () > (gdb) s > Single stepping until exit from function __mingw_CRTStartup, > which has no line number information. > > Program exited normally. > (gdb) q > > > 2/ Sample session with gdb 6.0: > ---------------------------------- > Manu@TBIRD1000 /c/Dev/Visual-MinGW/Projects/Samples/Console/Hello > $ gdb -nw -q -f "C:\Dev\Visual-MinGW\Projects\Samples\Console\Hello\hello.exe" > (gdb) b main.c:11 > Breakpoint 1 at 0x4012fc: file main.c, line 11. > (gdb) run > Starting program: C:\Dev\Visual-MinGW\Projects\Samples\Console\Hello\hello.exe > > Breakpoint 1, main () at main.c:12 > C:/Dev/Visual-MinGW/Projects/Samples/Console/Hello/main.c:12:349:beg:0x4012fc > > (gdb) info terminal > This GDB does not control a terminal. > ^^^^^^ well, well well. > > (gdb) s > ^^^^^^ nothing outputs after the printf() at line 12. > > C:/Dev/Visual-MinGW/Projects/Samples/Console/Hello/main.c:13:376:beg:0x40130c > (gdb) s > C:/Dev/Visual-MinGW/Projects/Samples/Console/Hello/main.c:14:415:beg:0x401311 > (gdb) s > 0x0040122d in __mingw_CRTStartup () > (gdb) s > Single stepping until exit from function __mingw_CRTStartup, > which has no line number information. > > Hello world ! > ^^^^^^ Thanks, but a bit too late!!! > > Program exited normally. > (gdb) q > > > The same behavior is observed within MSYS and Visual-MinGW. > (redirected GDB I/O) > > Any information about the way GDB is supposed to process > programs' I/O is greatly welcome. > Thanks. > > Manu. > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users |