Skip to content

[lldb/Symbol] Hoist SymbolLocation from AssertFrameRecognizer to reuse it #98975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

medismailben
Copy link
Member

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

…e 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 <[email protected]>
@llvmbot
Copy link
Member

llvmbot commented Jul 15, 2024

@llvm/pr-subscribers-lldb

Author: Med Ismail Bennani (medismailben)

Changes

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 --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

@medismailben medismailben merged commit 1c85496 into llvm:main Jul 15, 2024
6 of 7 checks passed
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
…e it (#98975)

Summary:
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 <[email protected]>

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251720
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants