Commit Graph

88 Commits

Author SHA1 Message Date
Julian Seward
d452d6b62d casting paranoia (harmless)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5484
2006-01-03 04:09:27 +00:00
Julian Seward
8ba9a34088 Add framework for ppc64 support. Apologies in advance for the
inevitable breakage to other platforms.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5250
2005-11-29 13:05:56 +00:00
Julian Seward
c7b988eab6 Fix bug observed by Neal Norwitz in which mremap fails for file mappings.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5229
2005-11-23 03:41:41 +00:00
Tom Hughes
91b44ff30e Use VG_(ntohl) and VG_(ntohs) to decode IP addresses and ports. Note
that this also required reversing the order of the arguments to the
print call as the previous ordering assumed that the address was still
byte swapped.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5163
2005-11-17 12:02:58 +00:00
Julian Seward
c01a097e5b Kludgey endianness fix (for printing only) to stop fdleak_ipv4 failing on
ppc32.  I'm sure there's a Right Way to fix it, and this isn't it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5161
2005-11-17 11:45:28 +00:00
Tom Hughes
39e6ec034f Handle some ALSA ioctls that don't have size or direction hints.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5131
2005-11-14 17:03:54 +00:00
Nicholas Nethercote
9d374f4530 Rename --simulation-hints as --sim-hints for brevity.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5099
2005-11-12 18:21:40 +00:00
Tom Hughes
0d25c745d7 Fix compiler warning.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5084
2005-11-11 12:32:10 +00:00
Julian Seward
1e2a85030c Add comments from email discussion re mprotect.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5057
2005-11-09 14:51:59 +00:00
Tom Hughes
db732ea188 Handle the PROT_GROWSDOWN and PROT_GROWSUP mprotect flags properly
which stops glibc falling over when a program requires an executable
stack and glibc has been built to assume that PROT_GROWSDOWN will work.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5041
2005-11-08 16:51:55 +00:00
Julian Seward
f1ead573e8 Second try at getting rid of the is_self() hack used to decide when to
load debug info from the V executable.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5033
2005-11-08 00:45:47 +00:00
Tom Hughes
48f8c22e44 Get core dumping working again - the architecture specific code that
was in the sigframe module has been moved into the coredump module 
where it belongs and things fixed up to compiler again.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4970
2005-10-31 17:05:21 +00:00
Julian Seward
4e2059f06a The Spin-Doctor arrives in Valgrind-Land: rename --weird-hacks= to
--simulation-hints=.  Bwaha.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4955
2005-10-20 01:09:57 +00:00
Nicholas Nethercote
82c3ab0af9 Overhaul the way programs are loaded at startup and exec() works. Now the
checking of programs done in these two places are combined, which avoids
duplicate code and greatly reduces the number of cases in which exec()
fails causing Valgrind to bomb out.

Also, we can now load some programs we could not previously, such as scripts
lacking a "#!" line at the start.  Also, the startup failure messages for
bad programs match the shell's messages very closely.

