[Lldb-commits] [lldb] r345569 - Utility: fix cross-compilation from Linux to Windows

2018-10-29 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Mon Oct 29 23:29:28 2018
New Revision: 345569

URL: http://llvm.org/viewvc/llvm-project?rev=345569&view=rev
Log:
Utility: fix cross-compilation from Linux to Windows

Only attempt to link against Backtrace if it is found.  Without this,
trying to cross-compile to Windows would try to link against
"Backtrace_LIBRARY-NOTFOUND.lib".

Modified:
lldb/trunk/source/Utility/CMakeLists.txt

Modified: lldb/trunk/source/Utility/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/CMakeLists.txt?rev=345569&r1=345568&r2=345569&view=diff
==
--- lldb/trunk/source/Utility/CMakeLists.txt (original)
+++ lldb/trunk/source/Utility/CMakeLists.txt Mon Oct 29 23:29:28 2018
@@ -22,7 +22,9 @@ if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
 list(APPEND LLDB_SYSTEM_LIBS atomic)
 endif()
 
-list(APPEND LLDB_SYSTEM_LIBS ${Backtrace_LIBRARY})
+if(Backtrace_FOUND)
+  list(APPEND LLDB_SYSTEM_LIBS ${Backtrace_LIBRARY})
+endif()
 
 if (NOT LLDB_DISABLE_PYTHON AND NOT LLVM_BUILD_STATIC)
   list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})


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


[Lldb-commits] [lldb] r348332 - gdb-remote: use elaborated type specifier for `Module`

2018-12-04 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Tue Dec  4 20:04:14 2018
New Revision: 348332

URL: http://llvm.org/viewvc/llvm-project?rev=348332&view=rev
Log:
gdb-remote: use elaborated type specifier for `Module`

When building with MSVC, the type `Module` is ambiguous due to both the
lldb_private and llvm namespaces being used.  Use the elaborated type
instead to resolve the ambiguity.

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=348332&r1=348331&r2=348332&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Dec  
4 20:04:14 2018
@@ -683,7 +683,7 @@ void ProcessGDBRemote::BuildDynamicRegis
   m_register_info.Finalize(GetTarget().GetArchitecture());
 }
 
