[Lldb-commits] [lldb] r346573 - Unbreak the linux bot from the previous commit. Fred needed to use

2018-11-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Nov  9 16:25:45 2018
New Revision: 346573

URL: http://llvm.org/viewvc/llvm-project?rev=346573=rev
Log:
Unbreak the linux bot from the previous commit.  Fred needed to use
some of the macros from mach/exc_resource.h to decode EXC_RESOURCE,
but that header doesn't exist on non-apple platforms and
StopInfoMachException.cpp needs to build on those systems.
EXC_RESOURCE won't be decoded when lldb is built on non-darwin systems.


Modified:
lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp?rev=346573=346572=346573=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Fri Nov 
 9 16:25:45 2018
@@ -10,7 +10,11 @@
 #include "StopInfoMachException.h"
 
 // C Includes
+
+#if defined(__APPLE__)
+// Needed for the EXC_RESOURCE interpretation macros
 #include 
+#endif
 
 // C++ Includes
 // Other libraries and framework includes
@@ -281,6 +285,7 @@ const char *StopInfoMachException::GetDe
   break;
 case 11:
   exc_desc = "EXC_RESOURCE";
+#if defined(__APPLE__)
   {
 int resource_type = EXC_RESOURCE_DECODE_RESOURCE_TYPE(m_exc_code);
 
@@ -320,6 +325,7 @@ const char *StopInfoMachException::GetDe
   break;
 }
   }
+#endif
   break;
 case 12:
   exc_desc = "EXC_GUARD";


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


[Lldb-commits] [lldb] r346572 - Add extra diagnostics to test

2018-11-09 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Fri Nov  9 16:16:39 2018
New Revision: 346572

URL: http://llvm.org/viewvc/llvm-project?rev=346572=rev
Log:
Add extra diagnostics to test

Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py?rev=346572=346571=346572=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py 
Fri Nov  9 16:16:39 2018
@@ -61,6 +61,8 @@ class ExecTestCase(TestBase):
 None, None, self.get_process_working_directory())
 self.assertTrue(process, PROCESS_IS_VALID)
 
