[Lldb-commits] [PATCH] D61333: [ASTImporter] Fix LLDB lookup in transparent ctx and with ext src

2019-07-12 Thread Gabor Marton via Phabricator via lldb-commits
martong added a comment.

@shafik @jingham This is a polite Ping.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61333



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


[Lldb-commits] [PATCH] D63813: Adjust variable formatting table

2019-07-12 Thread Lukas Böger via Phabricator via lldb-commits
lubgr added a comment.

Gentle ping...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D63813



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


[Lldb-commits] [lldb] r365908 - [lldb] Let table gen create command option initializers.

2019-07-12 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Jul 12 08:30:55 2019
New Revision: 365908

URL: http://llvm.org/viewvc/llvm-project?rev=365908&view=rev
Log:
[lldb] Let table gen create command option initializers.

Summary:
We currently have man large arrays containing initializers for our command 
options.
These tables are tricky maintain as we don't have any good place to check them 
for consistency and
it's also hard to read (`nullptr, {}, 0` is not very descriptive).

This patch fixes this by letting table gen generate those tables. This way we 
can have a more readable
syntax for this (especially for all the default arguments) and we can let 
TableCheck check them
for consistency (e.g. an option with an optional argument can't have 
`eArgTypeNone`, naming of flags', etc.).

Also refactoring the related data structures can now be done without changing 
the hundred of option initializers.

For example, this line:
```
{LLDB_OPT_SET_ALL, false, "hide-aliases", 'a', 
OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Hide aliases in the 
command list."},
```
becomes this:
```
  def hide_aliases : Option<"hide-aliases", "a">, Desc<"Hide aliases in the 
command list.">;
```

For now I just moved a few initializers to the new format to demonstrate the 
change. I'll slowly migrate the other
option initializers tables  in separate patches.

Reviewers: JDevlieghere, davide, sgraenitz

Reviewed By: JDevlieghere

Subscribers: jingham, xiaobai, labath, mgorny, abidh, lldb-commits

Tags: #lldb

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

Added:
lldb/trunk/source/Commands/Options.td
lldb/trunk/source/Commands/OptionsBase.td
lldb/trunk/utils/TableGen/
lldb/trunk/utils/TableGen/CMakeLists.txt
lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp
lldb/trunk/utils/TableGen/LLDBTableGen.cpp
lldb/trunk/utils/TableGen/LLDBTableGenBackends.h
Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/source/Commands/CMakeLists.txt
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Commands/CommandObjectHelp.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=365908&r1=365907&r2=365908&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Fri Jul 12 08:30:55 2019
@@ -33,6 +33,8 @@ endif()
 if (NOT LLDB_DISABLE_PYTHON)
   add_subdirectory(scripts)
 endif ()
+
+add_subdirectory(utils/TableGen)
 add_subdirectory(source)
 add_subdirectory(tools)
 add_subdirectory(docs)

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=365908&r1=365907&r2=365908&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Fri Jul 12 08:30:55 2019
@@ -1,4 +1,37 @@
+function(lldb_tablegen)
+  # Syntax:
+  # lldb_tablegen output-file [tablegen-arg ...] SOURCE source-file
+  # [[TARGET cmake-target-name] [DEPENDS extra-dependency ...]]
+  #
+  # Generates a custom command for invoking tblgen as
+  #
+  # tblgen source-file -o=output-file tablegen-arg ...
+  #
+  # and, if cmake-target-name is provided, creates a custom target for
+  # executing the custom command depending on output-file. It is
+  # possible to list more files to depend after DEPENDS.
+
+  cmake_parse_arguments(LTG "" "SOURCE;TARGET" "" ${ARGN})
+
+  if(NOT LTG_SOURCE)
+message(FATAL_ERROR "SOURCE source-file required by lldb_tablegen")
+  endif()
+
+  set(LLVM_TARGET_DEFINITIONS ${LTG_SOURCE})
+  tablegen(LLDB ${LTG_UNPARSED_ARGUMENTS})
+
+  if(LTG_TARGET)
+add_public_tablegen_target(${LTG_TARGET})
+set_target_properties( ${LTG_TARGET} PROPERTIES FOLDER "LLDB tablegenning")
+set_property(GLOBAL APPEND PROPERTY LLDB_TABLEGEN_TARGETS ${LTG_TARGET})
+  endif()
+endfunction(lldb_tablegen)
+
 function(add_lldb_library name)
+  include_directories(BEFORE
+${CMAKE_CURRENT_BINARY_DIR}
+)
+
   # only supported parameters to this macro are the optional
   # MODULE;SHARED;STATIC library type and source files
   cmake_parse_arguments(PARAM
@@ -241,4 +274,4 @@ function(lldb_setup_rpaths name)
 BUILD_RPATH "${LIST_BUILD_RPATH}"
 INSTALL_RPATH "${LIST_INSTALL_RPATH}"
   )
-endfunction()
\ No newline at end of file
+endfunction()

Modified: lldb/trunk/source/Commands/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CMakeLists.txt?rev=365908&r1=365907&r2=365908&view=diff
==
--- lldb/trunk/source/Commands/CMakeLists.txt (original)
+++ lldb/trunk/source/Commands/CMakeLists.txt Fri Jul 12 

[Lldb-commits] [PATCH] D64365: [lldb] Let table gen create command option initializers.

2019-07-12 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365908: [lldb] Let table gen create command option 
initializers. (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64365?vs=209119&id=209493#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64365

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/cmake/modules/AddLLDB.cmake
  lldb/trunk/source/Commands/CMakeLists.txt
  lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
  lldb/trunk/source/Commands/CommandObjectHelp.cpp
  lldb/trunk/source/Commands/CommandObjectSettings.cpp
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Commands/Options.td
  lldb/trunk/source/Commands/OptionsBase.td
  lldb/trunk/utils/TableGen/CMakeLists.txt
  lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp
  lldb/trunk/utils/TableGen/LLDBTableGen.cpp
  lldb/trunk/utils/TableGen/LLDBTableGenBackends.h

Index: lldb/trunk/cmake/modules/AddLLDB.cmake
===
--- lldb/trunk/cmake/modules/AddLLDB.cmake
+++ lldb/trunk/cmake/modules/AddLLDB.cmake
@@ -1,4 +1,37 @@
+function(lldb_tablegen)
+  # Syntax:
+  # lldb_tablegen output-file [tablegen-arg ...] SOURCE source-file
+  # [[TARGET cmake-target-name] [DEPENDS extra-dependency ...]]
+  #
+  # Generates a custom command for invoking tblgen as
+  #
+  # tblgen source-file -o=output-file tablegen-arg ...
+  #
+  # and, if cmake-target-name is provided, creates a custom target for
+  # executing the custom command depending on output-file. It is
+  # possible to list more files to depend after DEPENDS.
+
+  cmake_parse_arguments(LTG "" "SOURCE;TARGET" "" ${ARGN})
+
+  if(NOT LTG_SOURCE)
+message(FATAL_ERROR "SOURCE source-file required by lldb_tablegen")
+  endif()
+
+  set(LLVM_TARGET_DEFINITIONS ${LTG_SOURCE})
+  tablegen(LLDB ${LTG_UNPARSED_ARGUMENTS})
+
+  if(LTG_TARGET)
+add_public_tablegen_target(${LTG_TARGET})
+set_target_properties( ${LTG_TARGET} PROPERTIES FOLDER "LLDB tablegenning")
+set_property(GLOBAL APPEND PROPERTY LLDB_TABLEGEN_TARGETS ${LTG_TARGET})
+  endif()
+endfunction(lldb_tablegen)
+
 function(add_lldb_library name)
+  include_directories(BEFORE
+${CMAKE_CURRENT_BINARY_DIR}
+)
+
   # only supported parameters to this macro are the optional
   # MODULE;SHARED;STATIC library type and source files
   cmake_parse_arguments(PARAM
@@ -241,4 +274,4 @@
 BUILD_RPATH "${LIST_BUILD_RPATH}"
 INSTALL_RPATH "${LIST_INSTALL_RPATH}"
   )
-endfunction()
\ No newline at end of file
+endfunction()
Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -33,6 +33,8 @@
 if (NOT LLDB_DISABLE_PYTHON)
   add_subdirectory(scripts)
 endif ()
+
+add_subdirectory(utils/TableGen)
 add_subdirectory(source)
 add_subdirectory(tools)
 add_subdirectory(docs)
Index: lldb/trunk/utils/TableGen/LLDBTableGenBackends.h
===
--- lldb/trunk/utils/TableGen/LLDBTableGenBackends.h
+++ lldb/trunk/utils/TableGen/LLDBTableGenBackends.h
@@ -0,0 +1,34 @@
+//===- TableGen.cpp - Top-Level TableGen implementation for Clang -===//
+//
+// 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
+//
+//===--===//
+//
+// This file contains the declarations for all of the LLDB TableGen
+// backends. A "TableGen backend" is just a function. See
+// "$LLVM_ROOT/utils/TableGen/TableGenBackends.h" for more info.
+//
+//===--===//
+
+#ifndef LLVM_LLDB_UTILS_TABLEGEN_TABLEGENBACKENDS_H
+#define LLVM_LLDB_UTILS_TABLEGEN_TABLEGENBACKENDS_H
+
+#include 
+
+namespace llvm {
+class raw_ostream;
+class RecordKeeper;
+} // namespace llvm
+
+using llvm::raw_ostream;
+using llvm::RecordKeeper;
+
+namespace lldb_private {
+
+void EmitOptionDefs(RecordKeeper &RK, raw_ostream &OS);
+
+} // namespace lldb_private
+
+#endif
Index: lldb/trunk/utils/TableGen/LLDBTableGen.cpp
===
--- lldb/trunk/utils/TableGen/LLDBTableGen.cpp
+++ lldb/trunk/utils/TableGen/LLDBTableGen.cpp
@@ -0,0 +1,71 @@
+//===- TableGen.cpp - Top-Level TableGen implementation for Clang -===//
+//
+// 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
+//
+//===--===

[Lldb-commits] [PATCH] D64159: [Core] Generalize ValueObject::MaybeCalculateCompleteType

2019-07-12 Thread Saleem Abdulrasool via Phabricator via lldb-commits
compnerd accepted this revision.
compnerd added a comment.

Seems that all the comments have been addressed and this is purely code motion. 
 LGTM


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

https://reviews.llvm.org/D64159



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


[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread executation control

2019-07-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: krytarowski, labath.
Herald added subscribers: teemperor, abidh.
Herald added a project: LLDB.

Implement the full logic providing the ability to run, single-step
or suspend each thread separately.  This replaces the old code that
propagated the status of first thread to all of them.  It uses newer
APIs PT_RESUME/PT_SUSPEND and PT_SETSTEP/PT_CLEARSTEP.

It also uses the PT_SET_SIGINFO call to allow sending signal to a single
thread, in addition to sending it to entire process.  Due to API
limitations, sending signal to 1https://reviews.llvm.org/D64647

Files:
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h

Index: lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
===
--- lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
+++ lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -48,6 +48,10 @@
 private:
   // Interface for friend classes
 
+  Status Resume();
+  Status SingleStep();
+  Status Suspend();
+
   void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
   void SetStoppedByBreakpoint();
   void SetStoppedByTrace();
Index: lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -17,6 +17,11 @@
 #include "lldb/Utility/RegisterValue.h"
 #include "lldb/Utility/State.h"
 
+// clang-format off
+#include 
+#include 
+// clang-format on
+
 #include 
 
 using namespace lldb;
@@ -30,6 +35,38 @@
 NativeRegisterContextNetBSD::CreateHostNativeRegisterContextNetBSD(process.GetArchitecture(), *this)
 ), m_stop_description() {}
 
+Status NativeThreadNetBSD::Resume() {
+  Status ret = NativeProcessNetBSD::PtraceWrapper(PT_RESUME, m_process.GetID(),
+  nullptr, GetID());
+  if (!ret.Success())
+return ret;
+  ret = NativeProcessNetBSD::PtraceWrapper(PT_CLEARSTEP, m_process.GetID(),
+   nullptr, GetID());
+  if (ret.Success())
+SetRunning();
+  return ret;
+}
+
+Status NativeThreadNetBSD::SingleStep() {
+  Status ret = NativeProcessNetBSD::PtraceWrapper(PT_RESUME, m_process.GetID(),
+  nullptr, GetID());
+  if (!ret.Success())
+return ret;
+  ret = NativeProcessNetBSD::PtraceWrapper(PT_SETSTEP, m_process.GetID(),
+   nullptr, -GetID());
+  if (ret.Success())
+SetStepping();
+  return ret;
+}
+
+Status NativeThreadNetBSD::Suspend() {
+  Status ret = NativeProcessNetBSD::PtraceWrapper(PT_SUSPEND, m_process.GetID(),
+  nullptr, GetID());
+  if (ret.Success())
+SetStopped();
+  return ret;
+}
+
 void NativeThreadNetBSD::SetStoppedBySignal(uint32_t signo,
 const siginfo_t *info) {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -328,53 +328,84 @@
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
   LLDB_LOG(log, "pid {0}", GetID());
 
-  const auto &thread = m_threads[0];
-  const ResumeAction *const action =
-  resume_actions.GetActionForThread(thread->GetID(), true);
+  Status ret;
+  int signal = LLDB_INVALID_SIGNAL_NUMBER;
+  int signaled_lwp;
+  size_t signaled_threads = 0;
+
+  for (const auto &abs_thread : m_threads) {
+assert(abs_thread && "thread list should not contain NULL threads");
+NativeThreadNetBSD& thread = static_cast(*abs_thread);
+
+const ResumeAction *const action =
+resume_actions.GetActionForThread(thread.GetID(), true);
+
+if (action == nullptr) {
+  LLDB_LOG(log, "no action specified for pid {0} tid {1}", GetID(),
+   thread.GetID());
+  continue;
+}
 
-  if (action == nullptr) {
-LLDB_LOG(log, "no action specified for pid {0} tid {1}", GetID(),
- thread->GetID());
-return Status();
-  }
+LLDB_LOG(log, "processing resume action state {0} for pid {1} tid {2}",
+ action->state, GetID(), thread.GetID());
 
-  Status error;
+if (action->signal != LLDB_INVALID_SIGNAL_NUMBER) {
+  if (signal != LLDB_INVALID_SIGNAL_NUMBER && signal != action->signal)
+return Status("NetBSD does not support passing multiple signals simultaneously");
 
-  switch (action->state) {
-  case eStateRunning: {
-// Run the thread, possibly feeding it the signal

[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

2019-07-12 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

I think it looks OK. there are some nits that could be optimized in future or 
handled additionally.. but for now it should be fine.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64647



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


[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

2019-07-12 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Shouldn't there be some tests that come along with this patch?




Comment at: lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp:56
+  ret = NativeProcessNetBSD::PtraceWrapper(PT_SETSTEP, m_process.GetID(),
+   nullptr, -GetID());
+  if (ret.Success())

Is this really meant to be negative?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64647



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


[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

2019-07-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny marked 2 inline comments as done.
mgorny added inline comments.



Comment at: lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp:56
+  ret = NativeProcessNetBSD::PtraceWrapper(PT_SETSTEP, m_process.GetID(),
+   nullptr, -GetID());
+  if (ret.Success())

labath wrote:
> Is this really meant to be negative?
Good catch, it's leftover from `PT_STEP` usage…


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64647



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


[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

2019-07-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 209537.
mgorny marked an inline comment as done.

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

https://reviews.llvm.org/D64647

Files:
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h

Index: lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
===
--- lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
+++ lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -48,6 +48,10 @@
 private:
   // Interface for friend classes
 
+  Status Resume();
+  Status SingleStep();
+  Status Suspend();
+
   void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
   void SetStoppedByBreakpoint();
   void SetStoppedByTrace();
Index: lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -17,6 +17,11 @@
 #include "lldb/Utility/RegisterValue.h"
 #include "lldb/Utility/State.h"
 
+// clang-format off
+#include 
+#include 
+// clang-format on
+
 #include 
 
 using namespace lldb;
@@ -30,6 +35,38 @@
 NativeRegisterContextNetBSD::CreateHostNativeRegisterContextNetBSD(process.GetArchitecture(), *this)
 ), m_stop_description() {}
 
+Status NativeThreadNetBSD::Resume() {
+  Status ret = NativeProcessNetBSD::PtraceWrapper(PT_RESUME, m_process.GetID(),
+  nullptr, GetID());
+  if (!ret.Success())
+return ret;
+  ret = NativeProcessNetBSD::PtraceWrapper(PT_CLEARSTEP, m_process.GetID(),
+   nullptr, GetID());
+  if (ret.Success())
+SetRunning();
+  return ret;
+}
+
+Status NativeThreadNetBSD::SingleStep() {
+  Status ret = NativeProcessNetBSD::PtraceWrapper(PT_RESUME, m_process.GetID(),
+  nullptr, GetID());
+  if (!ret.Success())
+return ret;
+  ret = NativeProcessNetBSD::PtraceWrapper(PT_SETSTEP, m_process.GetID(),
+   nullptr, GetID());
+  if (ret.Success())
+SetStepping();
+  return ret;
+}
+
+Status NativeThreadNetBSD::Suspend() {
+  Status ret = NativeProcessNetBSD::PtraceWrapper(PT_SUSPEND, m_process.GetID(),
+  nullptr, GetID());
+  if (ret.Success())
+SetStopped();
+  return ret;
+}
+
 void NativeThreadNetBSD::SetStoppedBySignal(uint32_t signo,
 const siginfo_t *info) {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD));
Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -328,53 +328,84 @@
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
   LLDB_LOG(log, "pid {0}", GetID());
 
-  const auto &thread = m_threads[0];
-  const ResumeAction *const action =
-  resume_actions.GetActionForThread(thread->GetID(), true);
+  Status ret;
+  int signal = LLDB_INVALID_SIGNAL_NUMBER;
+  int signaled_lwp;
+  size_t signaled_threads = 0;
+
+  for (const auto &abs_thread : m_threads) {
+assert(abs_thread && "thread list should not contain NULL threads");
+NativeThreadNetBSD& thread = static_cast(*abs_thread);
+
+const ResumeAction *const action =
+resume_actions.GetActionForThread(thread.GetID(), true);
+
+if (action == nullptr) {
+  LLDB_LOG(log, "no action specified for pid {0} tid {1}", GetID(),
+   thread.GetID());
+  continue;
+}
 
-  if (action == nullptr) {
-LLDB_LOG(log, "no action specified for pid {0} tid {1}", GetID(),
- thread->GetID());
-return Status();
-  }
+LLDB_LOG(log, "processing resume action state {0} for pid {1} tid {2}",
+ action->state, GetID(), thread.GetID());
 
-  Status error;
+if (action->signal != LLDB_INVALID_SIGNAL_NUMBER) {
+  if (signal != LLDB_INVALID_SIGNAL_NUMBER && signal != action->signal)
+return Status("NetBSD does not support passing multiple signals simultaneously");
 
-  switch (action->state) {
-  case eStateRunning: {
-// Run the thread, possibly feeding it the signal.
-error = NativeProcessNetBSD::PtraceWrapper(PT_CONTINUE, GetID(), (void *)1,
-   action->signal);
-if (!error.Success())
-  return error;
-for (const auto &thread : m_threads)
-  static_cast(*thread).SetRunning();
-SetState(eStateRunning, true);
-break;
-  }
-  case eStateStepping:
-// Run the thread, possibly feeding it the signal.
-error = Na

[Lldb-commits] [PATCH] D61333: [ASTImporter] Fix LLDB lookup in transparent ctx and with ext src

2019-07-12 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

@martong Sorry for the delay, feel free to ping me in the future about these 
patches. I'll review them ASAP now that I'm back in office, so these delay's 
hopefully won't happen again.

I tried applying this patch and it seems it needs to be rebased. I would do it 
myself, but I'm not entirely sure how to rebase the changes to 
`ASTNodeImporter::ImportDefinition`. It seems we got rid of 
`To->completeDefinition();`, so not sure if the code that this patch adds is 
still in the right place.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61333



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


[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

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

In D64647#1583125 , @labath wrote:

> Shouldn't there be some tests that come along with this patch?


I was actually hoping that the test suite already covers what needs to be 
covered, and buildbot would tell me which tests were fixed ;-).


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

https://reviews.llvm.org/D64647



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


[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

2019-07-12 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D64647#1583178 , @mgorny wrote:

> In D64647#1583125 , @labath wrote:
>
> > Shouldn't there be some tests that come along with this patch?
>
>
> I was actually hoping that the test suite already covers what needs to be 
> covered, and buildbot would tell me which tests were fixed ;-).


That is possible, though it would be good to know that before landing the 
patch. But I would expect that at least some aspect of this functionality is 
not covered by  existing tests (e.g. the handling of multiple concurrent 
signals).




Comment at: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp:354
+  if (signal != LLDB_INVALID_SIGNAL_NUMBER && signal != action->signal)
+return Status("NetBSD does not support passing multiple signals 
simultaneously");
 

Is this "passing multiple signals simultaneously", or "passing multiple 
*distinct* signals simultaneously". (E.g,. thread 1 gets a SIGALRM, thread 2 
gets SIGIO, etc.).


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

https://reviews.llvm.org/D64647



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


[Lldb-commits] [lldb] r365939 - [Core] Generalize ValueObject::MaybeCalculateCompleteType

2019-07-12 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Fri Jul 12 11:34:37 2019
New Revision: 365939

URL: http://llvm.org/viewvc/llvm-project?rev=365939&view=rev
Log:
[Core] Generalize ValueObject::MaybeCalculateCompleteType

Summary:
Instead of hardcoding ClangASTContext and ObjCLanguageRuntime, we can
generalize this by creating the method GetRuntimeType in
LanguageRuntime and moving the current MaybeCalculateCompleteType
implementation into ObjCLanguageruntime::GetRuntimeType

Reviewers: jingham, clayborg, JDevlieghere

Subscribers: lldb-commits

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

Modified:
lldb/trunk/include/lldb/Target/LanguageRuntime.h
lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Target/ObjCLanguageRuntime.cpp

Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=365939&r1=365938&r2=365939&view=diff
==
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Fri Jul 12 11:34:37 2019
@@ -156,6 +156,10 @@ public:
   /// from the user interface.
   virtual bool IsWhitelistedRuntimeValue(ConstString name) { return false; }
 
+  virtual llvm::Optional GetRuntimeType(CompilerType base_type) {
+return llvm::None;
+  }
+
   virtual void ModulesDidLoad(const ModuleList &module_list) {}
 
   // Called by the Clang expression evaluation engine to allow runtimes to

Modified: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h?rev=365939&r1=365938&r2=365939&view=diff
==
--- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h Fri Jul 12 11:34:37 
2019
@@ -250,6 +250,8 @@ public:
 
   lldb::TypeSP LookupInCompleteClassCache(ConstString &name);
 
+  llvm::Optional GetRuntimeType(CompilerType base_type) override;
+
   virtual UtilityFunction *CreateObjectChecker(const char *) = 0;
 
   virtual ObjCRuntimeVersions GetRuntimeVersion() const {

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=365939&r1=365938&r2=365939&view=diff
==
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Jul 12 11:34:37 2019
@@ -35,7 +35,6 @@
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Language.h"
 #include "lldb/Target/LanguageRuntime.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
@@ -280,51 +279,21 @@ CompilerType ValueObject::MaybeCalculate
   return compiler_type;
   }
 
-  CompilerType class_type;
-  bool is_pointer_type = false;
-
-  if (ClangASTContext::IsObjCObjectPointerType(compiler_type, &class_type)) {
-is_pointer_type = true;
-  } else if (ClangASTContext::IsObjCObjectOrInterfaceType(compiler_type)) {
-class_type = compiler_type;
-  } else {
-return compiler_type;
-  }
-
   m_did_calculate_complete_objc_class_type = true;
 
-  if (class_type) {
-ConstString class_name(class_type.GetConstTypeName());
+  ProcessSP process_sp(
+  GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
 
-if (class_name) {
-  ProcessSP process_sp(
-  GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
-
-  if (process_sp) {
-ObjCLanguageRuntime *objc_language_runtime(
-ObjCLanguageRuntime::Get(*process_sp));
-
-if (objc_language_runtime) {
-  TypeSP complete_objc_class_type_sp =
-  objc_language_runtime->LookupInCompleteClassCache(class_name);
-
-  if (complete_objc_class_type_sp) {
-CompilerType complete_class(
-complete_objc_class_type_sp->GetFullCompilerType());
-
-if (complete_class.GetCompleteType()) {
-  if (is_pointer_type) {
-m_override_type = complete_class.GetPointerType();
-  } else {
-m_override_type = complete_class;
-  }
-
-  if (m_override_type.IsValid())
-return m_override_type;
-}
-  }
-}
-  }
+  if (!process_sp)
+return compiler_type;
+
+  if (auto *runtime =
+  process_sp->GetLanguageRuntime(GetObjectRuntimeLanguage())) {
+if (llvm::Optional complete_type =
+runtime->GetRuntimeType(compiler_type)) {
+  m_override_type = complete_type.getValue();
+  if (m_override_type.IsValid())
+return m_override_type;
 }
   }
   return compiler_type;


[Lldb-commits] [PATCH] D64159: [Core] Generalize ValueObject::MaybeCalculateCompleteType

2019-07-12 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365939: [Core] Generalize 
ValueObject::MaybeCalculateCompleteType (authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64159

Files:
  lldb/trunk/include/lldb/Target/LanguageRuntime.h
  lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
  lldb/trunk/source/Core/ValueObject.cpp
  lldb/trunk/source/Target/ObjCLanguageRuntime.cpp

Index: lldb/trunk/source/Core/ValueObject.cpp
===
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -35,7 +35,6 @@
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Language.h"
 #include "lldb/Target/LanguageRuntime.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
@@ -280,51 +279,21 @@
   return compiler_type;
   }
 
-  CompilerType class_type;
-  bool is_pointer_type = false;
-
-  if (ClangASTContext::IsObjCObjectPointerType(compiler_type, &class_type)) {
-is_pointer_type = true;
-  } else if (ClangASTContext::IsObjCObjectOrInterfaceType(compiler_type)) {
-class_type = compiler_type;
-  } else {
-return compiler_type;
-  }
-
   m_did_calculate_complete_objc_class_type = true;
 
-  if (class_type) {
-ConstString class_name(class_type.GetConstTypeName());
+  ProcessSP process_sp(
+  GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
 
-if (class_name) {
-  ProcessSP process_sp(
-  GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
-
-  if (process_sp) {
-ObjCLanguageRuntime *objc_language_runtime(
-ObjCLanguageRuntime::Get(*process_sp));
-
-if (objc_language_runtime) {
-  TypeSP complete_objc_class_type_sp =
-  objc_language_runtime->LookupInCompleteClassCache(class_name);
-
-  if (complete_objc_class_type_sp) {
-CompilerType complete_class(
-complete_objc_class_type_sp->GetFullCompilerType());
-
-if (complete_class.GetCompleteType()) {
-  if (is_pointer_type) {
-m_override_type = complete_class.GetPointerType();
-  } else {
-m_override_type = complete_class;
-  }
+  if (!process_sp)
+return compiler_type;
 
-  if (m_override_type.IsValid())
-return m_override_type;
-}
-  }
-}
-  }
+  if (auto *runtime =
+  process_sp->GetLanguageRuntime(GetObjectRuntimeLanguage())) {
+if (llvm::Optional complete_type =
+runtime->GetRuntimeType(compiler_type)) {
+  m_override_type = complete_type.getValue();
+  if (m_override_type.IsValid())
+return m_override_type;
 }
   }
   return compiler_type;
Index: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
===
--- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
+++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp
@@ -398,3 +398,38 @@
 "The ObjC Exception breakpoint doesn't support extra options.");
   return error;
 }
+
+llvm::Optional
+ObjCLanguageRuntime::GetRuntimeType(CompilerType base_type) {
+  CompilerType class_type;
+  bool is_pointer_type = false;
+
+  if (ClangASTContext::IsObjCObjectPointerType(base_type, &class_type))
+is_pointer_type = true;
+  else if (ClangASTContext::IsObjCObjectOrInterfaceType(base_type))
+class_type = base_type;
+  else
+return llvm::None;
+
+  if (!class_type)
+return llvm::None;
+
+  ConstString class_name(class_type.GetConstTypeName());
+  if (!class_name)
+return llvm::None;
+
+  TypeSP complete_objc_class_type_sp = LookupInCompleteClassCache(class_name);
+  if (!complete_objc_class_type_sp)
+return llvm::None;
+
+  CompilerType complete_class(
+  complete_objc_class_type_sp->GetFullCompilerType());
+  if (complete_class.GetCompleteType()) {
+if (is_pointer_type)
+  return complete_class.GetPointerType();
+else
+  return complete_class;
+  }
+
+  return llvm::None;
+}
Index: lldb/trunk/include/lldb/Target/LanguageRuntime.h
===
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h
@@ -156,6 +156,10 @@
   /// from the user interface.
   virtual bool IsWhitelistedRuntimeValue(ConstString name) { return false; }
 
+  virtual llvm::Optional GetRuntimeType(CompilerType base_type) {
+return llvm::None;
+  }
+
   virtual void ModulesDidLoad(const ModuleList &module_list) {}
 
   // Called by the Clang expression evaluation engine to allow runtimes to
Index: lldb/trunk/include/lldb/T

[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

2019-07-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny marked an inline comment as done.
mgorny added inline comments.



Comment at: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp:354
+  if (signal != LLDB_INVALID_SIGNAL_NUMBER && signal != action->signal)
+return Status("NetBSD does not support passing multiple signals 
simultaneously");
 

labath wrote:
> Is this "passing multiple signals simultaneously", or "passing multiple 
> *distinct* signals simultaneously". (E.g,. thread 1 gets a SIGALRM, thread 2 
> gets SIGIO, etc.).
The former. Basically there's one siginfo slot, so you can either put a signal 
for whole process, or for one LWP.


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

https://reviews.llvm.org/D64647



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


[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

2019-07-12 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp:354
+  if (signal != LLDB_INVALID_SIGNAL_NUMBER && signal != action->signal)
+return Status("NetBSD does not support passing multiple signals 
simultaneously");
 

mgorny wrote:
> labath wrote:
> > Is this "passing multiple signals simultaneously", or "passing multiple 
> > *distinct* signals simultaneously". (E.g,. thread 1 gets a SIGALRM, thread 
> > 2 gets SIGIO, etc.).
> The former. Basically there's one siginfo slot, so you can either put a 
> signal for whole process, or for one LWP.
Once we emit a single signal to all threads, it's still technically a single 
signal that hits the process.


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

https://reviews.llvm.org/D64647



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


[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

2019-07-12 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added a comment.

Something that we do not cover here is that once a tracee reports a signal 
(like someone poked it with SIGUSR1) and we want to pass it over to the tracee, 
we will reset siginfo.

This scenario should be covered by a test and we should handle it properly..

The solution in NetBSD for passing over signals without changing siginfo, is to 
not calling PT_SET_SIGINFO as the default one will be kept by the kernel.


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

https://reviews.llvm.org/D64647



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


[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

2019-07-12 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp:354
+  if (signal != LLDB_INVALID_SIGNAL_NUMBER && signal != action->signal)
+return Status("NetBSD does not support passing multiple signals 
simultaneously");
 

krytarowski wrote:
> mgorny wrote:
> > labath wrote:
> > > Is this "passing multiple signals simultaneously", or "passing multiple 
> > > *distinct* signals simultaneously". (E.g,. thread 1 gets a SIGALRM, 
> > > thread 2 gets SIGIO, etc.).
> > The former. Basically there's one siginfo slot, so you can either put a 
> > signal for whole process, or for one LWP.
> Once we emit a single signal to all threads, it's still technically a single 
> signal that hits the process.
Ok, that makes sense. But I don't think that's what the code does right now 
(IIUC, this line will only fire if the current signal is different that the 
signal sent to the previous thread).


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

https://reviews.llvm.org/D64647



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


[Lldb-commits] [PATCH] D64661: [ObjectContainerBSDArchive] Simplify a few things (NFC)

2019-07-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, xiaobai.
JDevlieghere added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D64661

Files:
  lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h

Index: lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
===
--- lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
+++ lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
@@ -80,20 +80,29 @@
 
 lldb::offset_t Extract(const lldb_private::DataExtractor &data,
lldb::offset_t offset);
+/// Object name in the archive.
+lldb_private::ConstString ar_name;
 
-lldb_private::ConstString ar_name; // name
-uint32_t ar_date;  // modification time
-uint16_t ar_uid;   // user id
-uint16_t ar_gid;   // group id
-uint16_t ar_mode;  // octal file permissions
-uint32_t ar_size;  // size in bytes
-lldb::offset_t ar_file_offset; // file offset in bytes from the beginning of
-   // the file of the object data
-lldb::offset_t ar_file_size;   // length of the object data
-
-typedef std::vector collection;
-typedef collection::iterator iterator;
-typedef collection::const_iterator const_iterator;
+/// Object modification time in the archive.
+uint32_t modification_time;
+
+/// Object user id in the archive.
+uint16_t uid;
+
+/// Object group id in the archive.
+uint16_t gid;
+
+/// Object octal file permissions in the archive.
+uint16_t mode;
+
+/// Object size in bytes in the archive.
+uint32_t size;
+
+/// File offset in bytes from the beginning of the file of the object data.
+lldb::offset_t file_offset;
+
+/// Length of the object data.
+lldb::offset_t file_size;
   };
 
   class Archive {
@@ -135,7 +144,9 @@
 
 lldb::offset_t GetFileOffset() const { return m_file_offset; }
 
-const llvm::sys::TimePoint<> &GetModificationTime() { return m_time; }
+const llvm::sys::TimePoint<> &GetModificationTime() {
+  return m_modification_time;
+}
 
 const lldb_private::ArchSpec &GetArchitecture() const { return m_arch; }
 
@@ -149,9 +160,9 @@
 typedef lldb_private::UniqueCStringMap ObjectNameToIndexMap;
 // Member Variables
 lldb_private::ArchSpec m_arch;
-llvm::sys::TimePoint<> m_time;
+llvm::sys::TimePoint<> m_modification_time;
 lldb::offset_t m_file_offset;
-Object::collection m_objects;
+std::vector m_objects;
 ObjectNameToIndexMap m_object_name_to_index_map;
 lldb_private::DataExtractor m_data; ///< The data for this object container
 ///so we don't lose data if the .a files
Index: lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
===
--- lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -41,18 +41,18 @@
 using namespace lldb_private;
 
 ObjectContainerBSDArchive::Object::Object()
-: ar_name(), ar_date(0), ar_uid(0), ar_gid(0), ar_mode(0), ar_size(0),
-  ar_file_offset(0), ar_file_size(0) {}
+: ar_name(), modification_time(0), uid(0), gid(0), mode(0), size(0),
+  file_offset(0), file_size(0) {}
 
 void ObjectContainerBSDArchive::Object::Clear() {
   ar_name.Clear();
-  ar_date = 0;
-  ar_uid = 0;
-  ar_gid = 0;
-  ar_mode = 0;
-  ar_size = 0;
-  ar_file_offset = 0;
-  ar_file_size = 0;
+  modification_time = 0;
+  uid = 0;
+  gid = 0;
+  mode = 0;
+  size = 0;
+  file_offset = 0;
+  file_size = 0;
 }
 
 lldb::offset_t
@@ -102,19 +102,19 @@
   }
 
   str.assign((const char *)data.GetData(&offset, 12), 12);
-  ar_date = strtoul(str.c_str(), &err, 10);
+  modification_time = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 6), 6);
-  ar_uid = strtoul(str.c_str(), &err, 10);
+  uid = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 6), 6);
-  ar_gid = strtoul(str.c_str(), &err, 10);
+  gid = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 8), 8);
-  ar_mode = strtoul(str.c_str(), &err, 8);
+  mode = strtoul(str.c_str(), &err, 8);
 
   str.assign((const char *)data.GetData(&offset, 10), 10);
-  ar_size = strtoul(str.c_str(), &err, 10);
+  size = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 2), 2);
   if (str == ARFMAG) {
@@ -126,8 +126,8 @@
   str.assign((const char *)ar_name_ptr, ar_name_len);
   ar_name.SetCString(str.c_str());
 }
-ar_fi

[Lldb-commits] [PATCH] D64661: [ObjectContainerBSDArchive] Simplify a few things (NFC)

2019-07-12 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64661



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


[Lldb-commits] [lldb] r365950 - [ObjectContainerBSDArchive] Simplify a few things (NFC)

2019-07-12 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Jul 12 13:08:41 2019
New Revision: 365950

URL: http://llvm.org/viewvc/llvm-project?rev=365950&view=rev
Log:
[ObjectContainerBSDArchive] Simplify a few things (NFC)

Differential revision: https://reviews.llvm.org/D64661

Modified:

lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp

lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h

Modified: 
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=365950&r1=365949&r2=365950&view=diff
==
--- 
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
 Fri Jul 12 13:08:41 2019
@@ -41,18 +41,18 @@ using namespace lldb;
 using namespace lldb_private;
 
 ObjectContainerBSDArchive::Object::Object()
-: ar_name(), ar_date(0), ar_uid(0), ar_gid(0), ar_mode(0), ar_size(0),
-  ar_file_offset(0), ar_file_size(0) {}
+: ar_name(), modification_time(0), uid(0), gid(0), mode(0), size(0),
+  file_offset(0), file_size(0) {}
 
 void ObjectContainerBSDArchive::Object::Clear() {
   ar_name.Clear();
-  ar_date = 0;
-  ar_uid = 0;
-  ar_gid = 0;
-  ar_mode = 0;
-  ar_size = 0;
-  ar_file_offset = 0;
-  ar_file_size = 0;
+  modification_time = 0;
+  uid = 0;
+  gid = 0;
+  mode = 0;
+  size = 0;
+  file_offset = 0;
+  file_size = 0;
 }
 
 lldb::offset_t
@@ -102,19 +102,19 @@ ObjectContainerBSDArchive::Object::Extra
   }
 
   str.assign((const char *)data.GetData(&offset, 12), 12);
-  ar_date = strtoul(str.c_str(), &err, 10);
+  modification_time = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 6), 6);
-  ar_uid = strtoul(str.c_str(), &err, 10);
+  uid = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 6), 6);
-  ar_gid = strtoul(str.c_str(), &err, 10);
+  gid = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 8), 8);
-  ar_mode = strtoul(str.c_str(), &err, 8);
+  mode = strtoul(str.c_str(), &err, 8);
 
   str.assign((const char *)data.GetData(&offset, 10), 10);
-  ar_size = strtoul(str.c_str(), &err, 10);
+  size = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 2), 2);
   if (str == ARFMAG) {
@@ -126,8 +126,8 @@ ObjectContainerBSDArchive::Object::Extra
   str.assign((const char *)ar_name_ptr, ar_name_len);
   ar_name.SetCString(str.c_str());
 }
-ar_file_offset = offset;
-ar_file_size = ar_size - ar_name_len;
+file_offset = offset;
+file_size = size - ar_name_len;
 return offset;
   }
   return LLDB_INVALID_OFFSET;
@@ -137,8 +137,8 @@ ObjectContainerBSDArchive::Archive::Arch
 const llvm::sys::TimePoint<> &time,
 lldb::offset_t file_offset,
 lldb_private::DataExtractor &data)
-: m_arch(arch), m_time(time), m_file_offset(file_offset), m_objects(),
-  m_data(data) {}
+: m_arch(arch), m_modification_time(time), m_file_offset(file_offset),
+  m_objects(), m_data(data) {}
 
 ObjectContainerBSDArchive::Archive::~Archive() {}
 
@@ -157,7 +157,7 @@ size_t ObjectContainerBSDArchive::Archiv
   m_objects.push_back(obj);
   // Insert all of the C strings out of order for now...
   m_object_name_to_index_map.Append(obj.ar_name, obj_idx);
-  offset += obj.ar_file_size;
+  offset += obj.file_size;
   obj.Clear();
 } while (data.ValidOffset(offset));
 
@@ -169,27 +169,27 @@ size_t ObjectContainerBSDArchive::Archiv
 
 ObjectContainerBSDArchive::Object *
 ObjectContainerBSDArchive::Archive::FindObject(
-ConstString object_name,
-const llvm::sys::TimePoint<> &object_mod_time) {
+ConstString object_name, const llvm::sys::TimePoint<> &object_mod_time) {
   const ObjectNameToIndexMap::Entry *match =
   m_object_name_to_index_map.FindFirstValueForName(object_name);
-  if (match) {
-if (object_mod_time != llvm::sys::TimePoint<>()) {
-  const uint64_t object_date = llvm::sys::toTimeT(object_mod_time);
-  if (m_objects[match->value].ar_date == object_date)
-return &m_objects[match->value];
-  const ObjectNameToIndexMap::Entry *next_match =
-  m_object_name_to_index_map.FindNextValueForName(match);
-  while (next_match) {
-if (m_objects[next_match->value].ar_date == object_date)
-  return &m_objects[next_match->value];
-next_match =
-m_object_name_to_index_map.FindNextValueForName(next_match);
-  }
-} else {
-  return &m_objects[match->value];
-}
+  if (!match)
+return nullptr;
+  if 

[Lldb-commits] [lldb] r365951 - [LanguageRuntime] Move CPPLanguageRuntime into a plugin

2019-07-12 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Fri Jul 12 13:09:32 2019
New Revision: 365951

URL: http://llvm.org/viewvc/llvm-project?rev=365951&view=rev
Log:
[LanguageRuntime] Move CPPLanguageRuntime into a plugin

Summary: This seems better suited to be in a plugin.

Reviewers: JDevlieghere, clayborg, jingham, compnerd, labath

Subscribers: mgorny, lldb-commits

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

Added:
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
  - copied, changed from r365939, 
lldb/trunk/source/Target/CPPLanguageRuntime.cpp
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
  - copied, changed from r365939, 
lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
Removed:
lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
lldb/trunk/source/Target/CPPLanguageRuntime.cpp
Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
lldb/trunk/source/Target/CMakeLists.txt

Removed: lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h?rev=365950&view=auto
==
--- lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h (removed)
@@ -1,90 +0,0 @@
-//===-- CPPLanguageRuntime.h
-//
-// 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 liblldb_CPPLanguageRuntime_h_
-#define liblldb_CPPLanguageRuntime_h_
-
-#include 
-#include "lldb/Core/PluginInterface.h"
-#include "lldb/Target/LanguageRuntime.h"
-#include "lldb/lldb-private.h"
-
-namespace lldb_private {
-
-class CPPLanguageRuntime : public LanguageRuntime {
-public:
-  enum class LibCppStdFunctionCallableCase {
-Lambda = 0,
-CallableObject,
-FreeOrMemberFunction,
-Invalid
-  };
-
-  struct LibCppStdFunctionCallableInfo {
-Symbol callable_symbol;
-Address callable_address;
-LineEntry callable_line_entry;
-lldb::addr_t member__f_pointer_value = 0u;
-LibCppStdFunctionCallableCase callable_case =
-LibCppStdFunctionCallableCase::Invalid;
-  };
-
-  LibCppStdFunctionCallableInfo
-  FindLibCppStdFunctionCallableInfo(lldb::ValueObjectSP &valobj_sp);
-
-  ~CPPLanguageRuntime() override;
-
-  static char ID;
-
-  bool isA(const void *ClassID) const override {
-return ClassID == &ID || LanguageRuntime::isA(ClassID);
-  }
-
-  static bool classof(const LanguageRuntime *runtime) {
-return runtime->isA(&ID);
-  }
-
-  lldb::LanguageType GetLanguageType() const override {
-return lldb::eLanguageTypeC_plus_plus;
-  }
-
-  static CPPLanguageRuntime *Get(Process &process) {
-return llvm::cast_or_null(
-process.GetLanguageRuntime(lldb::eLanguageTypeC_plus_plus));
-  }
-
-  bool GetObjectDescription(Stream &str, ValueObject &object) override;
-
-  bool GetObjectDescription(Stream &str, Value &value,
-ExecutionContextScope *exe_scope) override;
-
-  /// Obtain a ThreadPlan to get us into C++ constructs such as std::function.
-  ///
-  /// \param[in] thread
-  /// Curent thrad of execution.
-  ///
-  /// \param[in] stop_others
-  /// True if other threads should pause during execution.
-  ///
-  /// \return
-  ///  A ThreadPlan Shared pointer
-  lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
-  bool stop_others) override;
-
-  bool IsWhitelistedRuntimeValue(ConstString name) override;
-protected:
-  // Classes that inherit from CPPLanguageRuntime can see and modify these
-  CPPLanguageRuntime(Process *process);
-
-private:
-  DISALLOW_COPY_AND_ASSIGN(CPPLanguageRuntime);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_CPPLanguageRuntime_h_

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt?rev=36595

[Lldb-commits] [PATCH] D64661: [ObjectContainerBSDArchive] Simplify a few things (NFC)

2019-07-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365950: [ObjectContainerBSDArchive] Simplify a few things 
(NFC) (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64661?vs=209571&id=209574#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64661

Files:
  
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h

Index: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
===
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
@@ -80,20 +80,29 @@
 
 lldb::offset_t Extract(const lldb_private::DataExtractor &data,
lldb::offset_t offset);
+/// Object name in the archive.
+lldb_private::ConstString ar_name;
 
-lldb_private::ConstString ar_name; // name
-uint32_t ar_date;  // modification time
-uint16_t ar_uid;   // user id
-uint16_t ar_gid;   // group id
-uint16_t ar_mode;  // octal file permissions
-uint32_t ar_size;  // size in bytes
-lldb::offset_t ar_file_offset; // file offset in bytes from the beginning of
-   // the file of the object data
-lldb::offset_t ar_file_size;   // length of the object data
-
-typedef std::vector collection;
-typedef collection::iterator iterator;
-typedef collection::const_iterator const_iterator;
+/// Object modification time in the archive.
+uint32_t modification_time;
+
+/// Object user id in the archive.
+uint16_t uid;
+
+/// Object group id in the archive.
+uint16_t gid;
+
+/// Object octal file permissions in the archive.
+uint16_t mode;
+
+/// Object size in bytes in the archive.
+uint32_t size;
+
+/// File offset in bytes from the beginning of the file of the object data.
+lldb::offset_t file_offset;
+
+/// Length of the object data.
+lldb::offset_t file_size;
   };
 
   class Archive {
@@ -135,7 +144,9 @@
 
 lldb::offset_t GetFileOffset() const { return m_file_offset; }
 
-const llvm::sys::TimePoint<> &GetModificationTime() { return m_time; }
+const llvm::sys::TimePoint<> &GetModificationTime() {
+  return m_modification_time;
+}
 
 const lldb_private::ArchSpec &GetArchitecture() const { return m_arch; }
 
@@ -149,9 +160,9 @@
 typedef lldb_private::UniqueCStringMap ObjectNameToIndexMap;
 // Member Variables
 lldb_private::ArchSpec m_arch;
-llvm::sys::TimePoint<> m_time;
+llvm::sys::TimePoint<> m_modification_time;
 lldb::offset_t m_file_offset;
-Object::collection m_objects;
+std::vector m_objects;
 ObjectNameToIndexMap m_object_name_to_index_map;
 lldb_private::DataExtractor m_data; ///< The data for this object container
 ///so we don't lose data if the .a files
Index: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
===
--- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -41,18 +41,18 @@
 using namespace lldb_private;
 
 ObjectContainerBSDArchive::Object::Object()
-: ar_name(), ar_date(0), ar_uid(0), ar_gid(0), ar_mode(0), ar_size(0),
-  ar_file_offset(0), ar_file_size(0) {}
+: ar_name(), modification_time(0), uid(0), gid(0), mode(0), size(0),
+  file_offset(0), file_size(0) {}
 
 void ObjectContainerBSDArchive::Object::Clear() {
   ar_name.Clear();
-  ar_date = 0;
-  ar_uid = 0;
-  ar_gid = 0;
-  ar_mode = 0;
-  ar_size = 0;
-  ar_file_offset = 0;
-  ar_file_size = 0;
+  modification_time = 0;
+  uid = 0;
+  gid = 0;
+  mode = 0;
+  size = 0;
+  file_offset = 0;
+  file_size = 0;
 }
 
 lldb::offset_t
@@ -102,19 +102,19 @@
   }
 
   str.assign((const char *)data.GetData(&offset, 12), 12);
-  ar_date = strtoul(str.c_str(), &err, 10);
+  modification_time = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 6), 6);
-  ar_uid = strtoul(str.c_str(), &err, 10);
+  uid = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 6), 6);
-  ar_gid = strtoul(str.c_str(), &err, 10);
+  gid = strtoul(str.c_str(), &err, 10);
 
   str.assign((const char *)data.GetData(&offset, 8), 8);
