diff --git a/lldb/tools/debugserver/source/DNB.cpp b/lldb/tools/debugserver/source/DNB.cpp --- a/lldb/tools/debugserver/source/DNB.cpp +++ b/lldb/tools/debugserver/source/DNB.cpp @@ -477,6 +477,10 @@ } } + if (DNBDebugserverIsTranslated()) { + return INVALID_NUB_PROCESS_ARCH; + } + pid_t pid = INVALID_NUB_PROCESS; MachProcessSP processSP(new MachProcess); if (processSP.get()) { diff --git a/lldb/tools/debugserver/source/DNBDefs.h b/lldb/tools/debugserver/source/DNBDefs.h --- a/lldb/tools/debugserver/source/DNBDefs.h +++ b/lldb/tools/debugserver/source/DNBDefs.h @@ -54,6 +54,7 @@ typedef uint32_t nub_bool_t; #define INVALID_NUB_PROCESS ((nub_process_t)0) +#define INVALID_NUB_PROCESS_ARCH ((nub_process_t)-1) #define INVALID_NUB_THREAD ((nub_thread_t)0) #define INVALID_NUB_WATCH_ID ((nub_watch_t)0) #define INVALID_NUB_HW_INDEX UINT32_MAX diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp --- a/lldb/tools/debugserver/source/RNBRemote.cpp +++ b/lldb/tools/debugserver/source/RNBRemote.cpp @@ -3753,17 +3753,6 @@ char err_str[1024] = {'\0'}; std::string attach_name; - if (DNBDebugserverIsTranslated()) { - DNBLogError("debugserver is x86_64 binary running in translation, attach " - "failed."); - std::string return_message = "E96;"; - return_message += - cstring_to_asciihex_string("debugserver is x86_64 binary running in " - "translation, attached failed."); - SendPacket(return_message); - return rnb_err; - } - if (strstr(p, "vAttachWait;") == p) { p += strlen("vAttachWait;"); if (!GetProcessNameFrom_vAttach(p, attach_name)) { @@ -3823,6 +3812,17 @@ return HandlePacket_UNIMPLEMENTED(p); } + if (attach_pid == INVALID_NUB_PROCESS_ARCH) { + DNBLogError("debugserver is x86_64 binary running in translation, attach " + "failed."); + std::string return_message = "E96;"; + return_message += + cstring_to_asciihex_string("debugserver is x86_64 binary running in " + "translation, attach failed."); + SendPacket(return_message.c_str()); + return rnb_err; + } + if (attach_pid != INVALID_NUB_PROCESS) { if (m_ctx.ProcessID() != attach_pid) m_ctx.SetProcessID(attach_pid);