Commit Graph

595 Commits

Author SHA1 Message Date
Julian Seward
e87a6ce4ce Partially merge patch from Jeremy Fitzhardinge:
13-track-condvar-mutex
  This fixes mutex lock/unlock tracking. In particular, it gets
  tracking of mutex ownership over condition variables correct.

I didn't take the bits to do with vg_tid_currently_in_baseBlock's value
when baseBlock is empty.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1252
2002-10-22 04:30:35 +00:00
Julian Seward
9332fb832a Merge patch from Jeremy Fitzhardinge:
08-skin-clientreq
  Introduce a systematic way for skins to distinguish each other's
  client requests. Uses the de-facto standard two-letter identifiers in
  the top two bytes of the client request code. Also changes the
  interface to SK_(handle_client_request) so that a skin can say whether
  or not it handled the request, which allows correct setting of the
  default return value if the request was not handled.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1251
2002-10-22 04:14:35 +00:00
Julian Seward
976b63337a Common up leak detection stuff which was previously duplicated in Memcheck
and Addrcheck.  In coregrind/vg_memory.c, create

   void VG_(generic_detect_memory_leaks

and remove several hundred lines of code from both ac_main.c and mc_main.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1250
2002-10-21 07:29:59 +00:00
Julian Seward
1069339a64 merge patch from Jeremy Fitzhardinge:
16-ld-nodelete
  Add -Wl,-z,nodelete,-z,initfirst to link line for libpthread.so,
  because HJ [Lu] says so. Also add soname.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1249
2002-10-20 19:50:07 +00:00
Julian Seward
e3fbbadd13 merge patch from Jeremy Fitzhardinge:
15-hg-datasym
  HELGRIND: In conjunction with patch 13-data-syms, print symbolic
  information for addresses in error messages (if possible).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1248
2002-10-20 19:43:47 +00:00
Julian Seward
eba1b443e5 merge patches from Jeremy Fitzhardinge:
14-hg-tid
  HELGRIND: This fixes a bug in Helgrind in which all memory access by
  syscalls was being treated as if it were happening in thread 1. This
  is because the eraser_mem_read/write functions were using
  get_current_tid_1_if_root() to get the current tid. Unfortunately,
  during syscalls there is no current thread, so it was getting
  1_if_root. This patch fixes this by using what thread ID information
  we're given, and only using get_current_tid() if we're recording a
  memory access performed by code (rather than by a syscall).

... which relies on ...

06-memops
  Implement VG_(memcpy/memset).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1247
2002-10-20 19:40:32 +00:00
Julian Seward
1778e7985a Merge 13-data-syms from Jeremy Fitzhardinge:
Fix to the ELF file reader to make sure that each SegInfo includes not
only the text mapped from an ELF file, but also the data and bss. This
allows the data symbols to be extracted. Also adds a new needs boolean
to allow a skin to specify if it needs data symbols. As a nice
side-effect, it removes the "offset" hack: the offset is the mapped
address in the ELF Phdr: it is (mapped_address - phdr_vaddr).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1246
2002-10-20 19:29:21 +00:00
Julian Seward
dfa3421369 Merge 07-seginfo from Jeremy Fitzhardinge:
API for skins to extract information about mapped segments.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1245
2002-10-20 18:35:48 +00:00
Julian Seward
a2174b135a merge (in effect, and without docs) revs:
valgrind.in       1.17.2.3
   vg_syscall_mem.c 1.58.2.12

Add Jeremy Fitzhardinge's --weird-hacks=lax-ioctls patch, and add some docs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1244
2002-10-20 18:11:49 +00:00
Julian Seward
e6e71496fa merge rev 1.8.2.2:
Add a suppression for R H 7.3 on i686.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1243
2002-10-20 16:27:43 +00:00
Julian Seward
8f7a43395a merge rev 1.90.2.12:
Put __pthread_getspecific_addr inside ifdefs.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1242
2002-10-20 16:25:55 +00:00
Julian Seward
488524613b merge rev 1.90.2.11:
Create __ versions of the select and poll symbols, so that all
references are caught (Jeremy Fitzhardinge)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1241
2002-10-20 16:24:04 +00:00
Julian Seward
4a133a6408 merge revs
vg_libpthread.c       1.90.2.10
   vg_libpthread_unimp.c 1.30.2.5

Implement (sort-of) pthread_attr_{set,get}guardsize.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1240
2002-10-20 16:22:57 +00:00
Julian Seward
3a80785b70 merge rev 1.68.2.11:
Add ever more new ioctls and syscalls.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1239
2002-10-16 23:13:00 +00:00
Julian Seward
695aaac7c1 merge revs
vg_libpthread.c 1.90.2.9
   vg_libpthread_unimp.c 1.30.2.4

Add sem_timedwait().  From Scott Smith <sls@cs.unt.edu>.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1238
2002-10-16 19:45:06 +00:00
Julian Seward
e6f9adbd38 merge rev 1.35.2.6:
Change the capitalisation of Reuben's Mite.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1237
2002-10-16 19:41:41 +00:00
Julian Seward
0ae79cc37d merge rev 1.29.2.8:
Implement primary opcode 0x1A (SBB Eb,Gb).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1236
2002-10-16 19:40:04 +00:00
Dirk Mueller
87e7036870 make it work with newer autoconf
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1235
2002-10-16 13:09:26 +00:00
Nicholas Nethercote
8a33a377c3 Minor update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1233
2002-10-16 08:38:58 +00:00
Nicholas Nethercote
72908a31a6 Wibbles, thanks to Arnaud Desitter.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1232
2002-10-15 08:48:08 +00:00
Nicholas Nethercote
20f83c6132 Added VG_(rename) (untested), and made VG_(bbs_done) visible to skins, both at
the request of Josef Weidendorfer for his KCachegrind stuff.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1231
2002-10-14 09:25:37 +00:00
Nicholas Nethercote
a1b7d4baa8 Moved baseBlock initialisation to after command-line processing, for skins that
don't register helpers until command-line options are seen.  As requested by
Jeremy Fitzhardinge.  Also neatened the code up marginally.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1230
2002-10-14 09:25:19 +00:00
Julian Seward
9ea62d1526 Incorporate horrible hack to workaround problem of emitting bogus
uninit-value errors on code with inlined strlen() et al from gcc-3.1
and above.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1213
2002-10-13 00:57:26 +00:00
Julian Seward
e5494a7f05 Fixes for the DWARF2 reader, from Josef Weidendorfer:
Attached patch is for the Dwarf2 source line info reader;
For reading, a state machine is used reconstructing source line
info while running and reading (see DWARF2 specification, ch. 6.2).
The state machine was correct, but the calls to addLineInfo()
were wrong: It reported most of the times too small ranges
for source code statements, because it used only the diff of the last
state machine command instead of the diff to the last statement
boundary. Effect: Around 1/3 of all addresses with source line info got
unknown location.
The patch adds a "last_address" to the state machine to remember the last
statement boundary. On reset, it#s initialised to the "invalid" address 0. I
hope this is OK (or should we use "(Addr)-1" instead?).
The patch now uses the "is_stmt" boolean correctly to only call addLineInfo()
if there's a statement boundary (on x86, is_stmt most probably is
always true...).

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1209
2002-10-12 17:27:16 +00:00
Julian Seward
99c3bf9dbb Finish off support for Red Hat 8 thread-specific-data. Unfortunately
the appearance of libc_internal_tsd_address requires a redesign, since
the existing scheme doesn't make it sensible to take the address of a
specific-data value.

