[Lldb-commits] [PATCH] D25362: Fix build failure on lldb-amd64-ninja-freebsd11 error caused by rL283474

2016-10-07 Thread Valentina Giusti via lldb-commits
valentinagiusti created this revision.
valentinagiusti added reviewers: zturner, labath.
valentinagiusti added subscribers: lldb-commits, emaste.

https://reviews.llvm.org/D25362

Files:
  source/Plugins/Process/POSIX/CrashReason.cpp
  source/Plugins/Process/POSIX/CrashReason.h


Index: source/Plugins/Process/POSIX/CrashReason.h
===
--- source/Plugins/Process/POSIX/CrashReason.h
+++ source/Plugins/Process/POSIX/CrashReason.h
@@ -50,6 +50,7 @@
   eFloatSubscriptRange
 };
 
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info);
 
 const char *CrashReasonAsString(CrashReason reason);
Index: source/Plugins/Process/POSIX/CrashReason.cpp
===
--- source/Plugins/Process/POSIX/CrashReason.cpp
+++ source/Plugins/Process/POSIX/CrashReason.cpp
@@ -136,27 +136,40 @@
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
   std::string str;
 
+  if (reason == CrashReason::eBoundViolation) {
+// make sure that siginfo_t has the bound fields available.
+#if defined(si_lower) && defined(si_upper)
+str = "signal SIGSEGV";
+AppendBounds(str, reinterpret_cast(info.si_lower),
+ reinterpret_cast(info.si_upper),
+ reinterpret_cast(info.si_addr));
+#else
+str = GetCrashReasonString(reason, 
reinterpret_cast(info.si_addr));
+#endif
+  } else {
+str = GetCrashReasonString(reason, 
reinterpret_cast(info.si_addr));
+  }
+  return str;
+}
+
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
+  std::string str;
+
   switch (reason) {
   default:
 assert(false && "invalid CrashReason");
 break;
 
   case CrashReason::eInvalidAddress:
 str = "signal SIGSEGV: invalid address";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::ePrivilegedAddress:
 str = "signal SIGSEGV: address access protected";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::eBoundViolation:
-str = "signal SIGSEGV";
-// Make sure that siginfo_t has the bound fields available.
-#if defined(si_lower) && defined(si_upper)
-AppendBounds(str, reinterpret_cast(info.si_lower),
- reinterpret_cast(info.si_upper),
- reinterpret_cast(info.si_addr));
-#endif
+str = "signal SIGSEGV: bound violation";
 break;
   case CrashReason::eIllegalOpcode:
 str = "signal SIGILL: illegal instruction";


Index: source/Plugins/Process/POSIX/CrashReason.h
===
--- source/Plugins/Process/POSIX/CrashReason.h
+++ source/Plugins/Process/POSIX/CrashReason.h
@@ -50,6 +50,7 @@
   eFloatSubscriptRange
 };
 
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info);
 
 const char *CrashReasonAsString(CrashReason reason);
Index: source/Plugins/Process/POSIX/CrashReason.cpp
===
--- source/Plugins/Process/POSIX/CrashReason.cpp
+++ source/Plugins/Process/POSIX/CrashReason.cpp
@@ -136,27 +136,40 @@
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
   std::string str;
 
+  if (reason == CrashReason::eBoundViolation) {
+// make sure that siginfo_t has the bound fields available.
+#if defined(si_lower) && defined(si_upper)
+str = "signal SIGSEGV";
+AppendBounds(str, reinterpret_cast(info.si_lower),
+ reinterpret_cast(info.si_upper),
+ reinterpret_cast(info.si_addr));
+#else
+str = GetCrashReasonString(reason, reinterpret_cast(info.si_addr));
+#endif
+  } else {
+str = GetCrashReasonString(reason, reinterpret_cast(info.si_addr));
+  }
+  return str;
+}
+
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
+  std::string str;
+
   switch (reason) {
   default:
 assert(false && "invalid CrashReason");
 break;
 
   case CrashReason::eInvalidAddress:
 str = "signal SIGSEGV: invalid address";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::ePrivilegedAddress:
 str = "signal SIGSEGV: address access protected";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::eBoundViolation:
-str = "signal SIGSEGV";
-// Make sure that siginfo_t has the bound fields available.
-#if defined(si_lower) && defined(si_upper)
-AppendBounds(str, reinterpret_cast(info.si_lower),
- reinterpret_cast(info.si_upper),
- reint

[Lldb-commits] [PATCH] D25362: Fix build failure on lldb-amd64-ninja-freebsd11 error caused by rL283474

2016-10-07 Thread Valentina Giusti via lldb-commits
valentinagiusti updated this revision to Diff 73907.
valentinagiusti added a comment.

applied clang-format


https://reviews.llvm.org/D25362

Files:
  source/Plugins/Process/POSIX/CrashReason.cpp
  source/Plugins/Process/POSIX/CrashReason.h


Index: source/Plugins/Process/POSIX/CrashReason.h
===
--- source/Plugins/Process/POSIX/CrashReason.h
+++ source/Plugins/Process/POSIX/CrashReason.h
@@ -50,6 +50,7 @@
   eFloatSubscriptRange
 };
 
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info);
 
 const char *CrashReasonAsString(CrashReason reason);
Index: source/Plugins/Process/POSIX/CrashReason.cpp
===
--- source/Plugins/Process/POSIX/CrashReason.cpp
+++ source/Plugins/Process/POSIX/CrashReason.cpp
@@ -136,27 +136,42 @@
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
   std::string str;
 
