[Lldb-commits] [Bug 11588] New: valobj.AddressOf() returns None when an address is expected in a SyntheticChildrenProvider

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 15 11:51:50 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=11588

             Bug #: 11588
           Summary: valobj.AddressOf() returns None when an address is
                    expected in a SyntheticChildrenProvider
           Product: lldb
           Version: unspecified
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
        AssignedTo: lldb-commits at cs.uiuc.edu
        ReportedBy: nathanhowell at hotmail.com
    Classification: Unclassified


Getting the address of a SBValue in a SyntheticChildrenProvider is required in
situations where a member field specifies an object relative offset (common
even in C/C++) or where the lower pointer bits are used to store object
information or garbage collection state. Since this seems to work in the
expression evaluator, it looks as though the address is not preserved for
synthetic formatters.

# there is an object in r14 uses the lower two bits for pointer tagging
(lldb) print ((StgClosure_*)$r14)
(StgClosure_ *) $0 = 0x0000000100404151

# dereferencing it directly will give invalid results
(lldb) print *((StgClosure_*)$r14)
(StgClosure_) $1 = {
  (StgHeader) header = {
    (const StgInfoTable *) info = 0xf100000001000011
  }
  (StgClosure_ *[1]) payload = {
    (StgClosure_ *) [0] = 0x0100000001000f28
  }
}

# because the low bits need to be cleared before printing. the referenced
closure
# in the payload field also has the low bit set and it will need to be cleared
as well
(lldb) print *((StgClosure_*)($r14-1))
(StgClosure_) $3 = {
  (StgHeader) header = {
    (const StgInfoTable *) info = 0x0000000100001138
  }
  (StgClosure_ *[1]) payload = {
    (StgClosure_ *) [0] = 0x00000001000f28f1
  }
}

# so i thought the AddressOf operator would give me the original value back in
a SyntheticProvider
# like it does in the lldb expression evaluator
(lldb) print &*((StgClosure_*)($r14-1))
(StgClosure_ *) $4 = 0x0000000100404150

# but AddressOf fails in the provider
(lldb) type synthetic add StgClosure_ --python-class
synth.SyntheticClosureProvider
(lldb) print *((StgClosure_*)($r14-1))
AddressOf: No value
GetAddress: No value
GetLoadAddress: 18446744073709551615
(StgClosure_) $7 = {}

The referenced python code:
class SyntheticClosureProvider(object):
    def __init__(self, valobj, dict):
        self.valobj = valobj
        addrOf = valobj.AddressOf()
        print 'AddressOf: ' + str(addrOf)

        addr = valobj.GetAddress()
        print 'GetAddress: ' + str(addr)

        load_address = valobj.GetLoadAddress()
        print 'GetLoadAddress: ' + str(load_address)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the lldb-commits mailing list