306 Commits

Author SHA1 Message Date
Tom Hughes
64d14c247b Fix another read_UInt that should be read_Addr.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12089
2011-10-03 17:01:57 +00:00
Tom Hughes
acc83cb540 Add read_Addr and use it so that we work on systems where an address
is bigger that an int.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12084
2011-10-02 12:12:38 +00:00
Tom Hughes
8ecff4c133 Avoid using direct access to read multi-byte values from DWARF files
and use read_Type routines instead as they work rather better on strict
aligned (or semi-strict a la ARM) machines. Fixes #282527.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12083
2011-10-02 10:49:35 +00:00
Tom Hughes
c5b8629171 Use read_UInt to get the CRC as it may not be aligned. Fixes #283154.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12082
2011-10-02 10:22:08 +00:00
Tom Hughes
8437facdd1 Move read_<type> routines from readdwarf.c to be module level
routines in misc.c so that other parts of the debuginfo module
can access them.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12081
2011-10-02 10:20:12 +00:00
Julian Seward
941df4bd6c Un-break debuginfo image finding on non-Android Linuxes following
r12057, duh.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12058
2011-09-27 10:24:52 +00:00
Julian Seward
e843da3851 Add a facility for ad-hoc location of debuginfo files on Android.
All other platforms are unaffected.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12057
2011-09-27 09:26:39 +00:00
Julian Seward
b5f30896db ML_(read_elf_debug_info): (no functional change, I hope): fix up
confusing control flow, by separating the logic for "is there a
debuginfo file to be found?" from that of "if a debuginfo file was
found, let's record certain facts (section offsets etc) about it."

This makes it possible to add arbitrary other schemes for finding
debuginfo files without further complicating the existing control flow.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12056
2011-09-27 08:57:41 +00:00
Julian Seward
bda076043c Android only: don't ignore zero-sized symbols, since some of them
are ones that m_redir really needs to see.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12055
2011-09-27 08:06:14 +00:00
Julian Seward
4725b367ab Re-enable the use of loctab (line number table) trimming, for a 5% to
10% reduction in debuginfo storage requirements for large applications
on 32 bit platforms.  This code had been present since the MacOSX port
was merged but had been disabled.  Remove equivalent code for
shrinking the symbol tables since they are much (4 x) smaller than the
line number tables, trimming them is hardly worth the effort.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12050
2011-09-26 20:15:07 +00:00
Julian Seward
8885c4e740 Add initial support for Mac OS X 10.7 (Lion). Tracked by bug #275168.
* configure.in support

* new supp file darwin11.supp

* comment out many intercepts in mc_replace_strmem.c and
  vg_replace_malloc.c that are apparently unnecessary for Darwin

* add minimal handling for the following new syscalls and mach traps:
    mach_port_set_context
    task_get_exception_ports
    getaudit_addr
    psynch_mutexwait
    psynch_mutexdrop
    psynch_cvbroad
    psynch_cvsignal
    psynch_cvwait
    psynch_rw_rdlock
    psynch_rw_wrlock
    psynch_rw_unlock
    psynch_cvclrprepost

* wqthread_hijack on amd64-darwin: deal with
  tst->os_state.pthread having an apparently different offset,
  which caused an assertion failure

* m_debuginfo: for 32 bit processes on Lion, use the DebugInfoFSM
  cleanup added in r12041/12042 to handle apparently new dyld
  behaviour, which is to map text areas r-- first and only
  vm_protect them later to r-x.



The following cleanups remain to be done

* remove apparently pointless, commented out wrapper macro
  invokations in mc_replace_strmem.c, eg

  //MEMMOVE(VG_Z_DYLD,        memmove)

  (or determine that they are still necessary, and uncomment)


* ditto in vg_replace_malloc.c, plus general VGO_darwin cleanups
  there


* write proper syscall wrappers for
    mach_port_set_context
    task_get_exception_ports
    getaudit_addr
    psynch_mutexwait
    psynch_mutexdrop
    psynch_cvbroad
    psynch_cvsignal
    psynch_cvwait
    psynch_rw_rdlock
    psynch_rw_wrlock
    psynch_rw_unlock
    psynch_cvclrprepost
  These are currently just no-ops and may be causing Memcheck to
  report false undef-value errors


* figure out why it doesn't work properly unless built with gcc-4.2 on
  Lion.

  gcc-4.2 is the "normal" gcc (i686-apple-darwin11-gcc-4.2.1).  Plain
  gcc is the hybrid gcc-front-end clang-back-end thing
  (i686-apple-darwin11-llvm-gcc-4.2).  Whereas on Snow Leopard, plain
  gcc is the normal gcc.

  The symptoms of the failure are that wqthread_hijack in
  syswrap-amd64-linux.c hits this /*NOTREACHED*/ vg_assert(0); right
  at the end (you need a pretty complex threaded app to trigger this),
  which makes me think that either ML_(wqthread_continue_NORETURN) or
  call_on_new_stack_0_1 do return, which they are not expected to.


* figure out if some of the uninitialised value errors reported in
  system libraries on are caused by Memcheck being confused by LLVM
  generated code, as per bug #242137



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12043
2011-09-21 08:43:08 +00:00
Julian Seward
ccaa4e370a Un-break Darwin build following r12041 (creation of struct _DebugInfoFSM)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12042
2011-09-20 22:36:26 +00:00
Julian Seward
042bb40c53 A refactoring change; no functional effect. struct _DebugInfo
contains a bunch of fields which are used as a very simple state
machine that observes mmap calls and decides when to read debuginfo
for the associated file.  This change moves these fields into their
own structure, struct _DebugInfoFSM, for cleanness, so as to make it
clear they have a common purpose.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12041
2011-09-20 21:59:50 +00:00
Julian Seward
2b97c829a0 Get rid of DebugInfo::memname, a hangover from the now-removed
AIX5 support.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12040
2011-09-20 16:10:59 +00:00
Julian Seward
7368cfb7d3 ML_(read_elf_debug_info): debug printing of program header entries: print file
offsets consistently in base 10, not 16.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12024
2011-09-10 11:21:59 +00:00
Julian Seward
fbfe39c975 ML_(read_elf_debug_info): if we exit from this routine via the BAD
macro, set di->soname back to NULL, so that if we later reenter with
the same 'di', we don't fall over the initial di->soname == NULL
assertion.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12023
2011-09-10 11:20:26 +00:00
Julian Seward
22e6a57bac Print the (pseudo-)soname when doing debug printing for Mach-O
debuginfo reading.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12011
2011-09-06 11:26:31 +00:00
Julian Seward
8b9f49a4ab Un-break the build on OSX following r11981 (Remove the assumption, in
m_debuginfo, that each address is associated with only one symbol.)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11982
2011-08-15 10:07:56 +00:00
Julian Seward
a043f0a060 Remove the assumption, in m_debuginfo, that each address is associated
with only one symbol.  Instead, allow an address to have arbitrarily
many names.  This reflects reality better, particularly for systemy
libraries such as glibc and ld.so, and is background work needed for
fixing #275284.  This is not in itself a fix for #275284.  A followup
commit to un-break compilation on OSX will follow shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11981
2011-08-15 09:42:34 +00:00
Tom Hughes
ca6a8e8db9 DWARF comparisons should be signed. Patch from Jakub Jelinek.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11904
2011-07-21 15:07:26 +00:00
Julian Seward
00977fac18 Disable stabs reading on Android; it's uncompilable, and there's no
point.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11883
2011-07-12 07:27:23 +00:00
Julian Seward
0c769dd228 Disable stabs reading on ppc64-linux; it always segfaults.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11858
2011-07-06 07:23:56 +00:00
Tom Hughes
233e49f342 Implement some extra DWARF ops that gcc 4.6.1 seems to use. Fixes #275284.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11856
2011-07-05 09:22:32 +00:00
Julian Seward
827c6c3a50 Improve debug printing for ELF program header analysis. No functional
change.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11854
2011-07-05 09:13:04 +00:00
Julian Seward
ad7de5b336 Delete the AIX5 port. The last release this worked for is 3.4.1,
and then only on AIX 5.2 and 5.3.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11842
2011-06-28 07:25:29 +00:00
Julian Seward
d9ce3d3cc8 Fix the computation of debuginfo bias values, in the case where the
debuginfo object has been not been prelinked but the main object has.
Fixes a segfault observed running any C++ application (eg,
drd/tests/annotate_smart_pointer) on Fedora 14 (32-bit), when the
debuginfo RPM for libstdc++ is installed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11801
2011-06-07 22:44:09 +00:00
Julian Seward
c1841e384b Followup fix to r11794 (generalise processing of PT_LOAD entries):
change some incorrect "rx->bias" (which due to lameness of C's type
system was valid) to "inrx->bias".


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11795
2011-06-03 23:27:39 +00:00
Julian Seward
35756a6d62 ML_(read_elf_debug_info): when processing PT_LOAD entries from the
program header, don't make the following assumptions

- that there is only one r-x and one rw- entry

- that the r-x entry appears before the rw- entry

This makes it possible to handle ELF objects processed by Mike
Hommey's elfhack program.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11794
2011-06-02 10:06:25 +00:00
Julian Seward
f06ee2d1e1 Handle ELF objects with two .eh_frame sections. This fixes a problem
handling libxul.so when linked by gold on x86_64.  (n-i-bz)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11790
2011-05-30 10:18:59 +00:00
Julian Seward
897fd70777 When reading Dwarf3 variable type and location information, print a
line showing the number of variables read for each object.  Currently
disabled -- is a sanity-check mechanism for exp-sgcheck.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11744
2011-05-11 15:31:24 +00:00
Julian Seward
f8ca357dff Back out r11705, which was an attempt to make reading of line number
info created by LLVM 2.9 work properly.  As per long discussion in
#272189, this isn't actually possible -- LLVM 2.9 creates bogus line
number info, and the bogusness can't be worked around at the Valgrind
end.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11738
2011-05-09 22:51:14 +00:00
Julian Seward
f83e5835b1 read_dwarf2_lineblock: debug printing fix (no functional change)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11733
2011-05-09 09:19:32 +00:00
Julian Seward
1ccdd881a6 calling format_message: when passing frameNo == -1, also pass
tid == VG_INVALID_THREADID rather than an uninitialised ThreadId.
Also in format_message, improve precondition assertions for
frameNo and tid.

There's no error in the current code since if frameNo == -1 then
tid is unused, but it caused IBM's BEAM checker to complain.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11723
2011-05-04 09:06:17 +00:00
Julian Seward
b1a118436a Make reading of line number info from LLVM-2.9-generated Dwarf3 work.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11705
2011-04-21 08:55:51 +00:00
Julian Seward
c2120cadde Add an alternative implementation of VG_MINIMAL_{SET,LONG}JMP
for ppc32-linux, that works for gcc >= 4.4.  Related to #259977.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11688
2011-04-11 18:36:34 +00:00
Julian Seward
b3827d6c33 Create new module m_libcsetjmp, which wraps up uses of
__builtin_setjmp and __builtin_longjmp so that they can be selectively
replaced, on a platform by platform basis.  Does not change any
functionality.  Related to #259977.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11687
2011-04-11 16:17:51 +00:00
Julian Seward
adb0e3b18d Remove a bunch more warnings generated by gcc-4.6 about dead
assignments ("[-Wunused-but-set-variable]"), on ppc32-linux and
ppc64-linux.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11674
2011-03-28 20:33:52 +00:00
Julian Seward
9c6d0dc9c9 Fix up most but not all warnings generated by gcc-4.6 about
dead assignments ("[-Wunused-but-set-variable]").



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11673
2011-03-28 16:26:42 +00:00
Bart Van Assche
47fa81b4bf Process PDB files with a path that contains spaces properly.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11617
2011-03-10 12:49:50 +00:00
Julian Seward
6107fd666c Add a port to IBM z/Architecture (s390x) running Linux -- Valgrind
side components. (Florian Krohm <britzel@acm.org> and Christian
Borntraeger <borntraeger@de.ibm.com>).  Fixes #243404.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11604
2011-03-07 16:05:35 +00:00
Julian Seward
afa6fa71cb Handle Dwarf3 types created by GNAT. Fixes #255130.
(Philippe Waroquiers <philippe.waroquiers@skynet.be>)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11517
2011-02-01 23:10:14 +00:00
Julian Seward
401f70d784 Minor improvements to PDB reading:
* better progress messages, to make it clear that reading of a
  PDB is finished, and how much stuff was read from it

* don't mmap PDB files to read them -- instead use VG_(read).
  This is because CIFS filesystem mounting only works reliably on
  Linux when mounted with option '-o directio', and that
  disallows mmap-ing files.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11482
2010-12-06 11:11:29 +00:00
Tom Hughes
77171c6bfb Avoid a double free when a binary has a build-id and no debuglink section.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11458
2010-10-19 13:12:59 +00:00
Tom Hughes
8a3cde403f Add support for DW_ATE_UTF from DWARF4 which is needed for char16_t
support in C++0X.

Patch from Christian Borntraeger on bug #254550.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11450
2010-10-18 14:57:58 +00:00
Tom Hughes
9900b430c5 Don't look for build-id notes if NT_GNU_BUILD_ID is not defined.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11449
2010-10-18 13:04:13 +00:00
Tom Hughes
c8aedaf422 Add support for using build-id to find debugging information as
some distributions are starting to drop the old debuglink support
now. Fixes #254257.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11448
2010-10-18 12:38:22 +00:00
Julian Seward
1375448f10 Make the --prefix-to-strip=... command-line option added in r11312
behave more like the original proposal in #245535.  This makes it
more flexible and general.  Also rename it.

* new name is --fullpath-after=

* allow multiple instances of --fullpath-after=

* don't require the specified strings to be prefixes, only substrings

But retain the elegant backwards-compatibility trick in Bart's r11312
commit: if --fullpath-after= is not specified at all, then behave
exactly as before.

Fixes #245535.  A mixture of patches from Bart Van Assche
(bart.vanassche@gmail.com), Alexander Potapenko (glider@google.com),
and me (integration and documentation).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11430
2010-10-12 00:44:05 +00:00
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
d1bad49f00 Only use VKI_O_LARGEFILE on platforms where it exists. This
unbreaks the build breakage on Darwin introduced in r11397, which
was a fix for #234064.  The breakage was subsequently reported
in #253420 and #253452, which this commit fixes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11406
2010-10-07 09:56:19 +00:00