External functions returning C_DOUBLE are called twice (bug?)

new topic     » topic index » view thread      » older message » newer message

Forked from Re: Phix+EuGTK

petelomax said...
irv said...

double hello(double x) 
Can anybody explain why I get two hello's?

LOL.

LOL indeed. It certainly looks like the function is being called twice. Very not good. One call is directly from call_c() and the second is from icall_x86_64(), which is called by call_c().

Here's a stack trace showing the function calls. I'll need to run this against a debug build to get a better stack output and see what's going on. Currently I'm just using the 4.1 beta build.

$ gdb eui 
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1 
Reading symbols from eui...(no debugging symbols found)...done. 
(gdb) break hello 
Function "hello" not defined. 
Make breakpoint pending on future shared library load? (y or [n]) y 
Breakpoint 1 (hello) pending. 
(gdb) run libmytest.e 
Starting program: /usr/local/bin/eui libmytest.e 
[Thread debugging using libthread_db enabled] 
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 
 
Breakpoint 1, 0x00007ffff701f62e in hello () from ./libmytest.so 
(gdb) bt 
#0  0x00007ffff701f62e in hello () from ./libmytest.so 
#1  0x000000000057b074 in call_c () 
#2  0x00000000005780e3 in do_exec () 
#3  0x0000000000578a63 in Execute () 
#4  0x000000000057d301 in start_backend () 
#5  0x000000000057def8 in machine () 
#6  0x00000000004274be in _68BackEnd () 
#7  0x00000000004fe69c in _2BackEnd () 
#8  0x00000000004fa93a in _74main () 
#9  0x000000000041e0bf in main () 
(gdb) cont 
Continuing. 
Hello! Your number was 123.456 
 
Breakpoint 1, 0x00007ffff701f62e in hello () from ./libmytest.so 
(gdb) bt 
#0  0x00007ffff701f62e in hello () from ./libmytest.so 
#1  0x000000000057a590 in icall_x86_64 () 
#2  0x000000000057b09d in call_c () 
#3  0x00000000005780e3 in do_exec () 
#4  0x0000000000578a63 in Execute () 
#5  0x000000000057d301 in start_backend () 
#6  0x000000000057def8 in machine () 
#7  0x00000000004274be in _68BackEnd () 
#8  0x00000000004fe69c in _2BackEnd () 
#9  0x00000000004fa93a in _74main () 
#10 0x000000000041e0bf in main () 
(gdb) cont 
Continuing. 
Hello! Your number was 123.456 
Got back: 246.912 
warning: Temporarily disabling breakpoints for unloaded shared library "./libmytest.so" 
[Inferior 1 (process 2575) exited normally] 
(gdb) quit 

-Greg

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu