747 Commits

Author SHA1 Message Date
Mark Wielaard
f32cc294e3 Propagate memory allocation failure to out_of_memory_NORETURN
Provide the user with a hint of what caused an out of memory error.
And explain that some memory policies, like selinux deny_execmem
might cause Permission denied errors.

Add an err argument to out_of_memory_NORETURN. And change
am_shadow_alloc to return a SysRes (all three callers were already
checking for errors and calling out_of_memory_NORETURN).
2023-03-31 01:31:25 +02:00
Paul Floyd
50bded71b2 Bug 436413 - Warn about realloc of size zero
Adds a new warning to memcheck when realloc is used with a size of 0.
For a long time this has been "implementation defined" and so
non-portable. With C23 it will become UB.

Also adds a switch to turn off the error generation and a
second switch to select between the most common
"implementation" behaviours. The defaults for this second
switch are baked in at build time.
2023-03-10 21:55:14 +01:00
Paul Floyd
189ea2bf9e Remove unused helgrind expected
I don't think that this can match any more.
2023-02-28 21:52:54 +01:00
Paul Floyd
cbba7f699a Regtest: broaden suppression for helgrind bug 392331
Inlining differences on different Linux platforms.
2023-01-27 20:00:26 +01:00
Paul Floyd
57c1641d04 Linux regtest: some extra filtering for helgrind bug392331
Was failing on rhel 7.6
2023-01-27 08:22:19 +01:00
Paul Floyd
1cea0e151b Cleanup of warnings, mostly -Wno-unused-but-set-variable 2023-01-08 17:51:37 +01:00
Philippe Waroquiers
39a063513c Implement front end GDB commands for Valgrind gdbserver monitor commands.
This commit implements in python a set of GDB commands corresponding to the
Valgrind gdbserver monitor commands.

Basically, the idea is that one GDB command is defined for each valgrind
gdbserver subcommand and will generate and send a monitor command to valgrind.

The python code is auto-loaded by GDB as soon as GDB observes that the valgrind
preload core shared lib is loaded (e.g. vgpreload_core-amd64-linux.so).
This automatic loading is done thanks to the .debug_gdb_scripts section
added in vg_preloaded.c file.

Sadly, the auto-load only happens once valgrind has started to execute the code
of ld that loads this vg_preload file.

I have tried 2 approaches to have the python code auto-loaded when attaching at
startup to valgrind:
  * have valgrind gdbserver reporting first to GDB that the executable file is
    the tool executable (with a .debug_gdb_scripts section) and then reporting
    the real (guest) executable file.
    The drawback of this approach is that it triggers a warning/question in GDB
    according to the GDB setting 'set exec-file-mismatch'.
  * have valgrind gdbserver pretending to be multiprocess enabled, and report
    a fake process using the tool executable with a .debug_gdb_scripts section.
    The drawback of this is that this always creates a second inferior in GDB,
    which will be confusing.

Possibly, we might complete the below message :
  ==2984378== (action at startup) vgdb me ...
  ==2984378==
  ==2984378== TO DEBUG THIS PROCESS USING GDB: start GDB like this
  ==2984378==   /path/to/gdb /home/philippe/valgrind/littleprogs/some_mem
  ==2984378== and then give GDB the following command
  ==2984378==   target remote | /home/philippe/valgrind/git/improve/Inst/libexec/valgrind/../../bin/vgdb --pid=2984378
  ==2984378== --pid is optional if only one valgrind process is running

with:
  ==2984378== GDB valgrind python specific commands will be auto-loaded when execution begins.
  ==2984378== Alternatively, you might load it before with the GDB command:
  ==2984378==   source /abs/path/to/valgrind/install/libexec/valgrind/valgrind-monitor.py

The following GDB setting traces the monitor commands sent by a GDB valgrind
command to the valgrind gdbserver:
  set debug valgrind-execute-monitor on

How to use the new GDB valgrind commands?
-----------------------------------------