New scheme is that the ThreadState structure carries not the table of
specifics, but merely a pointer to such.  This is allocated from the
client-side library, thus residing in client-visible memory and so
addresses can validlyh be taken.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1208
2002-10-12 16:42:35 +00:00
Julian Seward
a3d1803851 Initial stuff to make it work on Red Hat 8:
- autoconf stuff for detecting glibc-2.3

- vg_libpthread_unimp.c: hack for __pthread_clock_[gs]ettime

- vg_libpthread.c: initialise thread's default locale by calling
  __uselocale(LC_GLOBAL_LOCALE) at the right time.  Gruesome.
  Also need to do this for new other threads - not yet done.

- cleanups -- don't use write() to write messages when bombing out,
  instead go direct to the syscalls.  Avoids nasty circularities
  with glibc initialisations.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1207
2002-10-07 23:56:55 +00:00
Nicholas Nethercote
1bca542dbb whoops
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1206
2002-10-07 14:46:07 +00:00
Nicholas Nethercote
28823c33b3 Added support for multi-skin suppressions, of the form:
skin_name1,skin_name2:supp_name

No spaces are allowed on either side of the comma.

This is useful for sharing suppressions between Addrcheck and Memcheck.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1205
2002-10-07 14:42:59 +00:00
Julian Seward
12f700c127 saneUInstr: define CCf correctly for FPU insns: they read no flags and
write no flags (usually) or write ZCP (rarely, >= P6 only fast FPU compare
insns.)

up_UInstr: Put some 0x in %x fields so we can see what's hex.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1204
2002-10-06 21:43:50 +00:00
Julian Seward
3ea39b94d1 startup_segment_callback: don't panic when faced with non-executable,
non-readable, non-writable sections.  Just ignore them.  Comment in
the 1.0.X sources to the effect that this never happens is evidently a
lie.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1203
2002-10-06 00:28:21 +00:00
Julian Seward
fd98e867af Fix strange bug in matching AddrErrs.
Nick, can you sanity-check this?


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1202
2002-10-06 00:19:16 +00:00
Julian Seward
0e4db64cd9 Simplify assembler syntax for R H 6.2.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1201
2002-10-06 00:08:57 +00:00
Julian Seward
f75a03682d Make suppressions work again after I messed with skin names. Sigh.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1200
2002-10-05 16:49:09 +00:00
Julian Seward
e464620bad Unbreak make dist / make distcheck.
Not sure if this is correct; Nick, can you verify?  Thx.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1199
2002-10-05 16:19:56 +00:00
Julian Seward
704a740e17 Naming wibbles -- start skin names with a capital letter (they deserve it)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1198
2002-10-05 15:49:27 +00:00
Julian Seward
e4b914c896 --> 1.1.0 (yay!)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1197
2002-10-05 15:34:55 +00:00
Julian Seward
cc76a2766b printing verbosity wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1196
2002-10-05 15:34:38 +00:00
Julian Seward
88f5f0f178 Fix compile warnings
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1195
2002-10-05 15:28:29 +00:00
Julian Seward
7856fb224e modify_ldt nano-wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1194
2002-10-05 15:23:17 +00:00
Julian Seward
7e71cd0997 __NR_modify_ldt: func=0x11 is also a kind of write
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1193
2002-10-05 15:22:29 +00:00
Julian Seward
5e6bec250e merge revs
vg_syscall_mem.c 1.58.2.8 and 1.58.2.10
   vg_unsafe.h 1.8.4.2

