[Lldb-commits] [PATCH] D39966: Add a data formatter for libc++ std::bitset

2017-11-14 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added inline comments.



Comment at: source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp:62
+
+  m_bool_type = 
m_backend.GetCompilerType().GetBasicTypeFromAST(eBasicTypeBool);
+  m_elements.assign(size, ValueObjectSP());

jingham wrote:
> Does this need to be done every time you Update?  Couldn't you do this in the 
> constructor instead?  This is probably pretty cheap call, so it doesn't 
> matter much, but it seems odd.
The other pretty printers were doing all of their initialization in the Update 
function, but I don't see a reason why this couldn't be done in the 
constructor. In that case, I can probably do the byte order and pointer size 
computation there as well.


https://reviews.llvm.org/D39966



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


[Lldb-commits] [lldb] r318145 - Add a data formatter for libc++ std::bitset

2017-11-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue Nov 14 03:15:03 2017
New Revision: 318145

URL: http://llvm.org/viewvc/llvm-project?rev=318145&view=rev
Log:
Add a data formatter for libc++ std::bitset

Reviewers: jingham, EricWF

Subscribers: mgorny, lldb-commits

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.h

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile?rev=318145&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
 Tue Nov 14 03:15:03 2017
@@ -0,0 +1,6 @@
+LEVEL = ../../../../../make
+
+CXX_SOURCES := main.cpp
+
+USE_LIBCPP := 1
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py?rev=318145&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
 Tue Nov 14 03:15:03 2017