The usage of the GDB front end commands is compatible with the
monitor command as accepted today by Valgrind.

For example, the memcheck monitor command "xb' has the following usage:
 xb <addr> [<len>]

With some piece of code:
   'char some_mem [5];'
xb can be used the following way:
  (gdb) print &some_mem
  (gdb) $2 = (char (*)[5]) 0x1ffefffe8b
  (gdb) monitor xb 0x1ffefffe8b 5
  		    ff	  ff	  ff	  ff	  ff
  0x4A43040:	  0x00	0x00	0x00	0x00	0x00
  (gdb)

The same action can be done with the new GDB 'memcheck xb' command:
  (gdb) memcheck xb 0x1ffefffe8b 5
  		    ff	  ff	  ff	  ff	  ff
  0x1FFEFFFE8B:	  0x00	0x00	0x00	0x00	0x00
  (gdb)

At this point, you might ask yourself: "what is the interest ?".

Using GDB valgrind commands provides several advantages compared to
the valgrind gdbserver monitor commands.

Evaluation of arguments by GDB:
-------------------------------
For relevant arguments, the GDB command will evaluate its arguments using
the usual GDB evaluation logic, for example, instead of printing/copying
the address and size of 'some_mem', the following will work:
  (gdb) memcheck xb &some_mem sizeof(some_mem)
  		    ff	  ff	  ff	  ff	  ff
  0x1FFEFFFE8B:	  0x00	0x00	0x00	0x00	0x00
  (gdb)

or:
  (gdb) p some_mem
  $4 = "\000\000\000\000"
  (gdb) memcheck xb &$4
  		    ff	  ff	  ff	  ff	  ff
  0x1FFEFFFE8B:	  0x00	0x00	0x00	0x00	0x00
  (gdb)

This is both easier to use interactively and easier to use in GDB scripts,
as you can directly use variable names in the GDB valgrind commands.

Command completion by GDB:
--------------------------
The usual command completion in GDB will work for the GDB valgrind commands.
For example, typing TAB after the letter 'l' in:
  (gdb) valgrind v.info l
will show the 2 "valgrind v.info" subcommands:
  last_error  location
  (gdb) valgrind v.info l

Note that as usual, GDB will recognise a command as soon as it is unambiguous.

Usual help and apropos support by GDB:
--------------------------------------
The Valgrind gdbserver provides an online help using:
  (gdb) monitor help
However, this gives the help for all monitor commands, and is not searchable.
GDB provides a better help and documentation search.
For example, the following commands can be used to get various help
or search the GDB Valgrind command online documentation:
   help valgrind
   help memcheck
   help helgrind
   help callgrind
   help massif
to get help about the general valgrind commands or the tool specific commands.

Examples of searching the online documentation:
  apropos valgrind.*location
  apropos -v validity
  apropos -v leak

User can define aliases for the valgrind commands:
--------------------------------------------------
The following aliases are predefined:
  v and vg for valgrind
  mc for memcheck
  hg for helgrind
  cg for callgrind
  ms for massif

So, the following will be equivalent:
   (gdb) valgrind v.info location &some_mem
   (gdb) v v.i lo &some_mem
   (gdb) alias Vl = valgrind v.info location
   (gdb) Vl &some_mem

Thanks to Hassan El Karouni for the help in factorising the python
code common to all valgrind python commands using a decorator.
2023-01-08 16:00:57 +01:00
Paul Floyd
74e2000746 Bug 327548 - false positive while destroying mutex 2023-01-03 21:28:42 +01:00
Paul Floyd
5cfb0173ed Add DRD shared_timed_mutex to Helgrind
This uses pthread_rwlock_timedrdlock / pthread_rwlock_timedwrlock
(see commit 6ffb70e650ee7cf4ada829557dd30ababb09e078)
2022-12-29 22:21:03 +01:00
Paul Floyd
d7c93d1f71 Add a variation of the Helgrind tls_threads test
This version uses GLIBC_TUNABLES in the environment so it checks
that glibc.pthread.stack_cache_size can be detected and modified.
2022-12-29 22:08:14 +01:00
Paul Floyd
6ffb70e650 Bug 400793 - pthread_rwlock_timedwrlock false positive
Add Helgrind intercepts for pthread_rwlock_timedwrlock
(and pthread_rwlock_timedrdlock)