+if self.TraceOn():
+self.runCmd("settings show target.process.stop-on-exec", 
check=False)
 if skip_exec:
 self.dbg.HandleCommand("settings set target.process.stop-on-exec 
false")
 def cleanup():
@@ -94,6 +96,8 @@ class ExecTestCase(TestBase):
 process.Continue()
 
 if not skip_exec:
+self.assertFalse(process.GetState() == lldb.eStateExited,
+ "Process should not have exited!")
 self.assertTrue(process.GetState() == lldb.eStateStopped,
 "Process should be stopped at __dyld_start")
 


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


[Lldb-commits] [lldb] r346571 - Enable listening for EXC_RESOURCE events, and format mach

2018-11-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Nov  9 16:14:14 2018
New Revision: 346571

URL: http://llvm.org/viewvc/llvm-project?rev=346571=rev
Log:
Enable listening for EXC_RESOURCE events, and format mach
event as a thread stop reason if we receive one, using 
some macros to decode the payload.  

Patch originally written by Fred Riss, with a few small changes
by myself.

Writing a test for this is a little tricky because the 
mach exception data interpretation relies on header macros
or function calls - it may change over time and writing
a gdb_remote_client test for this would break as older 
encoding interpretation is changed.  I'll tak with Fred
about this more, but neither of us has been thrilled with
the kind of tests we could write for it.

,  

Modified:
lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp?rev=346571=346570=346571=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Fri Nov 
 9 16:14:14 2018
@@ -10,6 +10,8 @@
 #include "StopInfoMachException.h"
 
 // C Includes
+#include 
+
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
@@ -41,6 +43,10 @@ const char *StopInfoMachException::GetDe
 const char *code_desc = NULL;
 const char *subcode_label = "subcode";
 const char *subcode_desc = NULL;
+
+char code_desc_buf[32];
+char subcode_desc_buf[32];
+
 switch (m_value) {
 case 1: // EXC_BAD_ACCESS
   exc_desc = "EXC_BAD_ACCESS";
@@ -275,6 +281,45 @@ const char *StopInfoMachException::GetDe
   break;
 case 11:
   exc_desc = "EXC_RESOURCE";
+  {
+int resource_type = EXC_RESOURCE_DECODE_RESOURCE_TYPE(m_exc_code);
+
+code_label = "limit";
+code_desc = code_desc_buf;
+subcode_label = "observed";
+subcode_desc = subcode_desc_buf;
+
+switch (resource_type) {
+case RESOURCE_TYPE_CPU:
+  exc_desc = "EXC_RESOURCE RESOURCE_TYPE_CPU";
+  snprintf(code_desc_buf, sizeof(code_desc_buf), "%d%%",
+(int)EXC_RESOURCE_CPUMONITOR_DECODE_PERCENTAGE(m_exc_code));
+  snprintf(subcode_desc_buf, sizeof(subcode_desc_buf), "%d%%",
+
(int)EXC_RESOURCE_CPUMONITOR_DECODE_PERCENTAGE_OBSERVED(m_exc_subcode));
+  break;
+case RESOURCE_TYPE_WAKEUPS:
+  exc_desc = "EXC_RESOURCE RESOURCE_TYPE_WAKEUPS";
+  snprintf(code_desc_buf, sizeof(code_desc_buf), "%d w/s",
+(int)EXC_RESOURCE_CPUMONITOR_DECODE_WAKEUPS_PERMITTED(m_exc_code));
+  snprintf(subcode_desc_buf, sizeof(subcode_desc_buf), "%d w/s",
+
(int)EXC_RESOURCE_CPUMONITOR_DECODE_WAKEUPS_OBSERVED(m_exc_subcode));
+  break;
+case RESOURCE_TYPE_MEMORY:
+  exc_desc = "EXC_RESOURCE RESOURCE_TYPE_MEMORY";
+  snprintf(code_desc_buf, sizeof(code_desc_buf), "%d MB",
+(int)EXC_RESOURCE_HWM_DECODE_LIMIT(m_exc_code));
+  subcode_desc = nullptr;
+  subcode_label = "unused";
+  break;
+case RESOURCE_TYPE_IO:
+  exc_desc = "EXC_RESOURCE RESOURCE_TYPE_IO";
+  snprintf(code_desc_buf, sizeof(code_desc_buf), "%d MB",
+(int)EXC_RESOURCE_IO_DECODE_LIMIT(m_exc_code));
+  snprintf(subcode_desc_buf, sizeof(subcode_desc_buf), "%d MB",
+(int)EXC_RESOURCE_IO_OBSERVED(m_exc_subcode));;
+  break;
+}
+  }
   break;
 case 12:
   exc_desc = "EXC_GUARD";

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp?rev=346571=346570=346571=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp Fri Nov  9 
16:14:14 2018
@@ -386,24 +386,29 @@ void MachException::Data::Dump() const {
   }
 }
 
-#define PREV_EXC_MASK_ALL  
\
-  (EXC_MASK_BAD_ACCESS | EXC_MASK_BAD_INSTRUCTION | EXC_MASK_ARITHMETIC |  
\
-   EXC_MASK_EMULATION | EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT |  
\
-   EXC_MASK_SYSCALL | EXC_MASK_MACH_SYSCALL | EXC_MASK_RPC_ALERT | 
\
-   EXC_MASK_MACHINE)
+// The EXC_MASK_ALL value hard-coded here so that lldb can be built
+// on a new OS with an older deployment target .  The new OS may have
+// an addition to its EXC_MASK_ALL that the old OS will not recognize -
+//  doesn't vary the value based on the deployment

[Lldb-commits] [PATCH] D54352: [CMake] Explicit lldb_codesign function with application in debugserver and lldb-server

2018-11-09 Thread Chris Bieneman via Phabricator via lldb-commits
beanz added a comment.

Why not just add entitlement support to ‘llvm_codesign’? Or feed through extra 
arguments?


https://reviews.llvm.org/D54352



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


[Lldb-commits] [lldb] r346561 - Work with a gdb-remote target that doesn't handle the

2018-11-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Nov  9 14:33:26 2018
New Revision: 346561

URL: http://llvm.org/viewvc/llvm-project?rev=346561=rev
Log:
Work with a gdb-remote target that doesn't handle the
qWatchpointSupportInfo packet correctly.  

In GDBRemoteCommunicationClient::GetWatchpointSupportInfo,
if the response to qWatchpointSupportInfo does not
include the 'num' field, then we did not get an answer
we understood, mark this target as not supporting that
packet.

In Target.cpp, rename the very confusingly named
CheckIfWatchpointsExhausted to CheckIfWatchpointsSupported,
and check the error status returned by 
Process::GetWatchpointSupportInfo.  If we cannot determine
what the number of supported watchpoints are, assume that
they will work.  We'll handle the failure
later when we try to create/enable the watchpoint if the
Z2 packet isn't supported.

Add a gdb_remote_client test case.

 




Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
Modified:

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Target/Target.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py?rev=346561=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestNoWatchpointSupportInfo.py
 Fri Nov  9 14:33:26 2018
@@ -0,0 +1,64 @@
+from __future__ import print_function
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from gdbclientutils import *
+
+class TestNoWatchpointSupportInfo(GDBRemoteTestBase):
+
+@skipIfXmlSupportMissing
+@skipIfRemote
+def test(self):
+"""
+Test lldb's parsing of the  tag in the target.xml 
register
+description packet.
+"""
+class MyResponder(MockGDBServerResponder):
+
+def haltReason(self):
+return "T02thread:1ff0d;thread-pcs:10001bc00;"
+
+def threadStopInfo(self, threadnum):
+if threadnum == 0x1ff0d:
+return "T02thread:1ff0d;thread-pcs:10001bc00;"
+
+def setBreakpoint(self, packet):
+if packet.startswith("Z2,"):
+return "OK"
+
+def qXferRead(self, obj, annex, offset, length):
+if annex == "target.xml":
+return """
+
+  i386:x86-64
+  
+
+  
+""", False
+else:
+return None, False
+
+self.server.responder = MyResponder()
+if self.TraceOn():
+interp = self.dbg.GetCommandInterpreter()
+result = lldb.SBCommandReturnObject()
+interp.HandleCommand("log enable gdb-remote packets", result)
+self.dbg.SetDefaultArchitecture("x86_64")
+target = self.dbg.CreateTargetWithFileAndArch(None, None)
+
+process = self.connect(target)
+
+if self.TraceOn():
+interp = self.dbg.GetCommandInterpreter()
+result = lldb.SBCommandReturnObject()
+interp.HandleCommand("target list", result)
+print(result.GetOutput())
+
+   
+err = lldb.SBError()
+wp = target.WatchAddress(0x100, 8, False, True, err)
+if self.TraceOn() and (err.Fail() or wp.IsValid == False):
+strm = lldb.SBStream()
+err.GetDescription(strm)
+print("watchpoint failed: %s" % strm.GetData())
+self.assertTrue(wp.IsValid())

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=346561=346560=346561=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Fri Nov  9 14:33:26 2018
@@ -1689,12 +1689,17 @@ Status GDBRemoteCommunicationClient::Get
   m_supports_watchpoint_support_info = eLazyBoolYes;
   llvm::StringRef name;
   llvm::StringRef value;
+  bool found_num_field = false;
   while (response.GetNameColonValue(name, value)) {
 if (name.equals("num")) {
   value.getAsInteger(0, m_num_supported_hardware_watchpoints);
   num = m_num_supported_hardware_watchpoints;
+  

[Lldb-commits] [PATCH] D54352: [CMake] Explicit lldb_codesign function with application in debugserver and lldb-server

2018-11-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

This would soon be used for other targets as well. llvm_codesign is here: 
https://reviews.llvm.org/D48797




Comment at: cmake/modules/AddLLDB.cmake:212
+  set(pass_force "--force")
+endif()
+

So far `--force` was used everywhere to avoid trouble with double signing I 
guess (turns the error into a warning). IIUC this should never happen for a 
post-build action right? Thus, the "more correct" way may be to remove this 
from invocations/altogether and go fix the actual issue if it ever fails. But 
then I think, who wants to bother with double code signing issues..

Anyway, llvm_codesign doesn't force. Any good reason to keep it?


https://reviews.llvm.org/D54352



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


[Lldb-commits] [PATCH] D54352: [CMake] Explicit lldb_codesign function with application in debugserver and lldb-server

2018-11-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: beanz, bogner, lanza, friss.
Herald added a subscriber: mgorny.

Add LLDB-specific utility function lldb_codesign. In contrast to llvm_codesign 
it must be invoked explicitly and allows to pass a target-specific entitlements 
file as well as an override for the codesign identity.


https://reviews.llvm.org/D54352

Files:
  CMakeLists.txt
  cmake/modules/AddLLDB.cmake
  tools/debugserver/CMakeLists.txt
  tools/debugserver/source/CMakeLists.txt
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -64,3 +64,11 @@
 )
 
 target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS})