+  if (reason == CrashReason::eBoundViolation) {
+// make sure that siginfo_t has the bound fields available.
+#if defined(si_lower) && defined(si_upper)
+str = "signal SIGSEGV";
+AppendBounds(str, reinterpret_cast(info.si_lower),
+ reinterpret_cast(info.si_upper),
+ reinterpret_cast(info.si_addr));
+#else
+str = GetCrashReasonString(reason,
+   reinterpret_cast(info.si_addr));
+#endif
+  } else {
+str = GetCrashReasonString(reason,
+   reinterpret_cast(info.si_addr));
+  }
+  return str;
+}
+
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
+  std::string str;
+
   switch (reason) {
   default:
 assert(false && "invalid CrashReason");
 break;
 
   case CrashReason::eInvalidAddress:
 str = "signal SIGSEGV: invalid address";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::ePrivilegedAddress:
 str = "signal SIGSEGV: address access protected";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::eBoundViolation:
-str = "signal SIGSEGV";
-// Make sure that siginfo_t has the bound fields available.
-#if defined(si_lower) && defined(si_upper)
-AppendBounds(str, reinterpret_cast(info.si_lower),
- reinterpret_cast(info.si_upper),
- reinterpret_cast(info.si_addr));
-#endif
+str = "signal SIGSEGV: bound violation";
 break;
   case CrashReason::eIllegalOpcode:
 str = "signal SIGILL: illegal instruction";


Index: source/Plugins/Process/POSIX/CrashReason.h
===
--- source/Plugins/Process/POSIX/CrashReason.h
+++ source/Plugins/Process/POSIX/CrashReason.h
@@ -50,6 +50,7 @@
   eFloatSubscriptRange
 };
 
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info);
 
 const char *CrashReasonAsString(CrashReason reason);
Index: source/Plugins/Process/POSIX/CrashReason.cpp
===
--- source/Plugins/Process/POSIX/CrashReason.cpp
+++ source/Plugins/Process/POSIX/CrashReason.cpp
@@ -136,27 +136,42 @@
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
   std::string str;
 
+  if (reason == CrashReason::eBoundViolation) {
+// make sure that siginfo_t has the bound fields available.
+#if defined(si_lower) && defined(si_upper)
+str = "signal SIGSEGV";
+AppendBounds(str, reinterpret_cast(info.si_lower),
+ reinterpret_cast(info.si_upper),
+ reinterpret_cast(info.si_addr));
+#else
+str = GetCrashReasonString(reason,
+   reinterpret_cast(info.si_addr));
+#endif
+  } else {
+str = GetCrashReasonString(reason,
+   reinterpret_cast(info.si_addr));
+  }
+  return str;
+}
+
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
+  std::string str;
+
   switch (reason) {
   default:
 assert(false && "invalid CrashReason");
 break;
 
   case CrashReason::eInvalidAddress:
 str = "signal SIGSEGV: invalid address";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::ePrivilegedAddress:
 str = "signal SIGSEGV: address access protected";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::eBoundViolation:
-str = "signal SIGSEGV";
-// Make sure that siginfo_t has the bound fields available.
-#if defined(si_lower) && defined(si_upper)
-AppendBounds(str, reinterpret_cast(info.si_lower),
-

[Lldb-commits] [PATCH] D25362: Fix build failure on lldb-amd64-ninja-freebsd11 error caused by rL283474

2016-10-07 Thread Valentina Giusti via lldb-commits
valentinagiusti updated this revision to Diff 73909.
valentinagiusti added a comment.

cleaned up code


https://reviews.llvm.org/D25362

Files:
  source/Plugins/Process/POSIX/CrashReason.cpp
  source/Plugins/Process/POSIX/CrashReason.h


Index: source/Plugins/Process/POSIX/CrashReason.h
===
--- source/Plugins/Process/POSIX/CrashReason.h
+++ source/Plugins/Process/POSIX/CrashReason.h
@@ -50,6 +50,7 @@
   eFloatSubscriptRange
 };
 
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info);
 
 const char *CrashReasonAsString(CrashReason reason);
Index: source/Plugins/Process/POSIX/CrashReason.cpp
===
--- source/Plugins/Process/POSIX/CrashReason.cpp
+++ source/Plugins/Process/POSIX/CrashReason.cpp
@@ -136,27 +136,39 @@
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
   std::string str;
 
+// make sure that siginfo_t has the bound fields available.
+#if defined(si_lower) && defined(si_upper)
+  if (reason == CrashReason::eBoundViolation) {
+str = "signal SIGSEGV";
+AppendBounds(str, reinterpret_cast(info.si_lower),
+ reinterpret_cast(info.si_upper),
+ reinterpret_cast(info.si_addr));
+return str;
+  }
+#endif
+
+  return GetCrashReasonString(reason,
+  reinterpret_cast(info.si_addr));
+}
+
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
+  std::string str;
+
   switch (reason) {
   default:
 assert(false && "invalid CrashReason");
 break;
 
   case CrashReason::eInvalidAddress:
 str = "signal SIGSEGV: invalid address";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::ePrivilegedAddress:
 str = "signal SIGSEGV: address access protected";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::eBoundViolation:
-str = "signal SIGSEGV";
-// Make sure that siginfo_t has the bound fields available.
-#if defined(si_lower) && defined(si_upper)
-AppendBounds(str, reinterpret_cast(info.si_lower),
- reinterpret_cast(info.si_upper),
- reinterpret_cast(info.si_addr));
-#endif
+str = "signal SIGSEGV: bound violation";
 break;
   case CrashReason::eIllegalOpcode:
 str = "signal SIGILL: illegal instruction";


Index: source/Plugins/Process/POSIX/CrashReason.h
===
--- source/Plugins/Process/POSIX/CrashReason.h
+++ source/Plugins/Process/POSIX/CrashReason.h
@@ -50,6 +50,7 @@
   eFloatSubscriptRange
 };
 
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info);
 
 const char *CrashReasonAsString(CrashReason reason);
