268 Commits

Author SHA1 Message Date
Julian Seward
cceed053ce Bug 79362 - Debug info is lost for .so files when they are dlclose'd. Majorly reworked by Philippe Waroquiers. 2018-01-11 19:40:12 +01:00
Ivo Raisr
d8f648486e Fix some spelling mistakes.
Fixes BZ#374719
Patch by: klemens <ka7@la-evento.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16336
2017-05-05 22:13:20 +00:00
Ivo Raisr
38edd50c0e Update copyright end year to 2017 in preparation for 3.13 release.
n-i-bz



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16333
2017-05-04 15:09:39 +00:00
Josef Weidendorfer
db860c7cdc Add a format marker to callgrind files
KCachegrind currently uses a quick format detection before
actually loading a file, and checks for a line starting with
"events:" in the first 2kB for that. This obviously is fragile,
as shown by an internal bug report by Philippe: before the
"events" line, Callgrind puts a "cmd:" line with the command
line. If this is very long, the detection fails and the file
does not get loaded at all.

While KCachegrind would not need to have this quick format
check at all, it is useful if multiple input format filters
get supported at some point, to automatically select the
correct filter.

Further, for the "file" command, for file managers and
desktop environments, having an unique way to detect a
file format is important.

It is not too late to fix this issue for the callgrind format.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16196
2017-01-10 20:21:21 +00:00
Philippe Waroquiers
53032ebb48 Small optimisation: no need to have a syscall wrapper unless collect systime is yes
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16167
2016-12-03 17:09:20 +00:00
Philippe Waroquiers
48d506364c Small changes in callgrind_annotate and callgrind manual
* callgrind_annotate: ignore the lines giving the long names of the
  events: such lines are used by kcachegrind for the GUI, so are better
  accepted (and ignored) by callgrind_annotate
* Document in callgrind_annotate manual that thresholds can be given
  per event kind.
* Avoid a division by zero in callgrind_annotate, for 'special data'
  such as produced by (some) xtrees.
  


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16125
2016-11-11 14:22:34 +00:00
Julian Seward
c6e56acc75 Fix invalid code caught by Ubsan, in which we compute the address
of "cgs->events[-1]", even though it isn't dereferenced.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15930
2016-08-06 07:15:30 +00:00
Philippe Waroquiers
f2e1687cb8 Fix misplaced closing parenthesis in various VG_(....) calls
At many places, we have:
   VG_(fun(a,b,c))
instead of
   VG_(fun)(a,b,c)