+
+if(APPLE)
+  if(NOT IOS)
+set(entitlements ${LLDB_SOURCE_DIR}/resources/debugserver-macosx-entitlements.plist)
+  endif()
+
+  lldb_codesign(TARGETS lldb-server ENTITLE ${entitlements} FORCE)
+endif()
Index: tools/debugserver/source/CMakeLists.txt
===
--- tools/debugserver/source/CMakeLists.txt
+++ tools/debugserver/source/CMakeLists.txt
@@ -206,16 +206,6 @@
 )
 endif()
 
-set(entitlements_xml ${CMAKE_CURRENT_SOURCE_DIR}/debugserver-macosx-entitlements.plist)
-if(IOS)
-  set(entitlements_xml ${CMAKE_CURRENT_SOURCE_DIR}/debugserver-entitlements.plist)
-else()
-  set(entitlements_xml ${CMAKE_CURRENT_SOURCE_DIR}/../../../resources/debugserver-macosx-entitlements.plist)
-endif()
-
-set(LLDB_USE_ENTITLEMENTS_Default On)
-option(LLDB_USE_ENTITLEMENTS "Use entitlements when codesigning (Defaults Off when using lldb_codesign identity, otherwise On)" ${LLDB_USE_ENTITLEMENTS_Default})
-
 if (SKIP_DEBUGSERVER)
   if (CMAKE_HOST_APPLE)
 # If we haven't built a signed debugserver, copy the one from the system.
@@ -225,32 +215,16 @@
   COMMENT "Copying the system debugserver to LLDB's binaries directory.")
   endif()
 else()
-  if(LLDB_USE_ENTITLEMENTS)
-set(entitlements_flags --entitlements ${entitlements_xml})
-  endif()
-  execute_process(
-COMMAND xcrun -f codesign_allocate
-OUTPUT_STRIP_TRAILING_WHITESPACE
-OUTPUT_VARIABLE CODESIGN_ALLOCATE
-)
-  add_custom_command(TARGET debugserver
-POST_BUILD
-COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE}
-codesign --force --sign ${LLDB_CODESIGN_IDENTITY}
-${entitlements_flags}
-$
-  )
-  if(IOS)
-add_custom_command(TARGET debugserver-nonui
-  POST_BUILD
-  COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CODESIGN_ALLOCATE}
-  codesign --force --sign ${LLDB_CODESIGN_IDENTITY}
-  ${entitlements_flags}
-  $
-)
+  if(APPLE)
+if(IOS)
+  set(entitlements ${CMAKE_CURRENT_SOURCE_DIR}/debugserver-entitlements.plist)
+  set(targets debugserver debugserver-nonui)
+else()
+  # Same entitlements file used for lldb-server
+  set(entitlements ${LLDB_SOURCE_DIR}/resources/debugserver-macosx-entitlements.plist)
+  set(targets debugserver)
+endif()
+
+lldb_codesign(TARGETS ${targets} ENTITLE ${entitlements} FORCE)
   endif()
 endif()
-
-
-
-
Index: tools/debugserver/CMakeLists.txt
===
--- tools/debugserver/CMakeLists.txt
+++ tools/debugserver/CMakeLists.txt
@@ -3,6 +3,8 @@
 project(Debugserver LANGUAGES C CXX ASM-ATT)
 
 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+  option(LLDB_USE_ENTITLEMENTS "When codesigning use entitlements if available" ON)
