Test dwarf compile unit with DW_LANG_C89
This commit is contained in:
parent
7c9f73ccc7
commit
8c6384f242
2 changed files with 20 additions and 11 deletions
|
|
@ -71,11 +71,14 @@ class CompileUnitDescriptor(object):
|
||||||
md(self.global_vars or []),
|
md(self.global_vars or []),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# for op in operands:
|
||||||
|
# print op
|
||||||
|
|
||||||
node = llvm.core.MetaData.get(llvm_module, operands)
|
node = llvm.core.MetaData.get(llvm_module, operands)
|
||||||
llvm.core.MetaData.add_named_operand(llvm_module, "dbg", node)
|
llvm.core.MetaData.add_named_operand(llvm_module, "dbg", node)
|
||||||
|
|
||||||
print "printing metadata compile unit..."
|
# print "printing metadata compile unit..."
|
||||||
print node
|
# print node
|
||||||
print "---- done ----"
|
# print "---- done ----"
|
||||||
|
|
||||||
return node
|
return node
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,11 @@ class TestDebugInfo(unittest.TestCase):
|
||||||
bldr = Builder.new(bb)
|
bldr = Builder.new(bb)
|
||||||
|
|
||||||
info = debuginfo.CompileUnitDescriptor(
|
info = debuginfo.CompileUnitDescriptor(
|
||||||
_dwarf.DW_LANG_Python,
|
# DW_LANG_Python segfaults:
|
||||||
|
# llvm/ADT/StringRef.h:79: llvm::StringRef::StringRef(const char*):
|
||||||
|
# Assertion `Str && "StringRef cannot be built from a NULL argument"'
|
||||||
|
# _dwarf.DW_LANG_Python,
|
||||||
|
_dwarf.DW_LANG_C89,
|
||||||
"test_debug_info.py",
|
"test_debug_info.py",
|
||||||
os.path.expanduser("~/"),
|
os.path.expanduser("~/"),
|
||||||
"my_cool_compiler",
|
"my_cool_compiler",
|
||||||
|
|
@ -44,13 +48,15 @@ class TestDebugInfo(unittest.TestCase):
|
||||||
result = bldr.fmul(value, value)
|
result = bldr.fmul(value, value)
|
||||||
bldr.ret(result)
|
bldr.ret(result)
|
||||||
|
|
||||||
# info.build_metadata(mod)
|
# print mod
|
||||||
print mod
|
modstr = str(mod)
|
||||||
# modstr = str(mod)
|
self.assertIn("my_cool_compiler", modstr)
|
||||||
# print modstr
|
self.assertIn("test_debug_info.py", modstr)
|
||||||
# self.assertIn("my_cool_compiler", modstr)
|
self.assertIn(os.path.expanduser("~/"), modstr)
|
||||||
|
self.assertIn("my_cool_compiler", modstr)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# TestDebugInfo("test_dwarf_constants").debug()
|
# TestDebugInfo("test_dwarf_constants").debug()
|
||||||
TestDebugInfo("test_debug_info_compile_unit").debug()
|
# TestDebugInfo("test_debug_info_compile_unit").debug()
|
||||||
# unittest.main()
|
unittest.main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue