142 Commits

Author SHA1 Message Date
Nicholas Nethercote
fe21329e16 Renamed and retyped the fields relating to valgrind's stack in os_state_t to
make their role clearer and their behaviour more consistent with the fields
describing the client's stack.  Also made the code in x86-linux/syscalls.c
and amd64-linux/syscalls.c more word-size-independent, which is not strictly
necessary but makes the code similarities between the two files more
obvious.

One consequence of this is that Valgrind's stack on AMD64 is now 16384 * 8
bytes, rather than 16384 * 4 bytes.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3520
2005-04-05 02:49:09 +00:00
Nicholas Nethercote
c8f3476758 minor cleanup with the stack-related fields in ThreadState:
- removed "stack_base" which wasn't used in any meaningful way
- added "client_" prefix to make it clear they concern the client's stack
- renamed "stack_size" as "client_stack_szB" to make the units clear



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3516
2005-04-04 02:41:42 +00:00
Julian Seward
0e735dde57 In vg_memory.c, allow the stack-change threshold to be specified by a
command-line flag (--max-stackframe=number), rather than hardwiring it
to 2000000.  This is helpful for dealing with unruly Fortran programs
which want to allocate large arrays on the stack.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3512
2005-04-02 23:40:59 +00:00
Julian Seward
1a2c48a114 A major overhaul of how malloc/free intercepts are done. The general
idea is the same -- write functions with special names encoding
sonames and fn names, and have the redir mechanism notice them.
However the way the functions are generated is significantly changed:

* The name mangling scheme has been replaced with one which is just about
  simple enough not to need a preprocessing phase.  Hence
  vg_replace_malloc.c.base is replaced by vg_replace_malloc.c, and
  the preprocessor disappears.  The demangler in vg_symtab2.c changes
  accordingly.

* Kill off the horrendous LIBALIAS macro.  In return we have to
  enumerate all the redirections longhand, but this is not a big deal.

* Remove use of the GNUisms "attribute alias" and "attribute
  protected".

* Remove the hardwired assumption that any C++ new/new[]/etc symbols
  we might want to intercept are mangled in GNU style.

* Add more comments.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3510
2005-04-02 17:38:59 +00:00
Tom Hughes
8ab17244a8 Add VGP_(setup_redirects) to the platform specific layers and use
it to setup vsyscall redirects on amd64 and the _dl_sysinfo_int80
redirect on x86.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3503
2005-04-02 15:53:01 +00:00
Tom Hughes
61ca56765a Move the gettid system call to the linux specific section.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3493
2005-03-31 16:02:07 +00:00
Nicholas Nethercote
3075ee0682 Rename VG_(tool_interface), which is overly general and a bit verbose, as
VG_(tdict).  Also make the typing more meaningful in vg_mallocfuncs_info.
And (barely) start removing the use of "TL_" names in the core.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3488
2005-03-31 04:52:26 +00:00
Nicholas Nethercote
f1f707c7b2 This change reduces the number of calls to dlsym() when loading tools from a
lot to one.  This required two basic changes.

1. Tools are responsible for telling the tool about any functions they
provide that the tool may call.  This includes basic functions like
TL_(instrument)(), functions that assist core services such as
TL_(pp_Error)(), and malloc-replacement-related functions like
TL_(malloc)().  

2. Tools that replace malloc now specify the size of the heap block redzones
through an arg to the VG_(malloc_funcs)() function, rather than with a
variable VG_(vg_malloc_redzone_szB).

One consequence of these changes is that VG_(tool_init_dlsym)() no longer
needs to be generated by gen_toolint.pl.

There are a number of further improvements that could follow on from this one.
- Avoid the confusingly different definitions of the TL_() macro in the
  core vs. for tools.  Indeed, the functions provided by the tools now don't
  need to use the TL_() macro at all, as they can have arbitrary names.
- Remove a lot of the auto-generated stuff in vg_toolint.c and vg_toolint.h
  (indeed, it might be possible to not auto-generate these at all, which
  would be nice).
