34 Commits

Author SHA1 Message Date
Tom Hughes
986c69ccf8 Don't worry about an unmapped, zero sized, bss segment. Bug #181594.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9026
2009-01-22 16:53:25 +00:00
Tom Hughes
d298be2664 Accept zero size text segments. Bug #181594.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9025
2009-01-22 15:08:53 +00:00
Tom Hughes
8f774ff30b Handle the rodata and sbss sections and cope with variables that
are in those sections.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9024
2009-01-22 14:14:13 +00:00
Tom Hughes
20abad2fad Bias values should be PtrdiffT now.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9023
2009-01-22 14:02:26 +00:00
Tom Hughes
33a768dabc Removed unused round_Addr_upwards function.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9022
2009-01-22 13:44:03 +00:00
Tom Hughes
0e02b9ee5b Improve detection of where ELF sections have been mapped by taking
the ELF segment table into account when deciding on the mapping
between SVMA and AVMA for a section.

This also allows the BSS kludge to be dropped, as the BSS address is
now correctly determined.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9020
2009-01-22 13:24:06 +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
1ee7f51214 Rename some local variables called 'index' to something else, to stop
gcc-3.2.2 complaining they shadow some built-in global declaration of
'index'.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8715
2008-10-27 21:42:36 +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
e5150447d7 Presently, Valgrind (non-client) code that wants to use the stat
family of syscalls is impossible to write in a way that's portable and
correct.  On some targets (eg x86-linux) you need to do sys_stat64 and
receive the results in a 'struct vki_stat64'.  But on other targets
(eg amd64-linux) neither sys_stat64 nor 'struct vki_stat64' exist.

This commit adds a new type, 'struct vg_stat', which contains 64 bit
fields in all the right places, and makes VG_(stat) and VG_(fstat) use
it.  This means callers to the two functions no longer need to worry
about the is-it-64-bit-clean-or-not question, since these routines
reformat the received data into a'struct vg_stat'.  Kind of like what
glibc must have been doing for decades.

This (indirectly) fixes a bug on x86-linux, in which m_debuginfo would
sometimes fail to read debug info, due to VG_(di_notify_mmap) using
VG_(stat) (hence sys_stat) on the file, which failed, and when in fact
it should have used sys_stat64.  Bug reported and tracked down by
Marc-Oliver Straub.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8522
2008-08-19 07:03:04 +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
Bart Van Assche
8480f85e39 Don't complain on .got.plt sections of size zero. Apparently such
sections are generated by older toolchains (binutils 2.15.90.0.3 ?)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8158
2008-05-30 13:21:13 +00:00
Bart Van Assche
46cb6b91d7 - Added support for querying information about .plt sections.
- Added support for .got.plt sections.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8127
2008-05-25 16:37:22 +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
50a23bf861 Don't be quite so paranoid about rejecting symbols that fall outside
the .text segment.  Instead only reject ones that fall outside the r-x
area.  This is in line with r7427, which instituted such a change in
other places in the system.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7546
2008-03-03 15:51:58 +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
Julian Seward
5679a22410 Update copyright dates ("200X-2007" --> "200X-2008").
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7398
2008-02-11 11:34:59 +00:00
Tom Hughes
70a1666570 Don't load debug sections from the linked debug file if we have
already loaded them from the main ELF file. Fixes #145609.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7196
2007-11-21 16:09:18 +00:00
Nicholas Nethercote
0974a299f5 Split the OSet interface into two parts: "OSetGen_", which is the existing
interface and provides full power;  and "OSetWord_", which is an
easier-to-use interface for if you just want to store words.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6841
2007-09-17 05:30:48 +00:00
Julian Seward
d18e63eb42 Avoid compilation warnings with gcc-4.2.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6722
2007-05-01 14:18:48 +00:00
Julian Seward
9377cf0ea5 Add limited support for DWARF3 'expressions' in stack-unwind (CFI)
info (DW_CFA_def_cfa_expression, DW_CFA_expression,
DW_CFA_val_expression).  Mechanism to support all of these is in place
although only DW_CFA_val_expression is currently connected up.

