[Lldb-commits] [PATCH] D55142: Minidump debugging using the native PDB reader

2019-01-09 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added inline comments.



Comment at: lit/Minidump/Windows/Sigsegv/sigsegv.test:6
+CHECK: * thread #1, stop reason = Exception 0xc005 encountered at address 
0x7ff7a13110d9
+CHECK:   * frame #0: 0x7ff7a13110d9 sigsegv.exe`crash at sigsegv.cpp:22
+

This test fails for me because lldb is picking up my custom lldbinit (which 
changes the format of the frame output). Not sure what's the right way to fix 
it, but setting a custom fixed frameformat in the sigsegv.lldbinit seems like 
an obvious solution.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55142/new/

https://reviews.llvm.org/D55142



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


[Lldb-commits] [PATCH] D55376: Generate LLDB website/documentation from rst with Sphinx

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

I think this is going to be really nice! Here's a few details I found.




Comment at: docs/use/map.rst:28
++--+---+
+| Launch a process with arguments .  
|
++--+---+

Maybe all `<` and `>` should be changed to `<` and `>` respectively?
`` here somehow survives, but all other other angle-brackets content 
disappears.



Comment at: docs/use/map.rst:30
++--+---+
+| **(gdb)** run
| **(lldb)** process launch --  |
+|  
|   |

Unfortunately all `--` turn into one large `–`. Is it possible to disable (or 
escape each instance)?



Comment at: docs/use/map.rst:236
+|| 
|
+| *(Hope that there are no C functions named **main**)*. | **(lldb)** 
br s -M main |
+++-+

Interestingly this turns into `(Hope that there are no C functions named 
**main*)*`
There is another case below. BTW do we really need these comments?



Comment at: docs/use/map.rst:330
+|  
   |


|
+|  
   |  * thread #1: tid = 0x1c03, 
0x00010ef5 a.out`modify + 21 at main.cpp:16, stop reason = watchpoint 1 

   |
+|  
   |


|

Could the `*` be escaped? Otherwise this turns into a bullet point.



Comment at: docs/use/map.rst:858
+++-+
+| **(gdb)** echo Here is some text\n   

  | **(lldb)** script print "Here is some text" 

|
+++-+

The `\` disappears.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55376/new/

https://reviews.llvm.org/D55376



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


[Lldb-commits] [PATCH] D56230: [gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv

2019-01-09 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

> It is not that applicable for the windows process launcher to determine which 
> entry in the args needs to be quoted unless given very specific flag or 
> option.

Why not? Given the argv parsing rules described here 
https://docs.microsoft.com/en-us/cpp/cpp/parsing-cpp-command-line-arguments?view=vs-2017,
 it sounds like it should be possible to create an algorithm doing the reverse 
mapping.
Something like this ought to do the trick:

  for(string: Args) {
if (string.contains_either_of(" \t\"")  {
  double_the_amount_of_backslashes_in_front_of_every_quote_char(string);
  string = '"' + string '"';
}
cmdline += " " + string;
  }


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56230/new/

https://reviews.llvm.org/D56230



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


[Lldb-commits] [PATCH] D56440: [CMake] Phase out LLDB_TEST_C/CXX_COMPILER in favor of single LLDB_TEST_COMPILER

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

In D56440#1349892 , @JDevlieghere 
wrote:

> It looks like `LLDB_TEST_COMPILER_IS_DEFAULT` is set but never read. Why do 
> we need it exactly?


Right, good you found that.

I first used it to determine whether the replacement in 
`LLDB_TEST_C/CXX_COMPILER` needs to be done in `lit/CMakeLists.txt`, but then 
it turned out the result is unused (since D54567 
, which is another verbose piece of history).
For reference please see: https://reviews.llvm.org/rL347216#change-H2HV4zA8ol05

It basically does what `LLDB_TEST_USE_CUSTOM_C/CXX_COMPILER` so far pretended 
to do (but in fact they were both broken). It somehow might makes sense to keep 
it as long as we have the manual string replacements in the dotest CMakeLists, 
even though the compiler paths are not used there (surprisingly). I will check 
why dotest doesn't need them and either fix it (which adds a use case) or 
remove it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56440/new/

https://reviews.llvm.org/D56440



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


[Lldb-commits] [PATCH] D56443: [CMake] In standalone builds, LLVM_BINARY_DIR should point to LLVM's binary directory

2019-01-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 180830.
sgraenitz marked an inline comment as done.
sgraenitz added a comment.

Fix typo


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56443/new/

https://reviews.llvm.org/D56443

Files:
  CMakeLists.txt
  cmake/modules/LLDBStandalone.cmake
  lit/Suite/lit.site.cfg.in
  lit/Unit/lit.site.cfg.py.in


Index: lit/Unit/lit.site.cfg.py.in
===
--- lit/Unit/lit.site.cfg.py.in
+++ lit/Unit/lit.site.cfg.py.in
@@ -1,6 +1,6 @@
 @LIT_SITE_CFG_IN_HEADER@
 
-config.test_exec_root = "@LLVM_BINARY_DIR@" 
+config.test_exec_root = "@LLDB_BINARY_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: lit/Suite/lit.site.cfg.in
===
--- lit/Suite/lit.site.cfg.in
+++ lit/Suite/lit.site.cfg.in
@@ -1,6 +1,6 @@
 @LIT_SITE_CFG_IN_HEADER@
 
-config.test_exec_root = "@LLVM_BINARY_DIR@"
+config.test_exec_root = "@LLDB_BINARY_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -108,10 +108,8 @@
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 
-  set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
-
   set(CMAKE_INCLUDE_CURRENT_DIR ON)
-  include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
+  include_directories("${CMAKE_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
   # Next three include directories are needed when llvm-config is located in 
build directory.
   # LLVM and Clang are assumed to be built together
   if (EXISTS "${LLVM_OBJ_ROOT}/include")
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -114,7 +114,7 @@
   # FIXME: Standalone builds should import the cxx target as well.
   if(LLDB_BUILT_STANDALONE)
 # For now check that the include directory exists.
-set(cxx_dir "${LLVM_DIR}/../../../include/c++")
+set(cxx_dir "${LLVM_BINARY_DIR}/include/c++")
 if(NOT EXISTS ${cxx_dir})
   message(WARNING "LLDB test suite requires libc++ in 
llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
 endif()


Index: lit/Unit/lit.site.cfg.py.in
===
--- lit/Unit/lit.site.cfg.py.in
+++ lit/Unit/lit.site.cfg.py.in
@@ -1,6 +1,6 @@
 @LIT_SITE_CFG_IN_HEADER@
 
-config.test_exec_root = "@LLVM_BINARY_DIR@" 
+config.test_exec_root = "@LLDB_BINARY_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: lit/Suite/lit.site.cfg.in
===
--- lit/Suite/lit.site.cfg.in
+++ lit/Suite/lit.site.cfg.in
@@ -1,6 +1,6 @@
 @LIT_SITE_CFG_IN_HEADER@
 
-config.test_exec_root = "@LLVM_BINARY_DIR@"
+config.test_exec_root = "@LLDB_BINARY_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -108,10 +108,8 @@
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 
-  set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
-
   set(CMAKE_INCLUDE_CURRENT_DIR ON)
-  include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
+  include_directories("${CMAKE_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
   # Next three include directories are needed when llvm-config is located in build directory.
   # LLVM and Clang are assumed to be built together
   if (EXISTS "${LLVM_OBJ_ROOT}/include")
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -114,7 +114,7 @@
   # FIXME: Standalone builds should import the cxx target as well.
   if(LLDB_BUILT_STANDALONE)
 # For now check that the include directory exists.
-set(cxx_dir "${LLVM_DIR}/../../../include/c++")
+set(cxx_dir "${LLVM_BINARY_DIR}/include/c++")
 if(NOT EXISTS ${cxx_dir})
   message(WARNING "LLDB test suite requires libc++ in llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D56443: [CMake] In standalone builds, LLVM_BINARY_DIR should point to LLVM's binary directory

2019-01-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz marked an inline comment as done.
sgraenitz added inline comments.



Comment at: CMakeLists.txt:117
 # For now check that the include directory exists.
-set(cxx_dir "${LLVM_DIR}/../../../include/c++")
+set(cxx_dir "${LLVM_BINRAY_DIR}/include/c++")
 if(NOT EXISTS ${cxx_dir})

labath wrote:
> typo (but BINRAY sounds cool, we should make that mean something :P).
Ww thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56443/new/

https://reviews.llvm.org/D56443



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


[Lldb-commits] [PATCH] D56461: [NativePDB] Add support for parsing typedefs and make lldb-test work with the native reader.

2019-01-09 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Is there any chance we can get someone who knows something about pdbs take a 
look at this (@amccarth ? @aleksandr.urakov ?) ?




Comment at: lldb/lit/SymbolFile/NativePDB/typedefs.cpp:3
+
+// REQUIRES: system-windows
+// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s

What's the reason for this? Does the test need msvc linker or something?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56461/new/

https://reviews.llvm.org/D56461



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


[Lldb-commits] [PATCH] D56462: Change SymbolFile::ParseTypes to ParseTypesForCompileUnit

2019-01-09 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Sounds good to me (not clicking accept to see if anyone else has an opinion 
here).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56462/new/

https://reviews.llvm.org/D56462



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


[Lldb-commits] [PATCH] D55142: Minidump debugging using the native PDB reader

2019-01-09 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: lit/Minidump/Windows/Sigsegv/sigsegv.test:6
+CHECK: * thread #1, stop reason = Exception 0xc005 encountered at address 
0x7ff7a13110d9
+CHECK:   * frame #0: 0x7ff7a13110d9 sigsegv.exe`crash at sigsegv.cpp:22
+

teemperor wrote:
> This test fails for me because lldb is picking up my custom lldbinit (which 
> changes the format of the frame output). Not sure what's the right way to fix 
> it, but setting a custom fixed frameformat in the sigsegv.lldbinit seems like 
> an obvious solution.
Are you sure you have the right patch here?

Regardless, I actually think the right solution would be to pass 
`--no-lldb-init` as a part of the `%lldb` substitution (I'm surprised we don't 
do that already) to make sure **no** test sources random commands from users' 
.lldbinit files.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55142/new/

https://reviews.llvm.org/D55142



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


Re: [Lldb-commits] [PATCH] D56461: [NativePDB] Add support for parsing typedefs and make lldb-test work with the native reader.

2019-01-09 Thread Zachary Turner via lldb-commits
Yes I expect someone else to review more thoroughly, but I included you
anyway since you may have to dtart caring about this soon :)
On Wed, Jan 9, 2019 at 6:39 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath added a comment.
>
> Is there any chance we can get someone who knows something about pdbs take
> a look at this (@amccarth ? @aleksandr.urakov ?) ?
>
>
>
> 
> Comment at: lldb/lit/SymbolFile/NativePDB/typedefs.cpp:3
> +
> +// REQUIRES: system-windows
> +// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
> 
> What's the reason for this? Does the test need msvc linker or something?
>
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D56461/new/
>
> https://reviews.llvm.org/D56461
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r350737 - [CMake] Fix standalone builds: workaround the cxx target not getting imported yet (unlike clang target)

2019-01-09 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Wed Jan  9 08:25:31 2019
New Revision: 350737

URL: http://llvm.org/viewvc/llvm-project?rev=350737&view=rev
Log:
[CMake] Fix standalone builds: workaround the cxx target not getting imported 
yet (unlike clang target)

Summary: Handle standalone builds separately and print a warning if we have no 
libcxx.

Reviewers: aprantl, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

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

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/www/build.html

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=350737&r1=350736&r2=350737&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Wed Jan  9 08:25:31 2019
@@ -101,10 +101,22 @@ if(LLDB_INCLUDE_TESTS)
 list(APPEND LLDB_TEST_DEPS liblldb)
   endif()
 
+  # Add dependencies if we test with the in-tree clang.
+  # This works with standalone builds as they import the clang target.
   if(TARGET clang)
 list(APPEND LLDB_TEST_DEPS clang)
 if(APPLE)