@@ -0,0 +1,46 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDataFormatterLibcxxBitset(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+
+primes = [1]*300
+primes[0] = primes[1] = 0
+for i in range(2, len(primes)):
+for j in range(2*i, len(primes), i):
+primes[j] = 0
+self.primes = primes
+
+def check(self, name, size):
+var = self.frame().FindVariable(name)
+self.assertTrue(var.IsValid())
+self.assertEqual(var.GetNumChildren(), size)
+for i in range(size):
+child = var.GetChildAtIndex(i)
+self.assertEqual(child.GetValueAsUnsigned(), self.primes[i],
+"variable: %s, index: %d"%(name, size))
+
+@add_test_categories(["libc++"])
+def test(self):
+"""Test that std::bitset is displayed correctly"""
+self.build()
+lldbutil.run_to_source_breakpoint(self, '// break here',
+lldb.SBFileSpec("main.cpp", False))
+
+self.check("empty", 0)
+self.check("small", 13)
+self.check("large", 200)

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp?rev=318145&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp
 Tue Nov 14 03:15:03 2017
@@ -0,0 +1,20 @@
+#include 
+
+template
+void fill(std::bitset &b) {
+  b.set();
+  b[0] = b[1] = false;
+  for (std::size_t i = 2; i < N; ++i) {
+for (std::size_t j = 2*i; j < N; j+=i)
+  b[j] = false;
+  }
+}
+
+int main() {
+  std::bitset<0> empty;
+  std::bitset<13> small;
+  fill(small);
+  std::bitset<200> large;
+  fill(large);
+  return 0; // break here
+}

Modifie

[Lldb-commits] [PATCH] D39966: Add a data formatter for libc++ std::bitset

2017-11-14 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
Closed by commit rL318145: Add a data formatter for libc++ std::bitset 
(authored by labath).

Changed prior to commit:
  https://reviews.llvm.org/D39966?vs=122685&id=122808#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39966

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
  lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.h
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/TestDataFormatterLibcxxBitset.py
@@ -0,0 +1,46 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestDataFormatterLibcxxBitset(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+
+primes = [1]*300
+primes[0] = primes[1] = 0
+for i in range(2, len(primes)):
+for j in range(2*i, len(primes), i):
+primes[j] = 0
+self.primes = primes
+
+def check(self, name, size):
+var = self.frame().FindVariable(name)
+self.assertTrue(var.IsValid())
+self.assertEqual(var.GetNumChildren(), size)
+for i in range(size):
+child = var.GetChildAtIndex(i)
+self.assertEqual(child.GetValueAsUnsigned(), self.primes[i],
+"variable: %s, index: %d"%(name, size))
+
+@add_test_categories(["libc++"])
+def test(self):
+"""Test that std::bitset is displayed correctly"""
+self.build()
+lldbutil.run_to_source_breakpoint(self, '// break here',
+lldb.SBFileSpec("main.cpp", False))
+
+self.check("empty", 0)
+self.check("small", 13)
+self.check("large", 200)
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp
@@ -0,0 +1,20 @@
+#include 
+
+template
+void fill(std::bitset &b) {
+  b.set();
+  b[0] = b[1] = false;
+  for (std::size_t i = 2; i < N; ++i) {
+for (std::size_t j = 2*i; j < N; j+=i)
+  b[j] = false;
+  }
+}
+
+int main() {
+  std::bitset<0> empty;
+  std::bitset<13> small;
+  fill(small);
+  std::bitset<200> large;
+  fill(large);
+  return 0; // break here
+}
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/Makefile
@@ -0,0 +1,6 @@
+LEVEL = ../../../../../make
+
+CXX_SOURCES := main.cpp
+
+USE_LIBCPP := 1
+include $(LEVEL)/Makefile.rules
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp
@@ -0,0 +1,109 @@
+//===-- LibCxxBitset.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "LibCxx.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Target/Target.h"
+
+using name

[Lldb-commits] [PATCH] D40022: Corrected two typos and removed unused variable

2017-11-14 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha created this revision.
Herald added a subscriber: ki.stfu.

+ clang-format


Repository:
  rL LLVM

https://reviews.llvm.org/D40022

Files:
  include/lldb/Core/Architecture.h
  source/Commands/CommandObjectTarget.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp


Index: source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -178,7 +178,6 @@
 const RegisterInfo *reg_info, GDBRemoteCommunicationClient &gdb_comm) {
   const uint32_t lldb_reg = reg_info->kinds[eRegisterKindLLDB];
   const uint32_t remote_reg = reg_info->kinds[eRegisterKindProcessPlugin];
-  StringExtractorGDBRemote response;
   if (DataBufferSP buffer_sp =
   gdb_comm.ReadRegister(m_thread.GetProtocolID(), remote_reg))
 return PrivateSetRegisterValue(
Index: source/Commands/CommandObjectTarget.cpp
===
--- source/Commands/CommandObjectTarget.cpp
+++ source/Commands/CommandObjectTarget.cpp
@@ -109,7 +109,7 @@
 const uint32_t start_frame = 0;
 const uint32_t num_frames = 1;
 const uint32_t num_frames_with_source = 1;
-const bool stop_format = false;
+const bool stop_format = false;
 process_sp->GetStatus(strm);
 process_sp->GetThreadStatus(strm, only_threads_with_stop_reason,
 start_frame, num_frames,
@@ -2576,9 +2576,10 @@
 public:
   CommandObjectTargetModulesLoad(CommandInterpreter &interpreter)
   : CommandObjectTargetModulesModuleAutoComplete(
-interpreter, "target modules load", "Set the load addresses for "
-"one or more sections in a "
-"target module.",
+interpreter, "target modules load",
+"Set the load addresses for "
+"one or more sections in a "
+"target module.",
 "target modules load [--file  --uuid ]  "
 " [  ]"),
 m_option_group(),
@@ -2586,7 +2587,7 @@
   "Fullpath or basename for module to load.", ""),
 m_load_option(LLDB_OPT_SET_1, false, "load", 'l',
   "Write file contents to the memory.", false, true),
-m_pc_option(LLDB_OPT_SET_1, false, "--set-pc-to-entry", 'p',
+m_pc_option(LLDB_OPT_SET_1, false, "set-pc-to-entry", 'p',
 "Set PC to the entry point."
 " Only applicable with '--load' option.",
 false, true),
Index: include/lldb/Core/Architecture.h
===
--- include/lldb/Core/Architecture.h
+++ include/lldb/Core/Architecture.h
@@ -22,7 +22,7 @@
   //--
   /// This is currently intended to handle cases where a
   /// program stops at an instruction that won't get executed and it
-  /// allows the stop reasonm, like "breakpoint hit", to be replaced
+  /// allows the stop reason, like "breakpoint hit", to be replaced
   /// with a different stop reason like "no stop reason".
   ///
   /// This is specifically used for ARM in Thumb code when we stop in


Index: source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -178,7 +178,6 @@
 const RegisterInfo *reg_info, GDBRemoteCommunicationClient &gdb_comm) {
   const uint32_t lldb_reg = reg_info->kinds[eRegisterKindLLDB];
   const uint32_t remote_reg = reg_info->kinds[eRegisterKindProcessPlugin];
-  StringExtractorGDBRemote response;
   if (DataBufferSP buffer_sp =
   gdb_comm.ReadRegister(m_thread.GetProtocolID(), remote_reg))
 return PrivateSetRegisterValue(
Index: source/Commands/CommandObjectTarget.cpp
===
--- source/Commands/CommandObjectTarget.cpp
+++ source/Commands/CommandObjectTarget.cpp
@@ -109,7 +109,7 @@
 const uint32_t start_frame = 0;
 const uint32_t num_frames = 1;
 const uint32_t num_frames_with_source = 1;
-const bool stop_format = false;
+const bool stop_format = false;
 process_sp->GetStatus(strm);
 process_sp->GetThreadStatus(strm, only_threads_with_stop_reason,
 start_frame, num_frames,
@@ -2576,9 +2576,10 @@
 public:
   CommandObjectTargetModulesLoad(CommandInterpreter &interpreter)
   : CommandObjectTargetModulesModuleAutoComplete(
-interpreter, "target modules load", "Set the load addresses for "
-"one or more sections in 

[Lldb-commits] [PATCH] D40022: Corrected two typos and removed unused variable

2017-11-14 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added inline comments.



Comment at: source/Commands/CommandObjectTarget.cpp:2589
   "Write file contents to the memory.", false, true),
-m_pc_option(LLDB_OPT_SET_1, false, "--set-pc-to-entry", 'p',
 "Set PC to the entry point."

Removed these minuses, otherwise user should type option "set-pc-to-entry"


Repository:
  rL LLVM

https://reviews.llvm.org/D40022



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


[Lldb-commits] libxml2 for Windows

2017-11-14 Thread Tatyana Krasnukha via lldb-commits
Propose to enable libxml2 support for Windows. I've built sources from 
https://git.gnome.org/browse/libxml2 and successfully used lldb with it (in 
part of parsing target.xml in ProcessGDBRemote).


LLDBConfig.cmake.LibXml.patch
Description: LLDBConfig.cmake.LibXml.patch
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D39967: Refactoring of MemoryWrite function

2017-11-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I believe we normally just clang format the changes. This is done with:

  svn diff --diff-cmd=diff -x-U0 | 
$llvm_src/llvm/tools/clang/tools/clang-format/clang-format-diff.py -i -binary 
$llvm_build/bin/clang-format
  git diff -U0 HEAD^ | 
$llvm_src/llvm/tools/clang/tools/clang-format/clang-format-diff.py -i -binary 
$llvm_build/bin/clang-format

You can set $llvm_src and $llvm_build correctly for your system.

With all of the reindentation and extra clang formatting I can't tell what has 
changed here. Did you change anything?


Repository:
  rL LLVM

https://reviews.llvm.org/D39967



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


[Lldb-commits] [PATCH] D39969: Set error status in ObjectFile::LoadInMemory if it is not set

2017-11-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Before working on a file for a diff you will submit, clang format it first, and 
then check it in. No need for review on clang format only changes.

So please clang format first and check in those change and update this with 
only the changes you intend to make to the functionality of the code.


Repository:
  rL LLVM

https://reviews.llvm.org/D39969



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


[Lldb-commits] [PATCH] D39967: Refactoring of MemoryWrite function

2017-11-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Please clang format and check in without any changes to the functionality and 
then make a patch that only has your functional changes.


Repository:
  rL LLVM

https://reviews.llvm.org/D39967



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


[Lldb-commits] [PATCH] D40022: Corrected two typos and removed unused variable

2017-11-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

The "--set-pc-to-entry" change is fine. No need for review when removing unused 
variables or clang formatting, but it would be nice to do those commits 
separately.


Repository:
  rL LLVM

https://reviews.llvm.org/D40022



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


[Lldb-commits] [lldb] r318164 - Add check for self-assignment. NFC

2017-11-14 Thread Don Hinton via lldb-commits
Author: dhinton
Date: Tue Nov 14 10:19:41 2017
New Revision: 318164

URL: http://llvm.org/viewvc/llvm-project?rev=318164&view=rev
Log:
Add check for self-assignment.  NFC

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

Modified:
lldb/trunk/source/Core/RegisterValue.cpp
lldb/trunk/source/Core/Value.cpp

Modified: lldb/trunk/source/Core/RegisterValue.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegisterValue.cpp?rev=318164&r1=318163&r2=318164&view=diff
==
--- lldb/trunk/source/Core/RegisterValue.cpp (original)
+++ lldb/trunk/source/Core/RegisterValue.cpp Tue Nov 14 10:19:41 2017
@@ -539,6 +539,9 @@ bool RegisterValue::SignExtend(uint32_t
 }
 
 bool RegisterValue::CopyValue(const RegisterValue &rhs) {
+  if (this == &rhs)
+return rhs.m_type == eTypeInvalid ? false : true;
+
   m_type = rhs.m_type;
   switch (m_type) {
   case eTypeInvalid:

Modified: lldb/trunk/source/Core/Value.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Value.cpp?rev=318164&r1=318163&r2=318164&view=diff
==
--- lldb/trunk/source/Core/Value.cpp (original)
+++ lldb/trunk/source/Core/Value.cpp Tue Nov 14 10:19:41 2017
@@ -142,6 +142,9 @@ Type *Value::GetType() {
 }
 
 size_t Value::AppendDataToHostBuffer(const Value &rhs) {
+  if (this == &rhs)
+return 0;
+
   size_t curr_size = m_data_buffer.GetByteSize();
   Status error;
   switch (rhs.GetValueType()) {


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


[Lldb-commits] [PATCH] D39578: Fix a couple of self-assignments using memcpy.

2017-11-14 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318164: Add check for self-assignment.  NFC (authored by 
dhinton).

Repository:
  rL LLVM

https://reviews.llvm.org/D39578

Files:
  lldb/trunk/source/Core/RegisterValue.cpp
  lldb/trunk/source/Core/Value.cpp


Index: lldb/trunk/source/Core/Value.cpp
===
--- lldb/trunk/source/Core/Value.cpp
+++ lldb/trunk/source/Core/Value.cpp
@@ -142,6 +142,9 @@
 }
 
 size_t Value::AppendDataToHostBuffer(const Value &rhs) {
+  if (this == &rhs)
+return 0;
+
   size_t curr_size = m_data_buffer.GetByteSize();
   Status error;
   switch (rhs.GetValueType()) {
Index: lldb/trunk/source/Core/RegisterValue.cpp
===
--- lldb/trunk/source/Core/RegisterValue.cpp
+++ lldb/trunk/source/Core/RegisterValue.cpp
@@ -539,6 +539,9 @@
 }
 
 bool RegisterValue::CopyValue(const RegisterValue &rhs) {
+  if (this == &rhs)
+return rhs.m_type == eTypeInvalid ? false : true;
+
   m_type = rhs.m_type;
   switch (m_type) {
   case eTypeInvalid:


Index: lldb/trunk/source/Core/Value.cpp
===
--- lldb/trunk/source/Core/Value.cpp
+++ lldb/trunk/source/Core/Value.cpp
@@ -142,6 +142,9 @@
 }
 
 size_t Value::AppendDataToHostBuffer(const Value &rhs) {
+  if (this == &rhs)
+return 0;
+
   size_t curr_size = m_data_buffer.GetByteSize();
   Status error;
   switch (rhs.GetValueType()) {
Index: lldb/trunk/source/Core/RegisterValue.cpp
===
--- lldb/trunk/source/Core/RegisterValue.cpp
+++ lldb/trunk/source/Core/RegisterValue.cpp
@@ -539,6 +539,9 @@
 }
 
 bool RegisterValue::CopyValue(const RegisterValue &rhs) {
+  if (this == &rhs)
+return rhs.m_type == eTypeInvalid ? false : true;
+
   m_type = rhs.m_type;
   switch (m_type) {
   case eTypeInvalid:
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le

2017-11-14 Thread Alexandre Yukio Yamashita via Phabricator via lldb-commits
alexandreyy updated this revision to Diff 122872.
alexandreyy added a comment.

Fixed backtrace issue.


https://reviews.llvm.org/D39681

Files:
  
packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
  
packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core
  
packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out
  source/Plugins/Process/Utility/CMakeLists.txt
  source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp
  source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h
  source/Plugins/Process/Utility/RegisterInfos_ppc64le.h
  source/Plugins/Process/elf-core/CMakeLists.txt
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp
  source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h
  source/Plugins/Process/elf-core/ThreadElfCore.cpp
  source/Plugins/Process/elf-core/ThreadElfCore.h
  source/Plugins/Process/elf-core/elf-core-enums.h

Index: source/Plugins/Process/elf-core/elf-core-enums.h
===
--- /dev/null
+++ source/Plugins/Process/elf-core/elf-core-enums.h
@@ -0,0 +1,64 @@
+//===-- elf-core-enums.h *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef elf_core_enums_h
+#define elf_core_enums_h
+
+/// Core files PT_NOTE segment descriptor types
+enum {
+  NT_PRSTATUS = 1,
+  NT_PRPSINFO = 3
+};
+
+namespace FREEBSD {
+  enum {
+NT_PRSTATUS = 1,
+NT_FPREGSET,
+NT_PRPSINFO,
+NT_THRMISC = 7,
+NT_PROCSTAT_AUXV = 16,
+NT_PPC_VMX = 0x100
+  };
+}
+
+namespace NETBSD {
+  enum {
+NT_PROCINFO = 1,
+NT_AUXV,
+NT_AMD64_REGS = 33,
+NT_AMD64_FPREGS = 35
+  };
+}
+
+namespace OPENBSD {
+  enum {
+NT_PROCINFO = 10,
+NT_AUXV = 11,
+NT_REGS = 20,
+NT_FPREGS = 21,
+  };
+}
+
+namespace LINUX {
+  enum {
+NT_PRSTATUS = 1,
+NT_FPREGSET,
+NT_PRPSINFO,
+NT_TASKSTRUCT,
+NT_PLATFORM,
+NT_AUXV,
+NT_FILE = 0x46494c45,
+NT_SIGINFO = 0x53494749,
+NT_PPC_VMX = 0x100,
+NT_PPC_VSX = 0x102,
+NT_PRXFPREG = 0x46e62b7f,
+  };
+}
+
+#endif // #ifndef elf_core_enums_h
Index: source/Plugins/Process/elf-core/ThreadElfCore.h
===
--- source/Plugins/Process/elf-core/ThreadElfCore.h
+++ source/Plugins/Process/elf-core/ThreadElfCore.h
@@ -18,6 +18,7 @@
 // Project includes
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/DataExtractor.h"
+#include "llvm/ADT/DenseMap.h"
 
 struct compat_timeval {
   alignas(8) uint64_t tv_sec;
@@ -131,6 +132,7 @@
   lldb_private::DataExtractor gpregset;
   lldb_private::DataExtractor fpregset;
   lldb_private::DataExtractor vregset;
+  llvm::DenseMap regsets;
   lldb::tid_t tid;
   int signo = 0;
   int prstatus_sig = 0;
@@ -179,6 +181,7 @@
   lldb_private::DataExtractor m_gpregset_data;
   lldb_private::DataExtractor m_fpregset_data;
   lldb_private::DataExtractor m_vregset_data;
+  llvm::DenseMap m_regsets_data;
 
   bool CalculateStopInfo() override;
 };
Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp
===
--- source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -28,13 +28,15 @@
 #include "Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h"
 #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h"
 #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
+#include "Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h"
 #include "ProcessElfCore.h"
 #include "RegisterContextPOSIXCore_arm.h"
 #include "RegisterContextPOSIXCore_arm64.h"
 #include "RegisterContextPOSIXCore_mips64.h"
 #include "RegisterContextPOSIXCore_powerpc.h"
 #include "RegisterContextPOSIXCore_s390x.h"
 #include "RegisterContextPOSIXCore_x86_64.h"
+#include "RegisterContextPOSIXCore_ppc64le.h"
 #include "ThreadElfCore.h"
 
 using namespace lldb;
@@ -46,7 +48,8 @@
 ThreadElfCore::ThreadElfCore(Process &process, const ThreadData &td)
 : Thread(process, td.tid), m_thread_name(td.name), m_thread_reg_ctx_sp(),
   m_signo(td.signo), m_gpregset_data(td.gpregset),
-  m_fpregset_data(td.fpregset), m_vregset_data(td.vregset) {}
+  m_fpregset_data(td.fpregset), m_vregset_data(td.vregset),
+  m_regsets_data(td.regsets) {}
 
 ThreadElfCore::~ThreadElfCore() { DestroyThread(); }
 
@@ -142,6 +145,9 @@
   case llvm::Triple::mips64:
 reg_interface = new RegisterContextLinux_mips64(arch);
 break;
+  case llvm::Triple::ppc64le:
+reg_interface = new RegisterInfoPOSIX_ppc64le(arch);
+  

[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le

2017-11-14 Thread Alexandre Yukio Yamashita via Phabricator via lldb-commits
alexandreyy added a comment.

In https://reviews.llvm.org/D39681#920349, @labath wrote:

> I'm not sure what's the problem with backtracing without more info, but the 
> nice thing about core files is that you can open a ppc and x86 one side by 
> side and see how for do you get before things start to diverge. The 
> interesting commands you can start with are "image lookup" (to see if you can 
> find symbols properly), "image show-unwind" (to see the unwind plans) and 
> "log enable lldb unwind && bt" (to see backtracing in action). This is what I 
> get for the x86_64 core file (you should be able to see the same thing 
> yourself):
>
>   (lldb) bt
>   * thread #1, name = 'a.out', stop reason = signal SIGSEGV
> * frame #0: 0x0040011c 
> linux-x86_64.out`bar(boom=0x) at main.c:4
>   frame #1: 0x00400142 
> linux-x86_64.out`foo(boom=0x, boomer=(linux-x86_64.out`bar at 
> main.c:2)) at main.c:10
>   frame #2: 0x0040015f linux-x86_64.out`_start at main.c:16
>   (lldb) image lookup -n bar
>   1 match found in 
> /usr/local/google/home/labath/ll/lldb/test/testcases/functionalities/postmortem/elf-core/linux-x86_64.out:
>   Address: linux-x86_64.out[0x0040010c] 
> (linux-x86_64.out..text + 0)
>   Summary: linux-x86_64.out`bar at main.c:2
>   (lldb) image show-unwind -n bar
>   UNWIND PLANS for linux-x86_64.out`bar (start addr 0x40010c)
>  
>   Asynchronous (not restricted to call-sites) UnwindPlan is 'assembly insn 
> profiling'
>   Synchronous (restricted to call-sites) UnwindPlan is 'eh_frame CFI'
>   Fast UnwindPlan is 'x86_64 default unwind plan'
>  
>   Assembly language inspection UnwindPlan:
>   This UnwindPlan originally sourced from assembly insn profiling
>   This UnwindPlan is sourced from the compiler: no.
>   This UnwindPlan is valid at all instruction locations: yes.
>   Address range of this UnwindPlan: [linux-x86_64.out..text + 
> 0-0x0015)
>   row[0]:0: CFA=rsp +8 => rsp=CFA+0 rip=[CFA-8] 
>   row[1]:1: CFA=rsp+16 => rbp=[CFA-16] rsp=CFA+0 rip=[CFA-8] 
>   row[2]:4: CFA=rbp+16 => rbp=[CFA-16] rsp=CFA+0 rip=[CFA-8] 
>   row[3]:   20: CFA=rsp +8 => rsp=CFA+0 rip=[CFA-8] 
>  
>   eh_frame UnwindPlan:
>   This UnwindPlan originally sourced from eh_frame CFI
>   This UnwindPlan is sourced from the compiler: yes.
>   This UnwindPlan is valid at all instruction locations: no.
>   Address range of this UnwindPlan: [linux-x86_64.out..text + 
> 0-0x0015)
>   row[0]:0: CFA=rsp +8 => rip=[CFA-8] 
>   row[1]:1: CFA=rsp+16 => rbp=[CFA-16] rip=[CFA-8] 
>   row[2]:4: CFA=rbp+16 => rbp=[CFA-16] rip=[CFA-8] 
>   row[3]:   20: CFA=rsp +8 => rbp=[CFA-16] rip=[CFA-8] 
>  
>   Fast UnwindPlan:
>   This UnwindPlan originally sourced from x86_64 default unwind plan
>   This UnwindPlan is sourced from the compiler: no.
>   This UnwindPlan is valid at all instruction locations: no.
>   row[0]:0: CFA=rbp+16 => rbp=[CFA-16] rsp=CFA+0 rip=[CFA-8] 
>  
>   Arch default UnwindPlan:
>   This UnwindPlan originally sourced from x86_64 default unwind plan
>   This UnwindPlan is sourced from the compiler: no.
>   This UnwindPlan is valid at all instruction locations: no.
>   row[0]:0: CFA=rbp+16 => rbp=[CFA-16] rsp=CFA+0 rip=[CFA-8] 
>  
>   Arch default at entry point UnwindPlan:
>   This UnwindPlan originally sourced from x86_64 at-func-entry default
>   This UnwindPlan is sourced from the compiler: no.
>   This UnwindPlan is valid at all instruction locations: not specified.
>   row[0]:0: CFA=rsp +8 => rsp=CFA+0 rip=[CFA-8] 
>  
>


I have fixed the backtrace issue.
The lr register was in a wrong position in RegisterInfos_ppc64le.h ,
Could you, please, submit these changes, @labath ?
Thanks! ;)


https://reviews.llvm.org/D39681



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


[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le

2017-11-14 Thread Alexandre Yukio Yamashita via Phabricator via lldb-commits
alexandreyy updated this revision to Diff 122879.
alexandreyy added a comment.

Removed issue note from commit message.


https://reviews.llvm.org/D39681

Files:
  
packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
  
packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.core
  
packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/linux-ppc64le.out
  source/Plugins/Process/Utility/CMakeLists.txt
  source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp
  source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.h
  source/Plugins/Process/Utility/RegisterInfos_ppc64le.h
  source/Plugins/Process/elf-core/CMakeLists.txt
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.cpp
  source/Plugins/Process/elf-core/RegisterContextPOSIXCore_ppc64le.h
  source/Plugins/Process/elf-core/ThreadElfCore.cpp
  source/Plugins/Process/elf-core/ThreadElfCore.h
  source/Plugins/Process/elf-core/elf-core-enums.h

Index: source/Plugins/Process/elf-core/elf-core-enums.h
===
--- /dev/null
+++ source/Plugins/Process/elf-core/elf-core-enums.h
@@ -0,0 +1,64 @@
+//===-- elf-core-enums.h *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef elf_core_enums_h
+#define elf_core_enums_h
+
+/// Core files PT_NOTE segment descriptor types
+enum {
+  NT_PRSTATUS = 1,
+  NT_PRPSINFO = 3
+};
+
+namespace FREEBSD {
+  enum {
+NT_PRSTATUS = 1,
+NT_FPREGSET,
+NT_PRPSINFO,
+NT_THRMISC = 7,
+NT_PROCSTAT_AUXV = 16,
+NT_PPC_VMX = 0x100
+  };
+}
+
+namespace NETBSD {
+  enum {
+NT_PROCINFO = 1,
+NT_AUXV,
+NT_AMD64_REGS = 33,
+NT_AMD64_FPREGS = 35
+  };
+}
+
+namespace OPENBSD {
+  enum {
+NT_PROCINFO = 10,
+NT_AUXV = 11,
+NT_REGS = 20,
+NT_FPREGS = 21,
+  };
+}
+
+namespace LINUX {
+  enum {
+NT_PRSTATUS = 1,
+NT_FPREGSET,
+NT_PRPSINFO,
+NT_TASKSTRUCT,
+NT_PLATFORM,
+NT_AUXV,
+NT_FILE = 0x46494c45,
+NT_SIGINFO = 0x53494749,
+NT_PPC_VMX = 0x100,
+NT_PPC_VSX = 0x102,
+NT_PRXFPREG = 0x46e62b7f,
+  };
+}
+
+#endif // #ifndef elf_core_enums_h
Index: source/Plugins/Process/elf-core/ThreadElfCore.h
===
--- source/Plugins/Process/elf-core/ThreadElfCore.h
+++ source/Plugins/Process/elf-core/ThreadElfCore.h
@@ -18,6 +18,7 @@
 // Project includes
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/DataExtractor.h"
+#include "llvm/ADT/DenseMap.h"
 
 struct compat_timeval {
   alignas(8) uint64_t tv_sec;
@@ -131,6 +132,7 @@
   lldb_private::DataExtractor gpregset;
   lldb_private::DataExtractor fpregset;
   lldb_private::DataExtractor vregset;
+  llvm::DenseMap regsets;
   lldb::tid_t tid;
   int signo = 0;
   int prstatus_sig = 0;
@@ -179,6 +181,7 @@
   lldb_private::DataExtractor m_gpregset_data;
   lldb_private::DataExtractor m_fpregset_data;
   lldb_private::DataExtractor m_vregset_data;
+  llvm::DenseMap m_regsets_data;
 
   bool CalculateStopInfo() override;
 };
Index: source/Plugins/Process/elf-core/ThreadElfCore.cpp
===
--- source/Plugins/Process/elf-core/ThreadElfCore.cpp
+++ source/Plugins/Process/elf-core/ThreadElfCore.cpp
@@ -28,13 +28,15 @@
 #include "Plugins/Process/Utility/RegisterContextOpenBSD_x86_64.h"
 #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h"
 #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
+#include "Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h"
 #include "ProcessElfCore.h"
 #include "RegisterContextPOSIXCore_arm.h"
 #include "RegisterContextPOSIXCore_arm64.h"
 #include "RegisterContextPOSIXCore_mips64.h"
 #include "RegisterContextPOSIXCore_powerpc.h"
 #include "RegisterContextPOSIXCore_s390x.h"
 #include "RegisterContextPOSIXCore_x86_64.h"
+#include "RegisterContextPOSIXCore_ppc64le.h"
 #include "ThreadElfCore.h"
 
 using namespace lldb;
@@ -46,7 +48,8 @@
 ThreadElfCore::ThreadElfCore(Process &process, const ThreadData &td)
 : Thread(process, td.tid), m_thread_name(td.name), m_thread_reg_ctx_sp(),
   m_signo(td.signo), m_gpregset_data(td.gpregset),
-  m_fpregset_data(td.fpregset), m_vregset_data(td.vregset) {}
+  m_fpregset_data(td.fpregset), m_vregset_data(td.vregset),
+  m_regsets_data(td.regsets) {}
 
 ThreadElfCore::~ThreadElfCore() { DestroyThread(); }
 
@@ -142,6 +145,9 @@
   case llvm::Triple::mips64:
 reg_interface = new RegisterContextLinux_mips64(arch);
 break;
+  case llvm::Triple::ppc64le:
+reg_interface = new RegisterInfoPOSIX_p

[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le

2017-11-14 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: source/Plugins/Process/elf-core/elf-core-enums.h:14
+/// Core files PT_NOTE segment descriptor types
+enum {
+  NT_PRSTATUS = 1,

No namespace here?


https://reviews.llvm.org/D39681



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


[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le

2017-11-14 Thread Alexandre Yukio Yamashita via Phabricator via lldb-commits
alexandreyy added inline comments.



Comment at: source/Plugins/Process/elf-core/elf-core-enums.h:14
+/// Core files PT_NOTE segment descriptor types
+enum {
+  NT_PRSTATUS = 1,

krytarowski wrote:
> No namespace here?
I think these constants are used for multiple OSs.
Am I correct?
Do you have a suggestion for a namespace?


https://reviews.llvm.org/D39681



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


[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le

2017-11-14 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: source/Plugins/Process/elf-core/elf-core-enums.h:14
+/// Core files PT_NOTE segment descriptor types
+enum {
+  NT_PRSTATUS = 1,

alexandreyy wrote:
> krytarowski wrote:
> > No namespace here?
> I think these constants are used for multiple OSs.
> Am I correct?
> Do you have a suggestion for a namespace?
There is rumor that they came from SVR4.. but I don't have the specs to make 
sure.

Multiple in this case does not mean "all". This is not true for at least NetBSD.


https://reviews.llvm.org/D39681



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


[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le

2017-11-14 Thread Alexandre Yukio Yamashita via Phabricator via lldb-commits
alexandreyy added inline comments.



Comment at: source/Plugins/Process/elf-core/elf-core-enums.h:14
+/// Core files PT_NOTE segment descriptor types
+enum {
+  NT_PRSTATUS = 1,

krytarowski wrote:
> alexandreyy wrote:
> > krytarowski wrote:
> > > No namespace here?
> > I think these constants are used for multiple OSs.
> > Am I correct?
> > Do you have a suggestion for a namespace?
> There is rumor that they came from SVR4.. but I don't have the specs to make 
> sure.
> 
> Multiple in this case does not mean "all". This is not true for at least 
> NetBSD.
I can remove these constants and modify the first "if" in 
ParseThreadContextsFromNoteSegment to:

  if (((note.n_type == LINUX::NT_PRSTATUS ||
  note.n_type == FREEBSD::NT_PRSTATUS) && have_prstatus) ||
((note.n_type == LINUX::NT_PRPSINFO ||
  note.n_type == FREEBSD::NT_PRPSINFO) && have_prpsinfo)) {
  assert(thread_data->gpregset.GetByteSize() > 0);

What do you think?
But NT_PRSTATUS and NT_PRPSINFO have the same value for Linux and FreeBSD .


https://reviews.llvm.org/D39681



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


[Lldb-commits] [PATCH] D39681: Implement core dump debugging for PPC64le

2017-11-14 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: source/Plugins/Process/elf-core/elf-core-enums.h:14
+/// Core files PT_NOTE segment descriptor types
+enum {
+  NT_PRSTATUS = 1,

alexandreyy wrote:
> krytarowski wrote:
> > alexandreyy wrote:
> > > krytarowski wrote:
> > > > No namespace here?
> > > I think these constants are used for multiple OSs.
> > > Am I correct?
> > > Do you have a suggestion for a namespace?
> > There is rumor that they came from SVR4.. but I don't have the specs to 
> > make sure.
> > 
> > Multiple in this case does not mean "all". This is not true for at least 
> > NetBSD.
> I can remove these constants and modify the first "if" in 
> ParseThreadContextsFromNoteSegment to:
> 
>   if (((note.n_type == LINUX::NT_PRSTATUS ||
>   note.n_type == FREEBSD::NT_PRSTATUS) && have_prstatus) ||
> ((note.n_type == LINUX::NT_PRPSINFO ||
>   note.n_type == FREEBSD::NT_PRPSINFO) && have_prpsinfo)) {
>   assert(thread_data->gpregset.GetByteSize() > 0);
> 
> What do you think?
> But NT_PRSTATUS and NT_PRPSINFO have the same value for Linux and FreeBSD .
I propose to put NT_PRSTATUS, NT_PRFPREG, NT_PRPSINFO into this namespace and 
call it SVR4.

SmartOS uses the same values.


https://reviews.llvm.org/D39681



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


[Lldb-commits] [lldb] r318218 - Update xcode project file to track ArchSpec.cpp

2017-11-14 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Nov 14 15:15:35 2017
New Revision: 318218

URL: http://llvm.org/viewvc/llvm-project?rev=318218&view=rev
Log:
Update xcode project file to track ArchSpec.cpp
move and LibCxxBitset.cpp addition.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=318218&r1=318217&r2=318218&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Nov 14 15:15:35 2017
@@ -393,7 +393,6 @@
2689002C13353E0400698AC0 /* AddressResolver.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9AC7034011752C6B0086C050 /* AddressResolver.cpp 
*/; };
2689002D13353E0400698AC0 /* AddressResolverFileLine.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 9AC7034211752C720086C050 /* 
AddressResolverFileLine.cpp */; };
2689002E13353E0400698AC0 /* AddressResolverName.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 9AC7034411752C790086C050 /* 
AddressResolverName.cpp */; };
-   2689002F13353E0400698AC0 /* ArchSpec.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 26BC7E6B10F1B85900F91463 /* ArchSpec.cpp */; };
2689003113353E0400698AC0 /* Broadcaster.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26BC7E6D10F1B85900F91463 /* Broadcaster.cpp */; 
};
2689003213353E0400698AC0 /* Communication.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26BC7E6E10F1B85900F91463 /* Communication.cpp 
*/; };
2689003313353E0400698AC0 /* Connection.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 26BC7E6F10F1B85900F91463 /* Connection.cpp */; };
@@ -974,6 +973,8 @@
AF45FDE518A1F3AC0007051C /* AppleGetThreadItemInfoHandler.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = AF45FDE318A1F3AC0007051C /* 
AppleGetThreadItemInfoHandler.cpp */; };
AF6335E21C87B21E00F7D554 /* SymbolFilePDB.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF6335E01C87B21E00F7D554 /* SymbolFilePDB.cpp 
*/; };
AF6335E31C87B21E00F7D554 /* SymbolFilePDB.h in Headers */ = 
{isa = PBXBuildFile; fileRef = AF6335E11C87B21E00F7D554 /* SymbolFilePDB.h */; 
};
+   AF6CA6661FBBAF28005A0DC3 /* ArchSpec.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = AF6CA6651FBBAF27005A0DC3 /* ArchSpec.cpp */; };
+   AF6CA6681FBBAF37005A0DC3 /* ArchSpec.h in Headers */ = {isa = 
PBXBuildFile; fileRef = AF6CA6671FBBAF37005A0DC3 /* ArchSpec.h */; };
AF77E08F1A033C700096C0EA /* ABISysV_ppc.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF77E08D1A033C700096C0EA /* ABISysV_ppc.cpp */; 
};
AF77E0931A033C7F0096C0EA /* ABISysV_ppc64.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AF77E0911A033C7F0096C0EA /* ABISysV_ppc64.cpp 
*/; };
AF77E0A11A033D360096C0EA /* RegisterContextFreeBSD_powerpc.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = AF77E09A1A033D360096C0EA /* 
RegisterContextFreeBSD_powerpc.cpp */; };
@@ -1004,6 +1005,7 @@
AFC2DCF31E6E30CF00283714 /* History.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = AFC2DCF21E6E30CF00283714 /* History.cpp */; };
AFC2DCF61E6E316A00283714 /* StreamCallback.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AFC2DCF51E6E316A00283714 /* StreamCallback.cpp 
*/; };
AFC2DCF91E6E318000283714 /* StreamGDBRemote.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AFC2DCF81E6E318000283714 /* StreamGDBRemote.cpp 
*/; };
+   AFC67B151FBBB03600860ECB /* LibCxxBitset.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = AFC67B141FBBB03500860ECB /* LibCxxBitset.cpp */; 
};
AFCB2BBD1BF577F40018B553 /* PythonExceptionState.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = AFCB2BBB1BF577F40018B553 /* 
PythonExceptionState.cpp */; };
AFCB2BBE1BF577F40018B553 /* PythonExceptionState.h in Headers 
*/ = {isa = PBXBuildFile; fileRef = AFCB2BBC1BF577F40018B553 /* 
PythonExceptionState.h */; };
AFD65C811D9B5B2E00D93120 /* RegisterContextMinidump_x86_64.cpp 
in Sources */ = {isa = PBXBuildFile; fileRef = AFD65C7F1D9B5B2E00D93120 /* 
RegisterContextMinidump_x86_64.cpp */; };
@@ -2080,7 +2082,6 @@
26BC7D2D10F1B76300F91463 /* CommandObjectThread.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
CommandObjectThread.h; path = source/Commands/CommandObjectThread.h; sourceTree 
= ""; };
26BC7D5010F1B77400F91463 /* Address.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
Address.h; path = include/lldb/Core/Address.h; sourceTree = ""; };
26BC7D5110F1B77400F91463 /* AddressRange.h */ = {isa = 
PBXFileReferenc

[Lldb-commits] [lldb] r318260 - Two small fixes to handle arm64 fpu register contexts in

2017-11-14 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Nov 14 19:18:24 2017
New Revision: 318260

URL: http://llvm.org/viewvc/llvm-project?rev=318260&view=rev
Log:
Two small fixes to handle arm64 fpu register contexts in 
a Mach-O file load command correctly, patch by Ryan
Mansfield.

 

Modified:
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=318260&r1=318259&r2=318260&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Nov 14 
19:18:24 2017
@@ -686,7 +686,7 @@ public:
   case FPURegSet: {
 uint8_t *fpu_reg_buf = (uint8_t *)&fpu.v[0];
 const int fpu_reg_buf_size = sizeof(fpu);
-if (fpu_reg_buf_size == count &&
+if (fpu_reg_buf_size == count * sizeof(uint32_t) &&
 data.ExtractBytes(offset, fpu_reg_buf_size, eByteOrderLittle,
   fpu_reg_buf) == fpu_reg_buf_size) {
   SetError(FPURegSet, Read, 0);

Modified: 
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h?rev=318260&r1=318259&r2=318260&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h 
(original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h Tue 
Nov 14 19:18:24 2017
@@ -83,7 +83,7 @@ public:
 
   // mirrors  arm_neon_state64_t
   struct FPU {
-VReg v[32];
+alignas(__uint128_t) VReg v[32];
 uint32_t fpsr;
 uint32_t fpcr;
   };


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


[Lldb-commits] [lldb] r318262 - Roll back r318260 because it is causing the windows bot to

2017-11-14 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Nov 14 19:41:47 2017
New Revision: 318262

URL: http://llvm.org/viewvc/llvm-project?rev=318262&view=rev
Log:
Roll back r318260 because it is causing the windows bot to
break.  The alignas(__uint128_t) is not recognized with MSVC
it looks like.  Zachary, is there a similar type on windows?
I suppose I can go with alignas(16) here but I'd prefer to
specify the type alignment that I want & let the ABI dictate
how much padding is required.

Modified:
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=318262&r1=318261&r2=318262&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Nov 14 
19:41:47 2017
@@ -686,7 +686,7 @@ public:
   case FPURegSet: {
 uint8_t *fpu_reg_buf = (uint8_t *)&fpu.v[0];
 const int fpu_reg_buf_size = sizeof(fpu);
-if (fpu_reg_buf_size == count * sizeof(uint32_t) &&
+if (fpu_reg_buf_size == count &&
 data.ExtractBytes(offset, fpu_reg_buf_size, eByteOrderLittle,
   fpu_reg_buf) == fpu_reg_buf_size) {
   SetError(FPURegSet, Read, 0);

Modified: 
lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h?rev=318262&r1=318261&r2=318262&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h 
(original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h Tue 
Nov 14 19:41:47 2017
@@ -83,7 +83,7 @@ public:
 
   // mirrors  arm_neon_state64_t
   struct FPU {
-alignas(__uint128_t) VReg v[32];
+VReg v[32];
 uint32_t fpsr;
 uint32_t fpcr;
   };


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


[Lldb-commits] [PATCH] D39967: Refactoring of MemoryWrite function

2017-11-14 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 122966.
tatyana-krasnukha added a comment.

Sorry for wrong formatting, I've removed it.

What I've actually done:

- grouped cases returning WriteMemoryPrivate in the top of function;
- moved last comment to code it relates;
- change other comment according what really will be returned in that case.

I hope that these changes improves readability and will help to avoid errors 
like I tried to fix in D39969 


Repository:
  rL LLVM

https://reviews.llvm.org/D39967

Files:
  source/Target/Process.cpp

Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -2423,65 +2423,64 @@
 
   BreakpointSiteList bp_sites_in_range;
 
-  if (m_breakpoint_site_list.FindInRange(addr, addr + size,
- bp_sites_in_range)) {
+  if (!m_breakpoint_site_list.FindInRange(addr, addr + size,
+  bp_sites_in_range) ||
+  bp_sites_in_range.IsEmpty()) {
+
 // No breakpoint sites overlap
-if (bp_sites_in_range.IsEmpty())
-  return WriteMemoryPrivate(addr, buf, size, error);
-else {
-  const uint8_t *ubuf = (const uint8_t *)buf;
-  uint64_t bytes_written = 0;
+return WriteMemoryPrivate(addr, buf, size, error);
+  }
 
-  bp_sites_in_range.ForEach([this, addr, size, &bytes_written, &ubuf,
- &error](BreakpointSite *bp) -> void {
+  const uint8_t *ubuf = (const uint8_t *)buf;
+  uint64_t bytes_written = 0;
 
-if (error.Success()) {
-  addr_t intersect_addr;
-  size_t intersect_size;
-  size_t opcode_offset;
-  const bool intersects = bp->IntersectsRange(
-  addr, size, &intersect_addr, &intersect_size, &opcode_offset);
-  UNUSED_IF_ASSERT_DISABLED(intersects);
-  assert(intersects);
-  assert(addr <= intersect_addr && intersect_addr < addr + size);
-  assert(addr < intersect_addr + intersect_size &&
- intersect_addr + intersect_size <= addr + size);
-  assert(opcode_offset + intersect_size <= bp->GetByteSize());
+  bp_sites_in_range.ForEach([this, addr, size, &bytes_written, &ubuf,
+ &error](BreakpointSite *bp) -> void {
 
-  // Check for bytes before this breakpoint
-  const addr_t curr_addr = addr + bytes_written;
-  if (intersect_addr > curr_addr) {
-// There are some bytes before this breakpoint that we need to
-// just write to memory
-size_t curr_size = intersect_addr - curr_addr;
-size_t curr_bytes_written = WriteMemoryPrivate(
-curr_addr, ubuf + bytes_written, curr_size, error);
-bytes_written += curr_bytes_written;
-if (curr_bytes_written != curr_size) {
-  // We weren't able to write all of the requested bytes, we
-  // are done looping and will return the number of bytes that
-  // we have written so far.
-  if (error.Success())
-error.SetErrorToGenericError();
-}
-  }
-  // Now write any bytes that would cover up any software breakpoints
-  // directly into the breakpoint opcode buffer
-  ::memcpy(bp->GetSavedOpcodeBytes() + opcode_offset,
-   ubuf + bytes_written, intersect_size);
-  bytes_written += intersect_size;
+if (error.Success()) {
+  addr_t intersect_addr;
+  size_t intersect_size;
+  size_t opcode_offset;
+  const bool intersects = bp->IntersectsRange(
+  addr, size, &intersect_addr, &intersect_size, &opcode_offset);
+  UNUSED_IF_ASSERT_DISABLED(intersects);
+  assert(intersects);
+  assert(addr <= intersect_addr && intersect_addr < addr + size);
+  assert(addr < intersect_addr + intersect_size &&
+ intersect_addr + intersect_size <= addr + size);
+  assert(opcode_offset + intersect_size <= bp->GetByteSize());
+
+  // Check for bytes before this breakpoint
+  const addr_t curr_addr = addr + bytes_written;
+  if (intersect_addr > curr_addr) {
+// There are some bytes before this breakpoint that we need to
+// just write to memory
+size_t curr_size = intersect_addr - curr_addr;
+size_t curr_bytes_written = WriteMemoryPrivate(
+curr_addr, ubuf + bytes_written, curr_size, error);
+bytes_written += curr_bytes_written;
+if (curr_bytes_written != curr_size) {
+  // We weren't able to write all of the requested bytes, we
+  // are done looping and will return zero.
+  if (error.Success())
+error.SetErrorToGenericError();
+
+  return;
 }
-  });
-
-  if (bytes_written < size)
-WriteMemoryPrivate(addr + bytes_written, ubuf + bytes_w

[Lldb-commits] [PATCH] D39969: Set error status in ObjectFile::LoadInMemory if it is not set

2017-11-14 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 122967.
tatyana-krasnukha added a comment.

Removed clang-format changes.


Repository:
  rL LLVM

https://reviews.llvm.org/D39969

Files:
  source/Symbol/ObjectFile.cpp


Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -665,7 +665,6 @@
 }
 
 Status ObjectFile::LoadInMemory(Target &target, bool set_pc) {
-  Status error;
   ProcessSP process = target.CalculateProcess();
   if (!process)
 return Status("No Process");
@@ -675,6 +674,8 @@
   SectionList *section_list = GetSectionList();
   if (!section_list)
 return Status("No section in object file");
+
+  Status error;
   size_t section_count = section_list->GetNumSections(0);
   for (size_t i = 0; i < section_count; ++i) {
 SectionSP section_sp = section_list->GetSectionAtIndex(i);
@@ -687,8 +688,13 @@
   section_sp->GetSectionData(section_data);
   lldb::offset_t written = process->WriteMemory(
   addr, section_data.GetDataStart(), section_data.GetByteSize(), 
error);
-  if (written != section_data.GetByteSize())
+  if (written != section_data.GetByteSize()) {
+if (!error.Fail())
+  error.SetErrorStringWithFormat(
+  "One or more breakpoints intersect section '%s'",
+  section_sp->GetName().AsCString());
 return error;
+  }
 }
   }
   if (set_pc) {


Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -665,7 +665,6 @@
 }
 
 Status ObjectFile::LoadInMemory(Target &target, bool set_pc) {
-  Status error;
   ProcessSP process = target.CalculateProcess();
   if (!process)
 return Status("No Process");
@@ -675,6 +674,8 @@
   SectionList *section_list = GetSectionList();
   if (!section_list)
 return Status("No section in object file");
+
+  Status error;
   size_t section_count = section_list->GetNumSections(0);
   for (size_t i = 0; i < section_count; ++i) {
 SectionSP section_sp = section_list->GetSectionAtIndex(i);
@@ -687,8 +688,13 @@
   section_sp->GetSectionData(section_data);
   lldb::offset_t written = process->WriteMemory(
   addr, section_data.GetDataStart(), section_data.GetByteSize(), error);
-  if (written != section_data.GetByteSize())
+  if (written != section_data.GetByteSize()) {
+if (!error.Fail())
+  error.SetErrorStringWithFormat(
+  "One or more breakpoints intersect section '%s'",
+  section_sp->GetName().AsCString());
 return error;
+  }
 }
   }
   if (set_pc) {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D40022: Corrected two typos and removed unused variable

2017-11-14 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added a comment.

I have not commit access, that is why I've decided to group all typos in one 
patch...


Repository:
  rL LLVM

https://reviews.llvm.org/D40022



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