39 Commits

Author SHA1 Message Date
Mark Wielaard
3392155359 Upgrade to GNU General Public License version 3
- Update COPYING and VEX/LICENSE.GPL to version 3.
- Update README, NEWS, docs/manual license and contributing text.
- Update file headers to say either version 3 of the License,
  or (at your option) any later version.
- Leave tests and perf file headers as is, unless the code is derived
  from Valgrind/VEX.
- Leave valgrind.h, cachegrind.h, callgrind.h, drd.h, helgrind.h,
  memcheck.h and dhat.h Hybrid-BSD licensed.
2025-10-18 00:55:07 +02:00
Paul Floyd
c1f6e5e64a Refactor: make try_get_interp extern and multi-plaftorm
Previously it was static and defined for Darwin, FreeBSD and Linux.
Now it is global VG_(args_the_exename)  and has a length check.

Also fixed a nasty bug related to VG_(args_the_exename).

Initially this is set to point to the name of the client command
in Valgrinds own arguments. Later when checking for scripts or binaries
VG_(load_script) may get called recursively. If it gets called more than
once it sets VG_(args_the_exename) to point to the new name.
But that is on the stack. Later, if the stack grows too much the
name will get overwritten. I was seeing that with my first versions
of this code in the recursive tests in none/tests/scripts.

Now I'm allocating VG_(args_the_exename) on the heap.
2025-09-21 17:08:35 +02:00
Paul Floyd
843fc19ccc Allow spaces in .valgrindrc files
The patch for m_commandline.c comes from the Debian package files.
Also add a regtest and allow --command-line-only=no to override
--command-line-only=yes
2023-08-27 09:35:03 +02:00
Julian Seward
9dcd3ab1f6 Fix some spelling errors found by Lintian. Patch from Alessandro Ghedini <ghedo@debian.org>. 2020-01-23 10:53:36 +01:00
Mark Wielaard
461cc5c003 Cleanup GPL header address notices by using http://www.gnu.org/licenses/
Sync VEX/LICENSE.GPL with top-level COPYING file. We used 3 different
addresses for writing to the FSF to receive a copy of the GPL. Replace
all different variants with an URL <http://www.gnu.org/licenses/>.

The following files might still have some slightly different (L)GPL
copyright notice because they were derived from other programs:

- files under coregrind/m_demangle which come from libiberty:
  cplus-dem.c, d-demangle.c, demangle.h, rust-demangle.c,
  safe-ctype.c and safe-ctype.h
- coregrind/m_demangle/dyn-string.[hc] derived from GCC.
- coregrind/m_demangle/ansidecl.h derived from glibc.
- VEX files for FMA detived from glibc:
  host_generic_maddf.h and host_generic_maddf.c
- files under coregrin/m_debuginfo derived from LZO:
  lzoconf.h, lzodefs.h, minilzo-inl.c and minilzo.h
- files under coregrind/m_gdbserver detived from GDB:
  gdb/signals.h, inferiors.c, regcache.c, regcache.h,
  regdef.h, remote-utils.c, server.c, server.h, signals.c,
  target.c, target.h and utils.c

Plus the following test files:

- none/tests/ppc32/testVMX.c derived from testVMX.
- ppc tests derived from QEMU: jm-insns.c, ppc64_helpers.h
  and test_isa_3_0.c
- tests derived from bzip2 (with embedded GPL text in code):
  hackedbz2.c, origin5-bz2.c, varinfo6.c
- tests detived from glibc: str_tester.c, pth_atfork1.c
- test detived from GCC libgomp: tc17_sembar.c
- performance tests derived from bzip2 or tinycc (with embedded GPL
  text in code): bz2.c, test_input_for_tinycc.c and tinycc.c
