25 Commits

Author SHA1 Message Date
Julian Seward
6334c4c3f9 Various improvements:
* rename many functions to do with shadow memory handling, to
  more clearly differentiate reads and writes directly of the
  shadow state from client reads and writes, each of which
  generate both a read and a write of the client state.  It was
  getting confusing (== hard to verify) in there.

* use idempotency of memory state machine transition rules to
  speed up long sequential sections, speedups in range 0% to 28%

* remove 4-way Pord (EQ, LT, GT, UN) and associated machinery,
  and replace it with something that merely computes LEQ in the
  partial ordering, since that's all that is necessary, and
  this simplifies some fast-case paths.

* add optional approx history mechanism a la DRD (start/end stack
  of conflicting segment), much faster if you don't need exact
  conflicting-access details

* libhb_so_recv: tick the VTS in the receiving thread; don't just
  join with the VC in the SO.  It's probably correct without this
  modification, but that correctness is fragile and depends on
  complex properties of how SOs are used/created.  Much better to
  be completely safe.  (Needs cache-isation).

* get rid of unnecessary shadow memory state "SVal_NOACCESS"
  and simplify associated fast-case paths in msmc{read,write}



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10589
2009-07-24 08:45:08 +00:00
Julian Seward
d6407ffc63 Merge helgrind/ changes from branches/MESSAGING_TIDYUP r10464.
See trunk r10465 commit message for details.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10468
2009-07-15 14:50:02 +00:00
Julian Seward
3109865279 Merge in branches/DCAS.
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.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10392
2009-07-01 08:10:49 +00:00
Julian Seward
97e2bdc064 When updating the constraint for a location following a race, make
sure the read-constraint <= the write-constraint.  Failure to do this
leads to assertion failures later on.  Fixes #181394.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10074
2009-05-21 14:54:05 +00:00
Nicholas Nethercote
98386a7102 Fix up some stack trace inconsistencies:
- When printing suppressions, never print more entries than there are in the
  stack.  This avoids bogus suppressions in some cases!  (I haven't seen
  them on Linux, but I have seen them on Darwin.)

- When getting a stack trace, stop if we get an IP of zero or one;  that
  means we've hit the end of the stack.  And don't include that entry in the
  stack trace, because it's a guaranteed "???" if it's ever printed which is
  useless.

- In VG_(apply_StackTrace), we can now rely entirely on the n_ip parameter
  rather than looking for 0 or -1, because that check is done when the stack
  trace is first obtained.  In other words, stack traces all use an n_ip
  parameter to record their size, whereas previously they used an odd
  mixture of n_ip and null-termination.

- Rename 'n_ips' variables as 'max_n_ips' where appropriate;  those left as
  'n_ips' truly describe how many IPs there are in the stack trace.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9793
2009-05-07 23:08:10 +00:00
Nicholas Nethercote
7c51693e2b Don't store the frames hash in .frames[0] and the actual frames in
.frames[1..N_FRAMES].  Instead store the hash in a separate .frames_hash
field, and the actual frames in .frames[0..N_FRAMES-1].



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9778
2009-05-05 23:46:24 +00:00
Nicholas Nethercote
b15e3d9a45 Fix all the non-VEX problems identified with the Clang Static Analyzer.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9416
2009-03-15 23:25:38 +00:00
Nicholas Nethercote
2001629c3f Updated copyright years.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344
2009-03-10 22:02:09 +00:00
Julian Seward
f3523a4a0e Some minor format string fixes for gcc-3.3.3 (SuSE 9.1). Not sure why
later gccs don't complain about these.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9019
2009-01-22 12:24:26 +00:00
Julian Seward
28f3b05d68 Various changes:
* remove flags --trace-addr= and --trace-level=.  These no longer
  have any effect, so there's no point in having the associated flags.

* add flag --show-conflicts=no|yes [yes], which makes it possible to
  disable the conflicting-access collection machinery.  This makes
  Helgrind run much faster.  Perhaps useful in regression testing,
  when it is desired only to find out if a race exists, but not to
  collect enough information to easily diagnose it.

* add flag --conflict-cache-size= [1000000], which makes it possible
  to control how much memory is used for storage of information about
  historical (potentially-conflicting) accesses.

* Update comments on the conflicting-access machinery to more closely
  reflect the code.  Includes comments on the important aspects of
  the value N_OLDREF_ACCS.  Increase said constant from 3 to 5.

* Fix bug in event_map_bind: when searching for an OldRef.accs[]
  entry that matches the current access, don't forget to also 
  compare the access sizes.  The old code only compared the thread
  identity and the read/writeness.

