Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » cin/cout breaks eclipse controls of gdb (Win7,MinGW)
cin/cout breaks eclipse controls of gdb (Win7,MinGW) [message #932215] Wed, 03 October 2012 19:44
Hey Merlin is currently offline Hey Merlin
Messages: 1
Registered: October 2012
Junior Member
I'm posting this here before submitting it as a bug in case I'm missing something. Feedback and solutions are very much welcome.

The summary is: when debugging a C++ (likely C also) program, unflushed stdout buffers causes the eclipse debugger perspective to loose control of gdb until a gdb command is manually entered on the gdb console. This is reproducible on Windows with MinGW but is not a problem on Linux or Mac.

This seems to be somewhat related to:



However, none of the above seems to mention or deal with the disconnection between gdb and the eclipse gui.

The work around solution of using the setvbuff commands does not work by itself and using << endl after each cout, or at very least before each cin is not ideal in many cases.

Lastly this has been reproduced on several systems by myself, a couple of my faculty, and many students.

Details:
1. Environment:
eclipse.buildId=M20110909-1335 (Indigo but also reproduced on Juno with Java 6 and 7)
java.version=1.6.0_34
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

os.arch=amd64
os.name=Windows Server 2008 R2 (also reproduced on Windows 7)
os.version=6.1
osgi.arch=x86_64

org.eclipse.cdt (8.0.0.201109151620) "Eclipse C/C++ Development Tools"
org.eclipse.cdt.build.crossgcc (1.0.0.201109151620) "CDT GCC Cross Compiler Support"
org.eclipse.cdt.gdb (7.0.0.201109151620) "GDB Common"
org.eclipse.cdt.launch.remote (6.0.0.201109151620) "C/C++ Remote Debug Launcher"
org.eclipse.cdt.mylyn (5.2.304.v20111118-0100) "Mylyn"
org.eclipse.cdt.p2 (1.0.0.201109151620) "CDT P2 customizations for SDKs"

MinGW
gcc (GCC) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

GNU gdb (GDB) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:


2. Reproducing without setvbuff commands
(refer to source below)

  • Create new C++ HelloWorld project with MinGW as the toolchain
  • Modify source to prompt for name and print it out. Do not include "endl" commands.
  • Build, run to ensure error free, start debugging.
  • After halt on main, use "step over" button to step through code
  • No output is seen (as expected from FAQ and other bugs mentioned above) on console from first cout (line 20).
  • After stepping over cin (line 21) gui debugger buttons grey out as expected and program waits for input in application console.
  • Type "Smith" into application console and hit enter.


At this point stdout is flushed to the application console along with the line from gdb (it starts with "*stopped,reason="end-stepping-range"..."; see line "121,161" in gdb race below. The debugger buttons (step over, step into, continue, etc.) are still greyed out and inaccessible with the exception of the terminate button.

To resolve or the issue, switch to the gdb console and type "next". The debugger processes the next line and pauses as expected on the following line. At this point the debugger buttons (step over, step into, etc.) are usable again and may be used until the end of the program.

Here is a copy of the various consoles after the above run:
First run: Not flushing buffers (breaks eclipse-gdb interface).

//============================================================================
// Name : HelloWorld.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main() {
//setvbuf(stdout, NULL, _IONBF, 0);
//setvbuf(stderr, NULL, _IONBF, 0);

string name;

cout << "Name? ";
cin >> name;
cout << "!!!Hello " + name + "!!!";
cout << endl;
return 0;
}

Applications console
--------------------
Smith
Name? *stopped,reason="end-stepping-range",frame={addr="0x004013d5",func="_fu3___ZSt3cin",args=[],file="..\src\HelloWorld.cpp",fullname="\\skorpio\zzz140\workspace\helloworld\src\helloworld.cpp",line="22"},thread-id="1",stopped-threads="all"
!!!Hello Smith!!!

GDB console
------------
[New Thread 820.0x1498]
next
next
23 cout << endl;
Quit (expect signal SIGINT when the program is resumed)

GDB traces console
-------------------
085,825 2-environment-cd //skorpio/zzz140/workspace/HelloWorld
085,836 2^done
085,837 (gdb)
085,837 3-gdb-set breakpoint pending on
085,848 3^done
085,848 (gdb)
085,848 4-gdb-set detach-on-fork on
085,858 4^done
085,858 (gdb)
085,858 5-enable-pretty-printing
085,869 5^done
085,869 (gdb)
085,869 6maintenance set python print-stack off
085,880 &"maintenance set python print-stack off\n"
085,880 6^done
085,880 (gdb)
085,881 7source .gdbinit
085,891 &"source .gdbinit\n"
085,907 &".gdbinit: No such file or directory.\n"
085,908 7^error,msg=".gdbinit: No such file or directory."
085,908 (gdb)
085,908 8-gdb-set auto-solib-add on
085,908 8^done
085,908 (gdb)
085,911 9-file-exec-and-symbols --thread-group i1 //skorpio/zzz140/workspace/HelloWorld/Debug/HelloW\
orld.exe
085,991 10-list-thread-groups
086,028 9^done
086,028 (gdb)
086,028 10^done,groups=[{id="i1",type="process",executable="\\\\skorpio\\zzz140\\workspace\\hellowor\
ld\\debug\\HelloWorld.exe"}]
086,028 (gdb)
086,031 11-break-insert --thread-group i1 -t -f main
086,133 11^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0040139e",func="ma\
in()",file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\hell\
oworld.cpp",line="14",times="0",original-location="main"}
086,133 (gdb)
086,141 12-exec-run --thread-group i1
086,436 =thread-group-started,id="i1",pid="820"
086,436 13-list-thread-groups --available
086,436 14-list-thread-groups
086,459 =thread-created,id="1",group-id="i1"
086,459 ~"[New Thread 820.0x1498]\n"
086,460 12^running
086,461 *running,thread-id="all"
086,461 (gdb)
086,582 =library-loaded,id="C:\\Windows\\system32\\ntdll.dll",target-name="C:\\Windows\\system32\\nt\
dll.dll",host-name="C:\\Windows\\system32\\ntdll.dll",symbols-loaded="0",thread-group="i1"
086,584 =library-loaded,id="C:\\Windows\\syswow64\\kernel32.dll",target-name="C:\\Windows\\syswow64\\
\kernel32.dll",host-name="C:\\Windows\\syswow64\\kernel32.dll",symbols-loaded="0",thread-group="i1"
086,584 =library-loaded,id="C:\\Windows\\syswow64\\KernelBase.dll",target-name="C:\\Windows\\syswow6\
4\\KernelBase.dll",host-name="C:\\Windows\\syswow64\\KernelBase.dll",symbols-loaded="0",thread-group\
="i1"
086,584 =library-loaded,id="C:\\Windows\\SysWOW64\\TSAPPCMP.dll",target-name="C:\\Windows\\SysWOW64\\
\TSAPPCMP.dll",host-name="C:\\Windows\\SysWOW64\\TSAPPCMP.dll",symbols-loaded="0",thread-group="i1"
086,584 =library-loaded,id="C:\\Windows\\syswow64\\msvcrt.dll",target-name="C:\\Windows\\syswow64\\m\
svcrt.dll",host-name="C:\\Windows\\syswow64\\msvcrt.dll",symbols-loaded="0",thread-group="i1"
086,586 =library-loaded,id="C:\\Windows\\syswow64\\user32.dll",target-name="C:\\Windows\\syswow64\\u\
ser32.dll",host-name="C:\\Windows\\syswow64\\user32.dll",symbols-loaded="0",thread-group="i1"
086,586 =library-loaded,id="C:\\Windows\\syswow64\\gdi32.dll",target-name="C:\\Windows\\syswow64\\gd\
i32.dll",host-name="C:\\Windows\\syswow64\\gdi32.dll",symbols-loaded="0",thread-group="i1"
086,586 =library-loaded,id="C:\\Windows\\syswow64\\lpk.dll",target-name="C:\\Windows\\syswow64\\lpk.\
dll",host-name="C:\\Windows\\syswow64\\lpk.dll",symbols-loaded="0",thread-group="i1"
086,586 =library-loaded,id="C:\\Windows\\syswow64\\usp10.dll",target-name="C:\\Windows\\syswow64\\us\
p10.dll",host-name="C:\\Windows\\syswow64\\usp10.dll",symbols-loaded="0",thread-group="i1"
086,591 =library-loaded,id="C:\\Windows\\syswow64\\advapi32.dll",target-name="C:\\Windows\\syswow64\\
\advapi32.dll",host-name="C:\\Windows\\syswow64\\advapi32.dll",symbols-loaded="0",thread-group="i1"
086,591 =library-loaded,id="C:\\Windows\\SysWOW64\\sechost.dll",target-name="C:\\Windows\\SysWOW64\\\
sechost.dll",host-name="C:\\Windows\\SysWOW64\\sechost.dll",symbols-loaded="0",thread-group="i1"
086,591 =library-loaded,id="C:\\Windows\\syswow64\\rpcrt4.dll",target-name="C:\\Windows\\syswow64\\r\
pcrt4.dll",host-name="C:\\Windows\\syswow64\\rpcrt4.dll",symbols-loaded="0",thread-group="i1"
086,591 =library-loaded,id="C:\\Windows\\syswow64\\sspicli.dll",target-name="C:\\Windows\\syswow64\\\
sspicli.dll",host-name="C:\\Windows\\syswow64\\sspicli.dll",symbols-loaded="0",thread-group="i1"
086,591 =library-loaded,id="C:\\Windows\\syswow64\\cryptbase.dll",target-name="C:\\Windows\\syswow64\
\\cryptbase.dll",host-name="C:\\Windows\\syswow64\\cryptbase.dll",symbols-loaded="0",thread-group="i\
1"
086,592 =library-loaded,id="C:\\Windows\\syswow64\\ole32.dll",target-name="C:\\Windows\\syswow64\\ol\
e32.dll",host-name="C:\\Windows\\syswow64\\ole32.dll",symbols-loaded="0",thread-group="i1"
086,592 =library-loaded,id="C:\\Windows\\SysWOW64\\imm32.dll",target-name="C:\\Windows\\SysWOW64\\im\
m32.dll",host-name="C:\\Windows\\SysWOW64\\imm32.dll",symbols-loaded="0",thread-group="i1"
086,593 =library-loaded,id="C:\\Windows\\syswow64\\msctf.dll",target-name="C:\\Windows\\syswow64\\ms\
ctf.dll",host-name="C:\\Windows\\syswow64\\msctf.dll",symbols-loaded="0",thread-group="i1"
086,593 =library-loaded,id="C:\\eclipse\\mingw\\bin\\libgcc_s_dw2-1.dll",target-name="C:\\eclipse\\m\
ingw\\bin\\libgcc_s_dw2-1.dll",host-name="C:\\eclipse\\mingw\\bin\\libgcc_s_dw2-1.dll",symbols-loade\
d="0",thread-group="i1"
086,593 =library-loaded,id="C:\\eclipse\\mingw\\bin\\libstdc++-6.dll",target-name="C:\\eclipse\\ming\
w\\bin\\libstdc++-6.dll",host-name="C:\\eclipse\\mingw\\bin\\libstdc++-6.dll",symbols-loaded="0",thr\
ead-group="i1"
086,799 *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x0040139e",func="main",\
args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\he\
lloworld.cpp",line="14"},thread-id="1",stopped-threads="all"
086,804 (gdb)
086,804 13^error,msg="Can not fetch data now."
086,804 (gdb)
086,804 14^done,groups=[{id="i1",type="process",pid="820",executable="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\debug\\HelloWorld.exe"}]
086,805 (gdb)
093,431 15-list-thread-groups
093,439 15^done,groups=[{id="i1",type="process",pid="820",executable="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\debug\\HelloWorld.exe"}]
093,439 (gdb)
093,443 16-list-thread-groups i1
093,471 16^done,threads=[{id="1",target-id="Thread 820.0x1498",frame={level="0",addr="0x0040139e",fu\
nc="main",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworl\
d\\src\\helloworld.cpp",line="14"},state="stopped"}]
093,472 (gdb)
093,476 17-stack-info-depth --thread 1 11
093,482 17^done,depth="1"
093,482 (gdb)
093,482 18-stack-list-frames --thread 1
093,515 18^done,stack=[frame={level="0",addr="0x0040139e",func="main",file="..\\src\\HelloWorld.cpp"\
,fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line="14"}]
093,515 (gdb)
093,535 19-thread-info 1
093,545 20-stack-list-locals --thread 1 --frame 0 1
093,594 19^done,threads=[{id="1",target-id="Thread 820.0x1498",frame={level="0",addr="0x0040139e",fu\
nc="main",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworl\
d\\src\\helloworld.cpp",line="14"},state="stopped"}]
093,594 (gdb)
093,595 20^done,locals=[]
093,595 (gdb)
097,358 21-exec-next --thread 1 1
097,367 21^running
097,367 *running,thread-id="all"
097,367 (gdb)
097,387 *stopped,reason="end-stepping-range",frame={addr="0x004013a3",func="main",args=[],file="..\\\
src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line\
="18"},thread-id="1",stopped-threads="all"
097,389 (gdb)
097,391 22-stack-list-locals --thread 1 --frame 0 1
097,402 23-stack-info-depth --thread 1 11
097,413 22^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
401a1c \"U\211\345\203\354\\b\241\\b @\"}}"}]
097,413 (gdb)
097,413 23^done,depth="1"
097,413 (gdb)
097,416 24-stack-info-depth --thread 1
097,423 24^done,depth="1"
097,423 (gdb)
097,423 25-var-create --thread 1 --frame 0 - * name
097,424 26-thread-info 1
097,425 27-list-thread-groups
097,434 25^done,name="var1",numchild="2",value="{...}",type="std::string",thread-id="1",has_more="0"\

097,434 (gdb)
097,454 26^done,threads=[{id="1",target-id="Thread 820.0x1498",frame={level="0",addr="0x004013a3",fu\
nc="main",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworl\
d\\src\\helloworld.cpp",line="18"},state="stopped"}]
097,454 (gdb)
097,454 27^done,groups=[{id="i1",type="process",pid="820",executable="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\debug\\HelloWorld.exe"}]
097,454 (gdb)
102,014 28-exec-next --thread 1 1
102,021 28^running
102,022 *running,thread-id="all"
102,022 (gdb)
102,041 *stopped,reason="end-stepping-range",frame={addr="0x004013ae",func="main",args=[],file="..\\\
src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line\
="20"},thread-id="1",stopped-threads="all"
102,045 (gdb)
102,056 29-stack-list-locals --thread 1 --frame 0 1
102,057 29^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
6fcc8fa4 \"\"}}"}]
102,057 (gdb)
102,062 30-stack-info-depth --thread 1
102,062 31-stack-info-depth --thread 1 11
102,068 30^done,depth="1"
102,068 (gdb)
102,068 31^done,depth="1"
102,068 (gdb)
102,068 32-var-update 1 var1
102,076 33-thread-info 1
102,077 34-list-thread-groups
102,079 32^done,changelist=[]
102,079 (gdb)
102,103 33^done,threads=[{id="1",target-id="Thread 820.0x1498",frame={level="0",addr="0x004013ae",fu\
nc="main",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworl\
d\\src\\helloworld.cpp",line="20"},state="stopped"}]
102,103 (gdb)
102,103 34^done,groups=[{id="i1",type="process",pid="820",executable="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\debug\\HelloWorld.exe"}]
102,103 (gdb)
103,487 35-exec-next --thread 1 1
103,490 35^running
103,490 *running,thread-id="all"
103,490 (gdb)
103,510 *stopped,reason="end-stepping-range",frame={addr="0x004013c2",func="_fu0___ZSt4cout",args=[]\
,file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworl\
d.cpp",line="21"},thread-id="1",stopped-threads="all"
103,514 (gdb)
103,535 36-stack-list-locals --thread 1 --frame 0 1
103,536 37-stack-info-depth --thread 1 11
103,537 36^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
6fcc8fa4 \"\"}}"}]
103,537 (gdb)
103,540 37^done,depth="1"
103,540 (gdb)
103,548 38-stack-info-depth --thread 1
103,548 39-thread-info 1
103,549 40-list-thread-groups
103,553 38^done,depth="1"
103,553 (gdb)
103,553 41-var-update 1 var1
103,576 39^done,threads=[{id="1",target-id="Thread 820.0x1498",frame={level="0",addr="0x004013c2",fu\
nc="_fu0___ZSt4cout",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\src\\helloworld.cpp",line="21"},state="stopped"}]
103,576 (gdb)
103,576 40^done,groups=[{id="i1",type="process",pid="820",executable="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\debug\\HelloWorld.exe"}]
103,577 (gdb)
103,577 41^done,changelist=[]
103,577 (gdb)
104,935 42-exec-next --thread 1 1
104,944 42^running
104,944 *running,thread-id="all"
104,945 (gdb)
121,161 Name? *stopped,reason="end-stepping-range",frame={addr="0x004013d5",func="_fu3___ZSt3cin",ar\
gs=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\hell\
oworld.cpp",line="22"},thread-id="1",stopped-threads="all"
121,161 (gdb)
216,655 43next
216,666 &"next\n"
216,666 43^running
216,666 *running,thread-id="all"
216,666 (gdb)
216,705 ~"23\t\tcout << endl;\n"
216,734 *stopped,frame={addr="0x00401438",func="_fu1___ZSt4cout",args=[],file="..\\src\\HelloWorld.c\
pp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line="23"},thread-id=\
"1",stopped-threads="all"
216,738 (gdb)
216,744 44-stack-info-depth --thread 1 11
216,749 44^done,depth="1"
216,749 (gdb)
216,795 45-thread-info 1
216,796 46-list-thread-groups
216,854 45^done,threads=[{id="1",target-id="Thread 820.0x1498",frame={level="0",addr="0x00401438",fu\
nc="_fu1___ZSt4cout",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\src\\helloworld.cpp",line="23"},state="stopped"}]
216,854 (gdb)
216,854 46^done,groups=[{id="i1",type="process",pid="820",executable="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\debug\\HelloWorld.exe"}]
216,855 (gdb)
216,949 47-stack-list-locals --thread 1 --frame 0 1
216,950 47^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
3e2c24 \"Smith\"}}"}]
216,950 (gdb)
216,958 48-stack-info-depth --thread 1
216,961 48^done,depth="1"
216,961 (gdb)
216,961 49-var-update 1 var1
216,973 49^done,changelist=[]
216,973 (gdb)
285,531 50-exec-next --thread 1 1
285,534 50^running
285,534 *running,thread-id="all"
285,534 (gdb)
285,534 !!!Hello Smith!!!
285,572 *stopped,reason="end-stepping-range",frame={addr="0x0040144c",func="_fu2___ZSt4cout",args=[]\
,file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworl\
d.cpp",line="24"},thread-id="1",stopped-threads="all"
285,573 (gdb)
285,576 51-stack-list-locals --thread 1 --frame 0 1
285,577 51^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
3e2c24 \"Smith\"}}"}]
285,577 (gdb)
285,593 52-stack-info-depth --thread 1 11
285,595 53-stack-info-depth --thread 1
285,598 52^done,depth="1"
285,598 (gdb)
285,598 53^done,depth="1"
285,598 (gdb)
285,598 54-var-update 1 var1
285,606 55-thread-info 1
285,607 56-list-thread-groups
285,609 54^done,changelist=[]
285,609 (gdb)
285,634 55^done,threads=[{id="1",target-id="Thread 820.0x1498",frame={level="0",addr="0x0040144c",fu\
nc="_fu2___ZSt4cout",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\src\\helloworld.cpp",line="24"},state="stopped"}]
285,634 (gdb)
285,634 56^done,groups=[{id="i1",type="process",pid="820",executable="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\debug\\HelloWorld.exe"}]
285,634 (gdb)
318,814 57-data-evaluate-expression --thread 1 --frame 0 name
318,815 57^done,value="{static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__g\
nu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x3e2c24 \"Smith\"}}"
318,815 (gdb)
318,839 58-var-list-children var1
318,847 58^done,numchild="2",children=[child={name="var1.public",exp="public",numchild="1",thread-id\
="1"},child={name="var1.private",exp="private",numchild="1",thread-id="1"}],has_more="0"
318,847 (gdb)
318,847 59-var-list-children var1.public
318,847 60-var-list-children var1.private
318,858 59^done,numchild="1",children=[child={name="var1.public.npos",exp="npos",numchild="0",type="\
const std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type",thread-id="\
1"}],has_more="0"
318,858 (gdb)
318,858 60^done,numchild="1",children=[child={name="var1.private._M_dataplus",exp="_M_dataplus",numc\
hild="2",type="std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider"\
,thread-id="1"}],has_more="0"
318,858 61-var-info-path-expression var1.public.npos
318,858 (gdb)
318,859 62-var-info-path-expression var1.private._M_dataplus
318,868 61^done,path_expr="((name).npos)"
318,868 (gdb)
318,868 62^done,path_expr="((name)._M_dataplus)"
318,868 (gdb)
318,874 63-var-evaluate-expression var1.public.npos
318,879 63^done,value=""
318,879 (gdb)
333,200 64-exec-continue --thread 1
333,204 64^running
333,204 *running,thread-id="all"
333,205 (gdb)
333,205 =thread-exited,id="1",group-id="i1"
333,205 =thread-group-exited,id="i1",exit-code="0"
333,225 65-gdb-exit
333,225 66-data-evaluate-expression $_exitcode
333,225 *stopped,reason="exited-normally"
333,225 (gdb)
333,225 &"Quit (expect signal SIGINT when the program is resumed)\n"
333,225 65^exit

3. Reproducing with setvbuff commands (per CDT FAQ) and without endl commands.
(refer to source below)
Basically same procedure as above:

  • Create new C++ HelloWorld project with MinGW as the toolchain
  • Modify source to prompt for name and print it out. Do not include "endl" commands.
  • Build, run to ensure error free, start debugging.
  • After halt on main, use "step over" button to step through code
  • stepping over cout (line 20), or any cout that does not have "<< endl" added to it results in gdb disconnecting from the debugger gui and printing out the "*stopped..." message as above.
  • type "next" and hit enter on the gdb console (steps over the cin on line 21)
  • type "Smith" and enter on the application console. Control is still available and the next line is highlighted as expected.
  • step over cout line with no endl (line 22) results in flush to console and the gdb "*stopped..." message in the application console as above"


Typing "next" and hitting enter in the gdb console works to step to the next line and reconnect gdb control to the gui buttons as it has previously and debugging can be continued.


//============================================================================
// Name : HelloWorld.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main() {
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);

string name;

cout << "Name? " << endl;
cin >> name;
cout << "!!!Hello " + name + "!!!";
cout << endl;
return 0;
}

Application console
-------------------
Name? *stopped,reason="end-stepping-range",frame={addr="0x00401412",func="_fu0___ZSt4cout",args=[],file="..\src\HelloWorld.cpp",fullname="\\skorpio\zzz140\workspace\helloworld\src\helloworld.cpp",line="21"},thread-id="1",stopped-threads="all"
Smith
!!!Hello Smith!!!*stopped,reason="end-stepping-range",frame={addr="0x00401488",func="_fu1___ZSt4cout",args=[],file="..\src\HelloWorld.cpp",fullname="\\skorpio\zzz140\workspace\helloworld\src\helloworld.cpp",line="23"},thread-id="1",stopped-threads="all"

GDB console
------------
[New Thread 2972.0x1274]
next
next
22 cout << "!!!Hello " + name + "!!!";
next
next
24 return 0;
Quit (expect signal SIGINT when the program is resumed)

GDB traces console
-------------------
157,982 2-environment-cd //skorpio/zzz140/workspace/HelloWorld
157,995 2^done
157,995 (gdb)
157,998 3-gdb-set breakpoint pending on
158,005 3^done
158,005 (gdb)
158,005 4-gdb-set detach-on-fork on
158,016 4^done
158,016 (gdb)
158,016 5-enable-pretty-printing
158,027 5^done
158,027 (gdb)
158,027 6maintenance set python print-stack off
158,038 &"maintenance set python print-stack off\n"
158,038 6^done
158,038 (gdb)
158,038 7source .gdbinit
158,048 &"source .gdbinit\n"
158,066 &".gdbinit: No such file or directory.\n"
158,066 7^error,msg=".gdbinit: No such file or directory."
158,066 (gdb)
158,066 8-gdb-set auto-solib-add on
158,067 8^done
158,067 (gdb)
158,069 9-file-exec-and-symbols --thread-group i1 //skorpio/zzz140/workspace/HelloWorld/Debug/HelloW\
orld.exe
158,154 10-list-thread-groups
158,177 9^done
158,177 (gdb)
158,178 10^done,groups=[{id="i1",type="process",executable="\\\\skorpio\\zzz140\\workspace\\hellowor\
ld\\debug\\HelloWorld.exe"}]
158,178 (gdb)
158,180 11-break-insert --thread-group i1 -t -f main
158,295 11^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0040139e",func="ma\
in()",file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\hell\
oworld.cpp",line="14",times="0",original-location="main"}
158,295 (gdb)
158,302 12-exec-run --thread-group i1
158,567 =thread-group-started,id="i1",pid="2972"
158,568 13-list-thread-groups --available
158,568 14-list-thread-groups
158,590 =thread-created,id="1",group-id="i1"
158,590 ~"[New Thread 2972.0x1274]\n"
158,591 12^running
158,591 *running,thread-id="all"
158,591 (gdb)
158,709 =library-loaded,id="C:\\Windows\\system32\\ntdll.dll",target-name="C:\\Windows\\system32\\nt\
dll.dll",host-name="C:\\Windows\\system32\\ntdll.dll",symbols-loaded="0",thread-group="i1"
158,709 =library-loaded,id="C:\\Windows\\syswow64\\kernel32.dll",target-name="C:\\Windows\\syswow64\\
\kernel32.dll",host-name="C:\\Windows\\syswow64\\kernel32.dll",symbols-loaded="0",thread-group="i1"
158,709 =library-loaded,id="C:\\Windows\\syswow64\\KernelBase.dll",target-name="C:\\Windows\\syswow6\
4\\KernelBase.dll",host-name="C:\\Windows\\syswow64\\KernelBase.dll",symbols-loaded="0",thread-group\
="i1"
158,710 =library-loaded,id="C:\\Windows\\SysWOW64\\TSAPPCMP.dll",target-name="C:\\Windows\\SysWOW64\\
\TSAPPCMP.dll",host-name="C:\\Windows\\SysWOW64\\TSAPPCMP.dll",symbols-loaded="0",thread-group="i1"
158,710 =library-loaded,id="C:\\Windows\\syswow64\\msvcrt.dll",target-name="C:\\Windows\\syswow64\\m\
svcrt.dll",host-name="C:\\Windows\\syswow64\\msvcrt.dll",symbols-loaded="0",thread-group="i1"
158,710 =library-loaded,id="C:\\Windows\\syswow64\\user32.dll",target-name="C:\\Windows\\syswow64\\u\
ser32.dll",host-name="C:\\Windows\\syswow64\\user32.dll",symbols-loaded="0",thread-group="i1"
158,710 =library-loaded,id="C:\\Windows\\syswow64\\gdi32.dll",target-name="C:\\Windows\\syswow64\\gd\
i32.dll",host-name="C:\\Windows\\syswow64\\gdi32.dll",symbols-loaded="0",thread-group="i1"
158,710 =library-loaded,id="C:\\Windows\\syswow64\\lpk.dll",target-name="C:\\Windows\\syswow64\\lpk.\
dll",host-name="C:\\Windows\\syswow64\\lpk.dll",symbols-loaded="0",thread-group="i1"
158,711 =library-loaded,id="C:\\Windows\\syswow64\\usp10.dll",target-name="C:\\Windows\\syswow64\\us\
p10.dll",host-name="C:\\Windows\\syswow64\\usp10.dll",symbols-loaded="0",thread-group="i1"
158,711 =library-loaded,id="C:\\Windows\\syswow64\\advapi32.dll",target-name="C:\\Windows\\syswow64\\
\advapi32.dll",host-name="C:\\Windows\\syswow64\\advapi32.dll",symbols-loaded="0",thread-group="i1"
158,712 =library-loaded,id="C:\\Windows\\SysWOW64\\sechost.dll",target-name="C:\\Windows\\SysWOW64\\\
sechost.dll",host-name="C:\\Windows\\SysWOW64\\sechost.dll",symbols-loaded="0",thread-group="i1"
158,712 =library-loaded,id="C:\\Windows\\syswow64\\rpcrt4.dll",target-name="C:\\Windows\\syswow64\\r\
pcrt4.dll",host-name="C:\\Windows\\syswow64\\rpcrt4.dll",symbols-loaded="0",thread-group="i1"
158,713 =library-loaded,id="C:\\Windows\\syswow64\\sspicli.dll",target-name="C:\\Windows\\syswow64\\\
sspicli.dll",host-name="C:\\Windows\\syswow64\\sspicli.dll",symbols-loaded="0",thread-group="i1"
158,713 =library-loaded,id="C:\\Windows\\syswow64\\cryptbase.dll",target-name="C:\\Windows\\syswow64\
\\cryptbase.dll",host-name="C:\\Windows\\syswow64\\cryptbase.dll",symbols-loaded="0",thread-group="i\
1"
158,713 =library-loaded,id="C:\\Windows\\syswow64\\ole32.dll",target-name="C:\\Windows\\syswow64\\ol\
e32.dll",host-name="C:\\Windows\\syswow64\\ole32.dll",symbols-loaded="0",thread-group="i1"
158,714 =library-loaded,id="C:\\Windows\\SysWOW64\\imm32.dll",target-name="C:\\Windows\\SysWOW64\\im\
m32.dll",host-name="C:\\Windows\\SysWOW64\\imm32.dll",symbols-loaded="0",thread-group="i1"
158,714 =library-loaded,id="C:\\Windows\\syswow64\\msctf.dll",target-name="C:\\Windows\\syswow64\\ms\
ctf.dll",host-name="C:\\Windows\\syswow64\\msctf.dll",symbols-loaded="0",thread-group="i1"
158,714 =library-loaded,id="C:\\eclipse\\mingw\\bin\\libgcc_s_dw2-1.dll",target-name="C:\\eclipse\\m\
ingw\\bin\\libgcc_s_dw2-1.dll",host-name="C:\\eclipse\\mingw\\bin\\libgcc_s_dw2-1.dll",symbols-loade\
d="0",thread-group="i1"
158,715 =library-loaded,id="C:\\eclipse\\mingw\\bin\\libstdc++-6.dll",target-name="C:\\eclipse\\ming\
w\\bin\\libstdc++-6.dll",host-name="C:\\eclipse\\mingw\\bin\\libstdc++-6.dll",symbols-loaded="0",thr\
ead-group="i1"
159,250 *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x0040139e",func="main",\
args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\he\
lloworld.cpp",line="14"},thread-id="1",stopped-threads="all"
159,254 (gdb)
159,254 13^error,msg="Can not fetch data now."
159,254 (gdb)
159,254 14^done,groups=[{id="i1",type="process",pid="2972",executable="\\\\skorpio\\zzz140\\workspac\
e\\helloworld\\debug\\HelloWorld.exe"}]
159,254 (gdb)
165,307 15-list-thread-groups
165,314 15^done,groups=[{id="i1",type="process",pid="2972",executable="\\\\skorpio\\zzz140\\workspac\
e\\helloworld\\debug\\HelloWorld.exe"}]
165,314 (gdb)
165,321 16-list-thread-groups i1
165,344 16^done,threads=[{id="1",target-id="Thread 2972.0x1274",frame={level="0",addr="0x0040139e",f\
unc="main",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\hellowor\
ld\\src\\helloworld.cpp",line="14"},state="stopped"}]
165,345 (gdb)
165,347 17-stack-info-depth --thread 1 11
165,354 17^done,depth="1"
165,354 (gdb)
165,354 18-stack-list-frames --thread 1
165,385 18^done,stack=[frame={level="0",addr="0x0040139e",func="main",file="..\\src\\HelloWorld.cpp"\
,fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line="14"}]
165,385 (gdb)
165,407 19-thread-info 1
165,417 20-stack-list-locals --thread 1 --frame 0 1
165,465 19^done,threads=[{id="1",target-id="Thread 2972.0x1274",frame={level="0",addr="0x0040139e",f\
unc="main",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\hellowor\
ld\\src\\helloworld.cpp",line="14"},state="stopped"}]
165,465 (gdb)
165,465 20^done,locals=[]
165,466 (gdb)
168,004 21-exec-next --thread 1 1
168,007 21^running
168,007 *running,thread-id="all"
168,007 (gdb)
168,037 *stopped,reason="end-stepping-range",frame={addr="0x004013a3",func="main",args=[],file="..\\\
src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line\
="15"},thread-id="1",stopped-threads="all"
168,041 22-stack-list-locals --thread 1 --frame 0 1
168,041 (gdb)
168,042 23-stack-info-depth --thread 1 11
168,054 22^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
401a6c \"U\211\345\203\354\\b\241\\b @\"}}"}]
168,055 (gdb)
168,055 23^done,depth="1"
168,055 (gdb)
168,062 24-stack-info-depth --thread 1
168,065 24^done,depth="1"
168,065 (gdb)
168,065 25-var-create --thread 1 --frame 0 - * name
168,065 25^done,name="var1",numchild="2",value="{...}",type="std::string",thread-id="1",has_more="0"\

168,065 (gdb)
168,068 26-thread-info 1
168,068 27-list-thread-groups
168,096 26^done,threads=[{id="1",target-id="Thread 2972.0x1274",frame={level="0",addr="0x004013a3",f\
unc="main",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\hellowor\
ld\\src\\helloworld.cpp",line="15"},state="stopped"}]
168,096 (gdb)
168,096 27^done,groups=[{id="i1",type="process",pid="2972",executable="\\\\skorpio\\zzz140\\workspac\
e\\helloworld\\debug\\HelloWorld.exe"}]
168,096 (gdb)
168,988 28-exec-next --thread 1 1
168,998 28^running
168,998 *running,thread-id="all"
168,999 (gdb)
169,035 *stopped,reason="end-stepping-range",frame={addr="0x004013cb",func="main",args=[],file="..\\\
src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line\
="16"},thread-id="1",stopped-threads="all"
169,036 (gdb)
169,040 29-stack-list-locals --thread 1 --frame 0 1
169,040 29^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
401a6c \"U\211\345\203\354\\b\241\\b @\"}}"}]
169,040 (gdb)
169,082 30-stack-info-depth --thread 1
169,083 31-stack-info-depth --thread 1 11
169,090 30^done,depth="1"
169,090 (gdb)
169,090 31^done,depth="1"
169,090 (gdb)
169,090 32-var-update 1 var1
169,098 33-thread-info 1
169,099 34-list-thread-groups
169,101 32^done,changelist=[]
169,101 (gdb)
169,124 33^done,threads=[{id="1",target-id="Thread 2972.0x1274",frame={level="0",addr="0x004013cb",f\
unc="main",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\hellowor\
ld\\src\\helloworld.cpp",line="16"},state="stopped"}]
169,124 (gdb)
169,124 34^done,groups=[{id="i1",type="process",pid="2972",executable="\\\\skorpio\\zzz140\\workspac\
e\\helloworld\\debug\\HelloWorld.exe"}]
169,124 (gdb)
169,844 35-exec-next --thread 1 1
169,854 35^running
169,854 *running,thread-id="all"
169,855 (gdb)
169,875 *stopped,reason="end-stepping-range",frame={addr="0x004013f3",func="main",args=[],file="..\\\
src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line\
="18"},thread-id="1",stopped-threads="all"
169,875 (gdb)
169,890 36-stack-list-locals --thread 1 --frame 0 1
169,891 37-stack-info-depth --thread 1 11
169,896 36^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
401a6c \"U\211\345\203\354\\b\241\\b @\"}}"}]
169,896 (gdb)
169,896 37^done,depth="1"
169,896 (gdb)
169,899 38-stack-info-depth --thread 1
169,906 39-thread-info 1
169,907 40-list-thread-groups
169,907 38^done,depth="1"
169,907 (gdb)
169,907 41-var-update 1 var1
169,931 39^done,threads=[{id="1",target-id="Thread 2972.0x1274",frame={level="0",addr="0x004013f3",f\
unc="main",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\hellowor\
ld\\src\\helloworld.cpp",line="18"},state="stopped"}]
169,932 (gdb)
169,932 40^done,groups=[{id="i1",type="process",pid="2972",executable="\\\\skorpio\\zzz140\\workspac\
e\\helloworld\\debug\\HelloWorld.exe"}]
169,932 (gdb)
169,932 41^done,changelist=[]
169,932 (gdb)
170,668 42-exec-next --thread 1 1
170,674 42^running
170,675 *running,thread-id="all"
170,675 (gdb)
170,694 *stopped,reason="end-stepping-range",frame={addr="0x004013fe",func="main",args=[],file="..\\\
src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line\
="20"},thread-id="1",stopped-threads="all"
170,695 (gdb)
170,710 43-stack-list-locals --thread 1 --frame 0 1
170,711 44-stack-info-depth --thread 1 11
170,717 43^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
6fcc8fa4 \"\"}}"}]
170,717 (gdb)
170,717 44^done,depth="1"
170,717 (gdb)
170,719 45-stack-info-depth --thread 1
170,728 45^done,depth="1"
170,728 (gdb)
170,729 46-thread-info 1
170,729 47-list-thread-groups
170,729 48-var-update 1 var1
170,758 46^done,threads=[{id="1",target-id="Thread 2972.0x1274",frame={level="0",addr="0x004013fe",f\
unc="main",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\hellowor\
ld\\src\\helloworld.cpp",line="20"},state="stopped"}]
170,758 (gdb)
170,758 47^done,groups=[{id="i1",type="process",pid="2972",executable="\\\\skorpio\\zzz140\\workspac\
e\\helloworld\\debug\\HelloWorld.exe"}]
170,758 (gdb)
170,758 48^done,changelist=[]
170,758 (gdb)
171,621 49-exec-next --thread 1 1
171,632 49^running
171,632 *running,thread-id="all"
171,632 (gdb)
171,651 Name? *stopped,reason="end-stepping-range",frame={addr="0x00401412",func="_fu0___ZSt4cout",a\
rgs=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\hel\
loworld.cpp",line="21"},thread-id="1",stopped-threads="all"
171,651 (gdb)
183,260 50next
183,261 &"next\n"
183,261 50^running
183,261 *running,thread-id="all"
183,261 (gdb)
211,570 ~"22\t\tcout << \"!!!Hello \" + name + \"!!!\";\n"
211,598 *stopped,frame={addr="0x00401425",func="_fu3___ZSt3cin",args=[],file="..\\src\\HelloWorld.cp\
p",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line="22"},thread-id="\
1",stopped-threads="all"
211,600 (gdb)
211,605 51-stack-info-depth --thread 1 11
211,612 51^done,depth="1"
211,612 (gdb)
211,620 52-thread-info 1
211,620 53-list-thread-groups
211,637 54-stack-list-locals --thread 1 --frame 0 1
211,647 52^done,threads=[{id="1",target-id="Thread 2972.0x1274",frame={level="0",addr="0x00401425",f\
unc="_fu3___ZSt3cin",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\
\\helloworld\\src\\helloworld.cpp",line="22"},state="stopped"}]
211,647 (gdb)
211,647 53^done,groups=[{id="i1",type="process",pid="2972",executable="\\\\skorpio\\zzz140\\workspac\
e\\helloworld\\debug\\HelloWorld.exe"}]
211,648 (gdb)
211,648 54^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
512c24 \"Smith\"}}"}]
211,648 (gdb)
211,652 55-stack-info-depth --thread 1
211,659 55^done,depth="1"
211,659 (gdb)
211,659 56-var-update 1 var1
211,670 56^done,changelist=[]
211,670 (gdb)
414,624 57-data-evaluate-expression --thread 1 --frame 0 "cin >> name"
414,626 57^error,msg="Address of symbol \"std::cin\" is unknown."
414,626 (gdb)
416,282 58-data-evaluate-expression --thread 1 --frame 0 name
416,293 58^done,value="{static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__g\
nu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x512c24 \"Smith\"}}"
416,294 (gdb)
416,319 59-var-list-children var1
416,324 59^done,numchild="2",children=[child={name="var1.public",exp="public",numchild="1",thread-id\
="1"},child={name="var1.private",exp="private",numchild="1",thread-id="1"}],has_more="0"
416,324 (gdb)
416,324 60-var-list-children var1.public
416,324 61-var-list-children var1.private
416,335 60^done,numchild="1",children=[child={name="var1.public.npos",exp="npos",numchild="0",type="\
const std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type",thread-id="\
1"}],has_more="0"
416,335 (gdb)
416,335 61^done,numchild="1",children=[child={name="var1.private._M_dataplus",exp="_M_dataplus",numc\
hild="2",type="std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider"\
,thread-id="1"}],has_more="0"
416,335 (gdb)
416,335 62-var-info-path-expression var1.public.npos
416,336 63-var-info-path-expression var1.private._M_dataplus
416,345 62^done,path_expr="((name).npos)"
416,345 (gdb)
416,345 63^done,path_expr="((name)._M_dataplus)"
416,345 (gdb)
416,350 64-var-evaluate-expression var1.public.npos
416,356 64^done,value=""
416,356 (gdb)
523,042 65-exec-next --thread 1 1
523,051 65^running
523,052 *running,thread-id="all"
523,052 (gdb)
523,106 !!!Hello Smith!!!*stopped,reason="end-stepping-range",frame={addr="0x00401488",func="_fu1___\
ZSt4cout",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworl\
d\\src\\helloworld.cpp",line="23"},thread-id="1",stopped-threads="all"
523,106 (gdb)
637,932 66next
637,937 &"next\n"
637,937 66^running
637,937 *running,thread-id="all"
637,937 (gdb)
637,971 ~"24\t\treturn 0;\n"
637,999 *stopped,frame={addr="0x0040149c",func="_fu2___ZSt4cout",args=[],file="..\\src\\HelloWorld.c\
pp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\helloworld.cpp",line="24"},thread-id=\
"1",stopped-threads="all"
637,999 (gdb)
638,007 67-stack-info-depth --thread 1 11
638,012 68-stack-info-depth --thread 1
638,016 67^done,depth="1"
638,016 (gdb)
638,022 68^done,depth="1"
638,022 (gdb)
638,022 69-var-update 1 var1
638,033 69^done,changelist=[]
638,033 (gdb)
638,059 70-thread-info 1
638,059 71-list-thread-groups
638,104 70^done,threads=[{id="1",target-id="Thread 2972.0x1274",frame={level="0",addr="0x0040149c",f\
unc="_fu2___ZSt4cout",args=[],file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspac\
e\\helloworld\\src\\helloworld.cpp",line="24"},state="stopped"}]
638,104 (gdb)
638,104 71^done,groups=[{id="i1",type="process",pid="2972",executable="\\\\skorpio\\zzz140\\workspac\
e\\helloworld\\debug\\HelloWorld.exe"}]
638,104 (gdb)
638,201 72-stack-list-locals --thread 1 --frame 0 1
638,207 72^done,locals=[{name="name",value="{static npos = <optimized out>, _M_dataplus = {<std::all\
ocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x\
512c24 \"Smith\"}}"}]
638,207 (gdb)
638,306 73-data-evaluate-expression --thread 1 --frame 0 name
638,315 73^done,value="{static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__g\
nu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x512c24 \"Smith\"}}"
638,315 (gdb)
641,166 74-exec-continue --thread 1
641,170 74^running
641,170 *running,thread-id="all"
641,170 (gdb)
641,170 =thread-exited,id="1",group-id="i1"
641,170 =thread-group-exited,id="i1",exit-code="0"
641,180 *stopped,reason="exited-normally"
641,180 (gdb)
641,180 &"Quit (expect signal SIGINT when the program is resumed)\n"
641,180 75-gdb-exit
641,180 76-data-evaluate-expression $_exitcode
641,183 75^exit

4. Finally an example of a run that works (not using the setenv and using << endl with each cout:

The procedure is as above and single step through the whole thing, entering "Smith" in the application console when prompted. I'm including this incase something can be gleaned from the gdb tract; I did not see anything different in the stopped lines though.


//============================================================================
// Name : HelloWorld.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

int main() {
//setvbuf(stdout, NULL, _IONBF, 0);
//setvbuf(stderr, NULL, _IONBF, 0);

string name;

cout << "Name? " << endl;
cin >> name;
cout << "!!!Hello " + name + "!!!";
cout << endl;
return 0;
}

Application console
-------------------
Name?
Smith
!!!Hello Smith!!!

GDB console
------------
[New Thread 4248.0x152c]
Quit (expect signal SIGINT when the program is resumed)

GDB traces console
-------------------
255,863 2-environment-cd //skorpio/zzz140/workspace/HelloWorld
255,876 2^done
255,876 (gdb)
255,877 3-gdb-set breakpoint pending on
255,887 3^done
255,887 (gdb)
255,887 4-gdb-set detach-on-fork on
255,897 4^done
255,897 (gdb)
255,897 5-enable-pretty-printing
255,908 5^done
255,908 (gdb)
255,908 6maintenance set python print-stack off
255,919 &"maintenance set python print-stack off\n"
255,919 6^done
255,919 (gdb)
255,919 7source .gdbinit
255,930 &"source .gdbinit\n"
255,947 &".gdbinit: No such file or directory.\n"
255,947 7^error,msg=".gdbinit: No such file or directory."
255,947 (gdb)
255,947 8-gdb-set auto-solib-add on
255,947 8^done
255,947 (gdb)
255,950 9-file-exec-and-symbols --thread-group i1 //skorpio/zzz140/workspace/HelloWorld/Debug/HelloW\
orld.exe
256,027 10-list-thread-groups
256,053 9^done
256,053 (gdb)
256,053 10^done,groups=[{id="i1",type="process",executable="\\\\skorpio\\zzz140\\workspace\\hellowor\
ld\\debug\\HelloWorld.exe"}]
256,054 (gdb)
256,056 11-break-insert --thread-group i1 -t -f main
256,152 11^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0040139e",func="ma\
in()",file="..\\src\\HelloWorld.cpp",fullname="\\\\skorpio\\zzz140\\workspace\\helloworld\\src\\hell\
oworld.cpp",line="14",times="0",original-location="main"}
256,152 (gdb)
256,170 12-exec-run --thread-group i1
256,432 =thread-group-started,id="i1",pid="4248"
256,434 13-list-thread-groups --available
256,434 14-list-thread-groups
256,455 =thread-created,id="1",group-id="i1"
256,455 ~"[New Thread 4248.0x152c]\n"
256,457 12^running
256,457 *running,thread-id="all"
256,457 (gdb)
256,572 =library-loaded,id="C:\\Windows\\system32\\ntdll.dll",target-name="C:\\Windows\\system32\\nt\
dll.dll",host-name="C:\\Windows\\system32\\ntdll.dll",symbols-loaded="0",thread-group="i1"
256,573 =library-loaded,id="C:\\Windows\\syswow64\\kernel32.dll",target-name="C:\\Windows\\syswow64\\
\kernel32.dll",host-name="C:\\Windows\\syswow64\\kernel32.dll",symbols-loaded="0",thread-group="i1"
256,573 =library-loaded,id="C:\\Windows\\syswow64\\KernelBase.dll",target-name="C:\\Windows\\syswow6\
4\\KernelBase.dll",host-name="C:\\Windows\\syswow64\\KernelBase.dll",symbols-loaded="0",thread-group\
="i1"
256,573 =library-loaded,id="C:\\Windows\\SysWOW64\\TSAPPCMP.dll",target-name="C:\\Windows\\SysWOW64\\
\TSAPPCMP.dll",host-name="C:\\Windows\\SysWOW64\\TSAPPCMP.dll",symbols-loaded="0",thread-group="i1"
256,574 =library-loaded,id="C:\\Windows\\syswow64\\msvcrt.dll",target-name="C:\\Windows\\syswow64\\m\
svcrt.dll",host-name="C:\\Windows\\syswow64\\msvcrt.dll",symbols-loaded="0",thread-group="i1"
256,574 =library-loaded,id="C:\\Windows\\syswow64\\user32.dll",target-name="C:\\Windows\\syswow64\\u\
ser32.dll",host-name="C:\\Windows\\syswow64\\user32.dll",symbols-loaded="0",thread-group="i1"
256,575 =library-loaded,id="C:\\Windows\\syswow64\\gdi32.dll",target-name="C:\\Windows\\syswow64\\gd\
i32.dll",host-name="C:\\Windows\\syswow64\\gdi32.dll",symbols-loaded="0",thread-group="i1"
256,575 =library-loaded,id="C:\\Windows\\syswow64\\lpk.dll",target-name="C:\\Windows\\syswow64\\lpk.\
dll",host-name="C:\\Windows\\syswow64\\lpk.dll",symbols-loaded="0",thread-group="i1"
256,575 =library-loaded,id="C:\\Windows\\syswow64\\usp10.dll",target-name="C:\\Windows\\syswow64\\us\
p10.dll",host-name="C:\\Windows\\syswow64\\usp10.dll",symbols-loaded="0",thread-group="i1"
256,576 =library-loaded,id="C:\\Windows\\syswow64\\advapi32.dll",target-name="C:\\Windows\\syswow64\\
\advapi32.dll",host-name="C:\\Windows\\syswow64\\advapi32.dll",symbols-loaded="0",thread-group="i1"
256,576 =library-loaded,id="C:\\Windows\\SysWOW64\\sechost.dll",target-name="C:\\Windows\\SysWOW64\\\
sechost.dll",host-name="C:\\Windows\\SysWOW64\\sechost.dll",symbols-loaded="0",thread-group="i1"
256,577 =library-loaded,id="C:\\Windows\\syswow64\\rpcrt4.dll",target-name="C:\\Windows\\syswow64\\r\
pcrt4.dll",host-name="C:\\Windows\\syswow64\\rpcrt4.dll",symbols-loaded="0",thread-group="i1"
256,577 =library-loaded,id="C:\\Windows\\syswow64\\sspicli.dll",target-name="C:\\Windows\\syswow64\\\
sspicli.dll",host-name="C:\\Windows\\syswow64\\sspicli.dll",symbols-loaded="0",thread-group="i1"
256,578 =library-loaded,id="C:\\Windows\\syswow64\\cryptbase.dll",target-name="C:\\Windows\\syswow64\
\\cryptbase.dll",host-name="C:\\Windows\\syswow64\\cryptbase.dll",symbols-loaded=&q
Previous Topic:Hello World.exe has stopped working
Next Topic:"Unresolved inclusion" errors after installing MinGW and Mysys
Goto Forum:
  


Current Time: Thu Aug 28 05:33:31 EDT 2014

Powered by FUDForum. Page generated in 0.01662 seconds