2019-05-26 20:07:51 +02:00
Ivo Raisr
3b12d0e199 Fix build problems on Solaris and OS X.
Follow up to SVN r16364.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16366
2017-05-12 01:37:33 +00:00
Ivo Raisr
bd0cb61cae Fix a problem when reading .valgrindrc and it is a directory instead of a file.
Fixes BZ#362223.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16364
2017-05-11 17:00:17 +00:00
Ivo Raisr
d8f648486e Fix some spelling mistakes.
Fixes BZ#374719
Patch by: klemens <ka7@la-evento.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16336
2017-05-05 22:13:20 +00:00
Ivo Raisr
38edd50c0e Update copyright end year to 2017 in preparation for 3.13 release.
n-i-bz



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16333
2017-05-04 15:09:39 +00:00
Mark Wielaard
be052139d6 Don't require the current working directory to exist. Bug #369209.
At startup valgrind fetches the current working directory and stashes
it away to be used later (in debug messages, read config files or create
log files). But if the current working directory didn't exist (or there
was some other error getting its path) then valgrind would go in an
endless loop. This was caused by assuming that any error meant a larger
buffer needed to be created to store the cwd path (ERANGE). However
there could be other reasons calling getcwd failed.

Fix this by only looping and resizing the buffer when the error is
ERANGE. Any other error just means we cannot fetch and store the current
working directory. Fix all callers to check get_startup_wd() returns
NULL. Only abort startup if a relative path needs to be used for
user supplied relative log files. Debug messages will just show
"<NO CWD>". And skip reading any config files from the startup_wd
if it doesn't exist.

Also add a new testcase that tests executing valgrind in a deep,
inaccessible and/or non-existing directory (none/tests/nocwd.vgtest).

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15989
2016-10-01 11:54:38 +00:00
Julian Seward
adc2dafee9 Update copyright dates, to include 2015. No functional change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15577
2015-08-21 11:32:26 +00:00
Florian Krohm
9a406c8279 Merge r14208 from BUF_REMOVAL branch to trunk.
In function read_dot_valgrindrc use a large enough buffer 
allocated on the stack. 
Also assert that the passed in directory is not NULL. This is 
true at all call sites. The old code would have attempted to read
/.valgrindrc for dir == NULL and I don't think we want that.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14580
2014-09-27 18:01:19 +00:00
Florian Krohm
76575e29cf Merge 14206,14207,14261,14577,14578 from BUF_REMOVAL branch to trunk.
This changes VG_(record_startup_wd) to dynamically allocate a large
enough buffer for the directory name. As the dynamic memory manager has
started up a while ago, this is quite safe. Also rewrite VG_(get_startup_wd)
to simply return the directory name. No more messing with copying it
around. Adapt call sites.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14579
2014-09-27 17:42:07 +00:00
Florian Krohm
c88dc7f039 Tidy up m_xarray.c.
VG_(newXA) and VG_(cloneXA) never return NULL. Remove pointless asserts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14539
2014-09-15 18:50:17 +00:00
Florian Krohm
33f32780a5 VG_(malloc/calloc/strdup) never return NULL (and never will).
So it's pointless to test or assert their return values.
Remove code doing so.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14528
2014-09-12 22:24:51 +00:00
Florian Krohm
d7cccf3f9f Make error message more precise.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14093
2014-06-24 13:08:44 +00:00
Julian Seward
dbf9b63605 Update copyright dates (20XY-2012 ==> 20XY-2013)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13658
2013-10-18 14:27:36 +00:00
Florian Krohm
af66466ce4 Changes to allow compilation with -Wwrite-strings. That compiler option
is not used for testcases, just for valgrind proper.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13137
2012-11-23 16:17:43 +00:00
Julian Seward
4a3633e266 Update copyright dates to include 2012.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12843
2012-08-05 15:46:46 +00:00
Julian Seward
c96096ab24 Update all copyright dates, from 20xy-2010 to 20xy-2011.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12206
2011-10-23 07:32:08 +00:00
Julian Seward
9b0574dff8 Update copyright dates to 2010.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11121
2010-05-03 21:37:12 +00:00
Julian Seward
e7dde85a24 Merge coregrind/ changes from branches/MESSAGING_TIDYUP r10464.
This commit tidies up and rationalises what could be called the
"messaging" system -- that part of V to do with presenting output to
the user.  In particular it brings significant improvements to XML
output.