So, fix these cases, found using:
grep -n -i -e 'VG_([a-z][a-z0-9_]*[^a-z0-9_)]' *.c */*.c */*/*.c



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15776
2016-01-27 22:35:14 +00:00
Josef Weidendorfer
b47baba217 Rephrase Callgrind manual about limiting event aggregation
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15637
2015-09-07 10:23:58 +00:00
Julian Seward
adc2dafee9 Update copyright dates, to include 2015. No functional change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15577
2015-08-21 11:32:26 +00:00
Florian Krohm
84a68aadcc Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15498
2015-08-05 19:04:51 +00:00
Julian Seward
ac60633d65 Bug 345248 - add support for Solaris OS in valgrind
Authors of this port:
    Petr Pavlu         setup@dagobah.cz
    Ivo Raisr          ivosh@ivosh.net
    Theo Schlossnagle  theo@omniti.com
            


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15426
2015-07-21 14:44:28 +00:00
Florian Krohm
7a474c9455 Fix typos in source code. Patch by Dmitriy (olshevskiy87@bk.ru).
Fixes BZ #349874


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15394
2015-07-05 21:53:33 +00:00
Josef Weidendorfer
5b74bd2aee Minor shuffling in Callgrind format doc
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15360
2015-06-26 15:44:01 +00:00
Josef Weidendorfer
9cd0f4e211 Complete/Fix Callgrind format specification.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15358
2015-06-26 14:05:33 +00:00
Josef Weidendorfer
9b43616636 Fix Bug #344314 callgrind_annotate ... commands containing newlines
Escape newlines in command arguments for "cmd:" header field in dumps
We could do unescaping in callgrind_annotate, but a escaped command
even seems better there.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14947
2015-02-18 16:28:58 +00:00
Florian Krohm
d47181fd7d Add command line flag --max-threads=<integer> to increase the number of
threads that valgrind can handle. No recompile is needed. 
Part of fixing BZ #337869.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14932
2015-02-13 19:08:26 +00:00
Florian Krohm
c29515885b Fix undefined behaviours when shifting.
Found by libubsan.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14913
2015-02-06 20:32:15 +00:00
Julian Seward
45a0fb5e69 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
2015-02-05 12:59:46 +00:00
Florian Krohm
cbd27b7288 Export VG_(discard_tranalsations_safely) to the tools. It is
only allowed to be called in certain contexts which is
enforced at runtime.
Change callgrind accordingly.
New header file pub_tool_transtab.h added.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14867
2015-01-13 17:33:59 +00:00
Florian Krohm
d64b630f9a Add VG_(gettimeofday) such that callgrind can use it without
a bloody hack.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14857
2015-01-08 14:43:29 +00:00
Josef Weidendorfer
fc60e4c9c8 Callgrind: fix BB discarding
When the info struct for a BB is created, we use the first guest
instruction address as key to insert the info into a hash table.
We should do the same when discarding.

This actually is not a real problem, as Callgrind obviously
is used very rarely with redirections. But we should be consistent
with cachegrind.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14856
2015-01-08 14:15:18 +00:00
Florian Krohm
a9aa079113 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
2015-01-04 17:20:45 +00:00
Florian Krohm
e7ed65a9f3 Track the IMark changes in VEX r3055.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14844
2015-01-02 17:32:40 +00:00
Florian Krohm
ae89e282cc Buffer audit. Resize a few.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14824
2014-12-19 20:29:22 +00:00
Florian Krohm
115f5cd399 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
2014-12-16 20:55:58 +00:00
Florian Krohm
73c5378615 Remove callgrind's percentify and commify functions as well as the
assorted buffers that go with them.
Part of fixing BZ #337869.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14810
2014-12-14 15:39:57 +00:00
Florian Krohm
f7c5c06c5d 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
2014-12-12 19:32:10 +00:00
Florian Krohm
69d42e3d4b Fix BZ 334802. Patch by Mark Wielaard with a few mods to make it apply.
r14794 is related as well.
Also: remove -Wno-format-zero-length from compile options.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14795
2014-11-29 14:41:32 +00:00
Florian Krohm
04b8584502 Audit two buffer sizes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14720
2014-11-13 22:45:58 +00:00
Florian Krohm
ac3b22e6af Merge revisions 14445 and 14446 from the BUF_REMOVAL branch to trunk.
Two things:
- remove the buffer argument from VG_(DebugInfo_sect_kind)
- allocate AddrInfo::SectKind::objname dynamically


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14719
2014-11-13 21:41:28 +00:00
Florian Krohm
73df75ebba Merge r14340,14346-14348,14352,14354-14355 from the BUF_REMOVAL branch to
trunk.
Convert callgrind to use VG_(fprintf).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14713
2014-11-11 20:46:34 +00:00
Florian Krohm
f3358e09cb Merge revisions 14366 and 14367 from the BUF_REMOVAL branch to trunk.
In function dump_state_togdb use VG_(gdb_printf) directly. No need to write
to a buffer first.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14700
2014-11-06 22:01:15 +00:00
Florian Krohm
dc0c3d41ac Merge revisions 14344 and 14345 from the BUF_REMOVAL branch to trunk.
Basically:
CLG_(sprint_eventmapping)  --> CLG_(eventmapping_as_string)
CLG_(sprint_mappingcost)   --> CLG_(mappingcost_as_string)
The new functions return the string in a dynamically allocated buffer
that caller ought to free.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14699
2014-11-06 21:43:44 +00:00
Florian Krohm
3a05af83d1 Merge r14339 from BUF_REMOVAL branch to trunk.
Prepare print_file function to be converted to use VG_(fprintf). 
Basically get rid of arithmetic involving the output buffer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14687
2014-11-04 15:08:53 +00:00
Florian Krohm
d7cc7eac99 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
2014-10-27 12:06:35 +00:00
Florian Krohm
aa96ed2915 Merge r14289 from the BUF_REMOVAL branch to trunk.
Change CLG_(get_debug_info) to not build up an absolute pathname in its
'file' parameter. Instead give it an additional parameter to hold the
directory name. Callers can then build up the absolute pathname if needed.
This change will come in handy soonish when VG_(get_filename_lineno) will be
changed and those buffers will disappear.
The change has a bit of ripple to get_fn_node_inseg and CLG_(get_file_node).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14666
2014-10-26 19:16:14 +00:00
Florian Krohm
665280aeaf 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
2014-10-25 19:20:38 +00:00
Florian Krohm
3065f2e199 Merge revisions 14337, 14596 from the BUF_REMOVAL branch to trunk.
Change callgrind's init_cmdbuf function to allocate a large enough
buffer for the command line.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14597
2014-10-01 14:16:05 +00:00
Florian Krohm
cd357d71b4 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
2014-09-30 22:15:05 +00:00
Florian Krohm
e383c673dd Ripple from constifying parameters of instrumentation functions and
callbacks from VexTranslateArgs. See VEX r2958.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14564
2014-09-24 12:06:55 +00:00
Florian Krohm
33f32780a5 VG_(malloc/calloc/strdup) never return NULL (and never will).
So it's pointless to test or assert their return values.
Remove code doing so.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14528
2014-09-12 22:24:51 +00:00
Florian Krohm
bfb5d3fc36 Remove some unneded checks as identified by IBM's BEAM checker.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14518
2014-09-11 22:15:39 +00:00
Philippe Waroquiers
596f3836e4 update callgrind and cachegrind filtering logic following rev 14469
rev 14469 gives better description of the tweak done to the
simulated cache. Update filtering logic to filter this (variable) tweaking
msg.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14486
2014-09-07 12:15:52 +00:00
Florian Krohm
f2c8fccbfd Cleanup: remove unused macros.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14360
2014-08-25 22:04:01 +00:00
Florian Krohm
91842f01b9 Remove unused functions and prototypes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14342
2014-08-23 19:42:52 +00:00
Florian Krohm
02fa6bce92 Remove unused function CLG_(sprint_cost).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14341
2014-08-23 19:13:48 +00:00
Josef Weidendorfer
3675ccd650 Cleanup. Cost array was never called anyway.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14334
2014-08-22 17:36:05 +00:00
Florian Krohm
147520eb27 Remove benign macro redefinition.
Give current_jccs internal linkage.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14332
2014-08-22 16:55:07 +00:00
Josef Weidendorfer
6962af41ae Align header comment with other files
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14330
2014-08-22 08:38:40 +00:00