sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 1 | |
| 2 | 1 July 2002 |
| 3 | |
| 4 | Greetings, packaging person! This information is aimed at people |
| 5 | building binary distributions of Valgrind. |
| 6 | |
| 7 | Thanks for taking the time and effort to make a binary distribution |
| 8 | of Valgrind. The following notes may save you some trouble. |
| 9 | |
| 10 | |
| 11 | -- (Unfortunate but true) When you configure to build with the |
| 12 | --prefix=/foo/bar/xyzzy option, the prefix /foo/bar/xyzzy gets |
| 13 | baked into valgrind.so. The consequence is that you _must_ install |
| 14 | valgrind at the location specified in the prefix. If you don't, |
| 15 | it may appear to work, but will break doing some obscure things, |
| 16 | particularly doing fork() and exec(). |
| 17 | |
| 18 | So you can't build a relocatable RPM / whatever from Valgrind. |
| 19 | |
| 20 | |
| 21 | -- Don't strip the debug info off valgrind.so or libpthread.so. |
| 22 | Valgrind will still work if you do, but it will generate less |
| 23 | helpful error messages. Here's an example: |
| 24 | |
| 25 | Mismatched free() / delete / delete [] |
| 26 | at 0x40043249: free (vg_clientfuncs.c:171) |
| 27 | by 0x4102BB4E: QGArray::~QGArray(void) (tools/qgarray.cpp:149) |
| 28 | by 0x4C261C41: PptDoc::~PptDoc(void) (include/qmemarray.h:60) |
| 29 | by 0x4C261F0E: PptXml::~PptXml(void) (pptxml.cc:44) |
| 30 | Address 0x4BB292A8 is 0 bytes inside a block of size 64 alloc'd |
| 31 | at 0x4004318C: __builtin_vec_new (vg_clientfuncs.c:152) |
| 32 | by 0x4C21BC15: KLaola::readSBStream(int) const (klaola.cc:314) |
| 33 | by 0x4C21C155: KLaola::stream(KLaola::OLENode const *) (klaola.cc:416) |
| 34 | by 0x4C21788F: OLEFilter::convert(QCString const &) (olefilter.cc:272) |
| 35 | |
| 36 | This tells you that some memory allocated with new[] was freed with |
| 37 | free(). If valgrind.so was stripped the message would look like |
| 38 | this: |
| 39 | |
| 40 | Mismatched free() / delete / delete [] |
| 41 | at 0x40043249: (inside valgrind.so) |
| 42 | by 0x4102BB4E: QGArray::~QGArray(void) (tools/qgarray.cpp:149) |
| 43 | by 0x4C261C41: PptDoc::~PptDoc(void) (include/qmemarray.h:60) |
| 44 | by 0x4C261F0E: PptXml::~PptXml(void) (pptxml.cc:44) |
| 45 | Address 0x4BB292A8 is 0 bytes inside a block of size 64 alloc'd |
| 46 | at 0x4004318C: (inside valgrind.so) |
| 47 | by 0x4C21BC15: KLaola::readSBStream(int) const (klaola.cc:314) |
| 48 | by 0x4C21C155: KLaola::stream(KLaola::OLENode const *) (klaola.cc:416) |
| 49 | by 0x4C21788F: OLEFilter::convert(QCString const &) (olefilter.cc:272) |
| 50 | |
| 51 | This isn't so helpful. Although you can tell there is a mismatch, |
| 52 | the names of the allocating and deallocating functions are no longer |
| 53 | visible. The same kind of thing occurs in various other messages |
| 54 | from valgrind. |
| 55 | |
| 56 | |
sewardj | 21be1e3 | 2002-07-01 10:59:17 +0000 | [diff] [blame] | 57 | -- Try and ensure that the /usr/include/asm/unistd.h file on the |
| 58 | build machine contains an entry for all the system calls that |
| 59 | the kernels on the target machines can actually support. On my |
| 60 | Red Hat 7.2 (kernel 2.4.9) box the highest-numbered entry is |
| 61 | #define __NR_fcntl64 221 |
| 62 | but I have heard of 2.2 boxes where it stops at 179 or so. |
| 63 | |
| 64 | Reason for this is that at build time, support for syscalls |
| 65 | is compiled in -- or not -- depending on which of these __NR_* |
| 66 | symbols is defined. Problems arise when /usr/include/asm/unistd.h |
| 67 | fails to give an entry for a system call which is actually |
| 68 | available in the target kernel. In that case, valgrind will |
| 69 | abort if asked to handle such a syscall. This is despite the |
| 70 | fact that (usually) valgrind's sources actually contain the |
| 71 | code to deal with the syscall. |
| 72 | |
| 73 | Several people have reported having this problem. So, please |
| 74 | be aware of it. If it's useful, the syscall wrappers are |
| 75 | all done in vg_syscall_mem.c; you might want to have a little |
| 76 | look in there. |
| 77 | |
| 78 | |
sewardj | 83abe43 | 2002-07-01 08:46:27 +0000 | [diff] [blame] | 79 | -- Please test the final installation works by running it on |
| 80 | something huge. I suggest checking that it can start and |
| 81 | exit successfully both Mozilla-1.0 and OpenOffice.org 1.0. |
| 82 | I use these as test programs, and I know they fairly thoroughly |
| 83 | exercise Valgrind. The command lines to use are: |
| 84 | |
| 85 | valgrind -v --trace-children=yes --workaround-gcc296-bugs=yes mozilla |
| 86 | |
| 87 | valgrind -v --trace-children=yes --workaround-gcc296-bugs=yes soffice |
| 88 | |
| 89 | |
| 90 | If you find any more hints/tips for packaging, please let me know |
| 91 | (jseward@acm.org). Thanks. |