[Lldb-commits] [PATCH] D27380: [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions.

2016-12-05 Thread Pavel Labath via Phabricator via lldb-commits
labath added a subscriber: ted.
labath added a comment.

It looks reasonable to me, but I don't know the full context, so I'd wait until 
others can comment on this as well.




Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2590
+(arch.GetTriple().isOSBinFormatELF() ||
  arch.GetMachine() == llvm::Triple::hexagon)) {
   SymbolContextList temp_sc_list;

I think we can remove the hexagon part as well. Ted, I presume hexagon uses ELF 
files?


Repository:
  rL LLVM

https://reviews.llvm.org/D27380



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


[Lldb-commits] [lldb] r288661 - Clean up some use of __ANDROID_NDK__ in the cmake files

2016-12-05 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Dec  5 05:15:36 2016
New Revision: 288661

URL: http://llvm.org/viewvc/llvm-project?rev=288661&view=rev
Log:
Clean up some use of __ANDROID_NDK__ in the cmake files

Rationale:
scripts/Python/modules: android is excluded at a higher level, so no point in
  checking here
tools/lldb-mi: lldb-mi builds fine (with some cosmetic tweaks) on android, and
  there is no reason it shouldn't.
tools/lldb-server: LLDB_DISABLE_LIBEDIT/CURSES already take the platform into
  account, so there is no point in checking again.

I am reasonably confident this should not break the build on any platform, but
I'll keep an eye out on the bots.

Modified:
lldb/trunk/scripts/Python/modules/CMakeLists.txt
lldb/trunk/tools/CMakeLists.txt
lldb/trunk/tools/lldb-mi/CMakeLists.txt
lldb/trunk/tools/lldb-mi/MIUtilString.cpp
lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/scripts/Python/modules/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modules/CMakeLists.txt?rev=288661&r1=288660&r2=288661&view=diff
==
--- lldb/trunk/scripts/Python/modules/CMakeLists.txt (original)
+++ lldb/trunk/scripts/Python/modules/CMakeLists.txt Mon Dec  5 05:15:36 2016
@@ -6,6 +6,6 @@ if (CXX_SUPPORTS_NO_MACRO_REDEFINED)
 endif ()
 
 # build the Python readline suppression module only on Linux
-if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT __ANDROID_NDK__)
+if (CMAKE_SYSTEM_NAME MATCHES "Linux")
add_subdirectory(readline)
 endif()

Modified: lldb/trunk/tools/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/CMakeLists.txt?rev=288661&r1=288660&r2=288661&view=diff
==
--- lldb/trunk/tools/CMakeLists.txt (original)
+++ lldb/trunk/tools/CMakeLists.txt Mon Dec  5 05:15:36 2016
@@ -2,11 +2,9 @@ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   add_subdirectory(darwin-debug)
   add_subdirectory(debugserver)
 endif()
-  add_subdirectory(argdumper)
-  add_subdirectory(driver)
-if (NOT __ANDROID_NDK__)
-  add_subdirectory(lldb-mi)
-endif()
+add_subdirectory(argdumper)
+add_subdirectory(driver)
+add_subdirectory(lldb-mi)
 if (LLDB_CAN_USE_LLDB_SERVER)
   add_subdirectory(lldb-server)
 endif()

Modified: lldb/trunk/tools/lldb-mi/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/CMakeLists.txt?rev=288661&r1=288660&r2=288661&view=diff
==
--- lldb/trunk/tools/lldb-mi/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-mi/CMakeLists.txt Mon Dec  5 05:15:36 2016
@@ -87,7 +87,7 @@ set(LLVM_LINK_COMPONENTS Support)
 add_lldb_executable(lldb-mi ${LLDB_MI_SOURCES})
 
 target_link_libraries(lldb-mi liblldb)
-if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
+if (HAVE_LIBPTHREAD)
   target_link_libraries(lldb-mi pthread)
 endif ()
 

Modified: lldb/trunk/tools/lldb-mi/MIUtilString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilString.cpp?rev=288661&r1=288660&r2=288661&view=diff
==
--- lldb/trunk/tools/lldb-mi/MIUtilString.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilString.cpp Mon Dec  5 05:15:36 2016
@@ -8,6 +8,7 @@
 
//===--===//
 
 // Third party headers
+#include 
 #include  // for PRIx8
 #include// for ULONG_MAX
 #include  // std::unique_ptr

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=288661&r1=288660&r2=288661&view=diff
==
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Mon Dec  5 05:15:36 2016
@@ -108,15 +108,13 @@ set( CLANG_USED_LIBS
   )
 
 set(LLDB_SYSTEM_LIBS)
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" AND NOT __ANDROID_NDK__)
-  if (NOT LLDB_DISABLE_LIBEDIT)
-list(APPEND LLDB_SYSTEM_LIBS edit)
-  endif()
-  if (NOT LLDB_DISABLE_CURSES)
-list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
-if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
-  list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
-endif()
+if (NOT LLDB_DISABLE_LIBEDIT)
+  list(APPEND LLDB_SYSTEM_LIBS edit)
+endif()
+if (NOT LLDB_DISABLE_CURSES)
+  list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
+  if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
+list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
   endif()
 endif()
 


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


[Lldb-commits] [lldb] r288674 - Remove superfluous android include

2016-12-05 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Dec  5 08:57:23 2016
New Revision: 288674

URL: http://llvm.org/viewvc/llvm-project?rev=288674&view=rev
Log:
Remove superfluous android include

This file is not in the include path when building with a non-standalone
toolchain. In does not seem to be necessary anyway.

Modified:
lldb/trunk/source/Host/common/Socket.cpp

Modified: lldb/trunk/source/Host/common/Socket.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Socket.cpp?rev=288674&r1=288673&r2=288674&view=diff
==
--- lldb/trunk/source/Host/common/Socket.cpp (original)
+++ lldb/trunk/source/Host/common/Socket.cpp Mon Dec  5 08:57:23 2016
@@ -36,7 +36,6 @@
 #ifdef __ANDROID__
 #include 
 #include 
-#include 
 #include 
 #include 
 #if defined(ANDROID_ARM_BUILD_STATIC) || defined(ANDROID_MIPS_BUILD_STATIC)


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


[Lldb-commits] [lldb] r288673 - Remove one more if(__ANDROID_NDK__) I missed

2016-12-05 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Dec  5 08:57:19 2016
New Revision: 288673

URL: http://llvm.org/viewvc/llvm-project?rev=288673&view=rev
Log:
Remove one more if(__ANDROID_NDK__) I missed

Modified:
lldb/trunk/cmake/LLDBDependencies.cmake

Modified: lldb/trunk/cmake/LLDBDependencies.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=288673&r1=288672&r2=288673&view=diff
==
--- lldb/trunk/cmake/LLDBDependencies.cmake (original)
+++ lldb/trunk/cmake/LLDBDependencies.cmake Mon Dec  5 08:57:19 2016
@@ -147,15 +147,13 @@ set( CLANG_USED_LIBS
   )
 
 set(LLDB_SYSTEM_LIBS)
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" AND NOT __ANDROID_NDK__)
-  if (NOT LLDB_DISABLE_LIBEDIT)
-list(APPEND LLDB_SYSTEM_LIBS edit)
-  endif()
-  if (NOT LLDB_DISABLE_CURSES)
-list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
-if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
-  list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
-endif()
+if (NOT LLDB_DISABLE_LIBEDIT)
+  list(APPEND LLDB_SYSTEM_LIBS edit)
+endif()
+if (NOT LLDB_DISABLE_CURSES)
+  list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
+  if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
+list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
   endif()
 endif()
 


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


