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

Ely Ronnen via lldb-commits lldb-commits at lists.llvm.org
Fri May 30 12:57:39 PDT 2025


================
@@ -0,0 +1,17 @@
+//===-- ProtocolUtils.cpp -------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "Protocol/ProtocolUtils.h"
+
+namespace lldb_dap::protocol {
+
+bool IsAssemblySource(const protocol::Source &source) {
+  return source.sourceReference.value_or(0) != 0;
+}
----------------
eronnen wrote:

When creating the source object if there is source code available we set the `path`, otherwise we set `sourceReference`, which means we fall back to assembly.

According to the spec:

```js
/**
   * The source location of the breakpoints; either `source.path` or
   * `source.sourceReference` must be specified.
   */
 ```  

Also added a comment to the function to make it clearer

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


More information about the lldb-commits mailing list