Move elf_loader_t to module.c and link it into the injector

Ptrace injection will use the ELF loader to map DR into the injectee.

module.c is general ELF utility code, while loader.c is tied to the
private loader.  Therefore module.c is more appropriate to link into
the injector.

Additional NOT_DYNAMORIO_CORE ifdefs were needed to make the link
succeed.

Review URL: https://codereview.appspot.com/6899053

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1838 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fix broken non-short-suite builds

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1839 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Fix the STATIC_LIBRARY build for gcc-4.7 ia32

The prefix for these special thunks changed from __i686 to __x86 between
gcc4.6 and 4.7.

Review URL: https://codereview.appspot.com/7145044

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1840 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fixes issue 1055

Added drmgr_current_bb_phase().  Added a call to it from
drutil_expand_rep_string_ex() to ensure it's used properly.

Added a USAGE_ERROR to drutil_expand_rep_string_ex() if meta instrs exist.

Tested on the memtrace,inscount order from the issue.

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1841 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fix message w/ pointer to cmake bug

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1842 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Restore /debug to client libs in tests

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1843 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#1061: Check fragment flag compatibility for new unexpected vmareas

When we flush code from non-module vmareas, we remove the area completely.
When we re-execute it, we re-add the area, and we check whether to sandbox
it based on stats in written_areas.  The current flag compatibility check
happens before re-adding the area, but we should also check compatibility
after adding the area.

Fixes issue 1061.

Review URL: https://codereview.appspot.com/7135057

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1844 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Add bbbuf sample to demonstrate how to use TLS field for per-thread profiling
Add DR_REG_START/STOP_GPR in instr.h for general registers range

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1845 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Make sure instr_decode_with_current_dcontext() isn't inlined in instr.c

This is a micro-optimization that saves ~800 bytes of .text and has negligible
impact on execution time.  It just shows up as cold code in things like
instr_is_exit_cti(), which are what I'm really trying to optimize.

Review URL: https://codereview.appspot.com/7179050

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1846 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Internally inline instr flag predicates

This results in a ~2% speedup in DumpRenderTree.

Review URL: https://codereview.appspot.com/7133066

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1847 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Avoid dead conditional decodes in instr_is_cti and instr_is_exit_cti

These predicates call down to many other predicates which each call
instr_get_opcode() individually.  Each instr_get_opcode() does an opcode
check and generates dead code to decode the opcode.  Worse, because the
decode could modify the instr flags, this confuses alias analysis, so
further flags checks must reload and retest flags.

By using opcode predicates, which get inlined into each instr predicate,
we get a ~2% improvement on DumpRenderTree.

Review URL: https://codereview.appspot.com/7198046

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1848 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fixes issue 1055

More complete fix for original r1841: handle meta instrs in
drutil_expand_rep_string_ex() as they're added by drwrap_replace_native()
and other app2app xforms.

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1849 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Add links to event registration routines to the event list in the
documentation

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1850 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Add a hashtable instantiation with strings as the key.
This is needed for more efficient loader redirection for replacing more and
more of kernel32.dll.

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1851 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Part of i#1063: system library replacement: refactor redirection.

Refactor Windows system library redirection out of loader.c and into
separate files per module in new core/win32/drwinapi/ directory.

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1852 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Part of i#1063: system library replacement: use hashtables.

Switch to using hashtables to look up redirection routines, rather than a
linear walk.  Hundreds of new routines will be added, necessitating a more
efficient lookup.

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1853 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#1063: system library replacement: kernel32 decls.

Add declarations and skeleton support for the 200+ kernel32 routines we
want to intercept: the union of C++, msvcrt, and dbghelp imports.
There is no implementation for any of the new ones, but with the headers
there it makes it easy to start incrementally implementing them.

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1854 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Remove WINAPI from nt_raw routines, to match the conventions of DR-internal routines.

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1855 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fix VS2008 build failures from r1854

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1856 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#1063: system library replacement: rpcrt4.

Add infrastructure support for replacing rpcrt4 routines.

Add implementation of redirect_UuidCreate().
Add unit test for redirect_UuidCreate().

git-svn-id: https://dynamorio.googlecode.com/svn/trunk@1857 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6