add support for drwrap_replace_native() at a call site

+ change interface (still marked experimental and not in any official
  release so no major compat worries) to take in "bool at_entry"

+ for call site replacement, if target instr is OP_call or OP_call_ind,
  app retaddr is pushed prior to regular replacement sequence.  this
  is much simpler than forcing the client to do a two-step replacement
  with fake code as an intermediary.

+ added a test of call site replacement to drwrap-test

this helps fix DrMem i#965: http://code.google.com/p/drmemory/issues/detail?id=965

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1539 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#875: ntdll!RtlpFlsLock lock isolation
+ It's not easy to isolate this lock while sharing the app's ntdll, so
  I put in a workaround: release thread_initexit_lock before
  running the private lib thread init code.

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1540 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
documentation updates:
+ fix dr_get_milliseconds and underlying routine docs
+ fix opnd_get_immed_int() comment
+ remove /nodefaultlib from sample build cmdlines

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1541 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fixes issue 872
+ standardized dr_get_milliseconds() and internal query_time_* on
  the UTC epoch

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1542 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Make memory reference operands use 64-bit regs in order to save the
addr32 prefix.

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1543 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#521: Don't leave data unprotected while re-reading the config

Fixes issue 521, which was the datasec_not_prot curiosity in the nightly suite.

Use a heap allocated buffer to store values while re-reading the config.
config_reread is called in fragile places, so it cannot make any heap
allocations due to layering issues.  The initial config read happens
before heap initialization, so DR has to call back into config to
initialize the heap allocated buffer.

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

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1545 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#449: drsyms memory management

+ Added drsym_free_resources() to allow a client to free debug info
  resources, typically at the end of the module load event.
+ Added docs and a does-it-crash test.

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1546 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#751: Fix x86_to_x64 translation of call [esp].

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1547 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fixes issue 878

use proper fini array size and check for null

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1548 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Clang: Implement portable asm for tests to get their own retaddr.

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

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1549 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#47: Use an ELF entry point instead of LD_PRELOAD for early injection

By adding an entry point, we can invoke libdynamorio.so as an
executable.  It is still marked as type ET_DYN, but the kernel will go
ahead and load us in the usual way.  We get to look at argc, argv, envp,
and auxv first, and fix them up to match what the kernel would have done
for the app.

It is now possible to use early injection to run both statically and
dynamically linked apps.

Instead of moving strings around on the stack in DR, drloader now
adjusts the argv array before calling execve.  This costs an extra
execve() during startup, but it's a little cleaner than moving strings
around.  Eventually drloader and drrun should be combined, and we can
avoid the extra execve() initialization.

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

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1550 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fixes issue 879

Raise -steal_fds from 12 to 96 for CLIENT_INTERFACE

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1551 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
fixes issue 881

If .symtab is not found, use .dynsym to examine export symbols
for stripped modules.

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1552 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#880: temporarily disable drsym_free_resources on linux

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1553 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#751: IBL optimization.

Spill xax, xcx, and xbx to r8, r9, and r10, respectively. Also use r10
for next_tag in mangle_x64_ib_in_trace().

Modify test suite win32.mixedmode to let clobbered r8 pass (FIXME i#865).

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1554 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Remove -private_loader usage from the vps build

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

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1555 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#47: Install private library TLS segment even if the app has none

This allows clients that rely on the private loader to work with early
injection.  Currently stl_test crashes, and this fixes it.

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

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1556 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Fix the base+disp overflow bug in addr32 optimization.

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1557 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
Relax NT path curiosities when used as a library

This allows the DrMemory frontend to blindly call dr_directory_exists()
on strings that are not paths without having to write any path parsing
logic.

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

git-svn-id: http://dynamorio.googlecode.com/svn/trunk@1558 49cc7528-f6fd-11dd-9d1a-b59b2e1864b6
i#47: Use PR_SET_NAME to make killall work for apps under DR

Interestingly, this has very little effect on ps.  The strings it
displays are usually from /proc/pid/cmdline.  Only 'ps -C <name>' uses
prctl PR_GET_NAME.

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

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