Skip to content

[lldb] Add InstructionARM64 to lldb-server #137267

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

Closed
wants to merge 1 commit into from

Conversation

slydiman
Copy link
Contributor

No description provided.

@slydiman slydiman added the lldb label Apr 24, 2025
@slydiman slydiman requested a review from labath April 24, 2025 23:23
@slydiman slydiman requested a review from JDevlieghere as a code owner April 24, 2025 23:23
@llvmbot
Copy link
Member

llvmbot commented Apr 24, 2025

@llvm/pr-subscribers-lldb

Author: Dmitry Vasilyev (slydiman)

Changes

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

2 Files Affected:

  • (modified) lldb/tools/lldb-server/CMakeLists.txt (+1)
  • (modified) lldb/tools/lldb-server/SystemInitializerLLGS.cpp (+11-4)
diff --git a/lldb/tools/lldb-server/CMakeLists.txt b/lldb/tools/lldb-server/CMakeLists.txt
index 0135b367fcc21..6eb0e478a23a9 100644
--- a/lldb/tools/lldb-server/CMakeLists.txt
+++ b/lldb/tools/lldb-server/CMakeLists.txt
@@ -55,6 +55,7 @@ add_lldb_tool(lldb-server
       lldbVersion
       ${LLDB_PLUGINS}
       lldbPluginInstructionARM
+      lldbPluginInstructionARM64
       lldbPluginInstructionLoongArch
       lldbPluginInstructionMIPS
       lldbPluginInstructionMIPS64
diff --git a/lldb/tools/lldb-server/SystemInitializerLLGS.cpp b/lldb/tools/lldb-server/SystemInitializerLLGS.cpp
index 5b280d6cf5280..7784bc637c843 100644
--- a/lldb/tools/lldb-server/SystemInitializerLLGS.cpp
+++ b/lldb/tools/lldb-server/SystemInitializerLLGS.cpp
@@ -24,6 +24,7 @@ using HostObjectFile = ObjectFileELF;
 
 #if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
 #define LLDB_TARGET_ARM64
+#include "Plugins/Instruction/ARM64/EmulateInstructionARM64.h"
 #endif
 
 #if defined(__arm__) || defined(__arm) || defined(_ARM) || defined(_M_ARM) ||  \
@@ -62,13 +63,16 @@ llvm::Error SystemInitializerLLGS::Initialize() {
 
   HostObjectFile::Initialize();
 
-#if defined(LLDB_TARGET_ARM) || defined(LLDB_TARGET_ARM64)
+#if defined(LLDB_TARGET_ARM)
   EmulateInstructionARM::Initialize();
 #endif
+#if defined(LLDB_TARGET_ARM64)
+  EmulateInstructionARM64::Initialize();
+#endif
 #if defined(LLDB_TARGET_LoongArch)
   EmulateInstructionLoongArch::Initialize();
 #endif
-#if defined(LLDB_TARGET_MIPS) || defined(LLDB_TARGET_MIPS64)
+#if defined(LLDB_TARGET_MIPS)
   EmulateInstructionMIPS::Initialize();
 #endif
 #if defined(LLDB_TARGET_MIPS64)
@@ -84,13 +88,16 @@ llvm::Error SystemInitializerLLGS::Initialize() {
 void SystemInitializerLLGS::Terminate() {
   HostObjectFile::Terminate();
 
-#if defined(LLDB_TARGET_ARM) || defined(LLDB_TARGET_ARM64)
+#if defined(LLDB_TARGET_ARM)
   EmulateInstructionARM::Terminate();
 #endif
+#if defined(LLDB_TARGET_ARM64)
+  EmulateInstructionARM64::Terminate();
+#endif
 #if defined(LLDB_TARGET_LoongArch)
   EmulateInstructionLoongArch::Terminate();
 #endif
-#if defined(LLDB_TARGET_MIPS) || defined(LLDB_TARGET_MIPS64)
+#if defined(LLDB_TARGET_MIPS)
   EmulateInstructionMIPS::Terminate();
 #endif
 #if defined(LLDB_TARGET_MIPS64)

@slydiman slydiman requested a review from DavidSpickett April 24, 2025 23:27
@labath
Copy link
Collaborator

labath commented Apr 25, 2025

What's the motivation? The instruction emulation plugins are used to implement software single-stepping on architectures without (reliably present) hardware support. AFAIK aarch64 is not one of those.

Copy link
Collaborator

@labath labath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After reading #129543 (comment) I get the feeling this is just speculative. So yea, there is a reason to not add InstructionARM64 -- it's not needed/used.

@DavidSpickett
Copy link
Collaborator

The instruction emulation plugins are used to implement software single-stepping on architectures without (reliably present) hardware support. AFAIK aarch64 is not one of those.

I think it's also used in unwinding for some basic prologue/epilogue instructions, but I think that would happen in the client lldb not the server.

Also if this code is not in lldb-server now, I don't see a reason to add it unless it's solving a real prolem.

@slydiman
Copy link
Contributor Author

Ok, thanks.
Then I will close this PR.

@slydiman slydiman closed this Apr 25, 2025
@slydiman slydiman deleted the lldb-server-arm64 branch June 23, 2025 09:59
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