[Lldb-commits] [lldb] [lldb/Symbol] Hoist SymbolLocation from AssertFrameRecognizer to reuse it (PR #98975)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 15 16:01:51 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)

<details>
<summary>Changes</summary>

This patch hoists the `SymbolLocation` struct from the `AssertFrameRecognizer` source file, since it's pretty generic and could be reused for other purposes.

---
Full diff: https://github.com/llvm/llvm-project/pull/98975.diff


2 Files Affected:

- (added) lldb/include/lldb/Symbol/SymbolLocation.h (+32) 
- (modified) lldb/source/Target/AssertFrameRecognizer.cpp (+1-12) 


``````````diff
diff --git a/lldb/include/lldb/Symbol/SymbolLocation.h b/lldb/include/lldb/Symbol/SymbolLocation.h
new file mode 100644
index 0000000000000..be590c403b6e2
--- /dev/null
+++ b/lldb/include/lldb/Symbol/SymbolLocation.h
@@ -0,0 +1,32 @@
+//===-- SymbolLocation.h ----------------------------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SYMBOL_SYMBOLLOCATION_H
+#define LLDB_SYMBOL_SYMBOLLOCATION_H
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-private.h"
+
+#include <vector>
+
+namespace lldb_private {
+
+/// Stores a function module spec, symbol name and possibly an alternate symbol
+/// name.
+struct SymbolLocation {
+  FileSpec module_spec;
+  std::vector<ConstString> symbols;
+
+  // The symbols are regular expressions. In such case all symbols are matched
+  // with their trailing @VER symbol version stripped.
+  bool symbols_are_regex = false;
+};
+
+} // namespace lldb_private
+#endif // LLDB_SYMBOL_SYMBOLLOCATION_H
diff --git a/lldb/source/Target/AssertFrameRecognizer.cpp b/lldb/source/Target/AssertFrameRecognizer.cpp
index 5f4682bd5c11a..da7c102645c01 100644
--- a/lldb/source/Target/AssertFrameRecognizer.cpp
+++ b/lldb/source/Target/AssertFrameRecognizer.cpp
@@ -2,6 +2,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Symbol/SymbolLocation.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackFrameList.h"
 #include "lldb/Target/Target.h"
@@ -13,18 +14,6 @@ using namespace lldb;
 using namespace lldb_private;
 
 namespace lldb_private {
-
-/// Stores a function module spec, symbol name and possibly an alternate symbol
-/// name.
-struct SymbolLocation {
-  FileSpec module_spec;
-  std::vector<ConstString> symbols;
-
-  // The symbols are regular expressions. In such case all symbols are matched
-  // with their trailing @VER symbol version stripped.
-  bool symbols_are_regex = false;
-};
-
 /// Fetches the abort frame location depending on the current platform.
 ///
 /// \param[in] os

``````````

</details>


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


More information about the lldb-commits mailing list