Commit Graph

217 Commits

Author SHA1 Message Date
Nicholas Nethercote
493933b1c6 Arch-abstraction: a nice change that removes the need for ume_entry.S. Instead
of using an assembly hack to find the stack pointer at startup, we find it from
argv.  It's much simpler, avoids linking games, is platform independent, and
works on PPC.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2782
2004-10-18 11:52:17 +00:00
Nicholas Nethercote
7f7638248f Remove unnecessary glibc #includes; use VKI_O_RDONLY instead of O_RDONLY as
appropriate with VG_(open).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2777
2004-10-16 15:31:49 +00:00
Nicholas Nethercote
7942c92bd6 Some combined cleaning up and arch-abstraction, involving UME and start-up:
- removed some assumptions that arch==x86 in Makefile.am files

- removed ume_arch.h;  moved its contents into ume.h.  There was no need for
  these to be separate.

- moved ume_go.c into an x86/ subdir;  gave it the more meaningful name
  jmp_with_stack.c in the process (the corresponding function also got the name
  change)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2757
2004-10-13 17:55:31 +00:00
Nicholas Nethercote
7440f4def2 Cleaned up ume.h by moving some functions around.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2756
2004-10-13 17:29:01 +00:00
Nicholas Nethercote
e86e8e1216 Improve error message.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2736
2004-10-08 14:01:14 +00:00
Tom Hughes
ea28504761 When augmenting the argument vector from the VALGRIND_OPTS environment
variable and/or the .valgrindrc files, make sure that enough space is
allocated for all the old arguments, not just those that are arguments
to valgrind itself.

CCMAIL: 88604-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2706
2004-09-13 10:20:34 +00:00
Tom Hughes
2aad0526df Virtualise the stack rlimit for the main thread and make valgrind enforce
that limit when growing the stack. Also add a message when the stack in any
thread overflows.

CCMAIL: 73818-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2689
2004-09-11 14:16:57 +00:00
Nicholas Nethercote
0a67ac22b4 Redo the regs setting for db-attach, in a way that works for PPC, which doesn't
support ptrace(SETREGS,...).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2678
2004-09-09 13:40:31 +00:00
Jeremy Fitzhardinge
8a1746826d Use MAP_NORESERVE for potentially large mappings.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2674
2004-09-08 20:03:51 +00:00
Nicholas Nethercote
d897ba2bd1 To get 32-bit programs working on Opteron, VG_(valgrind_end) was recently
changed to name the last byte in Valgrind's section, rather than one past the
last byte.  This was because the last byte is 0xffffffff, and so one past gave
0x0, which screwed things up.

However, when this change was made, all the places where VG_(valgrind_end) is
used weren't adjusted appropriately.  So this commit makes those adjustments.
It also renames the variable as VG_(valgrind_last), which makes the difference
between it and the other VG_(*_end) variables much clearer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2672
2004-09-07 23:04:49 +00:00
Nicholas Nethercote
0c56e65d07 Arch-abstraction:
- factored out pointercheck setup.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2671
2004-09-07 22:38:23 +00:00
Nicholas Nethercote
d5e1fb3c1d Arch-abstraction:
- factored out the setting of machine registers used when attaching the
  debugger.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2670
2004-09-07 22:22:39 +00:00
Nicholas Nethercote
4ecc334c35 Arch-abstraction:
- Moved VG_MAX_REALREGS into x86/ part.
- Tweaked basic types so they're suitable for both 32-bit and 64-bit platforms.
  Main change was to change 'Addr' to "unsigned long" which is the same size as
  a pointer.  Had to make a couple of minor changes to accommodate this.
  Also, introduced 'UWord' and 'Word' types which will be necessary for making
  code 64-bit clean.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2669
2004-09-07 10:17:02 +00:00
Nicholas Nethercote
28864b7564 Arch-abstraction:
- moved a lot of the baseBlock initialisation into x86/, including all the
  VGOFF variables, and all the x86 asm helper functions.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2668
