Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-debug-dev] Console skip output lines when using gdb on windows/MinGW


> On Linux, CDT redirects your application's output to a different
> pseudo-terminal (TTY).  That lets it unambiguously differentiate
> between GDB output and program output.  Windows doesn't have TTYs.
>
> On Windows you could probably arrange to do this just with pipes... or
> by using set new-console, but that pops up a window.
>
> -- 
> Daniel Jacobowitz
> CodeSourcery

Thanks,

Could you be more precise about your advices...

I have done some tests:

Solution 1 : "set new-console"
---------------------------
I suppose it is the "set new-console on" of gdb ("on" is the default mode in
mingw/gdb). I have tried to insert this line into a file "c:/gdbinit.txt"
and I set "c:/gdbinit.txt" in "gdb command set" in "launch
configuration>debugger". But "c:/gdbinit.txt" is not loaded by gdb under
eclipse (bug ?) (see traces #1)

Note : when I set "new-console" manually (outside eclipse), I have perfect
output (see trace #2)

Note : this solution is not as much pleasant than output in eclipse console
for simple test programs (especially, it requires "getchar()" function to
prevent automatic closing of the console window, ...) 

Is there a methode to set "new-console to on" by an another way ?

Solution 2 : new console with an other method
---------------------------------------------
http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg14587.html

In previous link, it is recommended to use "-Wl,-subsystem,console" option
in gcc.

It doesn't work in my environment... (it still use eclipse console)

My eclipse "build" console:

      **** Rebuild of configuration Debug for project test ****
      **** Internal Builder is used for build               ****
      g++ -O0 -g -c -osrc\test.o ..\src\test.cpp
      g++ -Wl,-subsystem,console -otest.exe src\test.o
      Build complete for project test
      Time consumed: 422  ms.  
 


Solution 3 : pipes
------------------

Do you mean to redirect output to a file and to watch file after execution ?

Do you mean to do something inside eclipse gui or outside eclipse ?


TRACES
======


trace #1 : gdb console, no call to c:/gdbinit.txt

        327-gdb-set confirm off
        327^done
        (gdb) 
        328-gdb-set width 0
        328^done
        (gdb) 
        329-gdb-set height 0
        329^done
        (gdb) 
        330-interpreter-exec console echo
        330^error,msg="Undefined MI command: interpreter-exec"
        (gdb) 
        331-gdb-show prompt
        331^done,value="(gdb) "
        (gdb) 
        332
        &"\n"
        332^done
        (gdb) 
        
        333-gdb-set stop-on-solib-events 0
        333^done
        334-gdb-set stop-on-solib-events 1
        (gdb) 
        334^done
        335-gdb-set new-console off
        (gdb) 
        335^done
        336-environment-cd C:\\Dev\\test
        (gdb) 
        336^done
        (gdb) 
        337-environment-directory C:/Dev/test C:/Dev/test/Debug
C:/Dev/test/Debug/src C:/Dev/test/src
        337^done
        (gdb) 
        338 info threads
        &"info threads\n"
        &"No stack.\n"
        338^error,msg="No stack."
        (gdb) 
        339-data-list-register-names
       
339^done,register-names=["eax","ecx","edx","ebx","esp","ebp","esi","edi","eip","eflags","cs","ss","ds","es","fs","gs","st0","st1","st2","st3","st4","st5","st6","st7","fctrl","fstat","ftag","fiseg","fioff","foseg","fooff","fop"]
        (gdb) 
        340-exec-run
        340^running
        (gdb) 
        one
        
        *two
        ==>tree
        -->four
        #five
        done
        340*stopped,reason="exited-normally"
        (gdb) 
        341-data-evaluate-expression $_exitcode
        341^done,value="0"
        (gdb) 
        342-gdb-exit
        342^exit


trace #2 : gdb console outside eclipse, test with "set-new-console"

        C:\Dev\test\Debug>gdb test.exe
        GNU gdb 5.2.1
        Copyright 2002 Free Software Foundation, Inc.
        GDB is free software, covered by the GNU General Public License, and
you are
        welcome to change it and/or distribute copies of it under certain
conditions.
        Type "show copying" to see the conditions.
        There is absolutely no warranty for GDB.  Type "show warranty" for
details.
        This GDB was configured as "i686-pc-mingw32"...
        (gdb) set new-console on
        (gdb) r
        Starting program: C:\Dev\test\Debug/test.exe
        
        Program exited normally.
        (gdb) set new-console off
        (gdb) r
        Starting program: C:\Dev\test\Debug/test.exe
        one
        
        *two
        ==>tree
        -->four
        #five
        done
        
        Program exited normally.
        (gdb) quit



-- 
View this message in context: http://www.nabble.com/Console-skip-output-lines-when-using-gdb-on-windows-MinGW-tp18342983p18382939.html
Sent from the Eclipse CDT - debug mailing list archive at Nabble.com.



Back to the top