-  ar_mode = strtoul(str.c_str(), &err, 8);
+  mode = strtoul(str.c_str(), &err, 8);
 
   str.assign((co

[Lldb-commits] [PATCH] D64599: [LanguageRuntime] Move CPPLanguageRuntime into a plugin

2019-07-12 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365951: [LanguageRuntime] Move CPPLanguageRuntime into a 
plugin (authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64599?vs=209331&id=209575#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64599

Files:
  lldb/trunk/include/lldb/Target/CPPLanguageRuntime.h
  lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
  lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/CMakeLists.txt
  lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
  lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
  lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt
  
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
  lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
  
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
  lldb/trunk/source/Target/CMakeLists.txt
  lldb/trunk/source/Target/CPPLanguageRuntime.cpp

Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
===
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h
@@ -19,10 +19,11 @@
 #include "llvm/ADT/StringRef.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Expression/LLVMUserExpression.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/lldb-private.h"
 
+#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
+
 namespace lldb_private {
 namespace lldb_renderscript {
 
Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
===
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -24,7 +24,6 @@
 #include "lldb/Expression/FunctionCaller.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
@@ -39,6 +38,7 @@
 
 #include "Plugins/Process/Utility/HistoryThread.h"
 #include "Plugins/Language/ObjC/NSString.h"
+#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
 
 #include 
 
Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/CMakeLists.txt
@@ -19,6 +19,7 @@
 lldbTarget
 lldbUtility
 lldbPluginExpressionParserClang
+lldbPluginCPPRuntime
   LINK_COMPONENTS
 Support
   )
Index: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/CMakeLists.txt
@@ -7,4 +7,5 @@
 lldbInterpreter
 lldbSymbol
 lldbTarget
+lldbPluginCPPRuntime
   )
Index: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
===
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
@@ -16,10 +16,11 @@
 #include "lldb/Breakpoint/BreakpointResolver.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Symbol/Type.h"
-#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/lldb-private.h"
 
+#include "Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h"
+
 namespace lldb_private {
 
 class ItaniumABILanguageRuntime : public lldb_private::CPPLanguageRuntime {
Index: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
===
--- lldb/trunk/source/Plugi

[Lldb-commits] [PATCH] D64670: [lldb][doc] Document how our LLDB table gen initialized options

2019-07-12 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: jingham.
Herald added subscribers: lldb-commits, abidh.
Herald added a project: LLDB.

This patch adds documentation that should make it easier to migrate from using 
the old initializers to the table gen format.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D64670

Files:
  lldb/source/Commands/OptionsBase.td

Index: lldb/source/Commands/OptionsBase.td
===
--- lldb/source/Commands/OptionsBase.td
+++ lldb/source/Commands/OptionsBase.td
@@ -1,3 +1,101 @@
+
+// The fields below describe how the fields of `OptionDefinition` struct are
+// initialized by different definitions in the Options.td and this file.
+
+// Field: usage_mask
+// Default value: LLDB_OPT_SET_ALL (Option allowed in all groups)
+// Set by:
+//  - `Group`: Sets a single group to this option.
+// Example: def foo : Option<"foo", "f">, Group<1>;
+//  - `Groups`: Sets a given list of group numbers.
+//  Example: def foo : Option<"foo", "f">, Groups<[1,4,6]>;
+//  - `GroupRange`: Sets an interval of groups. Start and end are inclusive.
+//  Example: def foo : Option<"foo", "f">, GroupRange<1, 4>;
+//   Sets group 1, 2, 3, 4 for the option.
+
+// Field: required
+// Default value: false (Not required)
+// Set by:
+//   - `Required`: Marks the option as required.
+//  Example: def foo : Option<"foo", "f">, Required;
+
+// Field: long_option
+// Default value: not available (has to be defined in Option)
+// Set by:
+//   - `Option` constructor: Already set by constructor.
+//   Example: def foo : Option<"long-option", "l">
+//   ^
+//long option value
+
+// Field: short_option
+// Default value: not available (has to be defined in Option)
+// Set by:
+//   - `Option` constructor: Already set by constructor.
+//   Example: def foo : Option<"long-option", "l">
+// ^
+//short option
+
+// Field: option_has_arg
+// Default value: OptionParser::eNoArgument (No argument allowed)
+// Set by:
+//  - `OptionalArg`: Sets the argument type and marks it as optional.
+//  - `Arg`: Sets the argument type and marks it as required.
+//  - `EnumArg`: Sets the argument type to an enum and marks it as required.
+// See argument_type field for more info.
+
+// Field: validator
+// Default value: 0 (No validator for option)
+// Set by: Nothing. This is currently only set after initialization in LLDB.
+
+// Field: enum_values
+// Default value: {} (No enum associated with this option)
+// Set by:
+//  - `EnumArg`: Sets the argument type and assigns it a enum holding the valid
+//   values. The enum needs to be a variable in the including code.
+//   Marks the option as required (see option_has_arg).
+//   Example: def foo : Option<"foo", "f">,
+//  EnumArg<"SortOrder",
+//  "OptionEnumValues(g_sort_option_enumeration)">;
+
+// Field: completion_type
+// Default value: CommandCompletions::eNoCompletion (no tab completion)
+// Set by:
+//  - `Completion`: Gives the option a single completion kind.
+//  Example: def foo : Option<"foo", "f">,
+// Completion<"DiskFile">;
+//   Sets the completion to eDiskFileCompletion
+//
+//  - `Completions`: Sets a given kinds of completions.
+//   Example: def foo : Option<"foo", "f">,
+//  Completions<["DiskFile", "DiskDirectory"]>;
+//Sets the completion to
+//`eDiskFileCompletion | eDiskDirectoryCompletion`.
+
+// Field: argument_type
+// Default value: eArgTypeNone
+// Set by:
+//  - `OptionalArg`: Sets the argument type and marks it as optional.
+//   Example: def foo : Option<"foo", "f">, OptionalArg<"Pid">;
+//   Sets the argument type to eArgTypePid and marks

[Lldb-commits] [PATCH] D64251: Don't depend on psutil on AIX

2019-07-12 Thread David Tenty via Phabricator via lldb-commits
daltenty marked 6 inline comments as done.
daltenty added inline comments.



Comment at: llvm/utils/lit/lit/util.py:426
 
+def killProcessAndChildrenIsSupported(llvm_config):
+"""

delcypher wrote:
> I don't really like how we're now coupling this function with the `LitConfig` 
> object just so we can print out the text `Found python psutil module`. Do we 
> actually need to print out that message? If the tests don't rely on this I 
> either suggest we remove this.
I don't really think it's necessary, this was just to mimic the previous 
behavior. I will remove it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64251



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


[Lldb-commits] [PATCH] D64251: Don't depend on psutil on AIX

2019-07-12 Thread David Tenty via Phabricator via lldb-commits
daltenty updated this revision to Diff 209619.
daltenty marked an inline comment as done.
daltenty added a comment.

- Address review comments round 3


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64251

Files:
  libcxx/utils/libcxx/util.py
  lldb/lit/lit.cfg.py
  llvm/utils/lit/lit/LitConfig.py
  llvm/utils/lit/lit/util.py
  llvm/utils/lit/tests/googletest-timeout.py
  llvm/utils/lit/tests/lit.cfg
  llvm/utils/lit/tests/shtest-timeout.py

Index: llvm/utils/lit/tests/shtest-timeout.py
===
--- llvm/utils/lit/tests/shtest-timeout.py
+++ llvm/utils/lit/tests/shtest-timeout.py
@@ -1,4 +1,4 @@
-# REQUIRES: python-psutil
+# REQUIRES: lit-max-individual-test-time
 
 # llvm.org/PR33944
 # UNSUPPORTED: system-windows
Index: llvm/utils/lit/tests/lit.cfg
===
--- llvm/utils/lit/tests/lit.cfg
+++ llvm/utils/lit/tests/lit.cfg
@@ -1,6 +1,7 @@
 # -*- Python -*-
 
 import os
+import platform
 import sys
 
 import lit.formats
@@ -56,10 +57,10 @@
 os.path.dirname(__file__), ".coveragerc")
 
 # Add a feature to detect if psutil is available
-try:
-import psutil
-lit_config.note('Found python psutil module')
-config.available_features.add("python-psutil")
-except ImportError:
-lit_config.warning('Could not import psutil. Some tests will be skipped and'
-   ' the --timeout command line argument will not work.')
+supported, errormsg = lit_config.maxIndividualTestTimeIsSupported
+if supported:
+config.available_features.add("lit-max-individual-test-time")
+else:
+lit_config.warning('Setting a timeout per test not supported. ' + errormsg
+   + ' Some tests will be skipped and the --timeout'
+ ' command line argument will not work.')
Index: llvm/utils/lit/tests/googletest-timeout.py
===
--- llvm/utils/lit/tests/googletest-timeout.py
+++ llvm/utils/lit/tests/googletest-timeout.py
@@ -1,4 +1,4 @@
-# REQUIRES: python-psutil
+# REQUIRES: lit-max-individual-test-time
 
 # Check that the per test timeout is enforced when running GTest tests.
 #
Index: llvm/utils/lit/lit/util.py
===
--- llvm/utils/lit/lit/util.py
+++ llvm/utils/lit/lit/util.py
@@ -423,34 +423,56 @@
 return out.decode()
 return None
 
+def killProcessAndChildrenIsSupported():
+"""
+Returns a tuple ( , )
+where
+`` is True if `killProcessAndChildren()` is supported on
+the current host, returns False otherwise.
+`` is an empty string if `` is True,
+otherwise is contains a string describing why the function is
+not supported.
+"""
+if platform.system() == 'AIX':
+return (True, "")
+try:
+import psutil  # noqa: F401
+return (True, "")
+except ImportError:
+return (False,  "Requires the Python psutil module but it could"
+" not be found. Try installing it via pip or via"
+" your operating system's package manager.")
 
 def killProcessAndChildren(pid):
 """This function kills a process with ``pid`` and all its running children
-(recursively). It is currently implemented using the psutil module which
-provides a simple platform neutral implementation.
+(recursively). It is currently implemented using the psutil module on some
+plaftorms which provides a simple platform neutral implementation.
 
-TODO: Reimplement this without using psutil so we can   remove
-our dependency on it.
+TODO: Reimplement this without using psutil on all platforms so we can
+remove our dependency on it.
 
 """
-import psutil
-try:
-psutilProc = psutil.Process(pid)
-# Handle the different psutil API versions
+if platform.system() == 'AIX':
+subprocess.call('kill -kill $(ps -o pid= -L{})'.format(pid), shell=True)
+else:
+import psutil
 try:
-# psutil >= 2.x
-children_iterator = psutilProc.children(recursive=True)
-except AttributeError:
-# psutil 1.x
-children_iterator = psutilProc.get_children(recursive=True)
-for child in children_iterator:
+psutilProc = psutil.Process(pid)
+# Handle the different psutil API versions
 try:
-child.kill()
-except psutil.NoSuchProcess:
-pass
-psutilProc.kill()
-except psutil.NoSuchProcess:
-pass
+# psutil >= 2.x
+children_iterator = psutilProc.children(recursive=True)
+except AttributeError:
+# psutil 1.x
+children_iterator = 

[Lldb-commits] [PATCH] D64251: Don't depend on psutil on AIX

2019-07-12 Thread David Tenty via Phabricator via lldb-commits
daltenty updated this revision to Diff 209621.
daltenty added a comment.

- Add a space to warning in LLDB lit config


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64251

Files:
  libcxx/utils/libcxx/util.py
  lldb/lit/lit.cfg.py
  llvm/utils/lit/lit/LitConfig.py
  llvm/utils/lit/lit/util.py
  llvm/utils/lit/tests/googletest-timeout.py
  llvm/utils/lit/tests/lit.cfg
  llvm/utils/lit/tests/shtest-timeout.py

Index: llvm/utils/lit/tests/shtest-timeout.py
===
--- llvm/utils/lit/tests/shtest-timeout.py
+++ llvm/utils/lit/tests/shtest-timeout.py
@@ -1,4 +1,4 @@
-# REQUIRES: python-psutil
+# REQUIRES: lit-max-individual-test-time
 
 # llvm.org/PR33944
 # UNSUPPORTED: system-windows
Index: llvm/utils/lit/tests/lit.cfg
===
--- llvm/utils/lit/tests/lit.cfg
+++ llvm/utils/lit/tests/lit.cfg
@@ -1,6 +1,7 @@
 # -*- Python -*-
 
 import os
+import platform
 import sys
 
 import lit.formats
@@ -56,10 +57,10 @@
 os.path.dirname(__file__), ".coveragerc")
 
 # Add a feature to detect if psutil is available
-try:
-import psutil
-lit_config.note('Found python psutil module')
-config.available_features.add("python-psutil")
-except ImportError:
-lit_config.warning('Could not import psutil. Some tests will be skipped and'
-   ' the --timeout command line argument will not work.')
+supported, errormsg = lit_config.maxIndividualTestTimeIsSupported
+if supported:
+config.available_features.add("lit-max-individual-test-time")
+else:
+lit_config.warning('Setting a timeout per test not supported. ' + errormsg
+   + ' Some tests will be skipped and the --timeout'
+ ' command line argument will not work.')
Index: llvm/utils/lit/tests/googletest-timeout.py
===
--- llvm/utils/lit/tests/googletest-timeout.py
+++ llvm/utils/lit/tests/googletest-timeout.py
@@ -1,4 +1,4 @@
-# REQUIRES: python-psutil
+# REQUIRES: lit-max-individual-test-time
 
 # Check that the per test timeout is enforced when running GTest tests.
 #
Index: llvm/utils/lit/lit/util.py
===
--- llvm/utils/lit/lit/util.py
+++ llvm/utils/lit/lit/util.py
@@ -423,34 +423,56 @@
 return out.decode()
 return None
 
+def killProcessAndChildrenIsSupported():
+"""
+Returns a tuple ( , )
+where
+`` is True if `killProcessAndChildren()` is supported on
+the current host, returns False otherwise.
+`` is an empty string if `` is True,
+otherwise is contains a string describing why the function is
+not supported.
+"""
+if platform.system() == 'AIX':
+return (True, "")
+try:
+import psutil  # noqa: F401
+return (True, "")
+except ImportError:
+return (False,  "Requires the Python psutil module but it could"
+" not be found. Try installing it via pip or via"
+" your operating system's package manager.")
 
 def killProcessAndChildren(pid):
 """This function kills a process with ``pid`` and all its running children
-(recursively). It is currently implemented using the psutil module which
-provides a simple platform neutral implementation.
+(recursively). It is currently implemented using the psutil module on some
+plaftorms which provides a simple platform neutral implementation.
 
-TODO: Reimplement this without using psutil so we can   remove
-our dependency on it.
+TODO: Reimplement this without using psutil on all platforms so we can
+remove our dependency on it.
 
 """
-import psutil
-try:
-psutilProc = psutil.Process(pid)
-# Handle the different psutil API versions
+if platform.system() == 'AIX':
+subprocess.call('kill -kill $(ps -o pid= -L{})'.format(pid), shell=True)
+else:
+import psutil
 try:
-# psutil >= 2.x
-children_iterator = psutilProc.children(recursive=True)
-except AttributeError:
-# psutil 1.x
-children_iterator = psutilProc.get_children(recursive=True)
-for child in children_iterator:
+psutilProc = psutil.Process(pid)
+# Handle the different psutil API versions
 try:
-child.kill()
-except psutil.NoSuchProcess:
-pass
-psutilProc.kill()
-except psutil.NoSuchProcess:
-pass
+# psutil >= 2.x
+children_iterator = psutilProc.children(recursive=True)
+except AttributeError:
+# psutil 1.x
+children_iterator = psutilProc.get_children(recursive

[Lldb-commits] [PATCH] D64670: [lldb][doc] Document how our LLDB table gen initialized options

2019-07-12 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Thanks for writing this up!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64670



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


[Lldb-commits] [PATCH] D63813: Adjust variable formatting table

2019-07-12 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

That looks good.

Note that the "address" format does more than show symbol/file/line offset, it 
will also print the string for addresses that point into the string pool.  
Might be worth mentioning that.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D63813



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


[Lldb-commits] [lldb] r365978 - [DWARFContext] Strip leading dot in section names

2019-07-12 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Jul 12 17:12:22 2019
New Revision: 365978

URL: http://llvm.org/viewvc/llvm-project?rev=365978&view=rev
Log:
[DWARFContext] Strip leading dot in section names

The LLVM context doesn't expect the leading dot in the section name.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp?rev=365978&r1=365977&r2=365978&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp Fri Jul 12 
17:12:22 2019
@@ -116,6 +116,8 @@ llvm::DWARFContext &DWARFContext::GetAsL
 
   llvm::StringRef data = llvm::toStringRef(section_data.GetData());
   llvm::StringRef name = section.GetName().GetStringRef();
+  if (name.startswith("."))
+name = name.drop_front();
   section_map.try_emplace(
   name, llvm::MemoryBuffer::getMemBuffer(data, name, false));
 };


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


[Lldb-commits] [PATCH] D62570: [WIP] Use LLVM's debug line parser in LLDB

2019-07-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 209648.
JDevlieghere added a comment.

- Rebase on current master
- Fix bug where we weren't actually creating any sections in the LLVM DWARF 
Context
- Don't create an LLVM DWARFUnit
- Get rid of `(*line_table)->`
- Add logging instead of swallowing errors


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

https://reviews.llvm.org/D62570

Files:
  lldb/include/lldb/Core/FileSpecList.h
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -486,6 +486,8 @@
   ClangTypeToDIE m_forward_decl_clang_type_to_die;
   llvm::DenseMap
   m_type_unit_support_files;
+  llvm::DenseMap
+  m_support_files;
   std::vector m_lldb_cu_to_dwarf_unit;
 };
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -58,7 +58,6 @@
 #include "DWARFDebugAbbrev.h"
 #include "DWARFDebugAranges.h"
 #include "DWARFDebugInfo.h"
-#include "DWARFDebugLine.h"
 #include "DWARFDebugMacro.h"
 #include "DWARFDebugRanges.h"
 #include "DWARFDeclContext.h"
@@ -72,6 +71,7 @@
 #include "SymbolFileDWARFDwo.h"
 #include "SymbolFileDWARFDwp.h"
 
+#include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/Support/FileSystem.h"
 
 #include 
@@ -793,18 +793,18 @@
 bool SymbolFileDWARF::ParseSupportFiles(CompileUnit &comp_unit,
 FileSpecList &support_files) {
   ASSERT_MODULE_LOCK(this);
-  if (DWARFUnit *unit = GetDWARFCompileUnit(&comp_unit)) {
-const dw_offset_t stmt_list = unit->GetLineTableOffset();
-if (stmt_list != DW_INVALID_OFFSET) {
-  // All file indexes in DWARF are one based and a file of index zero is
-  // supposed to be the compile unit itself.
-  support_files.Append(comp_unit);
-  return DWARFDebugLine::ParseSupportFiles(comp_unit.GetModule(),
-   m_context.getOrLoadLineData(),
-   stmt_list, support_files, unit);
-}
-  }
-  return false;
+
+  if (!comp_unit.GetLineTable())
+ParseLineTable(comp_unit);
+
+  // All file indexes in DWARF are one based and a file of index zero is
+  // supposed to be the compile unit itself.
+  // FIXME: This is false for DWARF5
+  support_files.Append(comp_unit);
+  for (const FileSpec &file : m_support_files[&comp_unit])
+support_files.Append(file);
+
+  return true;
 }
 
 FileSpec SymbolFileDWARF::GetFile(DWARFUnit &unit, size_t file_idx) {
@@ -828,6 +828,7 @@
   offset == llvm::DenseMapInfo::getTombstoneKey())
 return empty_list;
 
+#if 0
   // Many type units can share a line table, so parse the support file list
   // once, and cache it based on the offset field.
   auto iter_bool = m_type_unit_support_files.try_emplace(offset);
@@ -839,6 +840,9 @@
   list, &tu);
   }
   return list;
+#endif
+
+  return empty_list;
 }
 
 bool SymbolFileDWARF::ParseIsOptimized(CompileUnit &comp_unit) {
@@ -901,41 +905,27 @@
   return true;
 }
 
-struct ParseDWARFLineTableCallbackInfo {
-  LineTable *line_table;
-  std::unique_ptr sequence_up;
-  lldb::addr_t addr_mask;
-};
+static const llvm::DWARFDebugLine::LineTable *
+ParseLLVMLineTable(lldb_private::DWARFContext &context,
+   llvm::DWARFDebugLine &line, dw_offset_t line_offset,
+   dw_offset_t unit_offset) {
+  Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
 
-// ParseStatementTableCallback
-static void ParseDWARFLineTableCallback(dw_offset_t offset,
-const DWARFDebugLine::State &state,
-void *userData) {
-  if (state.row == DWARFDebugLine::State::StartParsingLineTable) {
-// Just started parsing the line table
-  } else if (state.row == DWARFDebugLine::State::DoneParsingLineTable) {
-// Done parsing line table, nothing to do for the cleanup
-  } else {
-ParseDWARFLineTableCallbackInfo *info =
-(ParseDWARFLineTableCallbackInfo *)userData;
-LineTable *line_table = info->line_table;
-
-// If this is our first time here, we need to create a sequence container.
-if (!info->sequence_up) {
-  info->sequence_up.reset(line_table->CreateLineSequenceContainer());
-  assert(info->sequence_up.get());
-}
-line_table->AppendLineEntryToSequence(
-info->seque

[Lldb-commits] [PATCH] D62570: [WIP] Use LLVM's debug line parser in LLDB

2019-07-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere marked 7 inline comments as done.
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/Core/FileSpecList.h:29
+  typedef std::vector collection;
+  typedef collection::iterator iterator;
+  typedef collection::const_iterator const_iterator;

grimar wrote:
> Seems you don't use `iterator` anywhere?
It's used in the range-based for loop in `ParseSupportFiles`


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

https://reviews.llvm.org/D62570



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


[Lldb-commits] [PATCH] D62570: [WIP] Use LLVM's debug line parser in LLDB

2019-07-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 209650.
JDevlieghere marked 2 inline comments as done.
JDevlieghere added a comment.

- Address remaining comment from George


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

https://reviews.llvm.org/D62570

Files:
  lldb/include/lldb/Core/FileSpecList.h
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -486,6 +486,8 @@
   ClangTypeToDIE m_forward_decl_clang_type_to_die;
   llvm::DenseMap
   m_type_unit_support_files;
+  llvm::DenseMap
+  m_support_files;
   std::vector m_lldb_cu_to_dwarf_unit;
 };
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -58,7 +58,6 @@
 #include "DWARFDebugAbbrev.h"
 #include "DWARFDebugAranges.h"
 #include "DWARFDebugInfo.h"
-#include "DWARFDebugLine.h"
 #include "DWARFDebugMacro.h"
 #include "DWARFDebugRanges.h"
 #include "DWARFDeclContext.h"
@@ -72,6 +71,7 @@
 #include "SymbolFileDWARFDwo.h"
 #include "SymbolFileDWARFDwp.h"
 
+#include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/Support/FileSystem.h"
 
 #include 
@@ -793,18 +793,18 @@
 bool SymbolFileDWARF::ParseSupportFiles(CompileUnit &comp_unit,
 FileSpecList &support_files) {
   ASSERT_MODULE_LOCK(this);
-  if (DWARFUnit *unit = GetDWARFCompileUnit(&comp_unit)) {
-const dw_offset_t stmt_list = unit->GetLineTableOffset();
-if (stmt_list != DW_INVALID_OFFSET) {
-  // All file indexes in DWARF are one based and a file of index zero is
-  // supposed to be the compile unit itself.
-  support_files.Append(comp_unit);
-  return DWARFDebugLine::ParseSupportFiles(comp_unit.GetModule(),
-   m_context.getOrLoadLineData(),
-   stmt_list, support_files, unit);
-}
-  }
-  return false;
+
+  if (!comp_unit.GetLineTable())
+ParseLineTable(comp_unit);
+
+  // All file indexes in DWARF are one based and a file of index zero is
+  // supposed to be the compile unit itself.
+  // FIXME: This is false for DWARF5
+  support_files.Append(comp_unit);
+  for (const FileSpec &file : m_support_files[&comp_unit])
+support_files.Append(file);
+
+  return true;
 }
 
 FileSpec SymbolFileDWARF::GetFile(DWARFUnit &unit, size_t file_idx) {
@@ -828,6 +828,7 @@
   offset == llvm::DenseMapInfo::getTombstoneKey())
 return empty_list;
 
+#if 0
   // Many type units can share a line table, so parse the support file list
   // once, and cache it based on the offset field.
   auto iter_bool = m_type_unit_support_files.try_emplace(offset);
@@ -839,6 +840,9 @@
   list, &tu);
   }
   return list;
+#endif
+
+  return empty_list;
 }
 
 bool SymbolFileDWARF::ParseIsOptimized(CompileUnit &comp_unit) {
@@ -901,41 +905,27 @@
   return true;
 }
 
-struct ParseDWARFLineTableCallbackInfo {
-  LineTable *line_table;
-  std::unique_ptr sequence_up;
-  lldb::addr_t addr_mask;
-};
+static const llvm::DWARFDebugLine::LineTable *
+ParseLLVMLineTable(lldb_private::DWARFContext &context,
+   llvm::DWARFDebugLine &line, dw_offset_t line_offset,
+   dw_offset_t unit_offset) {
+  Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
 
-// ParseStatementTableCallback
-static void ParseDWARFLineTableCallback(dw_offset_t offset,
-const DWARFDebugLine::State &state,
-void *userData) {
-  if (state.row == DWARFDebugLine::State::StartParsingLineTable) {
-// Just started parsing the line table
-  } else if (state.row == DWARFDebugLine::State::DoneParsingLineTable) {
-// Done parsing line table, nothing to do for the cleanup
-  } else {
-ParseDWARFLineTableCallbackInfo *info =
-(ParseDWARFLineTableCallbackInfo *)userData;
-LineTable *line_table = info->line_table;
-
-// If this is our first time here, we need to create a sequence container.
-if (!info->sequence_up) {
-  info->sequence_up.reset(line_table->CreateLineSequenceContainer());
-  assert(info->sequence_up.get());
-}
-line_table->AppendLineEntryToSequence(
-info->sequence_up.get(), state.address & info->addr_mask, state.line,
-state.column, state.file, state.is_stmt, state.basic_block,
-   

[Lldb-commits] [lldb] r365988 - Make Python version setting actually effective

2019-07-12 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Jul 12 20:30:55 2019
New Revision: 365988

URL: http://llvm.org/viewvc/llvm-project?rev=365988&view=rev
Log:
Make Python version setting actually effective

This needs to be outside the if to actually work. Also, this adjusts the
list of versions to match LLVM.

Patch by: Christian Biesinger

Differential revision: https://reviews.llvm.org/D64578

Modified:
lldb/trunk/cmake/modules/LLDBStandalone.cmake

Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBStandalone.cmake?rev=365988&r1=365987&r2=365988&view=diff
==
--- lldb/trunk/cmake/modules/LLDBStandalone.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBStandalone.cmake Fri Jul 12 20:30:55 2019
@@ -87,8 +87,8 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   include(CheckAtomic)
   include(LLVMDistributionSupport)
 
+  set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 2.7)
   if (PYTHON_EXECUTABLE STREQUAL "")
-set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5)
 include(FindPythonInterp)
 if( NOT PYTHONINTERP_FOUND )
   message(FATAL_ERROR


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


[Lldb-commits] [lldb] r365991 - [lldb] [test] Un-XFAIL TestFormattersSBAPI on NetBSD

2019-07-12 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Fri Jul 12 23:24:14 2019
New Revision: 365991

URL: http://llvm.org/viewvc/llvm-project?rev=365991&view=rev
Log:
[lldb] [test] Un-XFAIL TestFormattersSBAPI on NetBSD

Modified:

lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py?rev=365991&r1=365990&r2=365991&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py
 Fri Jul 12 23:24:14 2019
@@ -22,7 +22,6 @@ class SBFormattersAPITestCase(TestBase):
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
 @add_test_categories(['pyapi'])
-@expectedFailureNetBSD
 def test_formatters_api(self):
 """Test Python APIs for working with formatters"""
 self.build()


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


[Lldb-commits] [PATCH] D64647: [lldb] [Process/NetBSD] Implement per-thread execution control

2019-07-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny marked an inline comment as done.
mgorny added a comment.

In D64647#1583429 , @krytarowski wrote:

> Something that we do not cover here is that once a tracee reports a signal 
> (like someone poked it with SIGUSR1) and we want to pass it over to the 
> tracee, we will reset siginfo.
>
> This scenario should be covered by a test and we should handle it properly..
>
> The solution in NetBSD for passing over signals without changing siginfo, is 
> to not calling PT_SET_SIGINFO as the default one will be kept by the kernel. 
> Optionally pick old siginfo with PT_GET_SIGINFO and optionally change 
> destination lwp.


How is 'properly'? Should we reject resuming with a signal when there's already 
another signal pending?




Comment at: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp:354
+  if (signal != LLDB_INVALID_SIGNAL_NUMBER && signal != action->signal)
+return Status("NetBSD does not support passing multiple signals 
simultaneously");
 

labath wrote:
> krytarowski wrote:
> > mgorny wrote:
> > > labath wrote:
> > > > Is this "passing multiple signals simultaneously", or "passing multiple 
> > > > *distinct* signals simultaneously". (E.g,. thread 1 gets a SIGALRM, 
> > > > thread 2 gets SIGIO, etc.).
> > > The former. Basically there's one siginfo slot, so you can either put a 
> > > signal for whole process, or for one LWP.
> > Once we emit a single signal to all threads, it's still technically a 
> > single signal that hits the process.
> Ok, that makes sense. But I don't think that's what the code does right now 
> (IIUC, this line will only fire if the current signal is different that the 
> signal sent to the previous thread).
There's a second `if` on line 400 that verifies the number of threads signaled.

The idea is that we have either:
* exactly one thread signaled,
* all threads signaled with the same signal.

Here we check for the 'same signal' condition.


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

https://reviews.llvm.org/D64647



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