-Status ProcessGDBRemote::WillLaunch(Module *module) {
+Status ProcessGDBRemote::WillLaunch(lldb_private::Module *module) {
   return WillLaunchOrAttach();
 }
 
@@ -799,7 +799,7 @@ Status ProcessGDBRemote::WillLaunchOrAtt
 //--
 // Process Control
 //--
-Status ProcessGDBRemote::DoLaunch(Module *exe_module,
+Status ProcessGDBRemote::DoLaunch(lldb_private::Module *exe_module,
   ProcessLaunchInfo &launch_info) {
   Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
   Status error;


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


[Lldb-commits] [lldb] r348556 - Host: remove Yield on Windows

2018-12-06 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Thu Dec  6 16:31:34 2018
New Revision: 348556

URL: http://llvm.org/viewvc/llvm-project?rev=348556&view=rev
Log:
Host: remove Yield on Windows

Windows provides a Yield function-like macro that allows a thread to
yield the CPU.  However, this conflicts with `Yield` in swift.  Undefine
`Yield` to allow building lldb with swift support.

Modified:
lldb/trunk/include/lldb/Host/windows/windows.h

Modified: lldb/trunk/include/lldb/Host/windows/windows.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/windows.h?rev=348556&r1=348555&r2=348556&view=diff
==
--- lldb/trunk/include/lldb/Host/windows/windows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/windows.h Thu Dec  6 16:31:34 2018
@@ -21,6 +21,7 @@
 #undef GetUserName
 #undef LoadImage
 #undef CreateProcess
+#undef Yield
 #undef far
 #undef near
 #undef FAR


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


[Lldb-commits] [lldb] r333041 - build: use cmake to find the libedit content

2018-05-22 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Tue May 22 16:24:46 2018
New Revision: 333041

URL: http://llvm.org/viewvc/llvm-project?rev=333041&view=rev
Log:
build: use cmake to find the libedit content

Use proper cmake techniques to detect where the libedit package resides.
This allows for the use of libedit from an alternative location which is
needed for supporting cross-compilation.

Added:
lldb/trunk/cmake/modules/FindLibEdit.cmake
Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/scripts/Python/modules/readline/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=333041&r1=333040&r2=333041&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Tue May 22 16:24:46 2018
@@ -29,6 +29,8 @@ endif ()
 set(LLDB_DISABLE_LIBEDIT ${LLDB_DEFAULT_DISABLE_LIBEDIT} CACHE BOOL "Disables 
the use of editline.")
 if (LLDB_DISABLE_LIBEDIT)
   add_definitions( -DLLDB_DISABLE_LIBEDIT )
+else()
+  find_package(LibEdit REQUIRED)
 endif()
 
 if(APPLE)

Added: lldb/trunk/cmake/modules/FindLibEdit.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/FindLibEdit.cmake?rev=333041&view=auto
==
--- lldb/trunk/cmake/modules/FindLibEdit.cmake (added)
+++ lldb/trunk/cmake/modules/FindLibEdit.cmake Tue May 22 16:24:46 2018
@@ -0,0 +1,62 @@
+#.rst:
+# FindLibEdit
+# ---
+#
+# Find libedit library and headers
+#
+# The module defines the following variables:
+#
+# ::
+#
+#   libedit_FOUND - true if libedit was found
+#   libedit_INCLUDE_DIRS  - include search path
+#   libedit_LIBRARIES - libraries to link
+#   libedit_VERSION   - version number
+
+if(libedit_INCLUDE_DIRS AND libedit_LIBRARIES)
+  set(libedit_FOUND TRUE)
+else()
+  find_package(PkgConfig QUIET)
+  pkg_check_modules(PC_LIBEDIT QUIET libedit)
+
+  find_path(libedit_INCLUDE_DIRS
+NAMES
+  histedit.h
+HINTS
+  ${PC_LIBEDIT_INCLUDEDIR}
+  ${PC_LIBEDIT_INCLUDE_DIRS}
+  ${CMAKE_INSTALL_FULL_INCLUDEDIR})
+  find_library(libedit_LIBRARIES
+   NAMES
+ edit libedit
+   HINTS
+ ${PC_LIBEDIT_LIBDIR}
+ ${PC_LIBEDIT_LIBRARY_DIRS}
+ ${CMAKE_INSTALL_FULL_LIBDIR})
+
+  if(libedit_INCLUDE_DIRS AND EXISTS "${libedit_INCLUDE_DIRS}/histedit.h")
+file(STRINGS "${libedit_INCLUDE_DIRS}/histedit.h"
+ libedit_major_version_str
+ REGEX "^#define[ \t]+LIBEDIT_MAJOR[ \t]+[0-9]+")
+string(REGEX REPLACE "^#define[ \t]+LIBEDIT_MAJOR[ \t]+([0-9]+)" "\\1"
+   LIBEDIT_MAJOR_VERSION "${libedit_major_version_str}")
+
+file(STRINGS "${libedit_INCLUDE_DIRS}/histedit.h"
+ libedit_minor_version_str
+ REGEX "^#define[ \t]+LIBEDIT_MINOR[ \t]+[0-9]+")
+string(REGEX REPLACE "^#define[ \t]+LIBEDIT_MINOR[ \t]+([0-9]+)" "\\1"
+   LIBEDIT_MINOR_VERSION "${libedit_minor_version_str}")
+
+set(libedit_VERSION_STRING 
"${libedit_major_version}.${libedit_minor_version}")
+  endif()
+
+  include(FindPackageHandleStandardArgs)
+  find_package_handle_standard_args(libedit
+REQUIRED_VARS
+  libedit_INCLUDE_DIRS
+  libedit_LIBRARIES
+VERSION_VAR
+  libedit_VERSION_STRING)
+  mark_as_advanced(libedit_INCLUDE_DIRS libedit_LIBRARIES)
+endif()
+

Modified: lldb/trunk/scripts/Python/modules/readline/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modules/readline/CMakeLists.txt?rev=333041&r1=333040&r2=333041&view=diff
==
--- lldb/trunk/scripts/Python/modules/readline/CMakeLists.txt (original)
+++ lldb/trunk/scripts/Python/modules/readline/CMakeLists.txt Tue May 22 
16:24:46 2018
@@ -6,9 +6,12 @@ SET(PYTHON_DIRECTORY python${PYTHON_VERS
 # Build the readline python module
 include_directories(${PYTHON_INCLUDE_DIR})
 add_library(readline SHARED readline.cpp)
+target_include_directories(readline
+   PRIVATE
+ ${libedit_INCLUDE_DIRS})
 
 if (NOT LLDB_DISABLE_LIBEDIT)
-  target_link_libraries(readline ${PYTHON_LIBRARY} edit)
+  target_link_libraries(readline ${PYTHON_LIBRARY} ${libedit_LIBRARIES})
 else()
   target_link_libraries(readline ${PYTHON_LIBRARY})
 endif()


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


[Lldb-commits] [lldb] r333863 - Python: adjust the include directories

2018-06-03 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun Jun  3 19:08:12 2018
New Revision: 333863

URL: http://llvm.org/viewvc/llvm-project?rev=333863&view=rev
Log:
Python: adjust the include directories

Restructure the include search order to adjust for libedit.  This
ensures that the variables are not unused if they are not defined.

Modified:
lldb/trunk/scripts/Python/modules/readline/CMakeLists.txt

Modified: lldb/trunk/scripts/Python/modules/readline/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modules/readline/CMakeLists.txt?rev=333863&r1=333862&r2=333863&view=diff
==
--- lldb/trunk/scripts/Python/modules/readline/CMakeLists.txt (original)
+++ lldb/trunk/scripts/Python/modules/readline/CMakeLists.txt Sun Jun  3 
19:08:12 2018
@@ -6,14 +6,13 @@ SET(PYTHON_DIRECTORY python${PYTHON_VERS
 # Build the readline python module
 include_directories(${PYTHON_INCLUDE_DIR})
 add_library(readline SHARED readline.cpp)
-target_include_directories(readline
-   PRIVATE
- ${libedit_INCLUDE_DIRS})
+target_link_libraries(readline ${PYTHON_LIBRARY})
 
 if (NOT LLDB_DISABLE_LIBEDIT)
-  target_link_libraries(readline ${PYTHON_LIBRARY} ${libedit_LIBRARIES})
-else()
-  target_link_libraries(readline ${PYTHON_LIBRARY})
+  target_include_directories(readline
+ PRIVATE
+   ${libedit_INCLUDE_DIRS})
+  target_link_libraries(readline ${libedit_LIBRARIES})
 endif()
 
 # FIXME: the LIBRARY_OUTPUT_PATH seems to be ignored - this is not a


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


[Lldb-commits] [lldb] r323363 - www: update lldb architecture doc

2018-01-24 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Wed Jan 24 11:00:08 2018
New Revision: 323363

URL: http://llvm.org/viewvc/llvm-project?rev=323363&view=rev
Log:
www: update lldb architecture doc

ArchSpec was moved from Core to Utility, so I modified the docs to
reflect that.

Patch by Alex Langford !

Modified:
lldb/trunk/www/architecture/index.html

Modified: lldb/trunk/www/architecture/index.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/architecture/index.html?rev=323363&r1=323362&r2=323363&view=diff
==
--- lldb/trunk/www/architecture/index.html (original)
+++ lldb/trunk/www/architecture/index.html Wed Jan 24 11:00:08 2018
@@ -130,7 +130,6 @@

  Address (section offset addressing)
  AddressRange
- Architecture specification
  Broadcaster / Event / Listener 
  Communication classes that use Connection 
objects
  Mangled names
@@ -276,6 +275,7 @@


  Abstract path manipulation (FileSpec)
+ Architecture specification
  Data buffers (DataBuffer, DataEncoder, 
DataExtractor)
  Logging
  Structured data manipulation (JSON)


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


[Lldb-commits] [lldb] r308489 - silence a couple of -Wqual-cast warning from GCC (NFC)

2017-07-19 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Wed Jul 19 08:46:21 2017
New Revision: 308489

URL: http://llvm.org/viewvc/llvm-project?rev=308489&view=rev
Log:
silence a couple of -Wqual-cast warning from GCC (NFC)

Cast to `const uint8_t *` instead of `uint8_t *` to avoid the warning
from GCC.

  EmulationStateARM.cpp:206:34: warning: cast from type 'const void*' to type 
'uint8_t* {aka unsigned char*}' casts away qualifiers [-Wcast-qual]

Cast to `const uint32_t *` and the explicitly cast away the const-ness
of the value.  This seems pretty sketchy as the `DataExtractor` holds a
const reference to the data.  However, this is no worse than before.

  ObjectFilePECOFF.cpp:540:78: warning: cast from type 'const uint8_t* {aka 
const unsigned char*}' to type 'uint32_t* {aka unsigned int*}' casts away 
qualifiers [-Wcast-qual]

Modified:
lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp?rev=308489&r1=308488&r2=308489&view=diff
==
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp Wed Jul 19 
08:46:21 2017
@@ -203,7 +203,8 @@ size_t EmulationStateARM::WritePseudoMem
 uint32_t value1;
 uint32_t value2;
 memcpy (&value1, dst, sizeof (uint32_t));
-memcpy (&value2, (uint8_t *) dst + sizeof (uint32_t), sizeof (uint32_t));
+memcpy(&value2, static_cast(dst) + sizeof(uint32_t),
+   sizeof(uint32_t));
 if (endian::InlHostByteOrder() == lldb::eByteOrderBig) {
   value1 = llvm::ByteSwap_32(value1);
   value2 = llvm::ByteSwap_32(value2);

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=308489&r1=308488&r2=308489&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Wed Jul 19 
08:46:21 2017
@@ -537,7 +537,8 @@ Symtab *ObjectFilePECOFF::GetSymtab() {
 
   // First 4 bytes should be zeroed after strtab_size has been read,
   // because it is used as offset 0 to encode a NULL string.
-  uint32_t *strtab_data_start = (uint32_t *)strtab_data.GetDataStart();
+  uint32_t *strtab_data_start = const_cast(
+  reinterpret_cast(strtab_data.GetDataStart()));
   strtab_data_start[0] = 0;
 
   offset = 0;


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


[Lldb-commits] [lldb] r311577 - ObjC: fix some -Wpedantic warnings by removing '; '

2017-08-23 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Wed Aug 23 10:00:14 2017
New Revision: 311577

URL: http://llvm.org/viewvc/llvm-project?rev=311577&view=rev
Log:
ObjC: fix some -Wpedantic warnings by removing ';'

Remove some stray ';' that were in the source code.  NFC.

Modified:
lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp?rev=311577&r1=311576&r2=311577&view=diff
==
--- lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp Wed Aug 23 10:00:14 2017
@@ -124,7 +124,7 @@ namespace Foundation109 {
   
   using NSArrayMSyntheticFrontEnd =
   GenericNSArrayMSyntheticFrontEnd;
-};
+}
   
 namespace Foundation1010 {
   struct DataDescriptor_32 {
@@ -147,7 +147,7 @@ namespace Foundation1010 {
   
   using NSArrayMSyntheticFrontEnd =
   GenericNSArrayMSyntheticFrontEnd;
-};
+}
   
 namespace Foundation1428 {
   struct DataDescriptor_32 {
@@ -166,7 +166,7 @@ namespace Foundation1428 {
   
   using NSArrayMSyntheticFrontEnd =
   GenericNSArrayMSyntheticFrontEnd;
-};
+}
   
 namespace Foundation1437 {
   template 


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


[Lldb-commits] [lldb] r311579 - Process: fix FXSAVE on x86

2017-08-23 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Wed Aug 23 10:23:12 2017
New Revision: 311579

URL: http://llvm.org/viewvc/llvm-project?rev=311579&view=rev
Log:
Process: fix FXSAVE on x86

The FXSAVE member `ftw` (FPU Tag Word) was given the wrong size (8-bit)
instead of the correct width (16-bit) as per the x87 Programmer's
Manual.  Adjust this to ensure that we print out the complete value for
the register.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py?rev=311579&r1=311578&r2=311579&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
 Wed Aug 23 10:23:12 2017
@@ -256,7 +256,7 @@ class RegisterCommandsTestCase(TestBase)
 self.expect(
 "register read ftag", substrs=[
 'ftag' + ' = ', str(
-"0x%0.2x" %
+"0x%0.4x" %
 (reg_value_ftag_initial | (
 1 << fstat_top_pointer_initial)))])
 reg_value_ftag_initial = reg_value_ftag_initial | (

Modified: 
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp?rev=311579&r1=311578&r2=311579&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp Wed 
Aug 23 10:23:12 2017
@@ -36,8 +36,7 @@ struct GPR {
 struct FPR_i386 {
   uint16_t fctrl; // FPU Control Word (fcw)
   uint16_t fstat; // FPU Status Word (fsw)
-  uint8_t ftag;   // FPU Tag Word (ftw)
-  uint8_t reserved_1; // Reserved
+  uint16_t ftag;  // FPU Tag Word (ftw)
   uint16_t fop;   // Last Instruction Opcode (fop)
   union {
 struct {

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h?rev=311579&r1=311578&r2=311579&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h Wed Aug 23 
10:23:12 2017
@@ -257,8 +257,7 @@ struct XMMReg {
 struct FXSAVE {
   uint16_t fctrl; // FPU Control Word (fcw)
   uint16_t fstat; // FPU Status Word (fsw)
-  uint8_t ftag;   // FPU Tag Word (ftw)
-  uint8_t reserved_1; // Reserved
+  uint16_t ftag;  // FPU Tag Word (ftw)
   uint16_t fop;   // Last Instruction Opcode (fop)
   union {
 struct {


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


Re: [Lldb-commits] [lldb] r311579 - Process: fix FXSAVE on x86

2017-08-23 Thread Saleem Abdulrasool via lldb-commits
This would be nice to merge to 5.0 IMO.  It fixes reading the x87 FPU
state.  What do you think Greg?

On Wed, Aug 23, 2017 at 10:24 AM Saleem Abdulrasool via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: compnerd
> Date: Wed Aug 23 10:23:12 2017
> New Revision: 311579
>
> URL: http://llvm.org/viewvc/llvm-project?rev=311579&view=rev
> Log:
> Process: fix FXSAVE on x86
>
> The FXSAVE member `ftw` (FPU Tag Word) was given the wrong size (8-bit)
> instead of the correct width (16-bit) as per the x87 Programmer's
> Manual.  Adjust this to ensure that we print out the complete value for
> the register.
>
> Modified:
>
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
> lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
> lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h
>
> Modified:
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py?rev=311579&r1=311578&r2=311579&view=diff
>
> ==
> ---
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
> (original)
> +++
> lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/register_command/TestRegisters.py
> Wed Aug 23 10:23:12 2017
> @@ -256,7 +256,7 @@ class RegisterCommandsTestCase(TestBase)
>  self.expect(
>  "register read ftag", substrs=[
>  'ftag' + ' = ', str(
> -"0x%0.2x" %
> +"0x%0.4x" %
>  (reg_value_ftag_initial | (
>  1 << fstat_top_pointer_initial)))])
>  reg_value_ftag_initial = reg_value_ftag_initial | (
>
> Modified:
> lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp?rev=311579&r1=311578&r2=311579&view=diff
>
> ==
> ---
> lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp
> (original)
> +++
> lldb/trunk/source/Plugins/Process/Utility/RegisterContextLinux_i386.cpp Wed
> Aug 23 10:23:12 2017
> @@ -36,8 +36,7 @@ struct GPR {
>  struct FPR_i386 {
>uint16_t fctrl; // FPU Control Word (fcw)
>uint16_t fstat; // FPU Status Word (fsw)
> -  uint8_t ftag;   // FPU Tag Word (ftw)
> -  uint8_t reserved_1; // Reserved
> +  uint16_t ftag;  // FPU Tag Word (ftw)
>uint16_t fop;   // Last Instruction Opcode (fop)
>union {
>  struct {
>
> Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h?rev=311579&r1=311578&r2=311579&view=diff
>
> ==
> --- lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h
> (original)
> +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContext_x86.h Wed
> Aug 23 10:23:12 2017
> @@ -257,8 +257,7 @@ struct XMMReg {
>  struct FXSAVE {
>uint16_t fctrl; // FPU Control Word (fcw)
>uint16_t fstat; // FPU Status Word (fsw)
> -  uint8_t ftag;   // FPU Tag Word (ftw)
> -  uint8_t reserved_1; // Reserved
> +  uint16_t ftag;  // FPU Tag Word (ftw)
>uint16_t fop;   // Last Instruction Opcode (fop)
>union {
>  struct {
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r311582 - test: fix missed test

2017-08-23 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Wed Aug 23 11:05:19 2017
New Revision: 311582

URL: http://llvm.org/viewvc/llvm-project?rev=311582&view=rev
Log:
test: fix missed test

I had built without python bindings and did not find this in the grep
output.  Adjust the test output for the printing format update.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py?rev=311582&r1=311581&r2=311582&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 Wed Aug 23 11:05:19 2017
@@ -137,7 +137,7 @@ class LinuxCoreTestCase(TestBase):
 values = {}
 values["fctrl"] = "0x037f"
 values["fstat"] = "0x"
-values["ftag"] = "0xff"
+values["ftag"] = "0x00ff"
 values["fop"] = "0x"
 values["fiseg"] = "0x"
 values["fioff"] = "0x0040011e"


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


[Lldb-commits] [lldb] r312841 - Plugins: fix resolution ambiguity in PDB plugin

2017-09-08 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Fri Sep  8 17:13:49 2017
New Revision: 312841

URL: http://llvm.org/viewvc/llvm-project?rev=312841&view=rev
Log:
Plugins: fix resolution ambiguity in PDB plugin

A clang change caused the inclusion of `llvm::Type` and
`lldb_private::Type` to be pulled into the global namespace due to the
`using namespace llvm;` and `using namespace lldb_private;`.  Explicitly
qualify the `Type` to resolve the ambiguity.  NFC

Modified:
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp?rev=312841&r1=312840&r2=312841&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Fri Sep  8 
17:13:49 2017
@@ -95,11 +95,11 @@ lldb::TypeSP PDBASTParser::CreateLLDBTyp
 
 m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), true);
 
-return std::make_shared(type.getSymIndexId(), m_ast.GetSymbolFile(),
-  ConstString(udt->getName()), 
udt->getLength(),
-  nullptr, LLDB_INVALID_UID,
-  Type::eEncodingIsUID, decl, clang_type,
-  Type::eResolveStateForward);
+return std::make_shared(
+type.getSymIndexId(), m_ast.GetSymbolFile(),
+ConstString(udt->getName()), udt->getLength(), nullptr,
+LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl, clang_type,
+lldb_private::Type::eResolveStateForward);
   } else if (auto enum_type = llvm::dyn_cast(&type)) {
 std::string name = enum_type->getName();
 lldb::Encoding encoding =
@@ -117,12 +117,12 @@ lldb::TypeSP PDBASTParser::CreateLLDBTyp
   AddEnumValue(ast_enum, *enum_value);
 }
 
-return std::make_shared(type.getSymIndexId(), m_ast.GetSymbolFile(),
-  ConstString(name), bytes, nullptr,
-  LLDB_INVALID_UID, Type::eEncodingIsUID, decl,
-  ast_enum, Type::eResolveStateFull);
+return std::make_shared(
+type.getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name), bytes,
+nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
+ast_enum, lldb_private::Type::eResolveStateFull);
   } else if (auto type_def = llvm::dyn_cast(&type)) {
-Type *target_type =
+lldb_private::Type *target_type =
 m_ast.GetSymbolFile()->ResolveTypeUID(type_def->getTypeId());
 std::string name = type_def->getName();
 uint64_t bytes = type_def->getLength();
@@ -133,16 +133,17 @@ lldb::TypeSP PDBASTParser::CreateLLDBTyp
 m_ast.GetSymbolFile()->GetDeclContextForUID(target_type->GetID());
 CompilerType ast_typedef =
 m_ast.CreateTypedefType(target_ast_type, name.c_str(), 
target_decl_ctx);
-return std::make_shared(
+return std::make_shared(
 type_def->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name),
-bytes, nullptr, target_type->GetID(), Type::eEncodingIsTypedefUID, 
decl,
-ast_typedef, Type::eResolveStateFull);
+bytes, nullptr, target_type->GetID(),
+lldb_private::Type::eEncodingIsTypedefUID, decl, ast_typedef,
+lldb_private::Type::eResolveStateFull);
   } else if (auto func_sig = llvm::dyn_cast(&type)) {
 auto arg_enum = func_sig->getArguments();
 uint32_t num_args = arg_enum->getChildCount();
 std::vector arg_list(num_args);
 while (auto arg = arg_enum->getNext()) {
-  Type *arg_type =
+  lldb_private::Type *arg_type =
   m_ast.GetSymbolFile()->ResolveTypeUID(arg->getSymIndexId());
   // If there's some error looking up one of the dependent types of this
   // function signature, bail.
@@ -152,7 +153,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTyp
   arg_list.push_back(arg_ast_type);
 }
 auto pdb_return_type = func_sig->getReturnType();
-Type *return_type =
+lldb_private::Type *return_type =
 
m_ast.GetSymbolFile()->ResolveTypeUID(pdb_return_type->getSymIndexId());
 // If there's some error looking up one of the dependent types of this
 // function signature, bail.
@@ -167,23 +168,24 @@ lldb::TypeSP PDBASTParser::CreateLLDBTyp
 CompilerType func_sig_ast_type = m_ast.CreateFunctionType(
 return_ast_type, &arg_list[0], num_args, false, type_quals);
 
-return std::make_shared(
+return std::make_shared(
 func_sig->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(), 0,
-nullptr, LLDB_INVALID_UID, Type::eEncodingIsUID, decl,
-func_sig_ast_type, Type::eResolveStateFull);
+nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
+func_sig_ast_type, lldb_private::Type::eResolveStateFul

Re: [Lldb-commits] LLGS for Free/NetBSD (was: Re: [PATCH] D25756: FreeBSD ARM support for software single step.)

2016-10-24 Thread Saleem Abdulrasool via lldb-commits
On Mon, Oct 24, 2016 at 11:38 AM, Ed Maste via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> On 24 October 2016 at 06:26, Pavel Labath  wrote:
> >
> > It's not my place to tell you how to work, but I'd recommend a
> > different approach to this. If you base your work on the current
> > FreeBSD in-process plugin, then when you get around to actually
> > implementing remote support, you will find that you will have to
> > rewrite most of what you have already done to work with lldb-server,
> > as it uses completely different class hierarchies and everything. I'd
> > recommend starting with lldb-server right away. It's going to be a bit
> > more work as (I assume) freebsd implementation is closer to what you
> > need than linux, but I think it will save you time in the long run. I
> > can help you with factoring out any linux-specific code that you
> > encounter.
>
> I definitely second the approach Pavel suggests here, and am happy to
> work with others on refactoring the Linux lldb-server so that we can
> get it to support both FreeBSD and NetBSD at the same time.
>
> A direct port of the current FreeBSD support probably would result in
> a basic level of support running sooner, but that work would be
> largely thrown away in a future migration to lldb-server.
>

Just to throw out another option: DS2 (DebugServer2) at
http://github.com/facebook/ds2 may be another option to getting remote
debugging working.  It already has basic BSD support, so adding NetBSD
support shouldn't be too difficult.


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

-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r250661 - Silence some -Wunused-but-set-variable with gcc 5.2.0

2015-10-18 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun Oct 18 14:34:31 2015
New Revision: 250661

URL: http://llvm.org/viewvc/llvm-project?rev=250661&view=rev
Log:
Silence some -Wunused-but-set-variable with gcc 5.2.0

Cleanup some unused variables.  NFC.

Modified:
lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp

lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp

Modified: 
lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp?rev=250661&r1=250660&r2=250661&view=diff
==
--- lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp 
(original)
+++ lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp Sun 
Oct 18 14:34:31 2015
@@ -908,22 +908,16 @@ EmulateInstructionARM64::EmulateLDRSTRIm
 }
 
 MemOp memop;
-bool is_signed;
-uint32_t regsize;
 
 if (Bit32(opc, 1) == 0)
 {
 memop = Bit32(opc, 0) == 1 ? MemOp_LOAD : MemOp_STORE;
-regsize = size == 3 ? 64 : 32;
-is_signed = false;
 }
 else
 {
 memop = MemOp_LOAD;
 if (size == 2 && Bit32(opc, 0) == 1)
 return false;
-regsize = Bit32(opc, 0) == 1 ? 32 : 64;
-is_signed = true;
 }
 
 Error error;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp?rev=250661&r1=250660&r2=250661&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp Sun Oct 18 
14:34:31 2015
@@ -107,7 +107,6 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
 dwarf->m_die_to_type[die.GetDIE()] = DIE_IS_BEING_PARSED;
 
 const size_t num_attributes = 
die.GetAttributes(attributes);
-uint32_t encoding = 0;
 lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
 
 if (num_attributes > 0)
@@ -129,7 +128,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
 byte_size = form_value.Unsigned();
 break;
 case DW_AT_encoding:
-encoding = form_value.Unsigned();
+// = form_value.Unsigned();
 break;
 case DW_AT_type:
 encoding_uid = form_value.Reference();
@@ -510,7 +509,6 @@ DWARFASTParserGo::ParseChildParameters(c
 const size_t num_attributes = die.GetAttributes(attributes);
 if (num_attributes > 0)
 {
-const char *name = NULL;
 Declaration decl;
 dw_offset_t param_type_die_offset = DW_INVALID_OFFSET;
 
@@ -524,7 +522,7 @@ DWARFASTParserGo::ParseChildParameters(c
 switch (attr)
 {
 case DW_AT_name:
-name = form_value.AsCString();
+// = form_value.AsCString();
 break;
 case DW_AT_type:
 param_type_die_offset = 
form_value.Reference();

Modified: 
lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=250661&r1=250660&r2=250661&view=diff
==
--- 
lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
 Sun Oct 18 14:34:31 2015
@@ -117,21 +117,13 @@ UnwindAssemblyInstEmulation::GetNonCallS
 
 // cache the pc register number (in whatever register 
numbering this UnwindPlan uses) for
 // quick reference during instruction parsing.
-uint32_t pc_reg_num = LLDB_INVALID_REGNUM;
 RegisterInfo pc_reg_info;
-if (m_inst_emulator_ap->GetRegisterInfo (eRegisterKindGeneric, 
LLDB_REGNUM_GENERIC_PC, pc_reg_info))
-pc_reg_num = 
pc_reg_info.kinds[unwind_plan.GetRegisterKind()];
-else
-pc_reg_num = LLDB_INVALID_REGNUM;
+ 

[Lldb-commits] [lldb] r250662 - Silence -Wqual-cast warnings from GCC 5.2

2015-10-18 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun Oct 18 14:34:38 2015
New Revision: 250662

URL: http://llvm.org/viewvc/llvm-project?rev=250662&view=rev
Log:
Silence -Wqual-cast warnings from GCC 5.2

There were a number of const qualifiers being cast away which caused warnings.
This cluttered the output hiding real errors.  Silence them by explicit casting.
NFC.

Modified:
lldb/trunk/include/lldb/DataFormatters/StringPrinter.h
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Core/DataExtractor.cpp
lldb/trunk/source/Core/Scalar.cpp
lldb/trunk/source/Core/StreamString.cpp
lldb/trunk/source/DataFormatters/StringPrinter.cpp
lldb/trunk/source/Host/common/Host.cpp
lldb/trunk/source/Interpreter/Args.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Symbol/CompilerType.cpp
lldb/trunk/source/Symbol/Type.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/StringPrinter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/StringPrinter.h?rev=250662&r1=250661&r2=250662&view=diff
==
--- lldb/trunk/include/lldb/DataFormatters/StringPrinter.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/StringPrinter.h Sun Oct 18 14:34:38 
2015
@@ -432,13 +432,13 @@ namespace lldb_private {
 m_size(size),
 m_deleter(deleter)
 {}
-
+
 StringPrinterBufferPointer(const U* bytes, S size, Deleter 
deleter = nullptr) :
-m_data((T*)bytes),
+m_data(reinterpret_cast(bytes)),
 m_size(size),
 m_deleter(deleter)
 {}
-
+
 StringPrinterBufferPointer(StringPrinterBufferPointer&& rhs) :
 m_data(rhs.m_data),
 m_size(rhs.m_size),

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=250662&r1=250661&r2=250662&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Sun Oct 18 14:34:38 2015
@@ -527,20 +527,21 @@ protected:
1, 
type_list);
 }
-
+
 if (type_list.GetSize() == 0 && lookup_type_name.GetCString() && 
*lookup_type_name.GetCString() == '$')
 {
 if (ClangPersistentVariables *persistent_vars = 
llvm::dyn_cast_or_null(target->GetPersistentExpressionStateForLanguage(lldb::eLanguageTypeC)))
 {
 clang::TypeDecl *tdecl = 
persistent_vars->GetPersistentType(ConstString(lookup_type_name));
-
+
 if (tdecl)
 {
-
clang_ast_type.SetCompilerType(ClangASTContext::GetASTContext(&tdecl->getASTContext()),(const
 lldb::opaque_compiler_type_t)tdecl->getTypeForDecl());
+
clang_ast_type.SetCompilerType(ClangASTContext::GetASTContext(&tdecl->getASTContext()),
+   
reinterpret_cast(const_cast(tdecl->getTypeForDecl(;
 }
 }
 }
-
+
 if (clang_ast_type.IsValid() == false)
 {
 if (type_list.GetSize() == 0)

Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=250662&r1=250661&r2=250662&view=diff
==
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Sun Oct 18 14:34:38 2015
@@ -142,8 +142,8 @@ DataExtractor::DataExtractor () :
 // The data must stay around as long as this object is valid.
 //--
 DataExtractor::DataExtractor (const void* data, offset_t length, ByteOrder 
endian, uint32_t addr_size, uint32_t target_byte_size/*=1*/) :
-m_start ((uint8_t*)data),
-m_end   ((uint8_t*)data + length),
+m_start (const_cast(reinterpret_cast(data))),
+m_end   (const_cast(reinterpret_cast(data)) + length),
 m_byte_order(endian),
 m_addr_size (addr_size),
 m_data_sp   (),
@@ -287,7 +287,7 @@ DataExtractor::SetData (const void *byte
 }
 else
 {
-m_start = (uint8_t *)bytes;
+m_start = const_cast(reinterpret_cast(bytes));
 m_end = m_start + length;
 }
 return GetByteSize();


[Lldb-commits] [lldb] r250667 - Silence -Wreturn-type with gcc 5.2

2015-10-18 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun Oct 18 15:51:18 2015
New Revision: 250667

URL: http://llvm.org/viewvc/llvm-project?rev=250667&view=rev
Log:
Silence -Wreturn-type with gcc 5.2

The switch is fully covered, mark "default" as unreachable.  NFC.

Modified:
lldb/trunk/source/DataFormatters/StringPrinter.cpp

Modified: lldb/trunk/source/DataFormatters/StringPrinter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/StringPrinter.cpp?rev=250667&r1=250666&r2=250667&view=diff
==
--- lldb/trunk/source/DataFormatters/StringPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/StringPrinter.cpp Sun Oct 18 15:51:18 2015
@@ -258,6 +258,7 @@ StringPrinter::GetDefaultEscapingHelper
 return GetPrintable(StringPrinter::StringElementType::ASCII, 
buffer, buffer_end, next);
 };
 }
+llvm_unreachable("bad element type");
 }
 
 // use this call if you already have an LLDB-side buffer for the data


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


[Lldb-commits] [lldb] r250673 - Python: follow python guidelines for header usage

2015-10-18 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun Oct 18 20:16:17 2015
New Revision: 250673

URL: http://llvm.org/viewvc/llvm-project?rev=250673&view=rev
Log:
Python: follow python guidelines for header usage

Python requires that Python.h is included before any std header.  Not doing so
results in conflicts with standards macros such as `_XOPEN_SOURCE`.  NFC.

Modified:
lldb/trunk/scripts/Python/modules/readline/readline.cpp

Modified: lldb/trunk/scripts/Python/modules/readline/readline.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modules/readline/readline.cpp?rev=250673&r1=250672&r2=250673&view=diff
==
--- lldb/trunk/scripts/Python/modules/readline/readline.cpp (original)
+++ lldb/trunk/scripts/Python/modules/readline/readline.cpp Sun Oct 18 20:16:17 
2015
@@ -1,6 +1,10 @@
-#include 
+// NOTE: Since Python may define some pre-processor definitions which affect 
the
+// standard headers on some systems, you must include Python.h before any
+// standard headers are included.
 #include "Python.h"
 
+#include 
+
 #ifndef LLDB_DISABLE_LIBEDIT
 #include 
 #endif


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


Re: [Lldb-commits] [PATCH] D19604: Allow ObjectFilePECOFF to initialize with ARM binaries.

2016-04-30 Thread Saleem Abdulrasool via lldb-commits
compnerd accepted this revision.
This revision is now accepted and ready to land.


Comment at: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp:149
@@ +148,3 @@
+{
+spec.SetTriple("armv7-pc-windows");
+specs.Append(ModuleSpec(file, spec));

This may be a bit tricky.  `armv7-windows` is unsupported in LLVM/clang (and we 
silently rewrite that in the clang frontend), and you need `thumbv7-windows` 
(ARM NT).  Though, it is possible that LLDB is unable to handle that 
distinction right now.

That said, the `pc` vendor is silly, and `unknown` sounds better to me, but 
this shouldn't matter too much.

Finally, the Windows environment defaults to `msvc` here, which has a slight 
issue that it can sometimes fail to generate an assembly listing (the code 
generation is correct, its just a serialization issue caused by not having 
invested sufficiently in generating MASM style assembly listing).

The safest triple would be `thumbv7-unknown-windows-itanium`.  But, if lldb is 
going to ensure that the code is handled as thumb, using `armv7` should be fine.


http://reviews.llvm.org/D19604



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


Re: [Lldb-commits] [PATCH] D19604: Allow ObjectFilePECOFF to initialize with ARM binaries.

2016-05-02 Thread Saleem Abdulrasool via lldb-commits
compnerd added a comment.

The few lines above are for the x86, x86_64 targets, which traditionally use 
the pc vendor as a legacy label.


http://reviews.llvm.org/D19604



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


[Lldb-commits] [lldb] r268755 - debugserver: fix some -Wformat-pedantic warnings

2016-05-06 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Fri May  6 12:32:58 2016
New Revision: 268755

URL: http://llvm.org/viewvc/llvm-project?rev=268755&view=rev
Log:
debugserver: fix some -Wformat-pedantic warnings

Perform explicit casts for the log message to address some `-Wformat-pedantic`
warnings from clang.  NFC.

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

Modified: lldb/trunk/tools/debugserver/source/DNB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.cpp?rev=268755&r1=268754&r2=268755&view=diff
==
--- lldb/trunk/tools/debugserver/source/DNB.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNB.cpp Fri May  6 12:32:58 2016
@@ -360,21 +360,13 @@ DNBProcessLaunch (const char *path,
   char *err_str,
   size_t err_len)
 {
-DNBLogThreadedIf(LOG_PROCESS, "%s ( path='%s', argv = %p, envp = %p, 
working_dir=%s, stdin=%s, stdout=%s, stderr=%s, no-stdio=%i, launch_flavor = 
%u, disable_aslr = %d, err = %p, err_len = %llu) called...",
- __FUNCTION__, 
- path, 
- argv, 
- envp, 
- working_directory,
- stdin_path,
- stdout_path,
- stderr_path,
- no_stdio,
- launch_flavor, 
- disable_aslr, 
- err_str, 
- (uint64_t)err_len);
-
+DNBLogThreadedIf(LOG_PROCESS, "%s ( path='%s', argv = %p, envp = %p, 
working_dir=%s, stdin=%s, stdout=%s, "
+  "stderr=%s, no-stdio=%i, launch_flavor = %u, 
disable_aslr = %d, err = %p, err_len = "
+  "%llu) called...",
+ __FUNCTION__, path, static_cast(argv), 
static_cast(envp), working_directory,
+ stdin_path, stdout_path, stderr_path, no_stdio, 
launch_flavor, disable_aslr,
+ static_cast(err_str), 
static_cast(err_len));
+
 if (err_str && err_len > 0)
 err_str[0] = '\0';
 struct stat path_stat;
@@ -548,7 +540,6 @@ DNBProcessAttach (nub_process_t attach_p
 
 switch (pid_state)
 {
-default:
 case eStateInvalid:
 case eStateUnloaded:
 case eStateAttaching:


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


[Lldb-commits] [lldb] r268756 - debugserver: fix a few -Wcovered-swift-default warnings

2016-05-06 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Fri May  6 12:33:01 2016
New Revision: 268756

URL: http://llvm.org/viewvc/llvm-project?rev=268756&view=rev
Log:
debugserver: fix a few -Wcovered-swift-default warnings

Remove a couple of `default` cases from switches which are covered.  This is
beneficial since it would allow the compiler to indicate when a new enum value
is added and the switch is not updated.  Fixes some warnings from clang.  NFC.

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

Modified: lldb/trunk/tools/debugserver/source/DNBDataRef.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNBDataRef.cpp?rev=268756&r1=268755&r2=268756&view=diff
==
--- lldb/trunk/tools/debugserver/source/DNBDataRef.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNBDataRef.cpp Fri May  6 12:33:01 2016
@@ -362,7 +362,6 @@ DNBDataRef::Dump
 // the snprintf call each time through this loop
 switch (type)
 {
-default:
 case TypeUInt8:   str_offset += snprintf(str + str_offset, 
sizeof(str) - str_offset, format ? format : " %2.2x", Get8(&offset)); break;
 case TypeChar:
 {

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=268756&r1=268755&r2=268756&view=diff
==
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri May  6 12:33:01 2016
@@ -1026,7 +1026,6 @@ RNBRemote::ThreadFunctionReadRemoteData(
 case rnb_success:
 break;
 
-default:
 case rnb_err:
 DNBLogThreadedIf (LOG_RNB_REMOTE, "RNBSocket::GetCommData 
returned error %u", err);
 done = true;


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


[Lldb-commits] [lldb] r268759 - debugserver; fix -Wunused-local-typedef, -Wunused-variable warnings

2016-05-06 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Fri May  6 12:33:13 2016
New Revision: 268759

URL: http://llvm.org/viewvc/llvm-project?rev=268759&view=rev
Log:
debugserver; fix -Wunused-local-typedef, -Wunused-variable warnings

Remove the typedef and local structure which was unused.  Fixes last of the new
clang warnings in the debugserver build.  NFC.

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=268759&r1=268758&r2=268759&view=diff
==
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri May  6 12:33:13 2016
@@ -3555,13 +3555,6 @@ RNBRemote::HandlePacket_v (const char *p
 }
 else if (strstr (p, "vCont") == p)
 {
-typedef struct
-{
-nub_thread_t tid;
-char action;
-int signal;
-} vcont_action_t;
-
 DNBThreadResumeActions thread_actions;
 char *c = (char *)(p += strlen("vCont"));
 char *c_end = c + strlen(c);


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


[Lldb-commits] [lldb] r268757 - debugserver: fix some -Wpessimizing-move warnings

2016-05-06 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Fri May  6 12:33:04 2016
New Revision: 268757

URL: http://llvm.org/viewvc/llvm-project?rev=268757&view=rev
Log:
debugserver: fix some -Wpessimizing-move warnings

Remove the unnecessary use of std::move to permit the compiler to perform NVRO
instead.  Fixes more warnings from clang.  NFC.

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=268757&r1=268756&r2=268757&view=diff
==
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri May  6 12:33:04 2016
@@ -2570,13 +2570,13 @@ RNBRemote::DispatchQueueOffsets::GetThre
 nub_addr_t pointer_to_label_address = dispatch_queue_t + 
dqo_label;
 nub_addr_t label_addr = DNBProcessMemoryReadPointer (pid, 
pointer_to_label_address);
 if (label_addr)
-queue_name = std::move(DNBProcessMemoryReadCString (pid, 
label_addr));
+queue_name = DNBProcessMemoryReadCString(pid, label_addr);
 }
 else
 {
 // libdispatch versions 1-3, dispatch name is a fixed width 
char array
 // in the queue structure.
-queue_name = std::move(DNBProcessMemoryReadCStringFixed(pid, 
dispatch_queue_t + dqo_label, dqo_label_size));
+queue_name = DNBProcessMemoryReadCStringFixed(pid, 
dispatch_queue_t + dqo_label, dqo_label_size);
 }
 }
 }
@@ -5687,7 +5687,7 @@ RNBRemote::HandlePacket_qSymbol (const c
 if (*p)
 {
 // We have a symbol name
-symbol_name = std::move(decode_hex_ascii_string(p));
+symbol_name = decode_hex_ascii_string(p);
 if (!symbol_value_str.empty())
 {
 nub_addr_t symbol_value = decode_uint64(symbol_value_str.c_str(), 
16);


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


[Lldb-commits] [lldb] r268758 - debugserver: fix a couple of -Wmissing-field-initializers warnings

2016-05-06 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Fri May  6 12:33:09 2016
New Revision: 268758

URL: http://llvm.org/viewvc/llvm-project?rev=268758&view=rev
Log:
debugserver: fix a couple of -Wmissing-field-initializers warnings

Explicitly provide an initializer for the std::vector in the constructed type.
Addresses -Wmissing-field-initializers warnings from clang.  NFC.

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=268758&r1=268757&r2=268758&view=diff
==
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Fri May  6 12:33:09 2016
@@ -1227,7 +1227,9 @@ RNBRemote::InitializeRegisters (bool for
 register_map_entry_t reg_entry = {
 regnum++,   // register number 
starts at zero and goes up with no gaps
 reg_data_offset,// Offset into 
register context data, no gaps between registers
-reg_sets[set].registers[reg]// DNBRegisterInfo
+reg_sets[set].registers[reg],   // DNBRegisterInfo
+{},
+{},
 };
 
 name_to_regnum[reg_entry.nub_info.name] = 
reg_entry.debugserver_regnum;


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


[Lldb-commits] [lldb] r269598 - Fix a few -Wformat-pedantic warnings

2016-05-15 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun May 15 13:18:13 2016
New Revision: 269598

URL: http://llvm.org/viewvc/llvm-project?rev=269598&view=rev
Log:
Fix a few -Wformat-pedantic warnings

Clean up some newly introduced -Wformat-pedantic warnings (%p expects a void *).

Modified:
lldb/trunk/source/Core/Listener.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Modified: lldb/trunk/source/Core/Listener.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Listener.cpp?rev=269598&r1=269597&r2=269598&view=diff
==
--- lldb/trunk/source/Core/Listener.cpp (original)
+++ lldb/trunk/source/Core/Listener.cpp Sun May 15 13:18:13 2016
@@ -60,7 +60,7 @@ Listener::~Listener()
 Clear();
 
 if (log)
-log->Printf("%p Listener::%s('%s')", this, __FUNCTION__, 
m_name.c_str());
+log->Printf("%p Listener::%s('%s')", static_cast(this), 
__FUNCTION__, m_name.c_str());
 }
 
 void
@@ -89,7 +89,7 @@ Listener::Clear()
 }
 
 if (log)
-log->Printf("%p Listener::%s('%s')", this, __FUNCTION__, 
m_name.c_str());
+log->Printf("%p Listener::%s('%s')", static_cast(this), 
__FUNCTION__, m_name.c_str());
 }
 
 uint32_t

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=269598&r1=269597&r2=269598&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Sun May 
15 13:18:13 2016
@@ -3678,7 +3678,7 @@ ProcessGDBRemote::MonitorDebugserverProc
 
 std::shared_ptr process_sp = process_wp.lock();
 if (log)
-log->Printf("ProcessGDBRemote::%s(process = %p)", __FUNCTION__, 
process_sp.get());
+log->Printf("ProcessGDBRemote::%s(process = %p)", __FUNCTION__, 
static_cast(process_sp.get()));
 if (!process_sp || process_sp->m_debugserver_pid != debugserver_pid)
 return handled;
 


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


[Lldb-commits] [lldb] r269599 - Symbol: fix -Wcovered-switch warning

2016-05-15 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun May 15 13:18:16 2016
New Revision: 269599

URL: http://llvm.org/viewvc/llvm-project?rev=269599&view=rev
Log:
Symbol: fix -Wcovered-switch warning

Add the Float128 type to the enumeration.  Float128 is covered under IEEE754 as
a quad precision floating point value.

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=269599&r1=269598&r2=269599&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Sun May 15 13:18:16 2016
@@ -4803,121 +4803,127 @@ ClangASTContext::GetEncoding (lldb::opaq
 {
 if (!type)
 return lldb::eEncodingInvalid;
-
+
 count = 1;
 clang::QualType qual_type(GetCanonicalQualType(type));
-
+
 switch (qual_type->getTypeClass())
 {
 case clang::Type::UnaryTransform:
 break;
-
+
 case clang::Type::FunctionNoProto:
 case clang::Type::FunctionProto:
 break;
-
+
 case clang::Type::IncompleteArray:
 case clang::Type::VariableArray:
 break;
-
+
 case clang::Type::ConstantArray:
 break;
-
+
 case clang::Type::ExtVector:
 case clang::Type::Vector:
 // TODO: Set this to more than one???
 break;
-
+
 case clang::Type::Builtin:
 switch (llvm::cast(qual_type)->getKind())
-{
-case clang::BuiltinType::Void:
-break;
-
-case clang::BuiltinType::Bool:
-case clang::BuiltinType::Char_S:
-case clang::BuiltinType::SChar:
-case clang::BuiltinType::WChar_S:
-case clang::BuiltinType::Char16:
-case clang::BuiltinType::Char32:
-case clang::BuiltinType::Short:
-case clang::BuiltinType::Int:
-case clang::BuiltinType::Long:
-case clang::BuiltinType::LongLong:
-case clang::BuiltinType::Int128:return lldb::eEncodingSint;
-
-case clang::BuiltinType::Char_U:
-case clang::BuiltinType::UChar:
-case clang::BuiltinType::WChar_U:
-case clang::BuiltinType::UShort:
-case clang::BuiltinType::UInt:
-case clang::BuiltinType::ULong:
-case clang::BuiltinType::ULongLong:
-case clang::BuiltinType::UInt128:   return lldb::eEncodingUint;
-
-case clang::BuiltinType::Half:
-case clang::BuiltinType::Float:
-case clang::BuiltinType::Double:
-case clang::BuiltinType::LongDouble:return 
lldb::eEncodingIEEE754;
-
-case clang::BuiltinType::ObjCClass:
-case clang::BuiltinType::ObjCId:
-case clang::BuiltinType::ObjCSel:   return lldb::eEncodingUint;
-
-case clang::BuiltinType::NullPtr:   return lldb::eEncodingUint;
-
-case clang::BuiltinType::Kind::ARCUnbridgedCast:
-case clang::BuiltinType::Kind::BoundMember:
-case clang::BuiltinType::Kind::BuiltinFn:
-case clang::BuiltinType::Kind::Dependent:
-case clang::BuiltinType::Kind::OCLClkEvent:
-case clang::BuiltinType::Kind::OCLEvent:
-case clang::BuiltinType::Kind::OCLImage1dRO:
-case clang::BuiltinType::Kind::OCLImage1dWO:
-case clang::BuiltinType::Kind::OCLImage1dRW:
-case clang::BuiltinType::Kind::OCLImage1dArrayRO:
-case clang::BuiltinType::Kind::OCLImage1dArrayWO:
-case clang::BuiltinType::Kind::OCLImage1dArrayRW:
-case clang::BuiltinType::Kind::OCLImage1dBufferRO:
-case clang::BuiltinType::Kind::OCLImage1dBufferWO:
-case clang::BuiltinType::Kind::OCLImage1dBufferRW:
-case clang::BuiltinType::Kind::OCLImage2dRO:
-case clang::BuiltinType::Kind::OCLImage2dWO:
-case clang::BuiltinType::Kind::OCLImage2dRW:
-case clang::BuiltinType::Kind::OCLImage2dArrayRO:
-case clang::BuiltinType::Kind::OCLImage2dArrayWO:
-case clang::BuiltinType::Kind::OCLImage2dArrayRW:
-case clang::BuiltinType::Kind::OCLImage2dArrayDepthRO:
-case clang::BuiltinType::Kind::OCLImage2dArrayDepthWO:
-case clang::BuiltinType::Kind::OCLImage2dArrayDepthRW:
-case clang::BuiltinType::Kind::OCLImage2dArrayMSAARO:
-case clang::BuiltinType::Kind::OCLImage2dArrayMSAAWO:
-case clang::BuiltinType::Kind::OCLImage2dArrayMSAARW:
-case clang::BuiltinType::Kind::OCLImage2dArrayMSAADept

Re: [Lldb-commits] [PATCH] D20278: first pass for removing Mutex for std::{, recursive_}mutex

2016-05-15 Thread Saleem Abdulrasool via lldb-commits
compnerd added a comment.

I don't think I can write code without clang-format anymore (so, yes, it is 
clang-formatted).


http://reviews.llvm.org/D20278



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


[Lldb-commits] [lldb] r269627 - test: add missing splat

2016-05-15 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun May 15 22:13:08 2016
New Revision: 269627

URL: http://llvm.org/viewvc/llvm-project?rev=269627&view=rev
Log:
test: add missing splat

The parameter here is a list, not a string.  Ensure that the we splat the list
into arguments prior to invoke os.path.join.  This would previously fail with a
`startswith` is not a member of `list`.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/dotest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=269627&r1=269626&r2=269627&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Sun May 15 22:13:08 2016
@@ -640,7 +640,7 @@ def setupSysPath():
 python_resource_dir = ['LLDB.framework', 'Resources', 'Python']
 outputPaths = getXcodeOutputPaths(lldbRootDirectory)
 for outputPath in outputPaths:
-candidatePath = os.path.join(outputPath, 
python_resource_dir)
+candidatePath = os.path.join(outputPath, 
*python_resource_dir)
 if os.path.isfile(os.path.join(candidatePath, 
init_in_python_dir)):
 lldbPythonDir = candidatePath
 break


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


[Lldb-commits] [lldb] r269628 - test: remove use of undefined variables

2016-05-15 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun May 15 22:13:12 2016
New Revision: 269628

URL: http://llvm.org/viewvc/llvm-project?rev=269628&view=rev
Log:
test: remove use of undefined variables

The variables referenced in the print message are not defined.  Simply state
that the requisite script is not found.  Correct grammar to indicate that the
tests are rather likely to fail rather than unlikely to fail.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/dotest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=269628&r1=269627&r2=269628&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Sun May 15 22:13:12 2016
@@ -646,8 +646,7 @@ def setupSysPath():
 break
 
 if not lldbPythonDir:
-print('This script requires lldb.py to be in either ' + 
dbgPath + ',', end=' ')
-print(relPath + ', or ' + baiPath + '. Some tests might 
fail.')
+print("lldb.py is not found, some tests may fail.")
 else:
 print("Unable to load lldb extension module.  Possible reasons 
for this include:")
 print("  1) LLDB was built with LLDB_DISABLE_PYTHON=1")


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


[Lldb-commits] [lldb] r269626 - test: add missing parameter

2016-05-15 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun May 15 22:13:05 2016
New Revision: 269626

URL: http://llvm.org/viewvc/llvm-project?rev=269626&view=rev
Log:
test: add missing parameter

Add the missing required parameter to the function.  This permits tests to get a
bit further before failing.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/dotest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=269626&r1=269625&r2=269626&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Sun May 15 22:13:05 2016
@@ -638,7 +638,7 @@ def setupSysPath():
 if not lldbPythonDir:
 if platform.system() == "Darwin":
 python_resource_dir = ['LLDB.framework', 'Resources', 'Python']
-outputPaths = getXcodeOutputPaths()
+outputPaths = getXcodeOutputPaths(lldbRootDirectory)
 for outputPath in outputPaths:
 candidatePath = os.path.join(outputPath, 
python_resource_dir)
 if os.path.isfile(os.path.join(candidatePath, 
init_in_python_dir)):


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


Re: [Lldb-commits] [PATCH] D20278: first pass for removing Mutex for std::{, recursive_}mutex

2016-05-16 Thread Saleem Abdulrasool via lldb-commits
compnerd added a comment.

Zach is correct, this doesn't *remove* the Mutex and Condition types, merely 
starts reducing the easier uses of it.

My thinking is to do this piecemeal, slowly reducing the local usage until the 
real uses remain in the cases where we need to actually change the structure of 
the code.  In particular, it seems that there are places where we have 
`Mutex::Locker` passed in by reference to get a lock.

I agree that we want to start moving towards using std::condition_variable, 
however, that was a bit more involved as that will require adding a conversion 
operator for TimeValue.  Switching to `std::condition_variable` requires the 
switch to `std::mutex` as `std::conditional_variable::wait` requires a 
`std::unique_lock`.

I wanted to get as much of the mechanical change out of the way as possible so 
that when the rest of the uses are removed, it is easier to actually review the 
change to ensure that no subtle bugs are being introduced since it won't be as 
mechanical.


http://reviews.llvm.org/D20278



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


Re: [Lldb-commits] [PATCH] D20278: first pass for removing Mutex for std::{, recursive_}mutex

2016-05-16 Thread Saleem Abdulrasool via lldb-commits
compnerd added a comment.

I ran it on Darwin while I was working on this.  Ill run it on Linux once 
before I commit the first pass.


http://reviews.llvm.org/D20278



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


Re: [Lldb-commits] [PATCH] D20278: first pass for removing Mutex for std::{, recursive_}mutex

2016-05-16 Thread Saleem Abdulrasool via lldb-commits
compnerd added a comment.

If you can run the test that would be wonderful.  Im going to upload a slight 
update to this tonight that catches a few more of the trivial cases.  I think 
minimizing the second pass is ideal since that is going to be much more 
involved (changing APIs and such).


http://reviews.llvm.org/D20278



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


Re: [Lldb-commits] [PATCH] D20278: first pass for removing Mutex for std::{, recursive_}mutex

2016-05-17 Thread Saleem Abdulrasool via lldb-commits
compnerd added a comment.

Ah, I just ran git-clang-format, and that found a few additional things.  
Incorporated that; Ill commit this tonight and hopefully have the second pass 
done soon.


http://reviews.llvm.org/D20278



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


Re: [Lldb-commits] [PATCH] D20278: first pass for removing Mutex for std::{, recursive_}mutex

2016-05-17 Thread Saleem Abdulrasool via lldb-commits
compnerd closed this revision.
compnerd added a comment.

SVN r269877


http://reviews.llvm.org/D20278



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


Re: [Lldb-commits] [PATCH] D20351: second pass over removal of Mutex and Condition

2016-05-18 Thread Saleem Abdulrasool via lldb-commits
compnerd marked 2 inline comments as done.


Comment at: source/Interpreter/CommandObject.cpp:339
@@ -338,3 +338,3 @@
 m_exe_ctx.Clear();
-m_api_locker.Unlock();
+m_api_locker.unlock();
 }

zturner wrote:
> ```
> if (m_api_locker)
> m_api_locker.unlock();
> ```
> 
> Otherwise this is undefined behavior.  Also make sure you do this check 
> anywhere else in the patch where you do manual unlocking / locking like this.
Yeah, this was the only place where the lock was unlocked and there wasn't a 
comment indicating that the assumption was that the lock will be held.  A few 
places where there were unlocks were early releases of the unique_lock.  A 
couple of places indicated that the lock must have been acquired prior to the 
destructor running.


Repository:
  rL LLVM

http://reviews.llvm.org/D20351



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


Re: [Lldb-commits] [PATCH] D20351: second pass over removal of Mutex and Condition

2016-05-18 Thread Saleem Abdulrasool via lldb-commits
compnerd closed this revision.
compnerd marked an inline comment as done.
compnerd added a comment.

SVN r270024.


Repository:
  rL LLVM

http://reviews.llvm.org/D20351



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


Re: [Lldb-commits] [PATCH] D20436: Clean up vestigial remnants of locking primitives

2016-05-19 Thread Saleem Abdulrasool via lldb-commits
compnerd added a comment.

Yeah, I was thinking that once this clean up is done, we should remove the use 
of TimeValue in favor of std::chrono::duration.


Repository:
  rL LLVM

http://reviews.llvm.org/D20436



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


[Lldb-commits] [lldb] r270377 - SymbolFile: remove an unused variable

2016-05-22 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun May 22 15:16:53 2016
New Revision: 270377

URL: http://llvm.org/viewvc/llvm-project?rev=270377&view=rev
Log:
SymbolFile: remove an unused variable

Address a -Wunused-but-set-variable warning from gcc.  NFC.

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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp?rev=270377&r1=270376&r2=270377&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp Sun May 
22 15:16:53 2016
@@ -468,7 +468,6 @@ DWARFASTParserJava::ParseChildMembers(co
 DWARFFormValue encoding_uid;
 uint32_t member_byte_offset = UINT32_MAX;
 DWARFExpression member_location_expression(dwarf_cu);
-bool artificial = true;
 
 DWARFAttributes attributes;
 size_t num_attributes = die.GetAttributes(attributes);
@@ -494,7 +493,7 @@ DWARFASTParserJava::ParseChildMembers(co
 member_byte_offset = form_value.Unsigned();
 break;
 case DW_AT_artificial:
-artificial = form_value.Boolean();
+static_cast(form_value.Boolean());
 break;
 case DW_AT_accessibility:
 // TODO: Handle when needed


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


Re: [Lldb-commits] [PATCH] D22463: [RFC] Moving to GitHub Proposal: NOT DECISION!

2016-07-18 Thread Saleem Abdulrasool via lldb-commits
compnerd added inline comments.


Comment at: docs/Proposals/GitHub.rst:167
@@ +166,3 @@
+with the limited number of developers whose job will be to mainly merge
+thousands of patches a day.
+

rengolin wrote:
> compnerd wrote:
> > I don't fully understand how this is any different from today.  We have a 
> > core set of developers with commit access.  Others are encouraged to 
> > provide patches via email (or may use phabricator depending on the 
> > reviewer).  Once reviewed and accepted, one of the core developers still 
> > commits the change.  I just see this as a process change.
> > 
> > The person forks the repository on github, and creates a branch, and then a 
> > PR.  The PR is reviewed and once accepted, merged by one of the core 
> > developers.  It even implicitly handles authorship tracking which has 
> > currently been done in an adhoc fashion via the commit message.
> Today we all commit to SVN, which is linear. In GitHub, we'll be committing 
> to git. If we can have hooks forbidding merges, it'll remain linear, but then 
> pull requests will be blocked. Additional hooks will need to be in place 
> (please suggest all of them here and I'll update the doc).
I think that we should aim to preserve the linearity of history.  This would 
mean that we block non-fastforward commits (i.e. no merges, no force pushes).


Repository:
  rL LLVM

https://reviews.llvm.org/D22463



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


Re: [Lldb-commits] [PATCH] D20436: Clean up vestigial remnants of locking primitives

2016-07-18 Thread Saleem Abdulrasool via lldb-commits
compnerd added a comment.

Ugh, yeah, I had forgotten about this.  Ill try to get to this tonight/tomorrow.



Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:354-355
@@ -358,5 +353,4 @@
 {
-// Calculate absolute timeout value
-TimeValue timeout = TimeValue::Now();
-timeout.OffsetWithMicroSeconds(timeout_usec);
+std::chrono::time_point until =
+std::chrono::system_clock::now() + 
std::chrono::microseconds(timeout_usec);
 

zturner wrote:
> Need to use `auto` here, otherwise there's a compiler error.
Yeah, noticed that on Linux; Ill upload a new version of the patch.  I ended up 
just doing the math in a second step.


Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:844
@@ -845,1 +843,3 @@
+if (m_async_packet_predicate.WaitForValueEqualTo(
+false, until - 
std::chrono::system_clock::now(), &timed_out))
 {

zturner wrote:
> this needs to use 
> `std::chrono::duration_cast(until - 
> std::chrono::system_clock::now())`.  Maybe raise this into a temporary 
> variable (also make sure to use auto on the result just in case).
Yeah, hoisting that into a local var sounds good.


Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:860
@@ -859,2 +859,3 @@
 // Make sure we wait until the continue packet has 
been sent again...
-if (m_private_is_running.WaitForValueEqualTo (true, 
&timeout_time, &timed_out))
+if (m_private_is_running.WaitForValueEqualTo(true, 
until - std::chrono::system_clock::now(),
+ 
&timed_out))

zturner wrote:
> `duration_cast` again.
Yeah.


Comment at: source/Target/Process.cpp:5547
@@ +5546,3 @@
+log->Printf("Process::RunThreadPlan(): about to wait - now 
is %llu - endpoint is %llu",
+
std::chrono::time_point(
+std::chrono::system_clock::now())

zturner wrote:
> Delete the cast here.  Just use `std::chrono::system_clock::now()`.
Yeah.


Comment at: source/Target/Process.cpp:5551
@@ +5550,3 @@
+.count(),
+
std::chrono::time_point(timeout)
+.time_since_epoch()

zturner wrote:
> Change to `timeout.time_since_epoch()`
This doesn't work for me.  `timeout` is a `std::duration`, and 
`std::time_point` is needed.


Repository:
  rL LLVM

https://reviews.llvm.org/D20436



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


Re: [Lldb-commits] [PATCH] D20436: Clean up vestigial remnants of locking primitives

2016-07-18 Thread Saleem Abdulrasool via lldb-commits
compnerd added a comment.

*hadn't


Repository:
  rL LLVM

https://reviews.llvm.org/D20436



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


Re: [Lldb-commits] [PATCH] D22463: [RFC] Moving to GitHub Proposal: NOT DECISION!

2016-07-18 Thread Saleem Abdulrasool via lldb-commits
compnerd added inline comments.


Comment at: docs/Proposals/GitHub.rst:127
@@ +126,3 @@
+* The projects' repositories will remain identical, with a new address 
(GitHub).
+* They'll continue to have SVN RW access, but will also gain Git RW access.
+* The linear history can still be accessed in the (RO) submodule meta project,

jroelofs wrote:
> Do you mean `s/SVN RW access/SVN RO access/` here?
I believe @rengolin is referring to the final state here.  I agree that the 
current phrasing makes it hard to follow.


Comment at: docs/Proposals/GitHub.rst:129
@@ +128,3 @@
+* The linear history can still be accessed in the (RO) submodule meta project,
+  Which will continue to have SVN access.
+

"Which will continue to have SVN access" is redundant given the previous 
statement.


Comment at: docs/Proposals/GitHub.rst:136
@@ +135,3 @@
+Essentially, we're adding Git RW access in addition to the already existing
+structure, with all the additional benefits of it being in GitHub.
+

jroelofs wrote:
> Need to clarify here whether *write* access through SVN will be going away. 
> If I understand the proposal correctly, it will go away, but this section 
> makes it sound like it's staying.
The way that I read the nutshell is that it would potentially continue to 
exist, just at a different address.


Comment at: docs/Proposals/GitHub.rst:155
@@ +154,3 @@
+But some people/companies might not be allowed to use GitHub or might have
+firewalls blocking certain websites.
+

GitHub does have HTTPS based connections.  It seems highly unlikely that this 
is a real concern.  Companies would have to go out of their way to block access 
specifically to github over SSH and HTTPS.


Comment at: docs/Proposals/GitHub.rst:167
@@ +166,3 @@
+with the limited number of developers whose job will be to mainly merge
+thousands of patches a day.
+

I don't fully understand how this is any different from today.  We have a core 
set of developers with commit access.  Others are encouraged to provide patches 
via email (or may use phabricator depending on the reviewer).  Once reviewed 
and accepted, one of the core developers still commits the change.  I just see 
this as a process change.

The person forks the repository on github, and creates a branch, and then a PR. 
 The PR is reviewed and once accepted, merged by one of the core developers.  
It even implicitly handles authorship tracking which has currently been done in 
an adhoc fashion via the commit message.


Comment at: docs/Proposals/GitHub.rst:222
@@ +221,3 @@
+10. Collect peoples GitHub account information, give them push access. Ideally
+while still locking the GitHub repository somehow...
+11. Switch SVN repository to read-only and allow pushes to the GitHub 
repository.

Giving permissions to only the LLVM "project" is sufficient.  People can be 
added to the LLVM "project" as collaborators and get access that way.  This is 
similar to how Apple is managing swift for comparison.


Repository:
  rL LLVM

https://reviews.llvm.org/D22463



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


Re: [Lldb-commits] [PATCH] D20436: Clean up vestigial remnants of locking primitives

2016-07-18 Thread Saleem Abdulrasool via lldb-commits
compnerd added a comment.

Tested against Linux-x86_64, tests state seems unchanged across the patch.  
@zturner you want to run another round on Windows before I merge this?


https://reviews.llvm.org/D20436



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


Re: [Lldb-commits] [PATCH] D20436: Clean up vestigial remnants of locking primitives

2016-07-26 Thread Saleem Abdulrasool via lldb-commits
compnerd added a subscriber: sas.
compnerd added a comment.

@emaste I think so.  I was hoping that @zturner or @sas would be able to get a 
windows run.  However, Linux and FreeBSD should give us some assurance that 
this is good.  How about I go ahead and commit this tomorrow?


https://reviews.llvm.org/D20436



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


[Lldb-commits] [lldb] r277013 - Host: correct use of std::condition_variable::wait_for

2016-07-28 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Thu Jul 28 13:16:07 2016
New Revision: 277013

URL: http://llvm.org/viewvc/llvm-project?rev=277013&view=rev
Log:
Host: correct use of std::condition_variable::wait_for

std::condition::wait_for takes a std::unique_lock.  The previous commit
accidentally left a reference to `m_mutex` instead of `lock`.  Update that.
Should restore the android lldb builder to green.

Modified:
lldb/trunk/include/lldb/Host/Predicate.h

Modified: lldb/trunk/include/lldb/Host/Predicate.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Predicate.h?rev=277013&r1=277012&r2=277013&view=diff
==
--- lldb/trunk/include/lldb/Host/Predicate.h (original)
+++ lldb/trunk/include/lldb/Host/Predicate.h Thu Jul 28 13:16:07 2016
@@ -435,7 +435,7 @@ public:
 }
 else
 {
-std::cv_status result = m_condition.wait_for(m_mutex, timeout);
+std::cv_status result = m_condition.wait_for(lock, timeout);
 if (result == std::cv_status::timeout)
 {
 if (timed_out)


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


Re: [Lldb-commits] [PATCH] D20436: Clean up vestigial remnants of locking primitives

2016-07-28 Thread Saleem Abdulrasool via lldb-commits
compnerd closed this revision.
compnerd added a comment.

SVN r277011


https://reviews.llvm.org/D20436



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


[Lldb-commits] [lldb] r278774 - Symbol: add missing item in covered switch

2016-08-15 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Mon Aug 15 23:12:36 2016
New Revision: 278774

URL: http://llvm.org/viewvc/llvm-project?rev=278774&view=rev
Log:
Symbol: add missing item in covered switch

RenderScript was missing from the covered switch.  Add it to avoid a warning of
the missing entry.  NFC.

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=278774&r1=278773&r2=278774&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Aug 15 23:12:36 2016
@@ -406,6 +406,7 @@ ParseLangArgs (LangOptions &Opts, InputK
 case IK_None:
 case IK_AST:
 case IK_LLVM_IR:
+case IK_RenderScript:
 assert (!"Invalid input kind!");
 case IK_OpenCL:
 LangStd = LangStandard::lang_opencl;


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


[Lldb-commits] [lldb] r258547 - Target: fix -Wcast-qual warning

2016-01-22 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Fri Jan 22 14:26:32 2016
New Revision: 258547

URL: http://llvm.org/viewvc/llvm-project?rev=258547&view=rev
Log:
Target: fix -Wcast-qual warning

We were unnecessarily stripping the const qualifier on the temporary variable.
Restore the constness to avoid the warning.  NFC.

Modified:
lldb/trunk/source/Target/UnixSignals.cpp

Modified: lldb/trunk/source/Target/UnixSignals.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/UnixSignals.cpp?rev=258547&r1=258546&r2=258547&view=diff
==
--- lldb/trunk/source/Target/UnixSignals.cpp (original)
+++ lldb/trunk/source/Target/UnixSignals.cpp Fri Jan 22 14:26:32 2016
@@ -180,7 +180,7 @@ UnixSignals::GetShortName(ConstString na
 {
 if (name)
 {
-  char* signame = (char*)(name.AsCString());
+  const char* signame = name.AsCString();
   return ConstString(signame + 3); // Remove "SIG" from name
 }
 return name;


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


[Lldb-commits] [lldb] r258546 - Silence -Wreturn-type warnings

2016-01-22 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Fri Jan 22 14:26:30 2016
New Revision: 258546

URL: http://llvm.org/viewvc/llvm-project?rev=258546&view=rev
Log:
Silence -Wreturn-type warnings

Address a couple of instances of -Wreturn-type warning from GCC.  The switches
are covered, add an llvm_unreachable to the end of the functions to silence the
warning.  NFC.

Modified:
lldb/trunk/source/Expression/ExpressionSourceCode.cpp
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Expression/ExpressionSourceCode.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ExpressionSourceCode.cpp?rev=258546&r1=258545&r2=258546&view=diff
==
--- lldb/trunk/source/Expression/ExpressionSourceCode.cpp (original)
+++ lldb/trunk/source/Expression/ExpressionSourceCode.cpp Fri Jan 22 14:26:30 
2016
@@ -119,6 +119,7 @@ public:
 default:
 return false;
 }
+llvm_unreachable("unhandled state");
 }
 
 private:

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=258546&r1=258545&r2=258546&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Jan 22 14:26:30 2016
@@ -1501,6 +1501,7 @@ Process::IsAlive ()
 default:
 return false;
 }
+llvm_unreachable("unhandled state");
 }
 
 // This static callback can be used to watch for local child processes on


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


[Lldb-commits] [lldb] r258548 - Commands: silence dumb -Wextra warning from GCC

2016-01-22 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Fri Jan 22 14:26:34 2016
New Revision: 258548

URL: http://llvm.org/viewvc/llvm-project?rev=258548&view=rev
Log:
Commands: silence dumb -Wextra warning from GCC

This is a rather unhelpful warning indicating that the ternary operator return
types are mismatched, returning an integer and an enumeral type.  Since the
integeral type is shorter to type, cast the enumeral type to `int`.  Silences
the -Wextra warning from GCC.

Modified:
lldb/trunk/source/Commands/CommandObjectTarget.cpp

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=258548&r1=258547&r2=258548&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Jan 22 14:26:34 2016
@@ -4083,11 +4083,11 @@ public:
 case eLookupTypeAddress:
 if (m_options.m_addr != LLDB_INVALID_ADDRESS)
 {
-if (LookupAddressInModule (m_interpreter, 
-   result.GetOutputStream(), 
-   module, 
-   eSymbolContextEverything | 
(m_options.m_verbose ? eSymbolContextVariable : 0),
-   m_options.m_addr, 
+if (LookupAddressInModule (m_interpreter,
+   result.GetOutputStream(),
+   module,
+   eSymbolContextEverything | 
(m_options.m_verbose ? static_cast(eSymbolContextVariable) : 0),
+   m_options.m_addr,
m_options.m_offset,
m_options.m_verbose))
 {


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


[Lldb-commits] [lldb] r258821 - Revert r258546.

2016-01-26 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Tue Jan 26 11:43:48 2016
New Revision: 258821

URL: http://llvm.org/viewvc/llvm-project?rev=258821&view=rev
Log:
Revert r258546.

Seems that the patch was rebased on top of another change which obsoleted the
change but wasnt caught.

Thanks to nbjoerg for pointing this out!

Modified:
lldb/trunk/source/Expression/ExpressionSourceCode.cpp
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Expression/ExpressionSourceCode.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ExpressionSourceCode.cpp?rev=258821&r1=258820&r2=258821&view=diff
==
--- lldb/trunk/source/Expression/ExpressionSourceCode.cpp (original)
+++ lldb/trunk/source/Expression/ExpressionSourceCode.cpp Tue Jan 26 11:43:48 
2016
@@ -119,7 +119,6 @@ public:
 default:
 return false;
 }
-llvm_unreachable("unhandled state");
 }
 
 private:

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=258821&r1=258820&r2=258821&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Jan 26 11:43:48 2016
@@ -1501,7 +1501,6 @@ Process::IsAlive ()
 default:
 return false;
 }
-llvm_unreachable("unhandled state");
 }
 
 // This static callback can be used to watch for local child processes on


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


Re: [Lldb-commits] [lldb] r258546 - Silence -Wreturn-type warnings

2016-01-26 Thread Saleem Abdulrasool via lldb-commits
On Sat, Jan 23, 2016 at 3:24 PM, Joerg Sonnenberger  wrote:

> On Fri, Jan 22, 2016 at 08:26:30PM -0000, Saleem Abdulrasool via
> lldb-commits wrote:
> > Author: compnerd
> > Date: Fri Jan 22 14:26:30 2016
> > New Revision: 258546
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=258546&view=rev
> > Log:
> > Silence -Wreturn-type warnings
> >
> > Address a couple of instances of -Wreturn-type warning from GCC.  The
> switches
> > are covered, add an llvm_unreachable to the end of the functions to
> silence the
> > warning.  NFC.
>
> Huh? This is wrong. A switch with a default branch should never trigger
> a fall through waring.


You're right.  I think that this was rebased over another change and I
failed to notice that this was now default'ed.  Reverted in SVN r258821.


>
> Joerg
>



-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r260868 - ExpressionParser: silence some GCC warnings

2016-02-14 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sun Feb 14 21:23:14 2016
New Revision: 260868

URL: http://llvm.org/viewvc/llvm-project?rev=260868&view=rev
Log:
ExpressionParser: silence some GCC warnings

Silence a -Wreorder warning about order of member initialization and a
-Wqual-cast warning about casting away constness.  NFC.

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp?rev=260868&r1=260867&r2=260868&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
Sun Feb 14 21:23:14 2016
@@ -822,7 +822,7 @@ ClangExpressionDeclMap::FindExternalVisi
 {
 if (namespace_context->getName().str() == 
std::string(g_lldb_local_vars_namespace_cstr))
 {
-CompilerDeclContext compiler_decl_ctx(GetClangASTContext(), 
(void*)context.m_decl_context);
+CompilerDeclContext compiler_decl_ctx(GetClangASTContext(), 
const_cast(static_cast(context.m_decl_context)));
 FindExternalVisibleDecls(context, lldb::ModuleSP(), 
compiler_decl_ctx, current_id);
 return;
 }

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp?rev=260868&r1=260867&r2=260868&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Sun Feb 14 
21:23:14 2016
@@ -88,10 +88,10 @@ IRForTarget::IRForTarget (lldb_private::
 m_sel_registerName(NULL),
 m_intptr_ty(NULL),
 m_error_stream(error_stream),
+m_execution_unit(execution_unit),
 m_result_store(NULL),
 m_result_is_pointer(false),
 m_reloc_placeholder(NULL),
-m_execution_unit(execution_unit),
 m_entry_instruction_finder (FindEntryInstruction)
 {
 }


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


[Lldb-commits] [lldb] r260914 - Silence some clang warnings

2016-02-15 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Mon Feb 15 15:50:28 2016
New Revision: 260914

URL: http://llvm.org/viewvc/llvm-project?rev=260914&view=rev
Log:
Silence some clang warnings

Silences -Wmissing-brace and -Wformat-pedantic warnings from clang on Linux.  
NFC.

Modified:

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
lldb/trunk/tools/driver/Driver.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=260914&r1=260913&r2=260914&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Mon Feb 15 15:50:28 2016
@@ -174,15 +174,15 @@ GetArgsX86_64(GetArgsCtx &ctx, ArgItem *
 // number of arguments passed in registers
 static const uint32_t c_args_in_reg = 6;
 // register passing order
-static const std::array c_reg_names = {"rdi", 
"rsi", "rdx", "rcx", "r8", "r9"};
+static const std::array c_reg_names{{"rdi", 
"rsi", "rdx", "rcx", "r8", "r9"}};
 // argument type to size mapping
-static const std::array arg_size = {
+static const std::array arg_size{{
 8, // ePointer,
 4, // eInt32,
 8, // eInt64,
 8, // eLong,
 4, // eBool,
-};
+}};
 
 // get the current stack pointer
 uint64_t sp = ctx.reg_ctx->GetSP();
@@ -1020,7 +1020,7 @@ RenderScriptRuntime::CaptureScriptInvoke
 eRsSc,
 };
 
-std::array args = {
+std::array args{{
 ArgItem{ArgItem::ePointer, 0}, // const Context   *rsc
 ArgItem{ArgItem::ePointer, 0}, // Script  *s
 ArgItem{ArgItem::eInt32, 0},   // uint32_t slot
@@ -1030,7 +1030,7 @@ RenderScriptRuntime::CaptureScriptInvoke
 ArgItem{ArgItem::ePointer, 0}, // const void  *usr
 ArgItem{ArgItem::eInt32, 0},   // size_t   usrLen
 ArgItem{ArgItem::ePointer, 0}, // const RsScriptCall  *sc
-};
+}};
 
 bool success = GetArgs(context, &args[0], args.size());
 if (!success)
@@ -1125,13 +1125,13 @@ RenderScriptRuntime::CaptureSetGlobalVar
 eRsLength,
 };
 
-std::array args = {
+std::array args{{
 ArgItem{ArgItem::ePointer, 0}, // eRsContext
 ArgItem{ArgItem::ePointer, 0}, // eRsScript
 ArgItem{ArgItem::eInt32, 0},   // eRsId
 ArgItem{ArgItem::ePointer, 0}, // eRsData
 ArgItem{ArgItem::eInt32, 0},   // eRsLength
-};
+}};
 
 bool success = GetArgs(context, &args[0], args.size());
 if (!success)
@@ -1173,11 +1173,11 @@ RenderScriptRuntime::CaptureAllocationIn
 eRsForceZero
 };
 
-std::array args = {
+std::array args{{
 ArgItem{ArgItem::ePointer, 0}, // eRsContext
 ArgItem{ArgItem::ePointer, 0}, // eRsAlloc
 ArgItem{ArgItem::eBool, 0},// eRsForceZero
-};
+}};
 
 bool success = GetArgs(context, &args[0], args.size());
 if (!success) // error case
@@ -1207,10 +1207,10 @@ RenderScriptRuntime::CaptureAllocationDe
 eRsAlloc,
 };
 
-std::array args = {
+std::array args{{
 ArgItem{ArgItem::ePointer, 0}, // eRsContext
 ArgItem{ArgItem::ePointer, 0}, // eRsAlloc
-};
+}};
 
 bool success = GetArgs(context, &args[0], args.size());
 if (!success)
@@ -1256,8 +1256,8 @@ RenderScriptRuntime::CaptureScriptInit(R
 eRsCachedDirPtr
 };
 
-std::array args = {ArgItem{ArgItem::ePointer, 0}, 
ArgItem{ArgItem::ePointer, 0},
-   ArgItem{ArgItem::ePointer, 0}, 
ArgItem{ArgItem::ePointer, 0}};
+std::array args{{ArgItem{ArgItem::ePointer, 0}, 
ArgItem{ArgItem::ePointer, 0},
+ ArgItem{ArgItem::ePointer, 0}, 
ArgItem{ArgItem::ePointer, 0}}};
 bool success = GetArgs(context, &args[0], args.size());
 if (!success)
 {

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=260914&r1=260913&r2=260914&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Mon Feb 15 15:50:28 2016
@@ -914,7 +914,8 @@ PrepareCommandsForSourcing (const char *
 {
 fprintf(stderr, "error: write(%i, %p, %" PRIu64 ") failed (errno = 
%i) "
 "when trying to open LLDB commands pipe\n",
-fds[WRITE], commands_data, 
static_cast(commands_size), errno);
+fds[WRITE], static_cast(commands_data),
+ 

[Lldb-commits] [lldb] r261612 - RenderScript: silence some -Wmissing-brace warnings

2016-02-22 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Mon Feb 22 22:56:31 2016
New Revision: 261612

URL: http://llvm.org/viewvc/llvm-project?rev=261612&view=rev
Log:
RenderScript: silence some -Wmissing-brace warnings

Silence some -Wmissing-brace warnings on Linux with clang 3.7.

Modified:

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=261612&r1=261611&r2=261612&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Mon Feb 22 22:56:31 2016
@@ -2685,8 +2685,8 @@ RSModuleDescriptor::ParseRSInfo()
 }
 }
 
-std::array name = {'\0'};
-std::array value = {'\0'};
+std::array name{{'\0'}};
+std::array value{{'\0'}};
 
 // parse all text lines of .rs.info
 for (auto line = info_lines.begin(); line != info_lines.end(); ++line)


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


[Lldb-commits] [lldb] r265644 - Symbol: fix build

2016-04-06 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Thu Apr  7 01:51:10 2016
New Revision: 265644

URL: http://llvm.org/viewvc/llvm-project?rev=265644&view=rev
Log:
Symbol: fix build

TargetOptions is ambiguous due to a definition in LLVM and in clang.  This was
exposed by SVN r265640.  Update to fix the build against the newer revision.

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=265644&r1=265643&r2=265644&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Apr  7 01:51:10 2016
@@ -717,11 +717,11 @@ ClangASTContext::getDiagnosticConsumer()
 return m_diagnostic_consumer_ap.get();
 }
 
-std::shared_ptr &
+std::shared_ptr &
 ClangASTContext::getTargetOptions() {
 if (m_target_options_rp.get() == nullptr && !m_target_triple.empty())
 {
-m_target_options_rp = std::make_shared();
+m_target_options_rp = std::make_shared();
 if (m_target_options_rp.get() != nullptr)
 m_target_options_rp->Triple = m_target_triple;
 }


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


[Lldb-commits] [lldb] r266042 - Process: fix the build with certain kernel versions

2016-04-11 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Tue Apr 12 00:40:51 2016
New Revision: 266042

URL: http://llvm.org/viewvc/llvm-project?rev=266042&view=rev
Log:
Process: fix the build with certain kernel versions

The structure definitions are not provided, but we perform a sizeof operation of
them which causes a build failure.  Include `asm/ptrace.h` to get the structure
definitions.

Modified:
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp

Modified: 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp?rev=266042&r1=266041&r2=266042&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp 
Tue Apr 12 00:40:51 2016
@@ -32,6 +32,8 @@
 #include 
 // NT_PRSTATUS and NT_FPREGSET definition
 #include 
+// user_hwdebug_state definition
+#include 
 
 #define REG_CONTEXT_SIZE (GetGPRSize() + GetFPRSize())
 


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


[Lldb-commits] [lldb] r267000 - Host: fix some -Wformat-pedantic warnings

2016-04-21 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Thu Apr 21 11:55:58 2016
New Revision: 267000

URL: http://llvm.org/viewvc/llvm-project?rev=267000&view=rev
Log:
Host: fix some -Wformat-pedantic warnings

Add explicit casts for function pointer to void * for %p conversion.  NFC.

Modified:
lldb/trunk/source/Host/macosx/Host.mm

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=267000&r1=266999&r2=267000&view=diff
==
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Thu Apr 21 11:55:58 2016
@@ -1464,12 +1464,12 @@ Host::StartMonitoringChildProcess(Host::
  
::dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT,0));
 
 if (log)
-log->Printf ("Host::StartMonitoringChildProcess (callback=%p, 
baton=%p, pid=%i, monitor_signals=%i) source = %p\n",
- callback,
- callback_baton,
- (int)pid,
- monitor_signals,
- source);
+log->Printf("Host::StartMonitoringChildProcess "
+"(callback=%p, baton=%p, pid=%i, monitor_signals=%i) "
+"source = %p\n",
+reinterpret_cast(callback), callback_baton,
+static_cast(pid), monitor_signals,
+reinterpret_cast(source));
 
 if (source)
 {


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


[Lldb-commits] [lldb] r267001 - API: fix a -Wunused-variable warning

2016-04-21 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Thu Apr 21 11:56:02 2016
New Revision: 267001

URL: http://llvm.org/viewvc/llvm-project?rev=267001&view=rev
Log:
API: fix a -Wunused-variable warning

expr_log is only conditionally used via preprocessing.  Ensure that we guard the
definition accordingly.  NFC.

Modified:
lldb/trunk/source/API/SBFrame.cpp

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=267001&r1=267000&r2=267001&view=diff
==
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Thu Apr 21 11:56:02 2016
@@ -1440,7 +1440,9 @@ SBFrame::EvaluateExpression (const char
 {
 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
 
+#ifndef LLDB_DISABLE_PYTHON
 Log *expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+#endif
 
 ExpressionResults exe_results = eExpressionSetupError;
 SBValue expr_result;


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


[Lldb-commits] [PATCH] D19446: ObjectFile: parse EABI Attributes

2016-04-22 Thread Saleem Abdulrasool via lldb-commits
compnerd created this revision.
compnerd added a reviewer: clayborg.
compnerd added a subscriber: lldb-commits.
compnerd set the repository for this revision to rL LLVM.

This adds basic parsing of the EABI attributes section.  This section contains
additional information about the target for which the file was built.  Attempt
to infer additional architecture information from that section.

This is still relatively light in terms of inferred information.  However, this 
lays the groundwork for inferring more information in the future.

Suggestions for testing this welcome.

Repository:
  rL LLVM

http://reviews.llvm.org/D19446

Files:
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.h

Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.h
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -298,6 +298,10 @@
 size_t
 ParseSectionHeaders();
 
+static void
+ParseARMAttributes(lldb_private::DataExtractor &data, uint64_t length,
+   lldb_private::ArchSpec &arch_spec);
+
 /// Parses the elf section headers and returns the uuid, debug link name, crc, archspec.
 static size_t
 GetSectionHeaderInfo(SectionHeaderColl §ion_headers,
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -31,6 +31,7 @@
 
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/ARMBuildAttributes.h"
 #include "llvm/Support/MathExtras.h"
 
 #define CASE_AND_STREAM(s, def, width)  \
@@ -1516,6 +1517,90 @@
 return error;
 }
 
+void
+ObjectFileELF::ParseARMAttributes(DataExtractor &data, uint64_t length, ArchSpec &arch_spec)
+{
+lldb::offset_t Offset = 0;
+
+uint8_t FormatVersion = data.GetU8(&Offset);
+if (FormatVersion != llvm::ARMBuildAttrs::Format_Version)
+  return;
+
+Offset = Offset + sizeof(uint32_t); // Section Length
+llvm::StringRef VendorName = data.GetCStr(&Offset);
+
+if (VendorName != "aeabi")
+  return;
+
+if (arch_spec.GetTriple().getEnvironment() == llvm::Triple::UnknownEnvironment)
+arch_spec.GetTriple().setEnvironment(llvm::Triple::EABI);
+
+while (Offset < length)
+{
+uint8_t Tag = data.GetU8(&Offset);
+uint32_t Size = data.GetU32(&Offset);
+
+if (Tag != llvm::ARMBuildAttrs::File || Size == 0)
+continue;
+
+while (Offset < length)
+{
+uint64_t Tag = data.GetULEB128(&Offset);
+switch (Tag)
+{
+default:
+// TODO: log error for unhandled AEABI attribute
+if (Tag < 32)
+data.GetULEB128(&Offset);
+else if (Tag % 2 == 0)
+data.GetULEB128(&Offset);
+else
+data.GetCStr(&Offset);
+break;
+
+case llvm::ARMBuildAttrs::CPU_raw_name:
+case llvm::ARMBuildAttrs::CPU_name:
+data.GetCStr(&Offset);
+break;
+
+case llvm::ARMBuildAttrs::THUMB_ISA_use:
+{
+uint64_t ThumbISA = data.GetULEB128(&Offset);
+
+// NOTE: ignore ThumbISA == llvm::ARMBuildAttrs::AllowThumbDerived
+// since that derives it based on the architecutre/profile
+if (ThumbISA == llvm::ARMBuildAttrs::AllowThumb32)
+if (arch_spec.GetTriple().getArch() == llvm::Triple::UnknownArch ||
+arch_spec.GetTriple().getArch() == llvm::Triple::arm)
+arch_spec.GetTriple().setArch(llvm::Triple::thumb);
+}
+case llvm::ARMBuildAttrs::ABI_VFP_args:
+{
+uint64_t VFPArgs = data.GetULEB128(&Offset);
+
+if (VFPArgs == llvm::ARMBuildAttrs::BaseAAPCS)
+{
+if (arch_spec.GetTriple().getEnvironment() == llvm::Triple::UnknownEnvironment ||
+arch_spec.GetTriple().getEnvironment() == llvm::Triple::EABIHF)
+arch_spec.GetTriple().setEnvironment(llvm::Triple::EABI);
+
+arch_spec.SetFlags(ArchSpec::eARM_abi_soft_float);
+}
+else if (VFPArgs == llvm::ARMBuildAttrs::HardFPAAPCS)
+{
+if (arch_spec.GetTriple().getEnvironment() == llvm::Triple::UnknownEnvironment ||
+arch_spec.GetTriple().getEnvironment() == llvm::Triple::EABI)
+arch_spec.GetTriple().s

[Lldb-commits] [lldb] r267247 - Source: fix another -Wunused-variable warning

2016-04-22 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Fri Apr 22 18:08:34 2016
New Revision: 267247

URL: http://llvm.org/viewvc/llvm-project?rev=267247&view=rev
Log:
Source: fix another -Wunused-variable warning

Conditionalise a variable definition which may be unused in certain compilations
due to the preprocessor.  Protect the variable accordingly.  NFC.

Modified:
lldb/trunk/source/API/SBTarget.cpp

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=267247&r1=267246&r2=267247&view=diff
==
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Fri Apr 22 18:08:34 2016
@@ -2388,7 +2388,9 @@ lldb::SBValue
 SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions 
&options)
 {
 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+#if !defined(LLDB_DISABLE_PYTHON)
 Log * expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+#endif
 SBValue expr_result;
 ExpressionResults exe_results = eExpressionSetupError;
 ValueObjectSP expr_value_sp;


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


[Lldb-commits] [lldb] r267291 - ObjectFile: parse EABI Attributes

2016-04-23 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Sat Apr 23 11:00:15 2016
New Revision: 267291

URL: http://llvm.org/viewvc/llvm-project?rev=267291&view=rev
Log:
ObjectFile: parse EABI Attributes

This adds basic parsing of the EABI attributes section.  This section contains
additional information about the target for which the file was built.  Attempt
to infer additional architecture information from that section.

Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.h

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=267291&r1=267290&r2=267291&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Sat Apr 23 
11:00:15 2016
@@ -31,6 +31,7 @@
 
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/ARMBuildAttributes.h"
 #include "llvm/Support/MathExtras.h"
 
 #define CASE_AND_STREAM(s, def, width)  \
@@ -1516,6 +1517,93 @@ ObjectFileELF::RefineModuleDetailsFromNo
 return error;
 }
 
+void
+ObjectFileELF::ParseARMAttributes(DataExtractor &data, uint64_t length, 
ArchSpec &arch_spec)
+{
+lldb::offset_t Offset = 0;
+
+uint8_t FormatVersion = data.GetU8(&Offset);
+if (FormatVersion != llvm::ARMBuildAttrs::Format_Version)
+  return;
+
+Offset = Offset + sizeof(uint32_t); // Section Length
+llvm::StringRef VendorName = data.GetCStr(&Offset);
+
+if (VendorName != "aeabi")
+  return;
+
+if (arch_spec.GetTriple().getEnvironment() == 
llvm::Triple::UnknownEnvironment)
+arch_spec.GetTriple().setEnvironment(llvm::Triple::EABI);
+
+while (Offset < length)
+{
+uint8_t Tag = data.GetU8(&Offset);
+uint32_t Size = data.GetU32(&Offset);
+
+if (Tag != llvm::ARMBuildAttrs::File || Size == 0)
+continue;
+
+while (Offset < length)
+{
+uint64_t Tag = data.GetULEB128(&Offset);
+switch (Tag)
+{
+default:
+if (Tag < 32)
+data.GetULEB128(&Offset);
+else if (Tag % 2 == 0)
+data.GetULEB128(&Offset);
+else
+data.GetCStr(&Offset);
+
+break;
+
+case llvm::ARMBuildAttrs::CPU_raw_name:
+case llvm::ARMBuildAttrs::CPU_name:
+data.GetCStr(&Offset);
+
+break;
+
+case llvm::ARMBuildAttrs::THUMB_ISA_use:
+{
+uint64_t ThumbISA = data.GetULEB128(&Offset);
+
+// NOTE: ignore ThumbISA == 
llvm::ARMBuildAttrs::AllowThumbDerived
+// since that derives it based on the architecutre/profile
+if (ThumbISA == llvm::ARMBuildAttrs::AllowThumb32)
+if (arch_spec.GetTriple().getArch() == 
llvm::Triple::UnknownArch ||
+arch_spec.GetTriple().getArch() == 
llvm::Triple::arm)
+arch_spec.GetTriple().setArch(llvm::Triple::thumb);
+
+break;
+}
+case llvm::ARMBuildAttrs::ABI_VFP_args:
+{
+uint64_t VFPArgs = data.GetULEB128(&Offset);
+
+if (VFPArgs == llvm::ARMBuildAttrs::BaseAAPCS)
+{
+if (arch_spec.GetTriple().getEnvironment() == 
llvm::Triple::UnknownEnvironment ||
+arch_spec.GetTriple().getEnvironment() == 
llvm::Triple::EABIHF)
+
arch_spec.GetTriple().setEnvironment(llvm::Triple::EABI);
+
+arch_spec.SetFlags(ArchSpec::eARM_abi_soft_float);
+}
+else if (VFPArgs == llvm::ARMBuildAttrs::HardFPAAPCS)
+{
+if (arch_spec.GetTriple().getEnvironment() == 
llvm::Triple::UnknownEnvironment ||
+arch_spec.GetTriple().getEnvironment() == 
llvm::Triple::EABI)
+
arch_spec.GetTriple().setEnvironment(llvm::Triple::EABIHF);
+
+arch_spec.SetFlags(ArchSpec::eARM_abi_hard_float);
+}
+
+break;
+}
+}
+}
+}
+}
 
 //--
 // GetSectionHeaderInfo
@@ -1648,6 +1736,18 @@ ObjectFileELF::GetSectionHeaderInfo(Sect
 arch_spec.SetFlags (arch_flags);
 }
 
+if (arch_spec.GetMachine() == llvm::Triple::arm || 
arch_spec.GetMachine() == llvm::Triple::thumb)
+ 

[Lldb-commits] [lldb] lldb: android: fix missing Python import of urlparse in lldb test utilities (PR #99934)

2024-07-22 Thread Saleem Abdulrasool via lldb-commits

https://github.com/compnerd approved this pull request.


https://github.com/llvm/llvm-project/pull/99934
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] lldb: android: fix missing Python import of urlparse in lldb test utilities (PR #99934)

2024-07-23 Thread Saleem Abdulrasool via lldb-commits

https://github.com/compnerd closed 
https://github.com/llvm/llvm-project/pull/99934
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Change the implementation of Status to store an llvm::Error (NFC) (PR #106774)

2024-09-01 Thread Saleem Abdulrasool via lldb-commits


@@ -97,7 +97,7 @@ class LLDB_API SBError {
   friend class lldb_private::ScriptInterpreter;
   friend class lldb_private::python::SWIGBridge;
 
-  SBError(const lldb_private::Status &error);
+  SBError(lldb_private::Status &&error);

compnerd wrote:

I agree with @JDevlieghere that we shouldn't consider private symbols as ABI. 
As long as we do not decrease the access level, I think that the breakage 
should be fine.

https://github.com/llvm/llvm-project/pull/106774
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] lldb: get lldb API tests working with newer Android NDKs (PR #106443)

2024-09-16 Thread Saleem Abdulrasool via lldb-commits


@@ -1,81 +1,59 @@
 NDK_ROOT := $(shell dirname $(CC))/../../../../..
 
-ifeq "$(findstring 64, $(ARCH))" "64"
-   # lowest 64-bit API level
-   API_LEVEL := 21
-else ifeq "$(ARCH)" "i386"
-   # clone(2) declaration is present only since this api level
-   API_LEVEL := 17
+ifeq "$(HOST_OS)" "Linux"
+   HOST_TAG := linux-x86_64
+else ifeq "$(HOST_OS)" "Darwin"
+   HOST_TAG := darwin-x86_64
 else
-   # lowest supported 32-bit API level
-   API_LEVEL := 16
+   HOST_TAG := windows-x86_64
+endif
+
+TOOLCHAIN_ROOT := $(NDK_ROOT)/toolchains/llvm/prebuilt/$(HOST_TAG)
+TOOLCHAIN_SYSROOT := $(TOOLCHAIN_ROOT)/sysroot
+
+OBJCOPY ?= $(TOOLCHAIN_ROOT)/bin/llvm-objcopy
+ARCHIVER ?= $(TOOLCHAIN_ROOT)/bin/llvm-ar
+
+ifeq "$(wildcard $(TOOLCHAIN_SYSROOT)/.)" ""
+# Compiling test inferiors for Android requires an NDK with the unified
+# toolchain introduced in version r19.
+$(error "No unified toolchain sysroot found in $(NDK_ROOT). NDK must be r19 or 
later.")
 endif
 
 ifeq "$(ARCH)" "arm"
-   SYSROOT_ARCH := arm
-   STL_ARCH := armeabi-v7a
TRIPLE := armv7-none-linux-androideabi
ARCH_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm
 else ifeq "$(ARCH)" "aarch64"
-   SYSROOT_ARCH := arm64
-   STL_ARCH := arm64-v8a
TRIPLE := aarch64-none-linux-android
 else ifeq "$(ARCH)" "i386"
-   SYSROOT_ARCH := x86
-   STL_ARCH := x86
TRIPLE := i686-none-linux-android
 else
-   SYSROOT_ARCH := $(ARCH)
-   STL_ARCH := $(ARCH)
TRIPLE := $(ARCH)-none-linux-android
 endif
 
-ifeq "$(findstring 86,$(ARCH))" "86"
-   TOOLCHAIN_DIR := $(STL_ARCH)-4.9
-else ifeq "$(ARCH)" "arm"
-   TOOLCHAIN_DIR := arm-linux-androideabi-4.9
-else
-   TOOLCHAIN_DIR := $(subst -none,,$(TRIPLE))-4.9
-endif
+# lowest 64-bit API level
+API_LEVEL := 21

compnerd wrote:

This is Android 5.0, Lollipop, which has ~99.6% adoption as per 
https://apilevels.com/. Additionally, this is from 2014, which is still 10 
years ago.

https://github.com/llvm/llvm-project/pull/106443
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] lldb: get lldb API tests working with newer Android NDKs (PR #106443)

2024-09-16 Thread Saleem Abdulrasool via lldb-commits

https://github.com/compnerd approved this pull request.


https://github.com/llvm/llvm-project/pull/106443
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] lldb: add support for thread names on Windows (PR #74731)

2023-12-11 Thread Saleem Abdulrasool via lldb-commits


@@ -175,3 +179,30 @@ Status TargetThreadWindows::DoResume() {
 
   return Status();
 }
+
+const char *TargetThreadWindows::GetName() {
+  Log *log = GetLog(LLDBLog::Thread);
+  HMODULE hModule = ::LoadLibraryW(L"Kernel32.dll");
+  if (hModule) {
+auto GetThreadDescription =

compnerd wrote:

This should be pulled out into a lambda and store the lookup rather than 
re-evaluating it each time.

https://github.com/llvm/llvm-project/pull/74731
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] lldb: add support for thread names on Windows (PR #74731)

2023-12-11 Thread Saleem Abdulrasool via lldb-commits


@@ -175,3 +179,30 @@ Status TargetThreadWindows::DoResume() {
 
   return Status();
 }
+
+const char *TargetThreadWindows::GetName() {
+  Log *log = GetLog(LLDBLog::Thread);
+  HMODULE hModule = ::LoadLibraryW(L"Kernel32.dll");
+  if (hModule) {
+auto GetThreadDescription =
+reinterpret_cast(
+::GetProcAddress(hModule, "GetThreadDescription"));
+LLDB_LOGF(log, "GetProcAddress: %p",
+  reinterpret_cast(GetThreadDescription));
+if (GetThreadDescription) {

compnerd wrote:

An early out here would be nice to reduce indentation.

https://github.com/llvm/llvm-project/pull/74731
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] lldb: add support for thread names on Windows (PR #74731)

2023-12-11 Thread Saleem Abdulrasool via lldb-commits


@@ -175,3 +179,30 @@ Status TargetThreadWindows::DoResume() {
 
   return Status();
 }
+
+const char *TargetThreadWindows::GetName() {
+  Log *log = GetLog(LLDBLog::Thread);
+  HMODULE hModule = ::LoadLibraryW(L"Kernel32.dll");
+  if (hModule) {
+auto GetThreadDescription =
+reinterpret_cast(
+::GetProcAddress(hModule, "GetThreadDescription"));

compnerd wrote:

If there is compatibility that we are concerned about, I think that we should 
consider falling back to more ... esoteric solutions.

```c++
__try {
  RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), 
(ULONG_PTR*)&info);  
} __except (EXCEPTION_EXECUTE_HANDLER) {
} 
```

Should be far more portable and is what VS also uses.  This is documented at 
https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2015/debugger/how-to-set-a-thread-name-in-native-code?view=vs-2015&redirectedfrom=MSDN.

I would be okay with also raising the requirements to a newer version of 
Windows as 1607 is RS1 which makes it more than 8 years old at this point.

https://github.com/llvm/llvm-project/pull/74731
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] lldb: add support for thread names on Windows (PR #74731)

2023-12-12 Thread Saleem Abdulrasool via lldb-commits


@@ -175,3 +179,30 @@ Status TargetThreadWindows::DoResume() {
 
   return Status();
 }
+
+const char *TargetThreadWindows::GetName() {
+  Log *log = GetLog(LLDBLog::Thread);
+  HMODULE hModule = ::LoadLibraryW(L"Kernel32.dll");
+  if (hModule) {
+auto GetThreadDescription =
+reinterpret_cast(
+::GetProcAddress(hModule, "GetThreadDescription"));

compnerd wrote:

There is the set name below though.

https://github.com/llvm/llvm-project/pull/74731
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] lldb: add support for thread names on Windows (PR #74731)

2023-12-12 Thread Saleem Abdulrasool via lldb-commits

https://github.com/compnerd approved this pull request.


https://github.com/llvm/llvm-project/pull/74731
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Define _BSD_SOURCE globally, to get optreset available in mingw's getopt.h (PR #76137)

2023-12-21 Thread Saleem Abdulrasool via lldb-commits


@@ -44,6 +44,10 @@ endif()
 
 if (WIN32)
   add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
+  if (NOT MSVC)

compnerd wrote:

clang-cl should be detected as MSVC.  The define should be generally safe, but 
it is nice to be more precise and add it when needed.

https://github.com/llvm/llvm-project/pull/76137
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Saleem Abdulrasool via lldb-commits


@@ -168,8 +168,8 @@ class ConstString {
   // Implicitly convert \class ConstString instances to \class StringRef.
   operator llvm::StringRef() const { return GetStringRef(); }
 
-  // Implicitly convert \class ConstString instances to \class 
std::string_view.
-  operator std::string_view() const {
+  // Explicitly convert \class ConstString instances to \class 
std::string_view.
+  explicit operator std::string_view() const {

compnerd wrote:

How about flipping this to make `llvm::StringRef` the explicit conversion and 
leave `std::string_view` the implicit one? This seems like it would be better 
as we tend towards the standard types, which would make the eventual removal of 
`StringRef` easier.

https://github.com/llvm/llvm-project/pull/84362
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Saleem Abdulrasool via lldb-commits


@@ -168,8 +168,8 @@ class ConstString {
   // Implicitly convert \class ConstString instances to \class StringRef.
   operator llvm::StringRef() const { return GetStringRef(); }
 
-  // Implicitly convert \class ConstString instances to \class 
std::string_view.
-  operator std::string_view() const {
+  // Explicitly convert \class ConstString instances to \class 
std::string_view.
+  explicit operator std::string_view() const {

compnerd wrote:

:(

https://github.com/llvm/llvm-project/pull/84362
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Fix MSVC build issues (PR #84362)

2024-03-07 Thread Saleem Abdulrasool via lldb-commits

https://github.com/compnerd approved this pull request.


https://github.com/llvm/llvm-project/pull/84362
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-03-27 Thread Saleem Abdulrasool via lldb-commits

compnerd wrote:

Philosophically, I agree with this change. Enshrining the information about the 
line endings into the SCM tool makes sense.

I think that the concern that I have is that do we have sufficient testing for 
supporting line-ending dependent behaviour in the compiler? Additionally, do we 
have sufficient documentation for others to figure out how to ensure that git 
does not munge the line endings if they are introducing a test which is 
dependent on it? In such a case, how do we ensure that they are aware that the 
SCM will do so without actually checking the post-commit state with a hex 
editor?

https://github.com/llvm/llvm-project/pull/86318
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] Revert "NFC: Make clang resource headers an interface library (#88317)" (PR #89266)

2024-04-18 Thread Saleem Abdulrasool via lldb-commits

https://github.com/compnerd approved this pull request.

Approving it in case it needs to be merged, but I think that we should try to 
determine how it is breaking. This change feels like it should be correct and 
is a pretty good cleanup, so I would prefer that fix forward rather than revert.

https://github.com/llvm/llvm-project/pull/89266
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-04-25 Thread Saleem Abdulrasool via lldb-commits

compnerd wrote:

> @compnerd I just realised I didn't respond to your concern. Apologies.
> 
> > I think that the concern that I have is that do we have sufficient testing 
> > for supporting line-ending dependent behaviour in the compiler?
> 
> For the first part: I don't know that it matters, since this patch changes 
> how the LLVM source code is stored, but not how its parsers operate. In any 
> case, we run parser testing on LF and CRLF systems since the precommit 
> testing runs on Linux, and Win32 at least. In addition, and there are several 
> tests dedicated to line ending, so I think we should be good there. Happy to 
> tend to this and fix anything I've missed if someone lets me know something 
> is broken after we merge.

I don't know if the pre-commit testing guarantees that. Configuration settings 
will permit the files to be checked out in either Unix (`\n`) or Windows 
(`\r\n`) line-endings. If the builders are all configured to run in Unix line 
endings we lose that coverage. While I understand that this change only changes 
how the LLVM sources are stored, the issue is that the LLVM sources include the 
_tests_ directory. These need to be tested in various manners to ensure that we 
test how we handle the different inputs (in clang). One option might be to 
exclude the tests directory from the line ending conversion if we cannot verify 
that we have tests in both formats.

> As for the second part
> 
> > Additionally, do we have sufficient documentation for others to figure out 
> > how to ensure that git does not munge the line endings if they are 
> > introducing a test which is dependent on it? In such a case, how do we 
> > ensure that they are aware that the SCM will do so without actually 
> > checking the post-commit state with a hex editor?
> 
> I don't think we do, but also this patch doesn't really change the problem 
> since right now basically _anything_ can happen due to local configuration 
> overrides (`~/.gitconfig`). I'll add a comment to the testing infrastructure 
> page to be mindful of how line endings are storedand link to the 
> `.gitattributes` documentation. Does that sound enough?

I think that the documentation should be good. While, yes, it is possible to 
get the wrong behaviour currently, if the user configures git explicitly for a 
line-ending, I would expect them to be aware of that. The use of 
`.gitattributes` means that their defaults are not necessarily honoured and 
thus this can catch them by surprise.

https://github.com/llvm/llvm-project/pull/86318
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-04-25 Thread Saleem Abdulrasool via lldb-commits

compnerd wrote:

> changes to `clang/test/CXX/lex/lex.literal/lex.string/p4.cpp` should be 
> reverted (it's a CRLF related test)

This is the type of problems that I am concerned about. We certainly have some 
tests which are line-ending sensitive, and each test should be audited before 
we make such a change.

https://github.com/llvm/llvm-project/pull/86318
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [clang-tools-extra] [compiler-rt] [flang] [lld] [lldb] [llvm] [mlir] [openmp] [pstl] Finally formalise our defacto line-ending policy (PR #86318)

2024-04-25 Thread Saleem Abdulrasool via lldb-commits

compnerd wrote:

> Also, it's a bit funny to have .bat files without CRLF endings given that 
> they run on Windows.

I'm not sure about the funny bit - but certainly dangerous. I've had cmd 
misinterpret batch files with LF vs CRLF.

https://github.com/llvm/llvm-project/pull/86318
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] f1585a4 - Windows: support `DoLoadImage`

2021-12-04 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2021-12-04T11:11:47-08:00
New Revision: f1585a4b47cc9c08c9a4c10058597f4b7468c227

URL: 
https://github.com/llvm/llvm-project/commit/f1585a4b47cc9c08c9a4c10058597f4b7468c227
DIFF: 
https://github.com/llvm/llvm-project/commit/f1585a4b47cc9c08c9a4c10058597f4b7468c227.diff

LOG: Windows: support `DoLoadImage`

This implements `DoLoadImage` and `UnloadImage` in the Windows platform
plugin modelled after the POSIX platform plugin.  This was previously
unimplemented and resulted in a difficult to decipher error without any
logging.

This implementation is intended to support enables the use of LLDB's
Swift REPL on Windows.

Paths which are added to the library search path are persistent and
applied to all subsequent loads.  This can be adjusted in the future by
storing all the cookies and restoring the path prior to returning from
the helper.  However, the dynamic path count makes this a bit more
challenging.

Reviewed By: @JDevlieghere
Differential Revision: https://reviews.llvm.org/D77287

Added: 
lldb/test/Shell/Process/Windows/process_load.cpp

Modified: 
lldb/source/Plugins/Platform/Windows/CMakeLists.txt
lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
lldb/source/Plugins/Platform/Windows/PlatformWindows.h

Removed: 




diff  --git a/lldb/source/Plugins/Platform/Windows/CMakeLists.txt 
b/lldb/source/Plugins/Platform/Windows/CMakeLists.txt
index 49a197cdaff36..28c174dc4d95e 100644
--- a/lldb/source/Plugins/Platform/Windows/CMakeLists.txt
+++ b/lldb/source/Plugins/Platform/Windows/CMakeLists.txt
@@ -6,4 +6,7 @@ add_lldb_library(lldbPluginPlatformWindows PLUGIN
 lldbCore
 lldbHost
 lldbTarget
+
+   LINK_COMPONENTS
+Support
   )

diff  --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index 8714953a9cdb8..0e25e9a8199bd 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -19,10 +19,20 @@
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Expression/DiagnosticManager.h"
+#include "lldb/Expression/FunctionCaller.h"
+#include "lldb/Expression/UserExpression.h"
+#include "lldb/Expression/UtilityFunction.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/Status.h"
 
+#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
+
+#include "llvm/ADT/ScopeExit.h"
+#include "llvm/Support/ConvertUTF.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -151,6 +161,283 @@ Status PlatformWindows::ConnectRemote(Args &args) {
   return error;
 }
 
+uint32_t PlatformWindows::DoLoadImage(Process *process,
+  const FileSpec &remote_file,
+  const std::vector *paths,
+  Status &error, FileSpec *loaded_image) {
+  DiagnosticManager diagnostics;
+
+  if (loaded_image)
+loaded_image->Clear();
+
+  ThreadSP thread = process->GetThreadList().GetExpressionExecutionThread();
+  if (!thread) {
+error.SetErrorString("LoadLibrary error: no thread available to invoke 
LoadLibrary");
+return LLDB_INVALID_IMAGE_TOKEN;
+  }
+
+  ExecutionContext context;
+  thread->CalculateExecutionContext(context);
+
+  Status status;
+  UtilityFunction *loader =
+  process->GetLoadImageUtilityFunction(this, [&]() -> 
std::unique_ptr {
+return MakeLoadImageUtilityFunction(context, status);
+  });
+  if (loader == nullptr)
+return LLDB_INVALID_IMAGE_TOKEN;
+
+  FunctionCaller *invocation = loader->GetFunctionCaller();
+  if (!invocation) {
+error.SetErrorString("LoadLibrary error: could not get function caller");
+return LLDB_INVALID_IMAGE_TOKEN;
+  }
+
+  /* Convert name */
+  llvm::SmallVector name;
+  if (!llvm::convertUTF8ToUTF16String(remote_file.GetPath(), name)) {
+error.SetErrorString("LoadLibrary error: could not convert path to UCS2");
+return LLDB_INVALID_IMAGE_TOKEN;
+  }
+  name.emplace_back(L'\0');
+
+  /* Inject name paramter into inferior */
+  lldb::addr_t injected_name =
+  process->AllocateMemory(name.size() * sizeof(llvm::UTF16),
+  ePermissionsReadable | ePermissionsWritable,
+  status);
+  if (injected_name == LLDB_INVALID_ADDRESS) {
+error.SetErrorStringWithFormat("LoadLibrary error: unable to allocate 
memory for name: %s",
+   status.AsCString());
+return LLDB_INVALID_IMAGE_TOKEN;
+  }
+
+  auto name_cleanup = llvm::make_scope_exit([process, injected_name]() {
+process->DeallocateMemory(injected_name);
+  });
+
+  process->WriteMemory(injected_name, name.data(),
+   name.size() * sizeof(llvm::UTF1

[Lldb-commits] [lldb] 906e60b - lldb: silence a warning on the Windows error path (NFCI)

2021-12-08 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2021-12-08T09:01:10-08:00
New Revision: 906e60b9f923464cba0f71a9205846550752162f

URL: 
https://github.com/llvm/llvm-project/commit/906e60b9f923464cba0f71a9205846550752162f
DIFF: 
https://github.com/llvm/llvm-project/commit/906e60b9f923464cba0f71a9205846550752162f.diff

LOG: lldb: silence a warning on the Windows error path (NFCI)

This corrects the printf specifier for the `error_code` parameter that
was reported by @thakis.

Added: 


Modified: 
lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index d41d422576a9..eb1e3a9f7a00 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -394,7 +394,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
   return LLDB_INVALID_IMAGE_TOKEN;
 }
 
-error.SetErrorStringWithFormat("LoadLibrary Error: %lu", error_code);
+error.SetErrorStringWithFormat("LoadLibrary Error: %llu", error_code);
 return LLDB_INVALID_IMAGE_TOKEN;
   }
 



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


[Lldb-commits] [lldb] b5491dd - ObjectFile: add a case for `EM_RISCV`

2022-03-04 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2022-03-04T21:54:20Z
New Revision: b5491dd30792c1ad31bfc8e2f9d1809a79205234

URL: 
https://github.com/llvm/llvm-project/commit/b5491dd30792c1ad31bfc8e2f9d1809a79205234
DIFF: 
https://github.com/llvm/llvm-project/commit/b5491dd30792c1ad31bfc8e2f9d1809a79205234.diff

LOG: ObjectFile: add a case for `EM_RISCV`

This adds the jump slot mapping for RISCV.  This enables lldb to attach to a
remote debug server.  Although this doesn't enable debugging RISCV targets, it
is sufficient to attach, which is a slight improvement.

Tested with DebugServer2:
~~~
(lldb) gdb-remote localhost:1234
(lldb) Process 71438 stopped
* thread #1, name = 'reduced', stop reason = signal SIGTRAP
frame #0: 0x003ff7fe1b20

error: Process 71438 is currently being debugged, kill the process before 
connecting.
(lldb) register read
general:
x0 = 0x003ff7fe1b20
x1 = 0x002ae00d3a50
x2 = 0x003ff3e0
x3 = 0x002ae01566e0
x4 = 0x003fe567c7b0
x5 = 0x1000
x6 = 0x002ae00604ec
x7 = 0x03ff
x8 = 0x003fffc22db0
x9 = 0x
   x10 = 0x
   x11 = 0x002ae603b1c0
   x12 = 0x002ae6039350
   x13 = 0x
   x14 = 0x002ae6039350
   x15 = 0x002ae6039350
   x16 = 0x73642f74756f3d5f
   x17 = 0x00dd
   x18 = 0x002ae6038f08
   x19 = 0x002ae603b1c0
   x20 = 0x002b0f3d3f40
   x21 = 0x003ff0b212d0
   x22 = 0x002b0f3a2740
   x23 = 0x002b0f3de3a0
   x24 = 0x002b0f3d3f40
   x25 = 0x002ad6929850
   x26 = 0x
   x27 = 0x002ad69297c0
   x28 = 0x003fe578b364
   x29 = 0x002f
   x30 = 0x
   x31 = 0x002ae602401a
pc = 0x003ff7fe1b20
   ft0 = 0
   ft1 = 0
   ft2 = 0
   ft3 = 0
   ft4 = 0
   ft5 = 0
   ft6 = 0
   ft7 = 0
   fs0 = 0
   fs1 = 0
   fa0 = 0
   fa1 = 0
   fa2 = 0
   fa3 = 0
   fa4 = 0
   fa5 = 0
   fa6 = 0
   fa7 = 9.10304232197721e-313
   fs2 = 0
   fs3 = 1.35805727667792e-312
   fs4 = 1.35589259164679e-312
   fs5 = 1.35805727659887e-312
   fs6 = 9.10304232355822e-313
   fs7 = 0
   fs8 = 9.10304233027751e-313
   fs9 = 0
  fs10 = 9.10304232948701e-313
  fs11 = 1.35588724164707e-312
   ft8 = 0
   ft9 = 9.1372158616833e-313
  ft10 = 9.13720376537528e-313
  ft11 = 1.356808717416e-312
3 registers were unavailable.

(lldb) disassemble
error: Failed to disassemble memory at 0x3ff7fe1b2
~~~

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
index f0496beba2ef4..abda0cd0e9a38 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
@@ -208,6 +208,9 @@ unsigned ELFHeader::GetRelocationJumpSlotType() const {
   case EM_S390:
 slot = R_390_JMP_SLOT;
 break;
+  case EM_RISCV:
+slot = R_RISCV_JUMP_SLOT;
+break;
   }
 
   return slot;



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


[Lldb-commits] [lldb] f52b5a8 - lldb/ObjectFile: reflow a comment (NFC)

2022-03-09 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2022-03-09T18:47:31Z
New Revision: f52b5a852a4b4d48b9c049e68569cfdb184f11ab

URL: 
https://github.com/llvm/llvm-project/commit/f52b5a852a4b4d48b9c049e68569cfdb184f11ab
DIFF: 
https://github.com/llvm/llvm-project/commit/f52b5a852a4b4d48b9c049e68569cfdb184f11ab.diff

LOG: lldb/ObjectFile: reflow a comment (NFC)

Reflow the textual comment which preserves formatted output from
tooling.  This makes the content legible again after the lldb source
code was reformatted with automated tooling.

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index f9929aed06ecf..77d126684e662 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1175,26 +1175,28 @@ 
ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
   // register info
   arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
 } else if (note.n_name == LLDB_NT_OWNER_CORE) {
-  // Parse the NT_FILE to look for stuff in paths to shared libraries As
-  // the contents look like this in a 64 bit ELF core file: count =
-  // 0x000a (10) page_size = 0x1000 (4096) Index
-  // start  endfile_ofs   path =
-  // 0x00401000 0x /tmp/a.out [  1]
-  // 0x0060 0x00601000 0x /tmp/a.out [
-  // 2] 0x00601000 0x00602000 0x0001 /tmp/a.out
-  // [  3] 0x7fa79c9ed000 0x7fa79cba8000 0x
-  // /lib/x86_64-linux-gnu/libc-2.19.so [  4] 0x7fa79cba8000
-  // 0x7fa79cda7000 0x01bb /lib/x86_64-linux-
-  // gnu/libc-2.19.so [  5] 0x7fa79cda7000 0x7fa79cdab000
-  // 0x01ba /lib/x86_64-linux-gnu/libc-2.19.so [  6]
-  // 0x7fa79cdab000 0x7fa79cdad000 0x01be /lib/x86_64
-  // -linux-gnu/libc-2.19.so [  7] 0x7fa79cdb2000 0x7fa79cdd5000
-  // 0x /lib/x86_64-linux-gnu/ld-2.19.so [  8]
-  // 0x7fa79cfd4000 0x7fa79cfd5000 0x0022 /lib/x86_64
-  // -linux-gnu/ld-2.19.so [  9] 0x7fa79cfd5000 0x7fa79cfd6000
-  // 0x0023 /lib/x86_64-linux-gnu/ld-2.19.so In the 32 bit ELFs
-  // the count, page_size, start, end, file_ofs are uint32_t For reference:
-  // see readelf source code (in binutils).
+  // Parse the NT_FILE to look for stuff in paths to shared libraries
+  // The contents look like this in a 64 bit ELF core file:
+  //
+  // count = 0x000a (10)
+  // page_size = 0x1000 (4096)
+  // Index start  endfile_ofs   path
+  // = -- -- -- 
-
+  // [  0] 0x00401000 0x
/tmp/a.out
+  // [  1] 0x0060 0x00601000 0x 
/tmp/a.out
+  // [  2] 0x00601000 0x00602000 0x0001 
/tmp/a.out
+  // [  3] 0x7fa79c9ed000 0x7fa79cba8000 0x 
/lib/x86_64-linux-gnu/libc-2.19.so
+  // [  4] 0x7fa79cba8000 0x7fa79cda7000 0x01bb 
/lib/x86_64-linux-gnu/libc-2.19.so
+  // [  5] 0x7fa79cda7000 0x7fa79cdab000 0x01ba 
/lib/x86_64-linux-gnu/libc-2.19.so
+  // [  6] 0x7fa79cdab000 0x7fa79cdad000 0x01be 
/lib/x86_64-linux-gnu/libc-2.19.so
+  // [  7] 0x7fa79cdb2000 0x7fa79cdd5000 0x 
/lib/x86_64-linux-gnu/ld-2.19.so
+  // [  8] 0x7fa79cfd4000 0x7fa79cfd5000 0x0022 
/lib/x86_64-linux-gnu/ld-2.19.so
+  // [  9] 0x7fa79cfd5000 0x7fa79cfd6000 0x0023 
/lib/x86_64-linux-gnu/ld-2.19.so
+  //
+  // In the 32 bit ELFs the count, page_size, start, end, file_ofs are
+  // uint32_t.
+  //
+  // For reference: see readelf source code (in binutils).
   if (note.n_type == NT_FILE) {
 uint64_t count = data.GetAddress(&offset);
 const char *cstr;



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


[Lldb-commits] [lldb] c604207 - lldb/ObjectFile, Disassembler: read some state from the executable

2022-03-10 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2022-03-10T21:42:06Z
New Revision: c6042076081025bc8060637b05fbeb24dbb82538

URL: 
https://github.com/llvm/llvm-project/commit/c6042076081025bc8060637b05fbeb24dbb82538
DIFF: 
https://github.com/llvm/llvm-project/commit/c6042076081025bc8060637b05fbeb24dbb82538.diff

LOG: lldb/ObjectFile,Disassembler: read some state from the executable

Add support to inspect the ELF headers for RISCV targets to determine if
RVC or RVE are enabled and the floating point support to enable.  As per
the RISCV specification, d implies f, q implies d implies f, which gives
us the cascading effect that is used to enable the features when setting
up the disassembler.  With this change, it is now possible to attach the
debugger to a remote process and be able to disassemble the instruction
stream.

~~~
$ bin/lldb tmp/reduced
(lldb) target create "reduced"
Current executable set to '/tmp/reduced' (riscv64).
(lldb) gdb-remote localhost:1234
(lldb) Process 5737 stopped
* thread #1, name = 'reduced', stop reason = signal SIGTRAP
frame #0: 0x003ff7fe1b20
->  0x3ff7fe1b20: mv a0, sp
0x3ff7fe1b22: jal1936
0x3ff7fe1b26: mv s0, a0
0x3ff7fe1b28: auipc  a0, 27
~~~

Added: 


Modified: 
lldb/include/lldb/Utility/ArchSpec.h
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/ArchSpec.h 
b/lldb/include/lldb/Utility/ArchSpec.h
index fdfe6aceb033c..f67acedf11c2e 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -92,6 +92,17 @@ class ArchSpec {
 eARM_abi_hard_float = 0x0400
   };
 
+  enum RISCVeflags {
+eRISCV_rvc  = 0x0001, /// RVC, +c
+eRISCV_float_abi_soft   = 0x, /// soft float
+eRISCV_float_abi_single = 0x0002, /// single precision floating point, 
+f
+eRISCV_float_abi_double = 0x0004, /// double precision floating point, 
+d
+eRISCV_float_abi_quad   = 0x0006, /// quad precision floating point, +q
+eRISCV_float_abi_mask   = 0x0006,
+eRISCV_rve  = 0x0008, /// RVE, +e
+eRISCV_tso  = 0x0010, /// RVTSO (total store ordering)
+  };
+
   enum RISCVSubType {
 eRISCVSubType_unknown,
 eRISCVSubType_riscv32,

diff  --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index e1ad5ac838c72..ee6ae3ffe3db9 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -1187,6 +1187,24 @@ DisassemblerLLVMC::DisassemblerLLVMC(const ArchSpec 
&arch,
   cpu = "apple-latest";
   }
 
+  if (triple.isRISCV()) {
+uint32_t arch_flags = arch.GetFlags();
+if (arch_flags & ArchSpec::eRISCV_rvc)
+  features_str += "+c,";
+if (arch_flags & ArchSpec::eRISCV_rve)
+  features_str += "+e,";
+if ((arch_flags & ArchSpec::eRISCV_float_abi_single) ==
+ArchSpec::eRISCV_float_abi_single)
+  features_str += "+f,";
+if ((arch_flags & ArchSpec::eRISCV_float_abi_double) ==
+ArchSpec::eRISCV_float_abi_double)
+  features_str += "+f,+d,";
+if ((arch_flags & ArchSpec::eRISCV_float_abi_quad) ==
+ArchSpec::eRISCV_float_abi_quad)
+  features_str += "+f,+d,+q,";
+// FIXME: how do we detect features such as `+a`, `+m`?
+  }
+
   // We use m_disasm_up.get() to tell whether we are valid or not, so if this
   // isn't good for some reason, we won't be valid and FindPlugin will fail and
   // we won't get used.

diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 77d126684e662..0c79bc57e64a7 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1364,6 +1364,28 @@ size_t 
ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers,
   arch_spec.SetFlags(ArchSpec::eARM_abi_hard_float);
   }
 
+  if (arch_spec.GetMachine() == llvm::Triple::riscv32 ||
+  arch_spec.GetMachine() == llvm::Triple::riscv64) {
+uint32_t flags = arch_spec.GetFlags();
+
+if (header.e_flags & llvm::ELF::EF_RISCV_RVC)
+  flags |= ArchSpec::eRISCV_rvc;
+if (header.e_flags & llvm::ELF::EF_RISCV_RVE)
+  flags |= ArchSpec::eRISCV_rve;
+
+if ((header.e_flags & llvm::ELF::EF_RISCV_FLOAT_ABI_SINGLE) ==
+llvm::ELF::EF_RISCV_FLOAT_ABI_SINGLE)
+  flags |= ArchSpec::eRISCV_float_abi_single;
+else if ((header.e_flags & llvm::ELF::EF_RISCV_FLOAT_ABI_DOUBLE) ==
+ llvm::ELF::EF_RISCV_FLOAT_ABI_DOUBLE)
+  flags |= ArchSpec::eRISCV_float_abi_double;
+else if ((header.e_flags & llvm::ELF::EF_RISCV_FLOAT_ABI_QUAD) ==
+ llvm::ELF::EF_RISCV

[Lldb-commits] [lldb] 2696d82 - Windows: correct iteration of additional search paths

2022-04-16 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2022-04-16T18:01:02-07:00
New Revision: 2696d82fa0c323d92d8794f0a34ea9619888fae9

URL: 
https://github.com/llvm/llvm-project/commit/2696d82fa0c323d92d8794f0a34ea9619888fae9
DIFF: 
https://github.com/llvm/llvm-project/commit/2696d82fa0c323d92d8794f0a34ea9619888fae9.diff

LOG: Windows: correct iteration of additional search paths

This adjusts the path iteration - `paths` is a null-terminated sequence
of C strings, creating an array from a single contiguous buffer.  We
would previously continue to iterate indefinitely as we did not check if
we had encountered the terminator.

Found by inspection.

Added: 


Modified: 
lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp 
b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index b0501af7df30b..38f387dfdb29d 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -651,7 +651,7 @@ _Static_assert(sizeof(struct __lldb_LoadLibraryResult) <= 3 
* sizeof(void *),
 
 void * __lldb_LoadLibraryHelper(const wchar_t *name, const wchar_t *paths,
 __lldb_LoadLibraryResult *result) {
-  for (const wchar_t *path = paths; path; ) {
+  for (const wchar_t *path = paths; path && *path; ) {
 (void)AddDllDirectory(path);
 path += wcslen(path) + 1;
   }



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


[Lldb-commits] [lldb] 16b7cf2 - SymbolFile: ensure that we have a value before invoking `getBitWidth`

2023-03-22 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2023-03-22T14:14:13-04:00
New Revision: 16b7cf245ec0ff5428daee4f71af62e1938bfc73

URL: 
https://github.com/llvm/llvm-project/commit/16b7cf245ec0ff5428daee4f71af62e1938bfc73
DIFF: 
https://github.com/llvm/llvm-project/commit/16b7cf245ec0ff5428daee4f71af62e1938bfc73.diff

LOG: SymbolFile: ensure that we have a value before invoking `getBitWidth`

Ensure that the variant returned by `member->getValue()` has a value and
is not `Empty`.  Failure to do so will trigger an assertion failure in
`llvm::pdb::Variant::getBitWidth()`.  This can occur when the `static`
member is a forward declaration.

Differential Revision: https://reviews.llvm.org/D146536
Reviewed By: sgraenitz

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp 
b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index da57338ffb58a..b1a882465c404 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -1299,6 +1299,15 @@ void PDBASTParser::AddRecordMembers(
   // Query the symbol's value as the variable initializer if valid.
   if (member_comp_type.IsConst()) {
 auto value = member->getValue();
+if (value.Type == llvm::pdb::Empty) {
+  LLDB_LOG(GetLog(LLDBLog::AST),
+   "Class '{0}' has member '{1}' of type '{2}' with an unknown 
"
+   "constant size.",
+   record_type.GetTypeName(), member_name,
+   member_comp_type.GetTypeName());
+  continue;
+}
+
 clang::QualType qual_type = decl->getType();
 unsigned type_width = m_ast.getASTContext().getIntWidth(qual_type);
 unsigned constant_width = value.getBitWidth();



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


[Lldb-commits] [lldb] d87cd45 - PECOFF: consume errors properly

2023-04-17 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2023-04-17T07:53:54-07:00
New Revision: d87cd45e4d855b57aed76dbd72c270ed152542ff

URL: 
https://github.com/llvm/llvm-project/commit/d87cd45e4d855b57aed76dbd72c270ed152542ff
DIFF: 
https://github.com/llvm/llvm-project/commit/d87cd45e4d855b57aed76dbd72c270ed152542ff.diff

LOG: PECOFF: consume errors properly

We would not ensure that the error is consumed in the case that logging
is disabled. Ensure that we properly drop the error on the floor or we
would re-trigger the checked failure.

Differential Revision: https://reviews.llvm.org/D147669
Reviewed By: sgraenitz

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp 
b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 95c37d4202b51..1d11caf155ec1 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -863,10 +863,14 @@ ObjectFilePECOFF::AppendFromExportTable(SectionList 
*sect_list,
   for (const auto &entry : m_binary->export_directories()) {
 llvm::StringRef sym_name;
 if (auto err = entry.getSymbolName(sym_name)) {
-  LLDB_LOG(log,
-   "ObjectFilePECOFF::AppendFromExportTable - failed to get export 
"
-   "table entry name: {0}",
-   llvm::fmt_consume(std::move(err)));
+  if (log)
+log->Format(
+__FILE__, __func__,
+"ObjectFilePECOFF::AppendFromExportTable - failed to get export "
+"table entry name: {0}",
+llvm::fmt_consume(std::move(err)));
+  else
+llvm::consumeError(std::move(err));
   continue;
 }
 Symbol symbol;
@@ -884,10 +888,13 @@ ObjectFilePECOFF::AppendFromExportTable(SectionList 
*sect_list,
   // it in symtab and make a note using the symbol name.
   llvm::StringRef forwarder_name;
   if (auto err = entry.getForwardTo(forwarder_name)) {
-LLDB_LOG(log,
- "ObjectFilePECOFF::AppendFromExportTable - failed to get "
- "forwarder name of forwarder export '{0}': {1}",
- sym_name, llvm::fmt_consume(std::move(err)));
+if (log)
+  log->Format(__FILE__, __func__,
+  "ObjectFilePECOFF::AppendFromExportTable - failed to get 
"
+  "forwarder name of forwarder export '{0}': {1}",
+  sym_name, llvm::fmt_consume(std::move(err)));
+else
+  llvm::consumeError(std::move(err));
 continue;
   }
   llvm::SmallString<256> new_name = 
{symbol.GetDisplayName().GetStringRef(),
@@ -899,10 +906,13 @@ ObjectFilePECOFF::AppendFromExportTable(SectionList 
*sect_list,
 
 uint32_t function_rva;
 if (auto err = entry.getExportRVA(function_rva)) {
-  LLDB_LOG(log,
-   "ObjectFilePECOFF::AppendFromExportTable - failed to get "
-   "address of export entry '{0}': {1}",
-   sym_name, llvm::fmt_consume(std::move(err)));
+  if (log)
+log->Format(__FILE__, __func__,
+"ObjectFilePECOFF::AppendFromExportTable - failed to get "
+"address of export entry '{0}': {1}",
+sym_name, llvm::fmt_consume(std::move(err)));
+  else
+llvm::consumeError(std::move(err));
   continue;
 }
 // Skip the symbol if it doesn't look valid.



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


[Lldb-commits] [lldb] ade3c6a - Host: generalise `GetXcodeSDKPath`

2023-04-28 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2023-04-28T09:30:59-07:00
New Revision: ade3c6a6a88ed3a9b06c076406f196da9d3cc1b9

URL: 
https://github.com/llvm/llvm-project/commit/ade3c6a6a88ed3a9b06c076406f196da9d3cc1b9
DIFF: 
https://github.com/llvm/llvm-project/commit/ade3c6a6a88ed3a9b06c076406f196da9d3cc1b9.diff

LOG: Host: generalise `GetXcodeSDKPath`

This generalises the GetXcodeSDKPath hook to a GetSDKRoot path which
will be re-used for the Windows support to compute a language specific
SDK path on the platform. Because there may be other options that we
wish to use to compute the SDK path, sink the XcodeSDK parameter into
a structure which can pass a disaggregated set of options. Furthermore,
optionalise the parameter as Xcode is not available for all platforms.

Differential Revision: https://reviews.llvm.org/D149397
Reviewed By: JDevlieghere

Added: 


Modified: 
lldb/include/lldb/Host/HostInfoBase.h
lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
lldb/source/Core/Module.cpp
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/unittests/Host/HostInfoTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Host/HostInfoBase.h 
b/lldb/include/lldb/Host/HostInfoBase.h
index 42f71d91f9bf9..28f809398d5b4 100644
--- a/lldb/include/lldb/Host/HostInfoBase.h
+++ b/lldb/include/lldb/Host/HostInfoBase.h
@@ -31,6 +31,23 @@ struct SharedCacheImageInfo {
   lldb::DataBufferSP data_sp;
 };
 
+namespace {
+struct HostInfoError : public llvm::ErrorInfo {
+  static char ID;
+  const std::string message_;
+
+  HostInfoError(const std::string message) : message_(std::move(message)) {}
+
+  void log(llvm::raw_ostream &OS) const override { OS << "HostInfoError"; }
+
+  std::error_code convertToErrorCode() const override {
+return llvm::inconvertibleErrorCode();
+  }
+};
+
+char HostInfoError::ID = 0;
+} // namespace
+
 class HostInfoBase {
 private:
   // Static class, unconstructable.
@@ -108,10 +125,14 @@ class HostInfoBase {
 
   static FileSpec GetXcodeContentsDirectory() { return {}; }
   static FileSpec GetXcodeDeveloperDirectory() { return {}; }
-  
-  /// Return the directory containing a specific Xcode SDK.
-  static llvm::Expected GetXcodeSDKPath(XcodeSDK sdk) {
-return "";
+
+  struct SDKOptions {
+std::optional XcodeSDK;
+  };
+
+  /// Return the directory containing something like a SDK (reused for Swift).
+  static llvm::Expected GetSDKRoot(SDKOptions options) {
+return llvm::make_error("cannot determine SDK root");
   }
 
   /// Return information about module \p image_name if it is loaded in

diff  --git a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h 
b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
index 0402509cfa261..74d979d965a73 100644
--- a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
+++ b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
@@ -31,7 +31,7 @@ class HostInfoMacOSX : public HostInfoPosix {
   static FileSpec GetXcodeDeveloperDirectory();
 
   /// Query xcrun to find an Xcode SDK directory.
-  static llvm::Expected GetXcodeSDKPath(XcodeSDK sdk);
+  static llvm::Expected GetSDKRoot(SDKOptions options);
 
   /// Shared cache utilities
   static SharedCacheImageInfo

diff  --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 17d8043852ab7..6293cc7853f53 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1607,8 +1607,8 @@ std::optional 
Module::RemapSourceFile(llvm::StringRef path) const {
 
 void Module::RegisterXcodeSDK(llvm::StringRef sdk_name,
   llvm::StringRef sysroot) {
-  XcodeSDK sdk(sdk_name.str());
-  auto sdk_path_or_err = HostInfo::GetXcodeSDKPath(sdk);
+  auto sdk_path_or_err =
+  HostInfo::GetSDKRoot(HostInfo::SDKOptions{sdk_name.str()});
 
   if (!sdk_path_or_err) {
 Debugger::ReportError("Error while searching for Xcode SDK: " +

diff  --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm 
b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index 5a39ed370747a..6569013044513 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -338,7 +338,8 @@ static void ParseOSVersion(llvm::VersionTuple &version, 
NSString *Key) {
   }
 }
 
-auto sdk_path_or_err = HostInfo::GetXcodeSDKPath(XcodeSDK::GetAnyMacOS());
+auto sdk_path_or_err =
+HostInfo::GetSDKRoot(SDKOptions{XcodeSDK::GetAnyMacOS()});
 if (!sdk_path_or_err) {
   Log *log = GetLog(LLDBLog::Host);
   LLDB_LOGF(log, "Error while searching for Xcode SDK: %s",
@@ -519,7 +520,7 @@ static void ParseOSVersion(llvm::VersionTuple &version, 
NSString *Key) {
   return path;
 }
 
-llvm::Expected HostInfoMacOSX::GetXcodeSDKPath(XcodeSDK sdk) {
+llvm::Expected HostInfoMacOSX::GetSDKRoot(SDKOptions options) 
{
   struct E

[Lldb-commits] [lldb] 6bca093 - SymbolFile: invert condition, remove unnecessary `else` (NFC)

2023-05-05 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2023-05-05T07:31:19-07:00
New Revision: 6bca093976ef40f36a396b11a61a44dc0f4dcd13

URL: 
https://github.com/llvm/llvm-project/commit/6bca093976ef40f36a396b11a61a44dc0f4dcd13
DIFF: 
https://github.com/llvm/llvm-project/commit/6bca093976ef40f36a396b11a61a44dc0f4dcd13.diff

LOG: SymbolFile: invert condition, remove unnecessary `else` (NFC)

Remove an unnecessary `else` condition and swap the condition to be
positive rather than negative to make simpler to follow.  NFC

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 674977cd7b59a..e40752b9ff21b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1636,10 +1636,9 @@ bool SymbolFileDWARF::GetFunction(const DWARFDIE &die, 
SymbolContext &sc) {
 lldb::ModuleSP SymbolFileDWARF::GetExternalModule(ConstString name) {
   UpdateExternalModuleListIfNeeded();
   const auto &pos = m_external_type_modules.find(name);
-  if (pos != m_external_type_modules.end())
-return pos->second;
-  else
+  if (pos == m_external_type_modules.end())
 return lldb::ModuleSP();
+  return pos->second;
 }
 
 DWARFDIE



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


[Lldb-commits] [lldb] 039fc57 - ObjectFile: remove extraneous shadowed variable (NFCI)

2023-05-05 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2023-05-05T10:55:29-07:00
New Revision: 039fc57191980847afb6e674cac8bcbb6c1efa13

URL: 
https://github.com/llvm/llvm-project/commit/039fc57191980847afb6e674cac8bcbb6c1efa13
DIFF: 
https://github.com/llvm/llvm-project/commit/039fc57191980847afb6e674cac8bcbb6c1efa13.diff

LOG: ObjectFile: remove extraneous shadowed variable (NFCI)

We already construct the shared pointer for the module.  Avoid creating
a shadow copy and use the original definition.

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp 
b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index cded6b5fe698f..905226d67c2b5 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -1046,7 +1046,6 @@ void ObjectFilePECOFF::CreateSections(SectionList 
&unified_section_list) {
 unified_section_list.AddSection(header_sp);
 
 const uint32_t nsects = m_sect_headers.size();
-ModuleSP module_sp(GetModule());
 for (uint32_t idx = 0; idx < nsects; ++idx) {
   llvm::StringRef sect_name = GetSectionName(m_sect_headers[idx]);
   ConstString const_sect_name(sect_name);



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


[Lldb-commits] [lldb] 5014830 - ObjectFile: introduce a COFF object file plugin

2023-05-07 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2023-05-07T12:40:44-07:00
New Revision: 5014830ede78e55e2c638948ca00cea045eac9ce

URL: 
https://github.com/llvm/llvm-project/commit/5014830ede78e55e2c638948ca00cea045eac9ce
DIFF: 
https://github.com/llvm/llvm-project/commit/5014830ede78e55e2c638948ca00cea045eac9ce.diff

LOG: ObjectFile: introduce a COFF object file plugin

Windows uses COFF as an object file format and PE/COFF as an executable
file format. They are subtly different and certain elements of a COFF
file may not be present in an executable. Introduce a new plugin to add
support for the COFF object file format which is required to support
loading of modules built with -gmodules. This is motivated by Swift
which serialises debugging information into a PCM which is a COFF object
file.

Differential Revision: https://reviews.llvm.org/D149987
Reviewed By: bulbazord

Added: 
lldb/source/Plugins/ObjectFile/COFF/CMakeLists.txt
lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.cpp
lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.h
lldb/test/Shell/ObjectFile/COFF/basic.yaml

Modified: 
lldb/source/Plugins/ObjectFile/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/CMakeLists.txt 
b/lldb/source/Plugins/ObjectFile/CMakeLists.txt
index 851b680dc3c35..773241c8944c8 100644
--- a/lldb/source/Plugins/ObjectFile/CMakeLists.txt
+++ b/lldb/source/Plugins/ObjectFile/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_subdirectory(Breakpad)
+add_subdirectory(COFF)
 add_subdirectory(ELF)
 add_subdirectory(JSON)
 add_subdirectory(Mach-O)

diff  --git a/lldb/source/Plugins/ObjectFile/COFF/CMakeLists.txt 
b/lldb/source/Plugins/ObjectFile/COFF/CMakeLists.txt
new file mode 100644
index 0..e65b7ea501218
--- /dev/null
+++ b/lldb/source/Plugins/ObjectFile/COFF/CMakeLists.txt
@@ -0,0 +1,13 @@
+add_lldb_library(lldbPluginObjectFileCOFF PLUGIN
+  ObjectFileCOFF.cpp
+
+  LINK_LIBS
+lldbCore
+lldbHost
+lldbSymbol
+lldbTarget
+
+  LINK_COMPONENTS
+BinaryFormat
+Object
+Support)

diff  --git a/lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.cpp 
b/lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.cpp
new file mode 100644
index 0..03c454bf3efab
--- /dev/null
+++ b/lldb/source/Plugins/ObjectFile/COFF/ObjectFileCOFF.cpp
@@ -0,0 +1,311 @@
+//===-- ObjectFileCOFF.cpp 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ObjectFileCOFF.h"
+
+#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Utility/LLDBLog.h"
+
+#include "llvm/Support/Error.h"
+#include "llvm/Support/FormatAdapters.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+using namespace llvm;
+using namespace llvm::object;
+
+static bool IsCOFFObjectFile(const DataBufferSP &data) {
+  return identify_magic(toStringRef(data->GetData())) ==
+ file_magic::coff_object;
+}
+
+LLDB_PLUGIN_DEFINE(ObjectFileCOFF)
+
+char ObjectFileCOFF::ID;
+
+ObjectFileCOFF::~ObjectFileCOFF() = default;
+
+void ObjectFileCOFF::Initialize() {
+  PluginManager::RegisterPlugin(GetPluginNameStatic(),
+GetPluginDescriptionStatic(), CreateInstance,
+CreateMemoryInstance, GetModuleSpecifications);
+}
+
+void ObjectFileCOFF::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
+}
+
+lldb_private::ObjectFile *
+ObjectFileCOFF::CreateInstance(const ModuleSP &module_sp, DataBufferSP data_sp,
+   offset_t data_offset, const FileSpec *file,
+   offset_t file_offset, offset_t length) {
+  Log *log = GetLog(LLDBLog::Object);
+
+  if (!data_sp) {
+data_sp = MapFileData(*file, length, file_offset);
+if (!data_sp) {
+  LLDB_LOG(log,
+   "Failed to create ObjectFileCOFF instance: cannot read file 
{0}",
+   file->GetPath());
+  return nullptr;
+}
+data_offset = 0;
+  }
+
+  assert(data_sp && "must have mapped file at this point");
+
+  if (!IsCOFFObjectFile(data_sp))
+return nullptr;
+
+  if (data_sp->GetByteSize() < length) {
+data_sp = MapFileData(*file, length, file_offset);
+if (!data_sp) {
+  LLDB_LOG(log,
+   "Failed to create ObjectFileCOFF instance: cannot read file 
{0}",
+   file->GetPath());
+  return nullptr;
+}
+data_offset = 0;
+  }
+
+
+  MemoryBufferRef buffer{toStringRef(data_sp->GetData()),
+ file->GetFilename().GetStringRef()};
+
+  Expected> binary = createBinary(buffer);
+  if (!binary) {
+LLDB_LOG_

[Lldb-commits] [lldb] cd21c0d - Revert "Revert "Host: generalise `GetXcodeSDKPath`""

2023-05-29 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2023-05-29T10:16:41-07:00
New Revision: cd21c0d30c0803b24e1dcf71d2f04cb46e539905

URL: 
https://github.com/llvm/llvm-project/commit/cd21c0d30c0803b24e1dcf71d2f04cb46e539905
DIFF: 
https://github.com/llvm/llvm-project/commit/cd21c0d30c0803b24e1dcf71d2f04cb46e539905.diff

LOG: Revert "Revert "Host: generalise `GetXcodeSDKPath`""

This reverts commit c46d9af26cefb0b24646d3235b75ae7a1b8548d4.

Rename the variable to avoid `-Wchanges-meaning` warning.  Although, it
might be better to squelch the warning as it is of low value IMO.

Added: 


Modified: 
lldb/include/lldb/Host/HostInfoBase.h
lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
lldb/source/Core/Module.cpp
lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/unittests/Host/HostInfoTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Host/HostInfoBase.h 
b/lldb/include/lldb/Host/HostInfoBase.h
index 6c86c71e552dc..4082cd7f62bc6 100644
--- a/lldb/include/lldb/Host/HostInfoBase.h
+++ b/lldb/include/lldb/Host/HostInfoBase.h
@@ -31,6 +31,23 @@ struct SharedCacheImageInfo {
   lldb::DataBufferSP data_sp;
 };
 
+namespace {
+struct HostInfoError : public llvm::ErrorInfo {
+  static char ID;
+  const std::string message_;
+
+  HostInfoError(const std::string message) : message_(std::move(message)) {}
+
+  void log(llvm::raw_ostream &OS) const override { OS << "HostInfoError"; }
+
+  std::error_code convertToErrorCode() const override {
+return llvm::inconvertibleErrorCode();
+  }
+};
+
+char HostInfoError::ID = 0;
+} // namespace
+
 class HostInfoBase {
 private:
   // Static class, unconstructable.
@@ -108,10 +125,14 @@ class HostInfoBase {
 
   static FileSpec GetXcodeContentsDirectory() { return {}; }
   static FileSpec GetXcodeDeveloperDirectory() { return {}; }
-  
-  /// Return the directory containing a specific Xcode SDK.
-  static llvm::Expected GetXcodeSDKPath(XcodeSDK sdk) {
-return "";
+
+  struct SDKOptions {
+std::optional XcodeSDKSelection;
+  };
+
+  /// Return the directory containing something like a SDK (reused for Swift).
+  static llvm::Expected GetSDKRoot(SDKOptions options) {
+return llvm::make_error("cannot determine SDK root");
   }
 
   /// Return information about module \p image_name if it is loaded in

diff  --git a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h 
b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
index 0402509cfa261..74d979d965a73 100644
--- a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
+++ b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h
@@ -31,7 +31,7 @@ class HostInfoMacOSX : public HostInfoPosix {
   static FileSpec GetXcodeDeveloperDirectory();
 
   /// Query xcrun to find an Xcode SDK directory.
-  static llvm::Expected GetXcodeSDKPath(XcodeSDK sdk);
+  static llvm::Expected GetSDKRoot(SDKOptions options);
 
   /// Shared cache utilities
   static SharedCacheImageInfo

diff  --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index d527bdc76309d..a4ba09ef56418 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1607,8 +1607,8 @@ std::optional 
Module::RemapSourceFile(llvm::StringRef path) const {
 
 void Module::RegisterXcodeSDK(llvm::StringRef sdk_name,
   llvm::StringRef sysroot) {
-  XcodeSDK sdk(sdk_name.str());
-  auto sdk_path_or_err = HostInfo::GetXcodeSDKPath(sdk);
+  auto sdk_path_or_err =
+  HostInfo::GetSDKRoot(HostInfo::SDKOptions{sdk_name.str()});
 
   if (!sdk_path_or_err) {
 Debugger::ReportError("Error while searching for Xcode SDK: " +

diff  --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm 
b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index 5a39ed370747a..0b4fc1885cae9 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -338,7 +338,8 @@ static void ParseOSVersion(llvm::VersionTuple &version, 
NSString *Key) {
   }
 }
 
-auto sdk_path_or_err = HostInfo::GetXcodeSDKPath(XcodeSDK::GetAnyMacOS());
+auto sdk_path_or_err =
+HostInfo::GetSDKRoot(SDKOptions{XcodeSDK::GetAnyMacOS()});
 if (!sdk_path_or_err) {
   Log *log = GetLog(LLDBLog::Host);
   LLDB_LOGF(log, "Error while searching for Xcode SDK: %s",
@@ -519,7 +520,7 @@ static void ParseOSVersion(llvm::VersionTuple &version, 
NSString *Key) {
   return path;
 }
 
-llvm::Expected HostInfoMacOSX::GetXcodeSDKPath(XcodeSDK sdk) {
+llvm::Expected HostInfoMacOSX::GetSDKRoot(SDKOptions options) 
{
   struct ErrorOrPath {
 std::string str;
 bool is_error;
@@ -530,6 +531,11 @@ static void ParseOSVersion(llvm::VersionTuple &version, 
NSString *Key) {
   std::lock_guard guard(g_sdk_path_mutex);
   LLDB_SCOPED_TIMER();
 
+  if (!options.XcodeSDKSelection)
+return llvm::crea

[Lldb-commits] [lldb] 6488bd1 - test: add a lit configuration for Windows subdirectory

2021-11-28 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2021-11-28T18:27:47-08:00
New Revision: 6488bd1d51715501632778e3c9a1d4eedfac2998

URL: 
https://github.com/llvm/llvm-project/commit/6488bd1d51715501632778e3c9a1d4eedfac2998
DIFF: 
https://github.com/llvm/llvm-project/commit/6488bd1d51715501632778e3c9a1d4eedfac2998.diff

LOG: test: add a lit configuration for Windows subdirectory

This adds a local configuration to the Windows subdirectory to filter
out the tests on non-Windows platforms using the lit filtering.

Added: 
lldb/test/Shell/Process/Windows/lit.local.cfg

Modified: 


Removed: 




diff  --git a/lldb/test/Shell/Process/Windows/lit.local.cfg 
b/lldb/test/Shell/Process/Windows/lit.local.cfg
new file mode 100644
index 0..c10f33b2ad4b6
--- /dev/null
+++ b/lldb/test/Shell/Process/Windows/lit.local.cfg
@@ -0,0 +1,2 @@
+if 'system-windows' not in config.available_features:
+  config.unsupported = True



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


[Lldb-commits] [lldb] [lldb] Fix missing comsumeError() with LLDB_LOG in ObjectFileCOFF/PECOFF (PR #70793)

2023-10-31 Thread Saleem Abdulrasool via lldb-commits

https://github.com/compnerd approved this pull request.


https://github.com/llvm/llvm-project/pull/70793
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 3775be2 - Target: correct the return value for `GetImageAddrFromToken`

2020-04-06 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2020-04-06T17:37:57-07:00
New Revision: 3775be2d8e17aaeae62ab83ded005867f4bf70ac

URL: 
https://github.com/llvm/llvm-project/commit/3775be2d8e17aaeae62ab83ded005867f4bf70ac
DIFF: 
https://github.com/llvm/llvm-project/commit/3775be2d8e17aaeae62ab83ded005867f4bf70ac.diff

LOG: Target: correct the return value for `GetImageAddrFromToken`

We would return `LLDB_INVALID_IMAGE_TOKEN` for the address rather than
the correct value of `LLDB_IMAGE_ADDRESS`.  This would result in the
check for the return value to silently pass on x64 as the invalid
address and invalid token are of different sizes (`size_t` vs
`uintprr_t`).  This corrects the return value to `LLDB_INVALID_ADDRESS`
and addresses the rest to reset the mapped address to the invalid value.

This was found by inspection when trying to implement module support for
Windows.

Added: 


Modified: 
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index a3776f95..7797a4c60964 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -5796,12 +5796,12 @@ size_t Process::AddImageToken(lldb::addr_t image_ptr) {
 lldb::addr_t Process::GetImagePtrFromToken(size_t token) const {
   if (token < m_image_tokens.size())
 return m_image_tokens[token];
-  return LLDB_INVALID_IMAGE_TOKEN;
+  return LLDB_INVALID_ADDRESS;
 }
 
 void Process::ResetImageToken(size_t token) {
   if (token < m_image_tokens.size())
-m_image_tokens[token] = LLDB_INVALID_IMAGE_TOKEN;
+m_image_tokens[token] = LLDB_INVALID_ADDRESS;
 }
 
 Address



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


[Lldb-commits] [lldb] 92d42b3 - Utility: ignore OS version on non-Darwin targets in `ArchSpec`

2020-09-23 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2020-09-23T18:21:34-07:00
New Revision: 92d42b32a9b7a085fd200a56022724a77cf12a2d

URL: 
https://github.com/llvm/llvm-project/commit/92d42b32a9b7a085fd200a56022724a77cf12a2d
DIFF: 
https://github.com/llvm/llvm-project/commit/92d42b32a9b7a085fd200a56022724a77cf12a2d.diff

LOG: Utility: ignore OS version on non-Darwin targets in `ArchSpec`

The OS version field is generally not very helpful for non-Darwin
targets.  On Linux, it identifies the kernel version which moves
out-of-sync with the userspace.  On Windows, this field actually ends up
corresponding to the Visual Studio toolset version instead of the OS
version.  Consider non-Darwin targets without an OS version to be fully
specified.

Differential Revision: https://reviews.llvm.org/D88181
Reviewed By: Jonas Devlieghere, Dave Lee

Added: 


Modified: 
lldb/source/Utility/ArchSpec.cpp

Removed: 




diff  --git a/lldb/source/Utility/ArchSpec.cpp 
b/lldb/source/Utility/ArchSpec.cpp
index 9cbd5df3a7b6..c7b56a8385f7 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -1426,7 +1426,8 @@ bool ArchSpec::IsFullySpecifiedTriple() const {
 if ((user_specified_triple.getVendor() != llvm::Triple::UnknownVendor) ||
 TripleVendorWasSpecified()) {
   const unsigned unspecified = 0;
-  if (user_specified_triple.getOSMajorVersion() != unspecified) {
+  if (!user_specified_triple.isOSDarwin() ||
+  user_specified_triple.getOSMajorVersion() != unspecified) {
 user_triple_fully_specified = true;
   }
 }



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


[Lldb-commits] [lldb] 55eec2b - build: workaround stale caches (NFC)

2019-10-29 Thread Saleem Abdulrasool via lldb-commits

Author: Saleem Abdulrasool
Date: 2019-10-29T08:20:58-07:00
New Revision: 55eec2ba96bd9c19ccb5d4d13cb8c88d4abcebc6

URL: 
https://github.com/llvm/llvm-project/commit/55eec2ba96bd9c19ccb5d4d13cb8c88d4abcebc6
DIFF: 
https://github.com/llvm/llvm-project/commit/55eec2ba96bd9c19ccb5d4d13cb8c88d4abcebc6.diff

LOG: build: workaround stale caches (NFC)

`LLVM_DEFAULT_TARGET_TRIPLE` is a cached variable, which means that it
may actually be unset.  Furthermore, in standalone builds, the variable
may be fully undefined.  Apply the regular expression over the empty
string in such a case.  This should improve the state of the green
dragon bot.

Added: 


Modified: 
lldb/tools/debugserver/source/MacOSX/CMakeLists.txt

Removed: 




diff  --git a/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt 
b/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt
index 6d8e1ee449e3..59812b27dff2 100644
--- a/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -10,7 +10,7 @@
 # CFLAGS etc explicitly. Switching on LLVM_HOST_TRIPLE is also an option,
 # but it breaks down when cross-compiling.
 
-string(REGEX MATCH "^[^-]*" LLDB_DEBUGSERVER_ARCH 
${LLVM_DEFAULT_TARGET_TRIPLE})
+string(REGEX MATCH "^[^-]*" LLDB_DEBUGSERVER_ARCH 
"${LLVM_DEFAULT_TARGET_TRIPLE}")
 
 if("${LLDB_DEBUGSERVER_ARCH}" MATCHES ".*arm.*")
   list(APPEND SOURCES arm/DNBArchImpl.cpp arm64/DNBArchImplARM64.cpp)



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


  1   2   >