Reuse the DRD trylock test
2022-12-29 22:02:47 +01:00
Philippe Waroquiers
a5b88a02d5 Add a test for helgrind --history-backtrace-size
Extend hg04_race to have more entries in the conflicting stacktrace,
and make another test hg04_race_h9 to test with one more entry than
the default of 8.
2022-12-29 16:19:24 +01:00
Philippe Waroquiers
29252c77bb Add clo option the nr of entries in helgrind --history-level=full stack traces
The number of such entries was hardcoded to 8.
A new command line option -history-backtrace-size=number allows
to set the (max) number of entries to record.

Note that according
  perl perf/vg_perf --tools=helgrind --vg=. --vg=../trunk_untouched perf
this change (unexpectedly) improves some tests:
    - Running  tests in perf ----------------------------------------------
    -- bigcode1 --
    bigcode1 .         :0.08s  he: 2.0s (25.5x, -----)
    bigcode1 trunk_untouched:0.08s  he: 2.1s (25.9x, -1.5%)
    -- bigcode2 --
    bigcode2 .         :0.08s  he: 4.2s (52.2x, -----)
    bigcode2 trunk_untouched:0.08s  he: 4.2s (52.0x,  0.5%)
    -- bz2 --
    bz2      .         :0.40s  he: 6.5s (16.3x, -----)
    bz2      trunk_untouched:0.40s  he: 7.4s (18.5x,-14.0%)
    -- fbench --
    fbench   .         :0.15s  he: 2.0s (13.2x, -----)
    fbench   trunk_untouched:0.15s  he: 2.3s (15.5x,-17.7%)
    -- ffbench --
    ffbench  .         :0.16s  he: 3.7s (23.2x, -----)
    ffbench  trunk_untouched:0.16s  he: 3.7s (23.4x, -0.8%)
    -- heap --
    heap     .         :0.05s  he: 5.1s (102.8x, -----)
    heap     trunk_untouched:0.05s  he: 5.2s (104.6x, -1.8%)
    -- heap_pdb4 --
    heap_pdb4 .         :0.07s  he: 5.8s (82.9x, -----)
    heap_pdb4 trunk_untouched:0.07s  he: 5.8s (83.3x, -0.5%)
    -- many-loss-records --
    many-loss-records .         :0.01s  he: 1.0s (96.0x, -----)
    many-loss-records trunk_untouched:0.01s  he: 0.9s (95.0x,  1.0%)
    -- many-xpts --
    many-xpts .         :0.04s  he: 1.6s (38.8x, -----)
    many-xpts trunk_untouched:0.04s  he: 1.5s (38.5x,  0.6%)
    -- memrw --
    memrw    .         :0.06s  he: 2.5s (41.2x, -----)
    memrw    trunk_untouched:0.06s  he: 2.5s (41.2x,  0.0%)
    -- sarp --
    sarp     .         :0.02s  he: 4.0s (198.0x, -----)
    sarp     trunk_untouched:0.02s  he: 3.9s (196.5x,  0.8%)
    -- tinycc --
    tinycc   .         :0.10s  he: 7.1s (70.7x, -----)
    tinycc   trunk_untouched:0.10s  he: 7.6s (75.8x, -7.2%)
    -- Finished tests in perf ----------------------------------------------

    == 12 programs, 24 timings =================