-  list(APPEND LLDB_TEST_DEPS cxx)
+  # If we build clang, we should build libcxx.
+  # FIXME: Standalone builds should import the cxx target as well.
+  if(LLDB_BUILT_STANDALONE)
+# For now check that the include directory exists.
+set(cxx_dir "${LLVM_DIR}/../../../include/c++")
+if(NOT EXISTS ${cxx_dir})
+  message(WARNING "LLDB test suite requires libc++ in 
llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
+endif()
+  else()
+list(APPEND LLDB_TEST_DEPS cxx)
+  endif()
 endif()
   endif()
 

Modified: lldb/trunk/www/build.html
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/www/build.html?rev=350737&r1=350736&r2=350737&view=diff
==
--- lldb/trunk/www/build.html (original)
+++ lldb/trunk/www/build.html Wed Jan  9 08:25:31 2019
@@ -160,7 +160,7 @@
   In Xcode 4.x: lldb/lldb.xcworkspace, select the 
lldb-tool scheme, and build.
 
 Building LLDB with CMake
- First download the LLVM, Clang, and LLDB sources. Refer to this page for precise instructions on this step.
+ First download the LLVM, Clang, libc++ and LLDB sources. Refer 
to this page for precise instructions on this 
step.
  Refer to the code signing instructions in 
lldb/docs/code-signing.txt for info on codesigning debugserver during 
the build.
  Using CMake is documented on the http://llvm.org/docs/CMake.html";>Building LLVM with CMake page.
 Ninja is the recommended generator to use when building LLDB with 
CMake.


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


[Lldb-commits] [lldb] r350738 - [CMake] In standalone builds, LLVM_BINARY_DIR should point to LLVM's binary directory

2019-01-09 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Wed Jan  9 08:25:37 2019
New Revision: 350738

URL: http://llvm.org/viewvc/llvm-project?rev=350738&view=rev
Log:
[CMake] In standalone builds, LLVM_BINARY_DIR should point to LLVM's binary 
directory

Summary: In standalone builds `LLVM_BINARY_DIR` was equal to `LLDB_BINARY_DIR` 
so far. This is counterintuitive and invalidated the values of 
`LLDB_DEFAULT_TEST_DSYMUTIL/FILECHECK/COMPILER` etc.

Reviewers: zturner, labath, clayborg, JDevlieghere, stella.stamenova, 
serge-sans-paille

Reviewed By: labath

Subscribers: mgorny, friss, lldb-commits, #lldb

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

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/cmake/modules/LLDBStandalone.cmake
lldb/trunk/lit/Suite/lit.site.cfg.in
lldb/trunk/lit/Unit/lit.site.cfg.py.in

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=350738&r1=350737&r2=350738&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Wed Jan  9 08:25:37 2019
@@ -110,7 +110,7 @@ if(LLDB_INCLUDE_TESTS)
   # FIXME: Standalone builds should import the cxx target as well.
   if(LLDB_BUILT_STANDALONE)
 # For now check that the include directory exists.
-set(cxx_dir "${LLVM_DIR}/../../../include/c++")
+set(cxx_dir "${LLVM_BINARY_DIR}/include/c++")
 if(NOT EXISTS ${cxx_dir})
   message(WARNING "LLDB test suite requires libc++ in 
llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
 endif()

Modified: lldb/trunk/cmake/modules/LLDBStandalone.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBStandalone.cmake?rev=350738&r1=350737&r2=350738&view=diff
==
--- lldb/trunk/cmake/modules/LLDBStandalone.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBStandalone.cmake Wed Jan  9 08:25:37 2019
@@ -108,10 +108,8 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 
-  set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
-
   set(CMAKE_INCLUDE_CURRENT_DIR ON)
-  include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
+  include_directories("${CMAKE_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
   # Next three include directories are needed when llvm-config is located in 
build directory.
   # LLVM and Clang are assumed to be built together
   if (EXISTS "${LLVM_OBJ_ROOT}/include")

Modified: lldb/trunk/lit/Suite/lit.site.cfg.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Suite/lit.site.cfg.in?rev=350738&r1=350737&r2=350738&view=diff
==
--- lldb/trunk/lit/Suite/lit.site.cfg.in (original)
+++ lldb/trunk/lit/Suite/lit.site.cfg.in Wed Jan  9 08:25:37 2019
@@ -1,6 +1,6 @@
 @LIT_SITE_CFG_IN_HEADER@
 
-config.test_exec_root = "@LLVM_BINARY_DIR@"
+config.test_exec_root = "@LLDB_BINARY_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"

Modified: lldb/trunk/lit/Unit/lit.site.cfg.py.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Unit/lit.site.cfg.py.in?rev=350738&r1=350737&r2=350738&view=diff
==
--- lldb/trunk/lit/Unit/lit.site.cfg.py.in (original)
+++ lldb/trunk/lit/Unit/lit.site.cfg.py.in Wed Jan  9 08:25:37 2019
@@ -1,6 +1,6 @@
 @LIT_SITE_CFG_IN_HEADER@
 
-config.test_exec_root = "@LLVM_BINARY_DIR@" 
+config.test_exec_root = "@LLDB_BINARY_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"


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


[Lldb-commits] [PATCH] D56399: [CMake] Fix standalone builds: workaround the cxx target not getting imported yet (unlike clang target)

2019-01-09 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350737: [CMake] Fix standalone builds: workaround the cxx 
target not getting imported… (authored by stefan.graenitz, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56399/new/

https://reviews.llvm.org/D56399

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/www/build.html


Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -101,10 +101,22 @@
 list(APPEND LLDB_TEST_DEPS liblldb)
   endif()
 
+  # Add dependencies if we test with the in-tree clang.
+  # This works with standalone builds as they import the clang target.
   if(TARGET clang)
 list(APPEND LLDB_TEST_DEPS clang)
 if(APPLE)
-  list(APPEND LLDB_TEST_DEPS cxx)
+  # If we build clang, we should build libcxx.
+  # FIXME: Standalone builds should import the cxx target as well.
+  if(LLDB_BUILT_STANDALONE)
+# For now check that the include directory exists.
+set(cxx_dir "${LLVM_DIR}/../../../include/c++")
+if(NOT EXISTS ${cxx_dir})
+  message(WARNING "LLDB test suite requires libc++ in 
llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
+endif()
+  else()
+list(APPEND LLDB_TEST_DEPS cxx)
+  endif()
 endif()
   endif()
 
Index: lldb/trunk/www/build.html
===
--- lldb/trunk/www/build.html
+++ lldb/trunk/www/build.html
@@ -160,7 +160,7 @@
   In Xcode 4.x: lldb/lldb.xcworkspace, select the 
lldb-tool scheme, and build.
 
 Building LLDB with CMake
- First download the LLVM, Clang, and LLDB sources. Refer to this page for precise instructions on this step.
+ First download the LLVM, Clang, libc++ and LLDB sources. Refer 
to this page for precise instructions on this 
step.
  Refer to the code signing instructions in 
lldb/docs/code-signing.txt for info on codesigning debugserver during 
the build.
  Using CMake is documented on the http://llvm.org/docs/CMake.html";>Building LLVM with CMake page.
 Ninja is the recommended generator to use when building LLDB with 
CMake.


Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -101,10 +101,22 @@
 list(APPEND LLDB_TEST_DEPS liblldb)
   endif()
 
+  # Add dependencies if we test with the in-tree clang.
+  # This works with standalone builds as they import the clang target.
   if(TARGET clang)
 list(APPEND LLDB_TEST_DEPS clang)
 if(APPLE)
-  list(APPEND LLDB_TEST_DEPS cxx)
+  # If we build clang, we should build libcxx.
+  # FIXME: Standalone builds should import the cxx target as well.
+  if(LLDB_BUILT_STANDALONE)
+# For now check that the include directory exists.
+set(cxx_dir "${LLVM_DIR}/../../../include/c++")
+if(NOT EXISTS ${cxx_dir})
+  message(WARNING "LLDB test suite requires libc++ in llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
+endif()
+  else()
+list(APPEND LLDB_TEST_DEPS cxx)
+  endif()
 endif()
   endif()
 
Index: lldb/trunk/www/build.html
===
--- lldb/trunk/www/build.html
+++ lldb/trunk/www/build.html
@@ -160,7 +160,7 @@
   In Xcode 4.x: lldb/lldb.xcworkspace, select the lldb-tool scheme, and build.
 
 Building LLDB with CMake
- First download the LLVM, Clang, and LLDB sources. Refer to this page for precise instructions on this step.
+ First download the LLVM, Clang, libc++ and LLDB sources. Refer to this page for precise instructions on this step.
  Refer to the code signing instructions in lldb/docs/code-signing.txt for info on codesigning debugserver during the build.
  Using CMake is documented on the http://llvm.org/docs/CMake.html";>Building LLVM with CMake page.
 Ninja is the recommended generator to use when building LLDB with CMake.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D56443: [CMake] In standalone builds, LLVM_BINARY_DIR should point to LLVM's binary directory

2019-01-09 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350738: [CMake] In standalone builds, LLVM_BINARY_DIR should 
point to LLVM's binary… (authored by stefan.graenitz, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56443/new/

https://reviews.llvm.org/D56443

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/cmake/modules/LLDBStandalone.cmake
  lldb/trunk/lit/Suite/lit.site.cfg.in
  lldb/trunk/lit/Unit/lit.site.cfg.py.in


Index: lldb/trunk/lit/Suite/lit.site.cfg.in
===
--- lldb/trunk/lit/Suite/lit.site.cfg.in
+++ lldb/trunk/lit/Suite/lit.site.cfg.in
@@ -1,6 +1,6 @@
 @LIT_SITE_CFG_IN_HEADER@
 
-config.test_exec_root = "@LLVM_BINARY_DIR@"
+config.test_exec_root = "@LLDB_BINARY_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: lldb/trunk/lit/Unit/lit.site.cfg.py.in
===
--- lldb/trunk/lit/Unit/lit.site.cfg.py.in
+++ lldb/trunk/lit/Unit/lit.site.cfg.py.in
@@ -1,6 +1,6 @@
 @LIT_SITE_CFG_IN_HEADER@
 
-config.test_exec_root = "@LLVM_BINARY_DIR@" 
+config.test_exec_root = "@LLDB_BINARY_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: lldb/trunk/cmake/modules/LLDBStandalone.cmake
===
--- lldb/trunk/cmake/modules/LLDBStandalone.cmake
+++ lldb/trunk/cmake/modules/LLDBStandalone.cmake
@@ -108,10 +108,8 @@
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 
-  set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
-
   set(CMAKE_INCLUDE_CURRENT_DIR ON)
-  include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
+  include_directories("${CMAKE_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
   # Next three include directories are needed when llvm-config is located in 
build directory.
   # LLVM and Clang are assumed to be built together
   if (EXISTS "${LLVM_OBJ_ROOT}/include")
Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -110,7 +110,7 @@
   # FIXME: Standalone builds should import the cxx target as well.
   if(LLDB_BUILT_STANDALONE)
 # For now check that the include directory exists.
-set(cxx_dir "${LLVM_DIR}/../../../include/c++")
+set(cxx_dir "${LLVM_BINARY_DIR}/include/c++")
 if(NOT EXISTS ${cxx_dir})
   message(WARNING "LLDB test suite requires libc++ in 
llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
 endif()


Index: lldb/trunk/lit/Suite/lit.site.cfg.in
===
--- lldb/trunk/lit/Suite/lit.site.cfg.in
+++ lldb/trunk/lit/Suite/lit.site.cfg.in
@@ -1,6 +1,6 @@
 @LIT_SITE_CFG_IN_HEADER@
 
-config.test_exec_root = "@LLVM_BINARY_DIR@"
+config.test_exec_root = "@LLDB_BINARY_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: lldb/trunk/lit/Unit/lit.site.cfg.py.in
===
--- lldb/trunk/lit/Unit/lit.site.cfg.py.in
+++ lldb/trunk/lit/Unit/lit.site.cfg.py.in
@@ -1,6 +1,6 @@
 @LIT_SITE_CFG_IN_HEADER@
 
-config.test_exec_root = "@LLVM_BINARY_DIR@" 
+config.test_exec_root = "@LLDB_BINARY_DIR@"
 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
Index: lldb/trunk/cmake/modules/LLDBStandalone.cmake
===
--- lldb/trunk/cmake/modules/LLDBStandalone.cmake
+++ lldb/trunk/cmake/modules/LLDBStandalone.cmake
@@ -108,10 +108,8 @@
 
   set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
 
-  set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
-
   set(CMAKE_INCLUDE_CURRENT_DIR ON)
-  include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
+  include_directories("${CMAKE_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
   # Next three include directories are needed when llvm-config is located in build directory.
   # LLVM and Clang are assumed to be built together
   if (EXISTS "${LLVM_OBJ_ROOT}/include")
Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -110,7 +110,7 @@
   # FIXME: Standalone builds should import the cxx target as well.
   if(LLDB_BUILT_STANDALONE)
 # For now check that the include directory exists.
-set(cxx_dir "${LLVM_DIR}/../../../include/c++")
+set(cxx_dir "${LLVM_BINARY_DIR}/include/c++")
 if(NOT EXISTS ${cxx

[Lldb-commits] [lldb] r350742 - ELF: create "container" sections from PT_LOAD segments

2019-01-09 Thread Pavel Labath via lldb-commits
Author: labath
Date: Wed Jan  9 08:50:45 2019
New Revision: 350742

URL: http://llvm.org/viewvc/llvm-project?rev=350742&view=rev
Log:
ELF: create "container" sections from PT_LOAD segments

Summary:
This is the result of the discussion in D55356, where it was suggested
as a solution to representing the addresses that logically belong to a
module in memory, but are not a part of any of its sections.

The ELF PT_LOAD segments are similar to the MachO "load commands",
except that the relationship between them and the object file sections
is a bit weaker. While in the MachO case, the sections belonging to a
specific segment are placed directly inside it in the object file
logical structur, in the ELF case, the sections and segments form two
separate hierarchies. This means that it is in theory possible to create
an elf file where only a part of a section would belong to some segment
(and another part to a different one). However, I am not aware of any
tool which would produce such a file (and most tools will have problems
ingesting them), so this means it is still possible to follow the MachO
model and make sections children of the PT_LOAD segments.

In case we run into (corrupt?) files with overlapping sections, I have
added code (and tests) which adjusts the sizes and/or drops the offending
sections in order to present a reasonable image to the upper layers of
LLDB. This is mostly done for completeness, as I don't anticipate
running into this situation in the real world. However, if we do run
into it, and the current behavior is not suitable for some reason, we
can implement this logic differently.

Reviewers: clayborg, jankratochvil, krytarowski, joerg, espindola

Subscribers: emaste, arichardson, lldb-commits

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

Added:
lldb/trunk/lit/Modules/ELF/Inputs/
lldb/trunk/lit/Modules/ELF/Inputs/PT_LOAD-overlap-section.elf
lldb/trunk/lit/Modules/ELF/PT_LOAD-empty.yaml
lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_INTERP.yaml
lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-section.yaml
lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap.yaml
lldb/trunk/lit/Modules/ELF/PT_LOAD.yaml
lldb/trunk/lit/Modules/ELF/section-overlap.yaml
Modified:
lldb/trunk/lit/Modules/ELF/section-permissions.yaml
lldb/trunk/lit/Modules/ELF/section-types.yaml
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Added: lldb/trunk/lit/Modules/ELF/Inputs/PT_LOAD-overlap-section.elf
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/Inputs/PT_LOAD-overlap-section.elf?rev=350742&view=auto
==
Binary files lldb/trunk/lit/Modules/ELF/Inputs/PT_LOAD-overlap-section.elf 
(added) and lldb/trunk/lit/Modules/ELF/Inputs/PT_LOAD-overlap-section.elf Wed 
Jan  9 08:50:45 2019 differ

Added: lldb/trunk/lit/Modules/ELF/PT_LOAD-empty.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/PT_LOAD-empty.yaml?rev=350742&view=auto
==
--- lldb/trunk/lit/Modules/ELF/PT_LOAD-empty.yaml (added)
+++ lldb/trunk/lit/Modules/ELF/PT_LOAD-empty.yaml Wed Jan  9 08:50:45 2019
@@ -0,0 +1,26 @@
+# Test behavior on unusual (and probably corrupt) files. Test that we drop an
+# empty PT_LOAD segment.
+
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+#
+# CHECK-NOT: container
+
+!ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_ARM
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+Address: 0x1000
+AddressAlign:0x4
+Content: DEADBEEFBAADF00D
+ProgramHeaders:
+  - Type: PT_LOAD
+Flags: [ PF_X, PF_R ]
+VAddr: 0x1000
+Align: 0x4

Added: lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_INTERP.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_INTERP.yaml?rev=350742&view=auto
==
--- lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_INTERP.yaml (added)
+++ lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_INTERP.yaml Wed Jan  9 
08:50:45 2019
@@ -0,0 +1,50 @@
+# Test that an overlapping PT_INTERP segment does not cause us to drop the
+# subsequent PT_LOAD segment.
+
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK:Index: 0
+# CHECK-NEXT:   ID: 0xfffe
+# CHECK-NEXT:   Name: PT_LOAD[0]
+# CHECK-NEXT:   Type: container
+# CHECK-NEXT:   Permissions: rwx
+# CHECK-NEXT:   Thread specific: no
+# CHECK-NEXT:   VM address: 0x1000
+# CHECK-NEXT:   VM size: 12
+# CHECK-NEXT:   File size: 12
+# CHECK-NEXT:   Showing 2 subsections
+
+!ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  M

[Lldb-commits] [PATCH] D55998: ELF: create "container" sections from PT_LOAD segments

2019-01-09 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350742: ELF: create "container" sections from 
PT_LOAD segments (authored by labath, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55998/new/

https://reviews.llvm.org/D55998

Files:
  lldb/trunk/lit/Modules/ELF/Inputs/PT_LOAD-overlap-section.elf
  lldb/trunk/lit/Modules/ELF/PT_LOAD-empty.yaml
  lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-PT_INTERP.yaml
  lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap-section.yaml
  lldb/trunk/lit/Modules/ELF/PT_LOAD-overlap.yaml
  lldb/trunk/lit/Modules/ELF/PT_LOAD.yaml
  lldb/trunk/lit/Modules/ELF/section-overlap.yaml
  lldb/trunk/lit/Modules/ELF/section-permissions.yaml
  lldb/trunk/lit/Modules/ELF/section-types.yaml
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -17,6 +17,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Core/RangeMap.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Symbol/DWARFCallFrameInfo.h"
@@ -30,6 +31,7 @@
 #include "lldb/Utility/Stream.h"
 #include "lldb/Utility/Timer.h"
 
+#include "llvm/ADT/IntervalMap.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Object/Decompressor.h"
@@ -236,6 +238,8 @@
 
 } // end anonymous namespace
 
+static user_id_t SegmentID(size_t PHdrIndex) { return ~PHdrIndex; }
+
 bool ELFNote::Parse(const DataExtractor &data, lldb::offset_t *offset) {
   // Read all fields.
   if (data.GetU32(offset, &n_namesz, 3) == NULL)
@@ -822,7 +826,8 @@
 // Iterate through the object file sections to find all of the sections
 // that have SHF_ALLOC in their flag bits.
 SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
-if (section_sp && section_sp->Test(SHF_ALLOC)) {
+if (section_sp->Test(SHF_ALLOC) ||
+section_sp->GetType() == eSectionTypeContainer) {
   lldb::addr_t load_addr = section_sp->GetFileAddress();
   // We don't want to update the load address of a section with type
   // eSectionTypeAbsoluteAddress as they already have the absolute load
@@ -1821,74 +1826,185 @@
   return Perm;
 }
 
+static Permissions GetPermissions(const ELFProgramHeader &H) {
+  Permissions Perm = Permissions(0);
+  if (H.p_flags & PF_R)
+Perm |= ePermissionsReadable;
+  if (H.p_flags & PF_W)
+Perm |= ePermissionsWritable;
+  if (H.p_flags & PF_X)
+Perm |= ePermissionsExecutable;
+  return Perm;
+}
+
 namespace {
+
+using VMRange = lldb_private::Range;
+
+struct SectionAddressInfo {
+  SectionSP Segment;
+  VMRange Range;
+};
+
 // (Unlinked) ELF object files usually have 0 for every section address, meaning
 // we need to compute synthetic addresses in order for "file addresses" from
 // different sections to not overlap. This class handles that logic.
 class VMAddressProvider {
-  bool m_synthesizing;
-  addr_t m_next;
+  using VMMap = llvm::IntervalMap>;
+
+  ObjectFile::Type ObjectType;
+  addr_t NextVMAddress = 0;
+  VMMap::Allocator Alloc;
+  VMMap Segments = VMMap(Alloc);
+  VMMap Sections = VMMap(Alloc);
+  lldb_private::Log *Log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
+
+  VMRange GetVMRange(const ELFSectionHeader &H) {
+addr_t Address = H.sh_addr;
+addr_t Size = H.sh_flags & SHF_ALLOC ? H.sh_size : 0;
+if (ObjectType == ObjectFile::Type::eTypeObjectFile && Segments.empty() && (H.sh_flags & SHF_ALLOC)) {
+  NextVMAddress =
+  llvm::alignTo(NextVMAddress, std::max(H.sh_addralign, 1));
+  Address = NextVMAddress;
+  NextVMAddress += Size;
+}
+return VMRange(Address, Size);
+  }
 
 public:
-  VMAddressProvider(ObjectFile::Type Type)
-  : m_synthesizing(Type == ObjectFile::Type::eTypeObjectFile), m_next(0) {}
+  VMAddressProvider(ObjectFile::Type Type) : ObjectType(Type) {}
 
-  std::pair GetAddressAndSize(const ELFSectionHeader &H) {
-addr_t address = H.sh_addr;
-addr_t size = H.sh_flags & SHF_ALLOC ? H.sh_size : 0;
-if (m_synthesizing && (H.sh_flags & SHF_ALLOC)) {
-  m_next = llvm::alignTo(m_next, std::max(H.sh_addralign, 1));
-  address = m_next;
-  m_next += size;
-}
-return {address, size};
+  llvm::Optional GetAddressInfo(const ELFProgramHeader &H) {
+if (H.p_memsz == 0) {
+  LLDB_LOG(Log,
+   "Ignoring zero-sized PT_LOAD segment. Corrupt object file?");
+  return llvm::None;
+}
+
+if (Segments.overlaps(H.p_vaddr, H.p_vaddr + H.p_memsz)) {
+  LLDB_LOG(Log,
+   "Ignoring overlapping PT_LOAD segment. Corrupt object file?

[Lldb-commits] [PATCH] D56462: Change SymbolFile::ParseTypes to ParseTypesForCompileUnit

2019-01-09 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

So this Patch is effectively NFC, since no caller (not even a test) was using 
the functionality you've removed.  Seems like a nice refactor.




Comment at: lldb/source/Core/Module.cpp:382
 
   // Parse all types for this compile unit
+  symbols->ParseTypesForCompileUnit(*sc.comp_unit);

I'd argue that this comment is now obsolete.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56462/new/

https://reviews.llvm.org/D56462



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


[Lldb-commits] [PATCH] D56440: [CMake] Phase out LLDB_TEST_C/CXX_COMPILER in favor of single LLDB_TEST_COMPILER

2019-01-09 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova requested changes to this revision.
stella.stamenova added inline comments.
This revision now requires changes to proceed.



Comment at: lit/CMakeLists.txt:14
 
-if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER)
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_C_COMPILER 
"${LLDB_TEST_C_COMPILER}")

Your change is removing the logic to setup this path correctly. This will cause 
failures in the tests.



Comment at: lit/CMakeLists.txt:41
   list(APPEND LLDB_TEST_DEPS lld)
-  set(LLDB_HAVE_LLD 1)
-else()

It is better to do this in a separate change (the shared libs also) since they 
are not related to the compiler properties


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56440/new/

https://reviews.llvm.org/D56440



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


[Lldb-commits] [PATCH] D56462: Change SymbolFile::ParseTypes to ParseTypesForCompileUnit

2019-01-09 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

So I like the ability to specify any symbol context to parse all types for. If 
you pass in a symbol context with only a module filled in, we parse all types. 
If we pass in a symbol context with only the compile unit filled in (no 
function), we parse all types in the compile unit. If we pass in a symbol 
context with a function or block, we parse all types in that function or block. 
Currently it is only being used for compile units, but I don't think we need to 
change the API.




Comment at: lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp:228-238
 size_t SymbolFileSymtab::ParseFunctionBlocks(const SymbolContext &sc) {
   return 0;
 }
 
-size_t SymbolFileSymtab::ParseTypes(const SymbolContext &sc) { return 0; }
+size_t SymbolFileSymtab::ParseTypesForCompileUnit(CompileUnit &comp_unit) {
+  return 0;
+}

All these functions that just return zero, error, fail, should have default 
implementations in the SymbolFile class IMHO. Keeps diffs down.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56462/new/

https://reviews.llvm.org/D56462



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


[Lldb-commits] [PATCH] D56462: Change SymbolFile::ParseTypes to ParseTypesForCompileUnit

2019-01-09 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

So there really aren't that many things:

- module only filled out, parse all types
- compile unit only filled out, parse all type from a compile unit
- function filled out, parse all types in a function
- block filled out, parse all types in block, or we can skip this one


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56462/new/

https://reviews.llvm.org/D56462



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


[Lldb-commits] [PATCH] D56462: Change SymbolFile::ParseTypes to ParseTypesForCompileUnit

2019-01-09 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

But if everyone else thinks differently, I'll go with the majority. Just my 
initial thoughts.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56462/new/

https://reviews.llvm.org/D56462



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


[Lldb-commits] [PATCH] D56462: Change SymbolFile::ParseTypes to ParseTypesForCompileUnit

2019-01-09 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

In D56462#1351391 , @clayborg wrote:

> So I like the ability to specify any symbol context to parse all types for. 
> If you pass in a symbol context with only a module filled in, we parse all 
> types. If we pass in a symbol context with only the compile unit filled in 
> (no function), we parse all types in the compile unit. If we pass in a symbol 
> context with a function or block, we parse all types in that function or 
> block. Currently it is only being used for compile units, but I don't think 
> we need to change the API.


I'm actually specifically trying to remove this flexibility in the API because 
I think it's harmful.  In fact as we speak I'm writing up an RFC to send to the 
mailing list.  As someone who just went through implementing a new SymbolFile 
plugin, it is **very difficult** to implement these functions faithfully for 
arbitrary SymbolContexts, and begs for untested code as well as dead code (as 
evidenced by this patch, there was a bunch of dead code for combinations of 
SymbolContext fields that no caller actually cared about).  So nobody currently 
even needs this anyway.  which means that specifying an arbitrary 
`SymbolContext` is a case of YAGNI.  If someone comes along one day and needs 
the ability to parse types in a function or block, they can call 
`ParseTypesForFunction` followed by `ParseTypesForBlock`.  This way it is 
simple and easy for the caller to understand how to use the function, and it is 
equally simple and easy to understand for the implementer to implement the 
function.  Currently it is complicated for both.  For example, does specifying 
a `Module` and a `Function` mean to parse all types for that module //or// that 
function?  Or does it mean to parse all types for that module //and// that 
function.

I would like to remove the ability to specify arbitrary `SymbolContext` for 
most of the other SymboFile functions as well (although there are a few where 
we might still need it).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56462/new/

https://reviews.llvm.org/D56462



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


[Lldb-commits] [PATCH] D56440: [CMake] Phase out LLDB_TEST_C/CXX_COMPILER in favor of single LLDB_TEST_COMPILER

2019-01-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 180890.
sgraenitz marked 5 inline comments as done.
sgraenitz added a comment.

Move BUILD_SHARED_LIBS and LLDB_HAVE_LLD to a separate commit


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56440/new/

https://reviews.llvm.org/D56440

Files:
  CMakeLists.txt
  lit/CMakeLists.txt
  test/CMakeLists.txt
  www/build.html
  www/test.html

Index: www/test.html
===
--- www/test.html
+++ www/test.html
@@ -39,9 +39,7 @@
   The easiest way to run the LLDB test suite is to use the check-lldb build
   target. By default, the check-lldb target builds the test programs with
   the same compiler that was used to build LLDB. To build the tests with a different
-  compiler, you can set the LLDB_TEST_C_COMPILER or the LLDB_TEST_CXX_COMPILER CMake variables.
-  These variables are ignored unless the respective LLDB_TEST_USE_CUSTOM_C_COMPILER and
-  LLDB_TEST_USE_CUSTOM_CXX_COMPILER are set to ON.
+  compiler, you can set the LLDB_TEST_COMPILER CMake variable.
   It is possible to customize the architecture of the test binaries and compiler used by appending -A
   and -C options respectively to the CMake variable LLDB_TEST_USER_ARGS. For
   example, to test LLDB against 32-bit binaries
Index: www/build.html
===
--- www/build.html
+++ www/build.html
@@ -116,15 +116,14 @@
 the PYTHONHOME environment variable if it is specified).
   
   
-LLDB_TEST_C_COMPILER or LLDB_TEST_CXX_COMPILER: The test suite needs to be able to find a copy of clang.exe
+LLDB_TEST_COMPILER: The test suite needs to be able to find a copy of clang.exe
 that it can use to compile inferior programs.  Note that MSVC is not supported here, it must be a path to a
 clang executable.  Note that using a release clang.exe is strongly recommended here, as it will make the test suite run much faster.
-This can be a path to any recent clang.exe, including one you built yourself.  These variables are ignored unless the respective
-LLDB_TEST_USE_CUSTOM_C_COMPILER and LLDB_TEST_USE_CUSTOM_CXX_COMPILER are set to ON.
+This can be a path to any recent clang.exe, including one you built yourself.
   
 
 Sample command line:
-cmake -G Ninja -DLLDB_TEST_DEBUG_TEST_CRASHES=1 -DPYTHON_HOME=C:\Python35 -DLLDB_TEST_USE_CUSTOM_C_COMPILER=ON -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe ..\..\llvm
+cmake -G Ninja -DLLDB_TEST_DEBUG_TEST_CRASHES=1 -DPYTHON_HOME=C:\Python35 -DLLDB_TEST_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe ..\..\llvm
 Working with both Ninja and MSVC
 
   Compiling with ninja is both faster and simpler than compiling with MSVC, but chances are you still want
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -50,7 +50,7 @@
   --executable ${LLDB_TEST_EXECUTABLE}
   --dsymutil ${LLDB_TEST_DSYMUTIL}
   --filecheck ${LLDB_TEST_FILECHECK}
-  -C ${LLDB_TEST_C_COMPILER}
+  -C ${LLDB_TEST_COMPILER_USED}
   )
 
 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
Index: lit/CMakeLists.txt
===
--- lit/CMakeLists.txt
+++ lit/CMakeLists.txt
@@ -11,14 +11,6 @@
   set(LLDB_IS_64_BITS 1)
 endif()
 
-if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER)
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_C_COMPILER "${LLDB_TEST_C_COMPILER}")
-endif ()
-
-if (NOT LLDB_TEST_USE_CUSTOM_CXX_COMPILER)
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_CXX_COMPILER "${LLDB_TEST_CXX_COMPILER}")
-endif ()
-
 get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY)
 
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -36,9 +36,6 @@
 add_subdirectory(tools)
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
-option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
-option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
-
 if(LLDB_INCLUDE_TESTS)
   # Set the path to the default lldb test executable.
   set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDI

[Lldb-commits] [PATCH] D56440: [CMake] Phase out LLDB_TEST_C/CXX_COMPILER in favor of single LLDB_TEST_COMPILER

2019-01-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added inline comments.



Comment at: CMakeLists.txt:73
+  if (compiler_used)
+set(LLDB_TEST_COMPILER_USED ${compiler_used})
+  else()

Note: Using a different variable here to avoid force-overwriting the cached 
value of `LLDB_TEST_COMPILER`. If we did that, it would appear as if it was set 
explicitly by the user, when re-running CMake. Doing it this way (and leaving 
the default empty) allows to distinguish an explicit setting from the default. 
`LLDB_TEST_COMPILER_IS_DEFAULT` tracks this info but is currently not used.



Comment at: lit/CMakeLists.txt:14
 
-if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER)
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_C_COMPILER 
"${LLDB_TEST_C_COMPILER}")

stella.stamenova wrote:
> Your change is removing the logic to setup this path correctly. This will 
> cause failures in the tests.
That should be fine. It only changed the value of `LLDB_TEST_C/CXX_COMPILER` in 
the scope of this CMakeLists.txt/directory. The value in the parent 
CMakeLists.txt as well as the one in the cache remained unchanged.

Thus it is unused since https://reviews.llvm.org/rC347216#change-H2HV4zA8ol05 
removed their usage from `lit/lit.site.cfg.py.in` that gets configured below. 
Before this change the local value was passed to the config file like this:
```
config.cc = "@LLDB_TEST_C_COMPILER@"
config.cxx = "@LLDB_TEST_CXX_COMPILER@"
```

They seem to be inferred via `LLDB_LIT_TOOLS_DIR` now.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56440/new/

https://reviews.llvm.org/D56440



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


[Lldb-commits] [PATCH] D56440: [CMake] Phase out LLDB_TEST_C/CXX_COMPILER in favor of single LLDB_TEST_COMPILER

2019-01-09 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added inline comments.



Comment at: CMakeLists.txt:61
+  # Use LLDB_TEST_COMPILER_IS_DEFAULT to determine whether or not to replace
+  # CMAKE_CFG_INTDIR with LLVM_BUILD_MODE for dotest.
+  if(LLDB_TEST_COMPILER)

If it's true that we don't need the CMAKE_CFG_INTDIR replacement in the test 
cmake file, then is this comment still correct?



Comment at: lit/CMakeLists.txt:14
 
-if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER)
-  string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_C_COMPILER 
"${LLDB_TEST_C_COMPILER}")

sgraenitz wrote:
> stella.stamenova wrote:
> > Your change is removing the logic to setup this path correctly. This will 
> > cause failures in the tests.
> That should be fine. It only changed the value of `LLDB_TEST_C/CXX_COMPILER` 
> in the scope of this CMakeLists.txt/directory. The value in the parent 
> CMakeLists.txt as well as the one in the cache remained unchanged.
> 
> Thus it is unused since https://reviews.llvm.org/rC347216#change-H2HV4zA8ol05 
> removed their usage from `lit/lit.site.cfg.py.in` that gets configured below. 
> Before this change the local value was passed to the config file like this:
> ```
> config.cc = "@LLDB_TEST_C_COMPILER@"
> config.cxx = "@LLDB_TEST_CXX_COMPILER@"
> ```
> 
> They seem to be inferred via `LLDB_LIT_TOOLS_DIR` now.
Have you tested it with a tool set that supports multiple configurations to 
make sure that is the case? I believe XCode and VS both support multiple 
configurations.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56440/new/

https://reviews.llvm.org/D56440



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


[Lldb-commits] [PATCH] D56440: [CMake] Phase out LLDB_TEST_C/CXX_COMPILER in favor of single LLDB_TEST_COMPILER

2019-01-09 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added inline comments.



Comment at: CMakeLists.txt:72
   endif()
+  if (compiler_used)
+set(LLDB_TEST_COMPILER_USED ${compiler_used})

Is this check needed? `compiler_used` should be set always here because of the 
way the above block is written.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56440/new/

https://reviews.llvm.org/D56440



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


[Lldb-commits] [PATCH] D56511: [Python] Update PyString_FromString() to work for python 2 and 3.

2019-01-09 Thread Davide Italiano via Phabricator via lldb-commits
davide created this revision.
davide added reviewers: aprantl, JDevlieghere, friss, zturner.

https://reviews.llvm.org/D56511

Files:
  lldb/scripts/Python/python-swigsafecast.swig
  lldb/scripts/Python/python-wrapper.swig


Index: lldb/scripts/Python/python-wrapper.swig
===
--- lldb/scripts/Python/python-wrapper.swig
+++ lldb/scripts/Python/python-wrapper.swig
@@ -826,7 +826,12 @@
 lldb::SBFrame frame_sb(frame_sp);
 PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 
-PyObject* result = PyObject_CallMethodObjArgs(implementor, 
PyString_FromString(callee_name), arg, NULL);
+#if PY_MAJOR_VERSION >= 3
+PyObject *str_arg = PyUnicode_FromString(callee_name);
+#else
+PyObject *str_arg = PyString_FromString(callee_name);
+#endif
+PyObject* result = PyObject_CallMethodObjArgs(implementor, str_arg, arg, 
NULL);
 return result;
 }
 
Index: lldb/scripts/Python/python-swigsafecast.swig
===
--- lldb/scripts/Python/python-swigsafecast.swig
+++ lldb/scripts/Python/python-swigsafecast.swig
@@ -30,7 +30,11 @@
 SBTypeToSWIGWrapper (const char* c_str)
 {
 if (c_str)
+#if PY_MAJOR_VERSION >= 3
+return PyUnicode_FromString(c_str);
+#else
 return PyString_FromString(c_str);
+#endif
 return NULL;
 }
 


Index: lldb/scripts/Python/python-wrapper.swig
===
--- lldb/scripts/Python/python-wrapper.swig
+++ lldb/scripts/Python/python-wrapper.swig
@@ -826,7 +826,12 @@
 lldb::SBFrame frame_sb(frame_sp);
 PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 
-PyObject* result = PyObject_CallMethodObjArgs(implementor, PyString_FromString(callee_name), arg, NULL);
+#if PY_MAJOR_VERSION >= 3
+PyObject *str_arg = PyUnicode_FromString(callee_name);
+#else
+PyObject *str_arg = PyString_FromString(callee_name);
+#endif
+PyObject* result = PyObject_CallMethodObjArgs(implementor, str_arg, arg, NULL);
 return result;
 }
 
Index: lldb/scripts/Python/python-swigsafecast.swig
===
--- lldb/scripts/Python/python-swigsafecast.swig
+++ lldb/scripts/Python/python-swigsafecast.swig
@@ -30,7 +30,11 @@
 SBTypeToSWIGWrapper (const char* c_str)
 {
 if (c_str)
+#if PY_MAJOR_VERSION >= 3
+return PyUnicode_FromString(c_str);
+#else
 return PyString_FromString(c_str);
+#endif
 return NULL;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r350764 - Change lldb-test to use ParseAllDebugSymbols.

2019-01-09 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Jan  9 13:20:44 2019
New Revision: 350764

URL: http://llvm.org/viewvc/llvm-project?rev=350764&view=rev
Log:
Change lldb-test to use ParseAllDebugSymbols.

ParseDeclsForContext was originally created to serve the very specific
case where the context is a function block. It was never intended to be
used for arbitrary DeclContexts, however due to the generic name, the
DWARF and PDB plugins implemented it in this way "just in case". Then,
lldb-test came along and decided to use it in that way.

Related to this, there are a set of functions in the SymbolFile class
interface whose requirements and expectations are not documented. For
example, if you call ParseCompileUnitFunctions, there's an inherent
requirement that you create entries in the underlying clang AST for
these functions as well as their signature types, because in order to
create an lldb_private::Function object, you have to pass it a
CompilerType for the parameter representing the signature.

On the other hand, there is no similar requirement (either inherent or
documented) if one were to call ParseDeclsForContext. Specifically, if
one calls ParseDeclsForContext, and some variable declarations, types,
and other things are added to the clang AST, is it necessary to create
lldb::Variable, lldb::Type, etc objects representing them? Nobody knows.
There is, however, an accidental requirement, because since all of the
plugins implemented this just in case, lldb-test came along and used
ParsedDeclsForContext, and then wrote check lines that depended on this.

When I went to try and implemented the NativePDB reader, I did not
adhere to this (in fact, from a layering perspective I went out of my
way to avoid it), and as a result the existing DIA PDB tests don't work
when the native PDB reader is enabled, because they expect that calling
ParseDeclsForContext will modify the *module's* view of symbols, and not
just the internal AST.

All of this confusion, however, can be avoided if we simply stick to
using ParseDeclsForContext for its original intended use case (blocks),
and use a different function (ParseAllDebugSymbols) for its intended use
case which is, unsuprisingly, to parse all the debug symbols (which is
all lldb-test really wanted to do anyway).

In the future, I would like to change ParseDeclsForContext to
ParseDeclsForFunctionBlock, then delete all of the dead code inside that
handles other types of DeclContexts (and probably even assert if the
DeclContext is anything other than a block).

A few PDB tests needed to be fixed up as a result of this, and this also
exposed a couple of bugs in the DIA PDB reader (doesn't matter much
since it should be going away soon, but worth mentioning) where the
appropriate AST entries weren't being created always.

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

Modified:
lldb/trunk/lit/SymbolFile/PDB/enums-layout.test
lldb/trunk/lit/SymbolFile/PDB/type-quals.test
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/lit/SymbolFile/PDB/enums-layout.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/enums-layout.test?rev=350764&r1=350763&r2=350764&view=diff
==
--- lldb/trunk/lit/SymbolFile/PDB/enums-layout.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/enums-layout.test Wed Jan  9 13:20:44 2019
@@ -1,44 +1,45 @@
 REQUIRES: system-windows, msvc
 RUN: %build --compiler=msvc --arch=32 --nodefaultlib 
--output=%T/SimpleTypesTest.cpp.enums.exe %S/Inputs/SimpleTypesTest.cpp
-RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck 
--check-prefix=ENUM %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck 
--check-prefix=ENUM_CONST %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck 
--check-prefix=ENUM_EMPTY %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck 
--check-prefix=ENUM_UCHAR %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck 
--check-prefix=ENUM_CLASS %s
+RUN: lldb-test symbols %T/SimpleTypesTest.cpp.enums.exe | FileCheck 
--check-prefix=ENUM_STRUCT %s
 
 ; FIXME: PDB does not have information about scoped enumeration (Enum class) 
so the  
 ; compiler type used is the same as the one for unscoped enumeration.
 
-CHECK: Module [[CU:.*]]
-CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[CU]])
-CHECK:  Type{{.*}} , name = "Enum", size = 4, decl = 
simpletypestest.cpp:19, compiler_type = {{.*}} enum Enum {
-CHECK-NEXT:RED,
-CHECK-NEXT:GREEN,
-CHECK-NEXT:BLUE
-CHECK-NEXT:}
-
-CHECK:  Type{{.*}} , name = "EnumConst", size = 4,  decl = 
simpletypestest.cpp:22, compiler_type = {{.*}} enum EnumConst {
-CHECK-NEXT:LOW,
-CHECK-NEXT:NORMAL,
-CHECK-NEXT:HIGH

[Lldb-commits] [PATCH] D56511: [Python] Update PyString_FromString() to work for python 2 and 3.

2019-01-09 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

There's two more mentions of this function:

- `unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp`
- `source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp`

I guess these have to be updated as well? Would it be worth to define a 
PYSTRING_FROM_STRING macro?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56511/new/

https://reviews.llvm.org/D56511



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


[Lldb-commits] [PATCH] D56418: Change lldb-test to use ParseAllDebugSymbols instead of ParseDeclsForContext

2019-01-09 Thread Zachary Turner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB350764: Change lldb-test to use ParseAllDebugSymbols. 
(authored by zturner, committed by ).
Herald added subscribers: teemperor, abidh.

Changed prior to commit:
  https://reviews.llvm.org/D56418?vs=180576&id=180914#toc

Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56418/new/

https://reviews.llvm.org/D56418

Files:
  lit/SymbolFile/PDB/enums-layout.test
  lit/SymbolFile/PDB/type-quals.test
  source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  tools/lldb-test/lldb-test.cpp

Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -518,6 +518,7 @@
 
 Error opts::symbols::dumpAST(lldb_private::Module &Module) {
   SymbolVendor &plugin = *Module.GetSymbolVendor();
+   Module.ParseAllDebugSymbols();
 
   auto symfile = plugin.GetSymbolFile();
   if (!symfile)
@@ -536,9 +537,6 @@
   if (!tu)
 return make_string_error("Can't retrieve translation unit declaration.");
 
-  symfile->ParseDeclsForContext(CompilerDeclContext(
-  clang_ast_ctx, static_cast(tu)));
-
   tu->print(outs());
 
   return Error::success();
Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -314,6 +314,16 @@
  func_type_uid, mangled, func_type, func_range);
 
   sc.comp_unit->AddFunction(func_sp);
+
+  TypeSystem *type_system = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
+  if (!type_system)
+return nullptr;
+  ClangASTContext *clang_type_system =
+llvm::dyn_cast_or_null(type_system);
+  if (!clang_type_system)
+return nullptr;
+  clang_type_system->GetPDBParser()->GetDeclForSymbol(pdb_func);
+
   return func_sp.get();
 }
 
@@ -1035,6 +1045,9 @@
   if (variable_list)
 variable_list->AddVariableIfUnique(var_sp);
   ++num_added;
+  PDBASTParser *ast = GetPDBAstParser();
+  if (ast)
+ast->GetDeclForSymbol(*pdb_data);
 }
   }
 }
@@ -1623,6 +1636,16 @@
   return type_system;
 }
 
