Andreas Beschorner(deleted)
|
Problem debugging lambda expressions
|
Andreas Beschorner(deleted)
07/22/2011 10:46 AM
post87529
|
Problem debugging lambda expressions
Greetings all,
after waiting for a long time I was happy to see gcc 4.6.1 released for Momentics today. I installed it, changed my /etc
/.../default fiels and everything works fine. The compiler compiles debug and release version of a small testprogramm
without problems.
However, when I try debug the program which makes use of lambda expressions as functors, I cannot debug into the program
without getting the following error:
unknown symbol: _ZSt25__throw_bad_function_callv
ldd:FATAL: Could not resolve all symbols
The program itself is rather short:
#include <cstdlib>
#include <iostream>
#include <functional>
typedef std::function<float(float, float)> tTestfunc;
tTestfunc fsub = [](float x, float y) { return x - y; };
auto fadd = [](float x, float y) { return x + y; };
void compute(tTestfunc tf, float a, float b)
{
std::cout << "\n" << tf(a, b) << "\n";
}
int main()
{
compute(fsub, 2, 5);
compute(fadd, 5, 3);
}
Simply running the compiled executables works fine, but debugging seems to lead into the frequently discussed "empty
function" call problem. It arises as soon as I press F11 (start debugging) in the IDE.
Countercheck: The same program does can be debugged without problems in Visual Studio 2010 prof.
Here is the debug verbose output of IDE 4.7 -- thanks a lot for help in advance:
.gdbinit: No such file or directory.
19-gdb-set confirm off
19^done
(gdb)
20-gdb-set width 0
20^done
(gdb)
21-gdb-set height 0
21^done
(gdb)
22-interpreter-exec console echo
22^done
(gdb)
23-gdb-show prompt
23^done,value="(gdb) "
(gdb)
24-target-select qnx 192.168.243.3:8000
~"MsgNak received - resending\n"
MsgNak received - resending
~"Remote target is little-endian\n"
Remote target is little-endian
24^connected
(gdb)
25-gdb-set auto-solib-add on
25^done
(gdb)
26-gdb-set stop-on-solib-events 0
26^done
(gdb)
27-gdb-set stop-on-solib-events 1
27^done
(gdb)
28 attach 938022
&"attach 938022\n"
attach 938022
~"[New pid 938022 tid 1]\n"
[New pid 938022 tid 1]
~"0xb033f7e0 in ?? ()\n"
0xb033f7e0 in ?? ()
28^done
(gdb)
29-environment-directory C:/coding/projects/wm201106Base/workspace/testBug C:/coding/projects/wm201106Base/workspace/
testBug/.settings C:/coding/projects/wm201106Base/workspace/testBug/x86 C:/coding/projects/wm201106Base/workspace/
testBug/x86/o C:/coding/projects/wm201106Base/workspace/testBug/x86/o-g
29^done,source-path="C:/coding/projects/wm201106Base/workspace/testBug;C:/coding/projects/wm201106Base/workspace/testBug
/.settings;C:/coding/projects/wm201106Base/workspace/testBug/x86;C:/coding/projects/wm201106Base/workspace/testBug/x86/o
;C:/coding/projects/wm201106Base/workspace/testBug/x86/o-g;$cdir;$cwd"
(gdb)
30 info tidinfo
&"info tidinfo\n"
~"Threads for pid 938022 (C:\\coding\\projects\\wm201106Base\\workspace\\testBug\\x86\\o-g\\testBug_g)\nTid:\tState:\
tFlags:\n"
~"*1\t3\t0\n"
30^done
(gdb)
31-data-list-register-names
31^done,register-names=["eax","ecx","edx","ebx","esp","ebp","esi","edi","eip","eflags","cs","ss","ds","es","fs","gs","
st0","st1","st2","st3","st4","st5","st6","st7","fctrl","fstat","ftag","fiseg","fioff","foseg","fooff","fop","xmm0","xmm1
","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7","mxcsr","mm0","mm1","mm2","mm3","mm4","mm5","mm6","mm7"]
(gdb)
32-break-insert -t main
32^done,bkpt={number="1",type="breakpoint",disp="del",enabled="y",addr="0x0804899a",func="main",file="C:/coding/projects
/wm201106Base/workspace/testBug/testBug.cc",fullname="C:/coding/projects/wm201106Base/workspace/testBug/testBug.cc",line
="18",times="0"}
(gdb)
33-stack-info-depth
33^done,depth="1"
(gdb)
34-stack-list-frames 0 1
34^done,stack=[frame={level="0",addr="0xb033f7e0",func="??"}]
(gdb)
35-exec-continue
35^running
(gdb)
35*stopped,reason="exited",exit-code="01"
(gdb)
36-gdb-exit
36^exit
|
|
|
Ryan Mansfield(deleted)
|
Re: Problem debugging lambda expressions
|
Ryan Mansfield(deleted)
07/22/2011 11:00 AM
post87530
|
Re: Problem debugging lambda expressions
On 11-07-22 10:46 AM, Andreas Beschorner wrote:
> Greetings all,
>
> after waiting for a long time I was happy to see gcc 4.6.1 released for
> Momentics today. I installed it, changed my /etc/.../default fiels and
> everything works fine. The compiler compiles debug and release version
> of a small testprogramm without problems.
> However, when I try debug the program which makes use of lambda
> expressions as functors, I cannot debug into the program without getting
> the following error:
>
> unknown symbol: _ZSt25__throw_bad_function_callv
> ldd:FATAL: Could not resolve all symbols
Do you have libstdc++.6.0.16 on the target? If you still have
libstdc++.6.0.13 from gcc 4.4 on, you'll hit this unknown symbol error.
The reason it runs fine but by default the program is lazy bound at
runtime, but GDB forces immediate binding (i.e. LD_BIND_NOW).
Regards,
Ryan Mansfield
|
|
|
Andreas Beschorner(deleted)
|
AW: Problem debugging lambda expressions
|
Andreas Beschorner(deleted)
07/22/2011 11:09 AM
post87531
|
AW: Problem debugging lambda expressions
Ah, I guess this might be the problem. I will let you know on Monday whether it worked. Thanks in advance,
Andy
-----Ursprüngliche Nachricht-----
Von: Ryan Mansfield [mailto:community-noreply@qnx.com]
Gesendet: Freitag, 22. Juli 2011 17:01
An: general-ide
Betreff: Re: Problem debugging lambda expressions
On 11-07-22 10:46 AM, Andreas Beschorner wrote:
> Greetings all,
>
> after waiting for a long time I was happy to see gcc 4.6.1 released for
> Momentics today. I installed it, changed my /etc/.../default fiels and
> everything works fine. The compiler compiles debug and release version
> of a small testprogramm without problems.
> However, when I try debug the program which makes use of lambda
> expressions as functors, I cannot debug into the program without getting
> the following error:
>
> unknown symbol: _ZSt25__throw_bad_function_callv
> ldd:FATAL: Could not resolve all symbols
Do you have libstdc++.6.0.16 on the target? If you still have
libstdc++.6.0.13 from gcc 4.4 on, you'll hit this unknown symbol error.
The reason it runs fine but by default the program is lazy bound at
runtime, but GDB forces immediate binding (i.e. LD_BIND_NOW).
Regards,
Ryan Mansfield
_______________________________________________
General
http://community.qnx.com/sf/go/post87530
--
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.
|
|
|
Mario Charest
|
RE: Problem debugging lambda expressions
|
Mario Charest
07/22/2011 11:29 AM
post87532
|
RE: Problem debugging lambda expressions
> -----Message d'origine-----
> De : Andreas Beschorner [mailto:community-noreply@qnx.com]
> Envoyé : 22 juillet 2011 10:47
> À : general-ide
> Objet : Problem debugging lambda expressions
>
> Greetings all,
>
> after waiting for a long time I was happy to see gcc 4.6.1 released for
> Momentics today. I installed it, changed my /etc/.../default fiels and
> everything works fine. The compiler compiles debug and release version of a
> small testprogramm without problems.
Gcc 4.6.1 for momentics, where is it?
>
>
> However, when I try debug the program which makes use of lambda
> expressions as functors, I cannot debug into the program without getting
> the following error:
>
> unknown symbol: _ZSt25__throw_bad_function_callv
> ldd:FATAL: Could not resolve all symbols
>
> The program itself is rather short:
>
> #include <cstdlib>
> #include <iostream>
>
> #include <functional>
>
> typedef std::function<float(float, float)> tTestfunc; tTestfunc fsub = [](float
> x, float y) { return x - y; }; auto fadd = [](float x, float y) { return x + y; };
>
>
> void compute(tTestfunc tf, float a, float b) {
> std::cout << "\n" << tf(a, b) << "\n"; }
>
> int main()
> {
> compute(fsub, 2, 5);
> compute(fadd, 5, 3);
> }
>
> Simply running the compiled executables works fine, but debugging seems
> to lead into the frequently discussed "empty function" call problem. It arises
> as soon as I press F11 (start debugging) in the IDE.
>
> Countercheck: The same program does can be debugged without problems
> in Visual Studio 2010 prof.
>
> Here is the debug verbose output of IDE 4.7 -- thanks a lot for help in
> advance:
>
> .gdbinit: No such file or directory.
> 19-gdb-set confirm off
> 19^done
> (gdb)
> 20-gdb-set width 0
> 20^done
> (gdb)
> 21-gdb-set height 0
> 21^done
> (gdb)
> 22-interpreter-exec console echo
> 22^done
> (gdb)
> 23-gdb-show prompt
> 23^done,value="(gdb) "
> (gdb)
> 24-target-select qnx 192.168.243.3:8000
> ~"MsgNak received - resending\n"
> MsgNak received - resending
> ~"Remote target is little-endian\n"
> Remote target is little-endian
> 24^connected
> (gdb)
> 25-gdb-set auto-solib-add on
> 25^done
> (gdb)
> 26-gdb-set stop-on-solib-events 0
> 26^done
> (gdb)
> 27-gdb-set stop-on-solib-events 1
> 27^done
> (gdb)
> 28 attach 938022
> &"attach 938022\n"
> attach 938022
> ~"[New pid 938022 tid 1]\n"
> [New pid 938022 tid 1]
> ~"0xb033f7e0 in ?? ()\n"
> 0xb033f7e0 in ?? ()
> 28^done
> (gdb)
> 29-environment-directory
> C:/coding/projects/wm201106Base/workspace/testBug
> C:/coding/projects/wm201106Base/workspace/testBug/.settings
> C:/coding/projects/wm201106Base/workspace/testBug/x86
> C:/coding/projects/wm201106Base/workspace/testBug/x86/o
> C:/coding/projects/wm201106Base/workspace/testBug/x86/o-g
> 29^done,source-
> path="C:/coding/projects/wm201106Base/workspace/testBug;C:/coding/pro
> jects/wm201106Base/workspace/testBug/.settings;C:/coding/projects/wm2
> 01106Base/workspace/testBug/x86;C:/coding/projects/wm201106Base/wor
> kspace/testBug/x86/o;C:/coding/projects/wm201106Base/workspace/testB
> ug/x86/o-g;$cdir;$cwd"
> (gdb)
> 30 info tidinfo
> &"info tidinfo\n"
> ~"Threads for pid 938022
> (C:\\coding\\projects\\wm201106Base\\workspace\\testBug\\x86\\o-
> g\\testBug_g)\nTid:\tState:\tFlags:\n"
> ~"*1\t3\t0\n"
> 30^done
> (gdb)
> 31-data-list-register-names
> 31^done,register-
> names=["eax","ecx","edx","ebx","esp","ebp","esi","edi","eip","eflags","cs",
>...
View Full Message
|
|
|
Ryan Mansfield(deleted)
|
Re: Problem debugging lambda expressions
|
Ryan Mansfield(deleted)
07/22/2011 11:34 AM
post87533
|
Re: Problem debugging lambda expressions
On 11-07-22 11:29 AM, Mario Charest wrote:
> Gcc 4.6.1 for momentics, where is it?
http://community.qnx.com/sf/frs/do/viewRelease/projects.toolchain/frs.gcc.gcc_4_6
Regards,
Ryan Mansfield
|
|
|
Mario Charest
|
RE: Problem debugging lambda expressions
|
Mario Charest
07/22/2011 11:47 AM
post87536
|
RE: Problem debugging lambda expressions
> -----Message d'origine-----
> De : Ryan Mansfield [mailto:community-noreply@qnx.com]
> Envoyé : 22 juillet 2011 11:34
> À : general-ide
> Objet : Re: Problem debugging lambda expressions
>
> On 11-07-22 11:29 AM, Mario Charest wrote:
>
> > Gcc 4.6.1 for momentics, where is it?
>
> http://community.qnx.com/sf/frs/do/viewRelease/projects.toolchain/frs.gc
> c.gcc_4_6
>
Thanks, is that considered alpha, beta, official?
> Regards,
>
> Ryan Mansfield
>
>
>
> _______________________________________________
>
> General
> http://community.qnx.com/sf/go/post87533
>
|
|
|
Ryan Mansfield(deleted)
|
Re: Problem debugging lambda expressions
|
Ryan Mansfield(deleted)
07/22/2011 12:12 PM
post87537
|
Re: Problem debugging lambda expressions
On 11-07-22 11:47 AM, Mario Charest wrote:
> Thanks, is that considered alpha, beta, official?
It's considered experimental/beta. If there any issues please let us
know in the core development tools forums.
Regards,
Ryan Mansfield
|
|
|
Andreas Beschorner(deleted)
|
Re: Problem debugging lambda expressions
|
Andreas Beschorner(deleted)
07/25/2011 5:15 AM
post87555
|
Re: Problem debugging lambda expressions
Greetings again,
here is a problem I ran into using the new 4.6.1 compiler:
Getting a lof of undefined references to the atomic inbuilt gcc function __sync_fetch_and_add_4
which did not happen using the 4.4.2 compiler.
Hope it is not due to a flag the IDE sets when using x86 build variant...
Regards,
G.
|
|
|
Andreas Beschorner(deleted)
|
Re: Problem debugging lambda expressions
|
Andreas Beschorner(deleted)
07/25/2011 6:05 AM
post87559
|
Re: Problem debugging lambda expressions
It seems to be a combined IDE-compiler issue. The i386 architecture is sort of deprecated, and I guess the "i86" choice
in the IDE build variant flags -march=i386.
Adding -march=i486 to the compiler parameters solves the problem.
Greets,
G.
|
|
|
|