Changes are:

* XML and normal text output now have separate file descriptors,
  which solves longstanding problems for XML consumers caused by
  the XML output getting polluted by unexpected non-XML output.

* This also means that we no longer have to hardwire all manner
  of output settings (verbosity, etc) when XML is requested.

* The XML output format has been revised, cleaned up, and made
  more suitable for use by error detecting tools in general
  (various Memcheck-specific features have been removed).  XML
  output is enabled for Ptrcheck and Helgrind, and Memcheck is
  updated to the new format.

* One side effect is that the behaviour of VG_(message) has been
  made to be consistent with printf: it no longer automatically
  adds a newline at the end of the output.  This means multiple
  calls to it can be used to build up a single line message; or a
  single call can write a multi-line message.  The ==pid==
  preamble is automatically inserted at each newline.

* VG_(message)(Vg_UserMsg, ..args..) now has the abbreviated form
  VG_(UMSG)(..args..); ditto VG_(DMSG) for Vg_DebugMsg and
  VG_(EMSG) for Vg_DebugExtraMsg.  A couple of other useful
  printf derivatives have been added to pub_tool_libcprint.h,
  most particularly VG_(vcbprintf).

* There's a small change in the core-tool interface to do with
  error handling: VG_(needs_tool_errors) has a new method
  void (*before_pp_Error)(Error* err)  which, if non-NULL, is
  called just before  void (*pp_Error)(Error* err).  This is to
  give tools the chance to look at errors before any part of them
  is printed, so they can print any XML preamble they like.

* coregrind/m_errormgr.c has been overhauled and cleaned up, and
  is a bit simpler and more commented.  In particular pp_Error
  and VG_(maybe_record_error) are significantly changed.

The diff is huge, but mostly very boring.  Most of the changes
are of the form

-   VG_(message)(Vg_UserMsg, "this is a message %d", n);
+   VG_(message)(Vg_UserMsg, "this is a message %d\n", n);

Unfortunately as a result of this, it touches a large number
of source files.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10465
2009-07-15 14:48:32 +00:00
Nicholas Nethercote
7f19e9cb79 Merge r9993, r9995 (comment changes about vg_stat) from the DARWIN branch,
and rename all the vg_stat fields to avoid problems that the old names cause
on Darwin.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9996
2009-05-20 02:02:30 +00:00
Nicholas Nethercote
131ab00744 Merged non-Darwin-specific parts of r9397,r9423,r9490, 9461, 9462 from the
DARWIN branch.  A big ugly DARWIN/trunk sync commit, mostly to do with
changing the representation of SysRes and vki_sigset_t.  Functionality of
the trunk shouldn't be changed by it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9876
2009-05-18 02:12:08 +00:00
Nicholas Nethercote
2001629c3f Updated copyright years.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9344
2009-03-10 22:02:09 +00:00
Dirk Mueller
706dd9fa67 ignore .valgrindrc files that are world writeable
or not owned by the current user (CVE-2008-4865)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8798
2008-11-22 12:03:19 +00:00
Julian Seward
335992d8fc Merge all remaining changes from branches/PTRCHECK. These are some
relatively minor extensions to m_debuginfo, a major overhaul of
m_debuginfo/readdwarf3.c to get its space usage under control, and
changes throughout the system to enable heap-use profiling.

The majority of the merged changes were committed into
branches/PTRCHECK as the following revs: 8591 8595 8598 8599 8601 and
8161.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8621
2008-09-18 18:12:50 +00:00
Julian Seward
e5150447d7 Presently, Valgrind (non-client) code that wants to use the stat
family of syscalls is impossible to write in a way that's portable and
correct.  On some targets (eg x86-linux) you need to do sys_stat64 and
receive the results in a 'struct vki_stat64'.  But on other targets
(eg amd64-linux) neither sys_stat64 nor 'struct vki_stat64' exist.

