[racket-dev] Building Racket with the Android NDK

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Aug 30 10:03:52 EDT 2012

Here's something different to try:

In "src/racket/gc2/sighand.c", change to initialize_signal_handler() to
set `gc->generations_available = 0' and return install of installing
signal handlers. That should disable generational GC and the associated
write barrier.

At Thu, 30 Aug 2012 13:39:52 +0100 (BST), Jan Wedekind wrote:
> On Sat, 25 Aug 2012, Matthew Flatt wrote:
> > At Sat, 25 Aug 2012 20:04:45 +0100 (BST), Jan Wedekind wrote:
> >> I tried to debug
> >> However then the
> >> program reports the following segmentation fault instead:
> >>
> >>      Program received signal SIGSEGV, Segmentation fault.
> >>      0x00282540 in scheme_gmp_tls_unload (s=0x4031cedc, data=0x0) at
> >> ./gmp/gmp.c:5813
> >>      5813      s[0] = 0;
> >>      (gdb) l
> >>      5808    void scheme_gmp_tls_unload(intptr_t *s, void *data)
> >> [...]
> >>
> >> According to [2] this is a GC write barrier and one needs to ignore
> >> semgentation faults as follows
> >>
> >>      (gdb) handle SIGSEGV nostop noprint
> >
> > Yes.
> >
> >> But in that case it is not possible to debug the initial segmentation fault
> >> though.
> >
> > Does it work to set a breakpoint on abort()?
> >
> > (gdb) br abort
> >
> >
>    Thanks. That seems to ignore the GC write barrier related signals. 
> Unfortunately there is no debug information for the stack frame 
> (0xffff050c) of the current crash:
> 
> jan at wedemob:~$ 
> ~/android-ndk-r8b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
> /arm-linux-androideabi-gdb 
> GNU gdb (GDB) 7.3.1-gg2
> Copyright (C) 2011 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "--host=x86_64-linux-gnu 
> --target=arm-linux-android".
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> (gdb) target remote 192.168.0.3:1234
> Remote debugging using 192.168.0.3:1234
> 0xb0001000 in ?? ()
> (gdb) file /home/jan/build/cross/racket-5.3.0/src/racket/racket3m 
> A program is being debugged already.
> Are you sure you want to change the file? (y or n) y
> Reading symbols from 
> /home/jan/build/cross/racket-5.3.0/src/racket/racket3m...done.
> (gdb) cont
> Continuing.
> Cannot access memory at address 0x0
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00282540 in scheme_gmp_tls_unload (s=0x4031cedc, data=0x0) at 
> ./gmp/gmp.c:5813
> 5813      s[0] = 0;
> (gdb) up
> #1  0x0024b390 in done_with_GC () at xsrc/thread.c:8739
> 8739      scheme_gmp_tls_unload (scheme_current_thread -> gmp_tls , 
> scheme_current_thread -> gmp_tls_data ) ; 
> (gdb) handle SIGSEGV nostop noprint
> Signal        Stop      Print   Pass to program Description
> SIGSEGV       No        No      Yes             Segmentation fault
> (gdb) br abort
> Breakpoint 1 at 0x22658
> (gdb) cont
> Continuing.
> 
> Breakpoint 1, 0x00022658 in abort ()
> (gdb) up
> #1  0x0028ce30 in fault_handler (sn=11, si=0x3437a8, ctx=0x343828) at 
> ./sighand.c:99
> 99          abort();
> (gdb) 
> #2  0xffff050c in ?? ()
> (gdb) 
> #3  0xffff050c in ?? ()
> (gdb) 
> Initial frame selected; you cannot go up.
> (gdb) cont
> Continuing.
> 
> Breakpoint 1, 0x00022658 in abort ()
> (gdb) up
> #1  0x0028ce30 in fault_handler (sn=11, si=0x3433f0, ctx=0x343470) at 
> ./sighand.c:99
> 99          abort();
> (gdb) 
> #2  0xffff050c in ?? ()
> (gdb) 
> #3  0xffff050c in ?? ()
> (gdb) 
> Initial frame selected; you cannot go up.
> (gdb) cont
> Continuing.
> 
> Breakpoint 1, 0x00022658 in abort ()
> (gdb) up
> #1  0x0028ce30 in fault_handler (sn=11, si=0x343038, ctx=0x3430b8) at 
> ./sighand.c:99
> 99          abort();
> (gdb) 
> #2  0xffff050c in ?? ()
> (gdb) 
> #3  0xffff050c in ?? ()
> (gdb) 
> Initial frame selected; you cannot go up.
> (gdb)
> 
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev

Posted on the dev mailing list.