I would do something like this:

ps -ef | grep mserver5
> dude    27387 27358  0 17:46 ?        00:00:00 /usr/local/bin/mserver5 --set gdk_d...
sudo gdb $(which mserver5) 27387

(gdb) b binaryCopy
Breakpoint 1 at 0x7f71ef7b4000: file svom.c,...
(gdb) continue
<start mclient, test>

But if the error happens before hitting your function, I don't know how to debug.

On 06/26/2013 08:10 AM, hlfwm hlfwm wrote:
i defined a user defined function "binarycopy",when i use my function, there is error:
sql>select binarycopy('starid','1111',1);
TypeException:user.s1_1[5]:'svom.binarycopy' undefined in: _9:any := svom.binarycopy(_6:str, _7:str, _8:int)
program contains errors

i want to debug the error with mal, there also some error:

[svomhpc@localhost /home/data1]$>mclient -l mal -u monetdb -d mydb4
password:
Welcome to mclient, the MonetDB interactive terminal (unreleased)
Type \q to quit, \? for a list of available commands
mal>
mal>
mal>function test(i:int):str;
mal>io.print(i);
mal>i:=i*2;
mal>b:=bat.new(:int,:int);
mal>bat.insert(b,1,i);
mal>io.print(b);
mal>return test:= "ok";
mal>end test;
MAPI  = (monetdb) /tmp/.s.monetdb.50000
QUERY = end test;
ERROR = !TypeException:user.test[3]:'bat.new' undefined in: b:any := bat.new(_5:int, _6:int)
        !TypeException:user.test[4]:'bat.insert' undefined in: _7:any := bat.insert(b:any, _8:int, i:int)
mal>

could anyone tell me how to debug my function ,please?

Thanks!