504 Commits

Author SHA1 Message Date
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
Julian Seward
136a2cda56 Minor changes in an attempt to improve performance and reduce
the amount of file-reading resulting from DiImage-cache misses.

CACHE_N_ENTRIES:
Increase the DiImage cache size from 256KB to 8MB to deal with
drastically worse locality when reading inline info.  The 256KB
setting dates from befre inline-info-reading days.

is_in_CEnt: remove a conditional branch from the hot path (of |get|,
effectively)

set_CEnt: marginally improve debug printing



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14977
2015-03-05 00:52:07 +00:00
Julian Seward
6920a29c98 Stop gcc -Og complaining (incorrectly) about filessize being used
uninitialised.  No functional change.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14953
2015-02-23 13:58:55 +00:00
Julian Seward
38adfae0a0 canonicaliseSymtab: fix silly logic that could cause the function to
loop forever.  In particular, it will do that when two symbols have
exactly the same address range but differ in their .isText attribute.
Fixes #342117.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14948
2015-02-20 12:29:59 +00:00
Julian Seward
31f23d7028 Messaging cleanup for the PDB reader. No functional change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14945
2015-02-18 15:38:25 +00:00
Julian Seward
c6a9c7a38d For PDB stats printing, don't print the number of inl-info records,
since it's always zero.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14943
2015-02-18 12:58:56 +00:00
Julian Seward
a348c314d7 Improve string table reading for MSVC2010 compiled code. Also seems
to help with MSVC2013 compiled code.  Variant of a patch from
Mark Browning (mabrowningrr@gmail.com).  Fixes #211529.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14942
2015-02-18 12:57:06 +00:00
Julian Seward
3aa09eb3bf ML_(find_name_of_pdb_file): bit a bit more careful when grepping the
output from /usr/bin/strings, so as to not get confused by substrings
".pdb" and ".PDB" when they don't appear at the end of a line.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14938
2015-02-17 13:46:26 +00:00
Florian Krohm
2ba9e36810 Fix a bug introduced in r14913.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14925
2015-02-09 21:59:00 +00:00
Mark Wielaard
c6f6839488 Bug #343978 Recognize DWARF5/GCC5 DW_LANG_Fortran 2003 and 2008 constants.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14923
2015-02-09 20:41:48 +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
Florian Krohm
e70cb7b851 VG_(am_get_filename) returns a pointer to memory that belongs to the
address space manager. Callers should neither modify the string nor
free it (as the string resides is statically allocated memory). That
calls for a   const HChar *
The type change exposed two bugs. One in m_addrinfo.c and one in 
m_debuginfo.c. In both cases the returned string could possibly be freed later
on. So we need to strdup it first. Now fixed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14886
2015-01-24 00:02:19 +00:00
Florian Krohm
08d759c9a4 TyEnt::TyStOrUn::fieldRs is never NULL as VG_(newXA) always returns
something != NULL. Testing fieldRs for NULL-ness was confusing static
analysis. It usually takes such tests as evidence that the pointer
can in fact be NULL and may report false positives as a consequence.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14845
2015-01-04 11:30:11 +00:00
Florian Krohm
87dbf329ed Buffer audit. Resize some.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14825
2014-12-20 16:52:08 +00:00
Florian Krohm
601ef384bb Remove two fixed-size buffers in the dwarf readers.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14820
2014-12-17 19:52:25 +00:00
Florian Krohm
7baf26617a Comment change. Function vg_panic does not exist.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14816
2014-12-17 11:01:40 +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
48c0ff5c76 Fix BZ #116002.
Left justification of strings in myvprintf_str was mixed up.
Now fixed and %s formats changed accordingly.
In function myvprintf_int64: the local buffer was not large
enough to hold ULONG_MAX in binary notation. Numbers were
truncated at 39 digits. 
Testcases added.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14808
2014-12-13 18:35:00 +00:00
Florian Krohm
d80a701916 Remove fixed size arrays in the dwarf-3 parser.
Use proper initialisation functions for the type and variable parser.
Add functions to release the dynamically allocated functions.
No longer maintain content of popped-off stack entries as that is
essentially freed memory and complicates matters unnecessarily.
Part of fixing BZ #337869.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14801
2014-12-07 18:58:59 +00:00
Florian Krohm
572a96384c Eliminate fixed size buffer 'the_CIEs' and allocate it dynamically.
Part of fixing BZ #337869.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14800
2014-12-06 21:58:50 +00:00
Mark Wielaard
3129007b9a Bug 341238. Recognize GCC5/DWARFv5 DW_LANG constants Go, C11, C++11, C++14.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14791
2014-11-26 15:43:14 +00:00
Philippe Waroquiers
9cad0d5148 Fix typos in a comment
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14737
2014-11-19 22:21:12 +00:00
Florian Krohm
e7020c5a7e Minor non-functional cleanups.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14723
2014-11-14 19:25:08 +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
479e0e5b54 Fix a bug spotted by IBM's BEAM checker in VG_(describe_IP).
In the non-XML part buf_dirname was read without observing the
know_dirinfo guard. Now fixed. Initialise buf_dirname nevertheless.
Also remove a dead assignment.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14707
2014-11-09 21:57:23 +00:00
Florian Krohm
ab2599f4cf Change VG_(mkstemp) such that
(a) the 2nd argument must not be NULL
    This was true anyhow and requiring it allows us to simplify the function
    by eliminating the local buffer.
