[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linrad] Re: xlinrad 02.05. Problem solved(?)
- Subject: [linrad] Re: xlinrad 02.05. Problem solved(?)
- From: Robert McGwier <comcast.net; rwmcgwier@xxxxxxxxxxxxxxxx>
- Date: Sun, 16 Apr 2006 08:06:28 -0400
The first one cannot know whether or not a separate thread using a
pointer or the variable has initialized the contents. In the second,
typically the construct inside the
if (A ==0) {
}
braces, requires that A be initialized to zero and that some action
required by the inside of braces area has been accomplished. Otherwise,
there would be no need for the if test. This is typically why the
second fails and the first does not. If A is an unsigned integer
quantity, it does not matter that B is unitialized. The operation is
legal even if the contents are not. These kinds of assignments
typically succeed except in the case of floating point where a floating
point exception is thrown (if you are lucky!).
gdb and valgrind are tools that aid (as you can see) but they cannot
tease apart all of the logical ways things can happen. If I may, they
are not mind readers, they are the assistant in the audience aiding the
mentalist by picking the unsuspecting customer's pocket for
information! With that attitude, you will find a way to properly use
valgrind or gdb to eventually come to arrive at the error by logical
inference and deduction. I wish I could give a more satisfying answer
but you can see why it is not possible for valgrind or gdb to understand
all of the ways these things can happen.
The best case you can hope for is an explosion where valgrind gives you
the line of interest and you back it up logically to the nexus of the
problem.
73's
Bob
leif@xxxxxxxxxx wrote:
Hi Bob,
You will probably need to turn on the debug symbol generation and turn
off optimizations and then you will be able to follow the progress. You
do not care that it is slow here, you are attempting to find logic and
other errors.
OK. The problem is to know all the details....
gcc -g -O0 will turn off optimizations, insert debug symbols and you
can then debug with gdb or valgrind.
Hmmm, so far gdb is black magic to me, but valgrind gives
info I can understand:-)
I tried several times (various things) until I discovered I have to
put -g in the compiler stage and not the linker stage;-)
Another thing was that I had to remove -s from the linker options....
Now it works!
Is there a way to get an error message when an uninited variable
is used ? Things like this:
(B not initialised)
A=B;
.
.
.
.
if(A==0)whatever();
I get an error message from the last line but not from the first one
which may be very far away in the code an have inherited its non-init
status through a long chain through several intermediate variables.
73
Leif
--
AMSAT VP Engineering. Member: ARRL, AMSAT-DL, TAPR, Packrats,
NJQRP/AMQRP, QRP ARCI, QCWA, FRC. ARRL SDR Wrk Grp Chairman
Laziness is the number one inspiration for ingenuity. Guilty as charged!
#############################################################
This message is sent to you because you are subscribed to
the mailing list <linrad@xxxxxxxxxxxxxxxxxxxxx>.
To unsubscribe, E-mail to: <linrad-off@xxxxxxxxxxxxxxxxxxxxx>
To switch to the DIGEST mode, E-mail to <linrad-digest@xxxxxxxxxxxxxxxxxxxxx>
To switch to the INDEX mode, E-mail to <linrad-index@xxxxxxxxxxxxxxxxxxxxx>
Send administrative queries to <linrad-request@xxxxxxxxxxxxxxxxxxxxx>
LINRADDARNIL