212 Commits

Author SHA1 Message Date
Philippe Waroquiers
231d67347f add --vgdb-prefix arg to callgrind_control
If valgrind is started with --vgdb-prefix arg, then callgrind_control
cannot find and control this valgrind.
So, add an (optional) argument to callgrind_control,
and have callgrind tool report the needed vgdb prefix argument
if the user supplied this arg.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13769
2014-01-11 13:56:48 +00:00
Josef Weidendorfer
f56906eb07 Callgrind: support printing stats via vgdb
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13763
2013-12-17 15:12:06 +00:00
Josef Weidendorfer
84b48d7742 Fix bug 327238.
assertion failure in Callgrind: bbcc.c:585 (vgCallgrind_setup_bbcc):
 Assertion 'passed <= last_bb->cjmp_count' failed

Background:
We want to detect the jump behavior of code, that is, the side exit
from a SB, as there can be many. For that, instrumented code writes
the exit number into a global variable (jmps_passed) before an eventual
exit.

With an exception happening in the first few instructions of an SB,
jmps_passed never was written, and still contained an old value. This
got saved/restored around the exception handler, and resulted in the
failed assertion.
Solution: always initialize jmps_passed to zero in setup_bbcc(), which
is called at the beginning of every SB.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13712
2013-11-12 15:32:58 +00:00
Julian Seward
dbf9b63605 Update copyright dates (20XY-2012 ==> 20XY-2013)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13658
2013-10-18 14:27:36 +00:00
Mark Wielaard
363d971e32 Reuse (shared) cachegrind source files in callgrind directly.
The callgrind Makefile.am had a common sources list that included
../cachegrind/cg_arch.c. This doesn't play well with automake and
subdir-objects. Especially make distclean was broken because some
.deps files were removed multiple times.

Just include the shared source file directly into the callgrind
source file that needs it (cg_arch.c in sim.c).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13528
2013-09-03 15:22:14 +00:00
Julian Seward
5d7649ffe9 Rename cg-arch.c to cg_arch.c so as to be consistent with other
filenames, including cg_arch.h :)  No functional change.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13527
2013-09-03 08:39:28 +00:00
Philippe Waroquiers
0e086ed3b1 Fix 316145 - callgrind command line options in manpage reference (unknown) callgrind manual
Patch by Mark Wielaard.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13324
2013-03-10 16:29:02 +00:00
Josef Weidendorfer
5a2f34cff6 Fix inconsistency between callgrind and format spec
Bug found by, and fix based on a patch by Mark Wielaard

Callgrind format specification was inconsistent with
what Callgrind generates, and what callgrind_annotate
accepted. Now, callgrind_annotate accepts the examples
in the format specification.

* Callgrind writes 'cfi=' lines for when a call target goes
  into another source file. According to the spec, 'cfl=' is
  used for this. Change the spec to allow both, and change
  callgrind_annotate to accept both.
* The spec requires just an "events:" line as minimum header
  to render the file as correct according to the specification.
  callgrind_annotate also expected a 'cmd=' line. Fixed.
* The 'summary:' line is optional in the spec. Fixed in
  callgrind_annotate. If not provided, summary is calculated
  from all cost lines.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13310
2013-03-04 17:02:35 +00:00
Florian Krohm
463822e3eb Fix two asserts that Coverity's checker diagnosed as having side effects.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13252
2013-01-21 13:51:21 +00:00
Julian Seward
c8f2fb5b51 Teach Callgrind about IRLoadG and IRStoreG.
git-svn-id: svn://svn.valgrind.org/valgrind/branches/COMEM@13206
2012-12-27 12:02:15 +00:00
Florian Krohm
e7f4d4f57f 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
2012-11-24 19:41:54 +00:00
Florian Krohm
af66466ce4 Changes to allow compilation with -Wwrite-strings. That compiler option
is not used for testcases, just for valgrind proper.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13137
2012-11-23 16:17:43 +00:00
Petar Jovanovic
e2110c0f00 Flush events in Callgrind before enering a RMW region.
On some MIPS platforms, we had an issue in which SC would fail each time
due to some memory access occuring in the RMW region.
If code for simulator events is called before LL, it can help SC to pass.

This change fixes a few LL/SC issues on MIPS arch.

