Commit Graph

58 Commits

Author SHA1 Message Date
Julian Seward
32a6fb4fec 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
2007-07-09 23:13:07 +00:00
Josef Weidendorfer
2cf8b61901 callgrind: fix build with srcdir != builddir
Thanks to Diego 'Flameeyes' Pettenò for noting and providing the patch



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6751
2007-06-02 21:36:26 +00:00
Josef Weidendorfer
af3e00ab6f callgrind_annotate: Fix a warning
Port a fix for ""Possible precedence problem" from
cachegrind/cg_annotate, see r1713.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6749
2007-05-24 20:47:10 +00:00
Josef Weidendorfer
a09042a627 Callgrind manual: Fix typo
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6748
2007-05-24 20:42:41 +00:00
Josef Weidendorfer
833c095f5c Callgrind manual: rewriting start of section about avoding cycles
This hopefully makes the whole issue with cycles easier to understand.
And no, this does not get rid of the description of cycles, carefully
crafted by Julian ;-)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6747
2007-05-24 19:24:23 +00:00
Josef Weidendorfer
6575e93f46 Callgrind format: Note about event names in the example
The added paragraph was triggered by a question on the mailing list.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6746
2007-05-24 18:04:42 +00:00
Julian Seward
b91b51b42b Merge (from 3.2 branch) r6743 (Edit the manual to bring it up to date
and make some of the wording a bit more professional sounding.)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6745
2007-05-23 21:58:33 +00:00
Josef Weidendorfer
db1e230c31 Callgrind: improve documentation
* Looks a little bit more like the Cachegrind manual
  (at least in front)
* Removed the out-of-place general section about profiling
  and gprof. Perhaps something like this can be put at
  another place
* Notes about Callgrinds problems with call tracing on PPC
* Include usage of callgrind_annotate, and note its lack of
  cycle detection


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6734
2007-05-08 11:58:23 +00:00
Nicholas Nethercote
802b418634 Fix some copyright notices:
- extend some to 2007
- use njn@valgrind.org instead of njn25@cam.ac.uk
- use "tool" instead of "skin"


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6703
2007-04-15 22:15:57 +00:00
Julian Seward
de95f78978 Add assertion + comment to a loop using VG_(getcwd).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6663
2007-03-26 15:23:20 +00:00
Josef Weidendorfer
e06ac31db4 Callgrind: Fix potential buffer overruns with user provided strings
This introduces some macros to shorten the code for output of
strings to a file descriptor. I could use this a lot,
but this commit limits itself to the potential buffer overruns
(to ease backporting - provided we want to do this)

Heavy use of the macros probably blows up the code. Perhaps
it would be better to provide e.g. a VG_(write_str3) function
in the tool API.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6618
2007-02-26 00:16:09 +00:00
Julian Seward
b7302d9258 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
2007-02-25 15:08:24 +00:00
Josef Weidendorfer
b7dea1c39d Callgrind: Fix threads display of "callgrind_control -s"
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6601
2007-02-16 21:55:25 +00:00
Josef Weidendorfer
ef2d36cdfd callgrind: fix --collect-systime=yes with "no instrumentation" mode
(see bug 139363)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6593
2007-02-16 13:12:43 +00:00
Julian Seward
172505c978 Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6488
2007-01-08 06:01:59 +00:00
Nicholas Nethercote
cadc28816d Split the thread_runstate event into two, start_client_code and
stop_client_code, which is a bit clearer and easier to work with.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6418
2006-12-24 07:51:17 +00:00
Julian Seward
1083ded7e2 Non-functional commit: track IR renaming in vex r1689.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6416
2006-12-24 02:24:11 +00:00
Josef Weidendorfer
3f6a706d72 Callgrind: Throttle calls CLG_(run_thread) after r6413
After the change in r6413, CLG_(run_thread) is called a
lot more often, increasing the polling overhead to check
for a callgrind command file (created by callgrind_control
for controlling a callgrind run in an interactive way).
This reduces the calls to only be done every 5000 BBs,
which gives a similar polling frequency as before.
 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6414
2006-12-23 23:11:20 +00:00
Julian Seward
806c8b17b3 Change the core-tool interface 'thread_run' event to be more useful:
- Rename the event to 'thread_runstate'.

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

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

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

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

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



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6413
2006-12-23 01:21:12 +00:00
Nicholas Nethercote
2c3a6359bb Use the newly-added dopyIRBBExceptStmts() in tools.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6372
2006-11-25 22:38:11 +00:00
Josef Weidendorfer
39550a1d81 Fix same cache simulation bug in callgrind as fixed
in r6365 for cachegrind.

