History log of /external/valgrind/cachegrind/cg_main.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
8d47a61e503b69ffbc783717f5faf09d0bbc4723 05-Feb-2015 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Allow the user to specify precise-exception behaviour for translations
made from file-backed mappings (AOT code, basically) that is different
from the default behaviour as specified by --vex-iropt-register-updates.

New flag is --px-file-backed=, with the same possible args as
--vex-iropt-register-updates has.

Add a new flag --px-default, which is a short alias for
--vex-iropt-register-updates.

Add one line of stats output when --stats=yes, showing counts of how
many translations have been made under each of the 4 different PX
optimisation settings.

No user-visible change if you don't use the new flags.

Relies on VEX API change in r3084.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14906 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
ddd61ff058f02059064e083a8accaefed23d5548 04-Jan-2015 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Change most remaining use of Addr64 in coregrind and the tools to Addr.
Tracking VEX r3056.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14846 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
f466eef8e53aafcb617997e1ca18b7c829168db8 02-Jan-2015 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track the IMark changes in VEX r3055.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14844 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
f4384f47ee6b6234dba548a775585c37af712edf 16-Dec-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Simplify the VG_(get_filename_linenum) interface by removing
the dirname_available parameter. It's redundant. The value
of the returned directory name can be tested instead.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14814 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
227a1ecca7f44cb07e74aa8f1bd24b29df629499 12-Dec-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add limited support for printing floating point numbers to
VG_(debugLog_vprintf).
Remove function VG_(percentify) and fix up its call sites (part of
fixing BZ #337869.
Allow the width in a format specification to be '*', i.e. the width is
given as an additional function argument.

The limitations for printing floating point numbers are:
(1) %f is the only supported format. Width and precision can be
specified.
(2) Funny numbers (NaN and such) are not supported.
(3) Floating point numbers need to be benign in the sense that their
integral part fits into an ULong.
This is good enough for our purposes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14806 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
12d2eb58c09505f8b1a171bcdd8352c9713591b4 30-Oct-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge revisions 14222, 14268, and 14270 from the BUF_REMOVAL branch to trunk.
Assorted fixes in exp-bbv to eliminate a few buffers.
Implement a suggestion found in the massif source, namely to add the
equivalent of fprintf to m_libcprint. Good suggestion. Thusly
- VgFile: similar to FILE; buffered output, 8k buffer
- VG_(fopen): similar to fopen, but with arguments as in VG_(open)
- VG_(fprintf) and VG_(vfprintf): like [v]fprintf with VgFile 1at argument
- VG_(fclose)
Change massif, exp-bbv and cachegrind to use this functionality.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14678 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
5980e9df10ed1b0497bc09f4b2fa708b52c9adda 28-Oct-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> When traversing VG_(args_for_client) there is no need to check
the array element for NULL. Function VG_(split_up_argv), which
sets up that array, ensures that no element is NULL.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14671 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
10ef725f1e8e9f1615c483555348eb75b69c4713 27-Oct-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge revisions 14255, 14293, and 14294 from the BUF_REMOVAL branch to trunk.
The functions VG_(get_filename) and VG_(get_filename_lineno) now return
a pointer to filename and directory name instead of copying them into
buffers passed in from the caller.
The returned strings are persistent as long as the DebugInfo to which
they belong is not discarded. The caller therefore needs to stash them
away as needed.
Function VG_(strncpy_safely) has been removed as it is no longer needed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14668 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
6c67c5065bddcb5d8388acb03e6e9686c025e1f1 26-Oct-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge r14288 from the BUF_REMOVAL branch to trunk.
What it does it changing cachegrind's get_debug_info function such
that it no longer builds up an absolute pathname. Instead the function
get an additional parameter for the directory name and the absolute
pathname is built when it is needed. This will come in handy soonish
when VG_(get_filename_lineno) will be changed and those buffers will
disappear.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14665 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
46cc04521acf2827eb33310fadc119bf2dc039e4 25-Oct-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge r14202 from the BUF_REMOVAL branch to trunk.
This patch changes the interface and behaviour of VG_(demangle) and
VG_(maybe_Z_demangle). Instead of copying the demangled name into a
fixed sized buffer that is passed in from the caller (HChar *buf, Int n_buf),
the demangling functions will now return a pointer to the full-length
demangled name (HChar **result). It is the caller's responsiblilty to
make a copy if needed.

This change in function parameters ripples upward
- first: to get_sym_name
- then to the convenience wrappers
- VG_(get_fnname)
- VG_(get_fnname_w_offset)
- VG_(get_fnname_if_entry)
- VG_(get_fnname_raw)
- VG_(get_fnname_no_cxx_demangle)
- VG_(get_datasym_and_offset)

The changes in foComplete then forces the arguments of
- VG_(get_objname) to be changed as well

There are some issues regarding the ownership and persistence of
character strings to consider.
In general, the returned character string is owned by "somebody else"
which means the caller must not free it. Also, the caller must not
modify the returned string as it possibly points to read only memory.
Additionally, the returned string is not necessarily persistent. Here are
the scenarios:
- the returned string is a demangled function name in which case the
memory holding the string will be freed when the demangler is called again.
- the returned string hangs off of a DebugInfo structure in which case
it will be freed when the DebugInfo is discarded
- the returned string hangs off of a segment in the address space manager
in which case it may be overwritten when the segment is merged with
another segment
So the rule of thunb here is: if in doubt strdup the string.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14664 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
fed3c04fdddde080fd2834212f6f514be96db47c 01-Oct-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge six easy pieces from the BUF_REMOVAL branch:
r14271 Audit a few buffer sizes, increase one.
r14280 Audit buffer size.
r14296 Remove a few unneeded header files.
r14310 Replace fixed size buffers with a large enough buffers.
r14338 Remove a dead assignment in print_bbcs and make global variable
print_fd a local variable.
r14359 Remove a benign macro redefinition in cachegrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14595 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
3c0c94777f547bcb5eadbe8cb4328debf0f51875 24-Sep-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Ripple from constifying parameters of instrumentation functions and
callbacks from VexTranslateArgs. See VEX r2958.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14564 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
b16609bf952bf381154cb6cba87efc99c2c86a23 20-Aug-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Clean up confusion about VG_(args_the_exename) which was believed to
possibly be NULL in several places. Nowadays, VG_(ii_create_image) will
terminate the process if VG_(args_the_exename) is NULL.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14323 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
0b2f59c2b472539ae40e34c333ff97f5c8d30afa 13-Aug-2014 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Remove benign macro redefinition.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14269 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
0f157ddb404bcde7815a1c5bf2d7e41c114f3d73 18-Oct-2013 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates (20XY-2012 ==> 20XY-2013)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13658 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
cafe50502ae73d6d6d0f214e06a4619e6cb1b278 17-Jan-2013 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge, from branches/COMEM, revisions 13139 to 13235.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13236 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
d40533210bb15e00e4396030f81ab6650839d660 26-Nov-2012 weidendo <weidendo@a5019735-40e9-0310-863c-91ae7b9d1cf9> Before LL, instrument outstanding helper calls.

Callgrind, Cachegrind, and Lackey call
helpers for memory accesses in bunches, to reduce
register save/restore overhead (and merge load/store
within same instruction into a "modify" event).

The calls should not be done within a RMW section
enclosed by LL/SC instructions, as this reduces the
chance of SC to succeed, and can result in hangs.
For Callgrind, this definitly helped MIPS, and was
committed in r13136. Do the same for Cachegrind/Lackey.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13143 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
3e7986312a0ffc7646b0552d4c4ea3744a870e73 24-Nov-2012 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix some casts that removed const-ness as pointed out by
GCC's -Wcast-qual.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13138 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
19f91bbaedb4caef8a60ce94b0f507193cc0bc10 10-Nov-2012 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix more Char/HChar mixups. Closing in...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13119 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
6fc0de0c31dc5ff9423d004d3af5f2219259cff4 30-Oct-2012 weidendo <weidendo@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cachegrind: introduce special case for Ir

Because most Ir accesses touch only one line, and this
can be detected at instrumentation time, use a special
handler for that. This handler does not need to check
cache line crossing at runtime.

This does not change the results of the simulator at all,
but improves runtime by around 15% on perf benchmarks.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13095 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
dbb3584f591710a15a437918c0fc27e300993566 27-Oct-2012 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> More Char/HChar fixes and constification.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13088 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
ee90c8ab054c33c7010f1f9b9cf6f17c8a74446f 21-Oct-2012 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix a few Char/HChar mixups for cachegrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13068 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
ca503be79ca377d89b1692c37c97a06ed14dad3b 07-Oct-2012 florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> This is the 2nd installment of the cache info reorganisation.
The host's VexArchInfo is passed to the tool instrumentation
functions. Purely mechanic patch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13031 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
c1e9426c345714aac9e05751ca621d1f69c2b95f 06-Oct-2012 weidendo <weidendo@a5019735-40e9-0310-863c-91ae7b9d1cf9> cachegrind: replace huge macro with inlined functions

Makes modifications simpler in the future, and
should result in the same code.

This patch was already discussed some time ago on the
dev mailing list, and did not make a difference on
various architectures.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13024 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
5b240c20b48c86955e574d5880a145927c60a686 15-Aug-2012 philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9> Implement --vex-iropt-register-updates=sp-at-mem-access

Option sp-at-mem-access can be used by tools which do not
need an up to date BP and IP at each mem access.
It is needed however to have SP up to date at each memory
access, as an up to date SP is needed to grow the stack in
m_signals.c

Tools massif, cachegrind and callgrind are using sp-at-mem-access
as default.
None tool could also use sp-at-mem-access but default is kept
to unwindregs-at-mem-access (similar to memcheck, drd, helgrind, exp-sgcheck).

exp-dhat, exp-bbv, lackey have not been looked at to see if they
could make use of sp-at-mem-access.

Validated on x86, amd64, ppc64 and s390x.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12872 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
03f8d3fc25f5a45c5826259d1b33b7f310117279 05-Aug-2012 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates to include 2012.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12843 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
98763d5a6ee3a05ac0ee8340c30ded34c2b08a6d 04-Jun-2012 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> m_machine: add new function VG_(machine_get_size_of_largest_guest_register)
cachegrind: use the new function to abort startup if the minumum line
size is smaller than the size of the largest guest register.
Partially derived from a patch by Josef Weidendorfer.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12605 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
ec062e8d96a361af9905b5447027819dfbfee01a 23-Oct-2011 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update all copyright dates, from 20xy-2010 to 20xy-2011.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12206 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
23642271f41ad858fa0935b8b870290b45bd5eeb 06-Sep-2011 weidendo <weidendo@a5019735-40e9-0310-863c-91ae7b9d1cf9> Allow overriding not-supported auto-detected cache configs

Patch by Philippe Waroquiers, slightly changed.

This actually was a regression from 3.6.1, but the patch
also improves on printed messages, and refactors common
code between cachegrind and callgrind.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12013 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
d5c948f3761283fa73e04d965ae859bf3d17e3ad 19-Aug-2011 tom <tom@a5019735-40e9-0310-863c-91ae7b9d1cf9> Report the detected cache configuration with "-v -v" before we
validate it to make validation failures easier to diagnose.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11994 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
2d853a1f8a153ee1ed99c5e1166d69dd4c6574d8 07-Oct-2010 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Change Cachegrind/Callgrind to talk about the LL (last-level) cache instead
of the L2 cache. This is to accommodate machines with three levels of
cache. We still only simulate two levels, the first and the last.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11404 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
c52b932cc83d7be59f747696f83e24075f67a5f8 27-Sep-2010 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Speed up the --cache-sim=no case.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11383 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e90711c693bdf6cf23cbb0d94fdfe730d4df6c65 27-Sep-2010 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> In Cachegrind, allow --cache-sim=no --branch-sim=no. Sometimes just getting
instruction counts is useful.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11382 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
374a48fe16a760b874316eecdc61b8f61db36e58 02-Sep-2010 weidendo <weidendo@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix branch predictor simulation in Cachegrind

* do indirect branch prediction simulation on calls
via function pointers
* only call into conditional branch prediction simulation
on real guest code branches (eg. not for VEX emulation of some
instructions using branches of jumpkind Ijk_EmWarn)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11331 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
b1cc5d666cc8f8065419e4a8c819ed0b8256a764 06-Jul-2010 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Make error messages at start-up more consistent. Every line of such
messages now begin with "valgrind: ", and they're more often printed before
the preamble. This required introducing a new message kind, Vg_FailMsg, and
functions VG_(fmsg) and VG_(fmsg_bad_option), and removing
VG_(err_bad_option).

Where we used to have horrible output like this:

[ocean:~/grind/ws2] vg5 --tool=massif --threshold=101 date
==31877== Massif, a heap profiler
==31877== Copyright (C) 2003-2010, and GNU GPL'd, by Nicholas Nethercote
==31877== Using Valgrind-3.6.0.SVN and LibVEX; rerun with -h for copyright info
==31877== Command: date
==31877==
==31877== --threshold must be between 0.0 and 100.0
valgrind: Bad option '--threshold'; aborting.
valgrind: Use --help for more information.

We now have nice output like this:

[ocean:~/grind/ws2] vg2 --tool=massif --threshold=101 date
valgrind: Bad option: --threshold=101
valgrind: --threshold must be between 0.0 and 100.0
valgrind: Use --help for more information or consult the user manual.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11209 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
9eecbbb9a9cbbd30b903c09a9e04d8efc20bda33 03-May-2010 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates to 2010.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11121 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
db5907d7b94ce492f29a96c95e186fdcda23a149 26-Nov-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track vex r1930 (Change the IR representation of load linked and store
conditional.) Completes the fix of #215771.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10957 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
66c00b9833cb467381ba3b723ccda7e525f21929 31-Aug-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix another enum type error spotted by gcc-4.5.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10880 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
2d9e874b7a628ada216f09cc4f065798c65fffa4 07-Aug-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Tidy up of messaging:

* For all tools and the core, don't show statistics when -v is in
effect. Instead, try to restrict -v to mostly user-useful
stuff.

* A new flag --stats=no|yes [no] produces statistics output instead.

* Fix longstanding problem in that Memcheck's leak checker ran after
the core's error manager module shut down, thereby not showing use
counts of leak suppressions. This fixes #186790.

* As a consequence, the leak checker text output of Memcheck has
changed a bit -- leak check is done before the final error
summary is done (much more logical), and the output has been
tidied up a bit.

* Helgrind, Drd and Ptrcheck now also print "For counts of
detected and suppressed errors, rerun with: -v", which makes
them consistent with Memcheck in this regard. These are
filtered out by the regtest filter scripts.

For all tools except Memcheck, the regtests are unchanged. On
Memcheck regtests still fail due to rearrangements of the leak
checker output. This will be fixed by a followup commit.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10746 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
b2c985be249f050bcdfa83ce37dcbea4455a79f4 15-Jul-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge cachegrind/ changes from branches/MESSAGING_TIDYUP r10464.
See trunk r10465 commit message for details.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10472 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
1c0ce7a9edf8772773f6216dbad4bb04317d23b6 01-Jul-2009 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> 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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
f76d27a697a7b0bf3b84490baf60623fc96a23af 28-May-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge the DARWIN branch onto the trunk.

I tried using 'svn merge' to do the merge but it did a terrible job and
there were bazillions of conflicts. So instead I just took the diff between
the branch and trunk at r10155, applied the diff to the trunk, 'svn add'ed
the added files (no files needed to be 'svn remove'd) and committed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10156 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
cda2f0fbda4c4b2644babc830244be8aed95de1d 18-May-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merged non-Darwin-specific parts of r9397,r9423,r9490, 9461, 9462 from the
DARWIN branch. A big ugly DARWIN/trunk sync commit, mostly to do with
changing the representation of SysRes and vki_sigset_t. Functionality of
the trunk shouldn't be changed by it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9876 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4c245e595b9f6300d3120408ca873f7115d9cc7d 16-Mar-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix all the non-VEX problems identified with the Clang Static Analyzer.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9416 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
6f74a7ef1768dd3925cc22869b4e5e24e9338d08 12-Mar-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added some shortcuts for VG_(message)(), and used them in a few places (but
certainly not all).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9367 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
9f207460d70d38c46c9e81996a3dcdf90961c6db 10-Mar-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updated copyright years.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
83df0b67a14425c484d8dda42b53f3ff0b598894 25-Feb-2009 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> atoll() is a terrible function -- you can't do any error checking with it.
Some of our option processing code uses it. This means that eg.
'--log-fd=9xxx' logs to fd 9, and '--log-fd=blahblahblah' logs to 0 (because
atoll() returns 0 if the string doesn't contain a number!)

It turns out that most of our option processing uses VG_(strtoll*) instead
of VG_(atoll). The reason that not all of it does is that the
option-processing macros are underpowered -- they currently work well if you
just want to assign the value to a variable, eg:

VG_BOOL_CLO(arg, "--heap", clo_heap)
else VG_BOOL_CLO(arg, "--stacks", clo_stacks)

else VG_NUM_CLO(arg, "--heap-admin", clo_heap_admin)
else VG_NUM_CLO(arg, "--depth", clo_depth)

(This works because they are actually an if-statement, but it looks odd.)

VG_NUM_CLO uses VG_(stroll10). But if you want to do any checking or
processing, you can't use those macros, leading to code like this:

else if (VG_CLO_STREQN(9, arg, "--log-fd=")) {
log_to = VgLogTo_Fd;
VG_(clo_log_name) = NULL;
tmp_log_fd = (Int)VG_(atoll)(&arg[9]);
}

So this commit:
- Improves the *_CLO_* macros so that they can be used in all circumstances.
They're now just expressions (albeit ones with side-effects, setting the
named variable appropriately). Thus they can be used as if-conditions,
and any post-checking or processing can occur in the then-statement. And
malformed numeric arguments (eg. --log-fd=foo) aren't accepted. This also
means you don't have to specify the lengths of any option strings anywhere
(eg. the 9 in the --log-fd example above). The use of a wrong number
caused at least one bug, in Massif.
- Updates all places where the macros were used.
- Updates Helgrind to use the *_CLO_* macros (it didn't use them).
- Updates Callgrind to use the *_CLO_* macros (it didn't use them), except
for the more esoteric option names (those with numbers in the option
name). This allowed getUInt() and getUWord() to be removed.
- Improves the cache option parsing in Cachegrind and Callgrind -- now uses
VG_(strtoll10)(), detects overflow, and is shorter.
- Uses INT instead of NUM in the macro names, to distinguish better vs. the
DBL macro.
- Removes VG_(atoll*) and the few remaining uses -- they're wretched
functions and VG_(strtoll*) should be used instead.
- Adds the VG_STREQN macro.
- Changes VG_BINT_CLO and VG_BHEX_CLO to abort if the given value is outside
the range -- the current silent truncation is likely to cause confusion as
much as anything.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9255 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
144b76c70143b4e68e584ad6b382d16360a8a460 26-Jan-2009 weidendo <weidendo@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cachegrind/Callgrind: allow for cache sizes other than only powers of two

The number of sets, ie. number of cache lines divided by associativity,
and the cache line size still have to be powers of two.
This change is needed for default cache parameters used on some Intel
Core 2 and Atom processors.

Includes cachegrind manual update and explicit tests with 24KB D1/3MB L2
Reverts addition of 6MB warning to {cachegrind,callgrind}/tests/filter_stderr

Backporting to VALGRIND_3_4_BRANCH needs r8912

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9080 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
9c606bd8634cd6b67bb41fa645b5c639668cfa2d 18-Sep-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> 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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
a0b6b2cf9abc7b0d87be1215a245eaccc0452af9 07-Jul-2008 bart <bart@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merged FORMATCHECK branch (r8368) to trunk.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8369 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
7064fb280267d51e3f7f398f22d0e4800ec969e4 30-May-2008 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix a bug in Massif and Cachegrind, whereby if program's forked, the child
wrote into the parent's output file even if %p was specified.

Josef, I think Callgrind does not have this bug, but you might want to say
something about forking in the manual, as I have done for Massif and
Cachegrind.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8154 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4d474d086188fd1f29fa97dbd84d8ea2e589a9b8 11-Feb-2008 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates ("200X-2007" --> "200X-2008").


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7398 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
5a835d5980202c293b27f55f257e8e4ef3d170a0 30-Dec-2007 tom <tom@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add const qualifiers to appropriate arguments of OSet routines.

Patch from Bart Van Assche <bart.vanassche@gmail.com>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7308 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
374a36dbfb6d08ed8d77c31a88e198a861ffadf0 23-Nov-2007 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fixed up the log file mess throughout, including the docs. This killed
--log-file-qualifier and --log-file-exactly.

Updated NEWS some in preparation for 3.3.0.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7202 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
72d75132068882b52b67dddc9af85ffaae5ac14f 10-Nov-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track vex r1793: make all tools able to handle the new IR memory bus
event statement (Ist_MBE).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7119 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e2a9ad3b71e0eccca6115349192d5e844be4eb0a 17-Sep-2007 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Split the OSet interface into two parts: "OSetGen_", which is the existing
interface and provides full power; and "OSetWord_", which is an
easier-to-use interface for if you just want to store words.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6841 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
f3b61d6527aa24d2bd5e8f74be7dd40b26b1fe1f 17-Sep-2007 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add directory-reading of debug info to cachegrind.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6839 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
198f34fa929569172d863f9c33f9686855ca975a 10-Jul-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Get rid of VG_(getcwd) and replace it with a pair of functions,
VG_(record_startup_wd) which records the working directory at startup,
and VG_(get_startup_wd) which later tells you what value was recorded.
This works because all uses of VG_(getcwd) serve only to record the
directory at process start anyway. The motivation is that AIX does
not support sys_getcwd directly, so it's easier for the launcher to
ship in the required value using an environment variable. On Linux
sys_getcwd is used as before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6764 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
8badbaa801ff8826758d045a84d59ac2d52273c7 08-May-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add branch-misprediction profiling to Cachegrind. When the (new) flag
--branch-sim=yes is specified, Cachegrind simulates a simple indirect
branch predictor and a conditional branch predictor. The latter
considers both the branch instruction's address and the behaviour of
the last few conditional branches. Return stack prediction is not
modelled.

The new counted events are: conditional branches (Bc), mispredicted
conditional branches (Bcm), indirect branches (Bi) and mispredicted
indirect branches (Bim). Postprocessing tools (cg_annotate, cg_merge)
handle the new events as you would expect. Note that branch
simulation is not enabled by default as it gives a 20%-25% slowdown,
so you need to ask for it explicitly using --branch-sim=yes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6733 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
0a8db5c3d35622cfbb7eed728a512570bf3ac8d5 02-Apr-2007 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Explicitly zero CCs. It's already being done by VG_(OSet_AllocNode), but
that's more by chance than design.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6691 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
14c7cc5a5fbe9526329f058116f921988efe679e 25-Feb-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Get rid of the type XArrayStrings in m_clientstate and use new generic
equivalents in module m_xarray instead. A suprisingly pervasive
change.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6616 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e1216cbfeb840d103e478f58231093857b4daaed 07-Feb-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> * Add new flag --cachegrind-out-file to specify the output file
basename to be something other than "cachegrind.out".

* Observe the core-supplied --log-file-qualifier, if specified,
in creation of output file names.

* To make the above work, move most of the stuff in cg_pre_clo_init
into cg_post_clo_init, so that the core's determination of the
log file qualifier, if any, is done by the time cachegrind comes
to process its arguments.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6572 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
9ebd6e0c607fa30301b1325874eb8de871c21cc5 08-Jan-2007 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6488 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
0b9d74abd0a663b530d290b2b788ddeda46e5400 24-Dec-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Non-functional commit: track IR renaming in vex r1689.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6416 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
149aed8dbfb2432fcc4785219f4620de5b8a8e10 25-Nov-2006 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Use the newly-added dopyIRBBExceptStmts() in tools.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6372 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e808930793aeddc4cfd3e7a94b665913bec2566c 17-Oct-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track SysRes change.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6294 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
6893d65852940741dbebbc6ba1480e89cf34e30f 15-Oct-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Move functions which deal with bad command line options from m_main
into m_options.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6233 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4cfea4f9480393ed6799db463b2e0fb8865a1a2f 14-Oct-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Create a new module, m_vki, and move all knowledge about the kernel
interface, except for the syscall numbers, into that. Mostly this
means moving include/vki-*.h to include/vki/vki-*.h.

include/pub_tool_basics.h previously dragged in the entire kernel
interface. I've done away with that, so that modules which need to
see the kernel interface now have to include pub_{core,tool}_vki.h
explicitly. This is why there are many modified .c files -- they have
all acquired an extra #include line.

This certainly breaks all platforms except x86. Will fix shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6225 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e4b0bf07b0ee0a18eacc5aba91686ab5fc1d327b 06-Jun-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright dates.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5954 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
1baf7db4de0c9488e135499bca93b8f24e3256fd 19-Apr-2006 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> - Fix indentation in one section of Cachegrind
- In the same section, use VG_(percentify) to avoid overflow when computing
information for -v printing.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5857 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
3a384b30634e5310b59847974502997a0fdce4a1 22-Jan-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Index the BB_info table by redirected guest address, not
non-redirected guest address. This is a small but significant change
needed to make function wrapping work. The problem is that with
function wrapping two different translations are associated with the
non-redirected address (of a wrapped function entry point), and so
cachegrind asserts. Whereas the redirected guest addresses reflect
the reality of only one translation associated with each address. So
use them instead.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5582 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
461df9c36f6a07e4f0c14ae068e8e8e9bd383b26 17-Jan-2006 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> 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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
afa12261c2989fc05af6aeea5151574f8bd373bc 24-Dec-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix a nasty 64-bit-uncleanness bug in OSet spotted by Julian -- for fast
comparisons it was only considering the bottom 32-bits of the key.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5427 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
5bb86824902cff997eba4c392433560c24bffb45 23-Dec-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> ppc64-linux fixes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5421 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
bcd75fcb80c13b9828a4c33b0d7acf1499e14135 19-Dec-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Remove all remaining profiling gunk.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5388 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4311fe6d249cc8708e2004ea71e0cfe0c26cd52b 09-Dec-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix minor Cachegrind bug that was occasionally causing misattributions of
counts when a function name was used in more than one module. This showed
up for "???" functions when profiling Valgrind itself.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5319 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
a5ad9bad02cd70f6ee15255e7c9684fdd847e582 10-Nov-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cachegrind was aborting if it hit a client request. Now it doesn't.
This fixes #116057, I think. I added a regtest so it won't regress again.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5072 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
46c59b1976b9dbe66671f863e50a35ec07574196 01-Nov-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Make ULong_width(0) return 1 instead of 1431655765. This stops
cachegrind segfaulting if it can't open its output file.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4973 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
a9f538cf1b5b61ddc88f51cee14a4636d9310149 23-Oct-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't assume the first statement is an IRMark, since it could instead
be part of a self-check. Instead, copy verbatim any IR preamble
preceding the first IMark. This stops cachegrind asserting on
self-checking translations.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4967 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
75553fd251ae48fdda87aaf7ca4b3440cce30723 20-Oct-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> rm unused var


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4950 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4ba057cce1d81a949f5a899b5abb99e90a731bcc 18-Oct-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> 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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
fd9f622c84fba391215e415e942772862d0fe2af 16-Oct-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> A small Cachegrind cleanup: previously it was copying some things (eg.
instr_size and instr_addr) into Ir events, then later copying those into
instrInfo nodes. Now it just allocates the instrInfo nodes earlier and
copies them in directly. This is a bit more concise and easier to
understand.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4937 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
c285dcafa07466ab307726181cae2e9478b632c0 16-Oct-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cachegrind cleanups:
- Remove some unnecessary assertions.
- Add in some new ones.
- Make things more concise and readable by factoring out things like
"cgs->events[i+1]" into things like "ev2" in flushEvents().



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4936 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
d3bef4fa511894315998fee73f502650a8583de1 15-Oct-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> OSet-ified Cachegrind:
- The instrInfoTable was a VgHashTable, now it's an OSet.
- The CC table was a custom 3-level hash table, now it's an OSet. This
is easier to understand and there's no worrying about whether the hash
array sizes are big enough. It also has the nice property that the
results in the cachegrind.out.<pid> file are now sorted, so they're a bit
easier to read.

I did some testing and the performance difference appears to be negligible;
CC table and InstrInfo table lookups and traversal aren't that critical.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4933 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
f7d2609f04de254676f8ea35d0dae996ab8e892e 12-Oct-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Tiny comment/code layout tweaks; no functional change.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4913 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
a3a29a5a828aff527539c5a504f0c82a333f30f4 12-Oct-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Get rid of bbSeenBefore and associated logic: it appears to be
irrelevant.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4912 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
20edebfd7da1f94a1490e150283ddb0b35a05796 12-Oct-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> rm trigram stuff.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4904 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
5155dec2ac1d0855fcdc5060503e1d98a281b26a 12-Oct-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> 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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
0103de5f5d39add9080fe72884af2a5520c1f661 10-Oct-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Convert some native types to our types.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4899 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
45f4e7c91119c7d01a59f5e827c67841632c9314 27-Sep-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> 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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
99cb9e3fca178235e290dadde5534ae2042c9914 25-Sep-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> actually, they're unsigned



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4766 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
71adc3682ef6a35fcf65c7aba88bd437fb2ce553 25-Sep-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Print longs as longs.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4765 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
d111d100b250215516c66f0fceda76815191afa0 13-Sep-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't print the client's argv[i] if it's null, and related changes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4629 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
20677cc8ca07b5881279667f3759517bebfc29cb 13-Aug-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cachegrind should not assert when it encounters a client request.

BACKPORT TO 3_0_X



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4391 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4bd67b50448a7b826a34f8f8977d88ece0f6cac7 11-Aug-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Get rid of some stupidity:

- Added some useful hash table functions (vanilla lookup() and remove()).
[Actually, I accidentally added them with my previous commit]

Replaced various simple uses of VG_(HT_get_node) with these new functions.

- Passing record_freemismatch_error() the MAC_Chunk of the freed heap block.
So now we don't need to call describe_addr() to re-find that block, which
means that we can remove the MAC_Chunk from the malloc_list earlier, rather
than having to do a lookup and then later remove it with the stupid removal
handle returned by VG_(HT_get_node)().


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4379 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
b3507eaf2446369c502115c3678bc37050bb2b90 03-Aug-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fixed a bug in Cachegrind: it was adding instrumentation after
conditional jumps, so if those jumps were taken, the instrumentation
wasn't executed. This was causing the I-cache access counts to be
underestimated.

This commit puts the instrumentation before the jumps, except for the
odd case of REP instructions, giving the same behaviour as 2.4.0.
Based on a patch from Josef Weidendorfer.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4309 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
9264559eba4aa5d397a278b4e1a50c03de30693f 23-Jul-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> A commit which is almost all trivial change.

- m_main: if --log-file-qualifier applies, do not add ".pid"
at the end of the name

- Fix the logic which detected whether the just-devised name
already existed. This was broken (by me) because it could not
distinguish the reasons for failing to open the logfile.

Doing this required changing the return type of VG_(open)
from Int to SysRes (to make failure reasons visible) and
that's the cause of most of the changes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4228 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
8db3da8f7b18728fc0c4cbe6edb864a9d363adc0 03-Jul-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Remove dead function.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4101 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
f69f945020cbcc35fe0c98c3b223d96c7322a95a 03-Jul-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changed m_hashtable.c to allow the size of the hash table to be specified
when it is created. Fortunately this didn't affect code outside this
module except for the calls to VG_(HT_construct)().

As a result, we save some memory because not all tables have to be as big
as the ones needed for malloc/free tracking.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4100 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
2e595858903b80f29f271dc94e32a9e052bb4c8a 01-Jul-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track Vex API change (r1239, introduction of endianness-indications in
IR loads and stores.)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4072 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
856c54e8c6a56e5a29124a5ee3cb12b37b850342 26-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Combine the percentify() functions from Cachegrind and m_transtab into
a single more general one exported from m_libcprint.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4034 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
af839f52d74df156d655201a889954133ab01be7 23-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> 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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
57ca7abfcefb38c62a60fb41aa91227303dd2db6 22-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Remove VG_(getcwd_alloc)(), which can be done otherwise pretty easily.
This halves m_libcfile's dependence on m_mallocfree.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3995 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
c7561b931e249acf3768ead77638545b0ccaa8f1 19-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Final commit for the initial modularisation pass:

- Broke part of m_scheduler off into a new module m_threadstate. It
contains ThreadState, VG_(threads)[] and some basic operations on the
thread table. All simple stuff, the complex stuff stays in m_scheduler.
This avoids lots of circular dependencies between m_scheduler and other
modules.

- Managed to finally remove core.h and tool.h, double hurrah!

- Introduced pub_tool_basics.h and pub_core_basics.h, one of which is
include by every single C file.

- Lots of little cleanups and changes related to the above.

- I even did a small amount of documentation updating.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3944 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
7cee6f99bd38612f2d1c0102d75ca55839601538 13-Jun-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updates to the rest of the debuginfo module to track directory names.
The only interesting part is a change of signature of
VG_(get_filename_linenum) so that callers can optionally request
directory info too.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3909 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
f536bbbd4bf2024926574c5ed99b3e6251c6ff44 13-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Created m_machine, for various machine-related things.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3903 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
f39e9a36dca9642668a66c6b054f81c88650bcb9 12-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Finished the modularisation of vg_mylibc.c, which meant it could be removed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3894 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
eb8896b58301a0a7a34281384d705072994369f0 04-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised file and socket libc stuff in m_libcfile.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3844 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
132bfccd21960e462352175f8553a5bdce8a210c 04-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised assertions and panics in m_libcassert.

As part of this, killed the VG_STRINGIFY macro, which was used to expand
out names like "VG_(foo)" and "vgPlain_foo" in assertion failure
messages. This is good since we actually want the "VG_(foo)" form used
in these messages.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3842 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
36a20fa5f779a0a6fb7b4a90dcaa6376481f1faa 03-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularise printing functions in m_libcprint.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3840 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
97405b2d134b52880d6dbec3eb2929e2002c2542 02-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Started modularising vg_mylibc. Put all the standalone stuff -- ie. not
relying on any other modules -- in m_libcbase.

Also converted the 'size' parameters to functions like VG_(memcpy) and
VG_(strncpy) from Int to SizeT, as they should be.

Also removed VG_(atoll16) and VG_(toupper), which weren't being used.

Also made VG_(atoll36) less flexible -- it now only does base-36 numbers
instead of any base in the range 2..36, since base-36 is the only one we
need. As part of that, I fixed a horrible bug in it which caused it to
return incorrect answers for any number containing the digits 'A'..'I'!
(Eg. for "A; it would return 17 instead of 10!)

Had to disable the assertions in VG_(string_match), since this module can't
see vg_assert, which wasn't ideal but also isn't a disaster.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3838 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
31513b4ab8477029517f07f0dcf1b441cb818548 01-Jun-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised the profiling stuff as m_profile.c. It's much more
sensible now -- no vg_dummy_profile.c, no silly #including of
vg_profile.c from tools.

Unfortunately, it still doesn't work, due to bad interactions
with signal handling that I don't understand.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3833 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
ea27e4627518665dd6c81213c0ba1f7ff0218e1a 31-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised all the debug info stuff as m_debuginfo/. It's a mess
and needs further cleaning up, but it's a start.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3821 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
2024234c590f408994b373abfb00bc2cd2a90c48 17-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added module m_options for holding all the command-line option stuff.
Perhaps parts of process_cmd_line_option() should go in here, but I've
not done that for now.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3751 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
02bc4b8f54227320aa2b9ac4805173e0e2e3eeae 15-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't mix backticks and apostrophes when quoting words -- eg. use 'foo'
rather than `foo', as www.cl.cam.ac.uk/~mgk25/ucs/quotes.html explains
we should (in more detail than you'd imagine was possible). I did this
both in output messages and in some comments, for consistency.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3723 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
81c00df9ac724e898179dd90e52b2e15deb11fd8 14-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised vg_hashtable.c as m_hashtable.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3710 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4bf3abaf2d172d2f0a720bae5959d161bb7125d2 14-May-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't crash when dealing with dealing with naughty programs that set
argv[] elements to NULL. Bad bad GHC ...



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3702 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e6da2fac63546d5242b183ec7efc0aa96e2e1273 12-May-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Handle (ignore) IRStmt_AbiHint.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3679 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
43b9a8abb139b86a24457fa3c19b9cb60ca17c3a 10-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> 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 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
717cde5bda18d17792d1994c61b6a27408b4b4a7 10-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Modularised the malloc/free stuff into two modules: m_mallocfree for the
malloc/free implementation, and m_replacemalloc with the stuff for the tools
that replace malloc with their own version. Previously these two areas of
functionality were mixed up somewhat.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3648 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
51d827bcd88ce045a383ea1ca81768757df2d1fa 09-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Big clean-up: changed the core/tool interface to be mediated entirely
through the VG_(tdict) function dictionary, rather than using TL_(foo)
functions.

This facilitated the following changes:

- Removed the "TL_" prefix, which is no longer needed.

- Removed the auto-generated files vg_toolint.[ch], which were no longer
needed, which simplifies the build a great deal. Their (greatly
streamlined) contents went into core.h and vg_needs.h (and will soon
go into a new module defining the core/tool interface).

This also meant that tool.h.base reverted to tool.h (so no more
accidentally editing tool.h and not having the changes go into the
repo, hooray!) And gen_toolint.pl was removed. And toolfuncs.def was
removed.

- Removed VG_(missing_tool_func)(), no longer used.

- Bumped the core/tool interface major version number to 8. And I
killed the minor version number, which was never used. The layout
of the ToolInfo struct is such that this should not cause problems.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3644 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
a60a7c1e253ae622f18530386a1ff5f545b835ac 08-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rename some _SIZE macros as _SZB to make their units clear. This change is
in response to a mixed-units (bytes and words) error we had involving
VGA_STACK_REDZONE_SIZE (which is now VGA_STACK_REDZONE_SZB).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3639 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
2bc10126a94b421a490b2759dc50ab67ec4ee116 08-May-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> A crucial, crucial change: update my email address.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3632 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
ee0e6a3c70ce68db7d88720a408a739b7b0527d3 24-Apr-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Inline function that's only used once.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3550 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
101e5729e2a2170260c76d2b915ffb6363d04539 21-Apr-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Comment-only change



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3537 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
016712a7dabe38a207c8dbcc2d31bbaf2ee218bd 04-Apr-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Remove the x86-specific is_valid_data_size() test. Also, make any dataSize
greater than MIN_LINE_SIZE equal to MIN_LINE_SIZE. This makes the
x86/fpu-28-108 regression test pass.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3518 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
8a97c6d61ccd93aae5034e2f3f619c62c9a9cc41 31-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> This change reduces the number of calls to dlsym() when loading tools from a
lot to one. This required two basic changes.

1. Tools are responsible for telling the tool about any functions they
provide that the tool may call. This includes basic functions like
TL_(instrument)(), functions that assist core services such as
TL_(pp_Error)(), and malloc-replacement-related functions like
TL_(malloc)().

2. Tools that replace malloc now specify the size of the heap block redzones
through an arg to the VG_(malloc_funcs)() function, rather than with a
variable VG_(vg_malloc_redzone_szB).

One consequence of these changes is that VG_(tool_init_dlsym)() no longer
needs to be generated by gen_toolint.pl.

There are a number of further improvements that could follow on from this one.
- Avoid the confusingly different definitions of the TL_() macro in the
core vs. for tools. Indeed, the functions provided by the tools now don't
need to use the TL_() macro at all, as they can have arbitrary names.
- Remove a lot of the auto-generated stuff in vg_toolint.c and vg_toolint.h
(indeed, it might be possible to not auto-generate these at all, which
would be nice).
- The handling of VgToolInterface is currently split across vg_needs.c and
vg_toolint.c, which isn't nice.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3487 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
9fb73db1c3fe4296264cf35cc2f3cd671ab2e61a 27-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add VGA_ prefix to the arch-specific macros {MIN,MAX}_INSTR_SIZE and
REGPARMS.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3458 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
7f4a862b4942a40ac966ecdfb62a6375e804347e 26-Mar-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Pay attention to the annotations on dirty helper calls, since they
they tell us about the memory transactions done by such calls.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3451 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
31066fdeab8de4f54272c8cf3a7e9bf1fa74d1e5 26-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't use the VGP_ for profiling any more, just use VG_ -- we want to use
VGP_ for platform-specific things.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3435 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
2b641feb3bceb64e288bfb94edce3aa3260fc5c9 21-Mar-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> handleOneStatement: Derive a value for *instrAddr from the IMark in a
way which is 64-bit clean.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3399 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
17a56bf6715182163c1d75b0f0b046888ad3f5d8 21-Mar-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Bring in the beginnings of 64-bit cleanness for IR mangling in cachegrind:
* use mkIRExpr_HWord to wrap constants
* add a bunch of paranoia to check we're not screwing up too obviously



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3398 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
d54babf82db303dfe43082bfe1af75d7b58b3267 21-Mar-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track Vex API change in rev 1062: pass both the guest and host word
sizes to the instrumentatation functions. Make most of the tools
abort if they are not the same; we can't handle that case yet.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3397 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
21dc345ce861ac5a5686391b77659934c1d49a3e 21-Mar-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track Vex API (semantics) changes in rev 1061: introduction of IRStmt_NoOp.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3396 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
710d6c27c3ce7bf26639bda3ab4f42695bc92c2c 20-Mar-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Track minor Vex API changes that occurred in Vex rev 1059.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3393 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
6a3009b8aaa160fafe5b5d027bca3ce055bf6816 20-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Reinstated Cachegrind. Seems to be working ok -- numbers compare pretty
well with those for the CVS version... the I1 accesses are noticeably
higher, but everything else is nearly the same.

There's some ugliness in spots, partly due to shortcomings with Vex. And
CPUID auto-detection is currently disabled, because cpuid is disabled in
general.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3389 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
5361242f022b38fadb4cdf02428cea8b8d901a90 12-Mar-2005 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update copyright notice for 2005 on all relevant files. Don't bother trying
to be selective about it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3303 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
b5f6f51ebcac183818061bf53427a3e7808ef10d 11-Mar-2005 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge in changes from the 2.4.0 line. This basically brings in the
overhaul of the thread support. Many things are now probably broken,
but at least with --tool=none, simple and not-so-simple threaded and
non-thread programs work.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3265 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
a1d1a64a8c1ed1fe6071cacf11bd461636e37862 26-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Simplified the way Cachegrind configures the caches; it was really
strange before. Also aborting if any command-line-provided cache
configuration is unacceptable, rather than falling back on defaults;
it's simpler and arguably better than just emitting a warning.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3118 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
14d01ce38ebacdcf07217c8a3b4d517d01439c23 26-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Reinstated Helgrind and Cachegrind; at least, they are included in
compilation now. They both don't work, as I made the minimal changes
necessary to get them compiling (eg. both of the TL_(instrument)()
functions were commented out and replaced with a stub).

This means that 'make dist' should more or less work again, which is
necessary for my playing with the XML documentation.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3107 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
26f025100805e561354c8c98b5ebb0c4a517d9a9 22-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Converted the SK_ prefix to TL_ everywhere.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3060 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
6799325d013e8e5668c2b8727203c77294ccd202 22-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Renamed VG_(skin_panic) as VG_(tool_panic).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3057 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
ca82cc01fb1580551144b69d3f17213a80d952e1 22-Nov-2004 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Renamed sk_assert() as tl_assert().



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3055 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
928a5f790be9ced888356457d085260fbcedc62e 03-Nov-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> 64-bit cleanness: Yet more UInt-->SizeT changes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2910 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
6f7eb9c52cb76ebf151531334073eb5ca3931ced 06-Oct-2004 thughes <thughes@a5019735-40e9-0310-863c-91ae7b9d1cf9> Put back missing space...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2731 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
30c43d8b70620e6f7275d1e44dc490a366f6636d 06-Oct-2004 thughes <thughes@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cope with arguments over 510 characters in length when writing the
cachegrind output file.

CCMAIL: 90834-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2730 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
b35a8b9024e9bfb4166bc01698710e0af1a0bad9 11-Sep-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Arch-abstraction:
- In Cachegrind, abstract out x86-specific use of CPUID to find cache
configuration. Required adding a cachegrind/x86/ directory, and fiddling
a bit with the build system.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2698 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
fbfc108b38cd2923027f2d09040c127ed0bed705 04-Sep-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Arch-abstraction: introduce constants for min and max instruction sizes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2660 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
46063201cea329c862bed94ffffae9c82a706be5 02-Sep-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Arch-abstraction: renamed "vg_skin.h" as "tool.h". Kept a residual vg_skin.h
(which just #includes tool.h) for backward-compatibility.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2647 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
eec46308860444fc70041a71169a5d7830271fcf 23-Aug-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Small step in factoring out arch-specific code: replace
__attribute((regparm(n))) with REGPARM(n) everywhere. REGPARM() is defined in
vg_skin.h, but will eventually be defined separately for each arch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2601 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
564b2b03f26d176eb1e39187450cfc29bf186b8d 07-Aug-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add some missing 'static' annotations. Thanks to Josef W for spotting them.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2573 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
ca1f2dc95a27b745683356c60b077d2210d9b960 21-Jul-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Type name wibble


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2518 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
7149b42388dfedd30c1e675a1924fe770a5a95b6 20-Jul-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> comment typo


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2514 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
08fa9a789bd4747bb753fcbf53318c0de9426fc8 16-Jul-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Slightly change, with J's approval, startup copyright messages to better
reflect reality.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2489 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4c9611acc55dbc3ea61c59fdac86c8176f0f45f9 07-Jul-2004 thughes <thughes@a5019735-40e9-0310-863c-91ae7b9d1cf9> Only print a warning about not having identified the cache if we have
actually failed to recognise it...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2460 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
f5b74669d3cbdf56f658e5692170e1d8fb930d6a 07-Jul-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> minor


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2459 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
9313ac4501443976bc792928b6100e98b556bc3b 06-Jul-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Completely overhauled Cachegrind's data structures. With the new
scheme, there are two main structures:

1. The CC table holds a cost centre (CC) for every distinct source code
line, as found using debug/symbol info. It's arranged by files, then
functions, then lines.

2. The instr-info-table holds certain important pieces of info about
each instruction -- instr_addr, instr_size, data_size, its line-CC.
A pointer to the instr's info is passed to the simulation functions,
which is shorter and quicker than passing the pieces individually.

This is nice and simple. Previously, there was a single data structure
(the BBCC table) which mingled the two purposes (maintaining CCs and
caching instruction info). The CC stuff was done at the level of
instructions, and there were different CC types for different kinds of
instructions, and it was pretty yucky. The two simple data structures
together are much less complex than the original single data structure.

As a result, we have the following general improvements:

- Previously, when code was unloaded all its hit/miss counts were stuck
in a single "discard" CC, and so that code would not be annotated. Now
this code is profiled and annotatable just like all other code.

- Source code size is 27% smaller. cg_main.c is now 1472 lines, down
from 2174. Some (1/3?) of this is from removing the special handling
of JIFZ and general compaction, but most is from the data structure
changes. Happily, a lot of the removed code was nasty.

- Object code size (vgskin_cachegrind.so) is 15% smaller.

- cachegrind.out.pid size is about 90+% smaller(!) Annotation time is
accordingly *much* faster. Doing cost-centres at the level of source
code lines rather than instructions makes a big difference, since
there's typically 2--3 instructions per source line. Even better,
when debug info is not present, entire functions (and even files) get
collapsed into a single "???" CC. (This behaviour is no different
to what happened before, it's just the collapsing used to occur in the
annotation script, rather than within Cachegrind.) This is a huge win
for stripped libraries.

- Memory consumption is about 10--20% less, due to fewer CCs.

- Speed is not much changed -- the changes were not in the intensive
parts, so the only likely change is a cache improvement due to using
less memory. SPEC experiments go -3 -- 10% faster, with the "average"
being unchanged or perhaps a tiny bit faster.

I've tested it reasonably thoroughly, it seems extremely similar result
as the old version, which is highly encouraging. (The results aren't
quite the same, because they are so sensitive to memory layout; even
tiny changes to Cachegrind affect the results slightly.)

Some particularly nice changes that happened:

- No longer need an instrumentation prepass; this is because CCs are not
stored grouped by BB, and they're all the same size now. (This makes
various bits of code much simpler than before).

- The actions to take when a BB translation is discarded (due to the
translation table getting full) are much easier -- just chuck all the
instr-info nodes for the BB, without touching the CCs.

- Dumping the cachegrind.out.pid file at the end is much simpler, just
because the CC data structure is much neater.

Some other, specific changes:

- Removed the JIFZ special handling, which never did what it was
intended to do and just complicated things. This changes the results
for REP-prefixed instructions very slightly, but it's not important.

- Abbreviated the FP/MMX/SSE crap by being slightly laxer with size
checking -- not an issue, since this checking was just a pale
imitation of the stricter checking done in codegen anyway.

- Removed "fi" and "fe" handling from cg_annotate, no longer needed due
to neatening of the CC-table.

- Factorised out some code a bit, so fewer monolithic slabs,
particularly in SK_(instrument)().

- Just improved formatting and compacted code in general in various
places.

- Removed the long-commented-out sanity checking code at the bottom.

Phew.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2458 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
6fcbbe1a85b46a51e2c660bdb70a5fe45e02e561 03-Jul-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Remove unused variable.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2457 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
c5f2a5494e7af7bff0d68c2b56a3c3abd1c05b52 02-Jul-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix meaningless typo.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2456 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4ee64969e83a00fb6165d3862be568c0c20acc25 16-Jun-2004 thughes <thughes@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added VG_(cpuid) to replace the various bits of inline assembler used
to query the CPU characteristics as the use of four implicit registers
causes havoc when GCC tries to inline and optimise the assembler.

Fix to bug #79696.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2421 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
96b466ac1bc4b09b45c08b79cdadd3d42461bc2b 15-Mar-2004 thughes <thughes@a5019735-40e9-0310-863c-91ae7b9d1cf9> Move the handling of PSHUFW from the SSE code to the MMX code so that
it will work on older Athlons which only have MMXEXT support.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2319 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
09d853e574543c38d13fa82aebeec3986f070816 21-Jan-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix a bug in Cachegrind: when invalidating BBs, the lookup in the BBCC_table
sometimes failed, causing an assertion failure. This is because the debug
info for the code address, which is used in the lookup,
can change -- eg. "myprint.c:myprint()" is found at instrumentation, but by the
time the invalidation occurs, it's changed to "myprint.c:???". So it now falls
back to a slow exhaustive search of the table.

This was causing cachegrind/tests/dlclose to fail, and should hopefully fix
bug #72781.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2218 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
7cc9c239f785f2903b597cdb34418bed42d25331 21-Jan-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Convert "skin" to "tool" in various places; almost entirely within comments,
nothing that will affect code.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2217 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
b1affa88ef798064014f9657fa6bb4a8501fdbf8 19-Jan-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Patch from Tom Hughes, for bug 72643:

Patch to improve SSE/SS2 support

This patch should implement most of the missing SSE/SSE2 opcodes. About
the only ones it doesn't do are the MASKMOVxxx ones as they are quite
horrible and involved an implicit reference to EDI so I need to think
about them a bit more.

The patch also includes a set of tests for the MMX/SSE/SSE2 opcodes to
validate that they have the same effect under valgrind as they do when
run normally. In one or two cases this wasn't actually the case even
for some of the implemented opcodes, so I fixed those as well ;-)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2202 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
fca60182e856482778cdc95788b6ddf0f5303169 05-Jan-2004 jseward <jseward@a5019735-40e9-0310-863c-91ae7b9d1cf9> Support for FXSAVE/FXRSTOR (Tom Hughes). Fixes #71180.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2183 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
27fc1dacf94f1b9622d3a9bf48677fc09f61f7aa 04-Jan-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Folded cg_sim_{gen,I1,D1,L2}.c into cg_sim.c, which makes a lot more sense and
is shorter.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2178 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
bb1c99123c95fb9a4a2617d6e1d09559ac68db80 04-Jan-2004 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updated copyright dates for 2004. Also added a couple of missing headers and
footers to some new files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2177 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
98abfc7bb7798c4ac4580f7e0bc7171de94a0255 16-Dec-2003 fitzhardinge <fitzhardinge@a5019735-40e9-0310-863c-91ae7b9d1cf9> This jumbo-checkin is the Full Virtualization checkin. This eliminates
Valgrind's dependency on the dynamic linker for getting started, and
instead takes things into its own hands.

This checkin doesn't add much in the way of new functionality, but it
is the basis for all future work on Valgrind. It allows us much more
flexibility in implementation, and well as increasing the reliability
of Valgrind by protecting it more from its clients.

This patch requires some changes to tools to update them to the changes
in the tool API, but they are straightforward. See the posting "Heads
up: Full Virtualization" on valgrind-developers for a more complete
description of this change and its effects on you.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2118 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
421281e98e4ffc5e5fc034398707b8523676555d 20-Nov-2003 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updated all "report bugs to..." messages to point to valgrind.kde.org; also
updated the docs to refer to valgrind.kde.org instead of the old website.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2055 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
137bc55f216bc7d9528f159a78cdf9025e0b02ff 14-Nov-2003 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Started to rescind the name "skin", replacing it with "tool". Did this in all
the places that normal users will see:

- command line: --tool=foo (although --skin=foo still works)
- docs: removed all traces (included renaming coregrind_skins.html to
coregrind_tools.html)
- in the usage messages
- in error messages

Also did in in some places that I judged were unlikely to cause clashes with
existing workspaces:

- in the header comments of many files (eg. "This file is part of Memcheck, a
Valgrind tool for...")
- in the regtests script
- in the .supp files
- in AUTHORS
- in README_MISSING_SYSCALL_OR_IOCTL

Also update the AUTHORS file to mention Jeremy.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2027 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
1b58fbc519c18bdc86e6bdf8210337d210e7371c 04-Nov-2003 jseward <jseward@a5019735-40e9-0310-863c-91ae7b9d1cf9> More SSE support for cachegrind.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2003 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
50da0f3c1866bc1e34f4fb23904302c0e54331d8 30-Oct-2003 nethercote <nethercote@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fix cachegrind to deal with VG_(open)() returning any negative number on error,
not just -1.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1968 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
5686735326c9e88fa938f796f5df791e23fc60cc 12-Oct-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Delete some "inline" directives on functions that gcc-3.3.1 declined
to inline. This is needed to get a warning-free compilation on 3.3.1.
It seems we had "inline" on some pretty huge functions in places.
Also it appears gcc-3.3.1 won't inline a function call in a tail call
position, reasonably enough. I assume in that case it prefers to
create a tailcall to the callee, rather than inlining it.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1907 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
97b7b26ba39107ed92d6175e6d14468cb9de68f8 07-Oct-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rudimentary, kludgy, incomplete and probably just plain wrong support
for vendor_id "CentaurHauls", which is the VIA string (reflecting its
design heritage). Currently pretend to be something like a VIA Nehemiah.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1897 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
607adfc8fe0e64e6d9df29bb7fc5885a8855c0af 30-Sep-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added a new flag ',' to printf() format specifications. When specified in a
number, will print it with commas delimiting it. Very useful when printing
large numbers.

Using it, was able to remove the wretched commify() function from Cachegrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1869 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
99ccf083f043ad0386965cc0fa69c2a31cad7bbb 30-Sep-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added VG_(getcwd_alloc)(), which is much easier to use than VG_(getcwd)().
(getcwd() is really a pretty stupid syscall)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1867 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e864e2f6687730c679fa1b6fc0f1608548930d8d 29-Sep-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Add a couple more CPUID-auto-detect cases for Intel CPUs to Cachegrind, thanks
to Josef Weidendorfer.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1858 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
8ad1a4067a6ec44a9f3bc37d1d5629a8f29bf3d7 18-Sep-2003 daywalker <daywalker@a5019735-40e9-0310-863c-91ae7b9d1cf9> fix compiler warning


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1822 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
21f805d31689ded7ee7c0194c392d84ca030cd5f 25-Aug-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Teach Cachegrind about SSE instructions, courtesy of Josef Weidendorfer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1805 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
db918ddd2d0c8be05388b0e08002da6bb630c021 22-Jul-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Truncate the cachegrind.out.<pid> file, if it already exists. It wasn't doing
this, which meant that if a shorter file of the same name was written, the old
contents past the new end would remain, which would be bad. Had (probably)
never happened because the <pid> suffix makes it very unlikely for filenames to
be reused.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1777 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
7e1b3b2d962d0e9d5df94a85ddabcb290c4cba27 04-Jul-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> wibble


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1712 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
39c86656647ce5a9a04787f013287b42ade3d113 21-May-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> wibble


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1648 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
05bcdcb440c26246c3c1d80e4832961d99068b78 18-May-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> gcc-3.3 as supplied with SuSE 8.2 ("gcc version 3.3 20030226
(prerelease) (SuSE Linux)") seems to complain about signed-vs-unsigned
comparisons, when -Wall is on. This commit fixes (most of) those
complaints.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1638 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
13f02933f7378b956eaa73f753b4ec9cddcf6656 30-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fixed a bug in Cachegrind -- if the profiled program changes working directory,
the output file wouldn't get written. No longer creating the file at startup
and then writing it at the end; just writing it at the end. Also recording
the start directory at the start so that the output ends up in it even if the
program does change directory.

Had to add VG_(getcwd)() to vg_mylibc.c for this.

Added a regression test for it too.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1576 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
7d9f94dda63c0e604774f491ed6b3decbf5c3ce5 22-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added "Int exitcode" argument to SK_(fini)(), because it could be useful
for skins.

Changed lackey to print out the exit code.

Changed AUTOMAKE_OPTIONS back to 1.5 (whoops)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1538 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
0e1b514ab8e837f75a207a037ea53a6a721e9d28 15-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updated copyright notices for 2003. Only 4 months late.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1526 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
b4aee054064e8daf9e4c8266760f08974cd8d9fd 15-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Namespace police


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1525 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
3e88418f808bf2840646504481d6a5be1df16541 15-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> -----------------------------------------------------------------------------
overview
-----------------------------------------------------------------------------
Previously Valgrind had its own versions of malloc() et al that replaced
glibc's. This is necessary for various reasons for Memcheck, but isn't needed,
and was actually detrimental, to some other skins. I never managed to treat
this satisfactorily w.r.t the core/skin split.

Now I have. If a skin needs to know about malloc() et al, it must provide its
own replacements. But because this is not uncommon, the core provides a module
vg_replace_malloc.c which a skin can link with, which provides skeleton
definitions, to reduce the amount of work a skin must do. The skeletons handle
the transfer of control from the simd CPU to the real CPU, and also the
--alignment, --sloppy-malloc and --trace-malloc options. These skeleton
definitions subsequently call functions SK_(malloc), SK_(free), etc, which the
skin must define; in these functions the skin can do the things it needs to do
about tracking heap blocks.

For skins that track extra info about malloc'd blocks -- previously done with
ShadowChunks -- there is a new file vg_hashtable.c that implements a
generic-ish hash table (using dodgy C-style inheritance using struct overlays)
which allows skins to continue doing this fairly easily.

Skins can also replace other functions too, eg. Memcheck has its own versions
of strcpy(), memcpy(), etc.

Overall, it's slightly more work now for skins that need to replace malloc(),
but other skins don't have to use Valgrind's malloc(), so they're getting a
"purer" program run, which is good, and most of the remaining rough edges from
the core/skin split have been removed.

-----------------------------------------------------------------------------
details
-----------------------------------------------------------------------------
Moved malloc() et al intercepts from vg_clientfuncs.c into vg_replace_malloc.c.
Skins can link to it if they want to replace malloc() and friends; it does
some stuff then passes control to SK_(malloc)() et al which the skin must
define. They can call VG_(cli_malloc)() and VG_(cli_free)() to do the actual
allocation/deallocation. Redzone size for the client (the CLIENT arena) is
specified by the static variable VG_(vg_malloc_redzone_szB).
vg_replace_malloc.c thus represents a kind of "mantle" level service.

To get automake to build vg_replace_malloc.o, had to resort to a similar trick
as used for the demangler -- ask for a "no install" library (which is never
used) to be built from it.

Note that all malloc, calloc, realloc, builtin_new, builtin_vec_new, memalign
are now aware of --alignment, when running on simd CPU or real CPU.

This means the new_mem_heap, die_mem_heap, copy_mem_heap and ban_mem_heap
events no longer exist, since the core doesn't control malloc() any more, and
skins can watch for these events themselves.

This required moving all the ShadowChunk stuff out of the core, which meant
the sizeof_shadow_block ``need'' could be removed, yay -- it was a horrible
hack. Now ShadowChunks are done with a generic HashTable type, in
vg_hashtable.c, which skins can "inherit from" (in a dodgy C-only fashion by
using structs with similar layouts). Also, the free_list stuff was all moved
as a part of this. Also, VgAllocKind was moved out of core into
Memcheck/Addrcheck and renamed MAC_AllocKind.

Moved these options out of core into vg_replace_malloc.c:
--trace-malloc
--sloppy-malloc
--alignment

The alternative_free ``need'' could go, too, since Memcheck is now in complete
control of free(), yay -- another horribility.

The bad_free and free_mismatch events could go too, since they're now not
detected by core, yay -- yet another horribility.

Moved malloc() et al wrappers for Memcheck out of vg_clientmalloc.c into
mac_malloc_wrappers.c. Helgrind has its own wrappers now too.

Introduced VG_USERREQ__CLIENT_CALL[123] client requests. When a skin function
is operating on the simd CPU, this will call a given function and run it on the
real CPU. The macros VG_NON_SIMD_CALL[123] in valgrind.h present a cleaner
interface to actually use. Also introduce analogues of these that pass 'tst'
from the scheduler as the first arg to the called function -- needed for
MC_(client_malloc)() et al.

Fiddled with USERREQ_{MALLOC,FREE} etc. in vg_scheduler.c; they call
SK_({malloc,free})() which by default call VG_(cli_malloc)() -- can't call
glibc's malloc() here. All the other default SK_(calloc)() etc. instantly
panic; there's a lock variable to ensure that the default SK_({malloc,free})()
are only called from the scheduler, which prevents a skin from forgetting to
override SK_({malloc,free})(). Got rid of the unused USERREQ_CALLOC,
USERREQ_BUILTIN_NEW, etc.

Moved special versions of strcpy/strlen, etc, memcpy() and memchr() into
mac_replace_strmem.c -- they are only necessary for memcheck, because the
hyper-optimised normal glibc versions confuse it, and for memcpy() etc. overlap
checking.

Also added dst/src overlap checks to strcpy(), memcpy(), strcat(). They are
reported not as proper errors, but just with single line warnings, as for silly
args to malloc() et al; this is mainly because they're on the simulated CPU
and proper error handling would be a pain; hopefully they're rare enough to
not be a problem. The strcpy check is done after the copy, because it would
require counting the length of the string beforehand. Also added strncpy() and
strncat(), which have overlap checks too. Note that addrcheck doesn't do
overlap checking.

Put USERREQ__LOGMESSAGE in vg_skin.h to do the overlap check error messages.

After removing malloc() et al and strcpy() et al out of vg_clientfuncs.c, moved
the remaining three things (sigsuspend, VG_(__libc_freeres_wrapper),
__errno_location) into vg_intercept.c, since it contains things that run on the
simulated CPU too. Removed vg_clientfuncs.c altogether.

Moved regression test "malloc3" out of corecheck into memcheck, since corecheck
no longer looks for silly (eg. negative) args to malloc().

Removed the m_eip, m_esp, m_ebp fields from the `Error' type. They were being
set up, and then read immediately only once, only if GDB attachment was done.
So now they're just being held in local variables. This saves 12 bytes per
Error.

Made replacement calloc() check for --sloppy-malloc; previously it didn't.

Added "silly" negative size arg check to realloc(), it didn't have one.

Changed VG_(read_selfprocmaps)() so it can parse the file directly, or from a
previously read buffer. Buffer can be filled with the new
VG_(read_selfprocmaps_contents)(). Using this at start-up to snapshot
/proc/self/maps before the skins do anything, and then parsing it once they
have done their setup stuff. Skins can now safely call VG_(malloc)() in
SK_({pre,post}_clo_init)() without the mmap'd superblock erroneously being
identified as client memory.

Changed the --help usage message slightly, now divided into four sections: core
normal, skin normal, core debugging, skin debugging. Changed the interface for
the command_line_options need slightly -- now two functions, VG_(print_usage)()
and VG_(print_debug_usage)(), and they do the printing themselves, instead of
just returning a string -- that's more flexible.

Removed DEBUG_CLIENTMALLOC code, it wasn't being used and was a pain.

Added a regression test testing leak suppressions (nanoleak_supp), and another
testing strcpy/memcpy/etc overlap warnings (overlap).

Also changed Addrcheck to link with the files shared with Memcheck, rather than
#including the .c files directly.

Commoned up a little more shared Addrcheck/Memcheck code, for the usage
message, and initialisation/finalisation.

Added a Bool param to VG_(unique_error)() dictating whether it should allow
GDB to be attached; for leak checks, because we don't want to attach GDB on
leak errors (causes seg faults). A bit hacky, but it will do.

Had to change lots of the expected outputs from regression files now that
malloc() et al are in vg_replace_malloc.c rather than vg_clientfuncs.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1524 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e0205ff1b39eaf28a5639a832519a0848350b93d 08-Apr-2003 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Fixed minor printf bogons.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1519 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
d7971010f75e299ecba7a28eb836d872549beef1 04-Apr-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Rationalise ucode generation for 4-byte moves into the MMX unit (movd).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1506 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
3949d1097fc410b52cfee8ff922d57779615f928 28-Mar-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Teach cachegrind about MMX uopcodes. Nick, can you check this? Thx -- J


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1489 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
3d7c9c8c2e4882c787a9b63befe095785f3d5d07 26-Mar-2003 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Implement support for the MMX instruction set. The scheme used is
the same as that for FPU instructions. That is, regard the MMX state
(which is the same as the FPU state) opaquely, and every time we
need to do a MMX instruction, move the simulated MMX state into the
real CPU, do the instruction, and move it back. JeremyF's optimisation
to minimise FPU saves/restores applies automatically here.

So, this scheme is simple. It will cause memcheck to complain bitterly
if uninitialised data is copied through the MMX registers, in the same
way that memcheck complains if you move uninit data through the FPU
registers. Whether this turns out to be a problem remains to be seen.

Most instructions are done, and doing the rest is easy enough, I just
need people to send test cases so I can do them on demand.

(Core) UCode has been extended with 7 new uinstrs:

MMX1 MMX2 MMX3
-- 1/2/3 byte mmx insns, no references to
integer regs or memory, copy exactly to the output stream.

MMX_MemRd MMX_MemWr
-- 2 byte mmx insns which read/write memory and therefore need
to have an address register patched in at code generation
time. These are the analogues to FPU_R / FPU_W.

MMX_RegRd MMX_RegWr
-- These have no analogues in FPU land. They hold 2 byte insns
which move data to/from a normal integer register (%eax etc),
and so this has to be made explicit so that (1) a suitable
int reg can be patched in at codegen time, and (2) so that
memcheck can do suitable magic with the V bits going into/
out of the MMX regs.

Nulgrind (ok, this is a nop, but still ...) and AddrCheck's
instrumenters have been extended to cover these new UInstrs. All
others (cachesim, memcheck, lackey, helgrind, did I forget any)
abort when they see any of them. This may be overkill but at least
it ensures we don't forget to implement it in those skins.
[A bad thing would be that some skin silently passes along
MMX uinstrs because of a default: case, when it should actually
do something with them.]

If this works out well, I propose to backport this to 2_0_BRANCH.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1483 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
0744b6c126f8cd241042528ce0719cf6ef950a40 11-Dec-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge (from 1_0_BRANCH) rev 1.16.2.4 of the old vg_cachesim.c:

Make file_err() not abort the current process; recover and keep
going instead. This fixes a problem running OpenOffice on cachegrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1362 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
78210aa4799a5b3d4ebb44361577ca02dcdeef45 01-Dec-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Take into account TCEntry and alignment overheads when calculating TC
sector sizes. Also, recalibrate all skins against mozilla-1.0.1.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1341 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
c0d8f68810eb79a5a6cb6049d6a4ab1de7dc4e18 30-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Complete integration of the new code management (sectored FIFO) story.

This commit adds stats gathering / printing (use -v -v), and selection
of sector size decided by asking skins, via
VG_(details).avg_translation_sizeB, the average size of their
translations.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1334 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
810086f9489e1cb373bcfc15ab94a3fa3ec403f3 14-Nov-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Lots of changes to future-proof the core/skin interface, making it less likely
that changes will cause binary incompatibilities. Mostly done by hiding naked
structs with function calls.

Structs hidden in this way were: UCodeBlock, SkinSupp and SkinError (which were
merged back with CoreSupp and CoreError into single types Supp and Error),
ShadowChunk, VgDetails, VgNeeds and VgTrackEvents. The last three are the most
important ones, as they are (I think) the most likely to change.

Suitable get()/set() methods were defined for each one. The way UCodeBlocks
are copied for instrumentation by skins is a little different now, using
setup_UCodeBlock. Had to add a few other functions here n there. Changed
how SK_(complete_shadow_chunk) works a bit.

Added a file coregrind/vg_needs.c which contains all the get/set functions.
It's pretty simple.

The changes are not totally ideal -- eg. ShadowChunks has get()/set() methods
for its `next' field which arguably shouldn't be exposed (betraying the fact
that it's a linked list), and the get()/set() methods are a bit cumbersome at
times, esp. for `Error' because the fields are accessed quite a few times, and
the treatment of Supps and Errors is a bit inconsistent (but they are used in
different ways), and sizeof_shadow_blocks is still a hack. But still better
than naked structs. And one advantage is that a bit of sanity checking can be
performed by the get()/set() methods, as is done for VG_({get,set}_sc_extra)()
to make sure no reading/writing occurs outside the allowed area.

I didn't do it for UInstr, because its fields are accessed directly in lots and
lots of spots, which would have been a great big pain and I was a little
worried about overhead of calling lots of extra functions, although in practice
translation times are small enough that it probably doesn't matter.

Updated the example skin and the docs, too, hurrah.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1314 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
7a5ebcf66cfbd2fefa261cfbaf5f03527c299a29 13-Nov-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Merge patch from JeremyF:

39-lock-prefix

Add a new UInstr LOCK to represent a "lock" prefix in the instruction
stream. This has the same semantics as NOP, but allows a skin to tell
whether a group of UInstrs associated with an x86 instruction are
meant to be locked.

HELGRIND: uses the LOCK UInstr to automatically take and release a
special __BUS_HARDWARE_LOCK__ around locked instructions. This only
works properly if all instructions touching a given address are locked
(even reads).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1310 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
27f1a386dce7eb9e1d30b841771c71f0de27f34f 08-Nov-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added a basic core/skin interface versioning system. Each skin must use the
macro VG_DETERMINE_INTERFACE_VERSION exactly once. If the X.Y core and skin
versions don't have a matching X (indicating binary incompatibility), Valgrind
will abort execution immediately at startup.

I even documented it in the skins guide!


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1279 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4aa62bafc2c28dc14153ce8c765687cfb8aa7dde 05-Oct-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Naming wibbles -- start skin names with a capital letter (they deserve it)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1198 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
ac6c17667e489215a0795c24cc1b202254582a4f 04-Oct-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Moved the following macros, which were defined multiple times in multiple
files, into vg_skin.h:

uInstr0, uInstr1, uInstr2, uInstr3, nameIReg, nameISize, nameSReg,
newTemp, newShadow, uLiteral, uCCall

As macros they avoid namespace problems (they expand to VG_(whatever)) so
this should work fine.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1182 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
d04b7c6801102481b53ba2dccb9f693eea01004b 03-Oct-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changed startup message to give information about skin and core separately.
Added "version" and "copyright_author" fields for skins to supply.

Now startup message looks something like this:

==12698== cachegrind, an I1/D1/L2 cache profiler for x86-linux.
==12698== Copyright (C) 2002, and GNU GPL'd, by Nicholas Nethercote.
==12698== Built with valgrind-HEAD, a program execution monitor.
==12698== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
==12698== Estimated CPU clock rate is 1422 MHz
==12698== For more details, rerun with: -v

The skin can specify a version number, but the skins that will be distributed
with Valgrind don't.

Also changed "x86 GNU/Linux" to the wicked "x86-linux" at Julian's request.

Updated default regression test filter to handle this new startup message.

----

Also moved the skin's name, description, etc., fields out of VG_(needs) into a
new struct VG_(details), since they are logically quite different to the needs.
Did a little code formatting, etc., for this. Updated skin docs
correspondingly, too.

Also renamed the need `run_libc_freeres' --> `libc_freeres' so it's a noun
phrase rather than a verb phrase.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1172 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
c953984b8ee34ac55830b9871138b409d9d9476c 02-Oct-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Updated file descriptions in the copyright notices to reflect the core/skin
split. Each skin now has its own two-line description.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1166 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e427a6636de5b2d34c2223821ff5cbf79bad4fad 02-Oct-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changes made so that skin error "report this bug to" messages are distinguished
from core error ones:

- Split up VG_(panic) into VG_(core_panic) and VG_(skin_panic)

- Likewise, split vg_assert into vg_assert and sk_assert

- Added a new need string: `bug_reports_to'

- Removed VG_(skin_error) which was a previous wussy attempt at this change.
This removed the need for the hacky redeclaration of VG_(skin_error) in
vg_profile.c, which is good.

At the moment, Julian and Nick's email addresses are hard-coded into each skin
individually, rather than using a #define in vg_skin.h, because that didn't
feel quite right to me... jseward@acm.org is still done with a #define for
core errors, though.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1164 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4ba5a79d946b22c52856d62dca7c927cb306dfa3 30-Sep-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Converted all functions visible from vg_skin.h with names in CamelCaps to
use_under_scores instead, to be consistent.

Also added some missing 'extern's on function declarations in vg_skin.h.

Also added a quick note in vg_regtest.in on the simplest way to run regression
tests.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1135 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
cac76cb18577b9c51d331f56e8ea241f6effaf31 23-Sep-2002 njn25 <njn25@a5019735-40e9-0310-863c-91ae7b9d1cf9> Changed lots of files for the new core/ + skin/ directory structure:

- changed lots of Makefile.am files
- changed configure.in
- changed lots of #include lines for changed file names
- changed lots of file headers n footers for changed file names
- changed vg_regtest to handle new directory structure -- recursively
traverses subdirectories for .vgtest test files
- changed lots of paths in memcheck/ regression test expected outputs


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1090 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e49d8e7dfd3a9c96feb9935b5920973dfc0b170a 23-Sep-2002 njn25 <njn25@a5019735-40e9-0310-863c-91ae7b9d1cf9> Files updated, added and removed in order to turn the ERASER branch into HEAD


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1086 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
1780dae1643b18e1f8424e147ef2dbe01f1ecd73 16-Aug-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Undid the removal of INCEIPs during Cachegrind instrumentation. Although it
helped performance, it could cause problems.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@588 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
d5063384679d55049e40c02a81daa72235e7c57b 01-Aug-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cache simulation requires strict INCEIP updating so that the boundaries between
individual x86 instructions can be found when instrumenting UCode. However,
EIP is not needed during execution, because the x86 instr addresses are copied
into the cost-centres. So now they INCEIPs are removed during the
instrumentation step once their task is done.

This reduces running times by about 3--7%, and translation sizes by about 9%
(code expansion reduced from about 11x to about 10x).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@550 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
6431be70eaccc43c77869080b96fa1784ee2efe0 28-Jul-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> This commit introduces two new UInstructions: CCALL_1_0, CCALL_2_0.

These are the first of a generic family for calling C functions. CCALL_M_N
calls a function with M word-sized arguments and N word-sized return values
(N == 0 or 1, of course). All stack management is done automatically --
register saving, argument pushing, register restoring. Rough timings show it's
marginally faster (~3%), probably because the instrumentation phase is slightly
simpler and translations are slighly more compact.

It was introduced because the way Cachegrind was calling its helper functions
was not really legitimate -- it involved pushing RealRegs at a point where
RealRegs shouldn't have been used. This flukily worked for Cachegrind, but
caused obscure seg faults when I tried using the same technique for the DIDUCE
stuff. Hence this more general approach.

CCALL_M_N where M+N <= 3 are easy. More args might be done by abusing spare
fields in the UInstr struct, if really necessary. But it's not, yet.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@546 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
b1a77a41d7a96183dd36be8329d0fbacfd761921 13-Jul-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> get_caches(): ensure caches are initialised on targets where
get_caches_from_CPUID fails.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@501 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
83205b3ddae2fb8c0813670a859aa1e252eb406b 14-Jun-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Disable debug printing on BB discard.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@427 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
07133bfaeabb22009eddf26c34912c2a4e95548f 13-Jun-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Inconsequential cleanups to recent cachesim hacking.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@407 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
9b3366a1a6a54a59a5deba5f70b7f850b5c02737 10-Jun-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> vg_annotate.in:
- fixed a bug that was breaking the --threshold option.

vg_cachesim.c:
- fixed a bug that meant instructions that didn't have a line number in the
debug info were being written in cachegrind.out with whatever was the
last known line number. Now using 0.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@403 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
7cf0bd3f98c4140abadc3ecc58f03895ae08efa5 08-Jun-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Removed the need for the user to generate a cache simulation -- now do
automatic cache configuration detection using the CPUID instruction.
This can be overridden from the command-line if necessary.

vg_include.h:
- added the cache_t type and UNDEFINED_CACHE macro

- added command line args (of type cache_t) allowing manual override of
I1/D1/L2 configuration

- added log2(), which is generally useful

vg_main.c, valgrind.in, cachegrind.in:
- added handling of the new --{I1,D1,L2}=<size>,<assoc>,<line_size>
options

vg_cachesim.c:
- lots of stuff for auto-detecting cache configuration with CPUID.
Only handles Intel and AMD chips at the moment, and possibly not all of
them. Falls back onto defaults if anything goes wrong, and the configs
can be manually overridden from the command line anyway.

- now not printing cache summary stats if verbosity == 0. Still writing
cachegrind.out, though.

vg_cachesim_gen.c:
- new file containing stuff shared by the I1/D1/L2 simulations

vg_cachesim_{I1,D1,L2}:
- removed most of it; each now just calls a macro defined in
vg_cachesim_gen.c

vg_cachegen:
- has been cvs removed as it is no longer needed.

Makefile.am:
- added vg_cachesim_gen.c

- removed vg_cachegen

configure.in:
- removed vg_cachegen


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@400 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4294fd43868a9a119c49d59fee67222bb354e9bd 05-Jun-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Cache simulator now handles basic block discards correctly. When
VG_(cachesim_discard_notify) is called, the cost centre array for the basic
block is removed from the table, and its counts are aggregated into a single
"discard" cost centre, and the cost centre array is free'd.

The aggregate discard cost centre is given the filename:function_name
"(discarded):(discarded)". Mentioned this in the manual.

Only tested with tests/discard.c. Seems to work well for that case though :)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@385 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
95114da8989ca85d49af3f7f7beb30cc960e66ab 05-Jun-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added compile-time option to print instruction addresses for each line in
cachegrind.out. Increases file size by a fair bit, but useful for debugging
stabs errors <sigh>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@384 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
3c23d434e811d997f4210a07400d2c81b4ab4184 02-Jun-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Update author attributions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@350 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
18d7513cc08bf982711c8a22b70d56af6aa87b33 16-May-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Remove existing non-working support for self-modifying code, and instead
add a simple compromise, in which the client can notify valgrind
that certain code address ranges are invalid and should be retranslated.
This is done using the VALGRIND_DISCARD_TRANSLATIONS macro in valgrind.h.

At the same time take the opportunity to close the potentially fatal
loophole that translations for executable segments were not being
discarded when those segments were munmapped. They are now.

Documentation updated.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@274 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4f29ddfb0fb35486afe0a0af56f937c6ef019c82 04-May-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> External namespace cleanup.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@210 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
e0ee0712ffeb8bd0bcef71a8af3d863a9b57995e 03-May-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> vg_symtab2.c:
- Can now handle file sizes > 65536 lines, despite the stabs format only
storing line numbers in a short. Do this heuristically, by looking for
line number sequences that go from 65000-odd to 0-odd within the same
file.

This required changing the RiLoc.lineno field to 20 bytes, which gives a
maximum file length of 1,000,000-odd lines, whichs seems reasonable.

In order to keep RiLoc at 12 bytes (important because there are lots of
them) this required stealing four bits from the RiLoc.size field,
reducing it to 12 bits. This isn't too bad because the size is unlikely
to be larger than 4096 bytes -- we were already ignoring any ones larger
than 10,000 bytes because they were suspicious anyway (and see next
point).

- Tightened up the sanity checking on line address ranges. Previously any
range that looked suspicious (eg. > 10000 bytes, or not within the bound
of the segment info) was simply ignored(!) Now it prints a warning when
this happens and truncates the size to 1 to be safe; also there are some
extra assertions for totally space-cadet numbers.

(At first these checks were all assertions, but I tried a version of GNU
gas that produces a small handful of dodgy stabs entries; warnings
seemed a reasonable compromise.)

vg_cachesim.c:
- Removed the requirement that both types of cost centre (iCC, idCC) have
instr_addr as their second word. Less fragile -- now the only
requirement is that they both have their type tag as their first byte.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@197 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
1d021faa082f2f1cf76da1b9b45c23b40742f494 02-May-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> Added "L2 refs line" (an oversight).
Fixed minor output summary spacing wibble.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@196 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
98e91bc2252dbba63c07afc7eafcd2026827ab2e 01-May-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Don't want to see these guys with just -v. There get to be bazillions
of them after a while.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@184 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
9aae6745deda47e9713c0d23e215c763fe460a5a 30-Apr-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> vg_symtab2.c:
Discovered sometimes a SLINE stabs entry is the last one (which broke an
assertion). In such a case, we must guess the line's instruction address
range -- I've guessed 4, arbitrarily.

vg_cachegen.in, vg_cachesim_{I1,D1,L2}.c:
Discovered a bad bug in the cache simulation: when determining if a
references straddles two memory blocks, to find the end of the range I was
adding 'size' to the base address, rather than 'size - 1'. This was
causing way too many straddled references, which would inflate the miss
counts.

vg_cachesim.c:
Minor stuff


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@176 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
fc3e5d3d112726a1fdb80f9637687ad41e7473ea 30-Apr-2002 sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> Relax assertion to avoid this: vg_cachesim.c:402
(compute_BBCC_array_size): Assertion `!is_STORE && !is_FPU_R &&
!is_FPU_W' failed.

I don't know if this is correct, but I can run kate having done so.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@171 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c
4f9c93451bfd464ec0500c284b9d136ffdee8959 29-Apr-2002 njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> New files:
- vg_cachesim.c
- vg_cachesim_{I1,D1,L2}.c
- vg_annotate.in
- vg_cachegen.in

Changes to existing files:

- valgrind/valgrind.in, added option:

--cachesim=no|yes [no]

- Makefile/Makefile.am:
* added vg_cachesim.c to valgrind_so_SOURCES var
* added vg_cachesim_I1.c, vg_cachesim_D1.c, vg_cachesim_L2.c to
noinst_HEADERS var
* added vg_annotate, vg_cachegen to 'bin_SCRIPTS' var, and added empty
targets for them

- vg_main.c:
* added two offsets for cache sim functions (put in positions 17a,17b)
* added option handling (detection of --cachesim=yes which turns off of
--instrument);
* added calls to cachesim initialisation/finalisation functions

- vg_mylibc: added some system call wrappers (for chmod, open_write, etc) for
file writing

- vg_symtab2.c:
* allow it to read symbols if either of --instrument or --cachesim is
used
* made vg_symtab2.c:vg_what_{line,fn}_is_this extern, renaming it as
VG_(what_line_is_this) (and added to vg_include.h)
* completely rewrote the read loop in vg_read_lib_symbols, fixing
several bugs. Much better now, although probably not perfect. It's
also relatively fragile -- I'm using the "die immediately if anything
unexpected happens" approach.

- vg_to_ucode.c:
* in VG_(disBB), patching in x86 instruction size into extra4b field of
JMP instructions at the end of basic blocks if --cachesim=yes.
Shifted things around to do this; also had to fiddle around with
single-step stuff to get this to work, by not sticking extra JMPs on
the end of the single-instruction block if there was already one
there (to avoid breaking an assertion in vg_cachesim.c). Did a
similar thing to avoid an extra JMP on huge basic blocks that are
split.

- vg_translate.c:
* if --cachesim=yes call the cachesim instrumentation phase
* made some functions extern and renamed:
allocCodeBlock() --> VG_(allocCodeBlock)()
freeCodeBlock() --> VG_(freeCodeBlock)()
copyUInstr() --> VG_(copyUInstr)()
(added to vg_include.h too)

- vg_include.c: declared
* cachesim offsets
* exports of vg_cachesim.c
* added four new profiling events (increasing VGP_M_CCS to 24 -- I kept
the spare ones)
* added comment about UInstr.extra4b field being used for instr size in
JMPs for cache simulation

- docs/manual.html:
* Added --cachesim option to section 2.5.
* Added cache profiling stuff as section 7.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@168 a5019735-40e9-0310-863c-91ae7b9d1cf9
/external/valgrind/cachegrind/cg_main.c