551 Commits

Author SHA1 Message Date
Philippe Waroquiers
8259193f1c On ppc, add generic_start_main.isra.0 as a below main function
We can have stacktraces such as:
==41840==    by 0x10000927: a1 (deep.c:27)
==41840==    by 0x1000096F: main (deep.c:35)
==41840==    by 0x4126BEB: generic_start_main.isra.0 (in /usr/lib64/libc-2.17.so)
==41840==    by 0x4126E13: __libc_start_main (in /usr/lib64/libc-2.17.so)

So, add generic_start_main.isra.0 as a below main function.
This fixes the test  massif/tests/deep-D
2017-09-23 13:49:05 +02:00
Philippe Waroquiers
621cde90f7 Fix Bug 255603 - exp-sgcheck Assertion '!already_present' failed
The code handling array bounds is not ready to accept a reference
to something else (not very clear what this reference could be) :
the code only expects directly the value of a bound.
So, it was using the reference (i.e. an offset somewehere in the debug
info) as the value of the bound.
This then gave huge bounds for some arrays, causing an overlap
in the stack variable handling code in exp-sgcheck.

Such references seems to be used sometimes for arrays with variable
size stack allocated.

Fix (or rather bypass) the problem by not considering that we have
a usable array bound when a reference is given.
2017-09-13 22:47:11 +02:00
Philippe Waroquiers
eec7606c5b Fix 382515 - valgrind: "Assertion 'di->have_dinfo' failed." on wine's dlls/mscoree/tests/mscoree.c
* produce (more) user messages when valgrind cannot read a pdb file.
* recover properly from an invalid/unsupported pdb file.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16465
2017-07-31 20:43:43 +00:00
Philippe Waroquiers
af72da8cec fix misleading indentation
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16460
2017-07-21 18:46:35 +00:00
Ivo Raisr
246bb0e25f Remove TileGX/Linux port.
Fixes BZ#379504.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16340
2017-05-08 17:21:59 +00: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
Julian Seward
9e280aa166 Bug 377717 - Fix massive space leak when reading compressed debuginfo sections.
This makes reading of compressed debuginfo usable for very large object files.
It also adds a bunch extra documentation about a tricky invariant in the
compressed debuginfo handling (a recursive cache refill path!) and adds a
whole bunch of assertions.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16279
2017-03-20 21:34:02 +00:00
Ivo Raisr
b8854a1c50 Fix +1 error in get_elf_symbol_info() when computing value of 'hi' address for ML_(find_rx_mapping)()
Fixes BZ#375772


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16216
2017-01-31 12:33:54 +00:00
Philippe Waroquiers
7646bee8ed Fix sym name cache: handles the difference between text and data, + match in symbol
* sym name cache to cache the 'isText' characteristic of the cached sym_name
* implement the match anywhere also in the cache
Not handling matchAnywhere has bad performance effect on callgrind, as almost many
IPs were considered as a fn entry, while they were not.
* use the same convention to name the findText argument



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16136
2016-11-12 22:55:35 +00:00
Philippe Waroquiers
72160b3fef Implement a cache 'address -> symbol name' in m_debuginfo.c
Support work for xtree: as xtree implementation makes a high
nr of calls to get_sym_name, this cache improves the performance
as usually, stacktraces are repeatitively querying the same
addresses.
The cache follows the same principle as the cfsi_m_cache.
In particular, cache is cleared together with the cfsi_m cache.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16121
2016-11-11 13:38:18 +00:00
Philippe Waroquiers
3553ac9aad Add some more comments in pub_tool_debuginfo.h about memory persistence/ownership
and have m_debuginfo.c referencing these comments.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16106
2016-10-25 20:46:00 +00:00
Ivo Raisr
6260274e4e Follow recent Solaris development with respect to
SUNWDTRACE program header. Newer Solaris no longer utilizes
this program header as a scratchspace for DTrace fasttrap
provider, before libc is loaded.
For the time being, it serves as a space for initial thread
pointer.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15936
2016-08-12 22:28:50 +00:00
Julian Seward
f0077be94b Fix indentation that gcc-6 -Wmisleading-indentation rightfully complaints about.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15873
2016-04-27 08:19:52 +00:00
Julian Seward
abf0d0a78d Fix compilation breakage on platforms that do already have a definition
for Elf{32,64}_Chdr.  This is fallout from r15868.  That commit provided
a configure test, but the resulting config.h was not included here, causing
the test results to be ignored.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15869
2016-04-24 17:11:44 +00:00
Ivo Raisr
da7df0f276 Valgrind is able to read compressed debuginfo sections in two formats:
- zlib ELF gABI format with SHF_COMPRESSED flag (gcc option -gz=zlib)
  - zlib GNU format with .zdebug sections (gcc option -gz=zlib-gnu)