This commit adds a new type, 'struct vg_stat', which contains 64 bit
fields in all the right places, and makes VG_(stat) and VG_(fstat) use
it.  This means callers to the two functions no longer need to worry
about the is-it-64-bit-clean-or-not question, since these routines
reformat the received data into a'struct vg_stat'.  Kind of like what
glibc must have been doing for decades.

This (indirectly) fixes a bug on x86-linux, in which m_debuginfo would
sometimes fail to read debug info, due to VG_(di_notify_mmap) using
VG_(stat) (hence sys_stat) on the file, which failed, and when in fact
it should have used sys_stat64.  Bug reported and tracked down by
Marc-Oliver Straub.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8522
2008-08-19 07:03:04 +00:00
Julian Seward
5679a22410 Update copyright dates ("200X-2007" --> "200X-2008").
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7398
2008-02-11 11:34:59 +00:00
Julian Seward
32a6fb4fec Get rid of VG_(getcwd) and replace it with a pair of functions,
VG_(record_startup_wd) which records the working directory at startup,
and VG_(get_startup_wd) which later tells you what value was recorded.
This works because all uses of VG_(getcwd) serve only to record the
directory at process start anyway.  The motivation is that AIX does
not support sys_getcwd directly, so it's easier for the launcher to
ship in the required value using an environment variable.  On Linux
sys_getcwd is used as before.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6764
2007-07-09 23:13:07 +00:00
Nicholas Nethercote
39c78c7e8b Fix 142488: don't read ./.valgrindrc if CWD==HOME.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6665
2007-03-26 22:05:30 +00:00
Julian Seward
0a28307fca VG_(addToXA): return index in the array where the item was added.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6619
2007-02-27 16:40:53 +00:00
Julian Seward
b7302d9258 Get rid of the type XArrayStrings in m_clientstate and use new generic
equivalents in module m_xarray instead.  A suprisingly pervasive
change.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6616
2007-02-25 15:08:24 +00:00
Julian Seward
172505c978 Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6488
2007-01-08 06:01:59 +00:00
Julian Seward
abce15a799 Only read $HOME/.valgrindrc if HOME is actually set.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6380
2006-12-06 17:38:32 +00:00
Julian Seward
12ef34f623 Track SysRes change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6294
2006-10-17 02:15:17 +00:00
Julian Seward
ae8215b3ac Create a new module, m_vki, and move all knowledge about the kernel
interface, except for the syscall numbers, into that.  Mostly this
means moving include/vki-*.h to include/vki/vki-*.h.

include/pub_tool_basics.h previously dragged in the entire kernel
interface.  I've done away with that, so that modules which need to
see the kernel interface now have to include pub_{core,tool}_vki.h
explicitly.  This is why there are many modified .c files -- they have
all acquired an extra #include line.

This certainly breaks all platforms except x86.  Will fix shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6225
2006-10-14 19:26:10 +00:00
Julian Seward
ad67fd79fe Update copyright dates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5954
2006-06-05 23:21:15 +00:00
Julian Seward
cc8ccbbfb4 This commit merges in changes from branches/ASPACEM (specifically,
changes from r4341 through r4787 inclusive).  That branch is now dead.
Please do not commit anything else to it.

For the most part the merge was not troublesome.  The main areas of
uncertainty are:

- build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am
  and include it in a couple of places.  Building etc seems to still
  work, but I haven't tried building the documentation.

- syscall wrappers: Following analysis by Greg & Nick, a whole lot of
  stuff was moved from -generic to -linux after the branch was created.
  I think that is satisfactorily glued back together now.

- Regtests: although this appears to work, no .out files appear, which
  is strange, and makes it hard to diagnose regtest failures.  In
  particular memcheck/tests/x86/scalar.stderr.exp remains in a 
  conflicted state.

- amd64 is broken (slightly), and ppc32 will be unbuildable.  I'll
  attend to the former shortly.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789
2005-09-27 19:20:21 +00:00