2022-12-29 11:14:05 +01:00
Paul Floyd
4dcfc05c20 Fixes related to Bug 392331
1. Added C++17 check to configure.ac
2. Needed Linux version of suppression
3. Added a filter for pthread_cond_signal
2022-12-26 09:04:17 +01:00
Paul Floyd
67bb7eeec9 Fix suppression file inconsistency from previous commit for Bug 392331 2022-12-25 22:31:55 +01:00
Paul Floyd
7d0389956e Bug 392331 - Spurious lock not held error from inside pthread_cond_timedwait
Added a "Dubious" error category to cover this kind of error.
2022-12-25 21:43:36 +01:00
Paul Floyd
68ac5ca0ea Fix building on macOS
Adds a feature check for clockid_t

Also fix a typo in a macro affecting pthread_mutex_clocklock on Linux.
2022-04-11 22:32:45 +02:00
Mark Wielaard
7b5867b1fd helgrind reports false races for printfs using mempcpy on FILE* state
We already have a suppression for helgrind which is for when glibc
uses __GI_mempcpy to manipulate internal FILE state (this was bug
352130). But since glibc-2.26 mempcpy is used instead __GI_mempcpy,
making the suppresion from the original bug obsolete.

This patch adds a new suppression using mempcpy but doesn't replace
the original suppression for older systems.

Patch adding suppression + testcase by Jesus Checa <jcheca@redhat.com>

https://bugs.kde.org/show_bug.cgi?id=450962
2022-04-08 14:58:38 +02:00
Paul Floyd
e74872ded8 Fix compiler warnings on non-Linux platforms.
The new clock pthread APIs are not yet implemented on other platforms.
So make them Linux-only for the moment.

The DRD macros that instantiate the wrappers apply to all OSes so
there is no compiler warning there.
2021-12-04 12:34:18 +01:00
Paul Floyd
c2607e093c Bug 446139 DRD/Helgrind with std::shared_timed_mutex::try_lock_until and try_lock_shared_until false positives
also
Bug 446138 DRD/Helgrind with std::timed_mutex::try_lock_until false positives
2021-12-02 00:03:27 +01:00
Paul Floyd
e484eee0bd Bug 445300 [PATCH] Fix building tests with Musl
Patch contributed by
   Alyssa Ross <hi@alyssa.is>
2021-11-22 08:42:53 +01:00
Paul Floyd
9abfed23c0 Bug 445504 Using C++ condition_variable results in bogus "mutex is locked simultaneously by two threads" warning(edit)
Add intercepts for pthread_cond_clockwait to DRD and Helgrind
Also testcase from bugzilla done by Bart, with configure check
2021-11-19 08:34:53 +01:00
Paul Floyd
8c0f72667e Fix the ramaining easily fixable warnings with clang
There's one remaining
memalign2.c:29:9: warning: unused variable 'piece' [-Wunused-variable]
because of a block of #if FreeBSD for memalign that looks unnecessary

Otherwise all that is left is a few like

warning: unknown warning option '-Wno-alloc-size-larger-than'; did you mean '-Wno-frame-larger-than='? [-Wunknown-warning-option]

because there is no standard for compiler arguments.
2021-10-10 21:56:49 +02:00
Paul Floyd
d187106a76 Updating a few expecteds based on valgrind-testresults
I tried to work out what the expecteds should be based on the changes to
the testcase source so there may be a bit more to do.
2021-10-10 12:03:38 +02:00
Paul Floyd
85bbe2853e FreeBSD support, patch 5
drd and helgrind tests
2021-10-07 21:33:45 +02:00
Paul Floyd
e207312100 FreeBSD support, patch 5
helgrind code
Mainly intercepts and changes to conditional compilation
2021-10-06 22:17:18 +02:00
Paul Floyd
e42badd060 Bug 388787 - Support for C++17 new/delete
These over-aligned new and delete operators were added in C++ 17.
2021-03-02 13:32:22 +01:00
Paul Floyd
d2d54dbcc7 Bug 428909 - helgrind: need to intercept duplicate libc definitions for Fedora 33 2020-12-04 10:11:55 +01:00
Mark Wielaard
79818bf9a5 helgrind: If hg_cli__realloc fails, return NULL.
helgrind would not handle a failing realloc correctly and assume
cli_malloc would always succeed. If cli_malloc fails in hg_cli__realloc
do like dh and massif and fail the realloc call by returning NULL.
2020-06-08 13:24:54 +02:00
Mark Wielaard
de93a35139 Make Execution Trees references available in both manual and man pages.
Both the manual and the man pages reference xtrees. Create some shared
entities so both can reference the section.
2020-05-14 17:50:52 +02:00
Mark Wielaard
555ddc4753 Use DTD DocBook XML V4.5 everywhere.
This makes the rule for xmllint easier since it doesn't need to
override the DTD to validate against. It also helps with other tools
tryinf to process the docbookx xml files.
2020-05-14 15:12:02 +02:00
Mark Wielaard
8e40553f72 hg-manual.xml: listitems contain paras, not CDATA. 2020-05-13 15:26:53 +02:00
Aleksandar Rikalo
6f84421546 mips: fix helgrind/tests/annotate_hbefore for nanoMIPS
Implement do_acasW() function for nanoMIPS.
2020-04-17 18:38:11 +00:00
Julian Seward
40187fcd61 Remove the exp-sgcheck tool.
It only ever worked on x86 and amd64, and even on those it had a high false
positive rate and was slow.  Everything it does, ASan can do faster, better,
and on more architectures.  So there's no reason to keep this tool any more.
2020-04-17 19:25:32 +02:00
Julian Seward
56e04256a7 Rationalise --vex-guest* flags in the new IRSB construction framework
* removes --vex-guest-chase-cond=no|yes.  This was never used in practice.

* rename --vex-guest-chase-thresh=<0..99> to --vex-guest-chase=no|yes.  In
  otherwords, downgrade it from a numeric flag to a boolean one, that can
  simply disable all chasing if required.  (Some tools, notably Callgrind,
  force-disable block chasing, so this functionality at least needs to be
  retained).
2020-01-02 06:42:21 +01:00
Petar Jovanovic
192c1673c7 mips: update tests to compile for nanoMIPS
Update the tests so they can be compiled for nanoMIPS.

Patch by Dimitrije Nikolic and Aleksandra Karadzic.
2019-12-31 15:56:23 +00:00
Philippe Waroquiers
3a803036f7 Allow the user to change a set of command line options during execution.
This patch changes the option parsing framework to allow a set of
core or tool (currently only memcheck) options to be changed dynamically.

Here is a summary of the new functionality (extracted from NEWS):
* It is now possible to dynamically change the value of many command
  line options while your program (or its children) are running under
  Valgrind.
  To have the list of dynamically changeable options, run
     valgrind --help-dyn-options
  You can change the options from the shell by using vgdb to launch
  the monitor command "v.clo <clo option>...".
  The same monitor command can be used from a gdb connected
  to the valgrind gdbserver.
  Your program can also change the dynamically changeable options using
  the client request VALGRIND_CLO_CHANGE(option).

Here is a brief description of the code changes.
* the command line options parsing macros are now checking a 'parsing' mode
  to decide if the given option must be handled or not.
  (more about the parsing mode below).

* the 'main' command option parsing code has been split in a function
  'process_option' that can be called now by:
     - early_process_cmd_line_options
        (looping over args, calling process_option in mode "Early")
     - main_process_cmd_line_options
        (looping over args, calling process_option in mode "Processing")
     - the new function VG_(process_dynamic_option) called from
       gdbserver or from VALGRIND_CLO_CHANGE (calling
        process_option in mode "Dynamic" or "Help")

* So, now, during startup, process_option is called twice for each arg:
   - once during Early phase
   - once during normal Processing
  Then process_option can then be called again during execution.

So, the parsing mode is defined so that the option parsing code
behaves differently (e.g. allows or not to handle the option)
depending on the mode.

// Command line option parsing happens in the following modes:
//   cloE : Early processing, used by coregrind m_main.c to parse the
//      command line  options that must be handled early on.
//   cloP : Processing,  used by coregrind and tools during startup, when
//      doing command line options Processing.
//   clodD : Dynamic, used to dynamically change options after startup.
//      A subset of the command line options can be changed dynamically
//      after startup.
//   cloH : Help, special mode to produce the list of dynamically changeable
//      options for --help-dyn-options.
typedef
   enum {
      cloE = 1,
      cloP = 2,
      cloD = 4,
      cloH = 8
   } Clo_Mode;

The option parsing macros in pub_tool_options.h have now all a new variant
*_CLOM with the mode(s) in which the given option is accepted.
The old variant is kept and calls the new variant with mode cloP.
The function VG_(check_clom) in the macro compares the current mode
with the modes allowed for the option, and returns True if qq_arg
should be further processed.

For example:

// String argument, eg. --foo=yes or --foo=no
   (VG_(check_clom)                                                     \
    (qq_mode, qq_arg, qq_option,                                        \
     VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) &&      \
    ({const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ];         \
      if      VG_STREQ(val, "yes") (qq_var) = True;                     \
      else if VG_STREQ(val, "no")  (qq_var) = False;                    \
      else VG_(fmsg_bad_option)(qq_arg, "Invalid boolean value '%s'"    \
                                " (should be 'yes' or 'no')\n", val);   \
      True; }))

   VG_BOOL_CLOM(cloP, qq_arg, qq_option, qq_var)

To make an option dynamically excutable, it is typically enough to replace
    VG_BOOL_CLO(...)
by
    VG_BOOL_CLOM(cloPD, ...)

