Author Topic: Debugger issue: Boost, ifstream (filesystem lib) - exit code 1  (Read 7106 times)

Offline Silenas

  • Single posting newcomer
  • *
  • Posts: 4
Hi Everyone
First post on this topic - so the place might be wrong but I can't see better - and I did not find a topic
on this matter.  :)

System: XP
Processor: Intel
Using: Code::Blocks 8.0.2
Libs: Boost 1.41, Std

I came across a strange behavior that I thought was a misuse of C++ boost ifstream or compatibility issue with std ifstream
(although the first is inherited of the second).

The program I attached - works fine in a release / debug mode. It is fine as long as you do not activate a step by step
around the fstream declaration (!) and subsequent use.

At the moment you do step by step in this piece of code - the debugger exit with status 1 :
since the release and the non step debug (you can step elsewhere than here) works.
I assume that would be a debugger issue.
Can someone test / double check / comment ?

Code
            if(boost::filesystem::exists(final))
            {
                // process file
                try
                {
                    boost::filesystem::ifstream _fileStream;
                    _fileStream.open(final);

                    cout << "Test: is file open" << endl;

                    if(_fileStream.is_open())
                    {
                        // keep going
                        while(!_fileStream.eof())
                        {
                            getline(_fileStream, _line);
                            // parse line - find "=" in the whole line to separate value
                            _position = _line.find_first_of('=');
                            // if found - i.e. not -1 == npos
                            if(_position != string::npos)
                            {
                                _key = _line.substr(0, _position); // from beginning to "="
                                _value = _line.substr(_position+1); // from "=" to end
                                cout << "Key is: " << _key << endl;
                                cout << "Value is: " << _value << endl;
                            } // else - don't bother - skip line
                        }
                    } else {
                        // exception here
                        cout << "File not opened" << endl;
                    }
                } catch(...) {
                    cout << "prevented crash" << endl;
                }
            }

[attachment deleted by admin]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger issue: Boost, ifstream (filesystem lib) - exit code 1
« Reply #1 on: March 06, 2010, 06:53:58 pm »
Can you tell us the gcc version, gdb version?

If you're not using gdb 7.0.x please try it.

Also you could try to debug it using gdb directly
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Silenas

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugger issue: Boost, ifstream (filesystem lib) - exit code 1
« Reply #2 on: March 06, 2010, 07:01:18 pm »
Ok - I see - I was using default provided by 8.0.2 installation.

Quote
GNU gdb 6.7.50.20071127
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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 "i686-pc-mingw32".

Quote
Reading specs from ../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw3
2 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --d
isable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-l
ibgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)

I will see if anything updated and retry.

Offline Silenas

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugger issue: Boost, ifstream (filesystem lib) - exit code 1
« Reply #3 on: March 06, 2010, 07:03:31 pm »
Second thought ...
The debugger plugin is 0.3 (provided by install 8.0.2) - how can I update that ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger issue: Boost, ifstream (filesystem lib) - exit code 1
« Reply #4 on: March 06, 2010, 07:18:31 pm »
For the plugin you can try a nightly build (see the nightly build sub forum).
But first try newer gdb
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Silenas

  • Single posting newcomer
  • *
  • Posts: 4
Re: Debugger issue: Boost, ifstream (filesystem lib) - exit code 1
« Reply #5 on: March 06, 2010, 08:22:50 pm »
Hi
This is rather disappointing.
That GDB version 7.0.1 (or 7.0.0) is non-binary. That mean I have to set it up and compile it.
And same goes for GCC 4.4.3

I was using (from the start) version 5.1.6 from MinGW (latest) and it is outdated now considering the version
above.

The reason why I decide to mention this rather than just get on with this is because I am not
the only one going through this and the other are not going to just upgrade through compilation.

I think I will stick to the current version because I don't want to fight over issue due to different
GCC / GDB version from other developpers.

Sorry about that one.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Debugger issue: Boost, ifstream (filesystem lib) - exit code 1
« Reply #6 on: March 06, 2010, 09:27:07 pm »
For gcc use the TDragon's release -> http://www.tdragon.net/recentgcc/
For gdb you can try this: http://forums.codeblocks.org/index.php/topic,11301.0.html
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]