434 Commits

Author SHA1 Message Date
Philippe Waroquiers
9b67d18f11 Improve address description for address in the stack.
--read-var-info=yes is very memory and cpu intensive.
This patch ensures that even witout --read-var-info=yes that
the frame where the address point is reported in the address
description.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13991
2014-05-22 23:48:24 +00:00
Julian Seward
32adfb9026 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13989
2014-05-21 20:23:43 +00:00
Carl Love
2548eee443 Forgot to update NEWS file with bugzilla 335155 fix.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13988
2014-05-21 19:33:57 +00:00
Bart Van Assche
af88283a6d NEWS: Add #333072
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13985
2014-05-18 19:33:39 +00:00
Philippe Waroquiers
ab71852280 Fix 334788 clarify doc about --log-file initial program directory
Behaviour is kept unchanged, a paragraph is added in the doc to
clarify.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13979
2014-05-17 05:50:46 +00:00
Mark Wielaard
a1513e0348 Revert "Tools should explain why an option is bad when using fmsg_bad_option."
This reverts valgrind svn r13975. This was a work in progress, still being
discussed in bug #334802. It should not yet been pushed.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13978
2014-05-16 22:38:46 +00:00
Mark Wielaard
1418e68e22 Tools should explain why an option is bad when using fmsg_bad_option.
Add an explanation of why an option was bad to fmsg_bad_option calls that
were just using "" as argument. Fixes bug #334802.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13975
2014-05-16 22:28:42 +00:00
Julian Seward
b0e2fd66e4 Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13973
2014-05-16 12:22:50 +00:00
Philippe Waroquiers
183b978d08 Factorises the address code description and printing
of memcheck and helgrind in a common module:
  pub_tool_addrinfo.h pub_core_addrinfo.h m_addrinfo.c

At the same time, the factorised code is made usable by other
tools also (and is used by the gdbserver command 'v.info location'
which replaces the helgrind 'describe addr' introduced 1 week ago
and which is now callable by all tools).

The new address description code can describe more addresses
(e.g. for memcheck, if the block is not on the free list anymore,
but is in an arena free list, this will also be described).

Similarly, helgrind address description can now describe more addresses
when --read-var-info=no is given (e.g. global symbols are
described, or addresses on the stack are described as
being on the stack, freed blocks in the arena free list are
described, ...).
See e.g. the change in helgrind/tests/annotate_rwlock.stderr.exp
or locked_vs_unlocked2.stderr.exp

The patch touches many files, but is basically a lot of improvements
in helgrind output files.
The code changes are mostly refactorisation of existing code.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13965
2014-05-14 20:39:27 +00:00
Julian Seward
cdce5974bf Update.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13964
2014-05-14 13:29:04 +00:00
Mark Wielaard
85011418d1 Use safe_to_deref in coregrind syswrap-generic.c (msghdr_foreachfield).
Call ML_(safe_to_deref) before using msghdr msg_name, msg_iov or msg_control.
Fixes bug #334705.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13963
2014-05-14 11:35:54 +00:00
Mark Wielaard
5f385bb6e3 Support -Wformat -Werror=format-security.
Check if gcc supports -Wformat -Werror=format-security and use it if so.
Fix m_gdbserver/remote-utils.c sr_perror call. Fixes Bug #334727.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13962
2014-05-14 10:50:14 +00:00
Julian Seward
a9be523b3f Minor updates.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13955
2014-05-13 09:29:33 +00:00
Julian Seward
2c2bee19b1 3_9_BUGSTATUS.txt: looked at all bugs in the file. Moved fixed ones
to NEWS (if not already there).  Put the rest of them into a set of
categories depending on which part of the code base is affected, which
divides them up into -- IMO -- much more managable groups.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13951
2014-05-09 16:13:21 +00:00
Mark Wielaard
a07285e393 Add test for MPX instructions and bnd prefix. Bug #333666.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13948
2014-05-09 11:41:46 +00:00
Philippe Waroquiers
55c12b3a18 On a big application linking with gtk, using the compilation options
-ffunction-sections -fdata-sections and the linker option
-Wl,--gc-sections, --read-var-info=yes gives the following:

    valgrind: m_debuginfo/d3basics.c:973 (vgModuleLocal_evaluate_GX): Assertion 'aMax == ~(Addr)0' failed.

    host stacktrace:
    ==18521==    at 0x38057C54: show_sched_status_wrk (m_libcassert.c:308)
    ==18521==    by 0x38057F50: report_and_quit (m_libcassert.c:367)
    ==18521==    by 0x38058151: vgPlain_assert_fail (m_libcassert.c:432)
    ==18521==    by 0x3813F084: vgModuleLocal_evaluate_GX (d3basics.c:973)
    ==18521==    by 0x38098300: data_address_is_in_var (debuginfo.c:2769)
    ==18521==    by 0x38099E26: vgPlain_get_data_description (debuginfo.c:3298)
    ...