For example:
-   else if VG_BOOL_CLO(arg, "--show-possibly-lost", tmp_show) {
+   else if VG_BOOL_CLOM(cloPD, arg, "--show-possibly-lost", tmp_show) {

cloPD means the option value is set/changed during the main command
Processing (P) and Dynamically during execution (D).

Note that the 'body/further processing' of a command is only executed when
the option is recognised and the current parsing mode is ok for this option.
2019-08-31 14:41:10 +02: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
Petar Jovanovic
d6da48fe5a mips: use local labels for do_acasW()
use local labels for do_acasW() to avoid defining symbols multiple times
when the function gets inlined.

It fixes assembler error reported in KDE #400164.
2019-03-25 19:53:21 +01:00
Julian Seward
dee1c5ac84 Fix format string warnings from gcc9. No functional change (I think!) 2019-02-02 14:06:51 +01:00
Philippe Waroquiers
cfae4f70a6 Modify .exp files following the new error message.
Change:
For counts of detected and suppressed errors, rerun with: -v
to
For lists of detected and suppressed errors, rerun with: -s
2018-12-28 19:33:00 +01:00
Philippe Waroquiers
d680f66465 Implement option --show-error-list=no|yes -s
This option allows to list the detected errors and show the used
suppressions without increasing the verbosity.
Increasing the verbosity also activates a lot of messages that
are often not very useful for the user.
So, this option allows to see the list of errors and used suppressions
independently of the verbosity.

Note if a high verbosity is selected, the behaviour is unchanged.
In other words, when specifying -v, the list of detected errors
and the used suppressions are still shown, even if
--show-error-list=yes and -s are not used.
2018-12-28 19:32:53 +01:00
Philippe Waroquiers
36bf7c0647 Factorize producing the 'For counts of detected and suppressed errors' msg
Each tool producing errors had identical code to produce this msg.
Factorize the production of the message in m_main.c

This prepares the work to have a specific option to show the list
of detected errors and the count of suppressed errors.

This has a (small) visible effect on the output of memcheck:
Instead of producing
  For counts of detected and suppressed errors, rerun with: -v
  Use --track-origins=yes to see where uninitialised values come from
memcheck now produces:
  Use --track-origins=yes to see where uninitialised values come from
  For counts of detected and suppressed errors, rerun with: -v

i.e. the track origin and counts of errors msg are inverted.
2018-12-23 23:45:33 +01:00
Petar Jovanovic
b99acd0ad8 mips32: fix broken inline asm in helgrind/tests/tc08_hbl2.c
Remove the duplicated L1xyzzy1main, and use local symbol to replace.

This fixes KDE #396906.

Patch by Hongxu Jia <hongxu.jia@windriver.com>
2018-09-04 21:20:39 +00:00
Petar Jovanovic
925414b384 fix make distclean failure
commit 85cd72c0a80d64ddbfd3156743037925bb7f8f5f
"Add the drd/tests/bug322621 regression test"

introduced make distclean failure.
Fix it by using symlink instead of a relative path in
drd/tests/Makefile.

Also, revert "ignore .dirstamp file appearing in helgrind/tests directory"
This reverts commit 718b47e184bc090b9f2a5f22904f59a272c9018d.
2018-06-15 13:44:14 +00:00
Petar Jovanovic
58c1c98db4 mips64: update tests for N32 ABI
Fix n32/n64 types mismatch in none, memcheck and helgrind tests.

BZ issue - #345763.

Contributed by:
  Dimitrije Nikolic, Aleksandar Rikalo, Tamara Vlahovic.
2018-06-14 17:40:08 +00:00
Rhys Kidd
3b862b1cbb helgrind: properly condition test for bug322621 upon pthread_barrier support
Fixes: 9cf3d01 ("Add the helgrind/tests/bug322621 regression test")
2018-03-28 20:55:43 -04:00
Philippe Waroquiers
ab773096df Fix 338252 - building valgrind with -flto (link time optimisation) fails
* Addition of a new configure option --enable-lto=yes or --enable-lto=no
  Default value is --enable-lto=no, as the build is significantly slower,
  so is not appropriate for valgrind development : this should be used
  only on buildbots and/or by packagers.

* Some files containins asm functions have to be compiled without lto:
    coregrind/m_libcsetjmp.c
    coregrind/m_main.c
  If these are compiled with lto, that gives undefined symbols at link time.
  The files to compile without lto are
    coregrind/m_libcsetjmp.c
    coregrind/m_main.c

  To compile these files with other options, a noinst target lib is defined.
  The objects of this library are then added to the libcoregrind.

* memcheck/mc_main.c : move the handwritten asm helpers to mc_main_asm.c.
  This avoids undefined symbols on some toolchains. Due to this,
  the preprocessor symbols that activate the fast or asm memcheck helpers
  are moved to mc_include.h
  Platforms with handwritten helpers will also have the memcheck primary
  map defined non static.

* In VEX, auxprogs/genoffsets.c also has to be compiled without lto,
  as the asm produced by the compiler is post-processed to produce
  pub/libvex_guest_offsets.h. lto not producing asm means the generation
  fails if we used -flto to compile this file.

* all the various Makefile*am are modified to use LTO_CFLAGS for
  (most) targets. LTO_CFLAGS is empty when --enable-lto=no,
  otherwise is set to the flags needed for gcc.
  If --enable-lto=no, LTO_AR and LTO_RANLIB are the standard AR and RANLIB,
  otherwise they are the lto capable versions (gcc-ar and gcc-ranlib).

* This has been tested on:
    debian 9.4/gcc 6.3.0/amd64+x86
    rhel 7.4/gcc 6.4.0/amd64
    ubuntu 17.10/gcc 7.2.0/amd64+x86
    fedora26/gcc 7.3.1/s390x

  No regressions on the above.
2018-03-18 13:53:38 +01:00
Bart Van Assche
9cf3d0193d Add the helgrind/tests/bug322621 regression test 2018-03-17 21:32:56 -07:00
Julian Seward
cceed053ce Bug 79362 - Debug info is lost for .so files when they are dlclose'd. Majorly reworked by Philippe Waroquiers. 2018-01-11 19:40:12 +01:00