And I added a whole bunch of regtests to test all this.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4918
2005-10-14 03:11:30 +00:00
Tom Hughes
6961dcf591 Fix statement-before-declaration warnings for the core code.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4906
2005-10-12 10:45:27 +00:00
Julian Seward
5027b7a30e Enable sys_ftruncate64 on ppc32.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4891
2005-10-07 13:30:48 +00:00
Tom Hughes
193e4670fc When looking for a heap segment to extend look for the heap limit
address rather than the base address as the heap may have been split
into more than one segment by using mprotect on it...


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4882
2005-10-06 14:49:21 +00:00
Julian Seward
4ce62c9445 If the launcher can't figure out what it's own name is, don't bail
out.  Instead, print a warning message, continue, and cause any
attempt to trace into a child process to fail with ECHILD.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4861
2005-10-04 23:07:33 +00:00
Julian Seward
4a47f441f2 Rewrite ML_(fd_allowed):
* include explaination from Tom
* make logic easier to follow, and add comments
* remove veto on the -d file descriptor (detailed comments in code)



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4860
2005-10-04 22:27:22 +00:00
Tom Hughes
65bd3eb367 Create a new SkShmC segment type for shared memory segments so that we
can ensure they are never merged with adjacent segments. This makes
sure that we can find the right piece of memory to release when the
shmdt system call occurs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4854
2005-10-04 15:59:54 +00:00
Tom Hughes
760dbdc42a Get the SHM_RDONLY test the right way round. Fixes bug #113796.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4852
2005-10-04 12:04:06 +00:00
Julian Seward
b7cd9cb3de Plumb 64-bit file offsets throughout the address space manager.
Untested.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4844
2005-10-02 17:01:41 +00:00
Tom Hughes
9bddb4c141 Document mmap insanity in a comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4840
2005-09-30 16:09:12 +00:00
Julian Seward
7672845acb ML_(generic_PRE_sys_mmap): reject non-page-aligned offsets.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4838
2005-09-30 10:48:27 +00:00
Julian Seward
3564f53893 Placate gcc.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4836
2005-09-30 10:32:39 +00:00
Tom Hughes
6c610b89c7 Rationalise the mmap system call handling - after examining the kernel
source it turns out that there are five different versions of mmap for
the three platforms we currently support:

  - On x86-linux there is mmap (aka old_mmap) which takes the
    arguments in a memory block and the offset in bytes; and
    mmap2 (aka sys_mmap2) which takes the arguments in the normal
    way and the offset in pages.

  - On ppc32-linux there is mmap (aka sys_mmap) which takes the
    arguments in the normal way and the offset in bytes; and
    mmap2 (aka sys_mmap2) which takes the arguments in the normal
    way and the offset in pages.

  - On amd64-linux everything is simple and there is just the one
    call, mmap (aka sys_mmap)  which takes the arguments in the normal
    way and the offset in bytes.

To reconcile all this I have created a generic handler and then
written five platform specific wrappers which normalise all the
arguments and then call the generic handler.

I have also modified the address space manager to use mmap2 rather
than mmap on x86 and ppc32 so that large offsets can be correctly
handled.

There is still an issue of OffT truncating offsets as we go through
the address space manager that will need to be addressed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4834
2005-09-30 08:07:53 +00:00
Julian Seward
69a3fadbde Placate memcheck/tests/x86/scalar, which objected to the rewrite of
the sys_readlink wrapper.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4831
2005-09-30 01:47:12 +00:00
Julian Seward
44e0ab593a In PRE(sys_readlink), fix up handling of /proc/<pid>/exe and
/proc/self/exe.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4828
2005-09-30 01:09:50 +00:00
Julian Seward
e2f8cc1393 Fix subtle bug in ML_(generic_POST_sys_shmdt) caused by new aspacem.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4814
2005-09-28 20:05:31 +00:00
Julian Seward
b98ac01c9f Get rid of pub_core_main.h, so that m_main is not imported by anyone,
and so is not part of a module cycle.  This requires a moderately
grotty hack of passing a continuation-function pointer in a global
variable.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4806
2005-09-28 10:47:38 +00:00
Julian Seward
cc8ccbbfb4 This commit merges in changes from branches/ASPACEM (specifically,
changes from r4341 through r4787 inclusive).  That branch is now dead.
Please do not commit anything else to it.

For the most part the merge was not troublesome.  The main areas of
uncertainty are:

- build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am
  and include it in a couple of places.  Building etc seems to still
  work, but I haven't tried building the documentation.

- syscall wrappers: Following analysis by Greg & Nick, a whole lot of
  stuff was moved from -generic to -linux after the branch was created.
  I think that is satisfactorily glued back together now.

- Regtests: although this appears to work, no .out files appear, which
  is strange, and makes it hard to diagnose regtest failures.  In
  particular memcheck/tests/x86/scalar.stderr.exp remains in a 
  conflicted state.

- amd64 is broken (slightly), and ppc32 will be unbuildable.  I'll
  attend to the former shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789