(b) the memory pointed to by the 2nd argument is always initialised
    In the past the output file name was not initialised in case VG_(open)
    failed 10 times in a row. The call sites in m_main.c and m_gdbserver/target.c
    were reading the uninitialised filename unconditionally. This was spotted
    by IBM's BEAM checker.
Fix call sites, eliminate some magic constants along the way.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14706
2014-11-09 16:15:23 +00:00
Julian Seward
b519f73307 Adds initial support for AArch64 (arm64) on Android. Small programs
(/system/bin/ls, /system/bin/date) run.  Still to do:

* enable more malloc/free intercepts

* enable wrappers for ashmem and binder syscalls

* check to see if any special ioctl support is required for ARM Mali GPUs



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14690
2014-11-04 17:44:21 +00:00
Florian Krohm
d2723ddc9b Merge r14308 from the BUF_REMOVAL branch to trunk
Changes VG_(describe_IP) to return the untruncated result in a statically
allocated local buffer. Fix call sites and update two .exp files who had
truncated names.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14685
2014-11-03 22:43:42 +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
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
Julian Seward
17c050916e Enable reading of Dwarf2 frame-unwind info on MacOS. It seems
as if more recent XCodes rely on it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14660
2014-10-23 19:44:21 +00:00
Florian Krohm
aa6abf5a1d 2 pints later: more coregrind constification.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14659
2014-10-23 17:47:15 +00:00
Florian Krohm
1f8a4084b9 Followup to r14656. Fix compile problem on Darwin.
Patch by Rhys Kidd <rhyskidd@gmail.com>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14657
2014-10-23 11:38:12 +00:00
Florian Krohm
a3a57c92df Constify coregrind.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14656
2014-10-22 22:25:30 +00:00
Florian Krohm
8f0654600d Constify a variable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14655
2014-10-22 20:35:27 +00:00
Florian Krohm
d0dd4cbf30 Change VG_(allocEltDedupPA) to return a pointer to const. The reason is
that once an element has been allocated and added to the pool it must
not be modified afterwards. See the documentation in pub_tool_deduppoolalloc.h
The rest of the patch is ripple.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14654
2014-10-22 17:42:37 +00:00
Florian Krohm
f5e2bdbddc Change the definition of VgHashTable to not have pointer type.
This is (a) consistent with how the other containers are defined
and, more importantly, (b) allows the constification of the hash table API.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14639
2014-10-18 10:58:05 +00:00
Julian Seward
f26b61d67c di_notify_ACHIEVE_ACCEPT_STATE: before starting to parse the ELF file,
truncate overlaps in the DebugInfoMappings that have been collected by
the DebugInfo's FSM.  Not doing so can confuse ML_(read_elf_debug_info)'s
computation of bias values.  Observed to be a problem when reading EDIDX
sections for objects mangled by Mike Hommey's elfhack program.
See http://bugzilla.mozilla.org/show_bug.cgi?id=788974



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14632
2014-10-15 16:12:11 +00:00
Florian Krohm
77c3a4ef7c Merge revisions 14210 and 14626 from the BUF_REMOVAL branch to trunk.
Change VG_(resolve_filename) to not truncate the result which is returned
in a static buffer now. Fix callsites.
Simplify VG_(di_notify_pdb_debuginfo) to use VG_(resolve_filename).
Fix VG_(readlink) prototype.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14628
2014-10-14 21:01:33 +00:00
Philippe Waroquiers
800a64895b Add two gnu extensions DW_AT definition and tracing
(no functional changes, except that these values will be visible
in the dwarf trace, instead of DW_AT_???)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14611
2014-10-07 21:25:36 +00:00
Philippe Waroquiers
2e547da1ca follow up to fix for 339721 assertion 'check_sibling == sibling' failed in readdwarf3.c ...
The fix committed in revision 14603 is properly fixing the bug 339721.
However, when enabling the dwarf tracing, the DW_FORM_ref_sig8 causes
a segmentation violation, as the tracing code is shared with the
reading code. But the DW_FORM_ref_sig8 reading code is dereferencing
some data structure that is only initialised when --read-var-info=yes.