This is really nasty.  The basic idea is to partially evaluate each
expression at the debuginfo-reading time by running it on a stack
machine in which each stack element is an expression tree.  If the
expression can be 'run' successfully, the tree (dag, really) remaining
at the top of the stack is massaged and put into the DiCfSI record for
that address range.  At unwind time the tree is evaluated if needed.
Such cases are in fact extremely rare and so the vast majority of
unwindings use the same mechanism as before.

As a result of all this:

* some obscure cases in glibc-2.5's libpthread.so unwind when they
  didn't before

* --debug-dump=frames produces identical output to that of readelf
  for libc-2.5.so and associated libpthread.so

* All the action centers around the new type CfiExpr, which is a
  union expression-tree type in the same style as IRExpr et al

* Many dark corners of the CFI reader have been looked at and
  (re-)validated



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6620
2007-02-27 16:52:23 +00:00
Julian Seward
80835689c0 Make the frame unwinder able to handle 64-bit DWARF (untested :-(
mostly by a lot of comparison of this code vs that of
binutils-2.17/binutils/dwarf.c vs the relevant specs.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6610
2007-02-23 10:10:02 +00:00
Julian Seward
0dfa208588 Essentially non-functional tidyings and improvements to debuginfo
reading.  Two sets of changes:

* New flags for debugging the readers.  
  --debug-dump=syms
  --debug-dump=line
  --debug-dump=frames

  These (currently accepted but nonfunctional) are intended to
  create output in the style of (that is, identical to)
    /usr/bin/readelf --syms
    /usr/bin/readelf --debug-dump=line
    /usr/bin/readelf --debug-dump=frames
  respectively.  The plan is that flaws in these readers can then
  be easily found by diff-ing the output against that from readelf.

  Also, a new flag --trace-symtab-patt=<object filename pattern>
  which is used to limit all debuginfo-related debug info to the
  set of shared object names matching the given pattern.  This
  facilitates extracting the debuginfo details of one specific
  shared object, which is usually what is required, rather than
  having to wade through megabytes of junk from every object in
  the process.

* Propagate the avma/svma/image address-naming scheme
  (as described at the top of debuginfo.c) through large parts of
  readelf.c and readdwarf.c.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6588
2007-02-12 17:47:14 +00:00
Julian Seward
c8bb92ec69 ML_(read_callframe_info_dwarf2): deal better with CIEs with no
augmentation (has to do with read_encoded_Addr).  This "fix" is a
kludge and may be replaced in future by something cleaner.  See
extensive comment addition for the whole sorry tale.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6509
2007-01-12 19:03:19 +00:00
Julian Seward
471585d496 In struct _SegInfo, rename field 'size' to 'text_size' so as to be
consistent with all the other 'foo_start_avma'/'foo_size' pairings.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6508
2007-01-11 21:56:20 +00:00
Julian Seward
1b7dd32e8f In struct _SegInfo, rename field 'offset' to 'text_bias'.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6507
2007-01-11 20:11:51 +00:00
Julian Seward
00c15317cc Non-functional change: rename a bunch of variables and field names
that hold various kinds of addresses during debuginfo reading, so as
to make it easier to understand.  See comment at top of debuginfo.c.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6506
2007-01-11 19:42:11 +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
Julian Seward
565fe34ff0 Merge r6129:
Changes to support XCOFF:

- allow modules to have 'member names' as well as file names.  A member
  name is a "foo.o" name inside a "bar.a"; necessary as AIX
  keeps all its dynamic libraries in .a files.

- rename the type RiLoc to DiLoc (this holds a line number indication).
  No idea why it was called RiLoc in the first place.

- trace changes in type SysRes

- implement VG_(di_aix5_notify_segchange)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6266
2006-10-17 01:37:10 +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
Tom Hughes
ab63c4397b Use fstat64 to work out the size of a file if it is available as it
copes with a wider range of filesystems than the old fstat call.

Fixes bug #130020.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5979
2006-07-05 17:47:46 +00:00
Julian Seward
ddf1056a0e Properly handle external debuginfo (.gnu_debuglink) for stripped and
prelinked libraries (patch from L. David Baron).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5841
2006-04-12 10:08:05 +00:00
Julian Seward
7636cac62a Avoid compiler warnings on ppc64-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5829
2006-04-06 13:31:17 +00:00
Julian Seward
27b95f28a5 Cleanup/restructure m_debuginfo, as described in
coregrind/m_debuginfo/README.txt.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5823
2006-04-04 15:12:44 +00:00