Author Topic: Cannot evaluate function -- may be inlined  (Read 21475 times)

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Cannot evaluate function -- may be inlined
« on: November 05, 2011, 04:21:22 pm »
While debugging and trying to watch  std::string obj I'm getting the following info:
Cannot evaluate function -- may be inlined;
Is this behavior intentional?

zabzonk

  • Guest
Re: Cannot evaluate function -- may be inlined
« Reply #1 on: November 05, 2011, 05:14:30 pm »
Intentional in what way? It's an inevitable result of the way that inlining works - if a function actually is inlined,  there is no named function representation in the compiled code to watch.

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #2 on: November 05, 2011, 06:49:30 pm »
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:
Code: [Select]
#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;
}

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #3 on: November 05, 2011, 06:57:32 pm »
Same here:
Code: [Select]
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]
        }

    }
« Last Edit: November 05, 2011, 06:59:15 pm by smallB »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12005
    • Travis build status
Re: Cannot evaluate function -- may be inlined
« Reply #4 on: November 05, 2011, 07:33:27 pm »
Does it work, when you debug with GDB directly from the command line?
Do you have debugging symbols? Have you disabled the optimizations?
(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!]

zabzonk

  • Guest
Re: Cannot evaluate function -- may be inlined
« Reply #5 on: November 05, 2011, 07:44:31 pm »
@smallB

If you haven't worked it out by now, CB is not a debugger. As a convenience, it provides an interface to the GDB debugger (and possibly to others). If you have questions about GDB features and "intentions", post them on the GDB site. But if you are expecting the CB/GDB combination (particularly on Windows) to be as powerful, full featured and easy to use as Microsoft's debugger, you are going to be very, very disappointed.

However, even the MS debugger cannot watch (as opposed to step through)  functions that actually have been inlined. If the MS environment is allowing you to watch those functions, then they haven't been inlined by the MS compiler.
« Last Edit: November 05, 2011, 07:57:32 pm by Neil Butterworth »

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Cannot evaluate function -- may be inlined
« Reply #6 on: November 05, 2011, 10:16:36 pm »
Sry to interfere here. Is that applicable only to the inline function definitions in a class or any function defined inline globally.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12005
    • Travis build status
Re: Cannot evaluate function -- may be inlined
« Reply #7 on: November 05, 2011, 10:34:09 pm »
scarphin: There is no difference I guess. In the end the methods of a class are compiled as a functions with hidden this parameter.
(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 smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #8 on: November 06, 2011, 10:47:53 am »
@Neil, yes I do understand that(cb is not a debugger, yes I know...(in Tomy Saxondale style)) but surely this can change (I mean gdb can become a better debugger than it is now and in feature better debugger than MS). If cb could became better IDE then VS, surely gdb could become better dbg?
As things are for the moment this particular behavior of gdb makes cb unusable for debugging. For me anyway.
« Last Edit: November 06, 2011, 10:51:28 am by smallB »

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #9 on: November 06, 2011, 10:56:27 am »
@obfuscated I would have no idea how to use debugger from command line. yes I do have debugging symbols, yes, optimizations are disabled.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12005
    • Travis build status
Re: Cannot evaluate function -- may be inlined
« Reply #10 on: November 06, 2011, 11:01:37 am »
Every decent program has a manual or search the internet. It is not that hard.
(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!]

zabzonk

  • Guest
Re: Cannot evaluate function -- may be inlined
« Reply #11 on: November 06, 2011, 12:15:23 pm »
@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:

Code: [Select]
#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() );
}

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #12 on: November 06, 2011, 02:38:23 pm »
@Neil, perhaps I'm doing something wrong.
this code:
Code: [Select]
#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/
« Last Edit: November 06, 2011, 02:40:23 pm by smallB »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: Cannot evaluate function -- may be inlined
« Reply #13 on: November 06, 2011, 02:45:54 pm »
gives following output:
Here, the compiler might simply has optimised out the std::string as it is not being used. Make sure it's being used (i.e. output it on the console) and try again.

Furthermore: This is actually not a C::B issue. To differ between a C::B and a GDB issue, try to debug at the command line. If it shows the same result, then it's basically "your fault" as C::b is just an interface to GDB.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

zabzonk

  • Guest
Re: Cannot evaluate function -- may be inlined
« Reply #14 on: November 06, 2011, 02:52:20 pm »

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #15 on: November 06, 2011, 02:53:58 pm »
@Morten, I don't want to go into discussion who's fault is it when debugger doesn't show value of a variable (assuming that I set the settings in debugger correctly). It's just waste of time.
This is output from cb when string is used:
http://imageshack.us/photo/my-images/513/cannotevaluate1.png/

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #16 on: November 06, 2011, 02:55:27 pm »
@Neil, that looks good! What settings am I suppose to set in order to "have what you've got"?

zabzonk

  • Guest
Re: Cannot evaluate function -- may be inlined
« Reply #17 on: November 06, 2011, 03:02:48 pm »
@smallB:

That is just an ordinary debug build, with no optimisations, using the CB debug nightly, SVN 7452. The version of GCC I use is TDM 4.6.1 and the version of GDB is 7.3 - the one that comes with the TDM GCC build.

Note that the GCC optimiser is very aggressive, and does not know anything about "debug builds". If you have any optimisations enabled at all, then all the code in main() will probably be removed, whether you have debug info enabled with -g or not.


Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #18 on: November 06, 2011, 03:13:16 pm »
@Neil, thanks for your reply. Neil, I have cb 7550, and gcc ver same as yours. I've checked compiler settings and they are checked(see three images for - project settings, compiler_settings_general and debugger_settings):
http://imageshack.us/photo/my-images/171/compilersettingsglobal.png/
http://imageshack.us/photo/my-images/13/projectcompilersettings.png/
http://imageshack.us/photo/my-images/600/debuggersettings.png/

zabzonk

  • Guest
Re: Cannot evaluate function -- may be inlined
« Reply #19 on: November 06, 2011, 03:29:53 pm »
@smallB:

Yes, but what about these settings http://imgur.com/Kym4P ? All of them should be unchecked.

Also, the image of the code you posted in response to Morten is different from the code I am responding about. You have now posted at least three different chunks of code. Please identify, once and for all, which one you are asking about - and please make it simple, and compilable with no external dependencies.





Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #20 on: November 06, 2011, 05:30:02 pm »
@Neil sorry for the disconnection. Neil, let's talk about the simplest code example which is main to string obj.
Code: [Select]
#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)

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Cannot evaluate function -- may be inlined
« Reply #21 on: November 06, 2011, 06:47:29 pm »
Please do a full rebuild with full commandline enabled (or with enabled html log) and post he content of the build log or the html-log here (wherever the full commandline send to gcc/g++ is shown).
Without that it does not make any sense to discuss more.

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #22 on: November 06, 2011, 07:35:57 pm »
Hi Jens, this is build log:
-------------- Clean: Debug in 7500 ---------------

Cleaned "7500 - Debug"

-------------- Build: Debug in 7500 ---------------

g++.exe -Wall -g  -std=c++0x -Wextra -Wall -g  -std=c++0x -Wfatal-errors -Wextra -Wall -g   -IC:\excercizes\QT_projects\7500 -IC:\excercizes\QT_projects\7500 -c C:\excercizes\QT_projects\7500\main.cpp -o obj\Debug\main.o
C:\excercizes\QT_projects\7500\main.cpp:4:9: warning: unused parameter 'argc' [-Wunused-parameter]
C:\excercizes\QT_projects\7500\main.cpp:4:9: warning: unused parameter 'argv' [-Wunused-parameter]
mingw32-g++.exe -LC:\QtSDK\Desktop\Qt\4.7.4\mingw\lib  -o bin\Debug\7500.exe obj\Debug\main.o   
Output size is 75.46 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 2 warnings (0 minutes, 1 seconds)
Build log saved as:
file://C:/excercizes/QT_projects/7500/7500_build_log.html

zabzonk

  • Guest
Re: Cannot evaluate function -- may be inlined
« Reply #23 on: November 06, 2011, 08:06:37 pm »
@smallB:

My last post to you here, as I've become convinced that you are actually a troll. Nobody but a troll could keep up this steady flow of nearly comprehensible, but always vague crap. But still, in my last post I will try to be useful:

  • Post the complete HTML build log as an attachment.
  • Explain why you are using g++.exe in one place and mingw32-g++.exe in another.
  • Post your entire project somewhere (not here) that people can look at.


And with that, good-bye!

« Last Edit: November 06, 2011, 08:10:05 pm by Neil Butterworth »

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #24 on: November 06, 2011, 08:21:20 pm »
@Neil, I am astonished after reading your last post. Never expected to hear anything like this while asking for help. Yes I think it will be better if you'd never reply to any of my future post. I cannot believe that anyone could think about me as a troll. I on the other hand have every reason to call you pig arrogant, boorish individual. And with that good bye you ignorant pig.
And just to prove (to others not to you) that I've never meant anything except getting help:
To answer to your question from previous post:
1. http://pastebin.com/GUPg9PvL
2. Cannot explain - don't know, probably have some settings wrongly set. That's one of the reasons I'm asking here for help.
3. http://www.mediafire.com/?kke26hj2zggk3za

Neil, you ignorant, rude pig.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12005
    • Travis build status
Re: Cannot evaluate function -- may be inlined
« Reply #25 on: November 06, 2011, 08:29:42 pm »
Both of you are fun to read :)
Both are half-trolls, by the way :)
Unfortunately, I've run out of Coke :(, but if you continue in this fashion, I'll have to go to get some.

smallB: please put a description for you links, because the links look random.

2. Cannot explain - don't know, probably have some settings wrongly set. That's one of the reasons I'm asking here for help.
I can, you have different values for c++ compiler and linker.
Please go to your toolchain settings and hit auto detect :)
Then read a gdb manual and try some command line debugging.