Support for __NR_ptrace, thanks to Jason Molenda.  Now valgrind can be
used to debug GDB.  Bwaha!

Kludge to work around the problem that the /usr/include/sys/user.h on
R H 6.2 doesn't define struct user_fpxregs_struct (problem appeared
with Jason Molenda's ptrace patch).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1192
2002-10-05 15:18:27 +00:00
Julian Seward
ae1bdb53f7 merge rev 1.58.2.9:
Support __NR_mount and __NR_umount.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1191
2002-10-05 15:00:06 +00:00
Julian Seward
a4b942d399 merge rev 1.58.2.7:
Implement __NR_setresgid (170).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1190
2002-10-05 14:52:27 +00:00
Julian Seward
9d873be7dd merge rev 1.58.2.5:
Implement TIOCLINUX (from Pavel Roskin <proski@gnu.org>).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1189
2002-10-05 14:49:29 +00:00
Julian Seward
64e5d30677 merge rev 1.29.2.6:
Fix really stupid bug in REP SCAS<sz>.

Also (head only) add a bunch of asserts to guard against use of
seg override prefixes in conjunction with string ops; these are
not yet implemented.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1188
2002-10-05 14:42:39 +00:00
Julian Seward
8ce71517bd merge rev 1.29.2.7:
Implement missing XCHG insns.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1187
2002-10-05 14:36:26 +00:00
Julian Seward
b2ec9dae1b Implement, and document, the --run-libc-freeres=no|yes flag.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1186
2002-10-05 14:15:43 +00:00
Julian Seward
d822464c4a Back out rev 1.9 (optimised %eflags save/restore). It isn't quite
right.

Here's a code sequence illustrating the problem.  The conditional jump
at the end evidently goes the wrong way sometimes, and the program
goes off into outer space soon after.

        0x4017F6F7:  addl %ebx,%ecx

          12: GETL      %ECX, t10
          13: ADDL      %EBX, t10  (-wOSZACP)
          14: PUTL      t10, %ECX
          15: INCEIPo   $2

        0x4017F6F9:  decl %eax

          16: GETL      %EAX, t12
          17: DECL      t12  (-wOSZAP)
          18: PUTL      t12, %EAX
          19: INCEIPo   $1

        0x4017F6FA:  jnb-8 0x4017F710

          20: Jnbo      $0x4017F710  (-rOSZACP)
          21: JMPo      $0x4017F6FC

Look carefully at the annotation on # 17.  Then look in the Intel docs
and see what flag(s) the Jnb (not-below) condition consults.  Bwaha!
It consults the carry flag.

The generated code for 17 (renamed to 12 after some NOP removal, I
guess) is

          12: DECL      %edx  (-wOSZAP)         [---d--]
                 42: 4A
                decl    %edx
                 43: 9C 8F 45 20
                pushfl ; popl 32(%ebp)

viz, we do the decl, and then copy the real machine's %eflags into
%EFLAGS.  Unfortunately this copies the real carry flag into the
simulated one, rather than leaving the simulated one alone.

So the principle is that it's only safe to omit the initial
%EFLAGS->%eflags move prior to the insn if the insn writes _all_ the
flags, and in this case it doesn't.

(after further consideration ...)

At first it seems tempting to play games with subset checks, ie if an
insn writes a _subset_ of the flags, we'd better copy sim'd to real
flags before the insn.

Problem with that is that the D (direction) flag, which specifies the
direction that rep-prefix string ops travel, is part of the "normal"
flag set.  So it is conceivable, although highly unlikely, that an app
could

- set the D flag
- do something like   ADD (-wOSZACP)
- use the D flag

then we'd still have to do an %EFLAGS->%eflags copy prior to the ADD,
in order to ensure the simulated D flag is preserved.

So it seems to me that it's pretty much impossible to preserve
absolute correctness and do any better than the vg_from_ucode.c rev
1.8 scheme.

Backing out rev 1.9.  We can just as easily restore it from cvs if a
better solution is arrived at.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1185
2002-10-05 02:44:47 +00:00
Nicholas Nethercote
24e24c44aa wibbles
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1184
2002-10-04 15:30:48 +00:00
Nicholas Nethercote
0ec5897192 Factorised some egregiously repetitive code.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1183
2002-10-04 15:15:08 +00:00