43 Commits

Author SHA1 Message Date
Nicholas Nethercote
5ad1dd61f9 Introduce a new type, PtrdiffT. Replace lots of uses of OffT (all those
that are memory offsets) with PtrdiffT;  OffT should only be used for file
sizes and offsets.

Change Off64T from a ULong to a Long, as it should be.  Replace some uses
of ULong in the address space manager with Off64T to match.

Also add a comment explaining the meanings of the basic types like Addr,
OffT, SizeT, etc.

Also fix the prototype for VG_(pread) -- the last arg is an OffT, not an
Int.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8959
2009-01-15 21:29:24 +00:00
Julian Seward
335992d8fc Merge all remaining changes from branches/PTRCHECK. These are some
relatively minor extensions to m_debuginfo, a major overhaul of
m_debuginfo/readdwarf3.c to get its space usage under control, and
changes throughout the system to enable heap-use profiling.

The majority of the merged changes were committed into
branches/PTRCHECK as the following revs: 8591 8595 8598 8599 8601 and
8161.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8621
2008-09-18 18:12:50 +00:00
Julian Seward
a1289fb4ca Bump the core/tool iface version number, since the just-merged-in
changes for Memcheck origin tracking change the interface (slightly).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7984
2008-05-01 21:43:17 +00:00
Julian Seward
4cae5c3ed5 Merge branches/OTRACK_BY_INSTRUMENTATION into the trunk. This adds
support to Memcheck for tracking the origin of uninitialised values,
if you use the --track-origins=yes flag.

This currently causes some Memcheck regression tests to fail, because
they now print an extra line of advisory text in their output.  This
will be fixed.

The core-tool interface is slightly changed.  The version number for
the interface needs to be incremented.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7982
2008-05-01 20:24:26 +00:00
Julian Seward
14af4957fc Merge in the DATASYMS branch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7540
2008-03-03 01:35:41 +00:00
Julian Seward
5679a22410 Update copyright dates ("200X-2007" --> "200X-2008").
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7398
2008-02-11 11:34:59 +00:00
Julian Seward
931a40e83b Core-tool iface changes needed to support exp-drd (Bart Van Assche).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7212
2007-11-25 14:06:06 +00:00
Julian Seward
caa1e5d417 Fix bogus grammar in r7139.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7140
2007-11-10 22:19:42 +00:00
Julian Seward
88c1e8eb76 Clarify reason for existence of track_pre_thread_ll_create/_exit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7139
2007-11-10 22:13:03 +00:00
Julian Seward
06666933d9 Merge (from branches/THRCHECK) the following two changes to the core-tool
interface:

r6805: Modify two thread-notification events in the core-tool
interface.  This removes track_post_thread_create and
track_post_thread_join.  The core can only see low level thread
creation and exiting, and has no idea about pthread-level concepts
like "pthread_create" and "pthread_join", so these are a bit
ambiguous.

Replace them with track_pre_thread_ll_create, which is notified before
a new thread makes any memory references, and
track_pre_thread_ll_exit, which is notified just before the new thread
exits, that is, after it has made its last memory reference.

r6823: Core-tool interface: give 'needs_tool_errors' an extra Boolean
indicating whether or not the core should print thread id's on error
messages.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7123
2007-11-09 23:21:44 +00:00
Julian Seward
0ed8fc0ce0 Merge, from CGTUNE branch, a cleaned up version of r6742:
Another optimisation: allow tools to provide a final_tidy function
which they can use to mess with the final post-tree-built IR before it
is handed off to instruction selection.

In memcheck, use this to remove redundant calls to
MC_(helperc_value_check0_fail) et al.  Gives a 6% reduction in code
size for Memcheck on x86 and a smaller (3% ?) speedup.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6787
2007-08-28 06:05:20 +00:00
Julian Seward
4ab7e54154 VG_(needs_shadow_memory) does not exist; remove prototype for it.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6761
2007-06-23 16:03:05 +00:00
Nicholas Nethercote
b89c81e048 clarify comment
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6674
2007-03-27 06:46:03 +00:00
Nicholas Nethercote
1c8e6c7021 s/IRBB/IRSB/
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6570
2007-02-05 23:23:55 +00:00
Julian Seward
172505c978 Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6488
2007-01-08 06:01:59 +00:00
Julian Seward
10c505c003 Get rid of the core-tool events pre_mutex_lock, post_mutex_lock and
post_mutex_unlock.  The core can't detect them anyway any more, so
there's no point in having them.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6456
2006-12-28 20:26:08 +00:00
Nicholas Nethercote
cadc28816d Split the thread_runstate event into two, start_client_code and
stop_client_code, which is a bit clearer and easier to work with.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6418
2006-12-24 07:51:17 +00:00
Julian Seward
1083ded7e2 Non-functional commit: track IR renaming in vex r1689.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6416
2006-12-24 02:24:11 +00:00
Julian Seward
806c8b17b3 Change the core-tool interface 'thread_run' event to be more useful:
- Rename the event to 'thread_runstate'.

