[Lldb-commits] [lldb] [lldb-dap] Reuse source object logics (PR #141426)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu May 29 22:35:42 PDT 2025


================
@@ -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;
----------------
JDevlieghere wrote:

```suggestion
    if (const char *name = file.GetFilename())
      source.name = name;
```

https://github.com/llvm/llvm-project/pull/141426


More information about the lldb-commits mailing list