2004-09-06 16:43:37 +00:00
Nicholas Nethercote
2a1a81befa Arch-abstraction: arch-neutralise the startup message.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2667
2004-09-06 15:34:37 +00:00
Nicholas Nethercote
8762c939f2 Simplify calculation of VG_(shadow_end) to avoid an obscure bug on Paul M's PPC
port caused by rounding errors.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2661
2004-09-04 15:53:35 +00:00
Nicholas Nethercote
b392873e38 Removed x86/ume_archdefs.h; moved CLIENT_BASE into x86/core_arch.h.
(CLIENT_BASE wasn't really part of UME.)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2659
2004-09-03 23:25:33 +00:00
Nicholas Nethercote
18355ff96b Arch-abstraction:
- Added include/x86/:  contains tool_arch.h, Makefile.am, .cvsignore.

- Added coregrind/x86/state.c.  Contains some arch-specific code for dealing
  with x86 registers -- eg. setting up the baseBlock, loading/saving the whole
  register state.  It is compiled into coregrind/x86/libarch.a and linked via
  ${VG_ARCH} with the core.

  Relatedly, also added coregrind/x86/{core_arch.h,core_arch_asm.h}.

- Correspondingly abstracted the register state out of ThreadState.  This
  affected every place that touches registers, and there are a lot of them.
  (Eventually all the register touching should be abstracted out in an
  arch-neutral way, but not yet;  one step at a time.)

- Added some declarations about register loading/saving functions to core.h;
  all architectures will have to provide these functions.

- Rejigged the build system so that the arch-specific stuff is all done via
  ${VG_ARCH}, rather than naming e.g. x86/ directly.  Appropriate -I arguments
  are used so that all the headers are found, etc.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2656
2004-09-03 13:45:29 +00:00
Nicholas Nethercote
ba210a6364 Arch-abstraction step: renamed "vg_include.h" as "core.h".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2643
2004-09-01 23:58:16 +00:00
Nicholas Nethercote
78cb64cc71 Print a message if shadow memory cannot be allocated, rather than just
asserting.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2629
2004-08-30 19:36:42 +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
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
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
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
Nicholas Nethercote
a545bc15cc Tweaked sanity-checking: made function naming more consistent, removed
unnecessarily global functions from vg_include.h, etc.

Also tweaked printing of malloc stats.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2562
2004-08-03 23:14:00 +00:00
Nicholas Nethercote
12a9939d3f Tweak stats printing -- use more consistent function names, improve output
formatting slightly, etc.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2561
2004-08-03 18:08:50 +00:00
Nicholas Nethercote
ac6d31fd77 Removed 6 global variables from vg_include.h without even having to add
anything, just by moving VG_(helper_offset)() from vg_from_ucode.c to
vg_main.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2556
2004-08-03 15:45:46 +00:00
Nicholas Nethercote
38ff4e69d1 Comment changes only: s/skin/tool/
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2555
2004-08-03 13:29:09 +00:00
Nicholas Nethercote
b960eb25f7 comment wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2553
2004-08-02 16:54:01 +00:00
Nicholas Nethercote
3ef40799ac Scheduler counts don't need to be in vg_include.h. Replace with a print
function.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2551
2004-08-02 15:27:22 +00:00
Nicholas Nethercote
033827c0fd whoops, forgot to remove these in the last commit
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2550
2004-08-02 15:19:55 +00:00
Nicholas Nethercote
f8aacadc2b sanity_*_count don't need to be in vg_include.h.
Also hide the reg-alloc counters, and replace with a printing function.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2549
2004-08-02 15:17:43 +00:00
Nicholas Nethercote
11f790685a Sanity counters don't need to be in vg_include.h.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2548
2004-08-02 15:07:57 +00:00
Nicholas Nethercote
16ae73470f Tweak to remove another global variable from vg_include.h
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2547
2004-08-02 13:15:26 +00:00
Nicholas Nethercote
9a31e70a79 Cleaned up vg_include.h:
- removed various things that are no longer used
- made (module-)local some things that were global
- improved the formatting in places

Removed about 160 lines of code, and non-trivially reduced the number
of global entities.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2541
2004-08-01 22:36:40 +00:00
Nicholas Nethercote
1eb570df2c Restructured the as_*() functions so they are simpler and there is no implicit
global state -- the state is threaded explicitly through via function arguments
and return values.  ume.c now has no global variables, which is nice.

Also removed a redundant as_pad() call in stage2's main() which meant
layout_client_space() could be merged with layout_remaining_space().

Also removed a couple of no-longer-used variables and #defines.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2537
2004-07-30 21:50:15 +00:00
Nicholas Nethercote
4421ac53b7 Added some comments.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2531
2004-07-26 15:43:57 +00:00
Nicholas Nethercote
c4a06df097 Rename 'argv0' and 'argv1' to the more meaningful 'interp_name' and
'interp_args'.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2530
2004-07-26 15:32:47 +00:00
Nicholas Nethercote
8375190f69 Remove accidental double assignment. Also don't assume that VG_(client_base)
is zero.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2528
2004-07-26 12:44:35 +00:00
Nicholas Nethercote
dbc191490a Er, actually make this test meaningful. It now aborts correctly if you try to
launch stage2 directly, rather than giving an obscure error about the tool
later on.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2527
2004-07-26 11:11:56 +00:00
Tom Hughes
beadd8c358 Only treat colons in the switch name as important when looking for a
toolname to check - colons in the switch value are now ignored.

CCMAIL: 85416-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2503
2004-07-18 08:05:44 +00:00
Nicholas Nethercote
ec09bc6f26 Add a bunch of asserts to check the results of calls to system malloc().
Assertions are arguably not the right thing here, but the practice is
widespread and we're not planning on making asserts optional, and it's a lot
better than no checking.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2499
2004-07-17 16:40:50 +00:00
Nicholas Nethercote
755111b88d Slightly change, with J's approval, startup copyright messages to better
reflect reality.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2489
2004-07-16 17:44:00 +00:00
Nicholas Nethercote
b75b729a76 This commit fixes things so that the client stack can be easily placed
anywhere, even below the client executable, just by changing a single
assignment to VG_(clstk_end).  I haven't actually moved the stack, though.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2483
2004-07-15 14:58:33 +00:00
Nicholas Nethercote
472d50b40a Merged Valgrind's heap and stack. This has two main advantages:
1. It simplifies various things a bit.

2. Valgrind/tools will run out of memory later than currently in many
circumstances.  This is good news esp. for Calltree.

Some things were going in V's 128MB heap, and some were going in V's 128MB map
segment.  Now all these things are going into a single 256MB map segment.
stage2 has been moved down to 0xb0000000, the start of the 256MB map segment.
The .so files needed by it are placed at 0xb1000000 (that's the map_base).

This required some bootstrapping at startup for memory -- we need to allocate
memory to create the segments skip-list which lets us allocate memory...
solution was to make the first superblock allocated a special static one.
That's pretty simple and enough to get things going.

Removed vg_glibc.c which wasn't doing anything anyway.

Removed VG_(brk) and associated stuff, made all the things that were calling it
call VG_(mmap)() instead.

Removed VG_(valgrind_mmap_end) which was no longer needed.

Rejigged the startup order a bit as necessary.

Moved an important comment from ume.c to vg_main.c where it should be.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2482
2004-07-15 12:59:41 +00:00
Tom Hughes
0856504b27 Make sure the separator is restored when scan_colsep exits early. This
stops the PATH variable being truncated for programs run under valgrind.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2480
2004-07-12 09:35:37 +00:00