Commit Graph

1792 Commits

Author SHA1 Message Date
Tom Hughes
8cec8a36cc When delivering SIGFPE make sure we patch up si_addr in any siginfo
structure to match the address of the instruction in the client program
which caused the fault.

CCMAIL: 88115-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2623
2004-08-26 23:09:26 +00:00
Tom Hughes
22681c7c0a Include the filename in the system call trace for the access syscall.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2622
2004-08-26 12:26:27 +00:00
Tom Hughes
799e526298 If we return from a signal handler to a thread that was waiting to
rendezvous with another thread before the signal arrived then check
whether the rendezvous is now complete or we may deadlock.

CCMAIL: 77369-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2621
2004-08-25 18:58:04 +00:00
Nicholas Nethercote
3df220384a Change things so that stage2's location is controlled by a single variable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2620
2004-08-25 16:16:56 +00:00
Nicholas Nethercote
2f53ead94d Fix problem with brk(). Thanks to Paull Mackerras for the patch.
Added a regression test for it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2619
2004-08-25 13:43:44 +00:00
Nicholas Nethercote
29d59df719 Remove three unnecessary compile-time warnings.
Two were trivial.  The one for strncmp is slightly trickier;  you have to be
careful with the signedness of chars when comparing them... but the code
already casts s1 and s2 to (unsigned char*) before comparing them, so it's not
a problem.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2618
2004-08-25 13:33:17 +00:00
Tom Hughes
dbff330cf4 Removed comma at the end of an enumerator list - this is allowed
in C99 but not in C89 except as a GNU extension so it's probably
best not to rely on it.

Patch from Jeroen N. Witmond <jnw@xs4all.nl>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2617
2004-08-25 13:25:30 +00:00
Nicholas Nethercote
cfebbd9108 Fix symlinking -- the old code worked, but worked for the wrong reason; the
bit before "$(subdir)" has to specify the path from .in_place/ to the root.
It just so happened that $(top_builddir) was the same for all directories at
the same level in the hierarchy as .in_place/ (ie. one deep).

(I haven't bothered changing it in all the tool Makefile.am files, because I'll
do that when I factor out all their common bits into a single file, be it
before or after 2.2.0 is released.)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2616
2004-08-25 11:57:21 +00:00
Nicholas Nethercote
aec5623ebf Minor fixups:
- introduce $(inplacedir) like everywhere else
- valgrind.spec doesn't need to be included in "make dist", because it gets
  built from valgrind.spec.in at configure-time.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2615
2004-08-25 11:50:46 +00:00
Nicholas Nethercote
0db27515b1 Putting "dist_" in front of a "_DATA" variable means it is included in "make
dist".  This avoids the need to put it in "EXTRA_DIST", and saves a few lines
in all the docs Makefile.am files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2614
2004-08-25 11:40:07 +00:00
Tom Hughes
da2b7b0f72 Only check whether linux/mii.h can be processed so that we don't
generate ugly warnings by trying to compile it.

Patch from Eric Estievenart <eric.estievenart@free.fr>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2613
2004-08-24 23:09:07 +00:00
Nicholas Nethercote
4572ebc0f1 Add a reassuring warnings about the linux/mii.h warning.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2612
2004-08-24 14:38:53 +00:00
Nicholas Nethercote
9ac96e533a Update for filename change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2611
2004-08-24 13:56:54 +00:00
Tom Hughes
7b91de196c The size passed to VG_(st_mkfloat) should be in bytes, not bits.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2610
2004-08-23 23:18:57 +00:00
Tom Hughes
fa8a87d6c0 Added code to decode a number of additional negative type numbers
in STABS debug information based on the stabs specification at:

  http://sources.redhat.com/cygwin/stabs.html

CCMAIL: 85811-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2609
2004-08-23 22:29:31 +00:00
Tom Hughes
090cf06f43 Prevent a memcpy of zero bytes from complaining if one or both of the
pointers given as arguments is uninitialised.

CCMAIL: 86989-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2608
2004-08-23 18:39:09 +00:00
Robert Walsh
bd3e480bb3 Add explanatory comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2607
2004-08-23 18:15:12 +00:00
Robert Walsh
0b909972be Fix to allow 32-bit Valgrind to run on AMD64 boxes. Note: this does
NOT allow Valgrind to work with 64-bit executables - only with 32-bit
executables on an AMD64 box.

VG_(valgrind_end) now has a slightly different meaning to all the other
VG_(*_end) vars -- ie. it names the last byte, whereas the others go
one byte past the end.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2606
2004-08-23 18:13:16 +00:00
Tom Hughes
297462c18e Don't version the sem_xxx symbols that have more than one version in
glibc - it doesn't matter for valgrind as we only have one version and
by not versioning them we work no matter what version is asked for.

