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

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 15 16:01:17 PDT 2024


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

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

>From d22b491ab6557e4d53ed722a46de58ff126af4a6 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani <ismail at bennani.ma>
Date: Mon, 15 Jul 2024 16:00:07 -0700
Subject: [PATCH] [lldb/Symbol] Hoist SymbolLocation from AssertFrameRecognizer
 to reuse it

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

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
---
 lldb/include/lldb/Symbol/SymbolLocation.h    | 32 ++++++++++++++++++++
 lldb/source/Target/AssertFrameRecognizer.cpp | 13 +-------
 2 files changed, 33 insertions(+), 12 deletions(-)
 create mode 100644 lldb/include/lldb/Symbol/SymbolLocation.h

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



More information about the lldb-commits mailing list