So, in case DW_FORM_ref_sig8 form reading is done and --read-var-info=no,
then check that we are tracing, and avoid dereferencing the (not initialised)
signature hash table.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14610
2014-10-07 20:35:06 +00:00
Florian Krohm
97dc435677 Merge revisions 14372 and 14607 from the BUF_REMOVAL branch to trunk.
This change makes VG_(clo_suppressions), VG_(clo_fullpath_after),
and VG_(clo_req_tsyms) XArrays. They used to be arrays of fixed size.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14609
2014-10-07 18:36:28 +00:00
Philippe Waroquiers
623a54340e fix 339721 assertion 'check_sibling == sibling' failed in readdwarf3.c ...
The skip code was wrongly skipping 16 bytes, while only 8 are read
for a DW_FORM_ref_sig8.

Note that the problem is made visible by an assert when using 
--trace-symtab=yes but in fact this is a real bug in the dwarf reader,
that was introduced in one of the optimisations done for the inline info.

It can manifest itself with other symptoms:

One of the 2 following assertions can fail:
   vg_assert (check_sibling == sibling);
   vg_assert (get_position_of_Cursor (&check_skip) 
              == get_position_of_Cursor (&c));

Or the following error can be given:
--29973-- WARNING: Serious error when reading debug info
--29973-- When reading debug info from /home/philippe/valgrind/trunk_untouched/memcheck/tests/dw4:
--29973-- Overrun whilst reading .debug_info section




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14603
2014-10-06 21:46:43 +00:00
Florian Krohm
1af502ff14 The XArray element type of variable "described" is HChar not UChar.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14598
2014-10-04 21:08:42 +00:00
Philippe Waroquiers
e17dca21a1 Remove anouncement of helgrind dead in coregrind/m_debuginfo/README.txt
as helgrind died many years ago, but resuscitate since then.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14557
2014-09-19 09:08:42 +00:00
Florian Krohm
b1f50bd18d Fix a few casts that dropped type qualifiers. As pointed out by
-Wcast-qual.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14554
2014-09-18 18:35:47 +00:00
Florian Krohm
0919dfb754 Remove a few useless asserts after memory allocation.
The called allocators don't return NULL.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14553
2014-09-18 18:34:19 +00:00
Mark Wielaard
d5e8b1f68f Old STABS code is still being compiled, but never used. Remove it.
Since valgrind 3.9.0 the STABS support was already disabled completely.
But the code was still there being compiled and we were still searching
for stabs sections in binaries. Completely remove all sources, tests and
references. Add a note to coregrind/m_debuginfo/README.txt to mention
the old code can be found in the subversion repository.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14550
2014-09-18 12:24:53 +00:00