From 8c6384f24270d66549baea4336c5d60967117046 Mon Sep 17 00:00:00 2001 From: Mark Florisson Date: Mon, 21 Jan 2013 12:41:49 -0600 Subject: [PATCH] Test dwarf compile unit with DW_LANG_C89 --- llvm/debuginfo.py | 9 ++++++--- test/test_debuginfo.py | 22 ++++++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/llvm/debuginfo.py b/llvm/debuginfo.py index 7f2c16e..c9f6a2b 100644 --- a/llvm/debuginfo.py +++ b/llvm/debuginfo.py @@ -71,11 +71,14 @@ class CompileUnitDescriptor(object): md(self.global_vars or []), ] +# for op in operands: +# print op + node = llvm.core.MetaData.get(llvm_module, operands) llvm.core.MetaData.add_named_operand(llvm_module, "dbg", node) - print "printing metadata compile unit..." - print node - print "---- done ----" +# print "printing metadata compile unit..." +# print node +# print "---- done ----" return node diff --git a/test/test_debuginfo.py b/test/test_debuginfo.py index 3641d22..86cbe2d 100644 --- a/test/test_debuginfo.py +++ b/test/test_debuginfo.py @@ -32,7 +32,11 @@ class TestDebugInfo(unittest.TestCase): bldr = Builder.new(bb) 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", os.path.expanduser("~/"), "my_cool_compiler", @@ -44,13 +48,15 @@ class TestDebugInfo(unittest.TestCase): result = bldr.fmul(value, value) bldr.ret(result) -# info.build_metadata(mod) - print mod -# modstr = str(mod) -# print modstr - # self.assertIn("my_cool_compiler", modstr) +# print mod + modstr = str(mod) + self.assertIn("my_cool_compiler", modstr) + self.assertIn("test_debug_info.py", modstr) + self.assertIn(os.path.expanduser("~/"), modstr) + self.assertIn("my_cool_compiler", modstr) + if __name__ == '__main__': # TestDebugInfo("test_dwarf_constants").debug() - TestDebugInfo("test_debug_info_compile_unit").debug() -# unittest.main() \ No newline at end of file +# TestDebugInfo("test_debug_info_compile_unit").debug() + unittest.main() \ No newline at end of file