- The handling of VgToolInterface is currently split across vg_needs.c and
  vg_toolint.c, which isn't nice.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3487
2005-03-31 04:37:24 +00:00
Julian Seward
1a4748ff32 Completely get rid of VG_(instr_ptr_offset).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3484
2005-03-30 19:04:29 +00:00
Tom Hughes
9c1e938286 Fixed ROUNDDN to avoid truncating the result when the first argument
doesn't fit in 32 bits and the second one does.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3478
2005-03-29 12:16:10 +00:00
Nicholas Nethercote
7f22267612 VG_(get_memory_from_mmap_for_client)() need not be tool-visible.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3463
2005-03-27 03:48:13 +00:00
Nicholas Nethercote
68647c085d VG_(bbs_done) doesn't need to be tool-visible.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3461
2005-03-27 03:17:52 +00:00
Nicholas Nethercote
3ffaf470ac Remove dead field '.siginfo' from ThreadState(!)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3460
2005-03-27 02:38:15 +00:00
Nicholas Nethercote
8b55677ded Remove dead macros and declaration.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3459
2005-03-27 02:01:31 +00:00
Nicholas Nethercote
f912a81248 Add VGA_ prefix to the arch-specific macros {MIN,MAX}_INSTR_SIZE and
REGPARMS.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3458
2005-03-27 01:55:21 +00:00
Nicholas Nethercote
e2e1d2f896 Merge STR and VG__STRING macros into one, VG_STRINGIFY. Also, in
valgrind-listener.c, don't use the VG_ prefix on its equivalent, because
it's a local definition.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3454
2005-03-27 01:25:38 +00:00
Nicholas Nethercote
d5717b3e8c The two patches attached resolve the exit-hang (of OOo) bug for me. The first
fixes getppid(), and the second fixes the next bug which is revealed
once getppid() does what LinuxThreads wants;  LinuxThreads uses SIGKILL
to kill off stray threads, but if we send naked SIGKILLs to Valgrind
threads, they'll die without cleaning up or informing anyone of their
death, which means that they're waited on forever. 

ADAPTED FROM CVS HEAD



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3449
2005-03-26 20:08:06 +00:00
Nicholas Nethercote
bb4598350e Obsoleted three client requests that were still hanging around from the old
libpthread implementation: USERREQ__READ_MILLISECOND_TIMER, USERREQ__MALLOC,
USERREQ__FREE.

As a consequence, all the PTHREQ macros (eg. VGA_PTHREQ_RET,
SET_PTHREQ_RETVAL) could be removed.  And VG_(tl_malloc_called_by_scheduler)
has been renamed VG_(tl_malloc_called_deliberately) to reflect how its role
has changed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3438
2005-03-26 03:50:14 +00:00
Nicholas Nethercote
b08a041b56 Use "VGO_" prefix for various OS-specific exports.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3437
2005-03-26 02:57:36 +00:00
Nicholas Nethercote
8853545f0f Use VGP_ prefix more consistently for platform-specific exports.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3436
2005-03-26 02:42:31 +00:00
Nicholas Nethercote
27066dbfc5 Don't use the VGP_ for profiling any more, just use VG_ -- we want to use
VGP_ for platform-specific things.  



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3435
2005-03-26 00:42:02 +00:00
Nicholas Nethercote
0f0863110d Rename some arch-specific macros to use the more consistent "VGA_" prefix.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3432
2005-03-26 00:04:03 +00:00
Nicholas Nethercote
ff514fd09b Rename M_VG_ERRTXT as VG_ERRTXT_LEN, which is more consistent with other
names.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3430
2005-03-25 23:47:16 +00:00
Nicholas Nethercote
f474d2e51a A modularisation + refactoring commit. vg_execontext.c has been split into
two halves: stacktrace.c, which deals with getting, traversing and printing
stack traces;  and execontext.c, which deals with storing stack traces
permanently in a way that avoids duplicates, and comparing them.

One nice outcome:  previously we were often creating ExeContexts, which live
forever, even when they were only needed temporarily.  Ie. this was a memory
leak, which has been removed.

As part of this, new headers have been created, carved off core.h and
tool.h.  Lots of function names have changed, too.

In Massif, I also changed a lot of "eip" names to "ip" to make them less
x86-specific.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3429
2005-03-25 23:35:48 +00:00
Julian Seward
43e6c44681 Various amd64 syscall improvements (Tom Hughes)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3425
2005-03-24 17:52:02 +00:00
Julian Seward
28650c3aa0 jmp_with_stack is a hack which makes no sense on archs which pass args
in registers.  Replace it (for amd64) with something more disciplined:
call_on_new_stack_0_0 and call_on_new_stack_0_1.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3401
2005-03-22 00:19:55 +00:00
Nicholas Nethercote
f94393fec0 This commit partly cleans up and modularises ExeContext usage. It doesn't
look like that much, but it's a good first step;  there's more to come.

- vg_errcontext.c:gen_suppressions() and vg_symtab2.c:VG_(mini_stack_dump)()
  had very similar stack-trace-traversing loops.  I factored these out into
  the higher-order function VG_(apply_ExeContext)().  I put this into
  vg_execontext.c, which is the obvious spot.  This is good because before
  this change we had two functions, neither in vg_execontext.c, which were
  crawling all over ExeContexts -- they shouldn't have to do that.
  
- Removed VG_(mini_stack_dump)(), which was almost identical to
  VG_(pp_ExeContext)().

- Removed dead function VG_(get_EIP_from_ExeContext)().

- Replaced a call to VG_(get_ExeContext2)() with the simpler
  VG_(get_ExeContext)() in vg_scheduler.c.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3394
2005-03-20 23:45:36 +00:00
Julian Seward
b7761ebdb4 Don't show VEX emulation warnings by default; they are just too tiresome.
If you want to see them, use --show-emwarns=yes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3387
2005-03-19 15:12:21 +00:00
Nicholas Nethercote
3addbd9530 Get rid of VG_(malloc_aligned)(), and make VG_(arena_malloc_aligned)() local
to vg_malloc2.c -- the core and tools never do allocations with alignments
different to the default alignment.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3343
2005-03-13 18:33:02 +00:00
Nicholas Nethercote
b4dd85ce0c Remove two malloc/free arenas:
- JITTER, which was unused, since Vex now manages its own memory
- TRANSIENT, which was barely being used;  I replaced it with usage of CORE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3342
2005-03-13 18:11:44 +00:00
Nicholas Nethercote
ba91df6db8 Remove the alignment arg from VG_(arena_calloc)() and VG_(arena_realloc)(),
because it was always being set to VG_MIN_ALLOC_SZB, and so was just one
more thing to get wrong, as well as exposing VG_MIN_ALLOC_SZB to more places
than necessary.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3340
2005-03-13 14:56:31 +00:00
Nicholas Nethercote
122ce0fcb5 Remove dead function VG_(is_empty_arena)(). Also cleaned up the comment in
vg_demangler.c regarding its former use.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3339
2005-03-13 14:28:39 +00:00
Nicholas Nethercote
f7cf78c703 Remove some dead macros.
Move others that are only used in one file, out of core.h into that file.
Remove the "VG_" prefixes while doing it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3337
2005-03-13 06:26:22 +00:00
Nicholas Nethercote
be852cb912 Make VG_(deliver_signals)() local.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3333
2005-03-13 06:00:47 +00:00
Nicholas Nethercote
05fe123a9e Update copyright notice for 2005 on all relevant files. Don't bother trying
to be selective about it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3303
2005-03-12 16:22:54 +00:00
Nicholas Nethercote
29cc7c8a6c Remove dead functions: VG_(set_arg_and_bogus_ret), VG_(thread_initial_stack).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3294
2005-03-12 05:48:06 +00:00
Nicholas Nethercote
4cfbb7f38c Remove dead function: VG_(do_pthread_sigmask_SCSS_upd).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3291
2005-03-12 05:35:01 +00:00
Nicholas Nethercote
56bce432c3 Get rid of the VALGRIND_INTERNAL_PRINTF_BACKTRACE request -- it's no longer
used.