- Add arguments: pass also a boolean indicating whether the thread
  is running or stopping, and a 64-bit int showing how many blocks
  overall have run, so tools can make a rough estimate of workload.

  The boolean allows tools to see threads starting and stopping.
  Prior to this, de-schedule events were invisible to tools.

- Call the callback (hand the event to tools) just before client
  code is run, and again immediately after it stops running.  This
  should give correct sequencing w.r.t posting of thread creation/
  destruction events.

In order to make callgrind work without complex changes, I added a
simple impedance-matching function 'clg_thread_runstate_callback' 
which hands thread-run events onwards to CLG_(thread_run).

Use this new 'thread_runstate' with care: it will be called before
and after every translation, which means it will be called ~500k
times in a startup of firefox.  So the callback needs to be fast.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6413
2006-12-23 01:21:12 +00:00
Nicholas Nethercote
52dfe4cb39 Remove defunct constant.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6401
2006-12-15 04:37:25 +00:00
Dirk Mueller
6662c989dc change void* to Addr in mutex helpers. patch by Bard Van Assche.
I've bumped the tool interface version because it seems binary
incompatible.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6350
2006-11-14 14:32:46 +00:00
Julian Seward
68475a1dc5 Fix bug in memcheck's instrumenter introduced in r6319. Big comment
in the code explains it.  Sigh.  Why can't anything be simple?



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6322
2006-10-19 13:22:16 +00:00
Nicholas Nethercote
fad24de4bc Move VG_BUGS_TO to pub_tool_basics.h so that Nulgrind need not import
pub_tool_libcassert.h.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6320
2006-10-18 21:50:26 +00:00
Julian Seward
77e2257371 Update 'expected' default translation size (partial merge of r6214).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6301
2006-10-17 02:25:50 +00:00
Julian Seward
676afab8a5 Minor comment mods.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6238
2006-10-15 13:47:43 +00:00
Julian Seward
4e2a6f2ccb Add further comments about the tool instrument function.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6237
2006-10-15 13:46:18 +00:00
Julian Seward
86b7021db6 Add proper comments explaining the args for the tool instrumenation
function.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6236
2006-10-15 12:48:18 +00:00
Julian Seward
ad67fd79fe Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5954
2006-06-05 23:21:15 +00:00
Nicholas Nethercote
1a7237d77b Remove tool-specific code (which says which tools allow XML) from the core
by introducing a new "need":  VG_(needs_xml_output)().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5854
2006-04-16 10:25:43 +00:00
Julian Seward
aa35c50723 Extend stack-permissions-change fast-case machinery to handle +/- 112,
128, 144 and 160.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5640
2006-02-12 15:42:20 +00:00
Julian Seward
f0d678baab These files all speak about instrumentation functions.
Instrumentation functions now take a callback closure structure
(VgCallbackClosure*), so this commit changes the signatures
accordingly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5535
2006-01-17 02:06:39 +00:00
Julian Seward
1813e8fdcd Change the core-tool interface so that tools are fully aware of both
the guest extents for the presented translation and also its original
un-redirected guest address.  These changes are needed in particular
to make cachegrind's code cache management work properly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4943
2005-10-18 12:04:18 +00:00
Nicholas Nethercote
b32a66a35f augment comment
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4939
2005-10-16 17:48:09 +00:00
Julian Seward
5740bf2f53 Redo the way cachegrind generates instrumentation code, so that it can
deal with any IR that happens to show up.  This makes it work on ppc32
and should fix occasionally-reported bugs on x86/amd64 where it bombs
due to having to deal with multiple date references in a single
instruction.

The new scheme is based around the idea of a queue of memory events
which are outstanding, in the sense that no IR has yet been generated
to do the relevant helper calls.  The presence of the queue --
currently 16 entries deep -- gives cachegrind more scope for combining
multiple memory references into a single helper function call.  As a
result it runs 3%-5% faster than the previous version, on x86.

This commit also changes the type of the tool interface function
'tool_discard_basic_block_info' and clarifies its meaning.  See
comments in include/pub_tool_tooliface.h.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4903
2005-10-12 10:09:23 +00:00
Julian Seward
cc8ccbbfb4 This commit merges in changes from branches/ASPACEM (specifically,
changes from r4341 through r4787 inclusive).  That branch is now dead.
Please do not commit anything else to it.

For the most part the merge was not troublesome.  The main areas of
uncertainty are:

- build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am
  and include it in a couple of places.  Building etc seems to still
  work, but I haven't tried building the documentation.

- syscall wrappers: Following analysis by Greg & Nick, a whole lot of
  stuff was moved from -generic to -linux after the branch was created.
  I think that is satisfactorily glued back together now.

