Add posix API as a set of perl hashes

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
Better define always/never wrapped APIs in terms of POSIX

never wrap string functions or math functions

always wrap everything else

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
Allow ELF syscall extraction to prioritize always/never lists

When defining the white (always wrap) and black (never wrap) lists in terms of
POSIX APIs, there can be symbols that appear in both lists. For example, we want
to wrap all POSIX thread APIs, except pthread_mutex_lock/unlock. These symbols
will appear in both the white and black lists.

To choose between them, there is now a new option: "-prio [1|2]".
1 == check "always" list first (prioritize the white list)
2 == check "never" list first (prioritize the black list)

default is 2 (prioritize the black list)

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
Update wraplib.sh to use "-prio" symbols parsing arg

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
don't wrap some memory/thread fcns for now

The goal is to revert this commit later on by providing a way to efficiently log
these functions.

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
Move BT log size to _after_ log buffer, fixup bt_printf

Hopefully this will fix the occasional "4 bytes of zero" bug

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
Provide an easy way to export all symbols for debugging

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
Log DVM backtraces on JNI calls

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
bugfix! libdvm low-level interface sucks

There is at least one obscure bug in dvmGetThreadName() that causes occasional
crashes. We don't really need the java thread name, so I've just disabled it.

A more insidius offender is the dvmFillStackTraceArray() function. It takes an
array and a length as parameters and fills in the method pointers corresponding
to the Dalvik stack. However, it effectively ignores the length parameter, and
proceeds to continue writing into memory beyond the bound of your array if the
actual stack is too big for your array. Thanks guys.

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
bugfix! guard against bad/invalid unwind info

This issue shows up when there is bad/corrupt/invalid unwind information
somewhere in the middle of your stack trace. In manifests itself as an infinite
loop where the trace function gets called indefinitely with the same frame
pointer.

I put a max recursion depth counter on my tracing state structure to guard
against this, and cut off the tracing if we're not doing anymore valid work.

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
bugfix! check for library init recursion, and other NULL dereferences

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>
Move wrapped cache to flag based creation

better way of adding functionality... like say a couple extra flags :-)

Signed-off-by: Jeremy C. Andrus <jeremya@cs.columbia.edu>