2 GDB command for printing the names of various objects.
5 from compatibility
import *
11 #------------------------------------------------------------------------------
21 sd
= val
['m_fullName']
22 elif t
== 'HPHP::Class':
23 sd
= deref(val
['m_preClass'])['m_name']
24 elif t
== 'HPHP::ObjectData':
25 cls
= deref(val
['m_cls'])
26 sd
= deref(cls
['m_preClass'])['m_name']
31 return string_data_val(deref(sd
))
34 #------------------------------------------------------------------------------
37 class NameOfCommand(gdb
.Command
):
38 """Print the name of an HHVM object."""
41 super(NameOfCommand
, self
).__init
__('nameof', gdb
.COMMAND_DATA
)
44 def invoke(self
, args
, from_tty
):
46 obj
= gdb
.parse_and_eval(args
)
48 print('Usage: nameof <object>')
54 print('"' + name
+ '"')