Android port version

Messages in english

Modérateur : xcasadmin

leonelhs
Messages : 3
Inscription : mer. juil. 04, 2012 6:14 pm

Android port version

Message par leonelhs » jeu. juil. 05, 2012 12:05 am

I made an android arm port version of giac 0.9.8 whit gmp5.0.5, many test are exec well done but when I try to calculate this: integrate(1/sin(x),x) the app it crash whitout any debug information, I did add this options -frtti -fexceptions to enable dynamic_cast and let the compiler make the jni lib, as I said there is to many integrals so works fine ex: integrate(sin(x),x) result in -cos(x).

my cuestion ir how can I to debug the raize of the crash function for some operations, the adb don't show anything.

this is the jni:

jstring Java_org_giac_calculator_calc_Computer_resultFromGiac(JNIEnv* env, jobject thiz, jstring computation)
{
const char *compute = env->GetStringUTFChars(computation,0);

//string s = string(compute);

gen *g, e;

context * contextptr = 0;
context * contextptr2 = 0;
g= new gen(compute, contextptr);
e = eval(*g, contextptr2); //wen this sentence are exec, it crash only for integrate(1/sin(x),x),

__android_log_write(ANDROID_LOG_ERROR, "jni giac", e.print().c_str());

return env->NewStringUTF(e.print().c_str());
}

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Android port version

Message par parisse » jeu. juil. 05, 2012 6:54 am

Hello,

Interesting you could compile gmp for android, I did not succeed myself...
About your crash, I can not reproduce it with Androcas, our android port (using libtommath for big integers). I don't know what kind of debugger you can access (I have no experience myself in debugging android apps), if you can run gdb (either on the ARM port or on an x86 emulator port) then set a breakpoint in intg.cc at integrate_trig_fraction and run it step by step from here, maybe we can trace more precisely where the problem happens. Another suggestion would be to use
gen g
instead of
gen * g
(that way you do not need to delete the pointer)
and use a non-0 contextpointer
context ct; instead of context * contextptr2;
and call to eval with &ct instead of contextptr2.
You can also call protecteval instead of eval, that way if an exception happens, it will be catched and you will get a string describing the error as answer.

Répondre