This needs 3 fixes (the 4th is ifdef'd out) for the
3 versions of the simulator in callgrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6367
2006-11-22 21:00:53 +00:00
Julian Seward
51701576f2 This got a bit messed up during recent merging; tidy up.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6313
2006-10-17 21:06:58 +00:00
Julian Seward
10761b3aca Update expected translation sizes, + whitespace changes (??)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6299
2006-10-17 02:24:18 +00:00
Julian Seward
12ef34f623 Track SysRes change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6294
2006-10-17 02:15:17 +00:00
Julian Seward
713b2d46c0 Merge r6086:
Makefile.am changes for AIX5.  Almost all boilerplate stuff fitting in
with the existing factorisation scheme.  The only change of interest
is that configure.in now generates automake symbols of name
VGP_platform and VGO_os, whereas previously it just made VG_platform
which was a bit inconsistent with the VGP/VGO/VGA scheme used in C
code.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6242
2006-10-17 00:56:43 +00:00
Julian Seward
f4560d1332 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
2006-10-15 01:25:13 +00:00
Julian Seward
ae8215b3ac 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
2006-10-14 19:26:10 +00:00
Josef Weidendorfer
0d463585d9 Callgrind: fix interactive control after fork()
This fixes bug 134316: when an program in callgrind does
a fork, callgrind_control does show both now, and they
can be controlled separately.

However, missing in this patch is zeroing of cost centers
directly after the clone syscall in the child.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6082
2006-09-20 21:29:39 +00:00
Josef Weidendorfer
2d6c37778b callgrind_annotate: fix warnings with "--collect-jumps=yes"
This callgrind option produces lines starting e.g. with
"jfi" in the profile data files, which specifies a
source file change between a jump source and jump target.
This itself is meaningless for callgrind_annotate, as
it can not show jump information in its annotation.
However, such "jfi" lines can contain important mapping
info for a (file ID, file name) tuple - which leads to
further warnings and problems if ignored.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6064
2006-09-13 22:57:38 +00:00
Josef Weidendorfer
9418c0a710 Callgrind: Extend test for client requests
This checks all of callgrinds client requests,
and accordings actions (zero/dump) in different states
(collection on/off, instrumentation on/off).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6058
2006-09-12 21:24:24 +00:00
Josef Weidendorfer
c2d143c8ea Callgrind: fix segfault when dumping after toggling instrumentation mode
This bug shows up when callgrind dumps data of a BB with 0 instructions
(the segfault only appears on x86_64; for x86 we were "lucky").

"BB with 0 instructions" happens when you switch on instrumentation
(and callgrinds call graph tracing starts with an emtpy shadow call
stack) in the middle of a run: Whenever the shadow callstack
is empty, but callgrind sees a return instruction (ie. a shadow
callstack underrun), it creates an artifical BB which is faked to
have called the function we are returning from.
This way, the call arc is noted and will appear in the dump.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6053
2006-09-12 19:10:08 +00:00
Josef Weidendorfer
72fd1887c4 Callgrind: Fix failed assertion at toggling instrumentation mode
When instrumentation mode is switched off, we want to fully
reset callgrinds internal execution state, which includes
the shadow call stack and function stack for context generation.
The latter was not completely reset before.

The bug showed up when switching the instrumentation mode on for
the second time, leading to
  Callgrind: callstack.c:211 (vgCallgrind_push_call_stack): 
  Assertion 'current_entry->cxt != 0' failed.

This commit also improves debug output a little bit.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6045
2006-09-10 22:34:20 +00:00
Josef Weidendorfer
012d22a22e Callgrind: Fix annotate script for data produced with --dump-instr=yes
I just noticed that this is still a little wrong, as counts for e.g.
"strcmp" from libc and "strcmp" from ld.so will make up only one entry,
with the object name randomly choosen... but otherwise, it matches
with the data shown by KCachegrind.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6044
2006-08-31 22:54:36 +00:00
Josef Weidendorfer
777cac2987 callgrind: Fix warning about malformed creator line in annotate script
This also changes the default filename (if not given) to callgrind.out.*



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6043
2006-08-31 19:29:13 +00:00
Josef Weidendorfer
9f24ba3822 Correction: Callgrind got rid of the wrapper script with
the merge into Valgrind


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5972
2006-06-09 11:44:03 +00:00
Julian Seward
67a13d6390 Install header in the right place. (From Josef W).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5956
2006-06-06 21:39:09 +00:00
Julian Seward
2687531e76 More copyright updates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5955
2006-06-05 23:27:18 +00:00
Julian Seward
ad67fd79fe Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5954
2006-06-05 23:21:15 +00:00
Josef Weidendorfer
8cf72f1297 Bug reports should have the same destination as for other VG tools
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5943
2006-05-27 15:39:45 +00:00
Josef Weidendorfer
fb75a5cece Fix a failed assertion on retranslation of rep or cmov instructions.
Bug description: Very similar to cachegrind, callgrind stores
metainformation per guest instruction; this meta information is
given when calling into the simulator. In contrast to cachegrind,
callgrind keeps this info when the source is discarded, and checks
on retranslation whether the same meta info is generated.
This check sometimes fails: E.g. for rep x86 instructions, 2 simulator
calls
are usually generated for one x86 instruction (the instruction fetch and
a
data access), thus overwriting the data_size meta information for one
x86
instruction first with 0, and afterwards e.g. with 1. The check on
retranslation
fails because of this. The fix is to only write/check data_size values
>0.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5942
2006-05-27 15:30:58 +00:00
Julian Seward
00b4d31826 Various minor edits.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5929
2006-05-25 18:37:25 +00:00
Julian Seward
ce43a24158 Change ifdefs to select per-platform, not per-arch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5918
2006-05-22 00:09:51 +00:00
Julian Seward
9611713b0e Fix crash on ppc64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5917
2006-05-22 00:05:11 +00:00
Julian Seward
efcd6e4f21 gcc 3.3.3 on ppc64-linux believes (perhaps correctly) that 'fd' can be
used when uninitialised.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5903
2006-05-15 19:27:56 +00:00
Josef Weidendorfer
e4417538ad Callgrind: Fix for callgrind_control
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5870
2006-05-01 01:38:32 +00:00
Josef Weidendorfer
4906b8a958 Callgrind: Improve self-hosting with outer callgrind tool
This adds an option to change the default handling of jumps
between functions. Usually, a jump between functions is
interpreted as call, because such jumps are typically
generated by compilers on tail recursion optimization, and
we want to present this as call to the user. Thus, such
a jump pushes a call onto callgrinds shadow stack.
The option "--pop-on-jump" changes this to pop+push the
shadow callstack: then, a jump between functions is seen
as a return to the caller and a new call.

The default behaviour is _bad_ for using callgrind with
self-hosting. Valgrinds inner loop VG_(run_innerloop)
jumps to generated code, and this code jumps back to
the inner loop. Thus, every executed BB adds 2 calls
to an ever increasing shadow call stack, leading to
memory consumption increasing with runtime :-(

So: For self-hosting valgrind with an outer callgrind,
always use option "--pop-on-jump" for the outer callgrind. 



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5869
2006-05-01 00:55:54 +00:00
Josef Weidendorfer
b1eb513b99 Another fix for interactive control, together with
the --base option, which allows to specify another
directory for dumps and control/result files.
With "--base=/tmp/foo", we want control/result files
in "/tmp", and not in a directory "/tmp/foo/".


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5862
2006-04-21 01:02:13 +00:00
Josef Weidendorfer
bc616b8492 Fixes for interactive control:
- callgrind_control was not working, because it checks the
  "command syntax version" to be at most 1 before doing anything.
  But callgrind used Valgrinds version for this (3.2.0). Now we
  define a separate version COMMAND_VERSION for the syntax format
  of control and result files.
  Strictly, such a version is not needed for interaction of
  callgrind and the script callgrind_control itself, as they are
  delivered in the same package. But there are also external
  controlling tools (most notable KCachegrind)

- Some systems make it difficult for callgrind_control to
  automatically detect running callgrind processes. To make
  interactivity work, one has to provide the cwd with -w.
  For commands expecting a result from callgrind, this result
  was delivered in the wrong result file.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5861
2006-04-21 00:58:58 +00:00
Julian Seward
a7a4513e1e Include missing files in tarball (== unbreak from-tarball builds)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5837
2006-04-08 13:17:25 +00:00
Josef Weidendorfer
efa0f1d7bd Callgrind: add 4 regression tests
The simwork tests check different cache simulator
options/modes. These tests should be extended to
check for the produced call graph.

The threads check tests the callgrind mode where
counts are aggregated separate per thread.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5816
2006-04-02 22:23:27 +00:00