User forums > General (but related to Code::Blocks)

Debugger issue: Boost, ifstream (filesystem lib) - exit code 1

(1/2) > >>

Silenas:
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;
                }
            }

--- End code ---

[attachment deleted by admin]

oBFusCATed:
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

Silenas:
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".

--- End quote ---


--- 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)

--- End quote ---

I will see if anything updated and retry.

Silenas:
Second thought ...
The debugger plugin is 0.3 (provided by install 8.0.2) - how can I update that ?

oBFusCATed:
For the plugin you can try a nightly build (see the nightly build sub forum).
But first try newer gdb

Navigation

[0] Message Index

[#] Next page

Go to full version