jankratochvil created this revision.
jankratochvil added reviewers: LLDB, labath.
jankratochvil added a project: LLDB.
Herald added subscribers: abidh, ki.stfu.

There is already in use:

  lit/lit-lldb-init:settings set symbols.enable-external-lookup false
  packages/Python/lldbsuite/test/lldbtest.py:        self.runCmd('settings set 
symbols.enable-external-lookup false')

But those are not in effect during MI part of the testsuite.  Another problem 
is that `symbols.enable-external-lookup` (read by `GetEnableExternalLookup`) 
has been currently read only by `LocateMacOSXFilesUsingDebugSymbols` and 
therefore it had no effect on Linux.
On Red Hat platforms (Fedoras, RHEL-7) there is DWZ in use and so 
`MiSyntaxTestCase-test_lldbmi_output_grammar` FAILs due to:

  AssertionError: error: inconsistent pattern ''^.+?\n'' for state 0x5f 
(matched string: warning: (x86_64) /lib64/libstdc++.so.6 unsupported DW_FORM 
values: 0x1f20 0x1f21

It is the only testcase with this error. It happens due to:

  (lldb) target create "/lib64/libstdc++.so.6"
  Current executable set to '/lib64/libstdc++.so.6' (x86_64).
  (lldb) b main
  warning: (x86_64) /lib64/libstdc++.so.6 unsupported DW_FORM values: 0x1f20 
0x1f21
  Breakpoint 1: no locations (pending).
  WARNING:  Unable to resolve breakpoint to any actual locations.

which happens only with `gcc-base-debuginfo` rpm installed (similarly for other 
packages).
It should also speed up the testsuite as it no longer needs to read 
`/usr/lib/debug` symbols which have no effect (and should not have any effect) 
on the testsuite results.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D55859

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
  
packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
  
packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
  source/Host/common/Symbols.cpp

Index: source/Host/common/Symbols.cpp
===================================================================
--- source/Host/common/Symbols.cpp
+++ source/Host/common/Symbols.cpp
@@ -253,6 +253,9 @@
       FileSystem::Instance().Exists(symbol_file_spec))
     return symbol_file_spec;
 
+  bool external_lookup =
+      ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup();
+
   const char *symbol_filename = symbol_file_spec.GetFilename().AsCString();
   if (symbol_filename && symbol_filename[0]) {
     FileSpecList debug_file_search_paths(
@@ -270,30 +273,32 @@
       debug_file_search_paths.AppendIfUnique(file_spec);
     }
 
-    // Add current working directory.
-    {
-      FileSpec file_spec(".");
-      FileSystem::Instance().Resolve(file_spec);
-      debug_file_search_paths.AppendIfUnique(file_spec);
-    }
+    if (external_lookup) {
+      // Add current working directory.
+      {
+        FileSpec file_spec(".");
+        FileSystem::Instance().Resolve(file_spec);
+        debug_file_search_paths.AppendIfUnique(file_spec);
+      }
 
 #ifndef _WIN32
 #if defined(__NetBSD__)
-    // Add /usr/libdata/debug directory.
-    {
-      FileSpec file_spec("/usr/libdata/debug");
-      FileSystem::Instance().Resolve(file_spec);
-      debug_file_search_paths.AppendIfUnique(file_spec);
-    }
+      // Add /usr/libdata/debug directory.
+      {
+        FileSpec file_spec("/usr/libdata/debug");
+        FileSystem::Instance().Resolve(file_spec);
+        debug_file_search_paths.AppendIfUnique(file_spec);
+      }
 #else
-    // Add /usr/lib/debug directory.
-    {
-      FileSpec file_spec("/usr/lib/debug");
-      FileSystem::Instance().Resolve(file_spec);
-      debug_file_search_paths.AppendIfUnique(file_spec);
-    }
+      // Add /usr/lib/debug directory.
+      {
+        FileSpec file_spec("/usr/lib/debug");
+        FileSystem::Instance().Resolve(file_spec);
+        debug_file_search_paths.AppendIfUnique(file_spec);
+      }
 #endif
 #endif // _WIN32
+    }
 
     std::string uuid_str;
     const UUID &module_uuid = module_spec.GetUUID();
@@ -357,6 +362,12 @@
     }
   }
 
+  if (!external_lookup) {
+    Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
+    if (log)
+      log->Printf("External lookup for symbol files is disabled.");
+    return FileSpec();
+  }
   return LocateExecutableSymbolFileDsym(module_spec);
 }
 
Index: packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
+++ packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
@@ -1,2 +1,3 @@
+settings set symbols.enable-external-lookup false
 -file-exec-and-symbols a.out
 -break-ins -f main
Index: packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
@@ -237,7 +237,11 @@
 
         # Prepared source file
         sourceFile = self.copyScript("start_script_error")
-        self.spawnLldbMi(args="--source %s" % sourceFile)
+        self.spawnLldbMi(args="--source %s" % sourceFile, preconfig=False)
+
+        # After 'settings set symbols.enable-external-lookup false'
+        self.expect("settings set symbols.enable-external-lookup false")
+        self.expect("\^done")
 
         # After '-file-exec-and-symbols a.out'
         self.expect("-file-exec-and-symbols %s" % self.myexe)
Index: packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
===================================================================
--- packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
@@ -40,7 +40,7 @@
                 pass
         Base.tearDown(self)
 
-    def spawnLldbMi(self, exe=None, args=None):
+    def spawnLldbMi(self, exe=None, args=None, preconfig=True):
         import pexpect
         self.child = pexpect.spawn("%s --interpreter %s" % (
             self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
@@ -49,6 +49,10 @@
         self.child.logfile_read = open(self.mylog, "w")
         # wait until lldb-mi has started up and is ready to go
         self.expect(self.child_prompt, exactly=True)
+        if preconfig:
+            self.runCmd("settings set symbols.enable-external-lookup false")
+            self.expect("\^done")
+            self.expect(self.child_prompt, exactly=True)
         if exe:
             self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to