[LLVMdev] DISerializer question

Cédric Venet cedric.venet at student.ecp.fr
Tue Nov 13 13:44:26 PST 2007



   I am trying to add debugging information to a front-end. Following the
example off llvm-gcc, I pretty much understood how MachineModuleInfo work
but I have a question about the lifetime of the debug object.


>From the implementation of DISerialiser, It seems to me I need to keep all
my  debug information object alive until the end of the compilation unit
(until the destruction/last use of the instance of DISerialiser). For
example, I would need to keep all the SubprogramDesc for all the functions
from the translation unit. Have I correctly understood?


(the problem is that the map of the serialized data is keyed by the address
of the descriptor. If the descriptor is deleted, a new (and different)
descriptor could take the same address and cause an hard to find bug. As far
As I can see, the data isn’t acceded after being serialized, so if not for
the previous point, it would be safe to delete the descriptor after


This is a little inefficient from a memory stand point, but not so much
since the debug info shouldn’t take so much space after all. But from the
easiness to use (and to help writing bug free program) wouldn’t it be
simpler not too impose those restriction?


I think that a small change could accomplish this (cf patch). This patch
isn’t really tested (I just verified that it compile) and is only an idea,
perhaps I am totally wrong (didn’t take the time to understand all of
MachineModuleInfo.cpp). It cost an unsigned per Descriptor. Perhaps this
solution is no better.


(in fact I was just lazy and didn’t want to keep a list of all my descriptor
for cleanup at the end :S) 



Cédric Venet


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071113/efda3a6c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MMI2.patch
Type: application/octet-stream
Size: 2825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20071113/efda3a6c/attachment.obj>

More information about the llvm-dev mailing list