Patch by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
Fixes BZ#303877



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15868
2016-04-23 20:28:27 +00:00
Ivo Raisr
eb743789cd Print arguments of DWARF extension DW_CFA_ORCL_arg_loc.
n-i-bz


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15863
2016-04-20 00:21:50 +00:00
Ivo Raisr
60a0aa1d53 Kludge for multiple .rodata sections on Solaris introduced by BZ#353802
is no longer needed. The situation with multiple ".rodata" sections existed
only between dozens of builds of Solaris 12.
Fixes BZ#360749


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15853
2016-04-08 20:38:30 +00:00
Philippe Waroquiers
eb2ffd99ee Small optimisation : use preprocessor for cache stats
as the compiler does not remove the access to the not useful static vars


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15828
2016-03-12 21:38:22 +00:00
Philippe Waroquiers
861333b084 Some more fixes for Bug 348345 - Assertion fails for negative lineno
* Complain instead of asserting when negative line nr in inline info
* use a macro to factorise the complain once logic about lineno limits



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15780
2016-02-03 22:12:56 +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
Philippe Waroquiers
95bd519438 addLoc: only merge the new entry with the previous one if the resulting
size does not exceed the max allowed.

Also improve the tracing.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15744
2015-12-06 22:11:21 +00:00
Ivo Raisr
f1fceb1e3a Dwarf line info reader now correctly interprets 'is_stmt' register
Line numbers should correctly reflect all instructions belonging to a source line,
regardless of is_stmt value. Previously only instructions covered by
'is_stmt = 1' were attributed to a source line.

Fixes BZ#356044


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15741
2015-12-04 13:14:10 +00:00
Mark Wielaard
8b4dd5c47c BZ#355188 valgrind should intercept all malloc related global functions.
This implements the interception of all globally public allocation
functions by default. It works by adding a flag to the spec to say the
interception only applies to global functions. Which is set for the
somalloc spec. The librarypath to match is set to "*" unless the user
overrides it. Then each DiSym keeps track of whether the symbol is local
or global. For a spec which has isGlobal set only isGlobal symbols will
match.

Note that because of padding to keep the addresses in DiSym aligned the
addition of the extra bool isGlobal doesn't actually grow the struct.
The comments explain how the struct could be made more compact on 32bit
systems, but this isn't as easy on 64bit systems. So I didn't try to do
that in this patch.

For ELF symbols keeping track of which are global is trivial. For pdb I
had to guess and made only the "Public" symbols global. I don't know
how/if macho keeps track of global symbols or not. For now I just mark
all of them local (which just means things work as previously on platforms
that use machos, no non-system symbols are matches by default for somalloc
unless the user explicitly tells which library name to match).

Included are two testcases for shared libraries (wrapmalloc) and staticly
linked (wrapmallocstatic) malloc/free overrides that depend on the new
default. One existing testcase (new_override) was adjusted to explicitly
not use the new somalloc default because it depends on a user defined
new implementation that has side-effects and should explicitly not be
intercepted.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15726
2015-11-15 16:50:43 +00:00
Ivo Raisr
1cc06c7e14 ELF debug info reader was confused with multiple .rodata sections on Solaris
The ELF debug info reader on Solaris now performs a quick pre-scan of section
headers for .rodata sections. If there are multiple .rodata sections
present then symbols from .symtab are scanned which section they point to.
The "true" .rodata section is thus determined.
Fixes BZ#353802.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15719
2015-10-29 07:28:58 +00:00
Rhys Kidd
6251bc45e3 Silence -Wcast-qual const qualifier warning. n-i-bz.
m_debuginfo/readmacho.c:395:30: warning: cast from 'const void *' to 'DiSym *' drops const qualifier [-Wcast-qual]
   const DiSym* s1 = (DiSym*)v1;
                             ^
m_debuginfo/readmacho.c:396:30: warning: cast from 'const void *' to 'DiSym *' drops const qualifier [-Wcast-qual]
   const DiSym* s2 = (DiSym*)v2;
                             ^
m_libcsignal.c:481:49: warning: cast from 'const vki_sigset_t *' to 'vki_sigset_t *' drops const qualifier [-Wcast-qual]
  VG_(sigintersectset)(&pending, (vki_sigset_t*)set);
                                                ^

No regressions on OS X 10.10

Before:

== 596 tests, 219 stderr failures, 10 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 596 tests, 219 stderr failures, 10 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15711
2015-10-19 10:18:28 +00:00
Florian Krohm
e45be516ed Pick up 'egrep' and 'strings' from $PATH instead of using
hardwired absolute path names. People can always arrange $PATH
such that these tools are found.
Fixes BZ #294065. Patch by Austin English <austinenglish@gmail.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15652
2015-09-16 08:59:03 +00:00
Florian Krohm
aadfe81d7e Fix various compiler warnings for the arm architecture.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15650
2015-09-13 20:27:17 +00:00
Philippe Waroquiers
c65a4ee146 Fix a leak of the abbrev hash table when --read-var-info=yes is given
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15590
2015-08-25 21:39:44 +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
Julian Seward
6d6732e9df Fix a second format string error observed whilst building on OSX 10.10.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15564
2015-08-18 07:54:22 +00:00
Julian Seward
7540350321 Fix a format string error observed whilst building on OSX 10.10.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15563
2015-08-17 21:19:19 +00:00
Julian Seward
8c3ef7eb80 Bug 348345 - Assertion fails for negative lineno
(in ML_(addLineInfo))
Patch from Jim Garrison (jim@garrison.cc)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15544
2015-08-14 09:02:46 +00:00
Florian Krohm
aefb16463d Fix a few function declarations.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15514
2015-08-09 16:27:44 +00:00
Florian Krohm
01ea732633 Fix printf format inconsistencies as pointed out by gcc -Wformat-signedness.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15500
2015-08-05 22:27:24 +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
Mark Wielaard
c814eb6b35 349941 di_notify_mmap might create wrong start/size DebugInfoMapping
Use seg->start instead of a as DebugInfoMapping avma. Normally seg->start
equals a. But when it is not then the size of the map might extend beyond
the segment (and not actually cover the start of the segment). When another
ELF file is them mapped right after this then it triggers an overlap purge
of the DebugInfo. In the case the mapping was for libc or ld.so this then
removes all intercepts causing "bad things".

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15398
2015-07-07 13:01:40 +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
Philippe Waroquiers
8f30180df2 Inline ensure_valid. This improves reading the debug info of big executables
by 1 to 2%



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15327
2015-06-07 10:38:39 +00:00
Philippe Waroquiers
a833d76cd9 Add a gdbxrv monitor command to print the CFI unwind info for an address+len
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15306
2015-06-02 22:09:42 +00:00
Philippe Waroquiers
85a86af96d Slightly improve x86 unwind intensive workload.
e.g. perf/memrw is improved by 2% to 3% with this patch.

The unwinding code on x86 is trying to unwind using
either the %ebp-chain or CFI unwinding.
If these 2 techniques fail, then it tries to unwind
using FPO (PDB) debug info.
However, unless running wine or similar, there will never be
such FPO/PDB info.
The function VG_(use_FPO_info) is thus called for nothing
for each 'end of stack'. This function scans all the loaded di
to find a debug info that has some FP, to not find anything.

With this patch, the unwind code on x86 will only call VG_(use_FPO_info) if
some FPO/PDB info was loaded.

The fact that FPO/PDB info was loaded is cached and updated similarly to
cfi cache : each time new debug info is loaded, the cache value is refreshed
using the debuginfo generation.

The patch also changes the name of VG_(CF_info_generation)
to VG_(debuginfo_generation), as this generation is changed for
any kind of load or unload of debug info, not only for CFI based debug
info



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15293
2015-05-26 21:26:39 +00:00
Philippe Waroquiers
5f5fa8adf2 Some platforms such as x86 and amd64 have efficient unaligned access.
On these platforms, implement read_/write_<type> by doing a direct
access, rather than calling a function that will read or write
'byte per byte'.

For platforms that do not have efficient unaligned access,
or that do not support at all unaligned access, call function
  readUAS_/writeUAS_<type> that works as before.

Currently, direct acecss is activated only for x86 and amd64.
Unclear what other platforms support (efficiently) unaligned access.

On unwind intensive code (such as perf/memrw on amd64), this patch
gives up to 5% improvement.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15290
2015-05-25 20:15:25 +00:00
Florian Krohm
b6251821a1 Remove a few embarassing comments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15169
2015-04-30 20:44:17 +00:00
Julian Seward
47f7612998 DW_CFA_def_cfa_expression: don't push the CFA on the stack before
evaluation starts.  For DW_CFA_val_expression and DW_CFA_expression
doing so is correct, but not for DW_CFA_def_cfa_expression.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15160
2015-04-30 11:45:13 +00:00
Julian Seward
082f9298a1 Add a port to Linux/TileGx. Zhi-Gang Liu (zliu@tilera.com)
Valgrind aspects, to match vex r3124.

See bug 339778 - Linux/TileGx platform support to Valgrind



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15080
2015-04-10 12:30:09 +00:00
Florian Krohm
100f719c9c Do not reuse Creg_IA_* for s390. Add dedicated entries Creg_S390_...
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15025
2015-03-20 09:38:58 +00:00
Florian Krohm
95d7b1d054 Fix two bugs:
(1) In r14664 VG_(get_fnname_if_entry) was changed to always
    return a function name, even if that function was *not* an
    entry. That broke callgrind and was also confusing because
    it contradicts what "get_fnname_if_entry" suggests.
(2) In r14189 a function call was removed because it was considered
    redundant which it was not.

Both bugs were hunted down by Joseph Weidendorfer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15003
2015-03-12 18:56:21 +00:00
Florian Krohm
30e4288907 Remove assertion. Unlikely as it may be, len may be huge
and therefore we cannot assert otherwise.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15001
2015-03-11 22:16:22 +00:00
Florian Krohm
f696bd863b Issue a warning if a function has more than 5 million bytes of
code. Previously functions exceeding that size were observed in the
field. Assert for 100x that amount.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14997
2015-03-10 20:46:58 +00:00
Julian Seward
6e9e1112dc Update comment about range checks with observations from Florian.
No functional change.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14982
2015-03-06 09:19:38 +00:00