[Lldb-commits] [lldb] 9126ba2 - [lldb][NFC] Fix test file name in lang/cpp/non-type-template-param

2020-12-01 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-12-02T08:41:53+01:00
New Revision: 9126ba25a3eeffa438e20d3a18abf70eb547789d

URL: 
https://github.com/llvm/llvm-project/commit/9126ba25a3eeffa438e20d3a18abf70eb547789d
DIFF: 
https://github.com/llvm/llvm-project/commit/9126ba25a3eeffa438e20d3a18abf70eb547789d.diff

LOG: [lldb][NFC] Fix test file name in lang/cpp/non-type-template-param

The 'AlignAsBaseClass' part was a leftover form the align_as test that served as
the template for this test.

Added: 

lldb/test/API/lang/cpp/non-type-template-param/TestCppNonTypeTemplateParam.py

Modified: 


Removed: 

lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClassNonTemplateParam.py



diff  --git 
a/lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClassNonTemplateParam.py
 b/lldb/test/API/lang/cpp/non-type-template-param/TestCppNonTypeTemplateParam.py
similarity index 100%
rename from 
lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClassNonTemplateParam.py
rename to 
lldb/test/API/lang/cpp/non-type-template-param/TestCppNonTypeTemplateParam.py



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D82857: [LLDB] Add per-thread register infos shared pointer in gdb-remote

2020-12-01 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid updated this revision to Diff 308863.
omjavaid added a comment.

Updated after incorporating suggested changes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82857/new/

https://reviews.llvm.org/D82857

Files:
  lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h

Index: lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
===
--- lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
@@ -14,6 +14,8 @@
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/StructuredData.h"
 
+#include "GDBRemoteRegisterContext.h"
+
 class StringExtractor;
 
 namespace lldb_private {
@@ -101,6 +103,8 @@
   m_queue_serial_number; // Queue info from stop reply/stop info for thread
   lldb_private::LazyBool m_associated_with_libdispatch_queue;
 
+  GDBRemoteDynamicRegisterInfoSP m_reg_info_sp;
+
   bool PrivateSetRegisterValue(uint32_t reg, llvm::ArrayRef data);
 
   bool PrivateSetRegisterValue(uint32_t reg, uint64_t regval);
Index: lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -42,6 +42,22 @@
   Log *log(GetLogIfAnyCategoriesSet(GDBR_LOG_THREAD));
   LLDB_LOG(log, "this = {0}, pid = {1}, tid = {2}", this, process.GetID(),
GetID());
+  // At this point we can clone reg_info for architectures supporting
+  // run-time update to register sizes and offsets..
+  ProcessSP process_sp(GetProcess());
+  if (process_sp) {
+ProcessGDBRemote *gdb_process =
+static_cast(process_sp.get());
+
+if (!m_reg_info_sp) {
+  if (!gdb_process->m_register_info_sp->IsReconfigurable())
+m_reg_info_sp = gdb_process->m_register_info_sp;
+  else {
+m_reg_info_sp = std::make_shared();
+m_reg_info_sp->CloneFrom(gdb_process->m_register_info_sp);
+  }
+}
+  }
 }
 
 ThreadGDBRemote::~ThreadGDBRemote() {
@@ -307,8 +323,8 @@
   !pSupported || gdb_process->m_use_g_packet_for_reading;
   bool write_all_registers_at_once = !pSupported;
   reg_ctx_sp = std::make_shared(
-  *this, concrete_frame_idx, gdb_process->m_register_info,
-  read_all_registers_at_once, write_all_registers_at_once);
+  *this, concrete_frame_idx, m_reg_info_sp, read_all_registers_at_once,
+  write_all_registers_at_once);
 }
   } else {
 reg_ctx_sp = GetUnwinder().CreateRegisterContextForFrame(frame);
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -254,7 +254,7 @@
  // the last stop
  // packet variable
   std::recursive_mutex m_last_stop_packet_mutex;
-  GDBRemoteDynamicRegisterInfo m_register_info;
+  GDBRemoteDynamicRegisterInfoSP m_register_info_sp;
   Broadcaster m_async_broadcaster;
   lldb::ListenerSP m_async_listener_sp;
   HostThread m_async_thread;
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -249,7 +249,7 @@
ListenerSP listener_sp)
 : Process(target_sp, listener_sp),
   m_debugserver_pid(LLDB_INVALID_PROCESS_ID), m_last_stop_packet_mutex(),
-  m_register_info(),
+  m_register_info_sp(nullptr),
   m_async_broadcaster(nullptr, "lldb.process.gdb-remote.async-broadcaster"),
   m_async_listener_sp(
   Listener::MakeListener("lldb.process.gdb-remote.async-listener")),
@@ -368,8 +368,8 @@
   m_breakpoint_pc_offset = breakpoint_pc_int_value->GetValue();
   }
 
-  if (m_register_info.SetRegisterInfo(*target_definition_sp,
-  GetTarget().GetArchitecture()) > 0) {
+  if (m_register_info_sp->SetRegisterInfo(
+  *target_definition_sp, GetTarget().GetArchitecture()) > 0) {
 return true;
   }
 }