2005-09-27 19:20:21 +00:00
Nicholas Nethercote
1394091f86 Moved sys_mmap2 wrapper from "generic" to "linux".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4595
2005-08-31 03:00:40 +00:00
Nicholas Nethercote
c198b967b3 Moved some more syscall wrappers from "generic" to "linux".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4594
2005-08-31 02:44:31 +00:00
Nicholas Nethercote
b79e7281d4 Moved sched_* from "generic" to "linux"; Darwin doesn't have them.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4576
2005-08-30 02:17:23 +00:00
Nicholas Nethercote
40eb28bec1 Move *xattr from "generic" to "linux". Darwin has them, but with an extra
parameter.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4575
2005-08-30 01:53:54 +00:00
Tom Hughes
cf8c1b047f Handle the SCTP_GET_LOCAL_ADDRS and SCTP_GET_PEER_ADDRS getsockopt
calls correctly. Fix to bug #111231.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4549
2005-08-28 10:16:29 +00:00
Nicholas Nethercote
ccad5e3600 Change slightly the way integers are printed by printf() and friends.
Previously, %d printed a 32-bit int.  %ld and %lld printed 64-bit ints.
So if you wanted to print a word-sized int (eg. a SizeT variable), you
had to cast it to a Long and then print with %lld in order to work on
both 32-bit and 64-bit platforms.

I changed things so that %d prints a 32-bit int, %ld prints a word-sized
int, and %lld prints a 64-bit int.  There are two advantages to this:
- it now matches the way the normal glibc printf() works;
- you can print word-sized ints without casting.

I also made the corresponding change for %u/lu/llu and %x/lx/llx, and I
changed a couple of VG_(printf)() invocations accordingly.





git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4527
2005-08-26 19:42:27 +00:00
Nicholas Nethercote
45fc4050f8 Move *chown16 syscalls from "generic" to "linux".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4523
2005-08-26 04:36:10 +00:00
Nicholas Nethercote
1d0665b897 whoops
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4522
2005-08-26 04:30:34 +00:00
Nicholas Nethercote
1fa6f9bf7a Move get*16 and set*16 syscalls from "generic" to "linux".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4521
2005-08-26 04:27:54 +00:00
Nicholas Nethercote
7fd1f02169 Move cap{get,set} syscalls from "generic" to "linux".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4520
2005-08-26 04:03:04 +00:00
Nicholas Nethercote
832989d4af Move timer_* syscalls from "generic" to "linux".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4519
2005-08-26 03:54:30 +00:00
Nicholas Nethercote
c42361bf17 Move clock_* syscalls from "generic" to "linux".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4518
2005-08-26 03:49:43 +00:00
Nicholas Nethercote
c710281899 Move mq_* syscalls from "generic" to "linux".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4517
2005-08-26 03:43:28 +00:00
Nicholas Nethercote
ed0bcea859 Rename vg_preload_core.so to vgpreload_core.so to be consistent with
tool preload modules, which are called vgpreload_<tool>.so.  Also
fixed a couple of comments relating to this.

(This need not be merged into 3_0_X.)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4514
2005-08-25 22:53:57 +00:00
Nicholas Nethercote
e266e53970 Minor fixes for problems pointed out by Greg Parker:
* The wrapper for fcntl(F_SETOWN) and fcntl(F_SETSIG) ignores ARG3,
  but should not.

* Linux PRE(sys_umount) doesn't print ARG2.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4487
2005-08-24 13:55:59 +00:00
Julian Seward
b42cf14c30 Enable a few more syscalls on ppc32-linux.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4463
2005-08-19 10:07:29 +00:00
Tom Hughes
2f83dba402 Don't assert if execve fails. Fixes bug #110875.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4435
2005-08-16 10:19:58 +00:00
Nicholas Nethercote
c1719a4c98 Clarify comment.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4406
2005-08-14 17:36:07 +00:00
Tom Hughes
ebe67e6134 Check the fields of the new structure passed to sigaction individually
and only check sa_restorer if the SA_RESTORER flag is set.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4338
2005-08-07 15:16:59 +00:00