The problem is that -Wl,--gc-sections eliminates the unused functions
but keeps some debug info for the functions or their compilation units.
The dwarf entry has low and high pc, but both are equal to 0.
The dwarf reader of Valgrind is confused by this, as the varstack becomes
empty, while it should not. This then causes local (eliminated) variables
to be put in the global scope, leading afterwards to evaluation errors
when describing any other variables.

The fix is to also push something on the varstack when
a CU that has low and high pc given but with 0 value.
This is similar to the varstack_push done for a CU that has
no low pc, no high pc and no range.
Despite considerable effort to make a small reproducer, the problem
could only be produced with a big executable.
After the fix, everything was working properly.

The wrong behaviour for dwarf entries produce the following trace:
     <2><2ff291a>: Abbrev Number: 23 (DW_TAG_formal_parameter)
         DW_AT_name        : AET	
         DW_AT_decl_file   : 1	
         DW_AT_decl_line   : 243	
         DW_AT_type        : <2ff2811>	
         DW_AT_location    : 18288554	
      Recording this variable, with 1 PC range(s)
    ....
    <2ff291a> addVar: level 0: AET :: EdgeTableEntry*
      Loc=GX(final){[0x0,0x8]=50,[0x9,0x1d]=53,[0x1e,0x26]=51,[0x27,0x29]=53,[0x2a,0x2f]=51,[0x44,0x4a]=53,[0x4d,0x5e]=51,[0x5f,0x62]=53}
      FrB=none
      declared at: gdkpolyreg-generic.c:243
      ACQUIRE for range(s) [0x0,0xffffffff] 

The AET is a formal parameter of a function, but is wrongly added
at level 0, with a PC range covering the full space. It has a Loc GX
which uses non biased program counters (e.g. 0x0,0x8).
This dwarf entry will require a FrB (and registers when evaluating)
but no such things are available (or given) when evaluating a variable
in the global scope.

The fix is to handle compilation units with lo and hi pc == 0x0
similarly to a CU that has no lo and hi pc.
With this fix, valgrind --read-var-info=yes could properly
handle a big application with plenty of eliminated functions.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13941
2014-05-07 21:09:16 +00:00
Philippe Waroquiers
0a4b0b50a8 For the following c program:
main(int argc)
{
   typedef
      struct {
      int before_name;
      char name[argc];
      int after_name;
   }
   namet;
  namet n;

}

compiled with gcc 4.7.4, the trunk --read-var-info=yes gives:
parse_type_DIE: confused by:
 <2><51>: DW_TAG_structure_type
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 4	
     DW_AT_sibling     : <83>	

This is because that dwarf entry defines a struct with no size.
This happens when the struct has a VLA array in the middle
of a struct. This is a C gcc extension, and is a standard
feature of Ada.
The proper solution would be to have the size calculated at runtime,
using the gnat extensions or dwarf entries (to be generated by
the compiler).


The patch fixes this problem by defining the size of such structure
as 1 byte.
Another approach tried was to put the max possible size.
This had the disadvantage that any address on the stack was seen
as belonging to this variable.
This allows the description to work for the 1st byte of the variable
but cannot properly describe the 2nd and following bytes :
    (gdb) p &n
    $9 = (namet *) 0xbefbc070
    (gdb) mo c d 0xbefbc070
    Address 0xBEFBC070 len 1 not defined:
    Uninitialised value at 0xBEFBC070
    ==1396==  Location 0xbefbc070 is 0 bytes inside n.before_name,
    ==1396==  declared at crec.c:10, in frame #0 of thread 1
    (gdb) mo c d 0xbefbc071
    Address 0xBEFBC071 len 1 not defined:
    Uninitialised value at 0xBEFBC071
    ==1396==  Address 0xbefbc071 is on thread 1's stack
    (gdb) 

A possible refinement would be to use a huge size but have the
logic of variable description understanding this and describing
all between this var and hte next var on the stack as being
in the VLA variable.

In the meantime, the size 1 avoids --read-var-info=yes to fail.


Also, the 'goto bad_DIE' have been replaced by a macro
goto_bad_DIE that ensures the line nr at which the bad DIE has
been detected is reported in the error msg.
This makes it easier to understand what is the problem.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13938
2014-05-06 20:15:55 +00:00
Julian Seward
1f3b682ca0 Update aarch64 fixes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13933
2014-05-03 21:29:18 +00:00
Philippe Waroquiers
9bd0d72eb9 Helgrind : two new gdbserver commands 'describe address' and 'info locks'
- Helgrind GDB server monitor command 'describe <address>'
    allowing to describe an address (e.g. where it was allocated).
  - Helgrind GDB server monitor command 'info locks' giving
    the list of locks, their location, and their status.

