145 Commits

Author SHA1 Message Date
Bart Van Assche
cf45f897a6 Only read debug information from regular files, and not from device nodes. Do not complain on files for which we do not have read access.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7862
2008-04-09 16:21:34 +00:00
Bart Van Assche
f2526f4f35 Moved macro's that specify branch prediction hints to include/pub_tool_basics.h
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7745
2008-03-22 08:04:29 +00:00
Julian Seward
81663bc4b7 Kludgily fix a regression caused by the recent DATASYMS merge, which
caused V to hang when running Amarok in KDE 3.5.X.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7723
2008-03-17 16:23:54 +00:00
Julian Seward
56b0448a64 Handle DW_OP_deref.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7597
2008-03-08 10:44:39 +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
Julian Seward
8c1638a9ed Don't tell m_redir (and the user) that debuginfo is about to be
discarded if in fact we never got as far as reading anything into
DebugInfo.  This unbreaks self-hosting.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7579
2008-03-06 18:31:42 +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
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
Julian Seward
61b40d2d66 Handle DW_OP_plus_uconst. Possibly fixes #155091 (not yet confirmed
by reporter).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7347
2008-01-14 12:04:11 +00:00
Tom Hughes
b67822d578 If we don't find the address in the segInfo list that ask the address
space manager for the name of the file it was mapped from as a fallback
solution.

This allows us to print the names of exe/dll files in the stack trace
when running programs under wine.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7327
2008-01-08 17:44:04 +00:00
Julian Seward
06214b0c46 Back out r7210 ("Fix completely bogus implementation of
VG_(seginfo_sect_kind).") as it breaks DRD and possible Callgrind.

The segment kind identification code is basically broken for non-text
segments, but requires fixing at a higher level than this.  See
discussion on valgrind-developers, 20 March 07, "Bug in
VG_(seginfo_sect_kind) ?"



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7267
2007-12-02 22:03:43 +00:00
Julian Seward
9d7f1c6a52 Don't be confused by archive (.a) files which contain both a 32-bit
and a 64-bit version of the same object (with the same name).  Prior
to this, it would sometimes attempt to read debug info from the wrong
version of the object, complain that the magic number wasn't right,
and so end up reading nothing at all for that object.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7248
2007-11-29 03:06:25 +00:00
Julian Seward
54e5bf2856 Misc changes needed to support exp-drd (Bart Van Assche).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7213
2007-11-25 14:08:53 +00:00
Julian Seward
e78a73e925 Fix completely bogus implementation of VG_(seginfo_sect_kind). This
was reported a very long time ago (2 years?) but was not fixed until
now.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7210
2007-11-25 12:30:36 +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
Julian Seward
6520d8f476 Be more robust against malformed DWARF2 line number information: don't
assert when a reference is made to a filename not in the filename
table.  Fixes #150380 and #129937.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7191
2007-11-20 08:46:05 +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
8629b74b36 Handle DW_OP_deref in DWARF3 expressions. Fixes #147285.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6793
2007-08-31 23:08:39 +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
984e45e88f Add disclaimers.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6709
2007-04-29 09:06:40 +00:00
Nicholas Nethercote
bb2eae844c augment previous commit
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6708
2007-04-20 02:15:28 +00:00
Nicholas Nethercote
2005fbaa40 It's generally a good idea to set call-by-reference arguments, especially
when the function comments says that they always are set.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6707
2007-04-19 23:35:42 +00:00
Nicholas Nethercote
742ae56613 Remove duplicate code -- make XArray use VG_(ssort).
Had to change XArray's comparison function to return an Int rather than a
Word so it's consistent with the rest of the world.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6680
2007-03-28 01:27:05 +00:00
Julian Seward
1907f8c209 Handle DW_CFA_def_cfa_expression; also DW_OP_mul.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6627
2007-02-28 13:03:27 +00:00
Julian Seward
142e2aedb7 Fill in a few more DWARF3 'expression' related cases.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6626
2007-02-28 01:46:30 +00:00
Julian Seward
7efbc7213b Track recent XArray changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6625
2007-02-27 22:36:14 +00:00
Julian Seward
046ec22beb Barf more elegantly.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6623
2007-02-27 18:38:33 +00:00
Julian Seward
0cbff69f1c Make the leb readers 64-bit clean. That should guard against another
couple of decades of Moore's law.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6621
2007-02-27 17:43:43 +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
9a4164c5f3 Comment-only change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6617
2007-02-25 17:13:19 +00:00
Julian Seward
804c7868a1 Expandable arrays of arbitrary element type T are a simple, useful
abstraction implemented independently in several places in the code
base (bad!).  This commit moves into public view a generic
implementation of it which has been lurking in readxcoff.c for some
time.  Currently nothing uses it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6614
2007-02-25 11:51:13 +00:00
Julian Seward
b095682a89 CFI reader: make reading of 'encoded addresses' be much more in
line with the DWARF3 spec and also with binutils/readelf.c:

- Update some comments

- Get rid of kludge_then_addDiCfSI; apparently no longer needed

- Pass the SegInfo's text_bias around in the AddressDecodingInfo,
  so that ...

- read_encoded_Addr can set 'base' to the text_bias when handling
  DW_EH_PE_absptr.  This is the central change of this commit and
  appears (to me) to be what DWARF3 requires.  (The spec is less
  than clear ..)

- don't use read_encoded_Addr to read the FDE arange field since
  read_encoded_Addr's adding-on of a 'base' value is meaningless
  here - the arange is not an address, but a value saying how many
  bytes the FDE covers.  Instead just read a little-endian value of
  the right size.  This is in accordance with DWARF3 and with 
  readelf.c.  Add new function read_le_encoded_literal to make 
  this possible.

I believe this is all correct, and it's certainly much better than it
was.  But given that the DWARF3 spec isn't as formal as it should be,
it's hard to be sure.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6611
2007-02-24 23:29:31 +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
f8d99e1ee3 Improve --debug-dump=frames output.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6600
2007-02-16 20:11:27 +00:00
Julian Seward
c555fa5434 Correctly handle DW_CFA_def_cfa_sf (existing code fails to scale
offset by data_a_f).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6599
2007-02-16 19:20:28 +00:00
Julian Seward
6b895f8c7d Non-functional (debug printing only) change:
Implement GNU binutils 'readelf' style output for --debug-dump=lines
(fully) and --debug-dump=frames (partially).

Initial testing with --debug-dump=lines shows our DWARF2 line number
reader behaves identically to readelf for all examples I tried so far.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6597
2007-02-16 14:17:10 +00:00
Julian Seward
be97b31c6c Make VG_(printf) et al conform to ANSI w.r.t. capitalisation of
hex numbers: %x produces lowercase hex, and %X produces uppercase.
Unfortunately this probably changes the output in dozens of places.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6596
2007-02-16 14:10:24 +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
9943647c57 Unbreak aix build.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6578
2007-02-09 02:11:06 +00:00
Julian Seward
20ce1d0a81 Handle DW_CFA_undefined (produced by PathScale 2.4 on amd64-linux)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6510
2007-01-12 19:21:22 +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
afb082acc7 Generate valid XML even for very long fn names - always ensure tags
have matching closing tags.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6502
2007-01-10 15:42:15 +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
cf7e9dbc05 CFI reader: when decoding the single (address) argument to
DW_CFA_set_loc, take into account any encoding info conveyed by the
augmentation string.  See big comment in the code.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6356
2006-11-16 12:21:52 +00:00