Index: source/Plugins/Process/POSIX/CrashReason.cpp
===
--- source/Plugins/Process/POSIX/CrashReason.cpp
+++ source/Plugins/Process/POSIX/CrashReason.cpp
@@ -136,27 +136,39 @@
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
   std::string str;
 
+// make sure that siginfo_t has the bound fields available.
+#if defined(si_lower) && defined(si_upper)
+  if (reason == CrashReason::eBoundViolation) {
+str = "signal SIGSEGV";
+AppendBounds(str, reinterpret_cast(info.si_lower),
+ reinterpret_cast(info.si_upper),
+ reinterpret_cast(info.si_addr));
+return str;
+  }
+#endif
+
+  return GetCrashReasonString(reason,
+  reinterpret_cast(info.si_addr));
+}
+
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
+  std::string str;
+
   switch (reason) {
   default:
 assert(false && "invalid CrashReason");
 break;
 
   case CrashReason::eInvalidAddress:
 str = "signal SIGSEGV: invalid address";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::ePrivilegedAddress:
 str = "signal SIGSEGV: address access protected";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::eBoundViolation:
-str = "signal SIGSEGV";
-// Make sure that siginfo_t has the bound fields available.
-#if defined(si_lower) && defined(si_upper)
-AppendBounds(str, reinterpret_cast(info.si_lower),
- reinterpret_cast(info.si_upper),
- reinterpret_cast(info.si_addr));
-#endif
+str = "signal SIGSEGV: bound violation";
 break;
   case CrashReason::eIllegalOpcode:
 str = "signal SIGILL: illegal instructio

[Lldb-commits] [PATCH] D25362: Fix build failure on lldb-amd64-ninja-freebsd11 error caused by rL283474

2016-10-07 Thread Ed Maste via lldb-commits
emaste accepted this revision.
emaste added a reviewer: emaste.
emaste added a comment.
This revision is now accepted and ready to land.

Not tested, but looks reasonable to me.

I think we should avoid `siginfo_t` altogether here in order to support 
cross-debugging, but that's for a different change.


https://reviews.llvm.org/D25362



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


[Lldb-commits] [lldb] r283548 - Fix build failure on lldb-amd64-ninja-freebsd11 error caused by rL283474

2016-10-07 Thread Valentina Giusti via lldb-commits
Author: valentinagiusti
Date: Fri Oct  7 08:21:59 2016
New Revision: 283548

URL: http://llvm.org/viewvc/llvm-project?rev=283548&view=rev
Log:
Fix build failure on lldb-amd64-ninja-freebsd11 error caused by rL283474

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

Modified:
lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp
lldb/trunk/source/Plugins/Process/POSIX/CrashReason.h

Modified: lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp?rev=283548&r1=283547&r2=283548&view=diff
==
--- lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp Fri Oct  7 08:21:59 
2016
@@ -136,6 +136,24 @@ CrashReason GetCrashReasonForSIGBUS(cons
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
   std::string str;
 
+// make sure that siginfo_t has the bound fields available.
+#if defined(si_lower) && defined(si_upper)
+  if (reason == CrashReason::eBoundViolation) {
+str = "signal SIGSEGV";
+AppendBounds(str, reinterpret_cast(info.si_lower),
+ reinterpret_cast(info.si_upper),
+ reinterpret_cast(info.si_addr));
+return str;
+  }
+#endif
+
+  return GetCrashReasonString(reason,
+  reinterpret_cast(info.si_addr));
+}
+
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
+  std::string str;
+
   switch (reason) {
   default:
 assert(false && "invalid CrashReason");
@@ -143,20 +161,14 @@ std::string GetCrashReasonString(CrashRe
 
   case CrashReason::eInvalidAddress:
 str = "signal SIGSEGV: invalid address";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::ePrivilegedAddress:
 str = "signal SIGSEGV: address access protected";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::eBoundViolation:
-str = "signal SIGSEGV";
-// Make sure that siginfo_t has the bound fields available.
-#if defined(si_lower) && defined(si_upper)
-AppendBounds(str, reinterpret_cast(info.si_lower),
- reinterpret_cast(info.si_upper),
- reinterpret_cast(info.si_addr));
-#endif
+str = "signal SIGSEGV: bound violation";
 break;
   case CrashReason::eIllegalOpcode:
 str = "signal SIGILL: illegal instruction";

Modified: lldb/trunk/source/Plugins/Process/POSIX/CrashReason.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/CrashReason.h?rev=283548&r1=283547&r2=283548&view=diff
==
--- lldb/trunk/source/Plugins/Process/POSIX/CrashReason.h (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/CrashReason.h Fri Oct  7 08:21:59 
2016
@@ -50,6 +50,7 @@ enum class CrashReason {
   eFloatSubscriptRange
 };
 
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info);
 
 const char *CrashReasonAsString(CrashReason reason);


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


[Lldb-commits] [PATCH] D25362: Fix build failure on lldb-amd64-ninja-freebsd11 error caused by rL283474

2016-10-07 Thread Valentina Giusti via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL283548: Fix build failure on lldb-amd64-ninja-freebsd11 
error caused by rL283474 (authored by valentinagiusti).

Changed prior to commit:
  https://reviews.llvm.org/D25362?vs=73909&id=73945#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25362

Files:
  lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp
  lldb/trunk/source/Plugins/Process/POSIX/CrashReason.h


Index: lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp
===
--- lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp
+++ lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp
@@ -136,27 +136,39 @@
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
   std::string str;
 
+// make sure that siginfo_t has the bound fields available.
+#if defined(si_lower) && defined(si_upper)
+  if (reason == CrashReason::eBoundViolation) {
+str = "signal SIGSEGV";
+AppendBounds(str, reinterpret_cast(info.si_lower),
+ reinterpret_cast(info.si_upper),
+ reinterpret_cast(info.si_addr));
+return str;
+  }
+#endif
+
+  return GetCrashReasonString(reason,
+  reinterpret_cast(info.si_addr));
+}
+
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
+  std::string str;
+
   switch (reason) {
   default:
 assert(false && "invalid CrashReason");
 break;
 
   case CrashReason::eInvalidAddress:
 str = "signal SIGSEGV: invalid address";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::ePrivilegedAddress:
 str = "signal SIGSEGV: address access protected";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::eBoundViolation:
-str = "signal SIGSEGV";
-// Make sure that siginfo_t has the bound fields available.
-#if defined(si_lower) && defined(si_upper)
-AppendBounds(str, reinterpret_cast(info.si_lower),
- reinterpret_cast(info.si_upper),
- reinterpret_cast(info.si_addr));
-#endif
+str = "signal SIGSEGV: bound violation";
 break;
   case CrashReason::eIllegalOpcode:
 str = "signal SIGILL: illegal instruction";
Index: lldb/trunk/source/Plugins/Process/POSIX/CrashReason.h
===
--- lldb/trunk/source/Plugins/Process/POSIX/CrashReason.h
+++ lldb/trunk/source/Plugins/Process/POSIX/CrashReason.h
@@ -50,6 +50,7 @@
   eFloatSubscriptRange
 };
 
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr);
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info);
 
 const char *CrashReasonAsString(CrashReason reason);