[Lldb-commits] [PATCH] D27380: [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions.

2016-12-05 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Just remove hexagon from the if and this is good to go.




Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2590
+(arch.GetTriple().isOSBinFormatELF() ||
  arch.GetMachine() == llvm::Triple::hexagon)) {
   SymbolContextList temp_sc_list;

labath wrote:
> I think we can remove the hexagon part as well. Ted, I presume hexagon uses 
> ELF files?
I believe Hexagon uses ELF so it would be ok to remove the Hexagon from the if.


Repository:
  rL LLVM

https://reviews.llvm.org/D27380



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


[Lldb-commits] [PATCH] D27394: Fix expression evaluation inside lambda functions for gcc

2016-12-05 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a reviewer: spyffe.
clayborg added a comment.

I am going to include Sean Callanan in on this one to see what he thinks. We 
might just want to fix the AST importer so that it can handle types in a 
BlockDecl.


https://reviews.llvm.org/D27394



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


[Lldb-commits] [PATCH] D27380: [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions.

2016-12-05 Thread Alexander Shaposhnikov via Phabricator via lldb-commits
alexshap updated this revision to Diff 80278.
alexshap added a comment.

Address comments


Repository:
  rL LLVM

https://reviews.llvm.org/D27380

Files:
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp


Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2586,8 +2586,7 @@
   if (sc_list.GetSize() == original_size) {
 ArchSpec arch;
 if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) &&
-(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() ||
- arch.GetMachine() == llvm::Triple::hexagon)) {
+arch.GetTriple().isOSBinFormatELF()) {
   SymbolContextList temp_sc_list;
   FindFunctions(name, m_function_basename_index, include_inlines,
 temp_sc_list);
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1513,8 +1513,14 @@
 const uint32_t sub_type = subTypeFromElfHeader(header);
 arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type,
   header.e_ident[EI_OSABI]);
-//
-// Validate if it is ok to remove GetOsFromOSABI
+
+// Validate if it is ok to remove GetOsFromOSABI.
+// Note, that now the OS is determined based on EI_OSABI flag and
+// the info extracted from ELF notes (see RefineModuleDetailsFromNote).
+// However in some cases that still might be not enough: for example
+// a shared library might not have any notes at all
+// and have EI_OSABI flag set to System V,
+// as result the OS will be set to UnknownOS.
 GetOsFromOSABI(header.e_ident[EI_OSABI], ostype);
 spec_ostype = arch_spec.GetTriple().getOS();
 assert(spec_ostype == ostype);


Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2586,8 +2586,7 @@
   if (sc_list.GetSize() == original_size) {
 ArchSpec arch;
 if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) &&
-(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() ||
- arch.GetMachine() == llvm::Triple::hexagon)) {
+arch.GetTriple().isOSBinFormatELF()) {
   SymbolContextList temp_sc_list;
   FindFunctions(name, m_function_basename_index, include_inlines,
 temp_sc_list);
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1513,8 +1513,14 @@
 const uint32_t sub_type = subTypeFromElfHeader(header);
 arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type,
   header.e_ident[EI_OSABI]);
