[Lldb-commits] [lldb] r284817 - Revert "Fix a race condition between "ephemeral watchpoint disable/enable" and continue in commands."

2016-10-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Oct 21 05:52:11 2016
New Revision: 284817

URL: http://llvm.org/viewvc/llvm-project?rev=284817&view=rev
Log:
Revert "Fix a race condition between "ephemeral watchpoint disable/enable" and 
continue in commands."

This reverts commit r284795, as it breaks watchpoint handling on arm (and
presumable all architectures that report watchpoint hits without executing the
tripping instruction).

There seems to be something fundamentally wrong with this patch: it uses
process_sp->AddPreResumeAction to re-enable the watchpoint, but the whole point
of the step-over-watchpoint logic (which AFAIK is the only user of this class) 
is
to disable the watchpoint *after* we resume to do the single step.

I have no idea how to fix this except by reverting the offending patch.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
lldb/trunk/source/Breakpoint/Watchpoint.cpp
lldb/trunk/source/Target/StopInfo.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py?rev=284817&r1=284816&r2=284817&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
 Fri Oct 21 05:52:11 2016
@@ -54,6 +54,9 @@ class WatchpointPythonCommandTestCase(Te
 # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
 lldbutil.run_break_set_by_file_and_line(
 self, None, self.line, num_expected_locations=1)
+#self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+#startstr = "Breakpoint created: 1: file ='%s', line = %d, 
locations = 1" %
+#   (self.source, self.line))#
 
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
@@ -128,6 +131,9 @@ class WatchpointPythonCommandTestCase(Te
 # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
 lldbutil.run_break_set_by_file_and_line(
 self, None, self.line, num_expected_locations=1)
+#self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+#startstr = "Breakpoint created: 1: file ='%s', line = %d, 
locations = 1" %
+#   (self.source, self.line))#
 
 # Run the program.
 self.runCmd("run", RUN_SUCCEEDED)
@@ -171,4 +177,3 @@ class WatchpointPythonCommandTestCase(Te
 # second hit and set it to 999
 self.expect("frame variable --show-globals cookie",
 substrs=['(int32_t)', 'cookie = 999'])
-

Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=284817&r1=284816&r2=284817&view=diff
==
--- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Fri Oct 21 05:52:11 2016
@@ -232,7 +232,7 @@ void Watchpoint::TurnOffEphemeralMode()
 }
 
 bool Watchpoint::IsDisabledDuringEphemeralMode() {
-  return m_disabled_count > 1 && m_is_ephemeral;
+  return m_disabled_count > 1;
 }
 
 void Watchpoint::SetEnabled(bool enabled, bool notify) {

Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=284817&r1=284816&r2=284817&view=diff
==
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Fri Oct 21 05:52:11 2016
@@ -557,45 +557,27 @@ public:
   // performing watchpoint actions.
   class WatchpointSentry {
   public:
-WatchpointSentry(ProcessSP p_sp, WatchpointSP w_sp) : process_sp(p_sp), 
- watchpoint_sp(w_sp) {
-  if (process_sp && watchpoint_sp) {
+WatchpointSentry(Process *p, Watchpoint *w) : process(p), watchpoint(w) {
+  if (process && watchpoint) {
 const bool notify = false;
-watchpoint_sp->TurnOnEphemeralMode();
-process_sp->DisableWatchpoint(watchpoint_sp.get(), notify);
-process_sp->AddPreResumeAction(SentryPreResumeAction, this);
+watchpoint->TurnOnEphemeralMode();
+process->DisableWatchpoint(watchpoint, notify);
   }
 }
-
-void DoReenable() {
-  if (process_sp && watchpoint_sp) {
-bool was_disabled = watchpoint_sp->IsDisabledDuringEphemeralMode();
-watchpoint_sp->Turn

[Lldb-commits] [lldb] r284819 - Add TestMultipleHits.py

2016-10-21 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Oct 21 06:14:04 2016
New Revision: 284819

URL: http://llvm.org/viewvc/llvm-project?rev=284819&view=rev
Log:
Add TestMultipleHits.py

This tests that lldb handles the situation when a single instruction triggers
multiple watchpoint hits. It currently fails on arm due to what appears to be a
lldb-server bug (pr30758).

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile?rev=284819&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/Makefile
 Fri Oct 21 06:14:04 2016
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py?rev=284819&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/TestMultipleHits.py
 Fri Oct 21 06:14:04 2016
@@ -0,0 +1,58 @@
+"""
+Test handling of cases when a single instruction triggers multiple watchpoints
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MultipleHitsTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+NO_DEBUG_INFO_TESTCASE = True
+
+@expectedFailureAll(
+oslist=["windows"],
+bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not 
supported on Windows")
+@skipIf(bugnumber="llvm.org/pr30758", oslist=["linux"], archs=["arm", 
"aarch64"])
+def test(self):
+self.build()
+exe = os.path.join(os.getcwd(), "a.out")
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target and target.IsValid(), VALID_TARGET)
+
+bp = target.BreakpointCreateByName("main")
+self.assertTrue(bp and bp.IsValid(), "Breakpoint is valid")
+
+process = target.LaunchSimple(None, None,
+self.get_process_working_directory())
+self.assertEqual(process.GetState(), lldb.eStateStopped)
+
+thread = lldbutil.get_stopped_thread(process, 
lldb.eStopReasonBreakpoint)
+self.assertIsNotNone(thread)
+
+frame = thread.GetFrameAtIndex(0)
+self.assertTrue(frame and frame.IsValid(), "Frame is valid")
+
+buf = frame.FindValue("buf", lldb.eValueTypeVariableGlobal)
+self.assertTrue(buf and buf.IsValid(), "buf is valid")
+
+for i in [0, target.GetAddressByteSize()]:
+member = buf.GetChildAtIndex(i)
+self.assertTrue(member and member.IsValid(), "member is valid")
+
+error = lldb.SBError()
+watch = member.Watch(True, True, True, error)
+self.assertTrue(error.Success())
+
+process.Continue();
+self.assertEqual(process.GetState(), lldb.eStateStopped)
+self.assertEqual(thread.GetStopReason(), lldb.eStopReasonWatchpoint)
+

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp?rev=284819&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_hits/main.cpp
 Fri Oct 21 06:14:04 2016
@@ -0,0 +1,29 @@
+//===-- main.cpp *- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+

Re: [Lldb-commits] [PATCH] D25057: Fix ARM/AArch64 Step-Over watchpoint issue remove provision for duplicate watchpoints

2016-10-21 Thread Pavel Labath via lldb-commits
Ok, after the latest round of changes, I was not able to reproduce the
behaviour where we would continually be-continually re-hitting a
watchpoint. However, I did manage to get the lldb-server to hang if I
set two watchpoints close to each other and trigger them both with a
single instruction. I added it as TestMultipleHits.py. However, this
seems like a lldb-server problem, so it's probably not going to be
interesting to you. But maybe Omair would take a look (?)

To get watchpoints working at all, I had to revert your latest patch
-- it was causing watchpoints to be re-enabled before we actually
stepped-over them, causing a different kind of a loop. Let me know if
you have questions about that.

cheers,
pl

On 20 October 2016 at 19:43, Jim Ingham  wrote:
> Ah, I see, thanks.  If you can make a test case that fails on ARM in the 
> current state of things, I would be interested in taking a look at it.  We 
> had to do an analogous little dance for stepping from one breakpoint to 
> another.  Probably not the same solution, but we can surely get this to work.
>
> Jim
>
>
>> On Oct 20, 2016, at 3:12 AM, Pavel Labath  wrote:
>>
>> The reason you could not see this is that the issue is specific to arm
>> (or any target that reports watchpoint hits *before* executing the
>> instruction tripping the watch). In this case, we have special logic
>> in the client which removes the watchpoint, does a single step, and
>> reinstates the watchpoint. This code does not correctly handle the
>> case when you hit *another* watchpoint while "stepping over" the first
>> one.
>>
>> I was not able to reproduce the exact original problem now (I was
>> doing it with one of Omair's previous changes applied, so it may not
>> be possible to reproduce on trunk), but here is another way this
>> problem manifests itself:
>>
>>
>> Process 6009 stopped
>> * thread #1: tid = 6009, 0xaac67324 a.out`main + 16 at a.c:2, name =
>> 'a.out', stop reason = breakpoint 1.1
>>frame #0: 0xaac67324 a.out`main + 16 at a.c:2
>>   1   int x;
>> -> 2   int main () { x = 47; return 0; }
>> (lldb) fr var &x
>> (int *) &x = 0xaac69004
>> (lldb) watchpoint set expression -s 1 -- 0xaac69004
>> Watchpoint created: Watchpoint 6: addr = 0xaac69004 size = 1 state =
>> enabled type = w
>>new value: 0
>> (lldb) watchpoint set expression -s 1 -- 0xaac69005
>> Watchpoint created: Watchpoint 7: addr = 0xaac69005 size = 1 state =
>> enabled type = w
>>new value: 0
>> (lldb) c
>> Process 6009 resuming
>>
>> At this point, it appears as if the inferior keeps running and never
>> hits the watchpoint, but if you check the packet log you will see that
>> LLDB is continuously busy sending vCont packets trying to step over
>> the watchpoint hit.
>> Note that after Omair's change it will not be possible anymore to
>> reproduce the problem this easily, as he forbids the creation of
>> watchpoints within the same block, but you can reproduce still
>> reproduce it by having a signle instruction that writes to two blocks
>> (stp is a good candidate for that).
>>
>> If you are more than curious and want to dig into that I can make a
>> better repro case for it.
>>
>> pl
>>
>>
>>
>> On 19 October 2016 at 18:34, Jim Ingham  wrote:
>>>
 On Oct 4, 2016, at 9:28 AM, Pavel Labath via lldb-commits 
  wrote:

 Also, apparently lldb has a bug, where it mishandles the case where you do 
 a (user-level) single step over an instruction triggering a watchpoint. 
 That would be pretty important to fix as well.
>>>
>>> Do you have a reference for this?  In a trivial case, it works correctly on 
>>> MacOS so far as I can tell:
>>>
>>> (lldb) si
>>> Process 99358 stopped
>>> * thread #1: tid = 0x148d67e, function: main , stop reason = instruction 
>>> step into
>>>frame #0: 0x00010f5e changeit`main at changeit.c:9
>>>   6
>>>   7  printf("my_var is: %d.\n", my_var);
>>>   8
>>> -> 9  my_var = 20;
>>>   10
>>>   11 printf("my_var is: %d.\n", my_var);
>>>   12
>>> changeit`main:
>>> ->  0x10f5e <+46>: movl   $0x14, -0x8(%rbp)
>>>0x10f65 <+53>: movl   -0x8(%rbp), %esi
>>>0x10f68 <+56>: movl   %eax, -0xc(%rbp)
>>>0x10f6b <+59>: movb   $0x0, %al
>>> (lldb) si
>>>
>>> Watchpoint 1 hit:
>>> old value: 10
>>> new value: 20
>>> Process 99358 stopped
>>> * thread #1: tid = 0x148d67e, function: main , stop reason = watchpoint 1
>>>frame #0: 0x00010f65 changeit`main at changeit.c:11
>>>   8
>>>   9  my_var = 20;
>>>   10
>>> -> 11 printf("my_var is: %d.\n", my_var);
>>>   12
>>>   13 return 0;
>>>   14   }
>>> changeit`main:
>>> ->  0x10f65 <+53>: movl   -0x8(%rbp), %esi
>>>0x10f68 <+56>: movl   %eax, -0xc(%rbp)
>>>0x10f6b <+59>: movb   $0x0, %al
>>>0x10f6d <+61>: callq  0x10f80   ; symbol stub for: 
>>> printf
>>>
>>> Jim
>>>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-b

[Lldb-commits] [PATCH] D25756: FreeBSD ARM support for software single step.

2016-10-21 Thread Pavel Labath via lldb-commits
labath added a comment.

I don't know of any good source of documentation for this, but I am willing to 
answer any questions you might have about this. Basically, the idea of 
lldb-server is that you use the same code path for remote debugging as you to 
for local. So all the debugging is done in a separate process called 
lldb-server, with which the client then communicates when it needs something 
done.

If we want to get lldb-server working on freebsd, I would propose a plan like 
this:

- rename NativeProcessLinux into something more generic (NativeProcessPosix ?), 
make a new NativeProcessLinux, which inherits from that, but contains no code.
- get NativeProcessPosix building on FreeBSD. Now, you will likely get compile 
errors as we may be using some OS interfaces that don't exist on freebsd. We 
will need to figure out how we can either: a) use interfaces which are 
available on both platforms; b) abstract the functionality so it can 
implemented in the derived classes. The biggest offender here will be ptrace 
(at one point we used signalfd(), but that is gone now), as it operates a bit 
differently on the two OSs. For the implementation of the FreeBSD part of it, 
you can use the existing ProcessFreeBSD classes for inspiration. All the other
- get lldb-server test suite passing on FreeBSD (these are all the tests in 
tools/lldb-server), which test pure server functionality)
- switch lldb client to use lldb-server instead of ProcessFreeBSD
- get the rest of lldb tests passing
- remove ProcessFreeBSD

When we were getting lldb-server working for linux, it really helped having osx 
as a reference, because it already used the same flow. I imagine that it could 
be quite helpful for you as well, if you could get a linux machine/VM to be 
able to compare how the code behaves on two platforms, but I think it should be 
possible to do it without it.

So, if you want to get started, I propose you do a preliminary invetigation -- 
set the build system so that in builds NativeProcessLinux on FreeBSD, and see 
how much code do you have to delete, so that it compiles. This should give us 
an idea of the scope of the work.

good luck :)


Repository:
  rL LLVM

https://reviews.llvm.org/D25756



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


[Lldb-commits] [PATCH] D25864: Fix arm64 floating point register spill recording in UnwindPlan analysis

2016-10-21 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

A few high level comments:

- I have the feeling you ported much more code over to use the LLDB register 
numbers then it would be strictly necessary. I am not sure if it is good or bad 
as it can help us consolidate the confusion around the different register 
numbering schema but it icnreases the size of this patch by a lot and also adds 
a lot of new boilerplate code.
- I would prefer to keep lldb-arm64-register-enums.h over the new file you 
added as your code contains a lot of logic in ARM64_LLDB_Registers.cpp (e.g. to 
string conversion) what seems unnecessary to me as the register tables you 
modified recently already contains all information to get from register number 
to register name
- Regarding Greg's concern I think we should have a single table 
(RegisterInfoInterface) containing all registers what can appear on the target 
and then the register context should be the one who detects which one is 
available and then returns the correct one accordingly. We already have 
functionality like this for x86_64 where RegisterInfos_x86_64.h and 
lldb-x86-register-enums.h defines all possibly available register and then 
NativeRegisterContextLinux_x86_64 detects if the AVX and MPX registers are 
available or not and then report the register list accordingly.

In mid/long term I think we should clean up the full register info handling 
code to simplify all of this in the following lines (vague ideas):

- Implement a single copy of RegisterInfoInterface for every architecture what 
returns the correct list of registers based on the architecture and 
sub-architecture
- Define register sets inside the RegisterInfoInterface instead of inside the 
RegistrerContext... classes
- Change EmulateInstruction... to use the RegisterInfoInterface to get a 
RegisterInfo object from the register numbers
- Change all RegisterContext... to use the information from the 
RegisterInfoInterface... classes instead of duplicating it into them

Doing all of the cleanup will be a lot of work so I am not asking you to do it 
or I don't want to wait with this change for that long but wanted to raise it 
here so we don't start to move in a direction what will make later improvements 
more difficult




Comment at: source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp:196-197
 
-  if (reg_kind == eRegisterKindDWARF)
-return arm64_dwarf::GetRegisterInfo(reg_num, reg_info);
+  if (reg_kind == eRegisterKindLLDB)
+return arm64_lldb::GetRegisterInfo(reg_num, reg_info);
   return false;

What do you think about teaching this function to handle both 
eRegisterKindDWARF and eRegisterKindLLDB? That way you can use both in the 
emulation code. Also that would me that you don't have to update all usage 
inside the emulation code.



Comment at: source/Utility/ARM64_LLDB_Registers.cpp:18
+
+const char *arm64_lldb::GetRegisterName(unsigned reg_num,
+bool altnernate_name) {

I think this function is completely unnecessary if you use the 
g_register_infos_arm64_le table (or one of it's wrapper)


Repository:
  rL LLVM

https://reviews.llvm.org/D25864



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


[Lldb-commits] [PATCH] D25733: Add data formatter for libstdc++ tuple

2016-10-21 Thread Tamas Berghammer via lldb-commits
tberghammer updated this revision to Diff 75417.
tberghammer marked 4 inline comments as done.

https://reviews.llvm.org/D25733

Files:
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp
  source/Plugins/Language/CPlusPlus/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/LibStdcpp.h
  source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp

Index: source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
===
--- /dev/null
+++ source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
@@ -0,0 +1,109 @@
+//===-- LibStdcppTuple.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "LibStdcpp.h"
+
+#include 
+#include 
+
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace {
+
+class LibStdcppTupleSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  explicit LibStdcppTupleSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+private:
+  std::vector m_members;
+};
+
+} // end of anonymous namespace
+
+LibStdcppTupleSyntheticFrontEnd::LibStdcppTupleSyntheticFrontEnd(
+lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp) {
+  Update();
+}
+
+bool LibStdcppTupleSyntheticFrontEnd::Update() {
+  m_members.clear();
+
+  ValueObjectSP valobj_backend_sp = m_backend.GetSP();
+  if (!valobj_backend_sp)
+return false;
+
+  ValueObjectSP next_child_sp = valobj_backend_sp->GetNonSyntheticValue();
+  while (next_child_sp != nullptr) {
+ValueObjectSP current_child = next_child_sp;
+next_child_sp = nullptr;
+
+size_t child_count = current_child->GetNumChildren();
+for (size_t i = 0; i < child_count; ++i) {
+  ValueObjectSP child_sp = current_child->GetChildAtIndex(i, true);
+  llvm::StringRef name_str = child_sp->GetName().GetStringRef();
+  if (name_str.startswith("std::_Tuple_impl<")) {
+next_child_sp = child_sp;
+  } else if (name_str.startswith("std::_Head_base<")) {
+ValueObjectSP value_sp =
+child_sp->GetChildMemberWithName(ConstString("_M_head_impl"), true);
+if (value_sp) {
+  StreamString name;
+  name.Printf("[%zd]", m_members.size());
+  value_sp->SetName(ConstString(name.GetData()));
+
+  m_members.push_back(value_sp);
+}
+  }
+}
+  }
+
+  return false;
+}
+
+bool LibStdcppTupleSyntheticFrontEnd::MightHaveChildren() { return true; }
+
+lldb::ValueObjectSP
+LibStdcppTupleSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
+  if (idx < m_members.size())
+return m_members[idx];
+  return lldb::ValueObjectSP();
+}
+
+size_t LibStdcppTupleSyntheticFrontEnd::CalculateNumChildren() {
+  return m_members.size();
+}
+
+size_t LibStdcppTupleSyntheticFrontEnd::GetIndexOfChildWithName(
+const ConstString &name) {
+  return ExtractIndexFromString(name.GetCString());
+}
+
+SyntheticChildrenFrontEnd *
+lldb_private::formatters::LibStdcppTupleSyntheticFrontEndCreator(
+CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
+  return (valobj_sp ? new LibStdcppTupleSyntheticFrontEnd(valobj_sp) : nullptr);
+}
Index: source/Plugins/Language/CPlusPlus/LibStdcpp.h
===
--- source/Plugins/Language/CPlusPlus/LibStdcpp.h
+++ source/Plugins/Language/CPlusPlus/LibStdcpp.h
@@ -36,6 +36,10 @@
  lldb::ValueObjectSP);
 
 SyntheticChildrenFrontEnd *
+LibStdcppTupleSyntheticFrontEndCreator(CXXSyntheticChildren *,
+   lldb::ValueObjectSP);
+
+SyntheticChildrenFrontEnd *
 LibStdcppVectorIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
 lldb::ValueObjectSP);
 
Index: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- source/Plugins/Language/CPlusPlus/CPlusPlusLanguag

[Lldb-commits] [PATCH] D25734: Add data formatter for libstdc++ unique_ptr

2016-10-21 Thread Tamas Berghammer via lldb-commits
tberghammer updated this revision to Diff 75425.
tberghammer marked 2 inline comments as done.
Herald added subscribers: mgorny, beanz.

https://reviews.llvm.org/D25734

Files:
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
  
packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp
  source/Plugins/Language/CPlusPlus/CMakeLists.txt
  source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  source/Plugins/Language/CPlusPlus/LibStdcpp.h
  source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Index: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===
--- /dev/null
+++ source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -0,0 +1,160 @@
+//===-- LibStdcppUniquePointer.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "LibStdcpp.h"
+
+#include 
+#include 
+
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace {
+
+class LibStdcppUniquePtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  explicit LibStdcppUniquePtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+  bool GetSummary(Stream &stream, const TypeSummaryOptions &options);
+
+private:
+  ValueObjectSP m_ptr_obj;
+  ValueObjectSP m_obj_obj;
+  ValueObjectSP m_del_obj;
+};
+
+} // end of anonymous namespace
+
+LibStdcppUniquePtrSyntheticFrontEnd::LibStdcppUniquePtrSyntheticFrontEnd(
+lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp) {
+  Update();
+}
+
+bool LibStdcppUniquePtrSyntheticFrontEnd::Update() {
+  ValueObjectSP valobj_backend_sp = m_backend.GetSP();
+  if (!valobj_backend_sp)
+return false;
+
+  ValueObjectSP valobj_sp = valobj_backend_sp->GetNonSyntheticValue();
+  if (!valobj_sp)
+return false;
+
+  ValueObjectSP tuple_sp =
+  valobj_sp->GetChildMemberWithName(ConstString("_M_t"), true);
+  if (!tuple_sp)
+return false;
+
+  std::unique_ptr tuple_frontend(
+  LibStdcppTupleSyntheticFrontEndCreator(nullptr, tuple_sp));
+
+  m_ptr_obj = tuple_frontend->GetChildAtIndex(0);
+  if (m_ptr_obj)
+m_ptr_obj->SetName(ConstString("pointer"));
+
+  m_del_obj = tuple_frontend->GetChildAtIndex(1);
+  if (m_del_obj)
+m_del_obj->SetName(ConstString("deleter"));
+
+  if (m_ptr_obj) {
+Error error;
+m_obj_obj = m_ptr_obj->Dereference(error);
+if (error.Success()) {
+  m_obj_obj->SetName(ConstString("object"));
+}
+  }
+
+  return false;
+}
+
+bool LibStdcppUniquePtrSyntheticFrontEnd::MightHaveChildren() { return true; }
+
+lldb::ValueObjectSP
+LibStdcppUniquePtrSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
+  if (idx == 0)
+return m_obj_obj;
+  if (idx == 1)
+return m_del_obj;
+  if (idx == 2)
+return m_ptr_obj;
+  return lldb::ValueObjectSP();
+}
+
+size_t LibStdcppUniquePtrSyntheticFrontEnd::CalculateNumChildren() {
+  if (m_del_obj)
+return 2;
+  if (m_ptr_obj && m_ptr_obj->GetValueAsUnsigned(0) != 0)
+return 1;
+  return 0;
+}
+
+size_t LibStdcppUniquePtrSyntheticFrontEnd::GetIndexOfChildWithName(
+const ConstString &name) {
+  if (name == ConstString("obj") || name == ConstString("object"))
+return 0;
+  if (name == ConstString("del") || name == ConstString("deleter"))
+return 1;
+  if (name == ConstString("ptr") || name == ConstString("pointer"))
+return 2;
+  return UINT32_MAX;
+}
+
+bool LibStdcppUniquePtrSyntheticFrontEnd::GetSummary(
+Stream &stream, const TypeSummaryOptions &options) {
+  if (!m_ptr_obj)
+return false;
+
+  if (m_ptr_obj->GetValueAsUnsigned(0) == 0) {
+stream.Printf("nullptr");
+  } else {
+Error error;
+bool print_pointee = false;
+if (m_obj_obj) {
+  if (m_obj_obj->DumpPrintableRepresentation(
+  stream, ValueObject::eValueObjectRepresentationStyleSummary,
+  lldb::eFormatInvalid,
+  ValueObject::ePrintableRepresentationSpecialCasesDisable,
+  false)) {
+print_pointee = true;
+  }
+}
+if (!print_pointee)
+

[Lldb-commits] [PATCH] D25734: Add data formatter for libstdc++ unique_ptr

2016-10-21 Thread Tamas Berghammer via lldb-commits
tberghammer added inline comments.



Comment at: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp:110
+  if (name == ConstString("ptr") || name == ConstString("pointer")) return 2;
+  return UINT32_MAX;
+}

labath wrote:
> ~0 ?
The user compares the result against UINT32_MAX what is wrong but I don't want 
to start changing all use case of this function in this CL.


https://reviews.llvm.org/D25734



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


[Lldb-commits] [PATCH] D25681: [PseudoTerminal] Fix PseudoTerminal MSVC release crash

2016-10-21 Thread Rudy Pons via lldb-commits
Ilod updated this revision to Diff 75426.
Ilod added a comment.

Yeah, you're right, the previous code is used for reference was inconsistent 
here. Now I return false and set an error string. Also remove an hacky ifdef 
which was needed on previous implementation (because the master id was updated 
to 0), but now we leave it to -1, so it's not needed anymore.


https://reviews.llvm.org/D25681

Files:
  source/Utility/PseudoTerminal.cpp


Index: source/Utility/PseudoTerminal.cpp
===
--- source/Utility/PseudoTerminal.cpp
+++ source/Utility/PseudoTerminal.cpp
@@ -50,11 +50,7 @@
 //--
 void PseudoTerminal::CloseMasterFileDescriptor() {
   if (m_master_fd >= 0) {
-// Don't call 'close' on m_master_fd for Windows as a dummy implementation of
-// posix_openpt above always gives it a 0 value.
-#ifndef _WIN32
 ::close(m_master_fd);
-#endif
 m_master_fd = invalid_fd;
   }
 }
@@ -81,13 +77,14 @@
 // file descriptor after this object is out of scope or destroyed.
 //
 // RETURNS:
-//  Zero when successful, non-zero indicating an error occurred.
+//  True when successful, false indicating an error occurred.
 //--
 bool PseudoTerminal::OpenFirstAvailableMaster(int oflag, char *error_str,
   size_t error_len) {
   if (error_str)
 error_str[0] = '\0';
 
+#if !defined(LLDB_DISABLE_POSIX)
   // Open the master side of a pseudo terminal
   m_master_fd = ::posix_openpt(oflag);
   if (m_master_fd < 0) {
@@ -113,6 +110,12 @@
   }
 
   return true;
+#else
+  if (error_str)
+::snprintf(error_str, error_len, "%s",
+   "pseudo terminal not supported");
+  return false;
+#endif
 }
 
 //--
@@ -124,7 +127,7 @@
 // ReleaseSlaveFileDescriptor() member function.
 //
 // RETURNS:
-//  Zero when successful, non-zero indicating an error occurred.
+//  True when successful, false indicating an error occurred.
 //--
 bool PseudoTerminal::OpenSlave(int oflag, char *error_str, size_t error_len) {
   if (error_str)


Index: source/Utility/PseudoTerminal.cpp
===
--- source/Utility/PseudoTerminal.cpp
+++ source/Utility/PseudoTerminal.cpp
@@ -50,11 +50,7 @@
 //--
 void PseudoTerminal::CloseMasterFileDescriptor() {
   if (m_master_fd >= 0) {
-// Don't call 'close' on m_master_fd for Windows as a dummy implementation of
-// posix_openpt above always gives it a 0 value.
-#ifndef _WIN32
 ::close(m_master_fd);
-#endif
 m_master_fd = invalid_fd;
   }
 }
@@ -81,13 +77,14 @@
 // file descriptor after this object is out of scope or destroyed.
 //
 // RETURNS:
-//  Zero when successful, non-zero indicating an error occurred.
+//  True when successful, false indicating an error occurred.
 //--
 bool PseudoTerminal::OpenFirstAvailableMaster(int oflag, char *error_str,
   size_t error_len) {
   if (error_str)
 error_str[0] = '\0';
 
+#if !defined(LLDB_DISABLE_POSIX)
   // Open the master side of a pseudo terminal
   m_master_fd = ::posix_openpt(oflag);
   if (m_master_fd < 0) {
@@ -113,6 +110,12 @@
   }
 
   return true;
+#else
+  if (error_str)
+::snprintf(error_str, error_len, "%s",
+   "pseudo terminal not supported");
+  return false;
+#endif
 }
 
 //--
@@ -124,7 +127,7 @@
 // ReleaseSlaveFileDescriptor() member function.
 //
 // RETURNS:
-//  Zero when successful, non-zero indicating an error occurred.
+//  True when successful, false indicating an error occurred.
 //--
 bool PseudoTerminal::OpenSlave(int oflag, char *error_str, size_t error_len) {
   if (error_str)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r284828 - Improve the libstdc++ smart pointer formatters

2016-10-21 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Oct 21 10:02:32 2016
New Revision: 284828

URL: http://llvm.org/viewvc/llvm-project?rev=284828&view=rev
Log:
Improve the libstdc++ smart pointer formatters

* Display the strong/weak count in the summary
* Display the pointed object as a synthetic member
* Create synthetic children for weak/strong count

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

Added:
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppSmartPointer.cpp
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile?rev=284828&r1=284827&r2=284828&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
 Fri Oct 21 10:02:32 2016
@@ -2,14 +2,7 @@ LEVEL = ../../../../../make
 
 CXX_SOURCES := main.cpp
 
-CXXFLAGS := -O0
 USE_LIBSTDCPP := 1
-
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets.  Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
-  CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
 
 include $(LEVEL)/Makefile.rules

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py?rev=284828&r1=284827&r2=284828&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
 Fri Oct 21 10:02:32 2016
@@ -31,19 +31,58 @@ class StdSmartPtrDataFormatterTestCase(T
 substrs=['stopped', 'stop reason = breakpoint'])
 
 self.expect("frame variable nsp", substrs=['nsp = nullptr'])
-self.expect("frame variable isp", substrs=['isp = 123'])
-self.expect("frame variable ssp", substrs=['ssp = "foobar"'])
-
+self.expect("frame variable isp", substrs=['isp = 123', 'strong=1', 
'weak=1'])
+self.expect("frame variable ssp", substrs=['ssp = "foobar"', 
'strong=1', 'weak=1'])
 self.expect("frame variable nwp", substrs=['nwp = nullptr'])
-self.expect("frame variable iwp", substrs=['iwp = 123'])
-self.expect("frame variable swp", substrs=['swp = "foobar"'])
+self.expect("frame variable iwp", substrs=['iwp = 123', 'strong=1', 
'weak=1'])
+self.expect("frame variable swp", substrs=['swp = "foobar"', 
'strong=1', 'weak=1'])
+
+frame = self.frame()
+self.assertTrue(frame.IsValid())
+
+self.assertEqual(0, 
frame.GetValueForVariablePath("nsp.pointer").GetValueAsUnsigned())
+self.assertEqual(0, 
frame.GetValueForVariablePath("nwp.pointer").GetValueAsUnsigned())
+
+self.assertNotEqual(0, 
frame.GetValueForVariablePath("isp.pointer").GetValueAsUnsigned())
+self.assertEqual(123, 
frame.GetValueForVariablePath("isp.object").GetValueAsUnsigned())
+self.assertEqual(1, 
frame.GetValueForVariablePath("isp.count").GetValueAsUnsigned())
+self.assertEqual(1, 
frame.GetValueForVariablePath("isp.weak_count").GetValueAsUnsigned())
+self.assertFalse(frame.GetValueForVariablePath("isp.foobar").IsValid())
+
+self.assertNotEqual(0, 
frame.GetValueForVariablePath("ssp.pointer").GetValueAsUnsigned())
+self.assertEqual('"foobar"', 
frame.GetValueForVariablePath("ssp.object").GetSummary())
+self.assertEqual(1, 
frame.GetValueForVariablePath("ssp.count").GetValueAsUnsigned())
+self.assertEqual(1, 
frame.GetValueForVariablePath("ssp.weak_count").GetValueAsUnsigned())
+self.assertFalse(frame.GetValueForVariablePath("ssp.foobar").IsValid())

[Lldb-commits] [lldb] r284829 - Add data formatter for libstdc++ tuple

2016-10-21 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Oct 21 10:02:38 2016
New Revision: 284829

URL: http://llvm.org/viewvc/llvm-project?rev=284829&view=rev
Log:
Add data formatter for libstdc++ tuple

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.h

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile?rev=284829&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
 Fri Oct 21 10:02:38 2016
@@ -0,0 +1,8 @@
+LEVEL = ../../../../../make
+
+CXX_SOURCES := main.cpp
+
+USE_LIBSTDCPP := 1
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py?rev=284829&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
 Fri Oct 21 10:02:38 2016
@@ -0,0 +1,49 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class StdTupleDataFormatterTestCase(TestBase):
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfFreeBSD
+@skipIfWindows  # libstdcpp not ported to Windows
+@skipIfDarwin  # doesn't compile on Darwin
+def test_with_run_command(self):
+self.build()
+self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_source_regexp(
+self, "Set break point at this line.")
+self.runCmd("run", RUN_SUCCEEDED)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs=['stopped', 'stop reason = breakpoint'])
+
+frame = self.frame()
+self.assertTrue(frame.IsValid())
+
+self.expect("frame variable ti", substrs=['[0] = 1'])
+self.expect("frame variable ts", substrs=['[0] = "foobar"'])
+self.expect("frame variable tt", substrs=['[0] = 1', '[1] = "baz"', 
'[2] = 2'])
+
+self.assertEqual(1, 
frame.GetValueForVariablePath("ti[0]").GetValueAsUnsigned())
+self.assertFalse(frame.GetValueForVariablePath("ti[1]").IsValid())
+
+self.assertEqual('"foobar"', 
frame.GetValueForVariablePath("ts[0]").GetSummary())
+self.assertFalse(frame.GetValueForVariablePath("ts[1]").IsValid())
+
+self.assertEqual(1, 
frame.GetValueForVariablePath("tt[0]").GetValueAsUnsigned())
+self.assertEqual('"baz"', 
frame.GetValueForVariablePath("tt[1]").GetSummary())
+self.assertEqual(2, 
frame.GetValueForVariablePath("tt[2]").GetValueAsUnsigned())
+self.assertFalse(frame.GetValueForVariablePath("tt[3]").IsValid())

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp?rev=284829&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-for

[Lldb-commits] [PATCH] D25734: Add data formatter for libstdc++ unique_ptr

2016-10-21 Thread Eugene Zelenko via lldb-commits
Eugene.Zelenko added a comment.

Headers orders is still not correct.


https://reviews.llvm.org/D25734



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


[Lldb-commits] [lldb] r284830 - Add data formatter for libstdc++ unique_ptr

2016-10-21 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Oct 21 10:02:44 2016
New Revision: 284830

URL: http://llvm.org/viewvc/llvm-project?rev=284830&view=rev
Log:
Add data formatter for libstdc++ unique_ptr

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.h

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile?rev=284830&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
 Fri Oct 21 10:02:44 2016
@@ -0,0 +1,8 @@
+LEVEL = ../../../../../make
+
+CXX_SOURCES := main.cpp
+
+USE_LIBSTDCPP := 1
+CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py?rev=284830&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
 Fri Oct 21 10:02:44 2016
@@ -0,0 +1,61 @@
+"""
+Test lldb data formatter subsystem.
+"""
+
+from __future__ import print_function
+
+import os
+import time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class StdUniquePtrDataFormatterTestCase(TestBase):
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfFreeBSD
+@skipIfWindows  # libstdcpp not ported to Windows
+@skipIfDarwin  # doesn't compile on Darwin
+def test_with_run_command(self):
+self.build()
+self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_source_regexp(
+self, "Set break point at this line.")
+self.runCmd("run", RUN_SUCCEEDED)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs=['stopped', 'stop reason = breakpoint'])
+
+frame = self.frame()
+self.assertTrue(frame.IsValid())
+
+self.expect("frame variable nup", substrs=['nup = nullptr'])
+self.expect("frame variable iup", substrs=['iup = 123', 'object = 
123'])
+self.expect("frame variable sup", substrs=['sup = "foobar"', 'object = 
"foobar"'])
+
+self.expect("frame variable ndp", substrs=['ndp = nullptr'])
+self.expect("frame variable idp", substrs=['idp = 456', 'object = 
456', 'deleter = ', 'a = 1', 'b = 2'])
+self.expect("frame variable sdp", substrs=['sdp = "baz"', 'object = 
"baz"', 'deleter = ', 'a = 3', 'b = 4'])
+
+self.assertEqual(123, 
frame.GetValueForVariablePath("iup.object").GetValueAsUnsigned())
+
self.assertFalse(frame.GetValueForVariablePath("iup.deleter").IsValid())
+
+self.assertEqual('"foobar"', 
frame.GetValueForVariablePath("sup.object").GetSummary())
+
self.assertFalse(frame.GetValueForVariablePath("sup.deleter").IsValid())
+
+self.assertEqual(456, 
frame.GetValueForVariablePath("idp.object").GetValueAsUnsigned())
+self.assertEqual('"baz"', 
frame.GetValueForVariablePath("sdp.object").GetSummary())
+
+idp_deleter = frame.GetValueForVariablePath("idp.deleter")
+self.assertTrue(idp_deleter.IsValid())
+self.assertEqual(1, 
idp_deleter

[Lldb-commits] [PATCH] D25734: Add data formatter for libstdc++ unique_ptr

2016-10-21 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284830: Add data formatter for libstdc++ unique_ptr 
(authored by tberghammer).

Changed prior to commit:
  https://reviews.llvm.org/D25734?vs=75425&id=75432#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25734

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/TestDataFormatterStdUniquePtr.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/main.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
  lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.h
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Index: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -803,6 +803,11 @@
 
   AddCXXSynthetic(
   cpp_category_sp,
+  lldb_private::formatters::LibStdcppUniquePtrSyntheticFrontEndCreator,
+  "std::unique_ptr synthetic children",
+  ConstString("^std::unique_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
+  AddCXXSynthetic(
+  cpp_category_sp,
   lldb_private::formatters::LibStdcppSharedPtrSyntheticFrontEndCreator,
   "std::shared_ptr synthetic children",
   ConstString("^std::shared_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
@@ -818,6 +823,11 @@
   stl_synth_flags, true);
 
   AddCXXSummary(cpp_category_sp,
+lldb_private::formatters::LibStdcppUniquePointerSummaryProvider,
+"libstdc++ std::unique_ptr summary provider",
+ConstString("^std::unique_ptr<.+>(( )?&)?$"), stl_summary_flags,
+true);
+  AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibStdcppSmartPointerSummaryProvider,
 "libstdc++ std::shared_ptr summary provider",
 ConstString("^std::shared_ptr<.+>(( )?&)?$"), stl_summary_flags,
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -12,4 +12,5 @@
   LibStdcpp.cpp
   LibStdcppSmartPointer.cpp
   LibStdcppTuple.cpp
+  LibStdcppUniquePointer.cpp
 )
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.h
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.h
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.h
@@ -31,6 +31,10 @@
 const TypeSummaryOptions
 &options); // libstdc++ std::shared_ptr<> and std::weak_ptr<>
 
+bool LibStdcppUniquePointerSummaryProvider(
+ValueObject &valobj, Stream &stream,
+const TypeSummaryOptions &options); // libstdc++ std::unique_ptr<>
+
 SyntheticChildrenFrontEnd *
 LibstdcppMapIteratorSyntheticFrontEndCreator(CXXSyntheticChildren *,
  lldb::ValueObjectSP);
@@ -46,6 +50,11 @@
 SyntheticChildrenFrontEnd *
 LibStdcppSharedPtrSyntheticFrontEndCreator(CXXSyntheticChildren *,
lldb::ValueObjectSP);
+
+SyntheticChildrenFrontEnd *
+LibStdcppUniquePtrSyntheticFrontEndCreator(CXXSyntheticChildren *,
+   lldb::ValueObjectSP);
+
 } // namespace formatters
 } // namespace lldb_private
 
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
@@ -0,0 +1,160 @@
+//===-- LibStdcppUniquePointer.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "LibStdcpp.h"
+
+#include 
+#include 
+
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace {
+
+class LibStdcppUniquePtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  explicit LibStdcppUniquePtrSynthe

[Lldb-commits] [PATCH] D25733: Add data formatter for libstdc++ tuple

2016-10-21 Thread Eugene Zelenko via lldb-commits
Eugene.Zelenko added a comment.

Headers orders is still not correct.


Repository:
  rL LLVM

https://reviews.llvm.org/D25733



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


[Lldb-commits] [PATCH] D25726: Improve the libstdc++ smart pointer formatters

2016-10-21 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284828: Improve the libstdc++ smart pointer formatters 
(authored by tberghammer).

Changed prior to commit:
  https://reviews.llvm.org/D25726?vs=75300&id=75431#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25726

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
  lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppSmartPointer.cpp

Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
@@ -63,21 +63,6 @@
   lldb::ValueObjectSP m_pair_sp;
 };
 
-class LibStdcppSharedPtrSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
-public:
-  explicit LibStdcppSharedPtrSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
-
-  size_t CalculateNumChildren() override;
-
-  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
-
-  bool Update() override;
-
-  bool MightHaveChildren() override;
-
-  size_t GetIndexOfChildWithName(const ConstString &name) override;
-};
-
 } // end of anonymous namespace
 
 LibstdcppMapIteratorSyntheticFrontEnd::LibstdcppMapIteratorSyntheticFrontEnd(
@@ -351,80 +336,3 @@
   }
   return false;
 }
-
-LibStdcppSharedPtrSyntheticFrontEnd::LibStdcppSharedPtrSyntheticFrontEnd(
-lldb::ValueObjectSP valobj_sp)
-: SyntheticChildrenFrontEnd(*valobj_sp) {
-  if (valobj_sp)
-Update();
-}
-
-size_t LibStdcppSharedPtrSyntheticFrontEnd::CalculateNumChildren() { return 1; }
-
-lldb::ValueObjectSP
-LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
-  ValueObjectSP valobj_sp = m_backend.GetSP();
-  if (!valobj_sp)
-return lldb::ValueObjectSP();
-
-  if (idx == 0)
-return valobj_sp->GetChildMemberWithName(ConstString("_M_ptr"), true);
-  else
-return lldb::ValueObjectSP();
-}
-
-bool LibStdcppSharedPtrSyntheticFrontEnd::Update() { return false; }
-
-bool LibStdcppSharedPtrSyntheticFrontEnd::MightHaveChildren() { return true; }
-
-size_t LibStdcppSharedPtrSyntheticFrontEnd::GetIndexOfChildWithName(
-const ConstString &name) {
-  if (name == ConstString("_M_ptr"))
-return 0;
-  return UINT32_MAX;
-}
-
-SyntheticChildrenFrontEnd *
-lldb_private::formatters::LibStdcppSharedPtrSyntheticFrontEndCreator(
-CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
-  return (valobj_sp ? new LibStdcppSharedPtrSyntheticFrontEnd(valobj_sp)
-: nullptr);
-}
-
-bool lldb_private::formatters::LibStdcppSmartPointerSummaryProvider(
-ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
-  ValueObjectSP valobj_sp(valobj.GetNonSyntheticValue());
-  if (!valobj_sp)
-return false;
-
-  ValueObjectSP ptr_sp(
-  valobj_sp->GetChildMemberWithName(ConstString("_M_ptr"), true));
-  if (!ptr_sp)
-return false;
-
-  ValueObjectSP usecount_sp(valobj_sp->GetChildAtNamePath(
-  {ConstString("_M_refcount"), ConstString("_M_pi"),
-   ConstString("_M_use_count")}));
-  if (!usecount_sp)
-return false;
-
-  if (ptr_sp->GetValueAsUnsigned(0) == 0 ||
-  usecount_sp->GetValueAsUnsigned(0) == 0) {
-stream.Printf("nullptr");
-return true;
-  }
-
-  Error error;
-  ValueObjectSP pointee_sp = ptr_sp->Dereference(error);
-  if (pointee_sp && error.Success()) {
-if (pointee_sp->DumpPrintableRepresentation(
-stream, ValueObject::eValueObjectRepresentationStyleSummary,
-lldb::eFormatInvalid,
-ValueObject::ePrintableRepresentationSpecialCasesDisable, false)) {
-  return true;
-}
-  }
-
-  stream.Printf("ptr = 0x%" PRIx64, ptr_sp->GetValueAsUnsigned(0));
-  return true;
-}
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
@@ -10,4 +10,5 @@
   LibCxxUnorderedMap.cpp
   LibCxxVector.cpp
   LibStdcpp.cpp
+  LibStdcppSmartPointer.cpp
 )
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppSmartPointer.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppSmartPointer.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppSmartPointer.cpp
@@ -0,0 +1,200 @@
+//===-- LibStdcppSmartPointer.cpp ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under 

[Lldb-commits] [PATCH] D25733: Add data formatter for libstdc++ tuple

2016-10-21 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284829: Add data formatter for libstdc++ tuple (authored by 
tberghammer).

Changed prior to commit:
  https://reviews.llvm.org/D25733?vs=75417&id=75433#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25733

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/TestDataFormatterStdTuple.py
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/main.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/CMakeLists.txt
  lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.h
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp

Index: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -811,6 +811,11 @@
   lldb_private::formatters::LibStdcppSharedPtrSyntheticFrontEndCreator,
   "std::weak_ptr synthetic children",
   ConstString("^std::weak_ptr<.+>(( )?&)?$"), stl_synth_flags, true);
+  AddCXXSynthetic(
+  cpp_category_sp,
+  lldb_private::formatters::LibStdcppTupleSyntheticFrontEndCreator,
+  "std::tuple synthetic children", ConstString("^std::tuple<.+>(( )?&)?$"),
+  stl_synth_flags, true);
 
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibStdcppSmartPointerSummaryProvider,
Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
@@ -0,0 +1,109 @@
+//===-- LibStdcppTuple.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "LibStdcpp.h"
+
+#include 
+#include 
+
+#include "lldb/Core/ConstString.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+namespace {
+
+class LibStdcppTupleSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  explicit LibStdcppTupleSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+private:
+  std::vector m_members;
+};
+
+} // end of anonymous namespace
+
+LibStdcppTupleSyntheticFrontEnd::LibStdcppTupleSyntheticFrontEnd(
+lldb::ValueObjectSP valobj_sp)
+: SyntheticChildrenFrontEnd(*valobj_sp) {
+  Update();
+}
+
+bool LibStdcppTupleSyntheticFrontEnd::Update() {
+  m_members.clear();
+
+  ValueObjectSP valobj_backend_sp = m_backend.GetSP();
+  if (!valobj_backend_sp)
+return false;
+
+  ValueObjectSP next_child_sp = valobj_backend_sp->GetNonSyntheticValue();
+  while (next_child_sp != nullptr) {
+ValueObjectSP current_child = next_child_sp;
+next_child_sp = nullptr;
+
+size_t child_count = current_child->GetNumChildren();
+for (size_t i = 0; i < child_count; ++i) {
+  ValueObjectSP child_sp = current_child->GetChildAtIndex(i, true);
+  llvm::StringRef name_str = child_sp->GetName().GetStringRef();
+  if (name_str.startswith("std::_Tuple_impl<")) {
+next_child_sp = child_sp;
+  } else if (name_str.startswith("std::_Head_base<")) {
+ValueObjectSP value_sp =
+child_sp->GetChildMemberWithName(ConstString("_M_head_impl"), true);
+if (value_sp) {
+  StreamString name;
+  name.Printf("[%zd]", m_members.size());
+  value_sp->SetName(ConstString(name.GetData()));
+
+  m_members.push_back(value_sp);
+}
+  }
+}
+  }
+
+  return false;
+}
+
+bool LibStdcppTupleSyntheticFrontEnd::MightHaveChildren() { return true; }
+
+lldb::ValueObjectSP
+LibStdcppTupleSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
+  if (idx < m_members.size())
+return m_members[idx];
+  return lldb::ValueObjectSP();
+}
+
+size_t LibStdcppTupleSyntheticFrontEnd::CalculateNumChildren() {
+  return m_members.size();
+}
+
+size_t LibStdcppTupleSyntheticFrontEnd::GetIndex

[Lldb-commits] [lldb] r284831 - Fix incorrect header order introduced in rL284830

2016-10-21 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Oct 21 10:05:03 2016
New Revision: 284831

URL: http://llvm.org/viewvc/llvm-project?rev=284831&view=rev
Log:
Fix incorrect header order introduced in rL284830

Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp?rev=284831&r1=284830&r2=284831&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp Fri Oct 21 
10:05:03 2016
@@ -9,14 +9,14 @@
 
 #include "LibStdcpp.h"
 
-#include 
-#include 
-
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/ValueObject.h"
 #include "lldb/DataFormatters/FormattersHelpers.h"
 #include "lldb/DataFormatters/TypeSynthetic.h"
 
+#include 
+#include 
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;

Modified: 
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp?rev=284831&r1=284830&r2=284831&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp 
(original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Fri 
Oct 21 10:05:03 2016
@@ -9,14 +9,14 @@
 
 #include "LibStdcpp.h"
 
-#include 
-#include 
-
 #include "lldb/Core/ConstString.h"
 #include "lldb/Core/ValueObject.h"
 #include "lldb/DataFormatters/FormattersHelpers.h"
 #include "lldb/DataFormatters/TypeSynthetic.h"
 
+#include 
+#include 
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;


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


[Lldb-commits] [PATCH] D25733: Add data formatter for libstdc++ tuple

2016-10-21 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

Sorry, I missed that part. I just submitted r284831 what should fix the header 
order for both case.


Repository:
  rL LLVM

https://reviews.llvm.org/D25733



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


[Lldb-commits] [PATCH] D25756: FreeBSD ARM support for software single step.

2016-10-21 Thread Dmitry Mikulin via lldb-commits
dmikulin marked an inline comment as done.
dmikulin added a comment.

Thanks Pavel! I'll start working on it. Do you know when lldb-server Linux 
changes were committed? I want to use those patches as a template, but it's 
hard to locate them digging through thousands of commit log entries...

Ed, you mentioned NetBSD work. Do you know where they are in their 
implementation?  Anything I can do to help? Or should I start from scratch?


Repository:
  rL LLVM

https://reviews.llvm.org/D25756



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


Re: [Lldb-commits] [PATCH] D25057: Fix ARM/AArch64 Step-Over watchpoint issue remove provision for duplicate watchpoints

2016-10-21 Thread Jim Ingham via lldb-commits
Yeah, sorry, that was an oversight on my part, but I think it's trivial to fix. 
 The WatchpointSentry was being set up before the little single step over the 
watchpoint dance, and it was accidentally being used to get the watchpoint 
disabled.  That's not the main point of the sentry, which is to ensure that the 
right thing happens whatever the actions do.  OTOH, the single-step dance 
doesn't need such a fancy mechanism, it can just by-hand 
disable/single-step/enable, then set up the WatchpointSentry to handle the more 
complex task of running the actions.

I'm testing this out now and see how it goes.

Jim


> On Oct 21, 2016, at 5:02 AM, Pavel Labath  wrote:
> 
> Ok, after the latest round of changes, I was not able to reproduce the
> behaviour where we would continually be-continually re-hitting a
> watchpoint. However, I did manage to get the lldb-server to hang if I
> set two watchpoints close to each other and trigger them both with a
> single instruction. I added it as TestMultipleHits.py. However, this
> seems like a lldb-server problem, so it's probably not going to be
> interesting to you. But maybe Omair would take a look (?)
> 
> To get watchpoints working at all, I had to revert your latest patch
> -- it was causing watchpoints to be re-enabled before we actually
> stepped-over them, causing a different kind of a loop. Let me know if
> you have questions about that.
> 
> cheers,
> pl
> 
> On 20 October 2016 at 19:43, Jim Ingham  wrote:
>> Ah, I see, thanks.  If you can make a test case that fails on ARM in the 
>> current state of things, I would be interested in taking a look at it.  We 
>> had to do an analogous little dance for stepping from one breakpoint to 
>> another.  Probably not the same solution, but we can surely get this to work.
>> 
>> Jim
>> 
>> 
>>> On Oct 20, 2016, at 3:12 AM, Pavel Labath  wrote:
>>> 
>>> The reason you could not see this is that the issue is specific to arm
>>> (or any target that reports watchpoint hits *before* executing the
>>> instruction tripping the watch). In this case, we have special logic
>>> in the client which removes the watchpoint, does a single step, and
>>> reinstates the watchpoint. This code does not correctly handle the
>>> case when you hit *another* watchpoint while "stepping over" the first
>>> one.
>>> 
>>> I was not able to reproduce the exact original problem now (I was
>>> doing it with one of Omair's previous changes applied, so it may not
>>> be possible to reproduce on trunk), but here is another way this
>>> problem manifests itself:
>>> 
>>> 
>>> Process 6009 stopped
>>> * thread #1: tid = 6009, 0xaac67324 a.out`main + 16 at a.c:2, name =
>>> 'a.out', stop reason = breakpoint 1.1
>>>   frame #0: 0xaac67324 a.out`main + 16 at a.c:2
>>>  1   int x;
>>> -> 2   int main () { x = 47; return 0; }
>>> (lldb) fr var &x
>>> (int *) &x = 0xaac69004
>>> (lldb) watchpoint set expression -s 1 -- 0xaac69004
>>> Watchpoint created: Watchpoint 6: addr = 0xaac69004 size = 1 state =
>>> enabled type = w
>>>   new value: 0
>>> (lldb) watchpoint set expression -s 1 -- 0xaac69005
>>> Watchpoint created: Watchpoint 7: addr = 0xaac69005 size = 1 state =
>>> enabled type = w
>>>   new value: 0
>>> (lldb) c
>>> Process 6009 resuming
>>> 
>>> At this point, it appears as if the inferior keeps running and never
>>> hits the watchpoint, but if you check the packet log you will see that
>>> LLDB is continuously busy sending vCont packets trying to step over
>>> the watchpoint hit.
>>> Note that after Omair's change it will not be possible anymore to
>>> reproduce the problem this easily, as he forbids the creation of
>>> watchpoints within the same block, but you can reproduce still
>>> reproduce it by having a signle instruction that writes to two blocks
>>> (stp is a good candidate for that).
>>> 
>>> If you are more than curious and want to dig into that I can make a
>>> better repro case for it.
>>> 
>>> pl
>>> 
>>> 
>>> 
>>> On 19 October 2016 at 18:34, Jim Ingham  wrote:
 
> On Oct 4, 2016, at 9:28 AM, Pavel Labath via lldb-commits 
>  wrote:
> 
> Also, apparently lldb has a bug, where it mishandles the case where you 
> do a (user-level) single step over an instruction triggering a 
> watchpoint. That would be pretty important to fix as well.
 
 Do you have a reference for this?  In a trivial case, it works correctly 
 on MacOS so far as I can tell:
 
 (lldb) si
 Process 99358 stopped
 * thread #1: tid = 0x148d67e, function: main , stop reason = instruction 
 step into
   frame #0: 0x00010f5e changeit`main at changeit.c:9
  6
  7  printf("my_var is: %d.\n", my_var);
  8
 -> 9  my_var = 20;
  10
  11 printf("my_var is: %d.\n", my_var);
  12
 changeit`main:
 ->  0x10f5e <+46>: movl   $0x14, -0x8(%rbp)
   0x10f65 <+53>: movl   -0x8(%rbp), %esi
   0x10f68 <+56>: movl   %eax, -0xc(%rbp)
   0x10f6b <+59>:

[Lldb-commits] [PATCH] D25681: [PseudoTerminal] Fix PseudoTerminal MSVC release crash

2016-10-21 Thread Zachary Turner via lldb-commits
zturner accepted this revision.
zturner added a comment.
This revision is now accepted and ready to land.

LGTM as long as you've run the test suite and confirmed everything works.


https://reviews.llvm.org/D25681



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


[Lldb-commits] [lldb] r284847 - I hadn't fixed all the instances of the old marker for scripted format strings; do so now

2016-10-21 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Fri Oct 21 13:03:55 2016
New Revision: 284847

URL: http://llvm.org/viewvc/llvm-project?rev=284847&view=rev
Log:
I hadn't fixed all the instances of the old marker for scripted format strings; 
do so now


Modified:
lldb/trunk/www/formats.html

Modified: lldb/trunk/www/formats.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/formats.html?rev=284847&r1=284846&r2=284847&view=diff
==
--- lldb/trunk/www/formats.html (original)
+++ lldb/trunk/www/formats.html Fri Oct 21 13:03:55 2016
@@ -260,8 +260,8 @@
 that when the thread information is displayed in a 
context where
 we only want to show thread information, we can do so.
 
-   For both thread and frame formats, 
you can use ${target.script:python_func}, 
${process.script:python_func} and ${thread.script:python_func}
-   (and of course 
${frame.script:python_func} for frame formats)
+   For both thread and frame formats, 
you can use ${script.target:python_func}, 
${script.process:python_func} and ${script.thread:python_func}
+   (and of course 
${script.frame:python_func} for frame formats)
In all cases, the signature of 
python_func is expected to be:

def 
python_func(object,unused):
@@ -273,7 +273,7 @@
def thread_printer_func 
(thread,unused):
  return "Thread %s 
has %d frames\n" % (thread.name, thread.num_frames)

-   And you set it up with 
(lldb) settings set thread-format 
"${thread.script:thread_printer_func}"
+   And you set it up with 
(lldb) settings set thread-format 
"${script.thread:thread_printer_func}"
you would see output like:

* Thread main has 21 
frames


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


[Lldb-commits] [lldb] r284851 - Add the new stdcpp formatters to the Xcode project.

2016-10-21 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Oct 21 13:18:25 2016
New Revision: 284851

URL: http://llvm.org/viewvc/llvm-project?rev=284851&view=rev
Log:
Add the new stdcpp formatters to the Xcode project.

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=284851&r1=284850&r2=284851&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Oct 21 13:18:25 2016
@@ -748,6 +748,9 @@
4CCA645613B40B82003BDF98 /* AppleObjCTrampolineHandler.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CCA644813B40B82003BDF98 /* 
AppleObjCTrampolineHandler.cpp */; };
4CCA645813B40B82003BDF98 /* 
AppleThreadPlanStepThroughObjCTrampoline.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 4CCA644A13B40B82003BDF98 /* 
AppleThreadPlanStepThroughObjCTrampoline.cpp */; };
4CD0BD0F134BFADF00CB44D4 /* ValueObjectDynamicValue.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CD0BD0E134BFADF00CB44D4 /* 
ValueObjectDynamicValue.cpp */; };
+   4CDB8D6D1DBA91B6006C5B13 /* LibStdcppUniquePointer.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CDB8D671DBA91A6006C5B13 /* 
LibStdcppUniquePointer.cpp */; };
+   4CDB8D6E1DBA91B6006C5B13 /* LibStdcppTuple.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp 
*/; };
+   4CDB8D6F1DBA91B6006C5B13 /* LibStdcppSmartPointer.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4CDB8D691DBA91A6006C5B13 /* 
LibStdcppSmartPointer.cpp */; };
4CE4F673162C971A00F75CB3 /* SBExpressionOptions.h in Headers */ 
= {isa = PBXBuildFile; fileRef = 4CE4F672162C971A00F75CB3 /* 
SBExpressionOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
4CE4F675162C973F00F75CB3 /* SBExpressionOptions.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 4CE4F674162C973F00F75CB3 /* 
SBExpressionOptions.cpp */; };
4CF3D80C15AF4DC800845BF3 /* Security.framework in Frameworks */ 
= {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework 
*/; };
@@ -2576,6 +2579,9 @@
4CCA644B13B40B82003BDF98 /* 
AppleThreadPlanStepThroughObjCTrampoline.h */ = {isa = PBXFileReference; 
fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
AppleThreadPlanStepThroughObjCTrampoline.h; sourceTree = ""; };
4CD0BD0C134BFAB600CB44D4 /* ValueObjectDynamicValue.h */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name 
= ValueObjectDynamicValue.h; path = 
include/lldb/Core/ValueObjectDynamicValue.h; sourceTree = ""; };
4CD0BD0E134BFADF00CB44D4 /* ValueObjectDynamicValue.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = ValueObjectDynamicValue.cpp; path = 
source/Core/ValueObjectDynamicValue.cpp; sourceTree = ""; };
+   4CDB8D671DBA91A6006C5B13 /* LibStdcppUniquePointer.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = LibStdcppUniquePointer.cpp; path = 
Language/CPlusPlus/LibStdcppUniquePointer.cpp; sourceTree = ""; };
+   4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibStdcppTuple.cpp; path = Language/CPlusPlus/LibStdcppTuple.cpp; 
sourceTree = ""; };
+   4CDB8D691DBA91A6006C5B13 /* LibStdcppSmartPointer.cpp */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = LibStdcppSmartPointer.cpp; path = 
Language/CPlusPlus/LibStdcppSmartPointer.cpp; sourceTree = ""; };
4CE4F672162C971A00F75CB3 /* SBExpressionOptions.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBExpressionOptions.h; path = include/lldb/API/SBExpressionOptions.h; 
sourceTree = ""; };
4CE4F674162C973F00F75CB3 /* SBExpressionOptions.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBExpressionOptions.cpp; path = source/API/SBExpressionOptions.cpp; 
sourceTree = ""; };
4CE4F676162CE1E100F75CB3 /* SBExpressionOptions.i */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.c.preprocessed; path = SBExpressionOptions.i; sourceTree = 
""; };
@@ -5997,6 +6003,9 @@
945261B01B9A11BE00BF138D /* Formatters */ = {
isa = PBXGroup;
children = (
+   4CDB8D671DBA91A6006C5B13 /* 
LibStdcppUniquePointer.cpp */,
+   4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp 
*/,
+   

Re: [Lldb-commits] [PATCH] D25057: Fix ARM/AArch64 Step-Over watchpoint issue remove provision for duplicate watchpoints

2016-10-21 Thread Jim Ingham via lldb-commits
I uploaded:

https://reviews.llvm.org/D25875

Can you see if that fixes the failures you were seeing.

I'm not sure why that step over is happening in the StopInfoWatchpoint.  We 
usually try to hide that sort of platform difference down in the process 
plugins and then let the upper layers see the same state.  But that's a 
question for another day.

Jim


> On Oct 21, 2016, at 11:05 AM, Jim Ingham via lldb-commits 
>  wrote:
> 
> Yeah, sorry, that was an oversight on my part, but I think it's trivial to 
> fix.  The WatchpointSentry was being set up before the little single step 
> over the watchpoint dance, and it was accidentally being used to get the 
> watchpoint disabled.  That's not the main point of the sentry, which is to 
> ensure that the right thing happens whatever the actions do.  OTOH, the 
> single-step dance doesn't need such a fancy mechanism, it can just by-hand 
> disable/single-step/enable, then set up the WatchpointSentry to handle the 
> more complex task of running the actions.
> 
> I'm testing this out now and see how it goes.
> 
> Jim
> 
> 
>> On Oct 21, 2016, at 5:02 AM, Pavel Labath  wrote:
>> 
>> Ok, after the latest round of changes, I was not able to reproduce the
>> behaviour where we would continually be-continually re-hitting a
>> watchpoint. However, I did manage to get the lldb-server to hang if I
>> set two watchpoints close to each other and trigger them both with a
>> single instruction. I added it as TestMultipleHits.py. However, this
>> seems like a lldb-server problem, so it's probably not going to be
>> interesting to you. But maybe Omair would take a look (?)
>> 
>> To get watchpoints working at all, I had to revert your latest patch
>> -- it was causing watchpoints to be re-enabled before we actually
>> stepped-over them, causing a different kind of a loop. Let me know if
>> you have questions about that.
>> 
>> cheers,
>> pl
>> 
>> On 20 October 2016 at 19:43, Jim Ingham  wrote:
>>> Ah, I see, thanks.  If you can make a test case that fails on ARM in the 
>>> current state of things, I would be interested in taking a look at it.  We 
>>> had to do an analogous little dance for stepping from one breakpoint to 
>>> another.  Probably not the same solution, but we can surely get this to 
>>> work.
>>> 
>>> Jim
>>> 
>>> 
 On Oct 20, 2016, at 3:12 AM, Pavel Labath  wrote:
 
 The reason you could not see this is that the issue is specific to arm
 (or any target that reports watchpoint hits *before* executing the
 instruction tripping the watch). In this case, we have special logic
 in the client which removes the watchpoint, does a single step, and
 reinstates the watchpoint. This code does not correctly handle the
 case when you hit *another* watchpoint while "stepping over" the first
 one.
 
 I was not able to reproduce the exact original problem now (I was
 doing it with one of Omair's previous changes applied, so it may not
 be possible to reproduce on trunk), but here is another way this
 problem manifests itself:
 
 
 Process 6009 stopped
 * thread #1: tid = 6009, 0xaac67324 a.out`main + 16 at a.c:2, name =
 'a.out', stop reason = breakpoint 1.1
  frame #0: 0xaac67324 a.out`main + 16 at a.c:2
 1   int x;
 -> 2   int main () { x = 47; return 0; }
 (lldb) fr var &x
 (int *) &x = 0xaac69004
 (lldb) watchpoint set expression -s 1 -- 0xaac69004
 Watchpoint created: Watchpoint 6: addr = 0xaac69004 size = 1 state =
 enabled type = w
  new value: 0
 (lldb) watchpoint set expression -s 1 -- 0xaac69005
 Watchpoint created: Watchpoint 7: addr = 0xaac69005 size = 1 state =
 enabled type = w
  new value: 0
 (lldb) c
 Process 6009 resuming
 
 At this point, it appears as if the inferior keeps running and never
 hits the watchpoint, but if you check the packet log you will see that
 LLDB is continuously busy sending vCont packets trying to step over
 the watchpoint hit.
 Note that after Omair's change it will not be possible anymore to
 reproduce the problem this easily, as he forbids the creation of
 watchpoints within the same block, but you can reproduce still
 reproduce it by having a signle instruction that writes to two blocks
 (stp is a good candidate for that).
 
 If you are more than curious and want to dig into that I can make a
 better repro case for it.
 
 pl
 
 
 
 On 19 October 2016 at 18:34, Jim Ingham  wrote:
> 
>> On Oct 4, 2016, at 9:28 AM, Pavel Labath via lldb-commits 
>>  wrote:
>> 
>> Also, apparently lldb has a bug, where it mishandles the case where you 
>> do a (user-level) single step over an instruction triggering a 
>> watchpoint. That would be pretty important to fix as well.
> 
> Do you have a reference for this?  In a trivial case, it works correctly 
> on MacOS so far as I can tell:
> 
> 

[Lldb-commits] [PATCH] D25756: FreeBSD ARM support for software single step.

2016-10-21 Thread Ed Maste via lldb-commits
emaste added a subscriber: krytarowski.
emaste added a comment.

On a quick look this seems OK. I'll try to test/review in detail.

In https://reviews.llvm.org/D25756#576642, @dmikulin wrote:

> Thanks Pavel! I'll start working on it. Do you know when lldb-server Linux 
> changes were committed? I want to use those patches as a template, but it's 
> hard to locate them digging through thousands of commit log entries...


I recalled discussing this when the Linux changes were going in and wanted to 
point you at a mailing list archive, but it seems it was only in private mail. 
I'll try to send you the relevant threads.

Have a look at https://reviews.llvm.org/rL212069 for starters.

> Ed, you mentioned NetBSD work. Do you know where they are in their 
> implementation?  Anything I can do to help? Or should I start from scratch?

I hope @krytarowski can comment on that.

It's probably best to move this discussion to a new thread on lldb-dev.


Repository:
  rL LLVM

https://reviews.llvm.org/D25756



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


[Lldb-commits] [lldb] r284854 - [CMake] Fix standalone build

2016-10-21 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Fri Oct 21 13:38:44 2016
New Revision: 284854

URL: http://llvm.org/viewvc/llvm-project?rev=284854&view=rev
Log:
[CMake] Fix standalone build

not and FileCheck targets may not be defined in standalone builds.

Modified:
lldb/trunk/lit/CMakeLists.txt

Modified: lldb/trunk/lit/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=284854&r1=284853&r2=284854&view=diff
==
--- lldb/trunk/lit/CMakeLists.txt (original)
+++ lldb/trunk/lit/CMakeLists.txt Fri Oct 21 13:38:44 2016
@@ -24,11 +24,13 @@ configure_lit_site_cfg(
   )
 
 set(LLDB_TEST_DEPS
-  FileCheck
   LLDBUnitTests
   lldb
-  not
   )
+
+if(NOT LLDB_BUILT_STANDALONE)
+  list(APPEND LLDB_TEST_DEPS FileCheck not)
+endif()
   
 # lldb-server is not built on every platform.
 if (TARGET lldb-server)


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


[Lldb-commits] [PATCH] D25756: FreeBSD ARM support for software single step.

2016-10-21 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

NetBSD is still focused on amd64-only port.

I start a funded project November 1st on getting x86 process plugin to work. 
More details here:

http://blog.netbsd.org/tnf/entry/funded_contract_2016_2017

Estimated time is 4 months full-time.

However there every help is appreciated and donations to TNF (The NetBSD 
Foundation) make it possible.


Repository:
  rL LLVM

https://reviews.llvm.org/D25756



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


[Lldb-commits] [PATCH] D25830: Search for llvm-config in LLDB_PATH_TO_LLVM_BUILD first

2016-10-21 Thread Todd Fiala via lldb-commits
tfiala commandeered this revision.
tfiala edited reviewers, added: vivkong; removed: tfiala.
tfiala added a comment.

@beanz and I discussed.  This isn't needed here at all.  The issue is entirely 
in the current manifestation of the GitHub side of swift-lldb.

Closing this out, we'll resolve in GitHub.


Repository:
  rL LLVM

https://reviews.llvm.org/D25830



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


[Lldb-commits] [PATCH] D25756: FreeBSD ARM support for software single step.

2016-10-21 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

@emaste What's the status of remote debugging on FreeBSD?


Repository:
  rL LLVM

https://reviews.llvm.org/D25756



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


[Lldb-commits] [PATCH] D25756: FreeBSD ARM support for software single step.

2016-10-21 Thread Kamil Rytarowski via lldb-commits
krytarowski added a comment.

I just scrolled the discussion so it's not really started. Thanks.

My plan is to work on ptrace(2) for about a month.

Then I will take the FreeBSD code as it is and port to NetBSD trying to make it 
functional. This is difficult part as there is everywhere OS specific 
interfaces and behavior. I hope to get it to some usable point after a month.

Then ,I will start working on remote debugging, as my previous patch for 
process tracing (it was buggy) was rejected without this property. I planned to 
merge my previous work with master as I was forced to keep catching up after 
the project changes and it was time expensive, and move my focus on proper 
platform support.

So far all my efforts were voluntary and NetBSD build bot is paid from my 
private resources. Now I will be able to spend on in full-time about 4 months.

So to make it short, hopefully I can join you in remote capabilities after New 
Year (according to my estimations).


Repository:
  rL LLVM

https://reviews.llvm.org/D25756



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


[Lldb-commits] [lldb] r284893 - [Test Suite] Allow overriding codesign identity

2016-10-21 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Fri Oct 21 17:13:55 2016
New Revision: 284893

URL: http://llvm.org/viewvc/llvm-project?rev=284893&view=rev
Log:
[Test Suite] Allow overriding codesign identity

Summary: Not everyone names their code sign identity "lldb_codesign", so it is 
nice to allow this to be overridden.

Reviewers: zturner, tfiala

Subscribers: labath, mgorny, lldb-commits

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
lldb/trunk/test/CMakeLists.txt

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=284893&r1=284892&r2=284893&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Fri Oct 21 17:13:55 2016
@@ -481,6 +481,8 @@ def parseOptionsAndInitTestdirs():
 # Shut off multiprocessing mode when test directories are specified.
 configuration.no_multiprocess_test_runner = True
 
+lldbtest_config.codesign_identity = args.codesign_identity
+
 #print("testdirs:", testdirs)
 
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py?rev=284893&r1=284892&r2=284893&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py Fri Oct 21 
17:13:55 2016
@@ -151,6 +151,11 @@ def create_parser():
 dest='log_success',
 action='store_true',
 help="Leave logs/traces even for successful test runs (useful for 
creating reference log files during debugging.)")
+group.add_argument(
+'--codesign-identity',
+metavar='Codesigning identity',
+default='lldb_codesign',
+help='The codesigning identity to use')
 
 # Configuration options
 group = parser.add_argument_group('Remote platform options')

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=284893&r1=284892&r2=284893&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Oct 21 17:13:55 
2016
@@ -1543,8 +1543,8 @@ class Base(unittest2.TestCase):
 
 def signBinary(self, binary_path):
 if sys.platform.startswith("darwin"):
-codesign_cmd = "codesign --force --sign lldb_codesign %s" % (
-binary_path)
+codesign_cmd = "codesign --force --sign \"%s\" %s" % (
+lldbtest_config.codesign_identity, binary_path)
 call(codesign_cmd, shell=True)
 
 def findBuiltClang(self):

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=284893&r1=284892&r2=284893&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Fri Oct 21 17:13:55 2016
@@ -85,6 +85,10 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows"
   endif()
 endif()
 
+if(LLDB_CODESIGN_IDENTITY)
+  list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity 
"${LLDB_CODESIGN_IDENTITY}")
+endif()
+
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"


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


[Lldb-commits] [PATCH] D25714: [Test Suite] Allow overriding codesign identity

2016-10-21 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284893: [Test Suite] Allow overriding codesign identity 
(authored by cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D25714?vs=75057&id=75499#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25714

Files:
  lldb/trunk/packages/Python/lldbsuite/test/dotest.py
  lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
  lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
  lldb/trunk/test/CMakeLists.txt


Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -85,6 +85,10 @@
   endif()
 endif()
 
+if(LLDB_CODESIGN_IDENTITY)
+  list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity 
"${LLDB_CODESIGN_IDENTITY}")
+endif()
+
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
Index: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
@@ -151,6 +151,11 @@
 dest='log_success',
 action='store_true',
 help="Leave logs/traces even for successful test runs (useful for 
creating reference log files during debugging.)")
+group.add_argument(
+'--codesign-identity',
+metavar='Codesigning identity',
+default='lldb_codesign',
+help='The codesigning identity to use')
 
 # Configuration options
 group = parser.add_argument_group('Remote platform options')
Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -1543,8 +1543,8 @@
 
 def signBinary(self, binary_path):
 if sys.platform.startswith("darwin"):
-codesign_cmd = "codesign --force --sign lldb_codesign %s" % (
-binary_path)
+codesign_cmd = "codesign --force --sign \"%s\" %s" % (
+lldbtest_config.codesign_identity, binary_path)
 call(codesign_cmd, shell=True)
 
 def findBuiltClang(self):
Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py
@@ -481,6 +481,8 @@
 # Shut off multiprocessing mode when test directories are specified.
 configuration.no_multiprocess_test_runner = True
 
+lldbtest_config.codesign_identity = args.codesign_identity
+
 #print("testdirs:", testdirs)
 
 


Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -85,6 +85,10 @@
   endif()
 endif()
 
+if(LLDB_CODESIGN_IDENTITY)
+  list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity "${LLDB_CODESIGN_IDENTITY}")
+endif()
+
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
Index: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
@@ -151,6 +151,11 @@
 dest='log_success',
 action='store_true',
 help="Leave logs/traces even for successful test runs (useful for creating reference log files during debugging.)")
+group.add_argument(
+'--codesign-identity',
+metavar='Codesigning identity',
+default='lldb_codesign',
+help='The codesigning identity to use')
 
 # Configuration options
 group = parser.add_argument_group('Remote platform options')
Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
@@ -1543,8 +1543,8 @@
 
 def signBinary(self, binary_path):
 if sys.platform.startswith("darwin"):
-codesign_cmd = "codesign --force --sign lldb_codesign %s" % (
-binary_path)
+codesign_cmd = "codesign --force --sign \"%s\" %s" % (
+lldbtest_config.codesign_identity, binary_path)
 call(codesign_cmd, shell=True)
 
 def findBuiltClang(self):
Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/trunk/packages/Python/lldbsuite/

Re: [Lldb-commits] [lldb] r284817 - Revert "Fix a race condition between "ephemeral watchpoint disable/enable" and continue in commands."

2016-10-21 Thread Jim Ingham via lldb-commits
Note that the WatchpointSentry logic predated the support for 
"!watchpoint_triggers_after", and it's real goal was to have accesses to the 
watchpoint in commands in the breakpoint action not re-trigger the watchpoint.  
The step-over-watchpoint logic was accidentally getting the benefit of this, 
but if that was all it was for, you wouldn't have needed any of the accounting 
for "real" vrs. "ephemeral" disables.  

Anyway, the solution is to manually disable/enable the watchpoint when single 
stepping, since that is a simple bit of straight-line code, and then set up the 
watchpoint sentry to do just it's job.

That's:

https://reviews.llvm.org/D25875

Jim
 
> On Oct 21, 2016, at 3:52 AM, Pavel Labath via lldb-commits 
>  wrote:
> 
> Author: labath
> Date: Fri Oct 21 05:52:11 2016
> New Revision: 284817
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=284817&view=rev
> Log:
> Revert "Fix a race condition between "ephemeral watchpoint disable/enable" 
> and continue in commands."
> 
> This reverts commit r284795, as it breaks watchpoint handling on arm (and
> presumable all architectures that report watchpoint hits without executing the
> tripping instruction).
> 
> There seems to be something fundamentally wrong with this patch: it uses
> process_sp->AddPreResumeAction to re-enable the watchpoint, but the whole 
> point
> of the step-over-watchpoint logic (which AFAIK is the only user of this 
> class) is
> to disable the watchpoint *after* we resume to do the single step.
> 
> I have no idea how to fix this except by reverting the offending patch.
> 
> Modified:
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
>lldb/trunk/source/Breakpoint/Watchpoint.cpp
>lldb/trunk/source/Target/StopInfo.cpp
> 
> Modified: 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py?rev=284817&r1=284816&r2=284817&view=diff
> ==
> --- 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
>  (original)
> +++ 
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
>  Fri Oct 21 05:52:11 2016
> @@ -54,6 +54,9 @@ class WatchpointPythonCommandTestCase(Te
> # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
> lldbutil.run_break_set_by_file_and_line(
> self, None, self.line, num_expected_locations=1)
> +#self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
> +#startstr = "Breakpoint created: 1: file ='%s', line = %d, 
> locations = 1" %
> +#   (self.source, self.line))#
> 
> # Run the program.
> self.runCmd("run", RUN_SUCCEEDED)
> @@ -128,6 +131,9 @@ class WatchpointPythonCommandTestCase(Te
> # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
> lldbutil.run_break_set_by_file_and_line(
> self, None, self.line, num_expected_locations=1)
> +#self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
> +#startstr = "Breakpoint created: 1: file ='%s', line = %d, 
> locations = 1" %
> +#   (self.source, self.line))#
> 
> # Run the program.
> self.runCmd("run", RUN_SUCCEEDED)
> @@ -171,4 +177,3 @@ class WatchpointPythonCommandTestCase(Te
> # second hit and set it to 999
> self.expect("frame variable --show-globals cookie",
> substrs=['(int32_t)', 'cookie = 999'])
> -
> 
> Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=284817&r1=284816&r2=284817&view=diff
> ==
> --- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original)
> +++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Fri Oct 21 05:52:11 2016
> @@ -232,7 +232,7 @@ void Watchpoint::TurnOffEphemeralMode()
> }
> 
> bool Watchpoint::IsDisabledDuringEphemeralMode() {
> -  return m_disabled_count > 1 && m_is_ephemeral;
> +  return m_disabled_count > 1;
> }
> 
> void Watchpoint::SetEnabled(bool enabled, bool notify) {
> 
> Modified: lldb/trunk/source/Target/StopInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=284817&r1=284816&r2=284817&view=diff
> ==
> --- lldb/trunk/source/Target/StopInfo.cpp (original)
> +++ lldb/trunk/source/Target/StopInfo.cpp Fri Oct 21 05:52:11 2016
> @

[Lldb-commits] [PATCH] D25886: [Test Suite] Properly respect --framework option

2016-10-21 Thread Chris Bieneman via lldb-commits
beanz created this revision.
beanz added a reviewer: tfiala.
beanz added a subscriber: lldb-commits.
Herald added a subscriber: mgorny.

dotest.py has a framework option that is not respected. This patch makes the 
framework path properly configurable via the --framework option.

This patch also adds a function to the lldbtest.Base class named 
"hasDarwinFramework" which allows us to not rely on the host platform to 
determine if a framework is present. If running on Darwin, and not building a 
framework, this will follow the *nix code paths which are appropriate for 
Darwin.


https://reviews.llvm.org/D25886

Files:
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/lldbtest.py
  test/CMakeLists.txt

Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -89,6 +89,10 @@
   list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity "${LLDB_CODESIGN_IDENTITY}")
 endif()
 
+if(LLDB_BUILD_FRAMEWORK)
+  list(APPEND LLDB_TEST_COMMON_ARGS --framework $)
+endif()
+
 add_python_test_target(check-lldb-single
   ${LLDB_SOURCE_DIR}/test/dotest.py
   "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}"
Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -829,6 +829,29 @@
 # Initialize debug_info
 self.debug_info = None
 
+lib_dir = os.environ["LLDB_LIB_DIR"]
+self.dsym = None
+self.framework_dir = None
+self.darwinWithFramework = self.platformIsDarwin()
+if sys.platform.startswith("darwin"):
+# Handle the framework environment variable if it is set
+if hasattr(lldbtest_config, 'lldbFrameworkPath'):
+framework_path = lldbtest_config.lldbFrameworkPath
+# Framework dir should be the directory containing the framework
+self.framework_dir = framework_path[:framework_path.rfind('LLDB.framework')]
+# If a framework dir was not specified assume the Xcode build
+# directory layout where the framework is in LLDB_LIB_DIR.
+else:
+self.framework_dir = lib_dir
+self.dsym = os.path.join(self.framework_dir, 'LLDB.framework', 'LLDB')
+# If the framework binary doesn't exist, assume we didn't actually
+# build a framework, and fallback to standard *nix behavior by
+# setting framework_dir and dsym to None.
+if not os.path.exists(self.dsym):
+self.framework_dir = None
+self.dsym = None
+self.darwinWithFramework = False
+
 def setAsync(self, value):
 """ Sets async mode to True/False and ensures it is reset after the testcase completes."""
 old_async = self.dbg.GetAsync()
@@ -1276,6 +1299,9 @@
 """Returns true if the OS triple for the selected platform is any valid apple OS"""
 return lldbplatformutil.platformIsDarwin()
 
+def hasDarwinFramework(self):
+return self.darwinWithFramework
+
 def getPlatform(self):
 """Returns the target platform the test suite is running on."""
 return lldbplatformutil.getPlatform()
@@ -1373,24 +1399,23 @@
 stdlibflag = self.getstdlibFlag()
 
 lib_dir = os.environ["LLDB_LIB_DIR"]
-if sys.platform.startswith("darwin"):
-dsym = os.path.join(lib_dir, 'LLDB.framework', 'LLDB')
+if self.hasDarwinFramework():
 d = {'CXX_SOURCES': sources,
  'EXE': exe_name,
  'CFLAGS_EXTRAS': "%s %s" % (stdflag, stdlibflag),
- 'FRAMEWORK_INCLUDES': "-F%s" % lib_dir,
- 'LD_EXTRAS': "%s -Wl,-rpath,%s" % (dsym, lib_dir),
+ 'FRAMEWORK_INCLUDES': "-F%s" % self.framework_dir,
+ 'LD_EXTRAS': "%s -Wl,-rpath,%s" % (self.dsym, self.framework_dir),
  }
-elif sys.platform.rstrip('0123456789') in ('freebsd', 'linux', 'netbsd') or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
+elif sys.platform.rstrip('0123456789') in ('freebsd', 'linux', 'netbsd', 'darwin') or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
 d = {
 'CXX_SOURCES': sources,
 'EXE': exe_name,
 'CFLAGS_EXTRAS': "%s %s -I%s" % (stdflag,
  stdlibflag,
  os.path.join(
  os.environ["LLDB_SRC"],
  "include")),
-'LD_EXTRAS': "-L%s -llldb" % lib_dir}
+'LD_EXTRAS': "-L%s/../lib -llldb -Wl,-rpath,%s/../lib" % (lib_dir, lib_dir)}
 elif sys.platform.startswith('win'):
   

[Lldb-commits] [PATCH] D25887: [Test Suite] Pull generateSource into lldbtest

2016-10-21 Thread Chris Bieneman via lldb-commits
beanz created this revision.
beanz added reviewers: tfiala, zturner.
beanz added a subscriber: lldb-commits.

Convert tests using LLDB headers to use generateSource to put the right include 
paths in place regardless of whether or not you're building a framework.

This also abstracted generateSource out of TestPublicAPIHeaders.py into 
lldbtest.py.


https://reviews.llvm.org/D25887

Files:
  
packages/Python/lldbsuite/test/api/check_public_api_headers/TestPublicAPIHeaders.py
  packages/Python/lldbsuite/test/api/multithreaded/TestMultithreaded.py
  packages/Python/lldbsuite/test/api/multithreaded/driver.cpp
  packages/Python/lldbsuite/test/api/multithreaded/driver.cpp.template
  packages/Python/lldbsuite/test/api/multithreaded/listener_test.cpp
  packages/Python/lldbsuite/test/api/multithreaded/listener_test.cpp.template
  packages/Python/lldbsuite/test/api/multithreaded/lldb-headers.h
  packages/Python/lldbsuite/test/api/multithreaded/test_breakpoint_callback.cpp
  
packages/Python/lldbsuite/test/api/multithreaded/test_breakpoint_callback.cpp.template
  
packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_description.cpp
  
packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_description.cpp.template
  
packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp
  
packages/Python/lldbsuite/test/api/multithreaded/test_listener_event_process_state.cpp.template
  packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp
  
packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp.template
  
packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
  packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp
  
packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template
  packages/Python/lldbsuite/test/lldbtest.py

Index: packages/Python/lldbsuite/test/lldbtest.py
===
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -1824,6 +1824,33 @@
 folder = os.path.dirname(folder)
 continue
 
+def generateSource(self, source):
+template = source + '.template'
+temp = os.path.join(os.getcwd(), template)
+with open(temp, 'r') as f:
+content = f.read()
+
+public_api_dir = os.path.join(
+os.environ["LLDB_SRC"], "include", "lldb", "API")
+
+# Look under the include/lldb/API directory and add #include statements
+# for all the SB API headers.
+public_headers = os.listdir(public_api_dir)
+# For different platforms, the include statement can vary.
+if self.hasDarwinFramework():
+include_stmt = "'#include <%s>' % os.path.join('LLDB', header)"
+else:
+include_stmt = "'#include <%s>' % os.path.join(public_api_dir, header)"
+list = [eval(include_stmt) for header in public_headers if (
+header.startswith("SB") and header.endswith(".h"))]
+includes = '\n'.join(list)
+new_content = content.replace('%include_SB_APIs%', includes)
+src = os.path.join(os.getcwd(), source)
+with open(src, 'w') as f:
+f.write(new_content)
+
+self.addTearDownHook(lambda: os.remove(src))
+
 def setUp(self):
 #import traceback
 # traceback.print_stack()
Index: packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template
===
--- packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template
+++ packages/Python/lldbsuite/test/functionalities/plugins/commands/plugin.cpp.template
@@ -13,15 +13,7 @@
 by typing plugin load foo.dylib at the LLDB command line
 */
 
-#if defined (__APPLE__)
-#include 
-#include 
-#include 
-#else
-#include 
-#include 
-#include 
-#endif
+%include_SB_APIs%
 
 namespace lldb {
 bool
Index: packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
===
--- packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
+++ packages/Python/lldbsuite/test/functionalities/plugins/commands/TestPluginCommands.py
@@ -18,6 +18,10 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
+def setUp(self):
+TestBase.setUp(self)
+self.generateSource('plugin.cpp')
+
 @skipIfNoSBHeaders
 # Requires a compatible arch and platform to link against the host's built
 # lldb lib.
Index: packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp.template
===
--- packages/Python/lldbsuite/test/api/multithreaded/test_listener_resume.cpp.template
+++ packages/Python/lldbsuite/test/api/multithreaded/test_li

[Lldb-commits] [PATCH] D25745: [CMake] Rename lldb-launcher to darwin-debug

2016-10-21 Thread Chris Bieneman via lldb-commits
beanz updated this revision to Diff 75507.
beanz added a comment.

Cleaning up extra references to lldb-launcher


https://reviews.llvm.org/D25745

Files:
  scripts/Python/finish-swig-Python-LLDB.sh
  scripts/Python/finishSwigPythonLLDB.py
  tools/darwin-debug/CMakeLists.txt


Index: tools/darwin-debug/CMakeLists.txt
===
--- tools/darwin-debug/CMakeLists.txt
+++ tools/darwin-debug/CMakeLists.txt
@@ -1,6 +1,6 @@
-add_lldb_executable(lldb-launcher INCLUDE_IN_FRAMEWORK
+add_lldb_executable(darwin-debug INCLUDE_IN_FRAMEWORK
   darwin-debug.cpp
   )
 
-install(TARGETS lldb-launcher
+install(TARGETS darwin-debug
   RUNTIME DESTINATION bin)
Index: scripts/Python/finishSwigPythonLLDB.py
===
--- scripts/Python/finishSwigPythonLLDB.py
+++ scripts/Python/finishSwigPythonLLDB.py
@@ -452,39 +452,6 @@
 return (bOk, strErrMsg)
 
 #++---
-# Details:  Make the symbolic link to the darwin-debug.
-# Args: vDictArgs   - (R) Program input parameters.
-#   vstrFrameworkPythonDir  - (R) Python framework directory.
-#   vstrDarwinDebugFileName - (R) File name for darwin-debug.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_darwin_debug(
-vDictArgs,
-vstrFrameworkPythonDir,
-vstrDarwinDebugFileName):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_darwin_debug()")
-bOk = True
-strErrMsg = ""
-strTarget = vstrDarwinDebugFileName
-strSrc = ""
-
-bMakeFileCalled = "-m" in vDictArgs
-if not bMakeFileCalled:
-return (bOk, strErrMsg)
-else:
-strSrc = os.path.join("bin", "lldb-launcher")
-
-bOk, strErrMsg = make_symlink(
-vDictArgs, vstrFrameworkPythonDir, strSrc, strTarget)
-
-return (bOk, strErrMsg)
-
-#++---
 # Details:  Make the symbolic link to the lldb-argdumper.
 # Args: vDictArgs   - (R) Program input parameters.
 #   vstrFrameworkPythonDir  - (R) Python framework directory.
@@ -550,13 +517,6 @@
   strLibLldbFileName,
   vstrLldbLibDir)
 
-# Make symlink for darwin-debug on Darwin
-strDarwinDebugFileName = "darwin-debug"
-if bOk and eOSType == utilsOsType.EnumOsType.Darwin:
-bOk, strErrMsg = make_symlink_darwin_debug(vDictArgs,
-   vstrFrameworkPythonDir,
-   strDarwinDebugFileName)
-
 # Make symlink for lldb-argdumper
 strArgdumperFileName = "lldb-argdumper"
 if bOk:
Index: scripts/Python/finish-swig-Python-LLDB.sh
===
--- scripts/Python/finish-swig-Python-LLDB.sh
+++ scripts/Python/finish-swig-Python-LLDB.sh
@@ -179,7 +179,6 @@
 echo "Creating symlink for darwin-debug"
 fi
 cd "${framework_python_dir}"
-ln -s "../../../../bin/lldb-launcher" darwin-debug
 else
 if [ $Debug -eq 1 ]
 then


Index: tools/darwin-debug/CMakeLists.txt
===
--- tools/darwin-debug/CMakeLists.txt
+++ tools/darwin-debug/CMakeLists.txt
@@ -1,6 +1,6 @@
-add_lldb_executable(lldb-launcher INCLUDE_IN_FRAMEWORK
+add_lldb_executable(darwin-debug INCLUDE_IN_FRAMEWORK
   darwin-debug.cpp
   )
 
-install(TARGETS lldb-launcher
+install(TARGETS darwin-debug
   RUNTIME DESTINATION bin)
Index: scripts/Python/finishSwigPythonLLDB.py
===
--- scripts/Python/finishSwigPythonLLDB.py
+++ scripts/Python/finishSwigPythonLLDB.py
@@ -452,39 +452,6 @@
 return (bOk, strErrMsg)
 
 #++---
-# Details:  Make the symbolic link to the darwin-debug.
-# Args: vDictArgs   - (R) Program input parameters.
-#   vstrFrameworkPythonDir  - (R) Python framework directory.
-#   vstrDarwinDebugFileName - (R) File name for darwin-debug.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_darwin_debug(
-vDictArgs,
-vstrFrameworkPythonDir,
-vstrDarwinDebugFileName):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_darwin_debug()")
-bOk = True
-strErrMsg = ""
-strTarget = vstrDarwinDebugFileName
-strSrc = ""
-
-bMakeFileCalled = "-m" in vDictArgs
-if not bMakeFileCalled:
-return (bOk, strErrMsg)
-else

[Lldb-commits] [lldb] r284900 - Add some additional logging to

2016-10-21 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Oct 21 18:45:07 2016
New Revision: 284900

URL: http://llvm.org/viewvc/llvm-project?rev=284900&view=rev
Log:
Add some additional logging to 
DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress to debug
corefiles that may not be correctly formed.

 

Modified:

lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=284900&r1=284899&r2=284900&view=diff
==
--- 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
 Fri Oct 21 18:45:07 2016
@@ -415,8 +415,14 @@ DynamicLoaderDarwinKernel::CheckForKerne
   return UUID();
 
 ObjectFile *exe_objfile = memory_module_sp->GetObjectFile();
-if (exe_objfile == NULL)
+if (exe_objfile == NULL) {
+  if (log)
+log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress "
+"found a binary at 0x%" PRIx64
+" but could not create an object file from memory",
+addr);
   return UUID();
+}
 
 if (exe_objfile->GetType() == ObjectFile::eTypeExecutable &&
 exe_objfile->GetStrata() == ObjectFile::eStrataKernel) {
@@ -425,10 +431,19 @@ DynamicLoaderDarwinKernel::CheckForKerne
   kernel_arch)) {
 process->GetTarget().SetArchitecture(kernel_arch);
   }
-  if (log)
-log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
-"kernel binary image found at 0x%" PRIx64,
-addr);
+  if (log) {
+std::string uuid_str;
+if (memory_module_sp->GetUUID().IsValid()) {
+  uuid_str = "with UUID ";
+  uuid_str += memory_module_sp->GetUUID().GetAsString();
+} else {
+  uuid_str = "and no LC_UUID found in load commands ";
+}
+log->Printf(
+"DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
+"kernel binary image found at 0x%" PRIx64 " with arch '%s' %s",
+addr, kernel_arch.GetTriple().str().c_str(), uuid_str.c_str());
+  }
   return memory_module_sp->GetUUID();
 }
   }


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


[Lldb-commits] [PATCH] D25886: [Test Suite] Properly respect --framework option

2016-10-21 Thread Zachary Turner via lldb-commits
zturner added a comment.

Maybe put that function `lldbplatformutil`?


https://reviews.llvm.org/D25886



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


[Lldb-commits] LLVM buildmaster will be updated and restarted tonight

2016-10-21 Thread Galina Kistanova via lldb-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 7 PM Pacific time
today.

Thanks

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


[Lldb-commits] [PATCH] D25887: [Test Suite] Pull generateSource into lldbtest

2016-10-21 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D25887



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


[Lldb-commits] [PATCH] D25886: [Test Suite] Properly respect --framework option

2016-10-21 Thread Todd Fiala via lldb-commits
tfiala accepted this revision.
tfiala added a comment.
This revision is now accepted and ready to land.

Looks good.

I do wonder if we should have a general helper for lines like this:

  sys.platform.rstrip('0123456789') in ('freebsd', 'linux', 'netbsd', 'darwin')

but that doesn't have to be looked at here.


https://reviews.llvm.org/D25886



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