The patch by Josef Weidendorfer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13136
2012-11-23 00:01:36 +00:00
Josef Weidendorfer
635fe22514 Remove not-used typedef
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13131
2012-11-19 22:05:08 +00:00
Josef Weidendorfer
39cea8c6da Callgrind: fix Ir cost update for ignored functions
Also without cache simulation, Callgrind maintains Ir cost.
This is done in setup_bbcc by incrementing an execution counter
for last_bbcc (the cost center for the previously executed BB
in current context) and the global cost counter.

However, we forgot to increment any counter if the currently
executing function should be ignored. We need to still update
costs, add attribute this to a not-ignored call site (as
given in CLG_(current_state).nonskipped).

Before this fix, there was a difference in Ir cost with vs. without
cache simulation. This was because ignored functions (e.g. PLT code)
contributed no cost when not doing cache simulation.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13130
2012-11-19 22:05:06 +00:00
Florian Krohm
b87aa67392 Final patch for Char/HChar mixups.
Remove -Wno-pointer-sign from configure.in.
Fixes 273227.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13125
2012-11-18 00:36:15 +00:00
Florian Krohm
d0aa69c331 Fix more Char/HChar mixups. Closing in...
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13119
2012-11-10 22:29:54 +00:00
Christian Borntraeger
ad1814e451 s390x machines z196 and zec12 have 4 levels of caches. Adopt the test suite
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13106
2012-11-07 07:57:01 +00:00
Josef Weidendorfer
3cb1abdb61 Callgrind: use memory block number as tag for simple model
Same as in Cachegrind. Gives a slight speedup.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13094
2012-10-29 21:47:45 +00:00
Josef Weidendorfer
02838bf16f Use always_inline attribute also in Callgrinds simulator
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13093
2012-10-29 21:28:05 +00:00
Florian Krohm
5337376bf2 More Char/HChar fixes and constification.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13088
2012-10-27 18:39:11 +00:00
Florian Krohm
becb3e5032 Fix a few Char/HChar mixups in callgrind.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13069
2012-10-21 02:55:56 +00:00
Florian Krohm
7d59048401 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
2012-10-07 21:59:42 +00:00
Florian Krohm
a9b2103cf2 This patch is the first installment of the cache info reorganisation.
It's reorg only. No new cache autodetection stuff has been added.

coregrind
pub_tool_cpuid.h is removed as it is no longer exposed to tools.
Its contents has moved to pub_core_cpuid.h.
New file: coregrind/m_cache.c to contain the autodetect code for
cache configurations and define other cache characteristics that
cannot be autodetected (i.e. icaches_maintain_coherence). Most of 
cg-arch/x86-amd64.c was moved here. The cache detection code for
x86-64 needs to be fixed to properly initialise VexCacheInfo. It
currently has cachegrind bias.
m_cache.c exports a single function (to coregrind): 
   VG_(machine_get_cache_info)(VexArchInfo *vai)
This function is called from VG_(machine_get_hwcaps) after hwcaps have
been detected.

cachegrind
Remove cachegrind/cg-{ppc32,ppc43,arm,mips32,s390x,x86-amd64}.c
With the exception of x86/mamd64 those were only establishing a
default cache configuration and that is so small a code snippet that
a separate file is no longer warranted. So, the code was moved to
cg-arch.c. Code was added to extract the relevant info from 
x86-amd64.
New function maybe_tweak_LLc which captures the code to massage the
LLc cache configuration into something the simulator can handle. This
was originally in cg-x86-amd64.c but should be used to all architectures.
Changed warning message about missing cache auto-detect feature
to be more useful. Adapted filter-stderr scripts accordingly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13028
2012-10-07 19:47:04 +00:00
Philippe Waroquiers
613012246f Improve callgrind performance by 4 to 8% using UNLIKELY
Performance improvements from 4 to 8% obtained on amd64 on the perf tests by:
1. using UNLIKELY inside tracing macros
2. avoid calling CLG_(switch_thread)(tid) on the hot patch setup_bbcc
   unless tid differs from CLG_(current_tid).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12939
