Re: ddd 3.3.11 hangs when attached to a program with unbound output
Peter Wainwright <[email protected]> Fri, 29 Aug 2008 16:29:21 +0100
| Newsgroups | gmane.comp.debugging.ddd.bugs |
|---|---|
| Message-ID | <[email protected]> |
I can't replicate exactly the same behaviour on my DDD 3.3.11 or 3.3.12-test3 (x86_64-unknown-linux-gnu). Instead, ddd crashes with an X error: ! X error X Error of failed request: BadLength (poly request too large or internal Xlib length error) Major opcode of failed request: 74 (X_PolyText8) Serial number of failed request: 21264 Current serial number in output stream: 21265 ! X error ! Aborted At a guess, this happens because there are no newlines in the output. DDD is trying to write a single line of constantly increasing length. This is one of the reasons I almost always use a separate execution window. As it stands, DDD receives program output mixed with that of gdb, and often gets confused between the two. Peter On Thu, 2008-08-28 at 20:57 -0700, Eric Hattemer wrote: > Both: > GNU DDD 3.3.11 (sparc-sun-solaris2.8) > Copyright (C) 1995-1999 Technische Universität Braunschweig, Germany. > Copyright (C) 1999-2001 Universität Passau, Germany. > Copyright (C) 2001 Universität des Saarlandes, Germany. > Copyright (C) 2001-2004 Free Software Foundation, Inc. > > Compiled with GCC 3.3.2 > Requires X11R6, Xt11R6, Motif 2.1 (Motif Version 2.1.0) > Includes XPM 3.4.7, Athena Panner, DDD core, Readline 5.0 > Built 2007-11-21 by ehatteme <[email protected]>. > > and > > GNU DDD 3.3.11 (sparc-sun-solaris2.10) > Copyright (C) 1995-1999 Technische Universität Braunschweig, Germany. > Copyright (C) 1999-2001 Universität Passau, Germany. > Copyright (C) 2001 Universität des Saarlandes, Germany. > Copyright (C) 2001-2004 Free Software Foundation, Inc. > > Compiled with GCC 4.2.1 > Requires X11R6, Xt11R6, Motif 2.1 (Motif Version 2.1.0) > Includes XPM 3.4.7, Athena Panner, DDD core, Readline 5.0 > Built 2008-08-28 by ehatteme <[email protected]>. > > hang if they run a program that prints to stdout in an infinite loop. > This only occurs if the stdout is going to the gdb pane at the bottom of > ddd. If the program is run in a execution window, it prints fine, and > can be interrupted. The program can be interrupted in straight gdb. It > seems that the bug is related to the handling/buffering of the gdb pane > at the bottom of ddd. > > Here is the c++ code that causes the hang after entering an input >2: > > #include <iostream> > > using namespace std; > > // finds all of n's factors > // not including 1 and itself > void factors (int n) > { > int k = 2; > while (k < n) { > if (n % k == 0) { > cout << k << " "; > } > } > } > > int main() > { > int n; > cout << "Find factors of what number? "; > cin >> n; > cout << "Factors of n are: " << endl; > factors (n); > cout << endl; > } > > Attached is .ddd/log with most of the 2's cut out of it. > > -Eric Hattemer > > > > plain text document attachment (log) > GNU DDD 3.3.11 (sparc-sun-solaris2.8) > Copyright (C) 1995-1999 Technische Universitt Braunschweig, Germany. > Copyright (C) 1999-2001 Universitt Passau, Germany. > Copyright (C) 2001 Universitt des Saarlandes, Germany. > Copyright (C) 2001-2004 Free Software Foundation, Inc. > > Compiled with GCC 3.3.2 > Requires X11R6, Xt11R6, Motif 2.1 (Motif Version 2.1.0) > Includes XPM 3.4.7, Athena Panner, DDD core, Readline 5.0 > Built 2007-11-21 by ehatteme <[email protected]>. > $ ddd ./factors > + /bin/sh -c 'exec gdb -q -fullname '\''./factors'\''' > # Hello, world! > # Starting GDB... > # Running GDB (pid 27377, tty /dev/pts/1)... > # Current language: C/C++ > # Searching "vsllib/ddd.vsl"... > # Trying "/home/sol-00/ehatteme/.ddd/vsllib/ddd.vsl" > # Trying "/usr/usc/ddd/3.3.11/share/ddd-3.3.11/vsllib/ddd.vsl" > # Searching "vsllib/ddd.vsl"..."/usr/usc/ddd/3.3.11/share/ddd-3.3.11/vsllib/ddd.vsl". > # Another DDD is running (pid 28218, host bb-dev1.usc.edu, display localhost:10.0) > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "set prompt (gdb) \n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "set height 0\n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "set width 0\n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "set annotate 1\n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> " set verbose off\n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "info line\n" > 2008.08.28 20:51:12 > <- "No line number information available.\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "list\n" > 2008.08.28 20:51:12 > <- "16\t \n" > "17\t }\n" > "18\t\n" > "19\t}\n" > "20\t\n" > "21\tint main()\n" > "22\t{\n" > "23\t int n;\n" > "24\t\n" > "25\t cout << \"Find factors of what number? \";\n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "info line\n" > 2008.08.28 20:51:12 > <- "Line 25 of \"factors.cpp\" starts at address 0x10cb0 <main+4> and ends at 0x10cc8 <main+28>.\n" > "\032\032/home/sol-00/ehatteme/factors.cpp:25:257:beg:0x10cb0\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "output 4711\n" > 2008.08.28 20:51:12 > <- "4711" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "show language\n" > 2008.08.28 20:51:12 > <- "The current source language is \"auto; currently c++\".\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "show version\n" > 2008.08.28 20:51:12 > <- "GNU gdb 6.8\n" > "Copyright (C) 2008 Free Software Foundation, Inc.\n" > "License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n" > "This is free software: you are free to change and redistribute it.\n" > "There is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\n" > "and \"show warranty\" for details.\n" > "This GDB was configured as \"sparc-sun-solaris2.10\".\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "pwd\n" > 2008.08.28 20:51:12 > <- "Working directory /home/sol-00/ehatteme.\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "info breakpoints\n" > 2008.08.28 20:51:12 > <- "No breakpoints or watchpoints.\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "show history filename\n" > 2008.08.28 20:51:12 > <- "The filename in which to record the command history is \"/home/sol-00/ehatteme/.gdb_history\".\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "show history size\n" > 2008.08.28 20:51:12 > <- "The size of the command history is 256.\n" > "(gdb) " > # Reading file "/home/sol-00/ehatteme/factors.cpp"... > # Reading file "/home/sol-00/ehatteme/factors.cpp"...done. > # File "/home/sol-00/ehatteme/factors.cpp" 30 lines, 409 characters > # Setting buttons... > # Setting buttons...done. > 2008.08.28 20:51:12 > -> "info source\n" > 2008.08.28 20:51:12 > <- "Current source file is factors.cpp\n" > "Compilation directory is /home/sol-00/ehatteme\n" > "Located in /home/sol-00/ehatteme/factors.cpp\n" > "Contains 30 lines.\n" > "Source language is c++.\n" > "Compiled with DWARF 2 debugging format.\n" > "Does not include preprocessor macro info.\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "info files\n" > 2008.08.28 20:51:12 > <- "Symbols from \"/home/sol-00/ehatteme/factors\".\n" > "Local exec file:\n" > 2008.08.28 20:51:12 > <- "\t`/home/sol-00/ehatteme/factors\', file type elf32-sparc.\n" > "\tEntry point: 0x10998\t0x000100d4 - 0x000100e5 is .interp\n" > "\t0x000100e8 - 0x0001024c is .hash\n" > "\t0x0001024c - 0x0001050c is .dynsym\n" > "\t0x0001050c - 0x0001085a is .dynstr\n" > "\t0x0001085c - 0x0001089c is .SUNW_version\n" > "\t0x0001089c - 0x000108c0 is .rela.got\n" > "\t0x000108c0 - 0x000108e4 is .rela.bss\n" > "\t0x000108e4 - 0x00010998 is .rela.plt\n" > "\t0x00010998 - 0x00010e74 is .text\n" > "\t0x00010e74 - 0x00010e90 is .init\n" > "\t0x00010e90 - 0x00010ea4 is .fini\n" > "\t0x00010ea8 - 0x00010eeb is .rodata\n" > "\t0x00010eec - 0x00010ef0 is .gnu.linkonce.r._ZNSt15basic_streambufIcSt11char_traitsIcEE13_S_pback_sizeE\n" > "\t0x00020ef0 - 0x00020f18 is .got\n" > "\t0x00020f18 - 0x00021000 is .plt\n" > "\t0x00021000 - 0x000210e0 is .dynamic\n" > "\t0x000210e0 - 0x000210ec is .data\n" > "\t0x000210ec - 0x000210f8 is .ctors\n" > "\t0x000210f8 - 0x00021104 is .dtors\n" > "\t0x00021104 - 0x000211b0 is .eh_frame\n" > "\t0x000211b0 - 0x000211b4 is .jcr\n" > "\t0x000211b4 - 0x000211b8 is .data.rel.local\n" > "\t0x000211b8 - 0x000211b9 is .gnu.linkonce.d._ZN16__Atomicity_lockILi0EE17_S_atomicity_lockE\n" > "\t0x000211c0 - 0x00021300 is .bss\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "info program\n" > 2008.08.28 20:51:12 > <- "The program being debugged is not being run.\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "set confirm off\n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "source /var/tmp//dddZJa4D1\n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "info breakpoints\n" > 2008.08.28 20:51:12 > <- "No breakpoints or watchpoints.\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "# reset\n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "info breakpoints\n" > 2008.08.28 20:51:12 > <- "No breakpoints or watchpoints.\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "display\n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "info display\n" > 2008.08.28 20:51:12 > <- "There are no auto-display expressions now.\n" > "(gdb) " > 2008.08.28 20:51:12 > -> "set environment TERM dumb\n" > 2008.08.28 20:51:12 > <- "(gdb) " > 2008.08.28 20:51:12 > -> "info files\n" > 2008.08.28 20:51:13 > <- "Symbols from \"/home/sol-00/ehatteme/factors\".\n" > "Local exec file:\n" > "\t`/home/sol-00/ehatteme/factors\', file type elf32-sparc.\n" > "\tEntry point: 0x10998\t0x000100d4 - 0x000100e5 is .interp\n" > "\t0x000100e8 - 0x0001024c is .hash\n" > "\t0x0001024c - 0x0001050c is .dynsym\n" > "\t0x0001050c - 0x0001085a is .dynstr\n" > "\t0x0001085c - 0x0001089c is .SUNW_version\n" > "\t0x0001089c - 0x000108c0 is .rela.got\n" > "\t0x000108c0 - 0x000108e4 is .rela.bss\n" > "\t0x000108e4 - 0x00010998 is .rela.plt\n" > "\t0x00010998 - 0x00010e74 is .text\n" > "\t0x00010e74 - 0x00010e90 is .init\n" > "\t0x00010e90 - 0x00010ea4 is .fini\n" > "\t0x00010ea8 - 0x00010eeb is .rodata\n" > "\t0x00010eec - 0x00010ef0 is .gnu.linkonce.r._ZNSt15basic_streambufIcSt11char_traitsIcEE13_S_pback_sizeE\n" > "\t0x00020ef0 - 0x00020f18 is .got\n" > "\t0x00020f18 - 0x00021000 is .plt\n" > "\t0x00021000 - 0x000210e0 is .dynamic\n" > "\t0x000210e0 - 0x000210ec" > 2008.08.28 20:51:13 > <- " is .data\n" > "\t0x000210ec - 0x000210f8 is .ctors\n" > "\t0x000210f8 - 0x00021104 is .dtors\n" > "\t0x00021104 - 0x000211b0 is .eh_frame\n" > "\t0x000211b0 - 0x000211b4 is .jcr\n" > "\t0x000211b4 - 0x000211b8 is .data.rel.local\n" > "\t0x000211b8 - 0x000211b9 is .gnu.linkonce.d._ZN16__Atomicity_lockILi0EE17_S_atomicity_lockE\n" > "\t0x000211c0 - 0x00021300 is .bss\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "info program\n" > 2008.08.28 20:51:13 > <- "The program being debugged is not being run.\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help detach\n" > 2008.08.28 20:51:13 > <- "Detach a process or file previously attached.\n" > "If a process, it is no longer traced, and it continues its execution. If\n" > "you were debugging a file, the file is closed and gdb no longer accesses it.\n" > "\n" > "List of detach subcommands:\n" > "\n" > "\n" > "Type \"help detach\" followed by detach subcommand name for full documentation.\n" > "Type \"apropos word\" to search for commands related to \"word\".\n" > "Command name abbreviations are allowed if unambiguous.\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help run\n" > 2008.08.28 20:51:13 > <- "Start debugged program. You may specify arguments to give it.\n" > "Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n" > "Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n" > "\n" > "With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n" > "To cancel previous arguments and run with no arguments,\n" > "use \"set args\" without arguments.\n" > "(gdb) " > # Starting GDB...done. > # Welcome to DDD 3.3.11 "Rhubarb" (sparc-sun-solaris2.8) > 2008.08.28 20:51:13 > -> "help step\n" > 2008.08.28 20:51:13 > <- "Step program until it reaches a different source line.\n" > "Argument N means do this N times (or till program stops for another reason).\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help stepi\n" > 2008.08.28 20:51:13 > <- "Step one instruction exactly.\n" > "Argument N means do this N times (or till program stops for another reason).\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help next\n" > 2008.08.28 20:51:13 > <- "Step program, proceeding through subroutine calls.\n" > "Like the \"step\" command as long as subroutine calls do not happen;\n" > "when they do, the call is treated as one instruction.\n" > "Argument N means do this N times (or till program stops for another reason).\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help nexti\n" > 2008.08.28 20:51:13 > <- "Step one instruction, but proceed through subroutine calls.\n" > "Argument N means do this N times (or till program stops for another reason).\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help until\n" > 2008.08.28 20:51:13 > <- "Execute until the program reaches a source line greater than the current\n" > "or a specified location (same args as break command) within the current frame.\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help finish\n" > 2008.08.28 20:51:13 > <- "Execute until selected stack frame returns.\n" > "Upon return, the value returned is printed and put in the value history.\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help cont\n" > 2008.08.28 20:51:13 > <- "Continue program being debugged, after signal or breakpoint.\n" > "If proceeding from breakpoint, a number N may be used as an argument,\n" > "which means to set the ignore count of that breakpoint to N - 1 (so that\n" > "the breakpoint won\'t break until the Nth time it is reached).\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help signal\n" > 2008.08.28 20:51:13 > <- "Continue program giving it signal specified by the argument.\n" > "An argument of \"0\" means continue program without giving it a signal.\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help kill\n" > 2008.08.28 20:51:13 > <- "Kill execution of program being debugged.\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help up\n" > 2008.08.28 20:51:13 > <- "Select and print stack frame that called this one.\n" > "An argument says how many frames up to go.\n" > "(gdb) " > 2008.08.28 20:51:13 > -> "help down\n" > 2008.08.28 20:51:13 > <- "Select and print stack frame called by this one.\n" > "An argument says how many frames down to go.\n" > "(gdb) " > 2008.08.28 20:51:16 > -> "set environment TERM dumb\n" > 2008.08.28 20:51:16 > <- "(gdb) " > 2008.08.28 20:51:16 > -> "run\n" > 2008.08.28 20:51:16 > <- "Find factors of what number? " > 2008.08.28 20:51:18 > -> "12\n" > 2008.08.28 20:51:18 > <- "Factors of n are: \n" > 2008.08.28 20:51:22 > <- "2 2 2 2 2 " > # Saving options in "/home/sol-00/ehatteme/.ddd/init"... > # Saving options in "/home/sol-00/ehatteme/.ddd/init"...done. > # Saving history in "/home/sol-00/ehatteme/.ddd/history"... > # Saving history in "/home/sol-00/ehatteme/.ddd/history"...done. > # Thanks for using DDD 3.3.11! > > _______________________________________________ > bug-ddd mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/bug-ddd