You can enable the full log from the debugger, not the normal one, but the debugger's debug log, which should be enabled in the debugger's settings.
And post it here.
If you post the normal debug log, I'll ignore the topic, so read carefully!

p.s. please use code tags for pastes embedded in the posts.
(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 smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #26 on: November 06, 2011, 08:38:49 pm »
@obfuscated
1. After hitting auto detect I still see mingw32-g++.exe as a linker. Am I suppose to have g++ as a linker too? If needs be I'm prepared to make video file with camtasia and post it.
2. In settings/debugger/common: display debugger's log - that box I've checked just now.
3. 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:

-------------- Clean: Debug in 7500 ---------------

Cleaned "7500 - Debug"

-------------- Build: Debug in 7500 ---------------

g++.exe -Wall -g  -std=c++0x -Wextra -Wall -g  -std=c++0x -Wfatal-errors -Wextra -Wall -g   -IC:\excercizes\QT_projects\7500 -IC:\excercizes\QT_projects\7500 -c C:\excercizes\QT_projects\7500\main.cpp -o obj\Debug\main.o
C:\excercizes\QT_projects\7500\main.cpp:4:9: warning: unused parameter 'argc' [-Wunused-parameter]
C:\excercizes\QT_projects\7500\main.cpp:4:9: warning: unused parameter 'argv' [-Wunused-parameter]
mingw32-g++.exe -LC:\QtSDK\Desktop\Qt\4.7.4\mingw\lib  -o bin\Debug\7500.exe obj\Debug\main.o    
Output size is 75.46 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 2 warnings (0 minutes, 1 seconds)
Build log saved as:
file://C:/excercizes/QT_projects/7500/7500_build_log.html
 

Thanks
P.S. gotta go, will check your answer tomorrow.
« Last Edit: November 06, 2011, 08:41:51 pm by smallB »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12005
    • Travis build status
Re: Cannot evaluate function -- may be inlined
« Reply #27 on: November 06, 2011, 08:45:45 pm »
Hm, you're not reading mate!
I've said the debugger's debug log, you're pasting me the compiler's log.
I've said use code tags, you're pasting directly.

Please don't waste our time.

This is pretty strange that auto-detect is putting the g++ and mingw32-g++.exe in the options. I don't know what are the correct values for windows. So other dev should tell.
(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 stahta01

  • Lives here!
  • ****
  • Posts: 6636
    • My Best Post
Re: Cannot evaluate function -- may be inlined
« Reply #28 on: November 06, 2011, 09:41:59 pm »
This is pretty strange that auto-detect is putting the g++ and mingw32-g++.exe in the options. I don't know what are the correct values for windows. So other dev should tell.

Confirmed with CB 10.05; if they are manually set to g++ and mingw32-g++.exe in the options; doing auto detect will not change them to the normal values.

I consider the above the correct way to do it; just not the way I expected to happen

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Cannot evaluate function -- may be inlined
« Reply #29 on: November 06, 2011, 09:50:32 pm »
g++.exe and mingw32-g++.exe are the same in most cases, but in broken installs, they might differ, so use either the one or the other in both places (same is for gcc, either with or without mingw32-prefix, but the same as for g++).

And you really should learn to read and follow the advices you get.
And the debuggers debug-log is not really hard to find, it's in "Logs & others" like the other logs, maybe you should search for it.

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #30 on: November 07, 2011, 08:25:34 am »
@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:

Quote
"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):
Code: [Select]
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.
« Last Edit: November 07, 2011, 08:55:20 am by smallB »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12005
    • Travis build status
Re: Cannot evaluate function -- may be inlined
« Reply #31 on: November 07, 2011, 10:24:24 am »
Yes, this is the log, but where is no watch evaluation there.
So, after you stop on a breakpoint you should add a watch, both  to a string and to an int variable and then paste the log again.
Also you can try to disable the option "Enable watch scripts", it is in the debugger option. And paste the output from the debugger again.
(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 jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Cannot evaluate function -- may be inlined
« Reply #32 on: November 07, 2011, 10:36:44 am »
And don't forget to have the watches-window open !

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #33 on: November 07, 2011, 11:19:09 am »
@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):
Code: [Select]
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.
« Last Edit: November 07, 2011, 11:38:23 am by smallB »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Cannot evaluate function -- may be inlined
« Reply #34 on: November 07, 2011, 01:03:47 pm »
@smallB
You can show the contents of "std::string" by using gdb's pretty printer, have a look at:GDB - qp-gcc - QP's GCC/MinGW32 Builds - Google Project Hosting
This wiki was created by me some months ago. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #35 on: November 07, 2011, 02:29:42 pm »
@ollydbg thanks, will check it.

Offline smallB

  • Almost regular
  • **
  • Posts: 193
Re: Cannot evaluate function -- may be inlined
« Reply #36 on: November 07, 2011, 02:36:47 pm »
Hey ollydbg, I've checked it and it is just superb! Muchas gracias! I just love cb.