[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fkt-devel] Missing initialization ?
From: |
François Trahay |
Subject: |
[Fkt-devel] Missing initialization ? |
Date: |
Tue, 28 Aug 2012 10:20:33 +0200 |
User-agent: |
KMail/1.13.7 (Linux/3.2.0-3-amd64; KDE/4.8.4; x86_64; ; ) |
Hi,
I have imported the lastest version of FxT in EZTrace and it looks like
there's a problem during the initialization.
In fxt_setinfos(), we can find the following piece of code:
[...]
if (!(fxt = calloc(1,sizeof(*fxt))))
goto out;
fxt_print_symbols(fxt); // added for debugging purpose
fxt->infos.space=space;
fxt->infos.arch = FXT_RECORD_ARCH;
[...]
fxt_print_symbols(fxt) prints the value of fxt->addresses[i]. Since fxt has
just been initialized, fxt->addresses[i] should be NULL, but here is what the
program prints:
addresses[0]=0x7f99725a5200{.len=0, .address=0x7f9972297c90,
.source=0x72294000, .next=0x7f9972294280}
addresses[0]->next=0x7f9972294280{.len=-1991748779,
.address=0x52850f04a8078b48, .source=0x48000005, .next=0x503b48108b480000}
So the problem is that addresses is not initialized. At the end of the
program, when the trace is flushed to disk, the values of the addresses array
is browsed, leading to various warnings/errors.
A simple fix for this problem is to add :
if (!(fxt = calloc(1,sizeof(*fxt))))
goto out;
+ memset(fxt, 0, sizeof(*fxt));
fxt->infos.space=space;
fxt->infos.arch = FXT_RECORD_ARCH;
However, this problem seems to happen only when EZTrace does nasty things
(redefine malloc + uses OpenMPI that also tend to do crappy hacks), so I'm not
sure whether it's FxT's fault or EZTrace's.
François
- [Fkt-devel] Missing initialization ?,
François Trahay <=