|
From: Brian M. <bm...@di...> - 2003-08-29 02:48:07
|
I'm fairly new to valgrind and was wondering if there was a way to determine the actual memory address of the data that is being used in an un-initialized fashion. My error message is as follows: ==12355== Use of uninitialised value of size 4 ==12355== at 0x4145D874: void Filter<float, float>(float*, float const*, float const*, float const*, int) (Filter/Filter.h:90) ==12355== by 0x4145D30A: _t_ErrCode FilterTmplt<float, float>(CBoundedBlock<float>*, CBoundedBlock<float> const*, unsigned char, unsigned char, unsigned char) (Filter/Filter.h:199) ==12355== by 0x4145CF4D: FilterThreshold(CBoundedBlock<float>*, CBoundedBlock<float> const*, unsigned char, unsigned char, unsigned char) (Filter/Filter.cpp:44) I see that the offending code is at address 0x4145D874. What I am missing is the memory address of the *data* that is being used. Is there any way to get valgrind to report the data address? I've looked in the docs, and tried a number of various switches to no avail. Sorry if I'm missing something obvious. Thanks in advance, --Brian (Valgrind is awesome, by the way.) |
|
From: Tom H. <th...@cy...> - 2003-08-29 06:12:50
|
In message <608...@pd...>
Brian Mosher <bm...@di...> wrote:
> I'm fairly new to valgrind and was wondering if there was a way to determine
> the actual memory address of the data that is being used in an
> un-initialized fashion.
>
> My error message is as follows:
>
> ==12355== Use of uninitialised value of size 4
> ==12355== at 0x4145D874: void Filter<float, float>(float*, float const*,
> float const*, float const*, int) (Filter/Filter.h:90)
> ==12355== by 0x4145D30A: _t_ErrCode FilterTmplt<float,
> float>(CBoundedBlock<float>*, CBoundedBlock<float> const*, unsigned char,
> unsigned char, unsigned char) (Filter/Filter.h:199)
> ==12355== by 0x4145CF4D: FilterThreshold(CBoundedBlock<float>*,
> CBoundedBlock<float> const*, unsigned char, unsigned char, unsigned char)
> (Filter/Filter.cpp:44)
That's only half the error - there should be a second half to the
error report that describes the address of the uninitialised data.
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|
|
From: Jeremy F. <je...@go...> - 2003-09-01 20:44:08
|
On Thu, 2003-08-28 at 19:47, Brian Mosher wrote: > I see that the offending code is at address 0x4145D874. What I am missing is > the memory address of the *data* that is being used. Is there any way to get > valgrind to report the data address? I've looked in the docs, and tried a > number of various switches to no avail. The trouble is that Valgrind doesn't know what the address is - there may not be one. It's talking about a value your program tried to operate on, which is probably in a register when it caused the problem. Since memcheck doesn't track every value transfer, it doesn't know where that value came from at the time the error happened, so the best it can do is report what it knows. The value may not even be in memory, since it could be a temporary result of a calculation which had some undefined inputs, and the result is undefined but different from all its inputs. In these cases, the best thing to do is look at the code in question and add #include <valgrind/memcheck.h> [...] VALGRIND_CHECK_DEFINED(variable); to all relevant-looking variables and see what happens. This should help you track it down. J |