-//
-// Validate if it is ok to remove GetOsFromOSABI
+
+// Validate if it is ok to remove GetOsFromOSABI.
+// Note, that now the OS is determined based on EI_OSABI flag and
+// the info extracted from ELF notes (see RefineModuleDetailsFromNote).
+// However in some cases that still might be not enough: for example
+// a shared library might not have any notes at all
+// and have EI_OSABI flag set to System V,
+// as result the OS will be set to UnknownOS.
 GetOsFromOSABI(header.e_ident[EI_OSABI], ostype);
 spec_ostype = arch_spec.GetTriple().getOS();
 assert(spec_ostype == ostype);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D27380: [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions.

2016-12-05 Thread Ted Woodward via Phabricator via lldb-commits
ted added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:2590
+(arch.GetTriple().isOSBinFormatELF() ||
  arch.GetMachine() == llvm::Triple::hexagon)) {
   SymbolContextList temp_sc_list;

clayborg wrote:
> labath wrote:
> > I think we can remove the hexagon part as well. Ted, I presume hexagon uses 
> > ELF files?
> I believe Hexagon uses ELF so it would be ok to remove the Hexagon from the 
> if.
Yes, Hexagon uses ELF, so this change should be fine.


Repository:
  rL LLVM

https://reviews.llvm.org/D27380



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


[Lldb-commits] [PATCH] D27394: Fix expression evaluation inside lambda functions for gcc

2016-12-05 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

This is legal C++:

  #include 
  
  int main(int argc, char **argv)
  {
if (argc > 1)
  {
struct foo
{
  long int value;
};
foo my_foo = {10};
printf ("Foo: %ld.\n", my_foo.value);
  
  }
else
  {
struct foo
{
  short int value;
};
foo my_foo = {10};
printf ("Foo: %d.\n", my_foo.value);
  }
return 0;
  }

Isn't this patch going to cause problems with this sort of code?


https://reviews.llvm.org/D27394



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


[Lldb-commits] [PATCH] D27394: Fix expression evaluation inside lambda functions for gcc

2016-12-05 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

At present clang produces correct debug info, and lldb correctly debugs this 
code.


https://reviews.llvm.org/D27394



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


[Lldb-commits] [PATCH] D27394: Fix expression evaluation inside lambda functions for gcc

2016-12-05 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

As Jim said, we can't move stuff around because types will conflict. Marking as 
request changes.


https://reviews.llvm.org/D27394



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


[Lldb-commits] [PATCH] D27394: Fix expression evaluation inside lambda functions for gcc

2016-12-05 Thread Sean Callanan via Phabricator via lldb-commits
spyffe added a subscriber: aprantl.
spyffe added a comment.

How does Clang-emitted debug information express the region in which a type is 
declared if it has been moved to the containing Decl?  I'm thinking 
specifically of this case:

  int foo() {
return
  []() { struct A { int a; } a1; a1.a = 3; return a1.a; }() +
  []() { struct A { int b; } a2; a2.b = 4; return a2.b; }();
  }

As another point, it's not clear to me that the test is validating this.  There 
are no type declarations in the lambda in the test.

I'm not convinced this is all working fine at the moment, though:

  (lldb) br s -l 5
  (lldb) br s -l 6
  Breakpoint 2: 2 locations.
  (lldb) r
 3  int foo() {
 4return
  -> 5[]() { struct A { int a; } a1; a1.a = 3; 
return a1.a; }() +
 6[]() { struct A { int b; } a2; a2.b = 
4; return a2.b; }();
 7  }
 8
  (lldb) fr var
  (lldb) c
  (lldb) fr var
  (const (anonymous class) *) this = 0x7fff5fbff678
  (A) a1 = (a = 1606416064)
  (lldb) c
  (lldb) fr var
  (lldb) c
  (lldb) fr var
  (const (anonymous class) *) this = 0x7fff5fbff670
  (A) a2 = (a = 3)

I suggest we bring @aprantl in to this discussion.


https://reviews.llvm.org/D27394



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


[Lldb-commits] [lldb] r288687 - [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions

2016-12-05 Thread Alexander Shaposhnikov via lldb-commits
Author: alexshap
Date: Mon Dec  5 12:42:21 2016
New Revision: 288687

URL: http://llvm.org/viewvc/llvm-project?rev=288687&view=rev
Log:
[lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions

This diff
1. Adds a comment to ObjectFileELF.cpp about the current
approach to determining the OS.
2. Replaces the check in SymbolFileDWARF.cpp with a more robust one.

Test plan:
Built (on Linux) a test binary linked to a c++ shared library
which contains just an implementation of a function TestFunction,
the library (the binary itself) doesn't contain ELF notes 
and EI_OSABI is set to System V.
Checked in lldb that now "p TestFunction()" works fine 
(and doesn't work without this patch).

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

Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=288687&r1=288686&r2=288687&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Mon Dec  5 
12:42:21 2016
@@ -1513,8 +1513,14 @@ size_t ObjectFileELF::GetSectionHeaderIn
 const uint32_t sub_type = subTypeFromElfHeader(header);
 arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type,
   header.e_ident[EI_OSABI]);
-//
-// Validate if it is ok to remove GetOsFromOSABI
+
+// Validate if it is ok to remove GetOsFromOSABI.
+// Note, that now the OS is determined based on EI_OSABI flag and
+// the info extracted from ELF notes (see RefineModuleDetailsFromNote).
+// However in some cases that still might be not enough: for example
+// a shared library might not have any notes at all
+// and have EI_OSABI flag set to System V,
+// as result the OS will be set to UnknownOS.
 GetOsFromOSABI(header.e_ident[EI_OSABI], ostype);
 spec_ostype = arch_spec.GetTriple().getOS();
 assert(spec_ostype == ostype);

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=288687&r1=288686&r2=288687&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Dec  5 
12:42:21 2016
@@ -2586,8 +2586,7 @@ SymbolFileDWARF::FindFunctions(const Con
   if (sc_list.GetSize() == original_size) {
 ArchSpec arch;
 if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) &&
-(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() ||
- arch.GetMachine() == llvm::Triple::hexagon)) {
+arch.GetTriple().isOSBinFormatELF()) {
   SymbolContextList temp_sc_list;
   FindFunctions(name, m_function_basename_index, include_inlines,
 temp_sc_list);


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


[Lldb-commits] [PATCH] D27380: [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions.

2016-12-05 Thread Alexander Shaposhnikov via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL288687: [lldb] Update the check for Linux or FreeBSD in 
SymbolFileDWARF::FindFunctions (authored by alexshap).

Changed prior to commit:
  https://reviews.llvm.org/D27380?vs=80278&id=80295#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27380

Files:
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.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
@@ -1513,8 +1513,14 @@
 const uint32_t sub_type = subTypeFromElfHeader(header);
 arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type,
   header.e_ident[EI_OSABI]);
-//
-// Validate if it is ok to remove GetOsFromOSABI
+
+// Validate if it is ok to remove GetOsFromOSABI.
+// Note, that now the OS is determined based on EI_OSABI flag and
+// the info extracted from ELF notes (see RefineModuleDetailsFromNote).
+// However in some cases that still might be not enough: for example
+// a shared library might not have any notes at all
+// and have EI_OSABI flag set to System V,
+// as result the OS will be set to UnknownOS.
 GetOsFromOSABI(header.e_ident[EI_OSABI], ostype);
 spec_ostype = arch_spec.GetTriple().getOS();
 assert(spec_ostype == ostype);
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2586,8 +2586,7 @@
   if (sc_list.GetSize() == original_size) {
 ArchSpec arch;
 if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) &&
-(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() ||
- arch.GetMachine() == llvm::Triple::hexagon)) {
+arch.GetTriple().isOSBinFormatELF()) {
   SymbolContextList temp_sc_list;
   FindFunctions(name, m_function_basename_index, include_inlines,
 temp_sc_list);


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
@@ -1513,8 +1513,14 @@
 const uint32_t sub_type = subTypeFromElfHeader(header);
 arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type,
   header.e_ident[EI_OSABI]);
-//
-// Validate if it is ok to remove GetOsFromOSABI
+
+// Validate if it is ok to remove GetOsFromOSABI.
+// Note, that now the OS is determined based on EI_OSABI flag and
+// the info extracted from ELF notes (see RefineModuleDetailsFromNote).
+// However in some cases that still might be not enough: for example
+// a shared library might not have any notes at all
+// and have EI_OSABI flag set to System V,
+// as result the OS will be set to UnknownOS.
 GetOsFromOSABI(header.e_ident[EI_OSABI], ostype);
 spec_ostype = arch_spec.GetTriple().getOS();
 assert(spec_ostype == ostype);
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2586,8 +2586,7 @@
   if (sc_list.GetSize() == original_size) {
 ArchSpec arch;
 if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) &&
-(arch.GetTriple().isOSFreeBSD() || arch.GetTriple().isOSLinux() ||
- arch.GetMachine() == llvm::Triple::hexagon)) {
+arch.GetTriple().isOSBinFormatELF()) {
   SymbolContextList temp_sc_list;
   FindFunctions(name, m_function_basename_index, include_inlines,
 temp_sc_list);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r288535 - Support more report types in AddressSanitizerRuntime.cpp, re-word existing ones.

2016-12-05 Thread Kuba Mracek via lldb-commits
Author: kuba.brecka
Date: Fri Dec  2 15:00:32 2016
New Revision: 288535

URL: http://llvm.org/viewvc/llvm-project?rev=288535&view=rev
Log:
Support more report types in AddressSanitizerRuntime.cpp, re-word existing ones.

In r288065, we added more report types into ASan that will be reported via the 
debugging API. This patch in LLDB provides human-friendly bug descriptions. 
This also improves wording on existing bug descriptions.

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


Modified:

lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp

Modified: 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp?rev=288535&r1=288534&r2=288535&view=diff
==
--- 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
 Fri Dec  2 15:00:32 2016
@@ -26,6 +26,8 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
+#include "llvm/ADT/StringSwitch.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -194,32 +196,45 @@ AddressSanitizerRuntime::FormatDescripti
 ->GetValueForKey("description")
 ->GetAsString()
 ->GetValue();
-  if (description == "heap-use-after-free") {
-return "Use of deallocated memory detected";
-  } else if (description == "heap-buffer-overflow") {
-return "Heap buffer overflow detected";
-  } else if (description == "stack-buffer-underflow") {
-return "Stack buffer underflow detected";
-  } else if (description == "initialization-order-fiasco") {
-return "Initialization order problem detected";
-  } else if (description == "stack-buffer-overflow") {
-return "Stack buffer overflow detected";
-  } else if (description == "stack-use-after-return") {
-return "Use of returned stack memory detected";
-  } else if (description == "use-after-poison") {
-return "Use of poisoned memory detected";
-  } else if (description == "container-overflow") {
-return "Container overflow detected";
-  } else if (description == "stack-use-after-scope") {
-return "Use of out-of-scope stack memory detected";
-  } else if (description == "global-buffer-overflow") {
-return "Global buffer overflow detected";
-  } else if (description == "unknown-crash") {
-return "Invalid memory access detected";
-  }
-
-  // for unknown report codes just show the code
-  return description;
+  return llvm::StringSwitch(description)
+  .Case("heap-use-after-free", "Use of deallocated memory")
+  .Case("heap-buffer-overflow", "Heap buffer overflow")
+  .Case("stack-buffer-underflow", "Stack buffer underflow")
+  .Case("initialization-order-fiasco", "Initialization order problem")
+  .Case("stack-buffer-overflow", "Stack buffer overflow")
+  .Case("stack-use-after-return", "Use of stack memory after return")
+  .Case("use-after-poison", "Use of poisoned memory")
+  .Case("container-overflow", "Container overflow")
+  .Case("stack-use-after-scope", "Use of out-of-scope stack memory")
+  .Case("global-buffer-overflow", "Global buffer overflow")
+  .Case("unknown-crash", "Invalid memory access")
+  .Case("stack-overflow", "Stack space exhausted")
+  .Case("null-deref", "Dereference of null pointer")
+  .Case("wild-jump", "Jump to non-executable address")
+  .Case("wild-addr-write", "Write through wild pointer")
+  .Case("wild-addr-read", "Read from wild pointer")
+  .Case("wild-addr", "Access through wild pointer")
+  .Case("signal", "Deadly signal")
+  .Case("double-free", "Deallocation of freed memory")
+  .Case("new-delete-type-mismatch",
+"Deallocation size different from allocation size")
+  .Case("bad-free", "Deallocation of non-allocated memory")
+  .Case("alloc-dealloc-mismatch",
+"Mismatch between allocation and deallocation APIs")
+  .Case("bad-malloc_usable_size", "Invalid argument to malloc_usable_size")
+  .Case("bad-__sanitizer_get_allocated_size",
+"Invalid argument to __sanitizer_get_allocated_size")
+  .Case("param-overlap",
+"Call to function disallowing overlapping memory ranges")
+  .Case("negative-size-param", "Negative size used when accessing memory")
+  .Case("bad-__sanitizer_annotate_contiguous_container",
+"Invalid argument to __sanitizer_annotate_contiguous_container")
+  .Case("odr-violation", "Symbol defined in multiple translation units")
+  .Case(
+  "invalid-pointer-pair",
+  "Comparison or arithmetic on pointers fro

[Lldb-commits] [PATCH] D27081: Fix a comparison of integers of different signs warning

2016-12-05 Thread Taras Tsugrii via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL287848: Fix a comparison of integers of different signs 
warning. (authored by ttsugrii).

Changed prior to commit:
  https://reviews.llvm.org/D27081?vs=79173&id=79180#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27081

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


Index: 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
===
--- 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -400,7 +400,7 @@
   const uint32_t magicks[] = { llvm::MachO::MH_MAGIC_64, 
llvm::MachO::MH_MAGIC, llvm::MachO::MH_CIGAM, llvm::MachO::MH_CIGAM_64};
 
   bool found_matching_pattern = false;
-  for (int i = 0; i < llvm::array_lengthof (magicks); i++)
+  for (size_t i = 0; i < llvm::array_lengthof (magicks); i++)
 if (::memcmp (magicbuf, &magicks[i], sizeof (magicbuf)) == 0)
 found_matching_pattern = true;
 


Index: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
===
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -400,7 +400,7 @@
   const uint32_t magicks[] = { llvm::MachO::MH_MAGIC_64, llvm::MachO::MH_MAGIC, llvm::MachO::MH_CIGAM, llvm::MachO::MH_CIGAM_64};
 
   bool found_matching_pattern = false;
-  for (int i = 0; i < llvm::array_lengthof (magicks); i++)
+  for (size_t i = 0; i < llvm::array_lengthof (magicks); i++)
 if (::memcmp (magicbuf, &magicks[i], sizeof (magicbuf)) == 0)
 found_matching_pattern = true;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D27017: Support more report types in AddressSanitizerRuntime.cpp

2016-12-05 Thread Anna Zaks via lldb-commits
I like the version without "function" in it; you might be returning from a
method.

On Fri, Dec 2, 2016 at 12:15 PM, Filipe Cabecinhas <
filcab+llvm.phabrica...@gmail.com> wrote:

> .Case("stack-use-after-return", "Use of returned stack memory")
>
>
> Maybe "Use of stack memory after (function) return"? (i couldn't decide
> whether to include "function". Either delete it or delete the parens.
> This is a very minor nit, so I'm ok with keeping the current wording if
> you prefer that.
>
>
> On Fri, 2 Dec 2016 at 20:04, Kuba (Brecka) Mracek via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
>> kubabrecka added a comment.
>>
>>
>>
>> In https://reviews.llvm.org/D27017#611894, @filcab wrote:
>>
>>
>>
>> > LGTM
>>
>> >
>>
>> > (I commented on a minor nit. It might just be me, so feel free to keep
>> the current wording if you feel it's preferred)
>>
>>
>>
>>
>>
>> I'm not seeing this comment.  Can you post it again?
>>
>>
>>
>>
>>
>> https://reviews.llvm.org/D27017
>>
>>
>>
>>
>>
>>
>>
>>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

2016-12-05 Thread bryant via lldb-commits
bryant added inline comments.



Comment at: CMakeLists.txt:46
+COMMAND
+   ${PYTHON_EXECUTABLE} 
${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
+   --srcRoot=${LLDB_SOURCE_DIR}

You can reduce diff noise by leaving formatting changes for a separate patch.



Comment at: scripts/CMakeLists.txt:38
+  COMMAND
+${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/prepare_bindings.py
+  ${framework_arg}

Move this back up.



Comment at: scripts/Python/prepare_binding_Python.py:222
+)
+logging.info("running swig with: %r", command)
 

You can reduce diff noise by limiting your changes to removing the %s. So,

```python
# Build the SWIG args list
options.swig_executable,
"-c++",
"-shadow",
"-python",
"-threads",
"-I" + os.path.normcase(
os.path.join(options.src_root, "include")),
"-I" + os.path.normcase("./."),
"-D__STDC_LIMIT_MACROS",
"-D__STDC_CONSTANT_MACROS"]
if options.target_platform == "Darwin":
command.append("-D__APPLE__")
if options.generate_dependency_file:
command.extend(["-MMD", " -MF", temp_dep_file_path])
command.extend([
"-outdir", config_build_dir,
"-o", settings.output_file,
settings.input_file
])
logging.info("running swig with: %s", command)
```



Comment at: scripts/Python/prepare_binding_Python.py:229
 stderr=subprocess.PIPE,
-shell=True)
+)
 # Wait for SWIG process to terminate

ldrumm wrote:
> granata.enrico wrote:
> > This worries me a little bit.. Are we sure we are not in any way relying on 
> > the shell in executing the command line?
> The features of the shell are not used in this expression at all, and the 
> environment is identical to the previous invocation.
`shell=False` for both python 2 and 3: 
https://docs.python.org/2/library/subprocess.html#subprocess.Popen ; 
https://docs.python.org/3/library/subprocess.html#subprocess.Popen , unless 
I've missed your meaning.


https://reviews.llvm.org/D26757



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


[Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

2016-12-05 Thread bryant via lldb-commits
bryant added inline comments.



Comment at: scripts/Python/prepare_binding_Python.py:222
+)
+logging.info("running swig with: %r", command)
 

ldrumm wrote:
> bryant wrote:
> > You can reduce diff noise by limiting your changes to removing the %s. So,
> > 
> > ```python
> > # Build the SWIG args list
> > options.swig_executable,
> > "-c++",
> > "-shadow",
> > "-python",
> > "-threads",
> > "-I" + os.path.normcase(
> > os.path.join(options.src_root, "include")),
> > "-I" + os.path.normcase("./."),
> > "-D__STDC_LIMIT_MACROS",
> > "-D__STDC_CONSTANT_MACROS"]
> > if options.target_platform == "Darwin":
> > command.append("-D__APPLE__")
> > if options.generate_dependency_file:
> > command.extend(["-MMD", " -MF", temp_dep_file_path])
> > command.extend([
> > "-outdir", config_build_dir,
> > "-o", settings.output_file,
> > settings.input_file
> > ])
> > logging.info("running swig with: %s", command)
> > ```
> But `logging.info` is not a pretty printer - if the command fails for some 
> reason we need to see why. `repr` allows this, and the diff noise is again 
> minimal because that line is changing anyway and command is now a list, not a 
> string
Yes, that was a typo. Keep %r too.


https://reviews.llvm.org/D26757



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


[Lldb-commits] [PATCH] D26757: Fix broken escaping of commands in the build

2016-12-05 Thread bryant via lldb-commits
bryant added inline comments.



Comment at: CMakeLists.txt:53
+   --lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
+   ${FINISH_EXTRA_ARGS}
+VERBATIM

The indentation here could match the above.


https://reviews.llvm.org/D26757



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


[Lldb-commits] [lldb] r288691 - [CMake] Don't add gtest if it is already there

2016-12-05 Thread Chris Bieneman via lldb-commits
Author: cbieneman
Date: Mon Dec  5 13:40:34 2016
New Revision: 288691

URL: http://llvm.org/viewvc/llvm-project?rev=288691&view=rev
Log:
[CMake] Don't add gtest if it is already there

LLVM build trees export the gtest library through a special export set. If 
you're building against a build tree you shouldn't need to re-add gtest, but if 
you're building against an installed LLVM you do.

Modified:
lldb/trunk/unittests/CMakeLists.txt

Modified: lldb/trunk/unittests/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/CMakeLists.txt?rev=288691&r1=288690&r2=288691&view=diff
==
--- lldb/trunk/unittests/CMakeLists.txt (original)
+++ lldb/trunk/unittests/CMakeLists.txt Mon Dec  5 13:40:34 2016
@@ -15,7 +15,7 @@ include(${LLDB_PROJECT_ROOT}/cmake/LLDBD
 if (LLDB_BUILT_STANDALONE)
   # Build the gtest library needed for unittests, if we have LLVM sources
   # handy.
-  if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest)
+  if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET gtest)
 add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
   endif()
 endif()


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