Commit Graph

1750 Commits

Author SHA1 Message Date
Tom Hughes
577fc708f5 More amd64 system calls - emacs will now run under valgrind.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3511
2005-04-02 17:43:50 +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
7f5a0ed772 Remove vg_instrument.c from the makefile.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3507
2005-04-02 17:25:34 +00:00
Julian Seward
54279266b4 Get rid of apparently-redundant file.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3506
2005-04-02 17:16:25 +00:00
Tom Hughes
9ba2c09188 Assert that cpuid is available - this is just done to force the
code from cpuid.S to be pulled in so that tools can use it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3505
2005-04-02 17:01:52 +00:00
Tom Hughes
488b74dad3 Get VG_(has_cpuid) and VG_(cpuid) working on amd64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3504
2005-04-02 17:01:07 +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
43c5476c8c Don't truncate symbol values in ELF symbol tables.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3501
2005-04-02 14:57:43 +00:00
Tom Hughes
938b22c9c2 Even more amd64 system calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3499
2005-04-02 11:39:56 +00:00
Tom Hughes
6f26888fd7 Yet more amd64 system calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3498
2005-04-01 23:38:37 +00:00
Tom Hughes
e29c8a9ebd More amd64 system calls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3497
2005-04-01 23:22:36 +00:00
Tom Hughes
446ea57895 Rework the vsyscall redirections to work in pie code - the old form
seemed to completely confuse the compiler and it was generating
nonsense code to get the address of the replacement routines.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3495
2005-04-01 18:58:09 +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
Julian Seward
6109ce1fb4 Increase maximum translation size. This can happen when translating
long sequences of x86 insns with IR optimisation disabled, so the
tag-checking crap doesn't get knocked out like it usually does.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3492
2005-03-31 15:48:57 +00:00
Tom Hughes
21d1184fb7 Implement the gettid system call which seems to have got lost in the merge.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3490
2005-03-31 09:09: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
Tom Hughes
b03faae5f5 Make the dispatcher code position independent so that PIE mode works.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3486
2005-03-30 23:36:28 +00:00
Julian Seward
ff71ced87a Comment-only change
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3485
2005-03-30 19:31:18 +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
Julian Seward
25bad06ca3 Get rid of the use of VG_(instr_ptr_offset) since we know what that is
at system-build time: OFFSET_amd64_RIP.  This saves an instruction on
the fast path, and reduces the number of PIE-difficulties by one.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3483
2005-03-30 18:42:59 +00:00
Julian Seward
5bf0015052 rm unused function
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3482
2005-03-30 18:26:52 +00:00
Tom Hughes
cd18564979 Get thew DWARF reading going on 64 bit machines.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3481
2005-03-30 15:05:46 +00:00
Tom Hughes
6eccce80ba Discard the sys_socketcall wrapper (there is no socketcall system
call on amd64) and add a proper sys_socket wrapper.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3480
2005-03-30 08:22:38 +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
Tom Hughes
1de0d47116 Build the arch and platform libraries as PIE code when appropriate.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3477
2005-03-29 10:03:04 +00:00
Tom Hughes
ea0a6d77f5 Revive VG_(cpuid) which had been commented out during the merge and
add VG_(has_cpuid) as well. These are then used in place of the inline
assembly in state.c as the compiler was having trouble allocating the
required registers when building in PIE mode.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3476
2005-03-29 09:53:47 +00:00
Tom Hughes
f67c9b8ef0 Rework inline assembly to avoid requiring specific registers as they
may not always be available, especially in PIE builds.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3475
2005-03-29 09:52:21 +00:00
Tom Hughes
244a4aa560 Avoid truncating addresses returned from mmap on 64 bit platforms.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3474
2005-03-29 09:00:37 +00:00
Tom Hughes
7beebdd5b9 Avoid truncating addresses in debugging message.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3473
2005-03-29 09:00:12 +00:00
Tom Hughes
ba4f330105 Build the arch, os and platform libraries as PIE code if PIE is
enabled as they get linked into stage2 which is the PIE part.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3472
2005-03-29 08:09:31 +00:00
Tom Hughes
2a192a048f The open system call has a post handler.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3469
2005-03-28 23:25:58 +00:00
Tom Hughes
acdb4b9b02 Implement some more system calls on amd64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3468
2005-03-28 18:19:45 +00:00
Tom Hughes
7fc4fb6433 Actually setup the arguments for a signal handler before running
it - that way the signal might do what is expected.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3467
2005-03-28 18:19:21 +00:00
Julian Seward
3d55d57480 Reinstate a few more syscalls.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3466
2005-03-27 18:20:26 +00:00
Julian Seward
897aefaee9 comment-only change
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3464
2005-03-27 04:08:09 +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
416be3f29e Remove the "vg_" prefix from a lot of non-global variables.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3462
2005-03-27 03:40:28 +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
36e86a9542 Add VG_ prefix to SKIPLIST_INIT and IS_*_ALIGNED macros. Also pull
IS_PAGE_ALIGNED into tool.h with the others.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3457
2005-03-27 01:42:41 +00:00
Julian Seward
417691eb5a Track generic and x86 changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3456
2005-03-27 01:35:16 +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
8aac9bd8a7 Make the 'arg' parameter to VG_BOOL_CLO and similar macros explicit, rather
than implicit.  Also tweak some formatting of command-line arg code.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3453
2005-03-27 01:00:11 +00:00
Nicholas Nethercote
f0232e8c01 Remove some old CLOs that were hanging around for backward compatibility.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3452
2005-03-27 00:44:31 +00:00
Nicholas Nethercote
855c76345c Tweaks involving VG_(strncpy_safely)(), mostly to shorten code sequences.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3450
2005-03-26 21:34:45 +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
f385afbb5c sys_futex's FUTEX_(CMP_)REQUEUE requests use the futex2 pointer (not
timeout); FUTEX_CMP_REQUEUE also uses the timespec pointer as an integer.       
                                                                                
Also, more clearly document the argument usages, and make the per-operation     
special cases clearer.             

MERGED FROM CVS HEAD


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3447
2005-03-26 16:44:19 +00:00