As it exists today, Host::SystemLog is used exclusively for error reporting. With the introduction of diagnostic events, we have a better way of reporting those. Instead of printing directly to stderr, these messages now get printed to the debugger's error stream (when using the default event handler). Alternatively, if someone is listening for these events, they can decide how to display them, for example in the context of an IDE such as Xcode. This change also means we no longer write these messages to the system log on Darwin. As far as I know, nobody is relying on this, but I think this is something we could add to the diagnostic event mechanism. Differential revision: https://reviews.llvm.org/D128480
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
|
|
import unittest2
|
|
import os
|
|
import shutil
|
|
|
|
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
from lldbsuite.test import lldbutil
|
|
|
|
|
|
class TestClangModuleHashMismatch(TestBase):
|
|
|
|
@skipIf(debug_info=no_match(["gmodules"]))
|
|
def test_expr(self):
|
|
with open(self.getBuildArtifact("module.modulemap"), "w") as f:
|
|
f.write("""
|
|
module Foo { header "f.h" }
|
|
""")
|
|
with open(self.getBuildArtifact("f.h"), "w") as f:
|
|
f.write("""
|
|
typedef int my_int;
|
|
void f() {}
|
|
""")
|
|
|
|
mod_cache = self.getBuildArtifact("private-module-cache")
|
|
if os.path.isdir(mod_cache):
|
|
shutil.rmtree(mod_cache)
|
|
self.build()
|
|
self.assertTrue(os.path.isdir(mod_cache), "module cache exists")
|
|
|
|
logfile = self.getBuildArtifact("host.log")
|
|
with open(logfile, 'w') as f:
|
|
sbf = lldb.SBFile(f.fileno(), 'w', False)
|
|
status = self.dbg.SetErrorFile(sbf)
|
|
self.assertSuccess(status)
|
|
|
|
target, _, _, _ = lldbutil.run_to_source_breakpoint(
|
|
self, "break here", lldb.SBFileSpec("main.m"))
|
|
target.GetModuleAtIndex(0).FindTypes('my_int')
|
|
|
|
with open(logfile, 'r') as f:
|
|
for line in f:
|
|
if "hash mismatch" in line and "Foo" in line:
|
|
found = True
|
|
self.assertTrue(found)
|