33 Commits

Author SHA1 Message Date
Julian Seward
2569c4fc94 Remove some fluff detected by llvm-2.8 (clang):
- "*(int *)0 = " is apparently ignored by LLVM for who-knows-why
  reason.  Cast the zero to a volatile int * instead.

- remove an unused function that gcc failed to mention was unused
  (why?  because it was marked __attribute__((noreturn)) ?)

As an aside, clang/llvm-2.8 seemed to be able to successfully
compile Valgrind.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11429
2010-10-11 19:15:33 +00:00
Julian Seward
18503c8e64 Dwarf3 reader: handle Dwarf3 created by gcc-4.5.1. In other words,
work around the all-new-buggy-Dwarf3 created by gcc-4.5.1.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11418
2010-10-08 23:57:25 +00:00
Julian Seward
9b0574dff8 Update copyright dates to 2010.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11121
2010-05-03 21:37:12 +00:00
Tom Hughes
25b8be58ad Add some basic DWARF4 support. Based on patch from Jakub Jelinek
but with support for VLIW architectures with multiple opcodes per
instruction removed. Fixes #233595.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11106
2010-04-28 08:09:30 +00:00
Tom Hughes
ee70926b34 Various improvements to DWARF handling to cope with changes in recent
versions of gcc as shipped with Fedora 12. Specific changes include:

  - Vastly increase the number of opcodes we understand how to
    evaluate when processing a location expression.

  - Process frame unwind data from the debug_frame ELF section as
    well as the eh_frame section.

  - Handle version 3 CIEs in frame unwind data.

  - Handle the compact form of DW_AT_data_member_location which just
    gives a constant offset from the start of it's base type instead
    of a full location expression.

Based on patches from Jakub Jelinek on bugs #210479 and #210566.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10939
2009-11-12 13:28:34 +00:00
Julian Seward
8379ad7f3b parse_type_DIE: push incomplete structure tyents on the type stack,
since gcc-4.4 on Fedora 11 will create DW_TAG_member entries within
it, and we need to have a plausible parent type on the stack.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10770
2009-08-10 18:59:54 +00:00
Tom Hughes
213ac85a98 Ignore structure members with no location - thiscan happen with static
const members in C++ code which are compile time constants that do no
exist in the class. They're not of any interest to us so we ignore them.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10698
2009-08-03 14:39:54 +00:00
Julian Seward
7a04b26015 Use Dwarf3 section version numbers as specified in Appendix F of the
Dwarf3 standard.  (Jakub Jelinek).  This is #200029, patch in comment
#1.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10696
2009-08-03 13:29:42 +00:00
Tom Hughes
688d43d18d Handle some more DW_TAG_subrange_type cases which Fedora 11's
gcc 4.4.0 seems to generate.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10695
2009-08-03 08:50:58 +00:00
Julian Seward
e7dde85a24 Merge coregrind/ changes from branches/MESSAGING_TIDYUP r10464.
This commit tidies up and rationalises what could be called the
"messaging" system -- that part of V to do with presenting output to
the user.  In particular it brings significant improvements to XML
output.

Changes are:

* XML and normal text output now have separate file descriptors,
  which solves longstanding problems for XML consumers caused by
  the XML output getting polluted by unexpected non-XML output.

* This also means that we no longer have to hardwire all manner
  of output settings (verbosity, etc) when XML is requested.

* The XML output format has been revised, cleaned up, and made
  more suitable for use by error detecting tools in general
  (various Memcheck-specific features have been removed).  XML
  output is enabled for Ptrcheck and Helgrind, and Memcheck is
  updated to the new format.

* One side effect is that the behaviour of VG_(message) has been
  made to be consistent with printf: it no longer automatically
  adds a newline at the end of the output.  This means multiple
  calls to it can be used to build up a single line message; or a
  single call can write a multi-line message.  The ==pid==
  preamble is automatically inserted at each newline.

* VG_(message)(Vg_UserMsg, ..args..) now has the abbreviated form
  VG_(UMSG)(..args..); ditto VG_(DMSG) for Vg_DebugMsg and
  VG_(EMSG) for Vg_DebugExtraMsg.  A couple of other useful
  printf derivatives have been added to pub_tool_libcprint.h,
  most particularly VG_(vcbprintf).

* There's a small change in the core-tool interface to do with
  error handling: VG_(needs_tool_errors) has a new method
  void (*before_pp_Error)(Error* err)  which, if non-NULL, is
  called just before  void (*pp_Error)(Error* err).  This is to
  give tools the chance to look at errors before any part of them
  is printed, so they can print any XML preamble they like.

* coregrind/m_errormgr.c has been overhauled and cleaned up, and
  is a bit simpler and more commented.  In particular pp_Error
  and VG_(maybe_record_error) are significantly changed.

The diff is huge, but mostly very boring.  Most of the changes
are of the form

-   VG_(message)(Vg_UserMsg, "this is a message %d", n);
+   VG_(message)(Vg_UserMsg, "this is a message %d\n", n);

Unfortunately as a result of this, it touches a large number
of source files.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10465
2009-07-15 14:48:32 +00:00
Nicholas Nethercote
b05a2a18d7 This commit merges the BUILD_TWEAKS branch onto the trunk. It has the
following improvements:

- Arch/OS/platform-specific files are now included/excluded via the
  preprocessor, rather than via the build system.  This is more consistent
  (we use the pre-processor for small arch/OS/platform-specific chunks
  within files) and makes the build system much simpler, as the sources for
  all programs are the same on all platforms.

- Vast amounts of cut+paste Makefile.am code has been factored out.  If a
  new platform is implemented, you need to add 11 extra Makefile.am lines.
  Previously it was over 100 lines.

- Vex has been autotoolised.  Dependency checking now works in Vex (no more
  incomplete builds).  Parallel builds now also work.  --with-vex no longer
  works;  it's little use and a pain to support.  VEX/Makefile is still in
  the Vex repository and gets overwritten at configure-time;  it should
  probably be renamed Makefile-gcc to avoid possible problems, such as
  accidentally committing a generated Makefile.  There's a bunch of hacky
  copying to deal with the fact that autotools don't handle same-named files
  in different directories.  Julian plans to rename the files to avoid this
  problem.

- Various small Makefile.am things have been made more standard automake
  style, eg. the use of pkginclude/pkglib prefixes instead of rolling our
  own.

- The existing five top-level Makefile.am include files have been
  consolidated into three.

- Most Makefile.am files now are structured more clearly, with comment
  headers separating sections, declarations relating to the same things next
  to each other, better spacing and layout, etc.

- Removed the unused exp-ptrcheck/tests/x86 directory.

- Renamed some XML files.

- Factored out some duplicated dSYM handling code.

- Split auxprogs/ into auxprogs/ and mpi/, which allowed the resulting
  Makefile.am files to be much more standard.

- Cleaned up m_coredump by merging a bunch of files that had been
  overzealously separated.

The net result is 630 fewer lines of Makefile.am code, or 897 if you exclude
the added Makefile.vex.am, or 997 once the hacky file copying for Vex is
removed.  And the build system is much simpler.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10364
2009-06-24 00:37:09 +00:00
Nicholas Nethercote
07045477ca Merge the DARWIN branch onto the trunk.
I tried using 'svn merge' to do the merge but it did a terrible job and
there were bazillions of conflicts.  So instead I just took the diff between
the branch and trunk  at r10155, applied the diff to the trunk, 'svn add'ed
the added files (no files needed to be 'svn remove'd) and committed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10156
2009-05-28 01:53:07 +00:00
Nicholas Nethercote
b15e3d9a45 Fix all the non-VEX problems identified with the Clang Static Analyzer.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9416
2009-03-15 23:25:38 +00:00
Nicholas Nethercote
2001629c3f Updated copyright years.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344
2009-03-10 22:02:09 +00:00
Tom Hughes
5df14931d9 Keep track of the svma and bias values for the debug data separately
as they may be different to those for other sections of the ELF file
if we have separated debug information and the main file has been
prelinked since they were split. Fixes bug #185816.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9329
2009-03-09 09:19:03 +00:00
Julian Seward
c538f32818 Handle a couple of artefacts produced by icc11: DW_TAG_reference_type
that doesn't have a size, and DW_FORM_ref_addr (assuming my
interpretation of the standard is correct.)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9058
2009-01-25 23:50:32 +00:00
Julian Seward
c72e27c5b0 Accept 'enum' type DIEs that do not have any names; apparently Dwarf2
allows this.  Patch from Nuno Lopes.  #181707.
MERGE TO 3_4_BRANCH


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9055
2009-01-24 01:44:15 +00:00
Julian Seward
3a786496c1 Handle the case where a Compilation Unit (CU) (or, really, the CU and
its associated DIEs) occupies less space than stated in the CU's
header.  icc9 appears to produce CUs with this anomaly.  Not handling
the case causes the reader to lose sync at the start of the following
CU, since it hasn't skipped the junk bytes at the end of the current
CU, and it is basically hosed after that.
MERGE TO 3_4_BRANCH (?)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9049
2009-01-24 00:04:28 +00:00
Tom Hughes
4ca0c5f735 Don't assume that all global variables are in the data section - we
now cope with variables in the text, data, sdata and bss sections.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9021
2009-01-22 13:40:12 +00:00
Nicholas Nethercote
5ad1dd61f9 Introduce a new type, PtrdiffT. Replace lots of uses of OffT (all those
that are memory offsets) with PtrdiffT;  OffT should only be used for file
sizes and offsets.