Index: lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp
===
--- lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp
+++ lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp
@@ -136,27 +136,39 @@
 std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info) {
   std::string str;
 
+// make sure that siginfo_t has the bound fields available.
+#if defined(si_lower) && defined(si_upper)
+  if (reason == CrashReason::eBoundViolation) {
+str = "signal SIGSEGV";
+AppendBounds(str, reinterpret_cast(info.si_lower),
+ reinterpret_cast(info.si_upper),
+ reinterpret_cast(info.si_addr));
+return str;
+  }
+#endif
+
+  return GetCrashReasonString(reason,
+  reinterpret_cast(info.si_addr));
+}
+
+std::string GetCrashReasonString(CrashReason reason, lldb::addr_t fault_addr) {
+  std::string str;
+
   switch (reason) {
   default:
 assert(false && "invalid CrashReason");
 break;
 
   case CrashReason::eInvalidAddress:
 str = "signal SIGSEGV: invalid address";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::ePrivilegedAddress:
 str = "signal SIGSEGV: address access protected";
-AppendFaultAddr(str, reinterpret_cast(info.si_addr));
+AppendFaultAddr(str, fault_addr);
 break;
   case CrashReason::eBoundViolation:
-str = "signal SIGSEGV";
-// Make sure that siginfo_t has the bound fields available.
-#if defined(si_lower) && defined(si_upper)
-AppendBounds(str, reinterpret_cast(info.si_lower),
- reinterpret_cast(info.si_upper),
- reinterpret_cast(info.si_addr));
-#endif
+str = "signal SIGSEGV: bound violation";
 break;
   case CrashReason::eIllegalOpcode:
 str = "signal SIGILL: illegal instruction";
Index: lldb/trunk/source/Plugins/Process/POSIX/CrashReason.h
===
--- lldb/trun

[Lldb-commits] [lldb] r283578 - The PR that caused this test ot fail was fixed in July, removing the XFAIL.

2016-10-07 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Oct  7 13:15:11 2016
New Revision: 283578

URL: http://llvm.org/viewvc/llvm-project?rev=283578&view=rev
Log:
The PR that caused this test ot fail was fixed in July, removing the XFAIL.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py?rev=283578&r1=283577&r2=283578&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
 Fri Oct  7 13:15:11 2016
@@ -10,7 +10,6 @@ class TestWithGmodulesDebugInfo(TestBase
 mydir = TestBase.compute_mydir(__file__)
 
 @add_test_categories(["gmodules"])
-@expectedFailureAll(oslist=["macosx"], bugnumber="llvm.org/pr28156")
 def test_specialized_typedef_from_pch(self):
 self.build()
 cwd = os.getcwd()


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


[Lldb-commits] [lldb] r283603 - Remove unused variable.

2016-10-07 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Oct  7 16:23:31 2016
New Revision: 283603

URL: http://llvm.org/viewvc/llvm-project?rev=283603&view=rev
Log:
Remove unused variable.

Modified:
lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp

Modified: lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp?rev=283603&r1=283602&r2=283603&view=diff
==
--- lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp Fri Oct  7 
16:23:31 2016
@@ -118,7 +118,6 @@ size_t OptionValueEnumeration::AutoCompl
 
   const uint32_t num_enumerators = m_enumerations.GetSize();
   if (s && s[0]) {
-const size_t s_len = strlen(s);
 for (size_t i = 0; i < num_enumerators; ++i) {
   llvm::StringRef name = m_enumerations.GetCStringAtIndex(i);
   if (name.startswith(s))


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


[Lldb-commits] [lldb] r283604 - Remove a stray dump().

2016-10-07 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Fri Oct  7 16:25:29 2016
New Revision: 283604

URL: http://llvm.org/viewvc/llvm-project?rev=283604&view=rev
Log:
Remove a stray dump().



Modified:
lldb/trunk/source/Expression/IRExecutionUnit.cpp

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=283604&r1=283603&r2=283604&view=diff
==
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Fri Oct  7 16:25:29 2016
@@ -1023,8 +1023,6 @@ void IRExecutionUnit::GetStaticInitializ
  3); // this is standardized
   if (llvm::Function *ctor_function =
   llvm::dyn_cast(ctor_struct->getOperand(1))) {
-ctor_function->dump();
-
 ConstString ctor_function_name_cs(ctor_function->getName().str());
 
 for (JittedFunction &jitted_function : m_jitted_functions) {


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


[Lldb-commits] [lldb] r283607 - Fix a few warnings caught by clang.

2016-10-07 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Oct  7 16:32:16 2016
New Revision: 283607

URL: http://llvm.org/viewvc/llvm-project?rev=283607&view=rev
Log:
Fix a few warnings caught by clang.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=283607&r1=283606&r2=283607&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Fri Oct  
7 16:32:16 2016
@@ -4081,7 +4081,7 @@ bool DWARFASTParserClang::CopyUniqueClas
   if (log)
 log->Printf("warning: need to create artificial method for 0x%8.8x for 
"
 "method '%s'",
-dst_die.GetOffset(), dst_name_artificial);
+dst_die.GetOffset(), dst_name_artificial.str().c_str());
 
   failures.Append(dst_die);
 }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp?rev=283607&r1=283606&r2=283607&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp Fri Oct  7 
16:32:16 2016
@@ -58,7 +58,7 @@ void NameToDIE::Dump(Stream *s) {
 llvm::StringRef cstr = m_map.GetCStringAtIndex(i);
 const DIERef &die_ref = m_map.GetValueAtIndexUnchecked(i);
 s->Printf("%p: {0x%8.8x/0x%8.8x} \"%s\"\n", (const void *)cstr.data(),
-  die_ref.cu_offset, die_ref.die_offset, cstr);
+  die_ref.cu_offset, die_ref.die_offset, cstr.str().c_str());
   }
 }
 


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


[Lldb-commits] [lldb] r283652 - Fix compiler warnings in TestClangASTContext.cpp

2016-10-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Oct  7 23:03:19 2016
New Revision: 283652

URL: http://llvm.org/viewvc/llvm-project?rev=283652&view=rev
Log:
Fix compiler warnings in TestClangASTContext.cpp

Modified:
lldb/trunk/unittests/Symbol/TestClangASTContext.cpp

Modified: lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Symbol/TestClangASTContext.cpp?rev=283652&r1=283651&r2=283652&view=diff
==
--- lldb/trunk/unittests/Symbol/TestClangASTContext.cpp (original)
+++ lldb/trunk/unittests/Symbol/TestClangASTContext.cpp Fri Oct  7 23:03:19 2016
@@ -163,7 +163,7 @@ TEST_F(TestClangASTContext, TestGetBasic
 }
 
 void VerifyEncodingAndBitSize(clang::ASTContext *context,
-  lldb::Encoding encoding, int bit_size) {
+  lldb::Encoding encoding, unsigned int bit_size) {
   CompilerType type = ClangASTContext::GetBuiltinTypeForEncodingAndBitSize(
   context, encoding, bit_size);
   EXPECT_TRUE(type.IsValid());
@@ -244,15 +244,15 @@ TEST_F(TestClangASTContext, TestRemoveFa
   QualType qt;
 
   qt = ClangUtil::GetQualType(record_type);
-  EXPECT_EQ(0, qt.getLocalFastQualifiers());
+  EXPECT_EQ(0u, qt.getLocalFastQualifiers());
   record_type = record_type.AddConstModifier();
   record_type = record_type.AddVolatileModifier();
   record_type = record_type.AddRestrictModifier();
   qt = ClangUtil::GetQualType(record_type);
-  EXPECT_NE(0, qt.getLocalFastQualifiers());
+  EXPECT_NE(0u, qt.getLocalFastQualifiers());
   record_type = ClangUtil::RemoveFastQualifiers(record_type);
   qt = ClangUtil::GetQualType(record_type);
-  EXPECT_EQ(0, qt.getLocalFastQualifiers());
+  EXPECT_EQ(0u, qt.getLocalFastQualifiers());
 }
 
 TEST_F(TestClangASTContext, TestConvertAccessTypeToAccessSpecifier) {
@@ -350,7 +350,7 @@ TEST_F(TestClangASTContext, TestRecordHa
   m_ast->GetAsCXXRecordDecl(empty_derived.GetOpaqueQualType());
   RecordDecl *empty_derived_non_empty_base_decl =
   ClangASTContext::GetAsRecordDecl(empty_derived);
-  EXPECT_EQ(1, ClangASTContext::GetNumBaseClasses(
+  EXPECT_EQ(1u, ClangASTContext::GetNumBaseClasses(
empty_derived_non_empty_base_cxx_decl, false));
   EXPECT_TRUE(
   ClangASTContext::RecordHasFields(empty_derived_non_empty_base_decl));
@@ -371,7 +371,7 @@ TEST_F(TestClangASTContext, TestRecordHa
   m_ast->GetAsCXXRecordDecl(empty_derived2.GetOpaqueQualType());
   RecordDecl *empty_derived_non_empty_vbase_decl =
   ClangASTContext::GetAsRecordDecl(empty_derived2);
-  EXPECT_EQ(1, ClangASTContext::GetNumBaseClasses(
+  EXPECT_EQ(1u, ClangASTContext::GetNumBaseClasses(
empty_derived_non_empty_vbase_cxx_decl, false));
   EXPECT_TRUE(
   ClangASTContext::RecordHasFields(empty_derived_non_empty_vbase_decl));


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


[Lldb-commits] [lldb] r283651 - Fix compiler warnings in PlatformDarwinTest.cpp

2016-10-07 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Oct  7 23:03:15 2016
New Revision: 283651

URL: http://llvm.org/viewvc/llvm-project?rev=283651&view=rev
Log:
Fix compiler warnings in PlatformDarwinTest.cpp

Modified:
lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp

Modified: lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp?rev=283651&r1=283650&r2=283651&view=diff
==
--- lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp (original)
+++ lldb/trunk/unittests/Platform/PlatformDarwinTest.cpp Fri Oct  7 23:03:15 
2016
@@ -23,34 +23,34 @@ TEST(PlatformDarwinTest, TestParseVersio
   llvm::StringRef D;
 
   std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("1.2.3 (test1)");
-  EXPECT_EQ(1, A);
-  EXPECT_EQ(2, B);
-  EXPECT_EQ(3, C);
+  EXPECT_EQ(1u, A);
+  EXPECT_EQ(2u, B);
+  EXPECT_EQ(3u, C);
   EXPECT_EQ("test1", D);
 
   std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("2.3 (test2)");
-  EXPECT_EQ(2, A);
-  EXPECT_EQ(3, B);
+  EXPECT_EQ(2u, A);
+  EXPECT_EQ(3u, B);
   EXPECT_EQ("test2", D);
 
   std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("3 (test3)");
-  EXPECT_EQ(3, A);
+  EXPECT_EQ(3u, A);
   EXPECT_EQ("test3", D);
 
   std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("1.2.3 (test");
-  EXPECT_EQ(1, A);
-  EXPECT_EQ(2, B);
-  EXPECT_EQ(3, C);
+  EXPECT_EQ(1u, A);
+  EXPECT_EQ(2u, B);
+  EXPECT_EQ(3u, C);
   EXPECT_EQ("test", D);
 
   std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("2.3.4 test");
-  EXPECT_EQ(2, A);
-  EXPECT_EQ(3, B);
-  EXPECT_EQ(4, C);
+  EXPECT_EQ(2u, A);
+  EXPECT_EQ(3u, B);
+  EXPECT_EQ(4u, C);
   EXPECT_EQ("", D);
 
   std::tie(A, B, C, D) = PlatformDarwin::ParseVersionBuildDir("3.4.5");
-  EXPECT_EQ(3, A);
-  EXPECT_EQ(4, B);
-  EXPECT_EQ(5, C);
-}
\ No newline at end of file
+  EXPECT_EQ(3u, A);
+  EXPECT_EQ(4u, B);
+  EXPECT_EQ(5u, C);
+}


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


[Lldb-commits] [PATCH] D25391: Remove usages of TimeValue from gdb-remote process plugin

2016-10-07 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: clayborg, zturner.
labath added a subscriber: lldb-commits.

Most of the changes are very straight-forward, the only tricky part was the
"packet speed-test" function, which is very time-heavy. As the function was
completely untested, I added a quick unit smoke test for it.


https://reviews.llvm.org/D25391

Files:
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Index: unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -20,12 +20,14 @@
 #include "Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h"
 #include "lldb/Core/DataBuffer.h"
 #include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/StructuredData.h"
 
 #include "llvm/ADT/ArrayRef.h"
 
 using namespace lldb_private::process_gdb_remote;
 using namespace lldb_private;
 using namespace lldb;
+using namespace llvm;
 
 namespace {
 
@@ -45,8 +47,7 @@
 ASSERT_EQ(PacketResult::Success, server.SendUnimplementedResponse(nullptr));
 }
 
-void HandlePacket(MockServer &server, llvm::StringRef expected,
-  llvm::StringRef response) {
+void HandlePacket(MockServer &server, StringRef expected, StringRef response) {
   StringExtractorGDBRemote request;
   ASSERT_EQ(PacketResult::Success, server.GetPacket(request));
   ASSERT_EQ(expected, request.GetStringRef());
@@ -260,3 +261,45 @@
 ASSERT_FALSE(async_result.get().hasValue()) << "response was: " << response;
   }
 }
+
+TEST_F(GDBRemoteCommunicationClientTest, TestPacketSpeedJSON) {
+  TestClient client;
+  MockServer server;
+  Connect(client, server);
+  if (HasFailure())
+return;
+
+  std::thread server_thread([&server] {
+StringExtractorGDBRemote request;
+PacketResult result = server.GetPacket(request);
+if (result == PacketResult::ErrorDisconnected)
+  return;
+ASSERT_EQ(PacketResult::Success, result);
+StringRef ref = request.GetStringRef();
+ASSERT_TRUE(ref.consume_front("qSpeedTest:response_size:"));
+int size;
+ASSERT_FALSE(ref.consumeInteger(10, size)) << "ref: " << ref;
+std::string response(size, 'X');
+ASSERT_EQ(PacketResult::Success, server.SendPacket(response));
+  });
+
+  StreamString ss;
+  client.TestPacketSpeed(10, 32, 32, true, ss);
+  client.Disconnect();
+  server_thread.join();
+
+  auto object_sp = StructuredData::ParseJSON(ss.GetString());
+  ASSERT_TRUE(bool(object_sp));
+  auto dict_sp = object_sp->GetAsDictionary();
+  ASSERT_TRUE(bool(dict_sp));
+
+  object_sp = dict_sp->GetValueForKey("packet_speeds");
+  ASSERT_TRUE(bool(object_sp));
+  dict_sp = object_sp->GetAsDictionary();
+  ASSERT_TRUE(bool(dict_sp));
+
+  int num_packets;
+  ASSERT_TRUE(dict_sp->GetValueForKeyAsInteger("num_packets", num_packets))
+  << ss.GetString();
+  ASSERT_EQ(10, num_packets);
+}
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -46,7 +46,6 @@
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Host/Symbols.h"
 #include "lldb/Host/ThreadLauncher.h"
-#include "lldb/Host/TimeValue.h"
 #include "lldb/Host/XML.h"
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
@@ -289,7 +288,7 @@
   const uint64_t timeout_seconds =
   GetGlobalPluginProperties()->GetPacketTimeout();
   if (timeout_seconds > 0)
-m_gdb_comm.SetPacketTimeout(timeout_seconds);
+m_gdb_comm.SetPacketTimeout(std::chrono::seconds(timeout_seconds));
 }
 
 //--
@@ -424,9 +423,9 @@
   // Check if qHostInfo specified a specific packet timeout for this connection.
   // If so then lets update our setting so the user knows what the timeout is
   // and can see it.
-  const uint32_t host_packet_timeout = m_gdb_comm.GetHostDefaultPacketTimeout();
-  if (host_packet_timeout) {
-GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout);
+  const auto host_packet_timeout = m_gdb_comm.GetHostDefaultPacketTimeout();
+  if (host_packet_timeout > std::chrono::seconds(0)) {
+GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout.count());
   }
 

[Lldb-commits] [PATCH] D25392: Remove TimeValue usage from FileSpec.h

2016-10-07 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: clayborg, zturner.
labath added a subscriber: lldb-commits.
Herald added subscribers: mgorny, beanz, danalbert, tberghammer.

The only usage there was in GetModificationTime(). I also took the opportunity
to move this function from FileSpec to the FileSystem class - since we are
using FileSpecs to also represent remote files for which we cannot (easily)
retrieve modification time, it makes sense to make the decision to get the
modification time more explicit.

The new function returns a std::duration::time_point. To aid the transition
from TimeValue, I have added a constructor to it which enables implicit
conversion from a time_point.


https://reviews.llvm.org/D25392

Files:
  include/lldb/Core/ModuleSpec.h
  include/lldb/Core/SourceManager.h
  include/lldb/Host/FileSpec.h
  include/lldb/Host/FileSystem.h
  include/lldb/Host/TimeValue.h
  include/lldb/Interpreter/OptionValueFileSpec.h
  source/Core/Module.cpp
  source/Core/ModuleList.cpp
  source/Core/SourceManager.cpp
  source/Host/common/FileSpec.cpp
  source/Host/common/FileSystem.cpp
  source/Interpreter/OptionValueFileSpec.cpp
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  source/Plugins/Platform/Android/AdbClient.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  unittests/Host/CMakeLists.txt
  unittests/Host/FileSystemTest.cpp

Index: unittests/Host/FileSystemTest.cpp
===
--- /dev/null
+++ unittests/Host/FileSystemTest.cpp
@@ -0,0 +1,32 @@
+//===-- FileSystemTest.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "lldb/Host/FileSystem.h"
+
+extern const char *TestMainArgv0;
+
+using namespace lldb_private;
+
+TEST(FileSystemTest, FileAndDirectoryComponents) {
+  using namespace std::chrono;
+
+  const bool resolve = true;
+#ifdef _WIN32
+  FileSpec fs1("C:\\FILE\\THAT\\DOES\\NOT\\EXIST.TXT", !resolve);
+#else
+  FileSpec fs1("/file/that/does/not/exist.txt", !resolve);
+#endif
+  FileSpec fs2(TestMainArgv0, resolve);
+
+  EXPECT_EQ(system_clock::time_point(), FileSystem::GetModificationTime(fs1));
+  EXPECT_LT(system_clock::time_point() + hours(24 * 365 * 20),
+FileSystem::GetModificationTime(fs2));
+}
Index: unittests/Host/CMakeLists.txt
===
--- unittests/Host/CMakeLists.txt
+++ unittests/Host/CMakeLists.txt
@@ -1,5 +1,6 @@
 add_lldb_unittest(HostTests
   FileSpecTest.cpp
+  FileSystemTest.cpp
   SocketAddressTest.cpp
   SocketTest.cpp
   SymbolsTest.cpp
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -14,6 +14,7 @@
 #include 
 
 #include "lldb/Core/RangeMap.h"
+#include "lldb/Host/TimeValue.h"
 #include "lldb/Symbol/SymbolFile.h"
 
 #include "UniqueDWARFASTType.h"
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Core/RangeMap.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/Section.h"
+#include "lldb/Host/FileSystem.h"
 
 //#define DEBUG_OSO_DMAP // DO NOT CHECKIN WITH THIS NOT COMMENTED OUT
 #if defined(DEBUG_OSO_DMAP)
@@ -424,7 +425,7 @@
   FileSpec oso_file(oso_path, false);
   ConstString oso_object;
   if (oso_file.Exists()) {
-TimeValue oso_mod_time(oso_file.GetModificationTime());
+TimeValue oso_mod_time(FileSystem::GetModificationTime(oso_file));
 if (oso_mod_time != comp_unit_info->oso_mod_time) {
   obj_file->GetModule()->ReportError(
   "debug map object file '%s' has changed (actual time is "
Index: source/Plugins/Platform/Android/AdbClient.cpp
===
--- source/Plugins/Platform/Android/AdbClient.cpp
+++ source/Plugins/Platform/Android/AdbClient.cpp
@@ -22,6 +22,7 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/Host/ConnectionFileDescriptor.h"
 #include "lldb/Host/FileSpec.h"
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Host/PosixApi.h"
 
 #include 
@@ -475,8 +476,11 @@
 if (error.Fail())
   return Error("Failed to send file chunk: %s", error.AsCString());
   }
-

[Lldb-commits] [PATCH] D25393: Remove IntervalTimer class

2016-10-07 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: clayborg, zturner.
labath added a subscriber: lldb-commits.

it was added back in 2013, but there are no uses of it. I started refactoring
it, but then it occured to me it would better to delete it.


https://reviews.llvm.org/D25393

Files:
  include/lldb/Core/Timer.h


Index: include/lldb/Core/Timer.h
===
--- include/lldb/Core/Timer.h
+++ include/lldb/Core/Timer.h
@@ -85,47 +85,6 @@
   DISALLOW_COPY_AND_ASSIGN(Timer);
 };
 
-class IntervalTimer {
-public:
-  IntervalTimer() : m_start(TimeValue::Now()) {}
-
-  ~IntervalTimer() = default;
-
-  uint64_t GetElapsedNanoSeconds() const { return TimeValue::Now() - m_start; }
-
-  void Reset() { m_start = TimeValue::Now(); }
-
-  int PrintfElapsed(const char *format, ...)
-  __attribute__((format(printf, 2, 3))) {
-TimeValue now(TimeValue::Now());
-const uint64_t elapsed_nsec = now - m_start;
-const char *unit = nullptr;
-float elapsed_value;
-if (elapsed_nsec < 1000) {
-  unit = "ns";
-  elapsed_value = (float)elapsed_nsec;
-} else if (elapsed_nsec < 100) {
-  unit = "us";
-  elapsed_value = (float)elapsed_nsec / 1000.0f;
-} else if (elapsed_nsec < 10) {
-  unit = "ms";
-  elapsed_value = (float)elapsed_nsec / 100.0f;
-} else {
-  unit = "sec";
-  elapsed_value = (float)elapsed_nsec / 10.0f;
-}
-int result = printf("%3.2f %s: ", elapsed_value, unit);
-va_list args;
-va_start(args, format);
-result += vprintf(format, args);
-va_end(args);
-return result;
-  }
-
-protected:
-  TimeValue m_start;
-};
-
 } // namespace lldb_private
 
 #endif // liblldb_Timer_h_


Index: include/lldb/Core/Timer.h
===
--- include/lldb/Core/Timer.h
+++ include/lldb/Core/Timer.h
@@ -85,47 +85,6 @@
   DISALLOW_COPY_AND_ASSIGN(Timer);
 };
 
-class IntervalTimer {
-public:
-  IntervalTimer() : m_start(TimeValue::Now()) {}
-
-  ~IntervalTimer() = default;
-
-  uint64_t GetElapsedNanoSeconds() const { return TimeValue::Now() - m_start; }
-
-  void Reset() { m_start = TimeValue::Now(); }
-
-  int PrintfElapsed(const char *format, ...)
-  __attribute__((format(printf, 2, 3))) {
-TimeValue now(TimeValue::Now());
-const uint64_t elapsed_nsec = now - m_start;
-const char *unit = nullptr;
-float elapsed_value;
-if (elapsed_nsec < 1000) {
-  unit = "ns";
-  elapsed_value = (float)elapsed_nsec;
-} else if (elapsed_nsec < 100) {
-  unit = "us";
-  elapsed_value = (float)elapsed_nsec / 1000.0f;
-} else if (elapsed_nsec < 10) {
-  unit = "ms";
-  elapsed_value = (float)elapsed_nsec / 100.0f;
-} else {
-  unit = "sec";
-  elapsed_value = (float)elapsed_nsec / 10.0f;
-}
-int result = printf("%3.2f %s: ", elapsed_value, unit);
-va_list args;
-va_start(args, format);
-result += vprintf(format, args);
-va_end(args);
-return result;
-  }
-
-protected:
-  TimeValue m_start;
-};
-
 } // namespace lldb_private
 
 #endif // liblldb_Timer_h_
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D25391: Remove usages of TimeValue from gdb-remote process plugin

2016-10-07 Thread Pavel Labath via lldb-commits
labath added a subscriber: mehdi_amini.
labath added inline comments.



Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:2144
+template 
+static double float_duration(DurIn dur) {
+  return std::chrono::duration_cast<

First function I'd like to stash somewhere.


https://reviews.llvm.org/D25391



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


[Lldb-commits] [PATCH] D25392: Remove TimeValue usage from FileSpec.h

2016-10-07 Thread Pavel Labath via lldb-commits
labath added a subscriber: mehdi_amini.
labath added inline comments.



Comment at: source/Host/common/FileSystem.cpp:103
+
+  return system_clock::from_time_t(file_stats.st_mtimespec.tv_sec) +
+ nanoseconds(file_stats.st_mtimespec.tv_nsec);

The conversion from `struct timespec` will probably be necessary in some other 
places as well.


https://reviews.llvm.org/D25392



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