In a further patch, it is intended to
  1. factorise the describe address code between memcheck and helgrind
  2. generalise the describe address gdbsrv command so as to make
     it usable for all tools.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13930
2014-05-03 11:12:50 +00:00
Philippe Waroquiers
9ba256ffb0 * New option --aspace-minaddr=<address> allows to (possibly) make
use of some more memory by decreasing the default value
  or solve some conflicts with system libraries by increasing the value.
  See user manual for details.

Note that the lowest accepted possible value is 0x1000, which is
the current value used by Macos in 32bits.
On linux, 0x10000 (64KB) seems to cause not much conflicts.

Default values are unchanged (i.e. are the same as when there
was no clo option).



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13901
2014-04-20 14:20:37 +00:00
Philippe Waroquiers
8b7a52c4cb - The option "--vgdb-stop-at=event1,event2,..." allows the user
to ask GDB server to stop before program execution, at the end
  of the program execution and on Valgrind internal errors.

- A new monitor command "v.set hostvisibility" that allows GDB server
  to provide access to Valgrind internal host status/memory.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13900
2014-04-20 13:41:10 +00:00
Philippe Waroquiers
74fb3e1c3e vgdb must not transmit signals when gdbserver has been ptrace-invoked.
Most of the time, Valgrind masks async signals, and polls for such
signals at regular interval.
There is a very narrow range of code (around client syscall logic)
where such signals are unmasked (as they must be able to interrupt
syscalls).
This is the only range of code where Valgrind is expecting to
receive such a signal.

When gdbserver is ptraced invoked, Valgrind is artificially made
to jump out of this code portion. Signals are not masked.
When ptraceing valgrind, vgdb will get these signals but cannot
transmit them immediately, otherwise they arrive in range
of code where they are not expected (causing internal error
in syscall logic) and/or causing gdbserver syscalls to be
interrupted.

3 solutions to solve that were looked at:
1. have the gdbserver code masking signals "as quickly as possible".
 Easy to implement, but this leaves still a small window
 of code where signals are not masked and would cause a problem.
2. have vgdb setting the SIGMASK of valgrind before invoking
  gdbserver.
  This would be easy to implement, but changing the SIGMASK
  of the ptrace-d process is only available on very recent kernels.
3. have vgdb queuing signals, and only transmitting them once
   gdbserver invocation is finished.
This 3rd solution has been implemented.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13896
2014-04-15 22:35:23 +00:00
Julian Seward
d410da3564 Add client requests
VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE and
   VALGRIND_ENABLE_ADDR_ERROR_REPORTING_IN_RANGE
and supporting machinery for managing whole-address-space sparse
mappings.  n-i-bz.  In support of
https://bugzilla.mozilla.org/show_bug.cgi?id=970643



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13884
2014-03-20 23:00:09 +00:00
Julian Seward
bd3e36e6a6 Update for ARM fe fixes for 332037 and n-i-bz LDRD .. [PC, ]
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13873
2014-03-15 08:35:15 +00:00
Bart Van Assche
b8bef5d9b9 NEWS: Mention recently fixed DRD issues
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13872
2014-03-13 08:40:56 +00:00
Bart Van Assche
87ff855f49 NEWS: Mention recently fixed DRD issues
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13871
2014-03-12 14:44:34 +00:00
Mark Wielaard
2a54eefde2 Enable sys_getpriority and sys_setpriority for ppc64.
Bug 331830 - ppc64: WARNING: unhandled syscall: 96/97
(Miroslav Franc, mfranc@redhat.com)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13861
2014-03-10 14:45:32 +00:00
Carl Love
e4f5fda8e1 updated NEWS to state bug 329956 is fixed for the next release.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13851
2014-03-03 20:49:20 +00:00
Christian Borntraeger
26c05a0871 This fixes the shadow validity setup of SP,IA and FPC. The current
code misses a char * cast and thus uses a wrong pointer for memset.
This resulted in corruptions of a thread state for multi threaded
programs. After vex: r2818 the memset did overwrite the tid value
of a thread, making this bug visible.
Lets use the c structures instead of pointer arithmetics.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13838
2014-02-24 21:01:14 +00:00
Tom Hughes
59d4e2822a Handle IPv6 addresses when reporting open file descriptors.
Based on a patch from Roger Light on BZ#175819.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13836
2014-02-24 15:06:06 +00:00
Mark Wielaard
7f675b0c9b BZ#331380 Syscall param timer_create(evp) points to uninitialised byte(s)
Only check struct sigevent actually used by the kernel. If SIGEV_THREAD_ID
is set check sigev_notify_thread_id, otherwise don't.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13835
2014-02-24 10:38:45 +00:00
Florian Krohm
65d93e4de3 Make SGCheck fail with a meaningful message on unsupported platforms.
Fixes BZ #325856.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13834
2014-02-22 22:03:09 +00:00
Florian Krohm
d4cd406ade Announce bug fix for BZ #331305
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13833
2014-02-22 18:45:39 +00:00
Mark Wielaard
93d88baa00 Bug 331337 s390x WARNING: unhandled syscall: 326 (dup3)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13820
2014-02-20 15:43:07 +00:00
Dejan Jevtic
3d1369a6e0 mips32: Support for 64bit FPU on MIPS32 platforms.
Tests for 64bit FPU instructions on MIPS32 platforms.
Some mips instructions can cause SIGILL (Illegal instruction),
so we need to add SIGILL signal and a proper handler for that signal.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13817
2014-02-19 11:57:22 +00:00
Florian Krohm
bc1f32fb67 Fix BZ #327212. Check for absolute path name at the end of
expand_file_name -- not at the beginning.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13816
2014-02-19 11:16:00 +00:00
Tom Hughes
c6e0a9d24e Filter out differences in structure size
Patch from Ivo Raisr on BZ#331254


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13814
2014-02-17 22:59:42 +00:00
Tom Hughes
1175b7c1a3 Use pclose instead of fclose to close pipes opened with popen, which
also allows us to drop the loop that was supposed to give the child a
chance to exit as the pclose will wait properly for the child.