@@ -396,10 +396,11 @@
 }
 
 void ProcessGDBRemote::BuildDynamicRegisterInfo(bool 

[Lldb-commits] [PATCH] D92452: [lldb] Treat remote macOS debugging like any other remote darwin platform

2020-12-01 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked an inline comment as done.
JDevlieghere added inline comments.



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp:152
+  } else if (idx == m_num_arm_arches + 3) {
+arch.SetTriple("arm64e-apple-ios");
+return true;

jasonmolenda wrote:
> wouldn't these be a `remote-ios` platform?  Is this to handle iOS apps 
> running on an Apple Silicon macOS system?
Yep, I moved this from PlatformMacOSX.cpp where Davide added that for AS. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92452/new/

https://reviews.llvm.org/D92452

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D92452: [lldb] Treat remote macOS debugging like any other remote darwin platform

2020-12-01 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Looks good overall, nice test.




Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp:152
+  } else if (idx == m_num_arm_arches + 3) {
+arch.SetTriple("arm64e-apple-ios");
+return true;

wouldn't these be a `remote-ios` platform?  Is this to handle iOS apps running 
on an Apple Silicon macOS system?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92452/new/

https://reviews.llvm.org/D92452

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D92249: [LLDB/Python] Fix segfault on Python scripted breakpoints

2020-12-01 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Thanks! LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92249/new/

https://reviews.llvm.org/D92249

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D92452: [lldb] Treat remote macOS debugging like any other remote darwin platform

2020-12-01 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: aprantl, jasonmolenda, clayborg.
JDevlieghere added a project: LLDB.
Herald added subscribers: krytarowski, mgorny.
JDevlieghere requested review of this revision.

Extract remote debugging logic from PlatformMacOSX and move it into 
PlatformRemoteMacOSX so it can benefit from all the logic necessary for remote 
debugging. Until now, remote macOS debugging was treated almost identical to 
local macOS debugging. By moving in into its own class, we can have it inherit 
from PlatformRemoteDarwinDevice and all the functionality it provides, such as 
looking at the correct DeviceSupport directory.

rdar://68167374


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92452

Files:
  lldb/source/Plugins/Platform/MacOSX/CMakeLists.txt
  lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h
  lldb/test/API/commands/platform/sdk/Makefile
  lldb/test/API/commands/platform/sdk/TestPlatformSDK.py
  lldb/test/API/commands/platform/sdk/main.c

Index: lldb/test/API/commands/platform/sdk/main.c
===
--- /dev/null
+++ lldb/test/API/commands/platform/sdk/main.c
@@ -0,0 +1,7 @@
+#include 
+
+int main(int argc, char **argv) {
+  for (int i = 0; i != 10; ++i) {
+sleep(10);
+  }
+}
Index: lldb/test/API/commands/platform/sdk/TestPlatformSDK.py
===
--- /dev/null
+++ lldb/test/API/commands/platform/sdk/TestPlatformSDK.py
@@ -0,0 +1,96 @@
+import lldb
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+import os
+import platform
+import shutil
+import time
+import socket
+
+
+class PlatformSDKTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+NO_DEBUG_INFO_TESTCASE = True
+
+# The port used by debugserver.
+PORT = 54637
+
+# Time given to the binary to launch and to debugserver to attach to it.
+# The inferior will wait a total of 10 times 10 seconds so this is
+# conservative and can be increased if this is not enough on a loaded
+# system.
+TIMEOUT = 2
+
+def no_debugserver(self):
+if os.getenv('LLDB_DEBUGSERVER_PATH') is None:
+return 'no debugserver'
+return None
+
+def port_not_available(self):
+s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+if s.connect_ex(('127.0.0.1', self.PORT)) == 0:
+return '{} not available'.format(self.PORT)
+return None
+
+@no_debug_info_test
+@skipUnlessDarwin
+@expectedFailureIfFn(no_debugserver)
+@expectedFailureIfFn(port_not_available)
+def test_macos_sdk(self):
+self.build()
+exe = self.getBuildArtifact('a.out')
+
+# Create a fake 'SDK' directory.
+test_home = os.path.join(self.getBuildDir(), 'fake_home.noindex')
+macos_version = platform.mac_ver()[0]
+sdk_dir = os.path.join(test_home, 'Library', 'Developer', 'Xcode',
+   'macOS DeviceSupport', macos_version)
+symbols_dir = os.path.join(sdk_dir, 'Symbols')
+lldbutil.mkdir_p(symbols_dir)
+
+# Save the current home directory and restore it afterwards.
+old_home = os.getenv('HOME')
+
+def cleanup():
+if not old_home:
+del os.environ['HOME']
+else:
+os.environ['HOME'] = old_home
+
+self.addTearDownHook(cleanup)
+os.environ['HOME'] = test_home
+
+self.expect('platform select remote-macosx', substrs=[sdk_dir])
+
+# Launch our test binary.
+inferior = self.spawnSubprocess(exe)
+pid = inferior.pid
+
+# Give the binary time to launch.
+time.sleep(self.TIMEOUT)
+
+# Move the binary into the 'SDK'.
+rel_exe_path = os.path.relpath(exe, '/')
+exe_sdk_path = os.path.join(symbols_dir, rel_exe_path)
+lldbutil.mkdir_p(os.path.dirname(exe_sdk_path))
+shutil.move(exe, exe_sdk_path)
+
+# Attach to it with debugserver.
+debugserver = os.getenv('LLDB_DEBUGSERVER_PATH')
+debugserver_args = [
+'localhost:{}'.format(self.PORT), '--attach={}'.format(pid)
+]
+self.spawnSubprocess(debugserver, debugserver_args)
+
+# Give debugserver time to attach.
+time.sleep(self.TIMEOUT)
+
+# Connect to debugserver
+self.runCmd('gdb-remote {}'.format(self.PORT))
+
+# Make sure the image was loaded from the 'SDK'.
+self.expect('image list', substrs=[exe_sdk_path])
Index: lldb/test/API/commands/platform/sdk/Makefile
===
--- /dev/null
+++ 

[Lldb-commits] [lldb] ce5e218 - [lldb] Fix build after found_decls was removed by 1f40d60a3b7f310ff3f77bb8643a27d979a703cb

2020-12-01 Thread Fangrui Song via lldb-commits

Author: Fangrui Song
Date: 2020-12-01T19:14:35-08:00
New Revision: ce5e21868c22479df62ebd8884adc1bd7c964433

URL: 
https://github.com/llvm/llvm-project/commit/ce5e21868c22479df62ebd8884adc1bd7c964433
DIFF: 
https://github.com/llvm/llvm-project/commit/ce5e21868c22479df62ebd8884adc1bd7c964433.diff

LOG: [lldb] Fix build after found_decls was removed by 
1f40d60a3b7f310ff3f77bb8643a27d979a703cb

Added: 


Modified: 
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index bab50a3b068c..ca109ef9c2fc 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -148,10 +148,11 @@ void addOverridesForMethod(clang::CXXMethodDecl *decl) {
 return;
 
   clang::CXXBasePaths paths;
+  llvm::SmallVector decls;
 
   auto find_overridden_methods =
-  [decl](const clang::CXXBaseSpecifier *specifier,
- clang::CXXBasePath ) {
+  [, decl](const clang::CXXBaseSpecifier *specifier,
+ clang::CXXBasePath ) {
 if (auto *base_record = llvm::dyn_cast(
 specifier->getType()->getAs()->getDecl())) {
 
@@ -163,6 +164,7 @@ void addOverridesForMethod(clang::CXXMethodDecl *decl) {
 if (auto *baseDtorDecl = base_record->getDestructor()) {
   if (baseDtorDecl->isVirtual()) {
 path.Decls = baseDtorDecl;
+decls.push_back(baseDtorDecl);
 return true;
   } else
 return false;
@@ -175,6 +177,7 @@ void addOverridesForMethod(clang::CXXMethodDecl *decl) {
 llvm::dyn_cast(path.Decls.front()))
   if (method_decl->isVirtual() && !isOverload(decl, method_decl)) {
 path.Decls = method_decl;
+decls.push_back(method_decl);
 return true;
   }
   }
@@ -184,7 +187,7 @@ void addOverridesForMethod(clang::CXXMethodDecl *decl) {
   };
 
   if (decl->getParent()->lookupInBases(find_overridden_methods, paths)) {
-for (auto *overridden_decl : paths.found_decls())
+for (auto *overridden_decl : decls)
   decl->addOverriddenMethod(
   llvm::cast(overridden_decl));
   }



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] fa7fabb - [LLDB] Rename duplicate TestAlignAsBaseClass.py

2020-12-01 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2020-12-02T07:31:29+05:00
New Revision: fa7fabb644f8645442cbe42c78420240b6657160

URL: 
https://github.com/llvm/llvm-project/commit/fa7fabb644f8645442cbe42c78420240b6657160
DIFF: 
https://github.com/llvm/llvm-project/commit/fa7fabb644f8645442cbe42c78420240b6657160.diff

LOG: [LLDB] Rename duplicate TestAlignAsBaseClass.py

lldb-dotest breaks due to duplicate TestAlignAsBaseClass.py. I have
renamed later version to TestAlignAsBaseClassNonTemplateParam.py.

Added: 

lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClassNonTemplateParam.py

Modified: 


Removed: 
lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClass.py



diff  --git 
a/lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClass.py 
b/lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClassNonTemplateParam.py
similarity index 100%
rename from 
lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClass.py
rename to 
lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClassNonTemplateParam.py



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] e1f613c - [lldb] [test] Reenable two passing tests on FreeBSD

2020-12-01 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2020-12-01T23:25:45+01:00
New Revision: e1f613ce3c61d0664fd3cff663f290cf1c2b9696

URL: 
https://github.com/llvm/llvm-project/commit/e1f613ce3c61d0664fd3cff663f290cf1c2b9696
DIFF: 
https://github.com/llvm/llvm-project/commit/e1f613ce3c61d0664fd3cff663f290cf1c2b9696.diff

LOG: [lldb] [test] Reenable two passing tests on FreeBSD

[Reenable TestReproducerAttach and TestThreadSpecificBpPlusCondition
on FreeBSD -- both seem to pass correctly now.

Added: 


Modified: 
lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py

lldb/test/API/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py 
b/lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py
index e6bb9c6a1672..a1cfcd20013e 100644
--- a/lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py
+++ b/lldb/test/API/functionalities/reproducers/attach/TestReproducerAttach.py
@@ -15,7 +15,6 @@ class ReproducerAttachTestCase(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 NO_DEBUG_INFO_TESTCASE = True
 
-@skipIfFreeBSD
 @skipIfNetBSD
 @skipIfWindows
 @skipIfRemote

diff  --git 
a/lldb/test/API/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
 
b/lldb/test/API/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
index 126ad9e97ee5..ee7398ae5dfc 100644
--- 
a/lldb/test/API/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
+++ 
b/lldb/test/API/functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py
@@ -16,10 +16,8 @@ class ThreadSpecificBreakPlusConditionTestCase(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 # test frequently times out or hangs
-@skipIf(oslist=['windows', 'freebsd'])
 @skipIfDarwin
 # hits break in another thread in testrun
-@expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr18522')
 @add_test_categories(['pyapi'])
 @expectedFailureAll(oslist=['ios', 'watchos', 'tvos', 'bridgeos'], 
archs=['armv7', 'armv7k'], bugnumber='rdar://problem/34563348') # Two threads 
seem to end up with the same my_value when built for armv7.
 @expectedFailureNetBSD



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D91241: [LLDB] Make offset field optional in RegisterInfo packet for Arm64

2020-12-01 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG78cb4562faa7: Make offset field optional in RegisterInfo 
packet for Arm64 (authored by omjavaid).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91241/new/

https://reviews.llvm.org/D91241

Files:
  lldb/include/lldb/Host/common/NativeRegisterContext.h
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py
  
lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
  lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
  lldb/unittests/tools/lldb-server/tests/TestClient.cpp

Index: lldb/unittests/tools/lldb-server/tests/TestClient.cpp
===
--- lldb/unittests/tools/lldb-server/tests/TestClient.cpp
+++ lldb/unittests/tools/lldb-server/tests/TestClient.cpp
@@ -219,6 +219,7 @@
 }
 
 Error TestClient::qRegisterInfos() {
+  uint32_t reg_offset = 0;
   for (unsigned int Reg = 0;; ++Reg) {
 std::string Message = formatv("qRegisterInfo{0:x-}", Reg).str();
 Expected InfoOr = SendMessage(Message);
@@ -227,6 +228,12 @@
   break;
 }
 m_register_infos.emplace_back(std::move(*InfoOr));
+
+if (m_register_infos[Reg].byte_offset == LLDB_INVALID_INDEX32)
+  m_register_infos[Reg].byte_offset = reg_offset;
+
+reg_offset =
+m_register_infos[Reg].byte_offset + m_register_infos[Reg].byte_size;
 if (m_register_infos[Reg].kinds[eRegisterKindGeneric] ==
 LLDB_REGNUM_GENERIC_PC)
   m_pc_register = Reg;
Index: lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
===
--- lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
+++ lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
@@ -171,7 +171,7 @@
   Info.byte_size /= CHAR_BIT;
 
   if (!to_integer(Elements["offset"], Info.byte_offset, 10))
-return make_parsing_error("qRegisterInfo: offset");
+Info.byte_offset = LLDB_INVALID_INDEX32;
 
   Info.encoding = Args::StringToEncoding(Elements["encoding"]);
   if (Info.encoding == eEncodingInvalid)
Index: lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
===
--- lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
+++ lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
@@ -65,5 +65,8 @@
 self.assertEqual(q_info_reg["set"], xml_info_reg.get("group"))
 self.assertEqual(q_info_reg["format"], xml_info_reg.get("format"))
 self.assertEqual(q_info_reg["bitsize"], xml_info_reg.get("bitsize"))
-self.assertEqual(q_info_reg["offset"], xml_info_reg.get("offset"))
+
+if not self.getArchitecture() == 'aarch64':
+self.assertEqual(q_info_reg["offset"], xml_info_reg.get("offset"))
+
 self.assertEqual(q_info_reg["encoding"], xml_info_reg.get("encoding"))
Index: lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py
===
--- /dev/null
+++ lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py
@@ -0,0 +1,151 @@
+from __future__ import print_function
+from textwrap import dedent
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from gdbclientutils import *
+
+
+class MyResponder(MockGDBServerResponder):
+def qXferRead(self, obj, annex, offset, length):
+if annex == "target.xml":
+return dedent("""\
+
+  
+aarch64
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  

[Lldb-commits] [PATCH] D92063: [LLDB] RegisterInfoPOSIX_arm64 remove unused bytes from g/G packet

2020-12-01 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG26b8ea2e3782: RegisterInfoPOSIX_arm64 remove unused bytes 
from g/G packet (authored by omjavaid).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92063/new/

https://reviews.llvm.org/D92063

Files:
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h


Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
===
--- lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
+++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
@@ -29,6 +29,7 @@
   };
 
   // based on RegisterContextDarwin_arm64.h
+  LLVM_PACKED_START
   struct GPR {
 uint64_t x[29]; // x0-x28
 uint64_t fp;// x29
@@ -37,6 +38,7 @@
 uint64_t pc;// pc
 uint32_t cpsr;  // cpsr
   };
+  LLVM_PACKED_END
 
   // based on RegisterContextDarwin_arm64.h
   struct VReg {
Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
@@ -95,6 +95,10 @@
 
   void *GetGPRBuffer() override { return _gpr_arm64; }
 
+  // GetGPRBufferSize returns sizeof arm64 GPR ptrace buffer, it is different
+  // from GetGPRSize which returns sizeof RegisterInfoPOSIX_arm64::GPR.
+  size_t GetGPRBufferSize() { return sizeof(m_gpr_arm64); }
+
   void *GetFPRBuffer() override { return _fpr; }
 
   size_t GetFPRSize() override { return sizeof(m_fpr); }
@@ -106,7 +110,7 @@
 
   bool m_sve_header_is_valid;
 
-  RegisterInfoPOSIX_arm64::GPR m_gpr_arm64; // 64-bit general purpose 
registers.
+  struct user_pt_regs m_gpr_arm64; // 64-bit general purpose registers.
 
   RegisterInfoPOSIX_arm64::FPU
   m_fpr; // floating-point registers including extended register sets.
Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -936,9 +936,9 @@
 
   struct iovec ioVec;
   ioVec.iov_base = GetGPRBuffer();
-  ioVec.iov_len = GetGPRSize();
+  ioVec.iov_len = GetGPRBufferSize();
 
-  error = ReadRegisterSet(, GetGPRSize(), NT_PRSTATUS);
+  error = ReadRegisterSet(, GetGPRBufferSize(), NT_PRSTATUS);
 
   if (error.Success())
 m_gpr_is_valid = true;
@@ -953,11 +953,11 @@
 
   struct iovec ioVec;
   ioVec.iov_base = GetGPRBuffer();
-  ioVec.iov_len = GetGPRSize();
+  ioVec.iov_len = GetGPRBufferSize();
 
   m_gpr_is_valid = false;
 
-  return WriteRegisterSet(, GetGPRSize(), NT_PRSTATUS);
+  return WriteRegisterSet(, GetGPRBufferSize(), NT_PRSTATUS);
 }
 
 Status NativeRegisterContextLinux_arm64::ReadFPR() {


Index: lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
===
--- lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
+++ lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
@@ -29,6 +29,7 @@
   };
 
   // based on RegisterContextDarwin_arm64.h
+  LLVM_PACKED_START
   struct GPR {
 uint64_t x[29]; // x0-x28
 uint64_t fp;// x29
@@ -37,6 +38,7 @@
 uint64_t pc;// pc
 uint32_t cpsr;  // cpsr
   };
+  LLVM_PACKED_END
 
   // based on RegisterContextDarwin_arm64.h
   struct VReg {
Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
@@ -95,6 +95,10 @@
 
   void *GetGPRBuffer() override { return _gpr_arm64; }
 
+  // GetGPRBufferSize returns sizeof arm64 GPR ptrace buffer, it is different
+  // from GetGPRSize which returns sizeof RegisterInfoPOSIX_arm64::GPR.
+  size_t GetGPRBufferSize() { return sizeof(m_gpr_arm64); }
+
   void *GetFPRBuffer() override { return _fpr; }
 
   size_t GetFPRSize() override { return sizeof(m_fpr); }
@@ -106,7 +110,7 @@
 
   bool m_sve_header_is_valid;
 
-  RegisterInfoPOSIX_arm64::GPR m_gpr_arm64; // 64-bit general purpose registers.
+  struct user_pt_regs m_gpr_arm64; // 64-bit general purpose registers.
 
   RegisterInfoPOSIX_arm64::FPU
   m_fpr; // floating-point registers including extended register sets.
Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- 

[Lldb-commits] [lldb] 78cb456 - Make offset field optional in RegisterInfo packet for Arm64

2020-12-01 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2020-12-02T03:19:43+05:00
New Revision: 78cb4562faa7315fff030593bc6bca4dc033f803

URL: 
https://github.com/llvm/llvm-project/commit/78cb4562faa7315fff030593bc6bca4dc033f803
DIFF: 
https://github.com/llvm/llvm-project/commit/78cb4562faa7315fff030593bc6bca4dc033f803.diff

LOG: Make offset field optional in RegisterInfo packet for Arm64

This patch carries forward our aim to remove offset field from qRegisterInfo
packets and XML register description. I have created a new function which
returns if offset fields are dynamic meaning client can calculate offset on
its own based on register number sequence and register size. For now this
function only returns true for NativeRegisterContextLinux_arm64 but we can
test this for other architectures and make it standard later.

As a consequence we do not send offset field from lldb-server (arm64 for now)
while other stubs dont have an offset field so it wont effect them for now.
On the client side we have replaced previous offset calculation algorithm
with a new scheme, where we sort all primary registers in increasing
order of remote regnum and then calculate offset incrementally.

This committ also includes a test to verify all of above functionality
on Arm64.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D91241

Added: 
lldb/test/API/functionalities/gdb_remote_client/TestAArch64XMLRegOffsets.py

Modified: 
lldb/include/lldb/Host/common/NativeRegisterContext.h
lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

lldb/test/API/tools/lldb-server/registers-target-xml-reading/TestGdbRemoteTargetXmlPacket.py
lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
lldb/unittests/tools/lldb-server/tests/TestClient.cpp

Removed: 




diff  --git a/lldb/include/lldb/Host/common/NativeRegisterContext.h 
b/lldb/include/lldb/Host/common/NativeRegisterContext.h
index a8c74358c718..f7568fe31b80 100644
--- a/lldb/include/lldb/Host/common/NativeRegisterContext.h
+++ b/lldb/include/lldb/Host/common/NativeRegisterContext.h
@@ -121,6 +121,8 @@ class NativeRegisterContext
   virtual std::vector
   GetExpeditedRegisters(ExpeditedRegs expType) const;
 
+  virtual bool RegisterOffsetIsDynamic() const { return false; }
+
   const RegisterInfo *GetRegisterInfoByName(llvm::StringRef reg_name,
 uint32_t start_idx = 0);
 

diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index a1c420d1fa03..2f278289988c 100644
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -664,7 +664,10 @@ def assert_valid_reg_info(self, reg_info):
 # Check the bare-minimum expected set of register info keys.
 self.assertTrue("name" in reg_info)
 self.assertTrue("bitsize" in reg_info)
-self.assertTrue("offset" in reg_info)
+
+if not self.getArchitecture() == 'aarch64':
+self.assertTrue("offset" in reg_info)
+
 self.assertTrue("encoding" in reg_info)
 self.assertTrue("format" in reg_info)
 

diff  --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
index 9ba8c7699a56..344eae247e91 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
@@ -47,6 +47,8 @@ class NativeRegisterContextLinux_arm64 : public 
NativeRegisterContextLinux {
   std::vector
   GetExpeditedRegisters(ExpeditedRegs expType) const override;
 
+  bool RegisterOffsetIsDynamic() const override { return true; }
+
   // Hardware breakpoints/watchpoint management functions
 
   uint32_t NumSupportedHardwareBreakpoints() override;

diff  --git a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp 
b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
index fd9e1923104d..71e9b5ea4b2a 100644
--- a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -428,9 +428,6 @@ void DynamicRegisterInfo::AddRegister(RegisterInfo 
_info,
   assert(set < m_set_reg_nums.size());
   assert(set < m_set_names.size());
   m_set_reg_nums[set].push_back(reg_num);
-  size_t end_reg_offset = reg_info.byte_offset + 

[Lldb-commits] [lldb] 26b8ea2 - RegisterInfoPOSIX_arm64 remove unused bytes from g/G packet

2020-12-01 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2020-12-02T03:19:39+05:00
New Revision: 26b8ea2e3782890be96612701866d8ccec616bdc

URL: 
https://github.com/llvm/llvm-project/commit/26b8ea2e3782890be96612701866d8ccec616bdc
DIFF: 
https://github.com/llvm/llvm-project/commit/26b8ea2e3782890be96612701866d8ccec616bdc.diff

LOG: RegisterInfoPOSIX_arm64 remove unused bytes from g/G packet

This came up while putting together our new strategy to create g/G packets
in compliance with GDB RSP protocol where register offsets are calculated in
increasing order of register numbers without any unused spacing.

RegisterInfoPOSIX_arm64::GPR size was being calculated after alignment
correction to 8 bytes which meant there was a 4 bytes unused space between
last gpr (cpsr) and first vector register V. We have put LLVM_PACKED_START
decorator on RegisterInfoPOSIX_arm64::GPR to make sure single byte
alignment is enforced. Moreover we are now doing to use arm64 user_pt_regs
struct defined in ptrace.h for accessing ptrace user registers.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D92063

Added: 


Modified: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index 49badd8ef940..6b2dd25ba44d 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -936,9 +936,9 @@ Status NativeRegisterContextLinux_arm64::ReadGPR() {
 
   struct iovec ioVec;
   ioVec.iov_base = GetGPRBuffer();
-  ioVec.iov_len = GetGPRSize();
+  ioVec.iov_len = GetGPRBufferSize();
 
-  error = ReadRegisterSet(, GetGPRSize(), NT_PRSTATUS);
+  error = ReadRegisterSet(, GetGPRBufferSize(), NT_PRSTATUS);
 
   if (error.Success())
 m_gpr_is_valid = true;
@@ -953,11 +953,11 @@ Status NativeRegisterContextLinux_arm64::WriteGPR() {
 
   struct iovec ioVec;
   ioVec.iov_base = GetGPRBuffer();
-  ioVec.iov_len = GetGPRSize();
+  ioVec.iov_len = GetGPRBufferSize();
 
   m_gpr_is_valid = false;
 
-  return WriteRegisterSet(, GetGPRSize(), NT_PRSTATUS);
+  return WriteRegisterSet(, GetGPRBufferSize(), NT_PRSTATUS);
 }
 
 Status NativeRegisterContextLinux_arm64::ReadFPR() {

diff  --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
index 3d0656dceb62..9ba8c7699a56 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
@@ -95,6 +95,10 @@ class NativeRegisterContextLinux_arm64 : public 
NativeRegisterContextLinux {
 
   void *GetGPRBuffer() override { return _gpr_arm64; }
 
+  // GetGPRBufferSize returns sizeof arm64 GPR ptrace buffer, it is 
diff erent
+  // from GetGPRSize which returns sizeof RegisterInfoPOSIX_arm64::GPR.
+  size_t GetGPRBufferSize() { return sizeof(m_gpr_arm64); }
+
   void *GetFPRBuffer() override { return _fpr; }
 
   size_t GetFPRSize() override { return sizeof(m_fpr); }
@@ -106,7 +110,7 @@ class NativeRegisterContextLinux_arm64 : public 
NativeRegisterContextLinux {
 
   bool m_sve_header_is_valid;
 
-  RegisterInfoPOSIX_arm64::GPR m_gpr_arm64; // 64-bit general purpose 
registers.
+  struct user_pt_regs m_gpr_arm64; // 64-bit general purpose registers.
 
   RegisterInfoPOSIX_arm64::FPU
   m_fpr; // floating-point registers including extended register sets.

diff  --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h 
b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
index 37f7c23b62c5..1cbed5acb41c 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
+++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
@@ -29,6 +29,7 @@ class RegisterInfoPOSIX_arm64
   };
 
   // based on RegisterContextDarwin_arm64.h
+  LLVM_PACKED_START
   struct GPR {
 uint64_t x[29]; // x0-x28
 uint64_t fp;// x29
@@ -37,6 +38,7 @@ class RegisterInfoPOSIX_arm64
 uint64_t pc;// pc
 uint32_t cpsr;  // cpsr
   };
+  LLVM_PACKED_END
 
   // based on RegisterContextDarwin_arm64.h
   struct VReg {



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D92187: [lldb] [FreeBSD] Fix establishing DT_NEEDED libraries from dyld

2020-12-01 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

In D92187#2425378 , @labath wrote:

> In D92187#2425301 , @mgorny wrote:
>
>> I've added some more debug as requested, and it confirmed that Linux and 
>> FreeBSD dyld are behaving differently here.
>>
>> Linux triggers the breakpoint twice: first time in `add` state, including 
>> only `/lib64/ld-linux-x86-64.so.2` and `linux-vdso.so.1` in module list, and 
>> the second time in `consistent` state, adding soentries for all shared 
>> libraries.
>>
>> FreeBSD triggers it only once, in `consistent` state and the remote list 
>> includes all libraries immediately
>
> Thanks for investigating this. And I'm sorry for being so picky -- this is 
> all very messy, and I am trying to understand things to avoid making an even 
> bigger mess.
>
> When you say "FreeBSD triggers it only once", which breakpoint are you 
> referring to? The "rendezvous" breakpoint? Judging by the log's, I would say 
> yes.

Yes.

> But if that's true, then how does the "entry" breakpoint fit into this 
> picture (IIUC, your change basically forces setting of the entry breakpoint 
> on freebsd)? The question I'm looking to answer is whether we really need to 
> set the entry breakpoint, or we just need some side-effect of what happens 
> when we process that breakpoint hit (and we could achieve that differently).

It's not really about setting the breakpoint (it actually doesn't get set again 
because it's set already) but about registering the loaded libraries. I've 
presumed there's no harm in reusing the existing function as-is, i.e. issuing 
the unnecessary breakpoint call.

However, as I've noted on iRC, assuming the libraries reported on first 
rendezvous breakpoint to be 'added' would be a better solution. Most 
importantly, it fixes handling breakpoints in global constructors. I mean 
something like this:

  diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp 
b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  index 866acbddbdc..ad696995f9a 100644
  --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
  @@ -296,8 +296,10 @@ bool DYLDRendezvous::SaveSOEntriesFromRemote(
 return false;
   
   // Only add shared libraries and not the executable.
  -if (!SOEntryIsMainExecutable(entry))
  +if (!SOEntryIsMainExecutable(entry)) {
  +  m_added_soentries.push_back(entry);
 m_soentries.push_back(entry);
  +}
 }
   
 m_loaded_modules = module_list;

I would appreciate any advice how to turn that hack into a proper-ish solution.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92187/new/

https://reviews.llvm.org/D92187

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D92103: [ASTImporter] Import the default argument of TemplateTypeParmDecl

2020-12-01 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

@gamesh411 I recreated the setup you listed (thanks for that btw) but for me 
this works just fine. I assume the crash happens in a class template from one 
of the external libraries. It probably works for me because I don't have the 
same library version as you have, but just from the backtrace it's hard to know 
where the error could come from.

I'm not sure if the XTU analyzer has a way to create reproducers (maybe 
@martong knows), but if you could apply the patch below, recompile/run the 
analyzer and post the output that would help a lot with figuring out what code 
on your system is causing the crash:

  diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
  index 67ee8c0956d6..a471501aa71e 100644
  --- a/clang/lib/AST/ASTContext.cpp
  +++ b/clang/lib/AST/ASTContext.cpp
  @@ -4408,6 +4408,9 @@ static bool NeedsInjectedClassNameType(const RecordDecl 
*D) {
   /// injected class name type for the specified templated declaration.
   QualType ASTContext::getInjectedClassNameType(CXXRecordDecl *Decl,
 QualType TST) const {
  +  if (!NeedsInjectedClassNameType(Decl)) {
  +Decl->dumpColor();
  +  }
 assert(NeedsInjectedClassNameType(Decl));
 if (Decl->TypeForDecl) {
   assert(isa(Decl->TypeForDecl));

The output from this code is probably colorized in your terminal and looks a 
bit like this:

  |-ClassTemplateDecl 0x7ff94c04a0a0  line:1:36 A
  | |-TemplateTypeParmDecl 0x7ff94c049f50  col:26 referenced 
typename depth 0 index 0 T
  | |-CXXRecordDecl 0x7ff94c04a010  line:1:36 struct A 
definition
  | | |-DefinitionData empty standard_layout trivially_copyable 
has_user_declared_ctor can_const_default_init
  | | | |-DefaultConstructor defaulted_is_constexpr
  | | | |-CopyConstructor simple trivial has_const_param needs_implicit 
implicit_has_const_param
  | | | |-MoveConstructor exists simple trivial needs_implicit
  [...]

FWIW, I don't think the patch itself introduces this regression, but it just 
causes more of the AST to be imported (and the import of these AST nodes then 
runs into an unsupported use case). This would most likely already crash if the 
analysed source code referenced that class template in some other way.




Comment at: 
lldb/test/API/commands/expression/import-std-module/deque-basic/TestDequeFromStdModule.py:25
 
-deque_type = "std::deque >"
 size_type = deque_type + "::size_type"

shafik wrote:
> Why do the default arguments not show up in the results anymore?
Because we don't show args that match the default arg in the display type 
(which is identical to what Clang does). See also rdar://59292534


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92103/new/

https://reviews.llvm.org/D92103

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 64f0462 - [lldb][NFC] Modernize and cleanup TestClassTemplateParameterPack

2020-12-01 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-12-01T15:53:40+01:00
New Revision: 64f04629aa7a4cf9d2deb725683959faa4a857fe

URL: 
https://github.com/llvm/llvm-project/commit/64f04629aa7a4cf9d2deb725683959faa4a857fe
DIFF: 
https://github.com/llvm/llvm-project/commit/64f04629aa7a4cf9d2deb725683959faa4a857fe.diff

LOG: [lldb][NFC] Modernize and cleanup TestClassTemplateParameterPack

* Un-inline the test.
* Use expect_expr everywhere and also check all involved types.
* Clang-format the test sources.
* Explain what we're actually testing with the 'C' and 'D' templates.
* Split out the non-template-parameter-pack part of the test into its own small 
test.

Added: 
lldb/test/API/lang/cpp/class-template-parameter-pack/Makefile
lldb/test/API/lang/cpp/non-type-template-param/Makefile
lldb/test/API/lang/cpp/non-type-template-param/TestAlignAsBaseClass.py
lldb/test/API/lang/cpp/non-type-template-param/main.cpp

Modified: 

lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp

Removed: 




diff  --git a/lldb/test/API/lang/cpp/class-template-parameter-pack/Makefile 
b/lldb/test/API/lang/cpp/class-template-parameter-pack/Makefile
new file mode 100644
index ..8b20bcb0
--- /dev/null
+++ b/lldb/test/API/lang/cpp/class-template-parameter-pack/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules

diff  --git 
a/lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
 
b/lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
index 7e67f73b7092..e0497b62f55c 100644
--- 
a/lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
+++ 
b/lldb/test/API/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
@@ -1,7 +1,38 @@
-from lldbsuite.test import lldbinline
-from lldbsuite.test import decorators
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
 
-lldbinline.MakeInlineTest(
-__file__, globals(), [
-decorators.expectedFailureAll(
-compiler="gcc")])
+class TestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@expectedFailureAll(compiler="gcc")
+def test(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self, "// break here", 
lldb.SBFileSpec("main.cpp"))
+
+# Test non-type template parameter packs.
+self.expect_expr("myC", result_type="C", result_children=[
+ValueCheck(name="C", children=[
+ValueCheck(name="member", value="64")
+])
+])
+self.expect_expr("myLesserC.argsAre_16_32()", result_value="false")
+self.expect_expr("myC.argsAre_16_32()", result_value="true")
+
+# Test type template parameter packs.
+self.expect_expr("myD", result_type="D", 
result_children=[
+ValueCheck(name="D", children=[
+ValueCheck(name="member", value="64")
+])
+])
+self.expect_expr("myLesserD.argsAre_Int_bool()", result_value="false")
+self.expect_expr("myD.argsAre_Int_bool()", result_value="true")
+
+# Disabling until we do template lookup correctly: 
http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html
+# FIXME: Rewrite this with expect_expr
+# self.expect("expression -- C().isSixteenThirtyTwo()", 
DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
+# self.expect("expression -- C().isSixteenThirtyTwo()", 
DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])
+# self.expect("expression -- D().isIntBool()", 
DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"])
+# self.expect("expression -- D().isIntBool()", 
DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"])

diff  --git a/lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp 
b/lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp
index 82f09a1f268c..8bb0a42b58a3 100644
--- a/lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp
+++ b/lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp
@@ -1,64 +1,43 @@
 template  struct C {
   T member;
-  bool isSixteenThirtyTwo() { return false; }
+  bool argsAre_16_32() { return false; }
 };
 
 template <> struct C {
   int member;
-  bool isSixteenThirtyTwo() { return false; }
+  bool argsAre_16_32() { return false; }
 };
 
 template <> struct C : C {
-  bool isSixteenThirtyTwo() { return true; }
+  bool argsAre_16_32() { return true; }
 };
 
 template  struct D {
   T member;
-  bool isIntBool() { return false; }
+  bool argsAre_Int_bool() { return false; }
 };
 
 template <> struct D {
   int member;
-  bool isIntBool() { return false; }
+  bool argsAre_Int_bool() { return false; }
 };
 
 template <> struct 

[Lldb-commits] [PATCH] D92187: [lldb] [FreeBSD] Fix establishing DT_NEEDED libraries from dyld

2020-12-01 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

Ideally we should iterate over the startup process and investigate the state of 
the `r_debug` structure. Once it gets initialized, set the software brakpoint 
to `r_brk` and keep track of the dynamic loading and unloading of libraries. 
The tricky part is to detect the right moment to plug into `r_brk`, early 
enough in the startup process before calling constructors, loading the 
libraries etc and late enough to become initialized.

Right now we place the breakpoints unconditionally, hardcoding the linker name, 
mostly ignoring the `r_brk`, but in practice it's not clear whether it's the 
simplest and sufficient approach.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92187/new/

https://reviews.llvm.org/D92187

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D82857: [LLDB] Add per-thread register infos shared pointer in gdb-remote

2020-12-01 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp:34
 ThreadGDBRemote , uint32_t concrete_frame_idx,
-GDBRemoteDynamicRegisterInfo _info, bool read_all_at_once,
+GDBRemoteDynamicRegisterInfoSP reg_info, bool read_all_at_once,
 bool write_all_at_once)

reg_info_sp



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp:36
 bool write_all_at_once)
-: RegisterContext(thread, concrete_frame_idx), m_reg_info(reg_info),
+: RegisterContext(thread, concrete_frame_idx), m_reg_info_sp(reg_info),
   m_reg_valid(), m_reg_data(), m_read_all_at_once(read_all_at_once),

nit: std::move(reg_info) (and changing the uses below to m_reg_info_sp).



Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h:43
+
+  void CloneFrom(GDBRemoteDynamicRegisterInfoSP process_reginfo);
 };

This is basically making a copy, right? Could we just use the copy constructor 
for this (maybe coupled with declaring the class `final` to avoid the 
possibility of slicing)?



Comment at: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:399-405
+  if (!m_register_info_sp)
+m_register_info_sp = std::make_shared();
+
+  if (!force && m_register_info_sp->GetNumRegisters() > 0)
 return;
 
+  m_register_info_sp->Clear();

How about:
```
if (!force &&  m_register_info_sp)
  return;
m_register_info_sp = std::make_shared();
```



Comment at: lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp:322
 
+void ThreadGDBRemote::SetThreadRegisterInfo() {
+  ProcessSP process_sp(GetProcess());

Is this going to have more callers in the future? It seems that things would be 
a lot simpler if we just did this directly in the constructor...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82857/new/

https://reviews.llvm.org/D82857

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D92314: [lldb] [Process/FreeBSDRemote] Implement GetLoadedModuleFileSpec() and GetFileLoadAddress()

2020-12-01 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

These are basically workarounds for dynamic linker bugs, when we're not able to 
get complete information via r_debug. If your dynamic linker (loader) behaves, 
then it's not surprising that they make no effect.

Implementing them is fine. It might be nice to also add some explicit tests for 
these functions (via lldb-server tests, perhaps). We should have done something 
like that when we were adding these in the first place, but we weren't so big 
on testing then...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92314/new/

https://reviews.llvm.org/D92314

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D92187: [lldb] [FreeBSD] Fix establishing DT_NEEDED libraries from dyld

2020-12-01 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D92187#2425301 , @mgorny wrote:

> I've added some more debug as requested, and it confirmed that Linux and 
> FreeBSD dyld are behaving differently here.
>
> Linux triggers the breakpoint twice: first time in `add` state, including 
> only `/lib64/ld-linux-x86-64.so.2` and `linux-vdso.so.1` in module list, and 
> the second time in `consistent` state, adding soentries for all shared 
> libraries.
>
> FreeBSD triggers it only once, in `consistent` state and the remote list 
> includes all libraries immediately

Thanks for investigating this. And I'm sorry for being so picky -- this is all 
very messy, and I am trying to understand things to avoid making an even bigger 
mess.

When you say "FreeBSD triggers it only once", which breakpoint are you 
referring to? The "rendezvous" breakpoint? Judging by the log's, I would say 
yes. But if that's true, then how does the "entry" breakpoint fit into this 
picture (IIUC, your change basically forces setting of the entry breakpoint on 
freebsd)? The question I'm looking to answer is whether we really need to set 
the entry breakpoint, or we just need some side-effect of what happens when we 
process that breakpoint hit (and we could achieve that differently).

I'm not saying that setting the entry breakpoint is a bad idea -- that 
mechanism seems more canonical than searching for some hardcoded symbol name -- 
but in order to decide that, we need to know what actually goes on in there...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92187/new/

https://reviews.llvm.org/D92187

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D92187: [lldb] [FreeBSD] Fix establishing DT_NEEDED libraries from dyld

2020-12-01 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

Full logs below.

Linux:

  (lldb) log enable lldb dyld
  (lldb) run
  lldb DynamicLoaderDarwin::UseDYLDSPI: Use old DynamicLoader plugin
  lldb DynamicLoaderDarwin::UseDYLDSPI: Use old DynamicLoader plugin
  lldb DYLDRendezvous::DYLDRendezvous exe module executable path 
set: '/home/mgorny/git/llvm-project/_build/a.out'
  lldb DynamicLoaderPOSIXDYLD::DidLaunch()
  lldb DynamicLoaderPOSIXDYLD::DidLaunch about to call ProbeEntry()
  lldb Rendezvous structure is not set up yet. Trying to locate 
rendezvous breakpoint in the interpreter by symbol name.
  lldb Successfully set rendezvous breakpoint at address 
0x77fe1850 for pid 221689
  intern-state DynamicLoaderPOSIXDYLD::RendezvousBreakpointHit called for 
pid 221689
  intern-state DYLDRendezvous::Resolve address size: 8, padding 4
  intern-state ResolveRendezvousAddress info_location = 0x
  intern-state ResolveRendezvousAddress resolved via direct object file 
approach to 0x403ee8
  intern-state ResolveRendezvousAddress reading pointer (8 bytes) from 
0x403ee8
  intern-state DYLDRendezvous::Resolve cursor = 0x77ffe0a0
  intern-state DYLDRendezvous:
  intern-stateAddress: 77ffe0a0
  intern-stateVersion: 1
  intern-stateLink   : 77ffe1a0
  intern-stateBreak  : 77fe1850
  intern-stateLDBase : 77fd1000
  intern-stateState  : add
  intern-state DYLDRendezvous::UpdateSOEntriesFromRemote action = 1
  
  intern-state DYLDRendezvous::SaveSOEntriesFromRemote soentry from module 
list: link_addr=77ffda08, base_addr=77fd1000, dyn_addr=77ffce28, 
filename=/lib64/ld-linux-x86-64.so.2
  intern-state DYLDRendezvous::SaveSOEntriesFromRemote soentry from module 
list: link_addr=77ffe750, base_addr=77fcf000, dyn_addr=77fcf3a0, 
filename=linux-vdso.so.1
  intern-state DynamicLoaderPOSIXDYLD::RendezvousBreakpointHit pid 221689 
stop_when_images_change=false
  intern-state DynamicLoaderPOSIXDYLD::RendezvousBreakpointHit called for 
pid 221689
  intern-state DYLDRendezvous::Resolve address size: 8, padding 4
  intern-state DYLDRendezvous::Resolve cursor = 0x77ffe0a0
  intern-state DYLDRendezvous:
  intern-stateAddress: 77ffe0a0
  intern-stateVersion: 1
  intern-stateLink   : 77ffe1a0
  intern-stateBreak  : 77fe1850
  intern-stateLDBase : 77fd1000
  intern-stateState  : consistent
  intern-state DYLDRendezvous SOEntries:
  intern-state 
 SOEntry [1] /lib64/ld-linux-x86-64.so.2
  intern-state   Base : 77fd1000
  intern-state   Path : 0
  intern-state   Dyn  : 77ffce28
  intern-state   Next : 0
  intern-state   Prev : 0
  intern-state 
 SOEntry [2] linux-vdso.so.1
  intern-state   Base : 77fcf000
  intern-state   Path : 0
  intern-state   Dyn  : 77fcf3a0
  intern-state   Next : 0
  intern-state   Prev : 0
  intern-state DYLDRendezvous::UpdateSOEntriesFromRemote action = 2
  
  intern-state DYLDRendezvous::AddSOEntriesFromRemote add soentry: 
link_addr=77f8c000, base_addr=77f4f000, dyn_addr=77f86cb0, 
filename=/lib64/libedit.so.0
  intern-state DYLDRendezvous::AddSOEntriesFromRemote add soentry: 
link_addr=77f8c4f0, base_addr=77d88000, dyn_addr=77f48b60, 
filename=/lib64/libc.so.6
  intern-state DYLDRendezvous::AddSOEntriesFromRemote add soentry: 
link_addr=77f8c9e0, base_addr=77d4c000, dyn_addr=77d85cc8, 
filename=/lib64/libtinfo.so.6
  intern-state DynamicLoaderPOSIXDYLD::RendezvousBreakpointHit pid 221689 
stop_when_images_change=false
  Hello, world!
  Process 221689 exited with status = 0 (0x) 
  
  Process 221689 launched: '/home/mgorny/git/llvm-project/_build/a.out' (x86_64)

FreeBSD:

  (lldb) run
  lldb DynamicLoaderDarwin::UseDYLDSPI: Use old DynamicLoader plugin
  lldb DynamicLoaderDarwin::UseDYLDSPI: Use old DynamicLoader plugin
  lldb DYLDRendezvous::DYLDRendezvous exe module executable path 
set: '/home/mgorny/llvm-project/_build/a.out'
  lldb DynamicLoaderPOSIXDYLD::DidLaunch()
  lldb DynamicLoaderPOSIXDYLD::DidLaunch about to call ProbeEntry()
  lldb Rendezvous structure is not set up yet. Trying to locate 
rendezvous breakpoint in the interpreter by symbol name.
  lldb Successfully set rendezvous breakpoint at address 
0x80020fe20 for pid 3770
  intern-state DynamicLoaderPOSIXDYLD::RendezvousBreakpointHit called for 
pid 3770
  intern-state DYLDRendezvous::Resolve address size: 8, padding 4
  intern-state ResolveRendezvousAddress info_location = 0x
  intern-state ResolveRendezvousAddress resolved via direct object file 
approach to 

[Lldb-commits] [PATCH] D92187: [lldb] [FreeBSD] Fix establishing DT_NEEDED libraries from dyld

2020-12-01 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

I've added some more debug as requested, and it confirmed that Linux and 
FreeBSD dyld are behaving differently here.

Linux triggers the breakpoint twice: first time in `add` state, including only 
`/lib64/ld-linux-x86-64.so.2` and `linux-vdso.so.1` in module list, and the 
second time in `consistent` state, adding soentries for all shared libraries.

FreeBSD triggers it only once, in `consistent` state and the remote list 
includes all libraries immediately.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92187/new/

https://reviews.llvm.org/D92187

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D92249: [LLDB/Python] Fix segfault on Python scripted breakpoints

2020-12-01 Thread Pedro Tammela via Phabricator via lldb-commits
tammela updated this revision to Diff 308608.
tammela added a comment.

Addressing comments


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92249/new/

https://reviews.llvm.org/D92249

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint_lua.test

Index: lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint_lua.test
===
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint_lua.test
@@ -0,0 +1,8 @@
+# REQUIRES: python
+# UNSUPPORTED: lldb-repro
+#
+# RUN: cat %s | %lldb --script-language lua 2>&1 | FileCheck %s
+b main
+breakpoint command add -s python -o 'print(frame); return False'
+run
+# CHECK: frame #0
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -7,6 +7,7 @@
 //===--===//
 
 #include "lldb/Host/Config.h"
+#include "lldb/lldb-enumerations.h"
 
 #if LLDB_ENABLE_PYTHON
 
@@ -214,6 +215,12 @@
 LLDBSWIGPython_GetDynamicSetting(void *module, const char *setting,
  const lldb::TargetSP _sp);
 
+static ScriptInterpreterPythonImpl *GetPythonInterpreter(Debugger ) {
+  ScriptInterpreter *script_interpreter =
+  debugger.GetScriptInterpreter(true, lldb::eScriptLanguagePython);
+  return static_cast(script_interpreter);
+}
+
 static bool g_initialized = false;
 
 namespace {
@@ -1825,11 +1832,10 @@
 return {};
 
   Debugger  = thread_plan_sp->GetTarget().GetDebugger();
-  ScriptInterpreter *script_interpreter = debugger.GetScriptInterpreter();
   ScriptInterpreterPythonImpl *python_interpreter =
-  static_cast(script_interpreter);
+  GetPythonInterpreter(debugger);
 
-  if (!script_interpreter)
+  if (!python_interpreter)
 return {};
 
   void *ret_val;
@@ -1929,11 +1935,10 @@
 return StructuredData::GenericSP();
 
   Debugger  = bkpt_sp->GetTarget().GetDebugger();
-  ScriptInterpreter *script_interpreter = debugger.GetScriptInterpreter();
   ScriptInterpreterPythonImpl *python_interpreter =
-  static_cast(script_interpreter);
+  GetPythonInterpreter(debugger);
 
-  if (!script_interpreter)
+  if (!python_interpreter)
 return StructuredData::GenericSP();
 
   void *ret_val;
@@ -2003,11 +2008,10 @@
 return StructuredData::GenericSP();
   }
 
-  ScriptInterpreter *script_interpreter = m_debugger.GetScriptInterpreter();
   ScriptInterpreterPythonImpl *python_interpreter =
-  static_cast(script_interpreter);
+  GetPythonInterpreter(m_debugger);
 
-  if (!script_interpreter) {
+  if (!python_interpreter) {
 error.SetErrorString("No script interpreter for scripted stop-hook.");
 return StructuredData::GenericSP();
   }
@@ -2103,11 +2107,10 @@
 return StructuredData::ObjectSP();
 
   Debugger  = target->GetDebugger();
-  ScriptInterpreter *script_interpreter = debugger.GetScriptInterpreter();
   ScriptInterpreterPythonImpl *python_interpreter =
-  (ScriptInterpreterPythonImpl *)script_interpreter;
+  GetPythonInterpreter(debugger);
 
-  if (!script_interpreter)
+  if (!python_interpreter)
 return StructuredData::ObjectSP();
 
   void *ret_val = nullptr;
@@ -2274,11 +2277,10 @@
 return true;
 
   Debugger  = target->GetDebugger();
-  ScriptInterpreter *script_interpreter = debugger.GetScriptInterpreter();
   ScriptInterpreterPythonImpl *python_interpreter =
-  (ScriptInterpreterPythonImpl *)script_interpreter;
+  GetPythonInterpreter(debugger);
 
-  if (!script_interpreter)
+  if (!python_interpreter)
 return true;
 
   if (python_function_name && python_function_name[0]) {
@@ -2340,11 +2342,10 @@
 return true;
 
   Debugger  = target->GetDebugger();
-  ScriptInterpreter *script_interpreter = debugger.GetScriptInterpreter();
   ScriptInterpreterPythonImpl *python_interpreter =
-  (ScriptInterpreterPythonImpl *)script_interpreter;
+  GetPythonInterpreter(debugger);
 
-  if (!script_interpreter)
+  if (!python_interpreter)
 return true;
 
   if (python_function_name && python_function_name[0]) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D92187: [lldb] [FreeBSD] Fix establishing DT_NEEDED libraries from dyld

2020-12-01 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

In D92187#2424109 , @emaste wrote:

>> One thing that FreeBSD should do, is to upgrade to the protocol version 1 
>> (stored in r_version), like Linux, NetBSD and OpenBSD.
>
> It looks like Linux has always used r_version=1 (since 1995).
>
> AFAICT we can just add r_ldbase and set version to 1.
> See https://reviews.freebsd.org/D27429

I propose to add `#define R_DEBUG_VERSION 1` too, to keep compat with NetBSD 
(and SunOS?).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92187/new/

https://reviews.llvm.org/D92187

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits