Tom Hughes [Wed, 1 Jul 2009 11:59:20 +0000 (11:59 +0000)]
When looking for the text section in a PE executable ignore any
code section which is marked as uninitialised.
This can happen if you have incremental linking enabled in Visual
Studio, which causes a .textbss section to be added before the real
text section. We were picking up that .textbss section and using it to
compute the avma and bias for the code which was giving completely the
wrong results.
This branch adds proper support for atomic instructions, proper in the
sense that the atomicity is preserved through the compilation
pipeline, and thus in the instrumented code.
These changes track the IR changes added by vex r1901. They primarily
update the instrumentation functions in all tools to handle the
changes, with the exception of exp-ptrcheck, which needs some further
work in order to be able to run threaded code.
Add some more functions to the default --alloc-fns list. Had to tweak how
verbose output is printed so that the tests would be ok, now that different
platforms have different alloc-fns lists.
Fix statistics with multiple changes of instrumentation state
This fixeds bug 150606.
When switching on instrumentation, the current function got the
wrong (too large) inclusive cost when instrumentation ever was on before.
The reason was that the global (ever increasing) event counters where
not reset on toggling instrumentation state. The global counters
are used to calculate inclusive cost of a function by getting the
difference of the global counters at leaving minus their value at
enter time. When leaving a function which was not encountered
to be entered before (a stack underrun of the shadow stack), it is
assumed that this function was entered with instrumentation switched
off. Then, the absolute value of global counters is used to calculate
the inclusive cost. Thus, these global counters have to be zeroed
at instrumentation change to allow for senseable inclusive costs
of functions which were not observed to be entered.
Make the Linux launcher more like the Darwin one in how it reads the
executable headers. This means it no longer crashes on an empty executable.
Fixes bug 156065.
Bart Van Assche [Wed, 24 Jun 2009 18:35:02 +0000 (18:35 +0000)]
Use the value set in the environment variable DRD_SEGMENT_MERGING_INTERVAL if the segment merging interval has not been specified as a command-line option.
This commit merges the BUILD_TWEAKS branch onto the trunk. It has the
following improvements:
- Arch/OS/platform-specific files are now included/excluded via the
preprocessor, rather than via the build system. This is more consistent
(we use the pre-processor for small arch/OS/platform-specific chunks
within files) and makes the build system much simpler, as the sources for
all programs are the same on all platforms.
- Vast amounts of cut+paste Makefile.am code has been factored out. If a
new platform is implemented, you need to add 11 extra Makefile.am lines.
Previously it was over 100 lines.
- Vex has been autotoolised. Dependency checking now works in Vex (no more
incomplete builds). Parallel builds now also work. --with-vex no longer
works; it's little use and a pain to support. VEX/Makefile is still in
the Vex repository and gets overwritten at configure-time; it should
probably be renamed Makefile-gcc to avoid possible problems, such as
accidentally committing a generated Makefile. There's a bunch of hacky
copying to deal with the fact that autotools don't handle same-named files
in different directories. Julian plans to rename the files to avoid this
problem.
- Various small Makefile.am things have been made more standard automake
style, eg. the use of pkginclude/pkglib prefixes instead of rolling our
own.
- The existing five top-level Makefile.am include files have been
consolidated into three.
- Most Makefile.am files now are structured more clearly, with comment
headers separating sections, declarations relating to the same things next
to each other, better spacing and layout, etc.
- Removed the unused exp-ptrcheck/tests/x86 directory.
- Renamed some XML files.
- Factored out some duplicated dSYM handling code.
- Split auxprogs/ into auxprogs/ and mpi/, which allowed the resulting
Makefile.am files to be much more standard.
- Cleaned up m_coredump by merging a bunch of files that had been
overzealously separated.
The net result is 630 fewer lines of Makefile.am code, or 897 if you exclude
the added Makefile.vex.am, or 997 once the hacky file copying for Vex is
removed. And the build system is much simpler.
Bart Van Assche [Sun, 21 Jun 2009 18:07:35 +0000 (18:07 +0000)]
Combined DRD_(thread_new_segment)() and DRD_(thread_combine_vc_sync)()
into the function DRD_(thread_new_segment_and_combine_vc)() because
before DRD_(thread_combine_vc_sync)() was called the function
DRD_(thread_new_segment)() was always called.
Callgrind: fix instrumentation for arbitrary events per guest instruction
(should fix bug 169505)
This uses the same event queue scheme as cachegrind and lackey, and
same kind of helpers (1/2/3 Ir events, Ir+Dr, Dr, Ir+Dw, Dw).
Note that in contrast to Cachegrind, Callgrind interpretes a modify event
as Dw (otherwise the cache model generating write back events would not work).
Callgrind uses per-(guest)instruction event sets for cost counters.
An per-instruction eventset is incrementally extended as events for the
same guest instruction are flushed. Event sets always start with Ir counters,
but depending on Dr/Dw order afterwards, there exist IrDr(Dw) and IrDw(Dr).
Per-instruction event sets now are consistently named according to event ordering.
Event set "sim" is a subset of "full", was never used and was removed.
Tweak the README -- make its text match the website, get rid of some of the
more detailed explanation (if they're reading the README, we probably don't
need to convince them about Valgrind's wonderfulness).
Bart Van Assche [Wed, 10 Jun 2009 19:24:20 +0000 (19:24 +0000)]
- Added more comments in DRD's malloc wrappers.
- Fixed memory allocation counters.
- Client memory is now freed in the realloc() wrapper in all cases where
it should be freed.
Darwin syscall wrapper cleanups:
- Put Darwin syscall DECL_TEMPLATEs in syscall order.
- Removed the "sys_" prefix from Darwin-specific wrappers, it's not
necessary. Renamed a couple of other wrappers similarly.
- Removed the sys_fcntl64 Darwin wrapper, it was unused.
- Improved some code layout.
Overall this removes 6 "DDD"/"GrP" fixme comments.
Bart Van Assche [Sat, 6 Jun 2009 12:26:05 +0000 (12:26 +0000)]
Consistency improvement: made sure that for all synchronization operations vector clocks are combined after having created a new segment instead of before.
Bart Van Assche [Sat, 6 Jun 2009 10:56:40 +0000 (10:56 +0000)]
- Robustness improvement: do not trigger an assertion failure if one
thread destroys and reinitializes a semaphore another thread is
waiting on but print an error message instead.
- Behavior change: always decrement 'value', even if this makes value
negative.
- Updated expected output files.
Bart Van Assche [Sat, 6 Jun 2009 09:28:28 +0000 (09:28 +0000)]
Disabled libgomp intercepts. Since libgomp support was added to DRD, the
libgomp ABI has changed. Two new functions have been added, namely
gomp_team_barrier_wait() and gomp_team_barrier_wake(). The simplest way
to support all libgomp functions is by disabling the libgomp intercepts.
This fixes bug #195169.
Julian Seward [Fri, 5 Jun 2009 13:17:31 +0000 (13:17 +0000)]
x86-linux: sys_set_thread_area: don't allocate GDT entry number zero,
and reject attempts to use it. This is because the hardware does not
allow entry zero to be used, and apparently doing so confuses some
code (perhaps Windows apps running on Wine). Derived from a patch by
John Reiser.
- Put the old tree in valgrind-old/ and the new one in valgrind-new/,
instead of using valgrind/ for both. That way, the old tree is still
present after running the tests, so it can be inspected for problems.
This required changing how ABT_RUN_REGTEST worked -- it no longer should
change directories itself -- but I think Bart's machine is the only one
using that and I updated the .conf file accordingly.
- Change some variable names -- only use the "ABT_" prefix for variables
defined in the .conf files, and use $DIR and $TAG to match the README.txt.
Fixes for Darwin: it uses a different method for getting the time-and-date
for 24 hours ago. Also, the default 'sh' doesn't support "echo -n" so use
"printf" instead.
Two tweaks:
- Install in $DIR/valgrind/Inst/ rather than $DIR/Inst. Just a bit neater.
- Run "make regtest" instead of "perl tests/vg_regtest --all", because we
might not want to run all tests (eg. we don't on Darwin at the moment).