+
   set(CMAKE_MODULE_PATH
 ${CMAKE_MODULE_PATH}
 "${CMAKE_SOURCE_DIR}/../../cmake"
Index: cmake/modules/AddLLDB.cmake
===
--- cmake/modules/AddLLDB.cmake
+++ cmake/modules/AddLLDB.cmake
@@ -177,3 +177,61 @@
   # Now set them onto the target.
   set_target_properties(${target_name} PROPERTIES LINK_FLAGS ${new_link_flags})
 endfunction()
+
+# Usage: lldb_codesign(TARGETS t1 t2 [ENTITLE file] [IDENTITY override] [FORCE])
+#
+# In contrast to the LLVM implementation, this function must be invoked
+# explicitly for all targets that need code signing.
+#
+# IDENTITY defaults to LLDB_CODESIGN_IDENTITY. Code signing is skipped if it's
+# empty and no override passed. ENTITLE specifies the entitlements file to use
+# if LLDB_USE_ENTITLEMENTS is set. FORCE causes codesign to replace existing
+# signatures.
+#
+function(lldb_codesign)
+  cmake_parse_arguments(ARG "FORCE" "ENTITLE;IDENTITY" "TARGETS" ${ARGN})
+
+  if(ARG_IDENTITY)
+set(pass_identity --sign ${ARG_IDENTITY})
+  elseif(LLDB_CODESIGN_IDENTITY)
+set(pass_identity --sign ${LLDB_CODESIGN_IDENTITY})
+  endif()
+
+  if(NOT pass_identity)
+message(WARNING "Skip code signing for ${ARG_TARGETS} due to missing identity")
+return()
+  endif()
+
+  if(APPLE)
+if(LLDB_USE_ENTITLEMENTS AND 

[Lldb-commits] [PATCH] D54333: [CMake] Allow version overrides with -DLLDB_VERSION_MAJOR/MINOR/PATCH/SUFFIX

2018-11-09 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

nice!


https://reviews.llvm.org/D54333



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


[Lldb-commits] [PATCH] D54333: [CMake] Allow version overrides with -DLLDB_VERSION_MAJOR/MINOR/PATCH/SUFFIX

2018-11-09 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.

Yep, this looks good to me. Thanks! :)


https://reviews.llvm.org/D54333



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


[Lldb-commits] [PATCH] D54333: [CMake] Allow version overrides with -DLLDB_VERSION_MAJOR/MINOR/PATCH/SUFFIX

2018-11-09 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Seems reasonable!


https://reviews.llvm.org/D54333



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


[Lldb-commits] [lldb] r346553 - Remove llvm include from debugserver, change

2018-11-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Fri Nov  9 12:31:41 2018
New Revision: 346553

URL: http://llvm.org/viewvc/llvm-project?rev=346553=rev
Log:
Remove llvm include from debugserver, change 
LLVM_FALLTHROUGH's to [[clang::fallthrough]] -
debugserver is only ever compiled on darwin
systems with clang.

Modified:
lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp?rev=346553=346552=346553=diff
==
--- lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp Fri Nov  9 12:31:41 
2018
@@ -13,7 +13,6 @@
 
 #include "DNBRegisterInfo.h"
 #include "DNBLog.h"
-#include 
 #include 
 
 DNBRegisterValueClass::DNBRegisterValueClass(const DNBRegisterInfo *regInfo) {
@@ -157,7 +156,7 @@ void DNBRegisterValueClass::Dump(const c
 DNBLogError(
 "unsupported vector format %d, defaulting to hex bytes.",
 info.format);
-LLVM_FALLTHROUGH;
+[[clang::fallthrough]];
   case VectorOfUInt8:
 snprintf(str, sizeof(str), "%s", "uint8   { ");
 pos = str + strlen(str);

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=346553=346552=346553=diff
==
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri Nov  9 12:31:41 2018
@@ -50,7 +50,6 @@
 #include 
 #endif
 
-#include 
 #include  // for endianness predefines
 #include 
 #include 
@@ -3691,7 +3690,7 @@ rnb_err_t RNBRemote::HandlePacket_v(cons
   return HandlePacket_ILLFORMED(
   __FILE__, __LINE__, p, "Could not parse signal in vCont packet");
   // Fall through to next case...
-LLVM_FALLTHROUGH;
+[[clang::fallthrough]];
   case 'c':
 // Continue
 thread_action.state = eStateRunning;
@@ -3704,7 +3703,7 @@ rnb_err_t RNBRemote::HandlePacket_v(cons
   return HandlePacket_ILLFORMED(
   __FILE__, __LINE__, p, "Could not parse signal in vCont packet");
   // Fall through to next case...
-LLVM_FALLTHROUGH;
+[[clang::fallthrough]];
   case 's':
 // Step
 thread_action.state = eStateStepping;


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


[Lldb-commits] [PATCH] D54335: [CMake] Fix: add_host_subdirectory source/Host/macosx

2018-11-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added a reviewer: teemperor.
Herald added a subscriber: mgorny.

Typo introduced with https://reviews.llvm.org/D47929


https://reviews.llvm.org/D54335

Files:
  source/Host/CMakeLists.txt


Index: source/Host/CMakeLists.txt
===
--- source/Host/CMakeLists.txt
+++ source/Host/CMakeLists.txt
@@ -91,7 +91,7 @@
 include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
 add_subdirectory(macosx/objcxx)
 set(LLDBObjCLibs lldbHostMacOSXObjCXX)
-add_host_subdirectory(maqcosx
+add_host_subdirectory(macosx
   macosx/Symbols.cpp
   macosx/cfcpp/CFCBundle.cpp
   macosx/cfcpp/CFCData.cpp


Index: source/Host/CMakeLists.txt
===
--- source/Host/CMakeLists.txt
+++ source/Host/CMakeLists.txt
@@ -91,7 +91,7 @@
 include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
 add_subdirectory(macosx/objcxx)
 set(LLDBObjCLibs lldbHostMacOSXObjCXX)
-add_host_subdirectory(maqcosx
+add_host_subdirectory(macosx
   macosx/Symbols.cpp
   macosx/cfcpp/CFCBundle.cpp
   macosx/cfcpp/CFCData.cpp
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54333: [CMake] Allow version overrides with -DLLDB_VERSION_MAJOR/MINOR/PATCH/SUFFIX

2018-11-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: labath, xiaobai.
Herald added a subscriber: mgorny.

This follows the approach in Clang. If no overrides are given, LLDB_VERSION_* 
is inferred from LLVM_VERSION_*. This mimics the current behaviour 
(PACKAGE_VERSION itself is generated from LLVM_VERSION_*).
For in-tree builds LLVM_VERSION_* will be defined at this point already. For 
standalone builds, LLDBConfig.cmake is included after LLDBStandalone.cmake 
which includes LLVMConfig.cmake.


https://reviews.llvm.org/D54333

Files:
  CMakeLists.txt
  cmake/modules/LLDBConfig.cmake


Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -265,9 +265,20 @@
 "`CMakeFiles'. Please delete them.")
 endif()
 
-# Compute the LLDB version from the LLVM version.
-string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLDB_VERSION
-  ${PACKAGE_VERSION})
+# If LLDB_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
+if(NOT DEFINED LLDB_VERSION_MAJOR)
+  set(LLDB_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
+endif()
+if(NOT DEFINED LLDB_VERSION_MINOR)
+  set(LLDB_VERSION_MINOR ${LLVM_VERSION_MINOR})
+endif()
+if(NOT DEFINED LLDB_VERSION_PATCH)
+  set(LLDB_VERSION_PATCH ${LLVM_VERSION_PATCH})
+endif()
+if(NOT DEFINED LLDB_VERSION_SUFFIX)
+  set(LLDB_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
+endif()
+set(LLDB_VERSION 
"${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}")
 message(STATUS "LLDB version: ${LLDB_VERSION}")
 
 include_directories(BEFORE
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -56,7 +56,7 @@
   # the framework, and must be defined before building liblldb.
   set(PRODUCT_NAME "LLDB")
   set(EXECUTABLE_NAME "LLDB")
-  set(CURRENT_PROJECT_VERSION "360.99.0")
+  set(CURRENT_PROJECT_VERSION "${LLDB_VERSION}")
   set(LLDB_SUITE_TARGET lldb-framework)
 
   set(LLDB_FRAMEWORK_DIR


Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -265,9 +265,20 @@
 "`CMakeFiles'. Please delete them.")
 endif()
 
-# Compute the LLDB version from the LLVM version.
-string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLDB_VERSION
-  ${PACKAGE_VERSION})
+# If LLDB_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
+if(NOT DEFINED LLDB_VERSION_MAJOR)
+  set(LLDB_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
+endif()
+if(NOT DEFINED LLDB_VERSION_MINOR)
+  set(LLDB_VERSION_MINOR ${LLVM_VERSION_MINOR})
+endif()
+if(NOT DEFINED LLDB_VERSION_PATCH)
+  set(LLDB_VERSION_PATCH ${LLVM_VERSION_PATCH})
+endif()
+if(NOT DEFINED LLDB_VERSION_SUFFIX)
+  set(LLDB_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
+endif()
+set(LLDB_VERSION "${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}")
 message(STATUS "LLDB version: ${LLDB_VERSION}")
 
 include_directories(BEFORE
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -56,7 +56,7 @@
   # the framework, and must be defined before building liblldb.
   set(PRODUCT_NAME "LLDB")
   set(EXECUTABLE_NAME "LLDB")
-  set(CURRENT_PROJECT_VERSION "360.99.0")
+  set(CURRENT_PROJECT_VERSION "${LLDB_VERSION}")
   set(LLDB_SUITE_TARGET lldb-framework)
 
   set(LLDB_FRAMEWORK_DIR
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346527 - Add missing include

2018-11-09 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Fri Nov  9 09:58:05 2018
New Revision: 346527

URL: http://llvm.org/viewvc/llvm-project?rev=346527=rev
Log:
Add missing include

Modified:
lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=346527=346526=346527=diff
==
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri Nov  9 09:58:05 2018
@@ -50,6 +50,7 @@
 #include 
 #endif
 
+#include 
 #include  // for endianness predefines
 #include 
 #include 


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


[Lldb-commits] [lldb] r346525 - Add missing include

2018-11-09 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Fri Nov  9 09:44:20 2018
New Revision: 346525

URL: http://llvm.org/viewvc/llvm-project?rev=346525=rev
Log:
Add missing include

Modified:
lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp

Modified: lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp?rev=346525=346524=346525=diff
==
--- lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp Fri Nov  9 09:44:20 
2018
@@ -13,6 +13,7 @@
 
 #include "DNBRegisterInfo.h"
 #include "DNBLog.h"
+#include 
 #include 
 
 DNBRegisterValueClass::DNBRegisterValueClass(const DNBRegisterInfo *regInfo) {


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


[Lldb-commits] [lldb] r346519 - Annotate switch with LLVM_FALLTHROUGH

2018-11-09 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Fri Nov  9 09:11:17 2018
New Revision: 346519

URL: http://llvm.org/viewvc/llvm-project?rev=346519=rev
Log:
Annotate switch with LLVM_FALLTHROUGH

Modified:
lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp?rev=346519=346518=346519=diff
==
--- lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNBRegisterInfo.cpp Fri Nov  9 09:11:17 
2018
@@ -156,6 +156,7 @@ void DNBRegisterValueClass::Dump(const c
 DNBLogError(
 "unsupported vector format %d, defaulting to hex bytes.",
 info.format);
+LLVM_FALLTHROUGH;
   case VectorOfUInt8:
 snprintf(str, sizeof(str), "%s", "uint8   { ");
 pos = str + strlen(str);

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=346519=346518=346519=diff
==
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri Nov  9 09:11:17 2018
@@ -3690,7 +3690,7 @@ rnb_err_t RNBRemote::HandlePacket_v(cons
   return HandlePacket_ILLFORMED(
   __FILE__, __LINE__, p, "Could not parse signal in vCont packet");
   // Fall through to next case...
-
+LLVM_FALLTHROUGH;
   case 'c':
 // Continue
 thread_action.state = eStateRunning;
@@ -3703,7 +3703,7 @@ rnb_err_t RNBRemote::HandlePacket_v(cons
   return HandlePacket_ILLFORMED(
   __FILE__, __LINE__, p, "Could not parse signal in vCont packet");
   // Fall through to next case...
-
+LLVM_FALLTHROUGH;
   case 's':
 // Step
 thread_action.state = eStateStepping;


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


Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-09 Thread Zachary Turner via lldb-commits
The problem was actually in the native pdb plugin.  I forgot to call
ClangASTContext::SetHasExternalStorage with true on the enum decls when i
created it, so it wasn't getting completed.  I submitted a fix in r346517.

On Thu, Nov 8, 2018 at 2:00 PM Greg Clayton  wrote:

> Another way to think about this is if you have a SBValue that represents a
> class instances in an IDE, if no one turns it open to see the children, why
> do we need to complete the type? We should have to. The type should be able
> to complete itself if and when we need to know some information. This
> already works fine for classes, we just need to make it work for enums.
> Just complete the type before we need access to the enumerators. For a
> SBValue that contains a enum type:
>
> SBValue var = frame.FindVariable("myEnumVar");
>
> If I call:
>
> SBType var_type = var.GetType();
>
> "var_type" doesn't need be completed yet. Even:
>
> const char *n = var_type.GetName();
>
> Doesn't require a full type. Now for getting the value:
>
> const char *value = var.GetValue();
>
> We don't need to complete a class type as the class has no value. If this
> is a pointer to anything (enum, class, struct, union) we don't need to
> complete the type to show the pointer value. For an enum we do need it. But
> the type should complete itself in the code that knows it needs to full
> type.
>
> Asking the type about itself might also cause the type to complete itself:
>
> auto num_fields = var_type.GetNumFields();
>
> Would cause a class type to complete itself probably down in the
> TypeSystem class (ClangASTContext).
>
> So after thinking about this some more, the proposed fix you had was not
> the right one. We just need to fix the ClangASTContext to complete the type
> before it tries to use it.
>
> Question: did you use the clang external AST source like the DWARF plug-in
> stuff did to complete the types?
>
> On Nov 8, 2018, at 1:40 PM, Greg Clayton  wrote:
>
> Looks like this test was testing the functionality that you changed. It it
> expecting that a type won't be complete until you ask for more info about
> it (like asking about a child). Since PDB is not completing the type up
> front, we need to change LLDB or make your previous case work even when
> handing out a forward type.
>
> So the question is: do we expect types to be able to complete themselves
> on the fly anywhere? I believe we should be able to hand out a type as a
> forward declaration and have it complete itself at any point when it is
> needed. I know classes already do this when they need to know more. Maybe
> the AST doesn't treat enums like classes where it will complete the type
> through the external AST class.
>
> The correct fix is to probably call
>
> bool CompilerType::GetCompleteType() const;
>
> Before you need to access the enumerators in an enumeration.
>
>
>
> On Nov 8, 2018, at 1:17 PM, Zachary Turner via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
> +greg.
>
> Greg, is the test wrong here or the patch?  If it’s the test let’s just
> fix the test, otherwise we can revert the patch until we figure it out.
>
> It seems related to my change to use the layout type instead of the
> forward type.
>
> On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano 
> wrote:
>
>> On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner 
>> wrote:
>> >
>> > I’m ooo for at least 2 hours. Is it a test failure or a compilation
>> failure?
>>
>>
>> FAIL: test_with_run_command_gmodules
>> (TestTypeCompletion.TypeCompletionTestCase)
>>
>>Check that types only get completed when necessary.
>> --
>> Traceback (most recent call last):
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
>> line 1744, in test_method
>> return attrvalue(self)
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
>> line 113, in wrapper
>> func(*args, **kwargs)
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",
>> line 55, in test_with_run_command 'vector complete but it should
>> not be')
>> AssertionError: True is not False : vector complete but it should not
>> be
>>
>>
>> Do you want me to revert this in the meanwhile?
>>
>> --Davide
>>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346517 - [NativePDB] Fix completion of enum types.

2018-11-09 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  9 09:08:26 2018
New Revision: 346517

URL: http://llvm.org/viewvc/llvm-project?rev=346517=rev
Log:
[NativePDB] Fix completion of enum types.

This was originally submitted in a patch which fixed two unrelated
bugs at the same time.  This portion of the fix was reverted because
it broke several other things.  However, the fix employed originally
was totally wrong, and attempted to change something in the ValueObject
printer when actually the bug was in the NativePDB plugin.  We need
to mark forward enum decls as having external storage, otherwise
we won't be asked to complete them when the time comes.  This patch
implements the proper fix, and updates tests accordingly.

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346517=346516=346517=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Fri Nov  9 
09:08:26 2018
@@ -89,7 +89,7 @@ Anonymous>::D AnonABCVoidD;
 // CHECK: (TrivialC) TC = {}
 // CHECK: (TrivialS) TS = {}
 // CHECK: (TrivialU) TU = {}
-// CHECK: (TrivialE) TE = 
+// CHECK: (TrivialE) TE = TE_A
 // CHECK: (A::B::C) ABCInt = (ABCMember = 0)
 // CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
 // CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 
0x)
@@ -105,6 +105,7 @@ Anonymous>::D AnonABCVoidD;
 // CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition
 // CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition
 // CHECK: |-EnumDecl {{.*}} TrivialE
+// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'TrivialE'
 // CHECK: |-NamespaceDecl {{.*}} A
 // CHECK: | |-NamespaceDecl {{.*}} B
 // CHECK: | | |-CXXRecordDecl {{.*}} struct C definition

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=346517=346516=346517=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Fri 
Nov  9 09:08:26 2018
@@ -913,6 +913,7 @@ lldb::TypeSP SymbolFileNativePDB::Create
   underlying_type->GetFullCompilerType(), er.isScoped());
 
   ClangASTContext::StartTagDeclarationDefinition(enum_ct);
+  ClangASTContext::SetHasExternalStorage(enum_ct.GetOpaqueQualType(), true);
 
   // We're just going to forward resolve this for now.  We'll complete
   // it only if the user requests.


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


[Lldb-commits] [lldb] r346511 - [NativePDB] Add support for bitfield records.

2018-11-09 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  9 08:29:19 2018
New Revision: 346511

URL: http://llvm.org/viewvc/llvm-project?rev=346511=rev
Log:
[NativePDB] Add support for bitfield records.

Bitfields are represented as LF_MEMBER records whose TypeIndex
points to an LF_BITFIELD record that describes the bit width,
bit offset, and underlying type of the bitfield.  All we need to
do is resolve these when resolving record types.

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp
Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit?rev=346511=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/bitfields.lldbinit Fri Nov  9 
08:29:19 2018
@@ -0,0 +1,5 @@
+settings set auto-one-line-summaries false
+
+target variable -T TheStruct
+
+target modules dump ast

Added: lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp?rev=346511=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/bitfields.cpp Fri Nov  9 08:29:19 2018
@@ -0,0 +1,61 @@
+// clang-format off
+// REQUIRES: lld
+
+// Test various interesting cases for AST reconstruction.
+// RUN: clang-cl /Z7 /GS- /GR- /std:c++latest -Xclang -fkeep-static-consts /c 
/Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s
+
+// Test trivial versions of each tag type.
+struct Struct {
+  int A : 5 = 6;
+  int B : 7 = 8;
+  unsigned C : 3 = 2;
+  unsigned D : 15 = 12345;
+  char E : 1 = 0;
+  char F : 2 = 1;
+  char G : 3 = 2;
+  // H should be at offset 0 of a new byte.
+  char H : 3 = 3;
+};
+
+constexpr Struct TheStruct;
+
+
+int main(int argc, char **argv) {
+  return TheStruct.A;
+}
+
+// CHECK: (lldb) target variable -T TheStruct
+// CHECK: (const Struct) TheStruct = {
+// CHECK:   (int:5) A = 6
+// CHECK:   (int:7) B = 8
+// CHECK:   (unsigned int:3) C = 2
+// CHECK:   (unsigned int:15) D = 12345
+// CHECK:   (char:1) E = '\0'
+// CHECK:   (char:2) F = '\x01'
+// CHECK:   (char:3) G = '\x02'
+// CHECK:   (char:3) H = '\x03'
+// CHECK: }
+//
+// CHECK: target modules dump ast
+// CHECK: Dumping clang ast for 1 modules.
+// CHECK: TranslationUnitDecl {{.*}}
+// CHECK: |-CXXRecordDecl {{.*}} struct Struct definition
+// CHECK: | |-FieldDecl {{.*}} A 'int'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 5
+// CHECK: | |-FieldDecl {{.*}} B 'int'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 7
+// CHECK: | |-FieldDecl {{.*}} C 'unsigned int'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 3
+// CHECK: | |-FieldDecl {{.*}} D 'unsigned int'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 15
+// CHECK: | |-FieldDecl {{.*}} E 'char'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 1
+// CHECK: | |-FieldDecl {{.*}} F 'char'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 2
+// CHECK: | |-FieldDecl {{.*}} G 'char'
+// CHECK: | | `-IntegerLiteral {{.*}} 'int' 3
+// CHECK: | `-FieldDecl {{.*}} H 'char'
+// CHECK: |   `-IntegerLiteral {{.*}} 'int' 3

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp?rev=346511=346510=346511=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp Fri 
Nov  9 08:29:19 2018
@@ -123,17 +123,33 @@ Error UdtRecordCompleter::visitKnownMemb
 Error UdtRecordCompleter::visitKnownMember(CVMemberRecord ,
DataMemberRecord _member) {
 
-  TypeSP member_type = m_symbol_file.GetOrCreateType(data_member.Type);
-  CompilerType complete_member_type = member_type->GetFullCompilerType();
+  uint64_t offset = data_member.FieldOffset * 8;
+  uint32_t bitfield_width = 0;
+
+  TypeSP member_type;
+  TpiStream  = m_symbol_file.m_index->tpi();
+  TypeIndex ti(data_member.Type);
+  if (!ti.isSimple()) {
+CVType cvt = tpi.getType(ti);
+if (cvt.kind() == LF_BITFIELD) {
+  BitFieldRecord bfr;
+  llvm::cantFail(TypeDeserializer::deserializeAs(cvt, 
bfr));
+  offset += bfr.BitOffset;
+  bitfield_width = bfr.BitSize;
+  ti = bfr.Type;
+}
+  }
 
+  member_type = m_symbol_file.GetOrCreateType(ti);
+  

Re: [Lldb-commits] [lldb] r346502 - revert rL346478

2018-11-09 Thread Davide Italiano via lldb-commits
OK, thanks. Please add an explanation next time you revert something.

Best,

--
Davide
On Fri, Nov 9, 2018 at 8:10 AM Kadir Çetinkaya  wrote:
>
> It was reverted in base repo, https://reviews.llvm.org/rL346500
>
> On Fri, Nov 9, 2018 at 5:09 PM Davide Italiano  wrote:
>>
>> On Fri, Nov 9, 2018 at 7:20 AM Kadir Cetinkaya via lldb-commits
>>  wrote:
>> >
>> > Author: kadircet
>> > Date: Fri Nov  9 07:18:02 2018
>> > New Revision: 346502
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=346502=rev
>> > Log:
>> > revert rL346478
>> >
>>
>> This message isn't explaining why you reverted. Ca you please elaborate?
>>
>> --
>> Davide
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r346502 - revert rL346478

2018-11-09 Thread Kadir Çetinkaya via lldb-commits
It was reverted in base repo, https://reviews.llvm.org/rL346500

On Fri, Nov 9, 2018 at 5:09 PM Davide Italiano 
wrote:

> On Fri, Nov 9, 2018 at 7:20 AM Kadir Cetinkaya via lldb-commits
>  wrote:
> >
> > Author: kadircet
> > Date: Fri Nov  9 07:18:02 2018
> > New Revision: 346502
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=346502=rev
> > Log:
> > revert rL346478
> >
>
> This message isn't explaining why you reverted. Ca you please elaborate?
>
> --
> Davide
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r346502 - revert rL346478

2018-11-09 Thread Davide Italiano via lldb-commits
On Fri, Nov 9, 2018 at 7:20 AM Kadir Cetinkaya via lldb-commits
 wrote:
>
> Author: kadircet
> Date: Fri Nov  9 07:18:02 2018
> New Revision: 346502
>
> URL: http://llvm.org/viewvc/llvm-project?rev=346502=rev
> Log:
> revert rL346478
>

This message isn't explaining why you reverted. Ca you please elaborate?

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


[Lldb-commits] [lldb] r346505 - Resubmit "Fix bug in PE/COFF plugin."

2018-11-09 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Fri Nov  9 08:06:44 2018
New Revision: 346505

URL: http://llvm.org/viewvc/llvm-project?rev=346505=rev
Log:
Resubmit "Fix bug in PE/COFF plugin."

The original commit was actually 2 unrelated bug fixes, but it turns
out the second bug fix wasn't quite correct, so the entire patch was
reverted.  Resubmitting this half of the patch by itself, then will
follow up with a new patch which fixes the rest of the issue in a
more appropriate way.

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
Modified:
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit?rev=346505=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit Fri Nov  9 
08:06:44 2018
@@ -0,0 +1,3 @@
+target variable GlobalVariable
+
+quit

Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346505=346504=346505=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Fri Nov  9 
08:06:44 2018
@@ -90,15 +90,15 @@ Anonymous>::D AnonABCVoidD;
 // CHECK: (TrivialS) TS = {}
 // CHECK: (TrivialU) TU = {}
 // CHECK: (TrivialE) TE = 
-// CHECK: (A::B::C) ABCInt = (ABCMember = )
-// CHECK: (A::B::C) ABCFloat = (ABCMember = )
-// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = )
+// CHECK: (A::B::C) ABCInt = (ABCMember = 0)
+// CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 
0x)
 // CHECK: (A::C<0>) AC0 = {}
 // CHECK: (A::C<-1>) ACNeg1 = {}
-// CHECK: (A::C<0>::D) AC0D = (ACDMember = , 
CPtr = )
-// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = , CPtr = )
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
+// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x)
 // CHECK: (A::D) AD = {}
-// CHECK: (A::D::E) ADE = (ADDMember = )
+// CHECK: (A::D::E) ADE = (ADDMember = 0)
 // CHECK: Dumping clang ast for 1 modules.
 // CHECK: TranslationUnitDecl {{.*}}
 // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition

Added: lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp?rev=346505=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp Fri Nov  9 08:06:44 2018
@@ -0,0 +1,35 @@
+// clang-format off
+// REQUIRES: lld
+
+// Make sure we can read variables from BSS
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- 
%t.obj
+// RUN: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s
+
+int GlobalVariable = 0;
+
+int main(int argc, char **argv) {
+  return 0;
+}
+
+// BSS:   Section {
+// BSS: Number: 3
+// BSS: Name: .data
+// BSS-NEXT:VirtualSize: 0x4
+// BSS-NEXT:VirtualAddress:
+// BSS-NEXT:RawDataSize: 0
+// BSS-NEXT:PointerToRawData: 0x0
+// BSS-NEXT:PointerToRelocations: 0x0
+// BSS-NEXT:PointerToLineNumbers: 0x0
+// BSS-NEXT:RelocationCount: 0
+// BSS-NEXT:LineNumberCount: 0
+// BSS-NEXT:Characteristics [ (0xC040)
+// BSS-NEXT:  IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
+// BSS-NEXT:  IMAGE_SCN_MEM_READ (0x4000)
+// BSS-NEXT:  IMAGE_SCN_MEM_WRITE (0x8000)
+// BSS-NEXT:]
+// BSS-NEXT:  }
+
+// CHECK: (int) GlobalVariable = 0

Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=346505=346504=346505=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Fri Nov  9 
08:06:44 2018
@@ -710,7 +710,10 @@ void ObjectFilePECOFF::CreateSections(Se
llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA &&
((const_sect_name == g_data_sect_name) ||
 (const_sect_name == 

[Lldb-commits] [lldb] r346502 - revert rL346478

2018-11-09 Thread Kadir Cetinkaya via lldb-commits
Author: kadircet
Date: Fri Nov  9 07:18:02 2018
New Revision: 346502

URL: http://llvm.org/viewvc/llvm-project?rev=346502=rev
Log:
revert rL346478

Summary:

Reviewers:

Subscribers:

Modified:
lldb/trunk/unittests/Host/FileSystemTest.cpp

Modified: lldb/trunk/unittests/Host/FileSystemTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSystemTest.cpp?rev=346502=346501=346502=diff
==
--- lldb/trunk/unittests/Host/FileSystemTest.cpp (original)
+++ lldb/trunk/unittests/Host/FileSystemTest.cpp Fri Nov  9 07:18:02 2018
@@ -69,8 +69,8 @@ public:
 return std::error_code();
   }
   // Map any symlink to "/symlink".
-  std::error_code getRealPath(const Twine , SmallVectorImpl ,
-  bool ExpandTilde = false) const override {
+  std::error_code getRealPath(const Twine ,
+  SmallVectorImpl ) const override {
 auto I = FilesAndDirs.find(Path.str());
 if (I == FilesAndDirs.end())
   return make_error_code(llvm::errc::no_such_file_or_directory);


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