[gambit-list] Any procedure/debug way to see what objects reference an object?
mikael.rcv at gmail.com
Tue Jun 18 14:00:12 EDT 2013
2013/6/18 Marc Feeley <feeley at iro.umontreal.ca>
> These functions already exist:
> > (##object->encoding (cons 11 22))
> > (##encoding->object 4562002011)
> (11 . 22)
> Of course, this is unsafe...
The container_body is a pointer to the body of the copied object. So it is
> the new location.
> > (Or alternatively, how do I cancel the garbage collection, and get the
> ___SCMOBJ for container_body in its present location)
> I don't think aborting a GC is safe. *Don't do it*
Ok. Considering the above there's no reason anyhow.
The equivalence printing block, I defined now as
fprintf(stderr,"The scanned for object reference %lu was referenced to by
%lu .\n",DEBUG_scanned_for_object_ref,(reference_location == IN_OBJECT) ?
((int*) container_body) : 0);
So if there's a valid object reference, it should be printed out. (The int
typecast here may be a bit dirty but on this 32bit setup it should be
(define a (vector 1 2 3))
(define b (lambda () a)) (define c (vector a)) (define d (list a))
(define r (##object->encoding a)) r
In GDB, I do
set var DEBUG_scanned_for_object_ref=3081924705
and then in Gambit
And Gambit prints:
The scanned for object reference 3081924705 was referenced to by 0 .
The scanned for object reference 3081924705 was referenced to by 3083239844
The scanned for object reference 3081924705 was referenced to by 3083239968
The 0 should refer to the reference to the object from the global variable
a, so that's fine.
Also, I guess we see here that the lambda refers to the global variable
slot in a general way and not to this variable specifically, so therefore
the lambda doesn't create an object reference.
Then to inspect the objects refering to a:
> (##encoding->object 3083239844)
> (##encoding->object 3083239968)
So something is invalid about doing what I did in the printf above, which
should correspond to
___SCMOBJ newref = (reference_location == IN_OBJECT) ? ((int*)
container_body) : ___FAL;
Em. The ___SCMOBJ *is* the new location, isn't it, so this should have
What did I miss, how is this done correctly?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Gambit-list