2012-09-02 20:26:23 +00:00
Florian Krohm
4f0dd9365a Update filter_stderr due to changed warning message.
Unbreaks callgrind regtests on s390.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12918
2012-08-30 15:29:48 +00:00
Philippe Waroquiers
15493bb541 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
2012-08-14 22:28:31 +00:00
Julian Seward
4a3633e266 Update copyright dates to include 2012.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12843
2012-08-05 15:46:46 +00:00
Julian Seward
9461b8012f Doc updates for 3.8.0.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12838
2012-08-05 13:44:15 +00:00
Julian Seward
3e344c57f6 Merge in a port for mips32-linux, by Petar Jovanovic and Dejan Jevtic,
mips-valgrind@rt-rk.com, Bug 270777.

Valgrind: changes to existing files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12616
2012-06-07 09:13:21 +00:00
Julian Seward
aa021b2811 If we are doing cache simulation, refuse to start at all if the minimum
cache line size is smaller than the maximum guest register size.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12606
2012-06-03 23:10:55 +00:00
Josef Weidendorfer
2fd31d27a2 Callgrind: use jmpkind from VEX for side exits.
To detect calls and returns, Callgrind's heuristic
starts with using the jumpkind got from VEX for
a control flow change instruction. However, for
side exits, it always assumed a (conditional) jump,
which holds true for x86, but e.g. not for ARM.

This fixes Callgrind to use the jumpkind found
by VEX for all exits, which should help making
Callgrind work for ARM. It also moves the check
whether a boring jump is actually a fall-through
to instrumentation time. This changes (fixes) the
result for indirect jumps to the next instruction,
which should not be classified as fall-through
(anyway, this case is probably very rare).

This patch introduces an own enum for jump kinds
in Callgrind. This is less confusing than misusing
the VEX jump kind type, as Callgrinds wants
to distinguish BB fall-throughs from real jumps
(which both are Ijk_Boring in VEX).
Also, setup_bbcc now stores separately whether the
jump kind is conditional or not.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12269
2011-11-14 21:16:25 +00:00
Josef Weidendorfer
ff5bf18eb8 callgrind: remove command file polling
This is the last part of moving from command file polling
to the vgdb ptrace method for interactive control of Callgrind.
VG 3.7.x ported callgrind_control to vgdb (in r11867), but
still did command file polling to support existing KCachegrind
releases. KCachegrind from upcoming KDE SC 4.8 will use
callgrind_control instead of manually writing command files.

The main benefit from this is, apart from getting rid of
continous file polling activity in Callgrind, that blocked
processes can now respond to callgrind_control.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12268
2011-11-14 19:01:21 +00:00
Julian Seward
95f980821a When doing instrumentation, pay attention to the Ist.IMark.delta
fields.  This makes the --ct-verbose=1 output make a lot more sense
for Thumb code.  Should have no effect on any other platform.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12260
2011-11-08 19:32:57 +00:00
Josef Weidendorfer
ba9b09511b Get rid of over-cautious check to make BEAM happy
To play save, make an assertion out of it.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12237
2011-10-26 17:44:43 +00:00
Julian Seward
084b7cb10b Fix #284384 (clang 3.1 -Wunused-value warnings in valgrind.h,
memcheck.h) by changing a bunch of VALGRIND_DO_CLIENT_REQUEST_EXPR
into VALGRIND_DO_CLIENT_REQUEST_STMT for cases where the return value
of the former would be unused.  (Bart Van Assche, bart.vanassche@gmail.com)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12226
2011-10-24 13:21:57 +00:00
Julian Seward
0d7caa744f Get a bunch more copyright dates in the right format, 20xx-2011,
so the auto-update script will handle them correctly in future.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12207
2011-10-23 07:49:30 +00:00
Julian Seward
c96096ab24 Update all copyright dates, from 20xy-2010 to 20xy-2011.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12206
2011-10-23 07:32:08 +00:00
Josef Weidendorfer
d08c246e3f Fix callgrind part of bug 280757.
For this, we make VG_(tmpdir) available to tools.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12163
2011-10-17 18:12:48 +00:00
Bart Van Assche
eaf864d634 callgrind/tests/Makefile.am: Add regression tests simwork-both, simwork-branch and simwork-cache to the distribution tarball
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12154
2011-10-14 09:31:54 +00:00
Josef Weidendorfer
5c36030d9f Make some vgdb interface to callgrind_control internal
The vgdb "status" monitor command is still available, but
used for pretty printing of status information now (acutally,
just some place holder for real information up to now: just
number of running threads). The internal interface used by
callgrind_control to provide stack traces and event counts
is using "status internal", and is not documented, as the
format is not for human consumption.