CCMAIL: 86289-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2605
2004-08-23 18:05:51 +00:00
Nicholas Nethercote
0ae90953a0 Here's a couple more I missed in the last commit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2604
2004-08-23 16:39:42 +00:00
Nicholas Nethercote
7bb94df98b Use SYSNO and res, etc, instead of tst->m_eax in a few places to make things
less x86-specific.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2603
2004-08-23 16:36:09 +00:00
Nicholas Nethercote
cd1a723aa0 Makefile.am minor correction
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2602
2004-08-23 15:42:21 +00:00
Nicholas Nethercote
a2b3609df7 Small step in factoring out arch-specific code: replace
__attribute((regparm(n))) with REGPARM(n) everywhere.  REGPARM() is defined in
vg_skin.h, but will eventually be defined separately for each arch.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2601
2004-08-23 15:06:23 +00:00
Nicholas Nethercote
5bfc8bf7af Tweak configure.in in preparation for arch and OS ports -- we now have
variables VG_ARCH, VG_OS and VG_PLATFORM (which equals ${VG_ARCH}-${VG_OS}).
Also added a check for the platform (arch/OS) combination.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2600
2004-08-23 14:54:40 +00:00
Nicholas Nethercote
538305709f Removing the example tool 'example' -- it's almost identical to Nulgrind,
except it doesn't actually get built and so ex_main.c and the Makefile.am tend
to get out of date.  Changed the docs to refer to Nulgrind as the example tool
for if you start writing a new one.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2599
2004-08-23 14:15:29 +00:00
Nicholas Nethercote
d60edc277c Make some changes to Nulgrind -- it looks like Jeremy made some changes to it
as part of FV, but then later these changes become unnecessary.  Anyway, it now
looks more like the other tools again.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2598
2004-08-23 14:10:36 +00:00
Nicholas Nethercote
1bd17a3d0f Remove a bunch of unnecessary -DVG_LIBDIR="\"$(libdir)"\" arguments in
Makefile.am files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2597
2004-08-23 14:02:03 +00:00
Nicholas Nethercote
3fb236f86d Fix bug, courtesy of Paul Mackerras: when giving find_map_space an address
lower than that of any existing segment, it got it wrong due to the confusing
SkipList API.  I wonder how many more bugs like that there are...?


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2596
2004-08-23 09:28:37 +00:00
Tom Hughes
57d86ee4de More fixes for the cancellation wrappers in libpthread - if looking
for the original function with RTLD_NEXT doesn't work then try looking
for the __libc_ version of the function the RTLD_DEFAULT instead.

The reason for this is that, contrary to the dlsym documentation, it
seems that RTLD_NEXT doesn't always seem to find the definition that
would have been used if it weren't for the override. This is particularly
common wihen libpthread is pulled in implicitly by a dependency from
another library.

This should hopefully fix bug #85658.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2595
2004-08-22 22:56:25 +00:00
Tom Hughes
3314d48b5c Add support for a --time-stamp option that causes each message output
by valgrind to include a time stamp. This fixes bug #70587.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2594
2004-08-21 11:10:44 +00:00
Nicholas Nethercote
ef872d393b Rename VGOFF_(tls) to VGOFF_(tls_ptr) to make it clear it's not the same as
ThreadState.tls.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2593
2004-08-18 23:11:45 +00:00
Nicholas Nethercote
841b4ec9ae Remove 3 identical and self-admittedly spurious assertions.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2592
2004-08-18 22:26:01 +00:00
Nicholas Nethercote
40d9602352 Cleaned up the syscall wrappers a bit:
- corrected a few mistakes, eg. when printing them out, in prototypes
- made printing of "%p(%s)" args consistent
- removed 'sizeof_struct_user_fpxregs_struct' from PRE(ptrace)/POST(ptrace)
- allowing for the two different versions of open()


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2591
2004-08-18 14:37:17 +00:00
Tom Hughes
2ff805b932 Minor rejigging of includes to help compilation on Debian systems.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2590
2004-08-18 08:11:34 +00:00
Nicholas Nethercote
b35a98059b getgroups can't block
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2589
2004-08-17 13:26:52 +00:00
Tom Hughes
1e3b61b6cf Add support for the parallel port ioctls.
CCMAIL: 86407-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2588
2004-08-16 19:46:55 +00:00
Tom Hughes
7995acbe95 Treat a thread which is waiting to be reaped (ie one with a status
of VgTs_WaitJoiner) as non-existent for the purposes of cancellation.

This ensures that pthread_cancel returns ESRCH instead of trying to
cancel the thread, which would lead to the thread cleanup code being
run twice.

CCMAIL: 86730-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2587
2004-08-15 14:34:02 +00:00
Tom Hughes
c8932f4011 Back out yesterday's change to the symbol versioning in the pthread
library - it seems that I misunderstood hom the versioning works and
a system looking for a GLIBC_PRIVATE version of the clock routines
would not find the GLIB_2.2.3 one even with the inheritance. It only
seemed to be working on glibc 2.3 systems because of the version
overrides in the source code, but it failed on glibc 2.2.5 systems.