- Regtests: although this appears to work, no .out files appear, which
  is strange, and makes it hard to diagnose regtest failures.  In
  particular memcheck/tests/x86/scalar.stderr.exp remains in a 
  conflicted state.

- amd64 is broken (slightly), and ppc32 will be unbuildable.  I'll
  attend to the former shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789
2005-09-27 19:20:21 +00:00
Nicholas Nethercote
fcdc60441e Something I realised recently: in C, iterators are much better than
higher-order functions for traversing data structures.  The higher-order
approach is too clumsy due to the lack of polymorphism and closures;  you
have to use void* too much and it is more verbose than it should be.

Hence, I replaced all the uses of HT_first_match() and
HT_apply_to_all_nodes() with equivalent uses of the hashtable iterator.
Also replaced higher-order traversal functions for Memcheck's freed-list
and the thread stacks with iterators.  That last change changes the
core/tool interface, so I've increased the version number.







git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4415
2005-08-15 01:52:02 +00:00
Nicholas Nethercote
4e8bcf9076 Move the last remaining tests out of corecheck.
Also introduced VG_(showing_core_errors)() to make core error display
more consistent.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4073
2005-07-01 04:15:36 +00:00
Nicholas Nethercote
63bf761416 Moved the mman VG_(*_native)() functions into m_aspacemgr, and removed
the unused init_shadow_page() function.  As a result, m_aspacemgr no longer
depends on m_libcmman, breaking a circular module dependency, good!


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4015
2005-06-24 22:17:38 +00:00
Nicholas Nethercote
d463dd2292 Removed the VGA_/VGO_/VGP_ prefixes for arch/OS/platform-specific
things.  These made sense when the arch/OS/platform-specific code was in
one module, but as that code got mixed in with generic code the boundary
between generic and non-generic blurred, and the distinction made less
sense.  So let's get rid of them.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4002
2005-06-23 03:27:57 +00:00
Nicholas Nethercote
35fc371349 Malloc replacement worked very much like a 'need', but wasn't one.
I've changed it so it now is, which makes it consistent with the
other 'needs'.  Because of this, I was also able to invert the dependence
between m_mallocfree and m_tooliface, which is related to setting
the redzone size for client heap blocks.  As a result, m_tooliface
now doesn't depend on anything except pub_core_basics.h, hooray!
 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3979
2005-06-21 03:20:17 +00:00
Julian Seward
091ebb69f5 A major overhaul of all machinery to do with syscalls, but mostly of
the m_syscalls module.  Fundamentally the aim of the overhaul is to
clean up the logic and abstractions surrounding syscalls in order that
we can cleanly support ppc32 and other new targets.  Aims in detail:

* To further decouple the syscall PRE/POST wrappers from specifics of
  how those values are stored on a given platform.  The wrappers look
  the same as they did before, mostly (eg, references to ARGn and
  RES are unchanged), but now those macros refer to values in structs
  SyscallArgs and SyscallStatus (see priv_types_n_macros.h).

* Complete overhaul of the driver logic for syscalls.  The resulting
  logic is algorithmically identical to what we had before, but is
  more documented, and deals with moving arg/result data between
  platform specific representations and the canonical forms in
  structs SyscallArgs and SyscallStatus.

* Also as a result of this change, remove problems in the old logic
  due to assignments of RES in PRE wrappers trashing the ARGs whilst
  we still need to see them.

* Lots of other cleanups and documentation.  There is extensive
  commentary in syscalls-main.c.

The driver logic has been placed in its own file, syscalls-main.c.

New/deleted files in m_syscalls:

* syscalls.c is divided up into syscalls-main.c, containing driver
  logic, and syscalls-generic.c, containing generic Unix wrappers.

* priv_syscalls.h is chopped up into priv_types_n_macros.h
  and priv_syscalls-{generic,main}.h.

                           ------------

All the above changes are in m_syscalls.  However there is one
system-wide change as a result of all this.

The x86-linux assumption that syscall return values in the range -4095
.. -1 are errors and all others are values, has been done away with
everywhere.  Instead there is a new basic type SysRes which holds a
system call result in a platform-neutral way.

Everywhere that previously an Int would have held a system call
result, there is now a SysRes in its place.

                           ------------

Almost everything works on SuSE 9.1 (LinuxThreads) again.  NPTL will
still be majorly broken; I will commit fixes shortly.  AMD64 is also
totalled.  I will get to that too.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3849
2005-06-07 20:04:56 +00:00
Nicholas Nethercote
586e79e4bd core.h: remove some #include lines, move some others to more localised
places.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3745
2005-05-16 20:40:51 +00:00
Nicholas Nethercote
247e241160 Modularised the core/tool interface ('details', 'needs' and VG_(tdict))
into a new module m_tooliface.  Pretty straightforward.  Touches a lot
of files because many files use this interface and so need to include
the headers for the new module.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3652
2005-05-10 04:37:01 +00:00