+PDBASTParser *SymbolFilePDB::GetPDBAstParser() {
+  auto type_system = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
+  auto clang_type_system = llvm::dyn_cast_or_null(type_system);
+  if (!clang_type_system)
+return nullptr;
+
+  return clang_type_system->GetPDBParser();
+}
+
+
 lldb_private::CompilerDeclContext SymbolFilePDB::FindNamespace(
 const lldb_private::SymbolContext &sc,
 const lldb_private::ConstString &name,
Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
===
--- source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -20,6 +20,8 @@
 #include "llvm/DebugInfo/PDB/PDB.h"
 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
 
+class PDBASTParser;
+
 class SymbolFilePDB : public lldb_private::SymbolFile {
 public:
   //--
@@ -224,6 +226,8 @@
   void GetCompileUnitIndex(const llvm::pdb::PDBSymbolCompiland &pdb_compiland,
uint32_t &index);
 
+  PDBASTParser *GetPDBAstParser();
+
   std::unique_ptr
   GetPDBCompilandByUID(uint32_t uid);
 
Index: lit/SymbolFile/PDB/type-quals.test
===
--- lit/SymbolFile/PDB/type-quals.test
+++ lit/SymbolFile/PDB/type-quals.test
@@ -5,35 +5,35 @@
 
 CHECK: Module [[MOD:.*]]
 CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]])