Fix from Ivo Raisr on BZ#331255


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13813
2014-02-17 22:44:52 +00:00
Tom Hughes
c8f66f8d4d Use sigjmp_buf with sig{set,long}jmp, not jmp_buf
Patch from Ivo Raisr on BZ#331257


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13812
2014-02-17 22:32:15 +00:00
Petar Jovanovic
544994d634 mips64: add tests for load indexed instructions
Tests that should be executed on MIPS64 platforms that support lwx, ldx
and lbux.

Relevant VEX change - r2819.

Patch by Zahid Anwar, with some changes.

Related to Bugzilla issue 326444. It closes this issue now.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13808
2014-02-14 17:50:42 +00:00
Christian Borntraeger
4b8f0be86d - Handle KVM_CREATE_IRQCHIP, which does not take any parameter
and returns 0 or -1.
- white space fixes around the KVM ioctls


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13799
2014-02-11 15:15:31 +00:00
Tom Hughes
7e3bedb81e Update NEWS for VEX r2814
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13796
2014-02-09 11:41:25 +00:00
Tom Hughes
1cdbef5fd8 Fix typo in poll wrapper
Patch from Ivo Raisr via BZ#330941


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13795
2014-02-09 11:10:08 +00:00
Tom Hughes
6ef2cbe59d Add support for the clock_adjtime system call.
Based on a patch from Stefan Sørensen on BZ#330469.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13785
2014-01-30 22:33:02 +00:00
Tom Hughes
f1c82feda5 Both eventfd and eventfd2 have post handlers that we were failing
to call on most platforms. Fixes BZ #330459.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13784
2014-01-30 21:47:30 +00:00
Petar Jovanovic
f19c4a9504 Update NEWS (platform changes section) with MIPS/Android
As of r13767, Valgrind supports MIPS32/Android.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13779
2014-01-17 17:41:16 +00:00
Philippe Waroquiers
231d67347f add --vgdb-prefix arg to callgrind_control
If valgrind is started with --vgdb-prefix arg, then callgrind_control
cannot find and control this valgrind.
So, add an (optional) argument to callgrind_control,
and have callgrind tool report the needed vgdb prefix argument
if the user supplied this arg.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13769
2014-01-11 13:56:48 +00:00
Tom Hughes
057f9b7069 The value of AT_BASE should be the offset between where the ELF interpreter
expected to be loaded (as expressed in the ELF headers) and where it was
actually loaded, and not (as valgrind was doing) the absolute value of the
load address for the interpreter.

Note that when prelink is not in use the two are normally the same, as the
intpreter (like all shared libraries) is normally linked with a zero load
address. When prelinked that is no longer true.

With that fixed, the hack to patch out AT_BASE to avoid confusing gdb on
systems where prelink is in use is no longer needed.

Fixes BZ#329612


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13768
2014-01-07 22:27:57 +00:00
Florian Krohm
8e06b09720 Announce fix for BZ #327284.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13766
2013-12-21 17:59:50 +00:00
Philippe Waroquiers
c33117f7d6 Fix 325714 Empty vgcore but RLIMIT_CORE is big enough (too big)
Use ULong rather than UInt for coredump file size.

Tested manually by
  ulimit -c 4294967296
  ./vg-in-place ./gdbserver_tests/gone abort
valgrind creates vgcore.xxxxx unusable by GDB.

With the fix, GDB can read the core dump.

Patch from  Romain Geissler



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13762
2013-12-16 22:52:20 +00:00