* hg_main.c: disable Dwarf3 variable/type info reading by default.
  Mostly this provides little benefit and can cause Helgrind to use
  a lot more time and memory at startup.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8845
2008-12-21 10:43:10 +00:00
Julian Seward
7992575441 Avoid causing an assertion failure in VG_(make_ExeContext_from_StackTrace)
in the case where VG_(clo_backtrace_size) < N_FRAMES (that is, with
--num-callers=N where N < N_FRAMES).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8820
2008-12-13 01:20:21 +00:00
Julian Seward
061e035f79 event_map_lookup: when looking for a previous access to an address,
find conflicting accesses that overlap the current access in any way,
rather than just match at the addresses.  This allows reporting of
conflicts between accesses which overlap but are not the same
size/alignment.

Doesn't seem to always work reliably, for reasons I don't understand,
but I so far failed to make a small test case.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8811
2008-12-08 00:12:28 +00:00
Julian Seward
24b526c62b Tidy up and comment sanity-checking code/configuration.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8810
2008-12-07 11:40:17 +00:00
Julian Seward
5da3926707 * In the conflicting-event mechanism, also record the size and
read-or-writeness of each access, so that these can be displayed in
  error messages.

* Use recorded read-or-writeness info to avoid producing error
  messages that claim claim two reads race against each other -- this
  is clearly silly.  For each pair of racing accesses now reported, at
  least one of them will (should!) always now be a write, and (as
  previously ensured) they will be from different threads.

* Lookups in the conflicting-access map is expensive, so don't do that
  as soon as a race is detected.  Instead wait until the update_extra
  method is called.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8809
2008-12-07 01:41:46 +00:00
Julian Seward
44da343f9c Use the new SparseWA data type, rather than WordFM, to implement the
(primary) mapping of the conflicting-access mechanism.  This speeds
up Helgrind by 0% to 30% depending on the workload.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8807
2008-12-06 22:10:54 +00:00
Julian Seward
a6613bcb2b Change the memory allocation strategy used by the conflicting-access
machinery, so as to allocate fewer chunks of memory.  This increases
the speed of Helgrind by about 10% on some apps, which probably means
the conflicting-access machinery itself is about 20% faster.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8803
2008-12-03 11:39:37 +00:00
Julian Seward
468ca56d5d event_map_maybe_GC: use a flat array when computing the distribution
(counts) of generation numbers in the oldrefTree, instead of using a
WordFM as an associative array.  This significantly accelerates the
event map garbage collector.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8794
2008-11-20 23:17:01 +00:00
Julian Seward
36ca6df95a Re-set constraints in 'consistent' style after a race is detected,
instead of the more aggressive setting, which appeared to cause a
large number of extra race reports.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8793
2008-11-20 11:20:50 +00:00
Julian Seward
9398b50c4a Don't put raced-on locations in an (E)rror state; instead leave them
in a (C)onstraint state.  The former approach can cause races to be
missed.  Also, update state machine slightly following re-analysis
thereof.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8788
2008-11-19 16:35:15 +00:00
Julian Seward
c9b2f74417 event_map_maybe_GC: handle corner case that was previously simply
asserted on: if all the entries in the event map are in the same
generation, then we have no LRU information at all with which to
decide which entries to discard.  So in this case throw away half of
them randomly -- there's nothing better we can do.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8783
2008-11-18 23:40:00 +00:00
Julian Seward
2a7aedcf12 Handle EvM GC messaging properly.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8760
2008-11-10 16:19:21 +00:00
Julian Seward
4757ac5356 Update baseline expected outputs, now that Helgrind uses a different
algorithm than in 3.3.x.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8750
2008-11-09 20:47:57 +00:00
Julian Seward
a500c38d13 A bit of tidying up:
* get rid of 'struct _EC' (a.k.a 'struct EC_') and use ExeContext
  everywhere

* remove stacktrace_to_EC and call
  VG_(make_ExeContext_from_StackTrace) directly

* comment out some unused code



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8749
2008-11-08 20:36:26 +00:00
Julian Seward
1ee7f51214 Rename some local variables called 'index' to something else, to stop
gcc-3.2.2 complaining they shadow some built-in global declaration of
'index'.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8715
2008-10-27 21:42:36 +00:00
Julian Seward
35c28b721f Merge Helgrind from branches/YARD into the trunk. Also includes some
minor changes to make stack unwinding on amd64-linux approximately
twice as fast as it was before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8707
2008-10-25 16:22:41 +00:00