The new approach is to explicity create two versions of the routines
in question, one with a version of GLIBC_2.2.3 and one with a version
of GLIBC_PRIVATE instead. This has been tested on six different systems
and appears to work everywhere.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2586
2004-08-15 14:11:12 +00:00
Tom Hughes
546afbe696 Add support for the POSIX message queue system calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2585
2004-08-14 18:52:27 +00:00
Tom Hughes
42c7adce45 Maek init_global_thread_specific_state as a constructor to try and ensure
that it is called as soon as libpthread.so is loaded even if pthread_create
is never called.

This ensures that pthread_exit will work correctly, and I think will also
cure the famous memory leak in the pthread specifics for the main thread.

CCMAIL: 86730-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2584
2004-08-14 15:37:59 +00:00
Tom Hughes
bbb1fad521 Rather surprisingly we weren't actually calling pre_mem_write for the buffer
argument to the read system call...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2583
2004-08-14 12:10:49 +00:00
Tom Hughes
894916809d Updated list of system calls from the list in a 2.6.7 kernel.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2582
2004-08-14 10:49:43 +00:00
Tom Hughes
0efde93761 Move __pthread_clock_gettime and __pthread_clock_settime back to
the GLIBC_2.2.3 section which is where they were in glibc before
they were moved to GLIBC_PRIVATE around the 2.2.5 time frame.

This makes older systems work correctly as librt will be looking
for the symbols with that version. In order to make newer systems
work we make GLIBC_PRIVATE a child of the most recent version in
the file (currently GLIBC_2.3.3) so that a librt which is looking
for the symbols with a version of GLIBC_PRIVATE will find them.

The real glibc pthread libraries have GLIBC_PRIVATE as a child of
the most recent version anyway, so this shouldn't cause any problems
and with this change librt seems to be OK both on old RedHat 7.1 systems
with glibc 2.2.3 and on Fedora Core 2 systems with glibc 2.3.3.

Hopefully this will fix FAQ 3.4 but I haven't removed that just yet.

CCMAIL: 86696-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2581
2004-08-13 22:49:11 +00:00
Tom Hughes
6c5cd0dbd2 Improve handling of semctl, msgctl and shmctl so that all relevant
opcodes are properly validated. Using memcheck on ipcs now produces
no warnings on my machine.

This commit fixes bug #86987.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2580
2004-08-13 22:21:51 +00:00
Nicholas Nethercote
9033020ae4 Big overhaul of the allocator. Much of the structure is the same, but
lots of the details changed.  Made the following generalisations:

- Recast everything to be entirely terms of bytes, instead of a mixture
  of (32-bit) words and bytes.  This is a bit easier to understand, and
  made the following generalisations possible...

- Almost 64-bit clean;  no longer assuming 32-bit words/pointers.  Only
  (I think) non-64-bit clean part is that VG_(malloc)() et al take an
  Int as the size arg, and size_t is 64-bits on 64-bit machines.

- Made the alignment of blocks returned by malloc() et al completely
  controlled by a single value, VG_MIN_MALLOC_SZB.  (Previously there
  were various magic numbers and assumptions about block alignment
  scattered throughout.) I tested this, all the regression tests pass
  with VG_MIN_MALLOC_SZB of 4, 8, 16, 32, 64.  One thing required for
  this was to make redzones elastic;  the asked-for redzone size is now
  the minimum size;  it will use bigger ones if necessary to get the
  required alignment.

Some other specific changes:

- Made use of types a bit more;  ie. actually using the type 'Block',
  rather than just having everything as arrays of words, so that should
  be a bit safer.

- Removed the a->rz_check field, which was redundant wrt. a->clientmem.

- Fixed up the decision about which list to use so the 4 lists which
  weren't ever being used now are -- the problem was that this hasn't
  been properly updated when alignment changed from 4 to 8 bytes.

- Added a regression test for memalign() and posix_memalign().
  memalign() was aborting if passed a bad alignment argument.

- Added some high-level comments in various places, explaining how the
  damn thing works.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2579
2004-08-11 09:40:52 +00:00
Nicholas Nethercote
b36a2a2c6a Change VG_(scheduler)() slightly to remove two more global vars from
vg_include.h.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2578
2004-08-09 13:13:31 +00:00
Nicholas Nethercote
82c053aafc Remove some more global variables from vg_include.h, replacing them with
(fewer) functions.

Also fixed execve() so that it works better with .in_place.

Also added a regression test for --trace-children=yes (there were none!)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2577
2004-08-09 12:21:57 +00:00
Nicholas Nethercote
73852e1a20 Put VALGRIND_INTERNAL_PRINTF and VALGRIND_INTERNAL_PRINTF_BACKTRACE back in
vg_include.h, where they must be otherwise vg_libtpthread.c has problems.
Added a comment explaining why they must be in vg_include.h.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2576
2004-08-09 11:15:10 +00:00
Nicholas Nethercote
1246163aab Make VG_(last_run_tid) and VG_(sigstack) local.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2575
2004-08-07 18:16:56 +00:00
Nicholas Nethercote
1094bdc522 De-globalise a few more counters.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2574
2004-08-07 17:52:25 +00:00