2

I want to confirm that the 3rd party lib on an android app is working properly and catching all native crashes/reporting them.

Surprisingly, i can't find any each ways to do so. what's the simplest and quickest way to do this on Android? (ideally, triggerable by pressing a button).

i.e. on C you can do

int main(void)
{
    char *s = "hello world";
    *s = 'H';
}

that's pretty simple. what's the equivalent in Android?

**Edit: in Android APPLICATION code. no use of native code.

David T.
  • 22,301
  • 23
  • 71
  • 123
  • You could attach the ndk-gdb debugger and use it inject a fault condition? http://stackoverflow.com/questions/10534367/how-to-get-ndk-gdb-working-on-android – Barend Jul 24 '14 at 19:43
  • i'm not sure how that work all too well. would you be willing to explain it in an answer with more detail? do i have to install some library? – David T. Jul 24 '14 at 23:56
  • I've never done native development, so I can't really help you there. The ndk-gdb is a debugger, it's conceptually similar to the debugger that you use for Java development, but you'll have to figure it out yourself or get someone else to explain it, sorry. – Barend Jul 25 '14 at 08:13
  • 1
    Not in a documented way, I'm afraid. Java is meant to protect against those. Maybe by manipulating, via reflection, private fields of system classes... – Seva Alekseyev Jan 22 '15 at 02:56

1 Answers1

0

If you look at bionic/libc/unistd/abort.c it does the following to trigger a seg fault

*((char*)0xdeadbaad) = 39;

hanDerPeder
  • 397
  • 2
  • 12