================
@@ -558,28 +559,30 @@ protocol::Source CreateAssemblySource(const 
lldb::SBTarget &target,
   return source;
 }
 
-bool ShouldDisplayAssemblySource(
-    const lldb::SBLineEntry &line_entry,
-    lldb::StopDisassemblyType stop_disassembly_display) {
-  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNever)
-    return false;
-
-  if (stop_disassembly_display == lldb::eStopDisassemblyTypeAlways)
-    return true;
-
-  // A line entry of 0 indicates the line is compiler generated i.e. no source
-  // file is associated with the frame.
-  auto file_spec = line_entry.GetFileSpec();
-  if (!file_spec.IsValid() || line_entry.GetLine() == 0 ||
-      line_entry.GetLine() == LLDB_INVALID_LINE_NUMBER)
-    return true;
+protocol::Source CreateSource(const lldb::SBFileSpec &file) {
+  protocol::Source source;
+  if (file.IsValid()) {
+    const char *name = file.GetFilename();
+    if (name)
+      source.name = name;
+    char path[PATH_MAX] = "";
+    if (file.GetPath(path, sizeof(path)) &&
+        lldb::SBFileSpec::ResolvePath(path, path, PATH_MAX))
+      source.path = path;
+  }
+  return source;
+}
 
-  if (stop_disassembly_display == lldb::eStopDisassemblyTypeNoSource &&
-      !file_spec.Exists()) {
-    return true;
+protocol::Source CreateSource(lldb::SBAddress address, lldb::SBTarget &target) 
{
+  lldb::SBDebugger debugger = target.GetDebugger();
+  lldb::StopDisassemblyType stop_disassembly_display =
+      GetStopDisassemblyDisplay(debugger);
+  if (!ShouldDisplayAssemblySource(address, stop_disassembly_display)) {
+    lldb::SBLineEntry line_entry = GetLineEntryForAddress(target, address);
+    return CreateSource(line_entry.GetFileSpec());
   }
 
-  return false;
+  return CreateAssemblySource(target, address);
----------------
eronnen wrote:

:100: 

https://github.com/llvm/llvm-project/pull/141426
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to