Neil, I don't know in what way intentional. I've asked if it is intentional because few times I've pointed out that some of the behavior of cb seems either illogical or not fully baked and I've got response that the behavior is intentional. That's why this time I've asked.
Now to coding, same code different response:
#include <string>
int main(int argc, char* argv[])
{
std::string s("Ala ma kota");//this is observable in vs but not in cb - is this intentional?
return 0;
}
Same here:
template<class Int_T>
template<class Forward_Iterator>
std::string Calculator_engine<Int_T>::read_next_token_(Forward_Iterator& beg,Forward_Iterator& end)
{
std::string result;
if (std::isdigit(*beg))//On this line I'll get info from cb: Attempt to take contents of a non-pointer value.
{//when in fact beg is an iterator to std::string and has pointer semantics and this should be "observable"
return get_term_(beg,end);
}
else if (is_operator_(beg))
{
return get_operator_(beg,end);
}
else
{
throw Incorrect_Expression();//[opportunity to show exact place of error]
}
}
@smallB:
I don't know what you are doing in the debugger, but this code (I had to make changes to get it to compile and link), is debuggable using gdb and CB for me:
#include <string>
template <class Forward_Iterator>
bool is_operator_( Forward_Iterator it ) {
return * it == '+';
}
template<class Forward_Iterator>
std::string get_operator_( Forward_Iterator beg, Forward_Iterator end) {
return "+";
}
template<class Forward_Iterator>
std::string get_term_( Forward_Iterator beg, Forward_Iterator end) {
return "term";
}
template<class Forward_Iterator>
std::string read_next_token_(Forward_Iterator beg,Forward_Iterator end)
{
std::string result;
if (std::isdigit(*beg))
{
return get_term_(beg,end);
}
else if (is_operator_(beg))
{
return get_operator_(beg,end);
}
else {
throw "error";
}
}
int main(int argc, char* argv[])
{
std::string foo = "1234567avavav";
std::string t = read_next_token_( foo.begin(), foo.end() );
}
@Neil, perhaps I'm doing something wrong.
this code:
#include <string>
int main(int argc, char* argv[])
{
std::string foo = "1234567avavav";
return 0;
}
gives following output:
http://imageshack.us/photo/my-images/259/cannotevaluate.png/
@Neil sorry for the disconnection. Neil, let's talk about the simplest code example which is main to string obj.
#include <string>
int main(int argc, char* argv[])
{
std::string foo = "1234567avavav";
return 0;
}
And yes, I do have them unchecked (those options you've shown in your previous post)
@obfuscated, I do listen but I didn't have (and still don't see) anything in debug log tab. That's why I've said:
"Is the debuger's log now displayed in logs and others on build log tab instead of the regular one? if so that's the log if not I do not now where is it saved as there seems to be no path specified:"
And that's why I've pasted the only thing I've had (after I've checked everywhere I thought, and didn't find what may look like the exact thing), but I've explained why I'm doing this, didn't I? I'm not trying in any way to waste your or others time but sometimes problems will not get sort in one post or two. I hope that's obvious for all of us. Or not? Because if not then according to neil's definition (not in so many words): Someone who can't solve problem withing 2 posts obviously is a troll, then yes! I am a fully fledged troll. But if we agree that some of the problems may take longer to solve than those two posts then I'm just an user who started using this IDE and most of the things are not obvious to me and the only thing I'm trying to do is to get help. Not trolling, not wasting anyone's time. Couldn't stress it hard enough.
Ok let's go back to my problem:
1. Following jane's advice I've set linker and compiler to same values:
a) both set to g++, result: code compiles, but still in a watch window I cannot see value of string obj
b) both set to mingw32-g++, result: code compiles, but still in a watch window I cannot see value of string obj.
I think that's the log you were talking about(sorry for the misunderstandings - just didn't see this tab):
PATH=.;C:\QtSDK\Desktop\Qt\4.7.4\mingw\lib;C:\MinGW32\bin;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Universal Extractor;C:\Program Files\Universal Extractor\bin;D:\Libraries\boost_1_47_0\boost_1_47_0\build\bin;D:\Libraries\boost_1_47_0\boost_1_47_0\;C:\Program Files\TortoiseSVN\bin;C:\Qt\4.8.0\bin;D:\downloads\zip-2.3-3-bin\bin;C:\MinGW\bin;C:\Program Files\VisualSVN\bin
Command-line: C:\MinGW32\bin\gdb.exe -nx -fullname -quiet -args C:/excercizes/QT_projects/7500/bin/Debug/7500.exe
Working dir : C:\excercizes\QT_projects\7500
> set prompt >>>>>>cb_gdb:
Reading symbols from c:\excercizes\qt_projects\7500\bin\debug\7500.exe...done.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.3
Copyright (C) 2011 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 "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set print elements -1
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set new-console on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> catch throw
Function "__cxa_throw" not defined.
Catchpoint 1 (throw)
>>>>>>cb_gdb:
> source E:\downloads\codeblocks\Nightly\oct_2011\CB_20111030_rev7550_DEBUGGER_BRANCH_win32\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> directory C:/excercizes/QT_projects/7500/
>>>>>>cb_gdb:
> break "C:/excercizes/QT_projects/7500/main.cpp:7"
Breakpoint 2 at 0x4013cf: file C:\excercizes\QT_projects\7500\main.cpp, line 7.
>>>>>>cb_gdb:
> run
gdb: windows_init_thread_list
[New Thread 52.0x980]
Breakpoint 2, main (argc=1, argv=0x340ec0) at C:\excercizes\QT_projects\7500\main.cpp:7
c:\excercizes\qt_projects\7500\main.cpp:7:133:beg:0x4013cf
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:
> quit
Anyone have an idea how to solve it?
Thanks.
@obfuscated when you talk about int variable I assumed that you refer to 'argc' variable from args list of main. Hope that's the right assumption.
Ok, here is the log (by the way, after disabling "Enable watch scripts") I can see value of int and string (at last!). One extra thing only is that with string obj in order to see its value I have to expand the tree little (see the pic http://imageshack.us/photo/my-images/231/expandingtree.png/). Is there a way to see this value without expanding it or is this normal behavior (I don't mind expanding it just want to know if there is a way to ease this little bit):
PATH=.;C:\QtSDK\Desktop\Qt\4.7.4\mingw\lib;C:\MinGW32\bin;C:\Program Files\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\Universal Extractor;C:\Program Files\Universal Extractor\bin;D:\Libraries\boost_1_47_0\boost_1_47_0\build\bin;D:\Libraries\boost_1_47_0\boost_1_47_0\;C:\Program Files\TortoiseSVN\bin;C:\Qt\4.8.0\bin;D:\downloads\zip-2.3-3-bin\bin;C:\MinGW\bin;C:\Program Files\VisualSVN\bin
Command-line: C:\MinGW32\bin\gdb.exe -nx -fullname -quiet -args C:/excercizes/QT_projects/7500/bin/Debug/7500.exe
Working dir : C:\excercizes\QT_projects\7500
> set prompt >>>>>>cb_gdb:
Skip initializing the scripting!
Reading symbols from c:\excercizes\qt_projects\7500\bin\debug\7500.exe...done.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.3
Copyright (C) 2011 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 "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set print elements -1
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set new-console on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> catch throw
Function "__cxa_throw" not defined.
Catchpoint 1 (throw)
>>>>>>cb_gdb:
> directory C:/excercizes/QT_projects/7500/
>>>>>>cb_gdb:
> break "C:/excercizes/QT_projects/7500/main.cpp:7"
Breakpoint 2 at 0x4013cf: file C:\excercizes\QT_projects\7500\main.cpp, line 7.
>>>>>>cb_gdb:
> run
gdb: windows_init_thread_list
[New Thread 4608.0x1540]
Breakpoint 2, main (argc=1, argv=0x4f0ec0) at C:\excercizes\QT_projects\7500\main.cpp:7
c:\excercizes\qt_projects\7500\main.cpp:7:133:beg:0x4013cf
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:
> whatis foo
type = std::string
>>>>>>cb_gdb:
> output foo
{static npos = <optimized out>, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x4f0eec "1234567avavav"}}>>>>>>cb_gdb:
> whatis argc
type = int
>>>>>>cb_gdb:
> output argc
1>>>>>>cb_gdb:
> quit
By the way, I do want to thank you obfuscated for helping me with this problem. Most appreciated. Especially that I really do like cb more and more and it was upsetting me that I wouldn't be able to use it for debugging and will have to use vs. Luckily things aren't as bad as I thought. Thanks.