Change Off64T from a ULong to a Long, as it should be.  Replace some uses
of ULong in the address space manager with Off64T to match.

Also add a comment explaining the meanings of the basic types like Addr,
OffT, SizeT, etc.

Also fix the prototype for VG_(pread) -- the last arg is an OffT, not an
Int.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8959
2009-01-15 21:29:24 +00:00
Julian Seward
e2b15887e6 get_Form_contents: handle DW_FORM_block2.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8701
2008-10-23 11:13:05 +00:00
Julian Seward
2db480e222 Tolerate apparently broken Dwarf3 generated by gcc (GCC) 4.4.0
20081017 (experimental): accept DW_TAG_enumerator with only a
DW_AT_name but no DW_AT_const_value.  This is in violation of the
Dwarf3 standard.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8700
2008-10-23 10:54:40 +00:00
Julian Seward
2d9f215985 Don't assert on icc9 generated Dwarf3.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8696
2008-10-22 15:49:59 +00:00
Julian Seward
335992d8fc Merge all remaining changes from branches/PTRCHECK. These are some
relatively minor extensions to m_debuginfo, a major overhaul of
m_debuginfo/readdwarf3.c to get its space usage under control, and
changes throughout the system to enable heap-use profiling.

The majority of the merged changes were committed into
branches/PTRCHECK as the following revs: 8591 8595 8598 8599 8601 and
8161.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8621
2008-09-18 18:12:50 +00:00
Julian Seward
207c05fd20 Rework storage management in the Dwarf3 type and variable reader, to
try and reduce its space consumption.  This change changes some long
linked lists into XArrays instead.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8540
2008-08-22 23:18:02 +00:00
Julian Seward
4040072a3a Make the absolute bare minimum changes needed to stop the Dwarf3
variable & type reader dying on gcc-4.3.x produced Dwarf3.  This is
done by handling DW_TAG_class_type and treating it the same as
DW_TAG_structure_type.  I don't know if this is really correct or not.

This reader is still grossly inefficient in terms of space use, and
could be majorly improved, by storing information in arrays rather
than in linked lists with (sometimes) more than 5 million elements.
But this will have to wait.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8534
2008-08-20 08:14:07 +00:00
Bart Van Assche
8e96150945 Merged FORMATCHECK branch (r8368) to trunk.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8369
2008-07-07 06:49:24 +00:00
Julian Seward
9263da368a Handle apparently-bogus DW_TAG_compilation_unit DIE that shows up in
gcc-4.3 output.  My reading of the DWARF3 standard is that a
DW_TAG_compilation_unit should have either DW_AT_ranges or a
(DW_AT_low_pc, DW_AT_high_pc) pair, but not both.  So I think this is
a gcc bug.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8276
2008-06-24 09:51:55 +00:00
Julian Seward
4cae5c3ed5 Merge branches/OTRACK_BY_INSTRUMENTATION into the trunk. This adds
support to Memcheck for tracking the origin of uninitialised values,
if you use the --track-origins=yes flag.

This currently causes some Memcheck regression tests to fail, because
they now print an extra line of advisory text in their output.  This
will be fixed.

The core-tool interface is slightly changed.  The version number for
the interface needs to be incremented.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7982
2008-05-01 20:24:26 +00:00
Julian Seward
18a72f705c Try to handle the situation where an object is first split into a base
object (without D3 info) and a debuginfo (with D3 info), and then the
base object is prelinked to some nonzero address, but the debuginfo
object is left unchanged.  A nasty and unprincipled hack.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7590
2008-03-07 22:17:31 +00:00
Julian Seward
3f577414fe Handle DW_FORM_data8.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7589
2008-03-07 20:07:58 +00:00
Bart Van Assche
99e2db5631 Compiles now with gcc 2.96 too.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7550
2008-03-03 20:40:51 +00:00
Julian Seward
14af4957fc Merge in the DATASYMS branch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7540
2008-03-03 01:35:41 +00:00