-CHECK:  Type{{.*}} , name = "const int", size = 4, compiler_type = {{.*}} const int
-CHECK:  Type{{.*}} , size = 4, compiler_type = {{.*}} const int *
-CHECK:  Type{{.*}} , size = 4, compiler_type = {{.*}} const int **const
-CHECK:  Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const
-CHECK:  Type{{.*}} , size = 4, compiler_type = {{.*}} const int *const *
-CHECK:  Type{{.*}} , name = "Func1", {{.*}}, compiler_type = {{.*}} void (const int *, const int *, const int **const, const int *const *)
-
-CHECK:  Type{{.*}} , size = 4, compiler_type = {{.*}} volatile int *
-CHECK:  Type{{.*}} , name = "Func2", {{.*}}, compiler_type = {{.*}} void (volatile int *, volatile int *)
-
-CHECK:  Type{{.*}} , size = 4, compiler_type = {{.*}} int *
-CHECK:  Type{{.*}} , size = 4, compiler_type = {{.*}} int *&
-CHECK:  Type{{.*}} , size = 4, compiler_type = {{.*}} int &
-CHECK:  Type{{.*}} , size = 4, compiler_type = {{.*}} const int &
-CHECK:  Type{{.*}} , size = 4, compiler_type = {{.*}} int &&
-CHECK:  Type{{.*}} , name = "Func3", {{.*}}, compiler_type = {{.*}} void (int *&, int &,

[Lldb-commits] [PATCH] D56511: [Python] Update PyString_FromString() to work for python 2 and 3.

2019-01-09 Thread Zachary Turner via Phabricator via lldb-commits
zturner requested changes to this revision.
zturner added a comment.
This revision now requires changes to proceed.

In D56511#1351768 , @JDevlieghere 
wrote:

> There's two more mentions of this function:
>
> - `unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp`
> - `source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp`
>
>   I guess these have to be updated as well? Would it be worth to define a 
> PYSTRING_FROM_STRING macro?


I think it's the other way around.  Definitely the one in 
`PythonDataObjects.cpp` should remain, and the code in this patch should be 
updated to use `PythonString`, which already abstracts all this away.  In 
general we should not need explicit version checks anywhere outside of 
`PythonDataObjects.cpp`, as the whole purpose of that is to abstract away the 
differences so we don't need ifdefs in our code.




Comment at: lldb/scripts/Python/python-swigsafecast.swig:28-39
 template <>
 PyObject*
 SBTypeToSWIGWrapper (const char* c_str)
 {
 if (c_str)
+#if PY_MAJOR_VERSION >= 3
+return PyUnicode_FromString(c_str);

This entire function can just be deleted, it's not used.



Comment at: lldb/scripts/Python/python-wrapper.swig:829-835
+#if PY_MAJOR_VERSION >= 3
+PyObject *str_arg = PyUnicode_FromString(callee_name);
+#else
+PyObject *str_arg = PyString_FromString(callee_name);
+#endif
+PyObject* result = PyObject_CallMethodObjArgs(implementor, str_arg, arg, 
NULL);
 return result;

Instead of the version checks, use this:

```
PythonString str(callee_name);
PyObject *result = PyObject_CallMethodObjectArgs(implementor, str.GetObject(), 
arg, nullptr);
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56511/new/

https://reviews.llvm.org/D56511



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


[Lldb-commits] [PATCH] D56511: [Python] Update PyString_FromString() to work for python 2 and 3.

2019-01-09 Thread Zachary Turner via Phabricator via lldb-commits
zturner added inline comments.



Comment at: lldb/scripts/Python/python-wrapper.swig:834
+#endif
+PyObject* result = PyObject_CallMethodObjArgs(implementor, str_arg, arg, 
NULL);
 return result;

Note that there appears to be an object leak here, as the `str_arg` is never 
released.  Changing to `PythonString` should also fix that bug as a free side 
effect.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56511/new/

https://reviews.llvm.org/D56511



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


[Lldb-commits] [PATCH] D56511: [Python] Update PyString_FromString() to work for python 2 and 3.

2019-01-09 Thread Davide Italiano via Phabricator via lldb-commits
davide updated this revision to Diff 180924.
davide added a comment.

Address comments


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56511/new/

https://reviews.llvm.org/D56511

Files:
  lldb/scripts/Python/python-swigsafecast.swig
  lldb/scripts/Python/python-wrapper.swig


Index: lldb/scripts/Python/python-wrapper.swig
===
--- lldb/scripts/Python/python-wrapper.swig
+++ lldb/scripts/Python/python-wrapper.swig
@@ -826,7 +826,9 @@
 lldb::SBFrame frame_sb(frame_sp);
 PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 
-PyObject* result = PyObject_CallMethodObjArgs(implementor, 
PyString_FromString(callee_name), arg, NULL);
+PythonString str(callee_name);
+PyObject* result = PyObject_CallMethodObjArgs(implementor, str.get(), arg,
+  NULL);
 return result;
 }
 
Index: lldb/scripts/Python/python-swigsafecast.swig
===
--- lldb/scripts/Python/python-swigsafecast.swig
+++ lldb/scripts/Python/python-swigsafecast.swig
@@ -25,15 +25,6 @@
 return py_object;
 }
 
-template <>
-PyObject*
-SBTypeToSWIGWrapper (const char* c_str)
-{
-if (c_str)
-return PyString_FromString(c_str);
-return NULL;
-}
-
 template <>
 PyObject*
 SBTypeToSWIGWrapper (unsigned int* c_int)


Index: lldb/scripts/Python/python-wrapper.swig
===
--- lldb/scripts/Python/python-wrapper.swig
+++ lldb/scripts/Python/python-wrapper.swig
@@ -826,7 +826,9 @@
 lldb::SBFrame frame_sb(frame_sp);
 PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 
-PyObject* result = PyObject_CallMethodObjArgs(implementor, PyString_FromString(callee_name), arg, NULL);
+PythonString str(callee_name);
+PyObject* result = PyObject_CallMethodObjArgs(implementor, str.get(), arg,
+  NULL);
 return result;
 }
 
Index: lldb/scripts/Python/python-swigsafecast.swig
===
--- lldb/scripts/Python/python-swigsafecast.swig
+++ lldb/scripts/Python/python-swigsafecast.swig
@@ -25,15 +25,6 @@
 return py_object;
 }
 
-template <>
-PyObject*
-SBTypeToSWIGWrapper (const char* c_str)
-{
-if (c_str)
-return PyString_FromString(c_str);
-return NULL;
-}
-
 template <>
 PyObject*
 SBTypeToSWIGWrapper (unsigned int* c_int)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D56511: [Python] Update PyString_FromString() to work for python 2 and 3.

2019-01-09 Thread Zachary Turner via Phabricator via lldb-commits
zturner accepted this revision.
zturner added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/scripts/Python/python-wrapper.swig:827
 lldb::SBFrame frame_sb(frame_sp);
 PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 

This looks like another possible object leak.  The documentation for 
`PyObject_CallMethodObjArgs` doesn't mention whether it takes ownership of the 
argument, but I think it wouldn't make sense for it to do so, because you're 
just calling a function.  In any case, just make sure the current change 
doesn't regress the test suite.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56511/new/

https://reviews.llvm.org/D56511



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


[Lldb-commits] [PATCH] D56234: [lldb-server] Add unnamed pipe support to PipeWindows

2019-01-09 Thread Hui Huang via Phabricator via lldb-commits
Hui added inline comments.



Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:1051
 // and fill the data into "command_output_ptr"
 #if defined(__APPLE__)
 // Binding to port zero, we need to figure out what port it ends up

My first attempt was to enable windows specific along with apple's since named 
pipe is already supported. Seemed there was some problem for client pipe to 
open a server pipe on the same machine. This might not be the scope of this 
discussion. 



Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:1074
+}
+auto write_handle = socket_pipe.GetWriteNativeHandle();
+debugserver_args.AppendArgument(llvm::StringRef("--pipe"));

zturner wrote:
> labath wrote:
> > What do you think about adding `GetWriteNativeHandle` to the generic Pipe 
> > interface? In posix the file descriptor _is_ the native handle, so 
> > PipePosix could just return the fd, but it would allow you to write this 
> > bit of code generically without ifdefs (well, maybe except the 
> > `AppendCloseFileAction` below). Similarly, we could have a generic Pipe 
> > factory function(*) which takes the handles as input, which would allow you 
> > to implement the lldb-server side of things without ifdefs.
> > 
> > (*) I think a factory function (`Pipe::FromNativeHandles`?) would be better 
> > than a constructor to avoid ambiguities between descriptors and handles.
> That's one possibility, but at the very least we should at least move the 
> `CreateNew` and logging out of the ifdef.
Based on the lldb::pipe_t, using one of the introduced overloads could just put 
the windows specific all the way into the existing non-apple implementation.   
AppendCloseFileAction seemed yet impact anything.

lldb::pipe_t GetReadPipe() const { return lldb::pipe_t(m_read); }
lldb::pipe_t GetWritePipe() const { return lldb::pipe_t(m_write); }



Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56234/new/

https://reviews.llvm.org/D56234



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


[Lldb-commits] [lldb] r350769 - [Python] Update PyString_FromString() to work for python 2 and 3.

2019-01-09 Thread Davide Italiano via lldb-commits
Author: davide
Date: Wed Jan  9 14:52:47 2019
New Revision: 350769

URL: http://llvm.org/viewvc/llvm-project?rev=350769&view=rev
Log:
[Python] Update PyString_FromString() to work for python 2 and 3.

Reviewers: aprantl, JDevlieghere, friss, zturner

Subscribers: lldb-commits

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

Modified:
lldb/trunk/scripts/Python/python-swigsafecast.swig
lldb/trunk/scripts/Python/python-wrapper.swig

Modified: lldb/trunk/scripts/Python/python-swigsafecast.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-swigsafecast.swig?rev=350769&r1=350768&r2=350769&view=diff
==
--- lldb/trunk/scripts/Python/python-swigsafecast.swig (original)
+++ lldb/trunk/scripts/Python/python-swigsafecast.swig Wed Jan  9 14:52:47 2019
@@ -27,15 +27,6 @@ SBTypeToSWIGWrapper (PyObject* py_object
 
 template <>
 PyObject*
-SBTypeToSWIGWrapper (const char* c_str)
-{
-if (c_str)
-return PyString_FromString(c_str);
-return NULL;
-}
-
-template <>
-PyObject*
 SBTypeToSWIGWrapper (unsigned int* c_int)
 {
 if (!c_int)

Modified: lldb/trunk/scripts/Python/python-wrapper.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-wrapper.swig?rev=350769&r1=350768&r2=350769&view=diff
==
--- lldb/trunk/scripts/Python/python-wrapper.swig (original)
+++ lldb/trunk/scripts/Python/python-wrapper.swig Wed Jan  9 14:52:47 2019
@@ -826,7 +826,9 @@ LLDBSwigPython_GetRecognizedArguments
 lldb::SBFrame frame_sb(frame_sp);
 PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 
-PyObject* result = PyObject_CallMethodObjArgs(implementor, 
PyString_FromString(callee_name), arg, NULL);
+PythonString str(callee_name);
+PyObject* result = PyObject_CallMethodObjArgs(implementor, str.get(), arg,
+  NULL);
 return result;
 }
 


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


[Lldb-commits] [PATCH] D56511: [Python] Update PyString_FromString() to work for python 2 and 3.

2019-01-09 Thread Davide Italiano via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350769: [Python] Update PyString_FromString() to work for 
python 2 and 3. (authored by davide, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56511?vs=180924&id=180938#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56511/new/

https://reviews.llvm.org/D56511

Files:
  lldb/trunk/scripts/Python/python-swigsafecast.swig
  lldb/trunk/scripts/Python/python-wrapper.swig


Index: lldb/trunk/scripts/Python/python-swigsafecast.swig
===
--- lldb/trunk/scripts/Python/python-swigsafecast.swig
+++ lldb/trunk/scripts/Python/python-swigsafecast.swig
@@ -27,15 +27,6 @@
 
 template <>
 PyObject*
-SBTypeToSWIGWrapper (const char* c_str)
-{
-if (c_str)
-return PyString_FromString(c_str);
-return NULL;
-}
-
-template <>
-PyObject*
 SBTypeToSWIGWrapper (unsigned int* c_int)
 {
 if (!c_int)
Index: lldb/trunk/scripts/Python/python-wrapper.swig
===
--- lldb/trunk/scripts/Python/python-wrapper.swig
+++ lldb/trunk/scripts/Python/python-wrapper.swig
@@ -826,7 +826,9 @@
 lldb::SBFrame frame_sb(frame_sp);
 PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 
-PyObject* result = PyObject_CallMethodObjArgs(implementor, 
PyString_FromString(callee_name), arg, NULL);
+PythonString str(callee_name);
+PyObject* result = PyObject_CallMethodObjArgs(implementor, str.get(), arg,
+  NULL);
 return result;
 }
 


Index: lldb/trunk/scripts/Python/python-swigsafecast.swig
===
--- lldb/trunk/scripts/Python/python-swigsafecast.swig
+++ lldb/trunk/scripts/Python/python-swigsafecast.swig
@@ -27,15 +27,6 @@
 
 template <>
 PyObject*
-SBTypeToSWIGWrapper (const char* c_str)
-{
-if (c_str)
-return PyString_FromString(c_str);
-return NULL;
-}
-
-template <>
-PyObject*
 SBTypeToSWIGWrapper (unsigned int* c_int)
 {
 if (!c_int)
Index: lldb/trunk/scripts/Python/python-wrapper.swig
===
--- lldb/trunk/scripts/Python/python-wrapper.swig
+++ lldb/trunk/scripts/Python/python-wrapper.swig
@@ -826,7 +826,9 @@
 lldb::SBFrame frame_sb(frame_sp);
 PyObject *arg = SBTypeToSWIGWrapper(frame_sb);
 
-PyObject* result = PyObject_CallMethodObjArgs(implementor, PyString_FromString(callee_name), arg, NULL);
+PythonString str(callee_name);
+PyObject* result = PyObject_CallMethodObjArgs(implementor, str.get(), arg,
+  NULL);
 return result;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D56234: [lldb-server] Add unnamed pipe support to PipeWindows

2019-01-09 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 180939.
asmith added a comment.

Add lldb::pipe_t type


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56234/new/

https://reviews.llvm.org/D56234

Files:
  include/lldb/Host/PipeBase.h
  include/lldb/Host/posix/PipePosix.h
  include/lldb/Host/windows/PipeWindows.h
  include/lldb/lldb-types.h
  source/Host/posix/PipePosix.cpp
  source/Host/windows/PipeWindows.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  tools/lldb-server/lldb-gdbserver.cpp

Index: tools/lldb-server/lldb-gdbserver.cpp
===
--- tools/lldb-server/lldb-gdbserver.cpp
+++ tools/lldb-server/lldb-gdbserver.cpp
@@ -218,20 +218,17 @@
   return writeSocketIdToPipe(port_name_pipe, socket_id);
 }
 
-Status writeSocketIdToPipe(int unnamed_pipe_fd, const std::string &socket_id) {
-#if defined(_WIN32)
-  return Status("Unnamed pipes are not supported on Windows.");
-#else
-  Pipe port_pipe{Pipe::kInvalidDescriptor, unnamed_pipe_fd};
+Status writeSocketIdToPipe(lldb::pipe_t unnamed_pipe,
+   const std::string &socket_id) {
+  Pipe port_pipe{LLDB_INVALID_PIPE, unnamed_pipe};
   return writeSocketIdToPipe(port_pipe, socket_id);
-#endif
 }
 
 void ConnectToRemote(MainLoop &mainloop,
  GDBRemoteCommunicationServerLLGS &gdb_server,
  bool reverse_connect, const char *const host_and_port,
  const char *const progname, const char *const subcommand,
- const char *const named_pipe_path, int unnamed_pipe_fd,
+ const char *const named_pipe_path, pipe_t unnamed_pipe,
  int connection_fd) {
   Status error;
 
@@ -331,8 +328,8 @@
 }
 // If we have an unnamed pipe to write the socket id back to, do that
 // now.
-else if (unnamed_pipe_fd >= 0) {
-  error = writeSocketIdToPipe(unnamed_pipe_fd, socket_id);
+else if (unnamed_pipe != LLDB_INVALID_PIPE) {
+  error = writeSocketIdToPipe(unnamed_pipe, socket_id);
   if (error.Fail())
 fprintf(stderr, "failed to write to the unnamed pipe: %s\n",
 error.AsCString());
@@ -384,7 +381,7 @@
   std::string log_file;
   StringRef
   log_channels; // e.g. "lldb process threads:gdb-remote default:linux all"
-  int unnamed_pipe_fd = -1;
+  lldb::pipe_t unnamed_pipe = LLDB_INVALID_PIPE;
   bool reverse_connect = false;
   int connection_fd = -1;
 
@@ -425,7 +422,7 @@
 
 case 'U': // unnamed pipe
   if (optarg && optarg[0])
-unnamed_pipe_fd = StringConvert::ToUInt32(optarg, -1);
+unnamed_pipe = (pipe_t)StringConvert::ToUInt64(optarg, -1);
   break;
 
 case 'r':
@@ -528,8 +525,8 @@
   printf("%s-%s", LLGS_PROGRAM_NAME, LLGS_VERSION_STR);
 
   ConnectToRemote(mainloop, gdb_server, reverse_connect, host_and_port,
-  progname, subcommand, named_pipe_path.c_str(),
-  unnamed_pipe_fd, connection_fd);
+  progname, subcommand, named_pipe_path.c_str(), unnamed_pipe,
+  connection_fd);
 
   if (!gdb_server.IsConnected()) {
 fprintf(stderr, "no connection information provided, unable to run\n");
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -164,9 +164,6 @@
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer(
 StringExtractorGDBRemote &packet) {
-#ifdef _WIN32
-  return SendErrorResponse(9);
-#else
   // Spawn a local debugserver as a platform so we can then attach or launch a
   // process...
 
@@ -217,10 +214,9 @@
   PacketResult packet_result = SendPacketNoLock(response.GetString());
   if (packet_result != PacketResult::Success) {
 if (debugserver_pid != LLDB_INVALID_PROCESS_ID)
-  ::kill(debugserver_pid, SIGINT);
+  Host::Kill(debugserver_pid, SIGINT);
   }
   return packet_result;
-#endif
 }
 
 GDBRemoteCommunication::PacketResult
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1073,9 +1073,9 @@
 __FUNCTION__, error.AsCString());
   return error;
 }
-int write_fd = socket_pipe.GetWriteFileDescriptor();
+pipe_t write = socket_pipe.GetWritePipe();
 debugserver_args.AppendArgument(llvm::StringRef("--pipe"));
-debugserver_args.AppendArgument(llvm::to_string(write_fd));
+debugserver_args.

[Lldb-commits] [PATCH] D56517: [Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.

2019-01-09 Thread Davide Italiano via Phabricator via lldb-commits
davide created this revision.
davide added reviewers: JDevlieghere, friss, zturner, aprantl.
Herald added a reviewer: serge-sans-paille.

In python 2, strings and bytes are the same, but they're not in
python 3, hence the return of read() needs an explicit conversion.
While I'm around, rename the return of Popen() from `pipe` to
`process`, as that's what Popen returns.


https://reviews.llvm.org/D56517

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1061,14 +1061,15 @@
 
 def checkDsymForUUIDIsNotOn():
 cmd = ["defaults", "read", "com.apple.DebugSymbols"]
-pipe = subprocess.Popen(
+process = subprocess.Popen(
 cmd,
 stdout=subprocess.PIPE,
 stderr=subprocess.STDOUT)
-cmd_output = pipe.stdout.read()
-if cmd_output and "DBGFileMappedPaths = " in cmd_output:
+cmd_output = process.stdout.read()
+output_str = cmd_output.decode("utf-8")
+if "DBGFileMappedPaths = " in output_str:
 print("%s =>" % ' '.join(cmd))
-print(cmd_output)
+print(output_str)
 print(
 "Disable automatic lookup and caching of dSYMs before running the 
test suite!")
 print("Exiting...")


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1061,14 +1061,15 @@
 
 def checkDsymForUUIDIsNotOn():
 cmd = ["defaults", "read", "com.apple.DebugSymbols"]
-pipe = subprocess.Popen(
+process = subprocess.Popen(
 cmd,
 stdout=subprocess.PIPE,
 stderr=subprocess.STDOUT)
-cmd_output = pipe.stdout.read()
-if cmd_output and "DBGFileMappedPaths = " in cmd_output:
+cmd_output = process.stdout.read()
+output_str = cmd_output.decode("utf-8")
+if "DBGFileMappedPaths = " in output_str:
 print("%s =>" % ' '.join(cmd))
-print(cmd_output)
+print(output_str)
 print(
 "Disable automatic lookup and caching of dSYMs before running the test suite!")
 print("Exiting...")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D56517: [Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.

2019-01-09 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

Another way of dealing with this is to pass `universal_newlines=True` to 
`subprocess.Popen`.  Despite the silly name, all this really means is 
"redirected pipes are text mode".  As long as you expect the command being run 
to always return text rather than binary, it's safe to use.  The name 
`universal_newlines` is actually so poor that in Python 3.7 they made a new 
alias that is identical, but just called `text`, so in 3.7 and higher you can 
just say `text=True`.  We can't do that here because we probably want to 
support 3.5 and higher, but the point is just that `universal_newlines` isn't 
really anything fancy, it just means text.

If you do that, then `process.stdout.read()` will just return a string, and you 
don't need to manually decode it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56517/new/

https://reviews.llvm.org/D56517



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


[Lldb-commits] [lldb] r350773 - Write PDB/variables.test to be more robust.

2019-01-09 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Jan  9 15:26:50 2019
New Revision: 350773

URL: http://llvm.org/viewvc/llvm-project?rev=350773&view=rev
Log:
Write PDB/variables.test to be more robust.

CHECK-DAG can't really be mixed with CHECK-NEXT statements because
each non DAG check sets a new search-origin for following CHECK-DAG
statements.  This was passing by coincidence before, but a benign
change in the way we process symbols caused the order of the output
to be different, which triggered this test to fail.

This change makes the test resilient against ordering problems by
running a separate invocation of FileCheck for each function that
we want to test.

Note that with the Native PDB reader, we have full control over
the ordering that symbols are processed in, so we don't have
to worry about different machines returning things in different
orders due to different DIA SDK versions.

Modified:
lldb/trunk/lit/SymbolFile/PDB/variables.test

Modified: lldb/trunk/lit/SymbolFile/PDB/variables.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/variables.test?rev=350773&r1=350772&r2=350773&view=diff
==
--- lldb/trunk/lit/SymbolFile/PDB/variables.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/variables.test Wed Jan  9 15:26:50 2019
@@ -1,58 +1,66 @@
 REQUIRES: system-windows, msvc
 RUN: %build --compiler=clang-cl --mode=compile --arch=64 --nodefaultlib 
--output=%T/VariablesTest.cpp.obj %S/Inputs/VariablesTest.cpp
 RUN: %build --compiler=msvc --mode=link --arch=64 --nodefaultlib 
--output=%T/VariablesTest.cpp.exe %T/VariablesTest.cpp.obj
-RUN: lldb-test symbols %T/VariablesTest.cpp.exe | FileCheck %s
+RUN: lldb-test symbols %T/VariablesTest.cpp.exe > %T/VariablesTest.out
+RUN: FileCheck --check-prefix=GLOBALS --input-file=%T/VariablesTest.out %s
+RUN: FileCheck --check-prefix=FUNC-F --input-file=%T/VariablesTest.out %s
+RUN: FileCheck --check-prefix=FUNC-MAIN --input-file=%T/VariablesTest.out %s
+RUN: FileCheck --check-prefix=FUNC-CONSTRUCTOR 
--input-file=%T/VariablesTest.out %s
+RUN: FileCheck --check-prefix=FUNC-MEMBER --input-file=%T/VariablesTest.out %s
 
-CHECK: Module [[MOD:.*]]
-CHECK: SymbolVendor ([[MOD]])
-CHECK: CompileUnit{{.*}}, language = "c++", file = 
'{{.*}}\VariablesTest.cpp'
-CHECK-DAG:   Variable{{.*}}, name = "g_IntVar"
-CHECK-SAME:  scope = global, location = {{.*}}, external
-CHECK-DAG:   Variable{{.*}}, name = "m_StaticClassMember"
-CHECK-SAME:  scope = global, location = {{.*}}, external
-CHECK-DAG:   Variable{{.*}}, name = "g_pConst"
-CHECK-SAME:  scope = global, location = {{.*}}, external
-CHECK-DAG:   Variable{{.*}}, name = "same_name_var"
-CHECK-SAME:  scope = global, location = {{.*}}, external
-CHECK-DAG:   Variable{{.*}}, name = "g_EnumVar"
-CHECK-SAME:  scope = global, location = {{.*}}, external
-CHECK-DAG:   Variable{{.*}}, name = "g_tls"
-CHECK-SAME:  scope = thread local, location = {{.*}}, external
-CHECK-DAG:   Variable{{.*}}, name = "ClassVar"
-CHECK-SAME:  scope = global, location = {{.*}}, external
-CHECK-DAG:   Variable{{.*}}, name = "g_Const"
-CHECK-SAME:  scope = ??? (2)
+GLOBALS: Module [[MOD:.*]]
+GLOBALS: SymbolVendor ([[MOD]])
+GLOBALS: CompileUnit{{.*}}, language = "c++", file = 
'{{.*}}\VariablesTest.cpp'
+GLOBALS-DAG:   Variable{{.*}}, name = "g_IntVar"
+GLOBALS-SAME:  scope = global, location = {{.*}}, external
+GLOBALS-DAG:   Variable{{.*}}, name = "m_StaticClassMember"
+GLOBALS-SAME:  scope = global, location = {{.*}}, external
+GLOBALS-DAG:   Variable{{.*}}, name = "g_pConst"
+GLOBALS-SAME:  scope = global, location = {{.*}}, external
+GLOBALS-DAG:   Variable{{.*}}, name = "same_name_var"
+GLOBALS-SAME:  scope = global, location = {{.*}}, external
+GLOBALS-DAG:   Variable{{.*}}, name = "g_EnumVar"
+GLOBALS-SAME:  scope = global, location = {{.*}}, external
+GLOBALS-DAG:   Variable{{.*}}, name = "g_tls"
+GLOBALS-SAME:  scope = thread local, location = {{.*}}, external
+GLOBALS-DAG:   Variable{{.*}}, name = "ClassVar"
+GLOBALS-SAME:  scope = global, location = {{.*}}, external
+GLOBALS-DAG:   Variable{{.*}}, name = "g_Const"
+GLOBALS-SAME:  scope = ??? (2)
+GLOBALS: Function
 
-CHECK-DAG:   Function{[[FID1:.*]]}, mangled = ?f@@YAHHH@Z
-CHECK-NEXT:  Block{[[FID1]]}
-CHECK-DAG: Variable{{.*}}, name = "var_arg1"
-CHECK-SAME:scope = parameter
-CHECK-DAG: Variable{{.*}}, name = "var_arg2"
-CHECK-SAME:scope = parameter
-CHECK-DAG: Variable{{.*}}, name = "same_name_var"
-CHECK-SAME:scope = local
+FUNC-F:  Function{{.*}}, mangled = ?f@@YAHHH@Z
+FUNC-F-NEXT:   Block
+FUNC-F-NEXT: Variable{{.*}}, name = "var_arg1"
+FUNC-F-SAME: scope = parameter
+FUNC-F-NEXT: Variable{{.*}}, name = "var_arg2"
+FUNC-F-SAME: scope = parameter
+FUNC-F-NEXT: Variable{{.*}}, name = "same_name_var"
+FUNC-F-SAME: scope = local
 
-CHECK-DAG:   Function{[[FID2:.*]]}, mangled = main
-CHECK-N

[Lldb-commits] [PATCH] D56234: [lldb-server] Add unnamed pipe support to PipeWindows

2019-01-09 Thread Zachary Turner via Phabricator via lldb-commits
zturner accepted this revision.
zturner added a comment.
This revision is now accepted and ready to land.

This looks much nicer with the `pipe_t` type.




Comment at: source/Host/posix/PipePosix.cpp:70
+PipePosix::PipePosix(lldb::pipe_t read, lldb::pipe_t write)
+: m_fds{(int)read, (int)write} {}
 

I don't think you need the cast, since the type is already int.  (Some 
compilers will warn if you cast something to its own type).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56234/new/

https://reviews.llvm.org/D56234



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


[Lldb-commits] [PATCH] D56461: [NativePDB] Add support for parsing typedefs and make lldb-test work with the native reader.

2019-01-09 Thread Leonard Mosescu via Phabricator via lldb-commits
lemo added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp:626
+// a series of namespaces.
+// FIXME: do this.
+CVSymbol global = m_index.ReadSymbolRecord(uid.asGlobalSym());

leftover comment?



Comment at: lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h:70-74
+if (m_kind == Struct || m_kind == Union)
+  return cvclass.Name;
+if (m_kind == Enum)
+  return cvenum.Name;
+return cvunion.Name;

this, in isolation at least, reads very strange : for m_kind==Union return 
cvclass.Name and for everything else return cvunion.Name ?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56461/new/

https://reviews.llvm.org/D56461



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


[Lldb-commits] [PATCH] D56461: [NativePDB] Add support for parsing typedefs and make lldb-test work with the native reader.

2019-01-09 Thread Zachary Turner via Phabricator via lldb-commits
zturner marked an inline comment as done.
zturner added inline comments.



Comment at: lldb/lit/SymbolFile/NativePDB/typedefs.cpp:3
+
+// REQUIRES: system-windows
+// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s

labath wrote:
> What's the reason for this? Does the test need msvc linker or something?
It used to say `--compiler=msvc` until I realized it worked with clang-cl.  
Then I forgot to remove this.  Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56461/new/

https://reviews.llvm.org/D56461



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


[Lldb-commits] [PATCH] D56461: [NativePDB] Add support for parsing typedefs and make lldb-test work with the native reader.

2019-01-09 Thread Zachary Turner via Phabricator via lldb-commits
zturner marked 2 inline comments as done.
zturner added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp:626
+// a series of namespaces.
+// FIXME: do this.
+CVSymbol global = m_index.ReadSymbolRecord(uid.asGlobalSym());

lemo wrote:
> leftover comment?
Yep, thanks.



Comment at: lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h:70-74
+if (m_kind == Struct || m_kind == Union)
+  return cvclass.Name;
+if (m_kind == Enum)
+  return cvenum.Name;
+return cvunion.Name;

lemo wrote:
> this, in isolation at least, reads very strange : for m_kind==Union return 
> cvclass.Name and for everything else return cvunion.Name ?
Oops, that's a bug.  It's supposed to say 

```
if (m_kind == Struct || m_kind == Class)
  return cvclass.Name;
```

I think the rest of the function makes sense after that.  Thanks for catching 
that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56461/new/

https://reviews.llvm.org/D56461



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


[Lldb-commits] [lldb] r350784 - [lldb-server] Add unnamed pipe support to PipeWindows

2019-01-09 Thread Aaron Smith via lldb-commits
Author: asmith
Date: Wed Jan  9 16:46:09 2019
New Revision: 350784

URL: http://llvm.org/viewvc/llvm-project?rev=350784&view=rev
Log:
[lldb-server] Add unnamed pipe support to PipeWindows

Summary:
This adds unnamed pipe support in PipeWindows to support communication between 
a debug server and child process.
Modify PipeWindows::CreateNew to support the creation of an unnamed pipe.
Rename the previous method that created a named pipe to 
PipeWindows::CreateNewNamed.

Reviewers: zturner, llvm-commits

Reviewed By: zturner

Subscribers: Hui, labath, lldb-commits

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

Modified:
lldb/trunk/include/lldb/Host/PipeBase.h
lldb/trunk/include/lldb/Host/posix/PipePosix.h
lldb/trunk/include/lldb/Host/windows/PipeWindows.h
lldb/trunk/include/lldb/lldb-types.h
lldb/trunk/source/Host/posix/PipePosix.cpp
lldb/trunk/source/Host/windows/PipeWindows.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
lldb/trunk/tools/lldb-server/lldb-gdbserver.cpp

Modified: lldb/trunk/include/lldb/Host/PipeBase.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/PipeBase.h?rev=350784&r1=350783&r2=350784&view=diff
==
--- lldb/trunk/include/lldb/Host/PipeBase.h (original)
+++ lldb/trunk/include/lldb/Host/PipeBase.h Wed Jan  9 16:46:09 2019
@@ -41,6 +41,9 @@ public:
   virtual bool CanRead() const = 0;
   virtual bool CanWrite() const = 0;
 
+  virtual lldb::pipe_t GetReadPipe() const = 0;
+  virtual lldb::pipe_t GetWritePipe() const = 0;
+
   virtual int GetReadFileDescriptor() const = 0;
   virtual int GetWriteFileDescriptor() const = 0;
   virtual int ReleaseReadFileDescriptor() = 0;

Modified: lldb/trunk/include/lldb/Host/posix/PipePosix.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/PipePosix.h?rev=350784&r1=350783&r2=350784&view=diff
==
--- lldb/trunk/include/lldb/Host/posix/PipePosix.h (original)
+++ lldb/trunk/include/lldb/Host/posix/PipePosix.h Wed Jan  9 16:46:09 2019
@@ -27,7 +27,7 @@ public:
   static int kInvalidDescriptor;
 
   PipePosix();
-  PipePosix(int read_fd, int write_fd);
+  PipePosix(lldb::pipe_t read, lldb::pipe_t write);
   PipePosix(const PipePosix &) = delete;
   PipePosix(PipePosix &&pipe_posix);
   PipePosix &operator=(const PipePosix &) = delete;
@@ -49,6 +49,13 @@ public:
   bool CanRead() const override;
   bool CanWrite() const override;
 
+  lldb::pipe_t GetReadPipe() const override {
+return lldb::pipe_t(GetReadFileDescriptor());
+  }
+  lldb::pipe_t GetWritePipe() const override {
+return lldb::pipe_t(GetWriteFileDescriptor());
+  }
+
   int GetReadFileDescriptor() const override;
   int GetWriteFileDescriptor() const override;
   int ReleaseReadFileDescriptor() override;

Modified: lldb/trunk/include/lldb/Host/windows/PipeWindows.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/PipeWindows.h?rev=350784&r1=350783&r2=350784&view=diff
==
--- lldb/trunk/include/lldb/Host/windows/PipeWindows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/PipeWindows.h Wed Jan  9 16:46:09 2019
@@ -24,10 +24,18 @@ namespace lldb_private {
 //--
 class PipeWindows : public PipeBase {
 public:
+  static const int kInvalidDescriptor = -1;
+
+public:
   PipeWindows();
+  PipeWindows(lldb::pipe_t read, lldb::pipe_t write);
   ~PipeWindows() override;
 
+  // Create an unnamed pipe.
   Status CreateNew(bool child_process_inherit) override;
+
+  // Create a named pipe.
+  Status CreateNewNamed(bool child_process_inherit);
   Status CreateNew(llvm::StringRef name, bool child_process_inherit) override;
   Status CreateWithUniqueName(llvm::StringRef prefix,
   bool child_process_inherit,
@@ -41,6 +49,9 @@ public:
   bool CanRead() const override;
   bool CanWrite() const override;
 
+  lldb::pipe_t GetReadPipe() const { return lldb::pipe_t(m_read); }
+  lldb::pipe_t GetWritePipe() const { return lldb::pipe_t(m_write); }
+
   int GetReadFileDescriptor() const override;
   int GetWriteFileDescriptor() const override;
   int ReleaseReadFileDescriptor() override;

Modified: lldb/trunk/include/lldb/lldb-types.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-types.h?rev=350784&r1=350783&r2=350784&view=diff
==
--- lldb/trunk/include/lldb/lldb-types.h (original)
+++ lldb/trunk/include/lldb/lldb-types.h Wed Jan  9 16:46:09 2019
@@ -47,7 +47,8 @@ typedef unsigned int __w64 socket_t; //
 typedef void *thread_arg_t;   // 

[Lldb-commits] [PATCH] D56234: [lldb-server] Add unnamed pipe support to PipeWindows

2019-01-09 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 180965.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56234/new/

https://reviews.llvm.org/D56234

Files:
  include/lldb/Host/PipeBase.h
  include/lldb/Host/posix/PipePosix.h
  include/lldb/Host/windows/PipeWindows.h
  include/lldb/lldb-types.h
  source/Host/posix/PipePosix.cpp
  source/Host/windows/PipeWindows.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
  tools/lldb-server/lldb-gdbserver.cpp

Index: tools/lldb-server/lldb-gdbserver.cpp
===
--- tools/lldb-server/lldb-gdbserver.cpp
+++ tools/lldb-server/lldb-gdbserver.cpp
@@ -218,20 +218,17 @@
   return writeSocketIdToPipe(port_name_pipe, socket_id);
 }
 
-Status writeSocketIdToPipe(int unnamed_pipe_fd, const std::string &socket_id) {
-#if defined(_WIN32)
-  return Status("Unnamed pipes are not supported on Windows.");
-#else
-  Pipe port_pipe{Pipe::kInvalidDescriptor, unnamed_pipe_fd};
+Status writeSocketIdToPipe(lldb::pipe_t unnamed_pipe,
+   const std::string &socket_id) {
+  Pipe port_pipe{LLDB_INVALID_PIPE, unnamed_pipe};
   return writeSocketIdToPipe(port_pipe, socket_id);
-#endif
 }
 
 void ConnectToRemote(MainLoop &mainloop,
  GDBRemoteCommunicationServerLLGS &gdb_server,
  bool reverse_connect, const char *const host_and_port,
  const char *const progname, const char *const subcommand,
- const char *const named_pipe_path, int unnamed_pipe_fd,
+ const char *const named_pipe_path, pipe_t unnamed_pipe,
  int connection_fd) {
   Status error;
 
@@ -331,8 +328,8 @@
 }
 // If we have an unnamed pipe to write the socket id back to, do that
 // now.
-else if (unnamed_pipe_fd >= 0) {
-  error = writeSocketIdToPipe(unnamed_pipe_fd, socket_id);
+else if (unnamed_pipe != LLDB_INVALID_PIPE) {
+  error = writeSocketIdToPipe(unnamed_pipe, socket_id);
   if (error.Fail())
 fprintf(stderr, "failed to write to the unnamed pipe: %s\n",
 error.AsCString());
@@ -384,7 +381,7 @@
   std::string log_file;
   StringRef
   log_channels; // e.g. "lldb process threads:gdb-remote default:linux all"
-  int unnamed_pipe_fd = -1;
+  lldb::pipe_t unnamed_pipe = LLDB_INVALID_PIPE;
   bool reverse_connect = false;
   int connection_fd = -1;
 
@@ -425,7 +422,7 @@
 
 case 'U': // unnamed pipe
   if (optarg && optarg[0])
-unnamed_pipe_fd = StringConvert::ToUInt32(optarg, -1);
+unnamed_pipe = (pipe_t)StringConvert::ToUInt64(optarg, -1);
   break;
 
 case 'r':
@@ -528,8 +525,8 @@
   printf("%s-%s", LLGS_PROGRAM_NAME, LLGS_VERSION_STR);
 
   ConnectToRemote(mainloop, gdb_server, reverse_connect, host_and_port,
-  progname, subcommand, named_pipe_path.c_str(),
-  unnamed_pipe_fd, connection_fd);
+  progname, subcommand, named_pipe_path.c_str(), 
+  unnamed_pipe, connection_fd);
 
   if (!gdb_server.IsConnected()) {
 fprintf(stderr, "no connection information provided, unable to run\n");
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -164,9 +164,6 @@
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerPlatform::Handle_qLaunchGDBServer(
 StringExtractorGDBRemote &packet) {
-#ifdef _WIN32
-  return SendErrorResponse(9);
-#else
   // Spawn a local debugserver as a platform so we can then attach or launch a
   // process...
 
@@ -217,10 +214,9 @@
   PacketResult packet_result = SendPacketNoLock(response.GetString());
   if (packet_result != PacketResult::Success) {
 if (debugserver_pid != LLDB_INVALID_PROCESS_ID)
-  ::kill(debugserver_pid, SIGINT);
+  Host::Kill(debugserver_pid, SIGINT);
   }
   return packet_result;
-#endif
 }
 
 GDBRemoteCommunication::PacketResult
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -1074,9 +1074,9 @@
 __FUNCTION__, error.AsCString());
   return error;
 }
-int write_fd = socket_pipe.GetWriteFileDescriptor();
+pipe_t write = socket_pipe.GetWritePipe();
 debugserver_args.AppendArgument(llvm::StringRef("--pipe"));
-debugserver_args.AppendArgument(llvm::to_string(write_fd));
+debugserver_args.AppendArgument(llvm::to_string(write));
   

[Lldb-commits] [PATCH] D56517: [Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.

2019-01-09 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

Given the name is really bizarre, I would stick with what I have now, which at 
least clarifies the intent (unless you feel strongly about it)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56517/new/

https://reviews.llvm.org/D56517



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


[Lldb-commits] [lldb] r350786 - A little cleanup / commenting on locating kernel binaries while I

2019-01-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Wed Jan  9 16:57:54 2019
New Revision: 350786

URL: http://llvm.org/viewvc/llvm-project?rev=350786&view=rev
Log:
A little cleanup / commenting on locating kernel binaries while I
was working on something else.
DynamicLoaderDarwinKernel::SearchForKernelNearPC should have had
an early return if the pc value is not in high memory; add that.
The search for a kernel at 0x2000 offsets was a stopgap; it doesn't
need to be checked any longer.


Modified:

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

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=350786&r1=350785&r2=350786&view=diff
==
--- 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
 Wed Jan  9 16:57:54 2019
@@ -293,6 +293,18 @@ DynamicLoaderDarwinKernel::SearchForKern
 return LLDB_INVALID_ADDRESS;
   addr_t pc = thread->GetRegisterContext()->GetPC(LLDB_INVALID_ADDRESS);
 
+  // The kernel is always loaded in high memory, if the top bit is zero,
+  // this isn't a kernel.
+  if (process->GetTarget().GetArchitecture().GetAddressByteSize() == 8) {
+if ((pc & (1ULL << 63)) == 0) {
+  return LLDB_INVALID_ADDRESS;
+}
+  } else {
+if ((pc & (1ULL << 31)) == 0) {
+  return LLDB_INVALID_ADDRESS;
+}
+  }
+
   if (pc == LLDB_INVALID_ADDRESS)
 return LLDB_INVALID_ADDRESS;
 
@@ -307,12 +319,13 @@ DynamicLoaderDarwinKernel::SearchForKern
   // Search backwards 32 megabytes, looking for the start of the kernel at each
   // one-megabyte boundary.
   for (int i = 0; i < 32; i++, addr -= 0x10) {
+// x86_64 kernels are at offset 0
 if (CheckForKernelImageAtAddress(addr, process).IsValid())
   return addr;
+// 32-bit arm kernels are at offset 0x1000 (one 4k page)
 if (CheckForKernelImageAtAddress(addr + 0x1000, process).IsValid())
   return addr + 0x1000;
-if (CheckForKernelImageAtAddress(addr + 0x2000, process).IsValid())
-  return addr + 0x2000;
+// 64-bit arm kernels are at offset 0x4000 (one 16k page)
 if (CheckForKernelImageAtAddress(addr + 0x4000, process).IsValid())
   return addr + 0x4000;
   }
@@ -351,12 +364,13 @@ lldb::addr_t DynamicLoaderDarwinKernel::
   addr_t addr = kernel_range_low;
 
   while (addr >= kernel_range_low && addr < kernel_range_high) {
+// x86_64 kernels are at offset 0
 if (CheckForKernelImageAtAddress(addr, process).IsValid())
   return addr;
+// 32-bit arm kernels are at offset 0x1000 (one 4k page)
 if (CheckForKernelImageAtAddress(addr + 0x1000, process).IsValid())
   return addr + 0x1000;
-if (CheckForKernelImageAtAddress(addr + 0x2000, process).IsValid())
-  return addr + 0x2000;
+// 64-bit arm kernels are at offset 0x4000 (one 16k page)
 if (CheckForKernelImageAtAddress(addr + 0x4000, process).IsValid())
   return addr + 0x4000;
 addr += 0x10;


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


[Lldb-commits] [PATCH] D56517: [Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.

2019-01-09 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

It's probably fine the way it is.  The biggest advantage of using 
`universal_newlines=True` is that the result will always be a `string` in both 
Python 2 and Python 3.  This makes it easier to reason about subsequent code , 
but if you're not doing much with the subsequent code, it doesn't matter.  In 
Python 2, the return type is a `Unicode` object, which is different than a 
`string`.  For this code it's fine, it's just something to keep in mind in 
future code.

(BTW, if for whatever reason in the future we decide that we require a minimum 
of Python 3.7, we can change this to `text=True` and then it will "just work"


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56517/new/

https://reviews.llvm.org/D56517



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


[Lldb-commits] [lldb] r350788 - [Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.

2019-01-09 Thread Davide Italiano via lldb-commits
Author: davide
Date: Wed Jan  9 17:15:18 2019
New Revision: 350788

URL: http://llvm.org/viewvc/llvm-project?rev=350788&view=rev
Log:
[Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.

Summary:
In python 2, strings and bytes are the same, but they're not in
python 3, hence the return of read() needs an explicit conversion.
While I'm around, rename the return of Popen() from `pipe` to
`process`, as that's what Popen returns.

Reviewers: JDevlieghere, friss, zturner, aprantl, serge-sans-paille

Subscribers: lldb-commits

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

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=350788&r1=350787&r2=350788&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Wed Jan  9 17:15:18 2019
@@ -1061,14 +1061,15 @@ def getMyCommandLine():
 
 def checkDsymForUUIDIsNotOn():
 cmd = ["defaults", "read", "com.apple.DebugSymbols"]
-pipe = subprocess.Popen(
+process = subprocess.Popen(
 cmd,
 stdout=subprocess.PIPE,
 stderr=subprocess.STDOUT)
-cmd_output = pipe.stdout.read()
-if cmd_output and "DBGFileMappedPaths = " in cmd_output:
+cmd_output = process.stdout.read()
+output_str = cmd_output.decode("utf-8")
+if "DBGFileMappedPaths = " in output_str:
 print("%s =>" % ' '.join(cmd))
-print(cmd_output)
+print(output_str)
 print(
 "Disable automatic lookup and caching of dSYMs before running the 
test suite!")
 print("Exiting...")


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


[Lldb-commits] [PATCH] D56517: [Python] Update checkDsymForUUIDIsOn to be compatible with Python 3.

2019-01-09 Thread Davide Italiano via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350788: [Python] Update checkDsymForUUIDIsOn to be 
compatible with Python 3. (authored by davide, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56517?vs=180944&id=180970#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56517/new/

https://reviews.llvm.org/D56517

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


Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py
@@ -1061,14 +1061,15 @@
 
 def checkDsymForUUIDIsNotOn():
 cmd = ["defaults", "read", "com.apple.DebugSymbols"]
-pipe = subprocess.Popen(
+process = subprocess.Popen(
 cmd,
 stdout=subprocess.PIPE,
 stderr=subprocess.STDOUT)
-cmd_output = pipe.stdout.read()
-if cmd_output and "DBGFileMappedPaths = " in cmd_output:
+cmd_output = process.stdout.read()
+output_str = cmd_output.decode("utf-8")
+if "DBGFileMappedPaths = " in output_str:
 print("%s =>" % ' '.join(cmd))
-print(cmd_output)
+print(output_str)
 print(
 "Disable automatic lookup and caching of dSYMs before running the 
test suite!")
 print("Exiting...")


Index: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py
@@ -1061,14 +1061,15 @@
 
 def checkDsymForUUIDIsNotOn():
 cmd = ["defaults", "read", "com.apple.DebugSymbols"]
-pipe = subprocess.Popen(
+process = subprocess.Popen(
 cmd,
 stdout=subprocess.PIPE,
 stderr=subprocess.STDOUT)
-cmd_output = pipe.stdout.read()
-if cmd_output and "DBGFileMappedPaths = " in cmd_output:
+cmd_output = process.stdout.read()
+output_str = cmd_output.decode("utf-8")
+if "DBGFileMappedPaths = " in output_str:
 print("%s =>" % ' '.join(cmd))
-print(cmd_output)
+print(output_str)
 print(
 "Disable automatic lookup and caching of dSYMs before running the test suite!")
 print("Exiting...")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D56531: [CMake] Replace use of llvm-config with LLVM and Clang CMake packages

2019-01-09 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: sgraenitz, labath, zturner, JDevlieghere, davide, 
aprantl, stella.stamenova.
Herald added a subscriber: mgorny.

I did this for two reasons:

- Using the CMake packages simplifies building LLDB Standalone. This is for two 
reasons: 1) We were doing a decent amount of work that is already done in the 
LLVMConfig.cmake that we want to import, 2) We had to do some manual work to 
call llvm-config, parse its output, and populate variables that the build 
system uses.
- As far as I understand, using llvm-config makes it difficult if not 
impossible to cross-compile LLDB standalone.


https://reviews.llvm.org/D56531

Files:
  cmake/modules/LLDBStandalone.cmake

Index: cmake/modules/LLDBStandalone.cmake
===
--- cmake/modules/LLDBStandalone.cmake
+++ cmake/modules/LLDBStandalone.cmake
@@ -5,73 +5,20 @@
 
   option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
 
-  # Rely on llvm-config.
-  set(CONFIG_OUTPUT)
-  find_program(LLVM_CONFIG "llvm-config")
-  if(LLVM_CONFIG)
-message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
-set(CONFIG_COMMAND ${LLVM_CONFIG}
-  "--assertion-mode"
-  "--bindir"
-  "--libdir"
-  "--includedir"
-  "--prefix"
-  "--src-root"
-  "--cmakedir")
-execute_process(
-  COMMAND ${CONFIG_COMMAND}
-  RESULT_VARIABLE HAD_ERROR
-  OUTPUT_VARIABLE CONFIG_OUTPUT
-)
-if(NOT HAD_ERROR)
-  string(REGEX REPLACE
-"[ \t]*[\r\n]+[ \t]*" ";"
-CONFIG_OUTPUT ${CONFIG_OUTPUT})
+  find_package(LLVM REQUIRED CONFIG
+HINTS "${LLDB_PATH_TO_LLVM_BUILD}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+  find_package(Clang REQUIRED CONFIG
+HINTS "${LLDB_PATH_TO_CLANG_BUILD}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
 
-else()
-  string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}")
-  message(STATUS "${CONFIG_COMMAND_STR}")
-  message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
-endif()
-  else()
-message(FATAL_ERROR "llvm-config not found -- ${LLVM_CONFIG}")
-  endif()
-
-  list(GET CONFIG_OUTPUT 0 ENABLE_ASSERTIONS)
-  list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
-  list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
-  list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
-  list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
-  list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
-  list(GET CONFIG_OUTPUT 6 LLVM_CMAKE_PATH)
+  # We set LLVM_MAIN_INCLUDE_DIR so that it gets included in TableGen flags.
+  set(LLVM_MAIN_INCLUDE_DIR "${LLVM_BUILD_MAIN_INCLUDE_DIR}" CACHE PATH "Path to LLVM's source include dir")
+  # We set LLVM_CMAKE_PATH so that GetSVN.cmake is found correctly when building SVNVersion.inc
+  set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules")
 
-  if(NOT MSVC_IDE)
-set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
-  CACHE BOOL "Enable assertions")
-# Assertions should follow llvm-config's.
-mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
-  endif()
-
-  set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
-  set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
-  set(LLVM_MAIN_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include")
-  set(LLVM_DIR ${LLVM_OBJ_ROOT}/cmake/modules/CMakeFiles CACHE PATH "Path to LLVM build tree CMake files")
-  set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
-  set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
   set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE PATH "Path to llvm-lit")
-
   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
 NO_DEFAULT_PATH)
 
-  set(LLVMCONFIG_FILE "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
-  if(EXISTS ${LLVMCONFIG_FILE})
-file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH}" LLVM_CMAKE_PATH)
-list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
-include(${LLVMCONFIG_FILE})
-  else()
-message(FATAL_ERROR "Not found: ${LLVMCONFIG_FILE}")
-  endif()
-
   # They are used as destination of target generators.
   set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
   set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
@@ -82,6 +29,9 @@
 set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
   endif()
 
+  # We append the directory in which LLVMConfig.cmake lives. We expect LLVM's
+  # CMake modules to be in that directory as well.
+  list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}")
   include(AddLLVM)
   include(TableGen)
   include(HandleLLVMOptions)
@@ -99,28 +49,14 @@
 message("-- Found PythonInterp: ${PYTHON_EXECUTABLE}")
   endif()
 
-  # Import CMake library targets from LLVM and Clang.
-  include("${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm/LLVMConfig.cmake")
-  # cmake/clang/ClangConfig.cmake is not created when LLVM and Clang are built together.
-  if

[Lldb-commits] [PATCH] D56531: [CMake] Replace use of llvm-config with LLVM and Clang CMake packages

2019-01-09 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

Please don't risk merging this before the branching.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56531/new/

https://reviews.llvm.org/D56531



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


[Lldb-commits] [PATCH] D56231: [lldb-server] Improve support on Windows

2019-01-09 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 180992.
asmith added a comment.

Added lock suggested in review


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56231/new/

https://reviews.llvm.org/D56231

Files:
  include/lldb/Host/File.h
  include/lldb/Host/FileSystem.h
  source/Host/common/File.cpp
  source/Host/common/FileSystem.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp

Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -11,7 +11,6 @@
 
 #include 
 
-
 #ifdef __APPLE__
 #include 
 #endif
@@ -215,8 +214,7 @@
   if (sub != LLDB_INVALID_CPUTYPE)
 response.Printf("cpusubtype:%u;", sub);
 
-  if (cpu == llvm::MachO::CPU_TYPE_ARM
-  || cpu == llvm::MachO::CPU_TYPE_ARM64) {
+  if (cpu == llvm::MachO::CPU_TYPE_ARM || cpu == llvm::MachO::CPU_TYPE_ARM64) {
 // Indicate the OS type.
 #if defined(TARGET_OS_TV) && TARGET_OS_TV == 1
 response.PutCString("ostype:tvos;");
@@ -511,18 +509,19 @@
   packet.GetHexByteStringTerminatedBy(path, ',');
   if (!path.empty()) {
 if (packet.GetChar() == ',') {
-  uint32_t flags =
-  File::ConvertOpenOptionsForPOSIXOpen(packet.GetHexMaxU32(false, 0));
+  uint32_t flags = packet.GetHexMaxU32(false, 0);
   if (packet.GetChar() == ',') {
 mode_t mode = packet.GetHexMaxU32(false, 0600);
-Status error;
 FileSpec path_spec(path);
 FileSystem::Instance().Resolve(path_spec);
-int fd = ::open(path_spec.GetCString(), flags, mode);
-const int save_errno = fd == -1 ? errno : 0;
+File file;
+// Do not close fd.
+Status error =
+FileSystem::Instance().Open(file, path_spec, flags, mode, false);
+const int save_errno = error.GetError();
 StreamString response;
 response.PutChar('F');
-response.Printf("%i", fd);
+response.Printf("%i", file.GetDescriptor());
 if (save_errno)
   response.Printf(",%i", save_errno);
 return SendPacketNoLock(response.GetString());
@@ -537,12 +536,13 @@
 StringExtractorGDBRemote &packet) {
   packet.SetFilePos(::strlen("vFile:close:"));
   int fd = packet.GetS32(-1);
-  Status error;
   int err = -1;
   int save_errno = 0;
   if (fd >= 0) {
-err = close(fd);
-save_errno = err == -1 ? errno : 0;
+File file(fd, true);
+Status error = file.Close();
+err = 0;
+save_errno = error.GetError();
   } else {
 save_errno = EINVAL;
   }
@@ -557,26 +557,23 @@
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerCommon::Handle_vFile_pRead(
 StringExtractorGDBRemote &packet) {
-#ifdef _WIN32
-  // Not implemented on Windows
-  return SendUnimplementedResponse(
-  "GDBRemoteCommunicationServerCommon::Handle_vFile_pRead() unimplemented");
-#else
   StreamGDBRemote response;
   packet.SetFilePos(::strlen("vFile:pread:"));
   int fd = packet.GetS32(-1);
   if (packet.GetChar() == ',') {
-uint64_t count = packet.GetU64(UINT64_MAX);
+size_t count = packet.GetU64(UINT64_MAX);
 if (packet.GetChar() == ',') {
-  uint64_t offset = packet.GetU64(UINT32_MAX);
+  off_t offset = packet.GetU64(UINT32_MAX);
   if (count == UINT64_MAX) {
 response.Printf("F-1:%i", EINVAL);
 return SendPacketNoLock(response.GetString());
   }
 
   std::string buffer(count, 0);
-  const ssize_t bytes_read = ::pread(fd, &buffer[0], buffer.size(), offset);
-  const int save_errno = bytes_read == -1 ? errno : 0;
+  File file(fd, false);
+  Status error = file.Read(static_cast(&buffer[0]), count, offset);
+  const ssize_t bytes_read = error.Success() ? count : -1;
+  const int save_errno = error.GetError();
   response.PutChar('F');
   response.Printf("%zi", bytes_read);
   if (save_errno)
@@ -589,17 +586,11 @@
 }
   }
   return SendErrorResponse(21);
-
-#endif
 }
 
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerCommon::Handle_vFile_pWrite(
 StringExtractorGDBRemote &packet) {
-#ifdef _WIN32
-  return SendUnimplementedResponse("GDBRemoteCommunicationServerCommon::Handle_"
-   "vFile_pWrite() unimplemented");
-#else
   packet.SetFilePos(::strlen("vFile:pwrite:"));
 
   StreamGDBRemote response;
@@ -611,9 +602,12 @@
 if (packet.GetChar() == ',') {
   std::string buffer;
   if (packet.GetEscapedBinaryData(buffer)) {
-const ssize_t bytes_written =
-::pwrite(fd, buffer.data(), buffer.size(), offset);
-const int save_errno = bytes_written == -1 ? errno : 0;
+File file(fd, false);
+size_t count = buffer.size();
+Status error =
+file.Write(static_cast(&buffer[0]), count, offset);
+const ssize