How to handle a NullPointerException
Andrew Haley
aph@redhat.com
Thu Feb 21 10:56:00 GMT 2008
Dimiter Stamenov wrote:
> >Dimiter Stamenov wrote:
> >> >Do simple programs work?
> >>
> >> Hi Andrew, yes, all other programs I have compiled work fine, except this.
> >> It is supposed just to take the text from a MS Word file, but until that
> >> moment I have not succeed to do that with gcj compiled version...
> >
> >We'll have to take this in stages. Can you usually get a backtrace out of gdb?
> >
> >If not, we might have to try `-finstrument-functions'. You'll find
>> Thanks, `-finstrument-functions' seems very useful option. I have read the documentation but could not realize how to define __cyg_profile_func_enter and __cyg_profile_func_exit?
__cyg_profile_func_enter() is just a C function that takes two void* args
void __cyg_profile_func_enter( void *this, void *callsite )
Define it and link with your program.
Do *not* compile this C code with `-finstrument-functions'.
Andrew.
void __cyg_profile_func_enter( void *this, void *callsite )
{
/* Function Entry Address */
fprintf(fp, "E%p\n", (int *)this);
}
void __cyg_profile_func_exit( void *this, void *callsite )
{
/* Function Exit Address */
fprintf(fp, "X%p\n", (int *)this);
}
More information about the Java
mailing list