This also adds some documentation.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12014
2011-09-06 19:08:35 +00:00
Josef Weidendorfer
7617408d27 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
2011-09-06 19:08:31 +00:00
Tom Hughes
d4552238d5 Make callgrind report the detected cache configuration as well.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11995
2011-08-19 09:05:13 +00:00
Josef Weidendorfer
3bb3954eb5 Update ugly Callgrind hack for supporting instrumentation modes
To support different instrumentation modes, callgrind calls
VG_(discard_translations), which up to now does not belong to the
functions allowed to call from tools, as this is unsafe if
called from generated code.

Callgrind hacks around that by defining the prototype itself.
However, in r4789 (from Sep 27 2005!) a 3rd arg was added for
debugging output. Thus, callgrind could crash if called
with "-d -d".

As the "instrumentation off" feature seems to be used quite often,
it really would be nice to have VG_(discard_translations) callable
from tools...

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11906
2011-07-21 20:24:54 +00:00
Josef Weidendorfer
bd379979b8 callgrind_control: fix parsing of vgdb -l
If valgrind is called with absolute path (as qtcreator does),
callgrind_control found nothing, as it looked for
"... for valgrind ...", thus breaking qtcreator.

This also fixes expected behavior with client commands called with
absolute path. For "/usr/bin/valgrind --tool callgrind /usr/bin/foo",
running "callgrind_control foo" should catch this callgrind command.
Instead, you previously had to include the absolute path.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11905
2011-07-21 18:58:37 +00:00
Josef Weidendorfer
5eb8c47884 Port callgrind_control to vgdb
Same functionality, apart from "-l" to show "long information".
This only printed the current working directory of the callgrind run,
which currently is not available any longer, but not really needed.

The port to vgdb has an important benefit:
callgrind can now be controlled by callgrind_control also when
the client program is blocked/sleeping in a system call. This was
not possible before as a command file was polled only while the
client was running.

Ubuntu by default restricts PTRACE (used by vgdb) to parent processes,
making Ubuntu show similar behavior as before: vgdb is not allowed
to attach by PTRACE when the client is blocked/sleeping, so
callgrind_control works similar to before this change on Ubuntu.

A final patch, which gets rid of command file polling, will be
submitted after Valgrind 3.7, as KCachegrind currently writes
command files directly, and needs to be changed to rely on
callgrind_control instead.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11867
2011-07-11 14:46:44 +00:00
Josef Weidendorfer
4a3ad5c4fc callgrind: add vgdb commands needed for porting callgrind_control
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11866
2011-07-11 14:46:41 +00:00
Julian Seward
97c113e7e0 valgrind and tool mon. cmds prefixes changes + doc fixes + new vgdb option
--cmd-time-out

* changed prefixes of Valgrind core monitor commands from vg. to v.
* removed prefixes of Tool monitor commands
* memcheck leak_check 'leakpossible' arg renamed to 'possibleleak'
* memcheck make_memory 'ifaddressabledefined' arg renamed to
'Definedifaddressable'
    (with uppercase D to avoid confusion with 'defined' arg).
* vgdb options
  - Some doc updates : more logical option order documentation,
       specify 'standalone' for options aimed at standalone usage.
  - added option --cmd-time-out for standalone vgdb
     (comment of Josef Weindendorfer, needed to interface with a callgrind GUI)
* updated tests according to the above.
* updated documentation according to the above.
* some additional minor doc fixes/clarifications

(Philippe Waroquiers, philippe.waroquiers@skynet.be).  Bug 214909
comment 111.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11844
2011-06-28 08:20:39 +00:00
Josef Weidendorfer
04003f215d Suppress warning about associativity change for tests
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11840
2011-06-27 17:26:19 +00:00
Julian Seward
48d69a241a Move the GDBserver documentation from the "Valgrind core" chapter
to the "Valgrind core: advanced topics" chapter.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11821
2011-06-17 08:31:22 +00:00