And move VALGRIND_INTERNAL_PRINTF() out of core.h into vg_replace_malloc.c,
which is the only place it's used now.  Also made it print it's message with
Vg_DebugMsg rather than Vg_UserMsg, which makes more sense, since it's used
for --trace-malloc which is debugging-style info.

Improved some comments about this stuff too.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3290
2005-03-12 05:32:28 +00:00
Nicholas Nethercote
d9d1e37683 Remove dead declarations.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3288
2005-03-12 05:04:30 +00:00
Nicholas Nethercote
6498475675 Fix VG_(calloc)() so it actually zeroes the entire memory area it allocates.
Also rename the variables involve to lessen the chance of such confusion        
occurring again.  

MERGED FROM CVS HEAD


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3274
2005-03-11 04:44:10 +00:00
Julian Seward
0356d27ca6 Merge in changes from the 2.4.0 line. This basically brings in the
overhaul of the thread support.  Many things are now probably broken,
but at least with --tool=none, simple and not-so-simple threaded and
non-thread programs work.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3265
2005-03-10 23:59:00 +00:00
Julian Seward
435d820b6d Clean up handling of socket system calls on amd64-linux, so that the
code for them is shared between amd64-linux and x86-linux.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3257
2005-03-01 19:00:30 +00:00
Julian Seward
006c9e84c3 When handling syscalls, don't try to figure out if the pre-handler set
the syscall result by inspecting RES after the pre-handler has run.
Instead, give each thread a syscall_result_set Bool, and make
SET_RESULT set it.  Inspect that Bool.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3254
2005-02-28 17:27:04 +00:00
Julian Seward
be6b72b2d3 Various cleanups to revised low-level memory manager.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3253
2005-02-28 14:39:21 +00:00
Julian Seward
f122d86dc0 Further cleanups to low-level memory management. It's still a
conceptual mess and needs a redesign, but this is a start.  Most stuff
now works again.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3247
2005-02-18 08:28:32 +00:00
Julian Seward
245173117c Major rewrite of the machinery which keeps track of segments:
* remove initialisation-time circularities by not using the
  skiplist mechanism and therefore not using any dynamically
  allocated memory in support of this mechanism

* Add comments about how it works (it is pretty opaque) so as
  to help future maintainers/bug-fixers

It only just works and many things are still broken.  That should
improve rapidly however.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3242
2005-02-16 01:31:37 +00:00
Julian Seward
67a7a983cf Change signature of thread_syscall a bit.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3239
2005-02-13 10:57:01 +00:00
Julian Seward
efcf1e61ec Complete rewrite (I think this is the 4th incarnation) of translation
table/cache management.  Two main changes.  (1) Translation areas are
recorded using VexGuestExtents, so that Vex is now properly supported
and code deletion works correctly.  (2) Low overhead BB profiling,
enabled by the --profile-flags=<XXXXXXXX> option.  This finds the top
N bbs at exit and shows them, so as to give a basis from which to do
performane tuning.

To support this, the way tt/tc work is changed.  It is still a
sectored arrangement, but now each sector has its own hash table.
This simplifies a lot of things.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3226
2005-01-19 11:55:34 +00:00
Julian Seward
9b03779a20 Implement --log-file-exactly= for when the user wants to specify
*exactly* the log file name.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3220
2005-01-11 14:01:02 +00:00
Julian Seward
6c9a668a42 Add a new variant for --gen-suppressions: --gen-suppressions=all,
which just prints a suppression for all reported errors without asking
questions.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3219
2005-01-10 17:24:47 +00:00