[Lldb-commits] [PATCH] D11935: Fetch SDK version from PlatformAndroid

2015-08-11 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added a reviewer: ovyalov.
tberghammer added a subscriber: lldb-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

Fetch SDK version from PlatformAndroid

The SDK version implies the features supported by a given android
device. This version number will be used in future changes to execute
the right command on the device.


http://reviews.llvm.org/D11935

Files:
  source/Plugins/Platform/Android/PlatformAndroid.cpp
  source/Plugins/Platform/Android/PlatformAndroid.h

Index: source/Plugins/Platform/Android/PlatformAndroid.h
===
--- source/Plugins/Platform/Android/PlatformAndroid.h
+++ source/Plugins/Platform/Android/PlatformAndroid.h
@@ -73,6 +73,12 @@
  const FileSpec& destination,
  uint32_t uid = UINT32_MAX,
  uint32_t gid = UINT32_MAX) override;
+
+uint32_t
+GetSdkVersion();
+
+Error
+DisconnectRemote () override;
 
  protected:
 const char *
@@ -86,6 +92,8 @@
 
 private:
 std::string m_device_id;
+uint32_t m_sdk_version;
+
 DISALLOW_COPY_AND_ASSIGN (PlatformAndroid);
 };
 
Index: source/Plugins/Platform/Android/PlatformAndroid.cpp
===
--- source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -133,7 +133,8 @@
 }
 
 PlatformAndroid::PlatformAndroid (bool is_host) :
-PlatformLinux(is_host)
+PlatformLinux(is_host),
+m_sdk_version(0)
 {
 }
 
@@ -257,3 +258,35 @@
 
 return GetFile (src_file_spec, dst_file_spec);
 }
+
+Error
+PlatformAndroid::DisconnectRemote()
+{
+Error error = PlatformLinux::DisconnectRemote();
+if (error.Success())
+{
+m_device_id.clear();
+m_sdk_version = 0;
+}
+return error;
+}
+
+uint32_t
+PlatformAndroid::GetSdkVersion()
+{
+if (!IsConnected())
+return 0;
+
+if (m_sdk_version != 0)
+return m_sdk_version;
+
+std::string version_string;
+RunShellCommand("getprop ro.build.version.sdk",
+GetWorkingDirectory(),
+nullptr,
+nullptr,
+&version_string,
+1);
+m_sdk_version = ::atoi(version_string.c_str());
+return m_sdk_version;
+}


Index: source/Plugins/Platform/Android/PlatformAndroid.h
===
--- source/Plugins/Platform/Android/PlatformAndroid.h
+++ source/Plugins/Platform/Android/PlatformAndroid.h
@@ -73,6 +73,12 @@
  const FileSpec& destination,
  uint32_t uid = UINT32_MAX,
  uint32_t gid = UINT32_MAX) override;
+
+uint32_t
+GetSdkVersion();
+
+Error
+DisconnectRemote () override;
 
  protected:
 const char *
@@ -86,6 +92,8 @@
 
 private:
 std::string m_device_id;
+uint32_t m_sdk_version;
+
 DISALLOW_COPY_AND_ASSIGN (PlatformAndroid);
 };
 
Index: source/Plugins/Platform/Android/PlatformAndroid.cpp
===
--- source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -133,7 +133,8 @@
 }
 
 PlatformAndroid::PlatformAndroid (bool is_host) :
-PlatformLinux(is_host)
+PlatformLinux(is_host),
+m_sdk_version(0)
 {
 }
 
@@ -257,3 +258,35 @@
 
 return GetFile (src_file_spec, dst_file_spec);
 }
+
+Error
+PlatformAndroid::DisconnectRemote()
+{
+Error error = PlatformLinux::DisconnectRemote();
+if (error.Success())
+{
+m_device_id.clear();
+m_sdk_version = 0;
+}
+return error;
+}
+
+uint32_t
+PlatformAndroid::GetSdkVersion()
+{
+if (!IsConnected())
+return 0;
+
+if (m_sdk_version != 0)
+return m_sdk_version;
+
+std::string version_string;
+RunShellCommand("getprop ro.build.version.sdk",
+GetWorkingDirectory(),
+nullptr,
+nullptr,
+&version_string,
+1);
+m_sdk_version = ::atoi(version_string.c_str());
+return m_sdk_version;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D11936: Download symbol file for .oat files on android

2015-08-11 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added a reviewer: ovyalov.
tberghammer added a subscriber: lldb-commits.
Herald added subscribers: srhines, danalbert, tberghammer.

Download symbol file for .oat files on android

On android .oat files (compiled java code) don't have symbol
information but on SDK 23+ it can be generated by the oatdump tool
(based on the dex information).

This CL adds logic to download this information and store it in the
module cache.

http://reviews.llvm.org/D11936

Files:
  include/lldb/Target/Platform.h
  source/Plugins/Platform/Android/PlatformAndroid.cpp
  source/Plugins/Platform/Android/PlatformAndroid.h
  source/Target/Platform.cpp
  source/Utility/ModuleCache.cpp
  source/Utility/ModuleCache.h

Index: source/Utility/ModuleCache.h
===
--- source/Utility/ModuleCache.h
+++ source/Utility/ModuleCache.h
@@ -46,22 +46,25 @@
 class ModuleCache
 {
 public:
-using Downloader = std::function;
+using ModuleDownloader = std::function;
+using SymfileDownloader = std::function;
 
 Error
 GetAndPut(const FileSpec &root_dir_spec,
   const char *hostname,
   const ModuleSpec &module_spec,
-  const Downloader &downloader,
+  const ModuleDownloader &module_downloader,
+  const SymfileDownloader &symfile_downloader,
   lldb::ModuleSP &cached_module_sp,
   bool *did_create_ptr);
 
 private:
 Error
 Put (const FileSpec &root_dir_spec,
  const char *hostname,
  const ModuleSpec &module_spec,
- const FileSpec &tmp_file);
+ const FileSpec &tmp_file,
+ const FileSpec &target_file);
 
 Error
 Get (const FileSpec &root_dir_spec,
Index: source/Utility/ModuleCache.cpp
===
--- source/Utility/ModuleCache.cpp
+++ source/Utility/ModuleCache.cpp
@@ -29,6 +29,7 @@
 const char* kModulesSubdir = ".cache";
 const char* kLockFileName = ".lock";
 const char* kTempFileName = ".temp";
+const char* kTempSymFileName = ".symtemp";
 
 FileSpec
 JoinPath (const FileSpec &path1, const char* path2)
@@ -80,18 +81,19 @@
 ModuleCache::Put (const FileSpec &root_dir_spec,
   const char *hostname,
   const ModuleSpec &module_spec,
-  const FileSpec &tmp_file)
+  const FileSpec &tmp_file,
+  const FileSpec &target_file)
 {
 const auto module_spec_dir = GetModuleDirectory (root_dir_spec, module_spec.GetUUID ());
-const auto module_file_path = JoinPath (module_spec_dir, module_spec.GetFileSpec ().GetFilename ().AsCString ());
+const auto module_file_path = JoinPath (module_spec_dir, target_file.GetFilename ().AsCString ());
 
 const auto tmp_file_path = tmp_file.GetPath ();
 const auto err_code = llvm::sys::fs::rename (tmp_file_path.c_str (), module_file_path.GetPath ().c_str ());
 if (err_code)
 return Error ("Failed to rename file %s to %s: %s",
   tmp_file_path.c_str (), module_file_path.GetPath ().c_str (), err_code.message ().c_str ());
 
-const auto error = CreateHostSysRootModuleLink(root_dir_spec, hostname, module_spec.GetFileSpec(), module_file_path);
+const auto error = CreateHostSysRootModuleLink(root_dir_spec, hostname, target_file, module_file_path);
 if (error.Fail ())
 return Error ("Failed to create link to %s: %s", module_file_path.GetPath ().c_str (), error.AsCString ());
 return Error ();
@@ -131,6 +133,11 @@
 cached_module_spec.GetFileSpec () = module_file_path;
 cached_module_spec.GetPlatformFileSpec () = module_spec.GetFileSpec ();
 cached_module_sp.reset (new Module (cached_module_spec));
+
+FileSpec symfile_spec((cached_module_sp->GetFileSpec ().GetPath () + ".sym").c_str (), false);
+if (symfile_spec.Exists ())
+cached_module_sp->SetSymbolFileFileSpec (symfile_spec);
+
 if (did_create_ptr)
 *did_create_ptr = true;
 
@@ -143,7 +150,8 @@
 ModuleCache::GetAndPut (const FileSpec &root_dir_spec,
 const char *hostname,
 const ModuleSpec &module_spec,
-const Downloader &downloader,
+const ModuleDownloader &module_downloader,
+const SymfileDownloader &symfile_downloader,
 lldb::ModuleSP &cached_module_sp,
 bool *did_create_ptr)
 {
@@ -171,16 +179,37 @@
 return error;
 
 const auto tmp_download_file_spec = JoinPath (module_spec_dir, kTempFileName);
-error = downloader (module_spec, tmp_download_file_spec);
+error = module_downloader (module_spec, tmp_download_file_spec);
 llvm::FileRemover tmp_file_remover (tmp_download_file_spec.GetPath ().c_str ());
 if (error.Fail ())
 return Error("Failed to download module: %s", error.AsCString (

Re: [Lldb-commits] [PATCH] D11935: Fetch SDK version from PlatformAndroid

2015-08-11 Thread Oleksiy Vyalov via lldb-commits
ovyalov added a comment.

Please see my comments.



Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:284
@@ +283,3 @@
+std::string version_string;
+RunShellCommand("getprop ro.build.version.sdk",
+GetWorkingDirectory(),

Could you check for error that RunShellCommand returns?


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:290
@@ +289,3 @@
+1);
+m_sdk_version = ::atoi(version_string.c_str());
+return m_sdk_version;

StringConvert::ToUInt32 ?


http://reviews.llvm.org/D11935



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


Re: [Lldb-commits] [PATCH] D11790: Fix ObjC++ types Class and id being defined in C and C++ expressions.

2015-08-11 Thread Sean Callanan via lldb-commits
spyffe added a comment.

It looks like this patch does not use "language" to determine which language 
the expression parser runs in, but rather to allow lookups specifically of "id" 
and "Class" if the current frame is not Objective-C++.  Is that correct?


http://reviews.llvm.org/D11790



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


Re: [Lldb-commits] [PATCH] D11936: Download symbol file for .oat files on android

2015-08-11 Thread Oleksiy Vyalov via lldb-commits
ovyalov added a comment.

Please see my comments.



Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:306
@@ +305,3 @@
+if (!module_sp->GetPlatformFileSpec())
+return Error("No platform file specified");
+

indentation.


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:325
@@ +324,3 @@
+  &tmpdir,
+  1);
+

Please add constant for timeout.


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:329
@@ +328,3 @@
+return Error("Failed to generate temporary directory on the device 
(%s)", error.AsCString());
+tmpdir.erase(tmpdir.size() - 1); // Remove trailing new line
+

Please check that tmpdir isn't empty.


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:331
@@ +330,3 @@
+
+// Create file remover for the temporary directroy created on the device
+std::unique_ptr> 
tmpdir_remover(

s/directroy/directory


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:337
@@ +336,3 @@
+command.Printf("rm -rf %s", s->c_str());
+this->RunShellCommand(command.GetData(),
+  GetWorkingDirectory(),

Please log an error if rm fails.


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:342
@@ +341,3 @@
+  nullptr,
+  1);
+}

Can we have a bigger timeout? 1 sec might not be enough.


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:352
@@ +351,3 @@
+command.Printf("oatdump --symbolize=%s --output=%s",
+   module_sp->GetPlatformFileSpec().GetCString(),
+   symfile_platform_filespec.GetCString());

GetCString(false)?


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:353
@@ +352,3 @@
+   module_sp->GetPlatformFileSpec().GetCString(),
+   symfile_platform_filespec.GetCString());
+error = RunShellCommand(command.GetData(),

ditto - please verify that it works as expected from Windows.


Comment at: source/Utility/ModuleCache.cpp:137
@@ +136,3 @@
+
+FileSpec symfile_spec((cached_module_sp->GetFileSpec ().GetPath () + 
".sym").c_str (), false);
+if (symfile_spec.Exists ())

Please add ".sym" constant


Comment at: source/Utility/ModuleCache.cpp:197
@@ +196,3 @@
+
+// Fetching a symbol file for the modul
+const auto tmp_download_sym_file_spec = JoinPath (module_spec_dir, 
kTempSymFileName);

s/modul/module


Comment at: source/Utility/ModuleCache.cpp:207
@@ +206,3 @@
+FileSpec symfile_spec((cached_module_sp->GetFileSpec ().GetPath () + 
".sym").c_str (), false);
+error = Put (root_dir_spec, hostname, module_spec, 
tmp_download_sym_file_spec, symfile_spec);
+if (error.Fail ())

Do we really want to have a link for sym file in sys root? 
I'd rather moved code for sym file download from GetAndPut into Put method and 
skip link creation for symbol file.


http://reviews.llvm.org/D11936



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


Re: [Lldb-commits] [PATCH] D11790: Fix ObjC++ types Class and id being defined in C and C++ expressions.

2015-08-11 Thread Sean Callanan via lldb-commits
spyffe requested changes to this revision.
spyffe added a comment.
This revision now requires changes to proceed.

Ooh, I'm reading the patch at the beginning of ClangUserExpression::Evaluate 
again and it does look like this patch sets language based on the language of 
the containing frame, and that affects what language the expression is parsed 
in.

I don't think it's appropriate to force the expression parser out of 
Objective-C or C++ mode in non-ObjC frames, because it's entirely possible for 
a user to want to run Objective-C (or C++ code) from frames in a different 
language.  For example, it is often the case that a user will want to call 
[NSApplication sharedApplication] in an app, even if they are in C/C++ code.

For the same reason I think the idea of a target-level language isn't the right 
approach.  Rather, I think there should be a setting that says "force all 
expressions to this language by default" that the user can set if they're 
debugging a process that prefers a particular language.  By default, this 
setting would be Objective-C++ – but for cases where the user is expecting to 
deal mostly with pure C++ binaries, that can be switched to C++.  It might even 
be something that could be set on a per-platform basis.

Be aware (as I usually warn) that you will get a broken expression parser if 
you try to force it to use only C.  The expression parser uses references 
internally to allow you to use local variables without dereferencing pointers.  
We want to get Clang support for a "C-language reference" of some sort 
eventually, but until that happens you need to at least enable C++.


http://reviews.llvm.org/D11790



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


Re: [Lldb-commits] [PATCH] D11935: Fetch SDK version from PlatformAndroid

2015-08-11 Thread Tamas Berghammer via lldb-commits
tberghammer updated this revision to Diff 31822.
tberghammer added a comment.

Address review comments


http://reviews.llvm.org/D11935

Files:
  source/Plugins/Platform/Android/PlatformAndroid.cpp
  source/Plugins/Platform/Android/PlatformAndroid.h

Index: source/Plugins/Platform/Android/PlatformAndroid.h
===
--- source/Plugins/Platform/Android/PlatformAndroid.h
+++ source/Plugins/Platform/Android/PlatformAndroid.h
@@ -73,6 +73,12 @@
  const FileSpec& destination,
  uint32_t uid = UINT32_MAX,
  uint32_t gid = UINT32_MAX) override;
+
+uint32_t
+GetSdkVersion();
+
+Error
+DisconnectRemote () override;
 
  protected:
 const char *
@@ -86,6 +92,8 @@
 
 private:
 std::string m_device_id;
+uint32_t m_sdk_version;
+
 DISALLOW_COPY_AND_ASSIGN (PlatformAndroid);
 };
 
Index: source/Plugins/Platform/Android/PlatformAndroid.cpp
===
--- source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -13,6 +13,7 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Host/StringConvert.h"
 #include "Utility/UriParser.h"
 
 // Project includes
@@ -133,7 +134,8 @@
 }
 
 PlatformAndroid::PlatformAndroid (bool is_host) :
-PlatformLinux(is_host)
+PlatformLinux(is_host),
+m_sdk_version(0)
 {
 }
 
@@ -257,3 +259,40 @@
 
 return GetFile (src_file_spec, dst_file_spec);
 }
+
+Error
+PlatformAndroid::DisconnectRemote()
+{
+Error error = PlatformLinux::DisconnectRemote();
+if (error.Success())
+{
+m_device_id.clear();
+m_sdk_version = 0;
+}
+return error;
+}
+
+uint32_t
+PlatformAndroid::GetSdkVersion()
+{
+if (!IsConnected())
+return 0;
+
+if (m_sdk_version != 0)
+return m_sdk_version;
+
+int status = 0;
+std::string version_string;
+Error error = RunShellCommand("getprop ro.build.version.sdk",
+  GetWorkingDirectory(),
+  &status,
+  nullptr,
+  &version_string,
+  1);
+if (error.Fail() || status != 0 || version_string.empty())
+return 0;
+version_string.erase(version_string.size() - 1); // Remove trailing new 
line
+
+m_sdk_version = StringConvert::ToUInt32(version_string.c_str());
+return m_sdk_version;
+}


Index: source/Plugins/Platform/Android/PlatformAndroid.h
===
--- source/Plugins/Platform/Android/PlatformAndroid.h
+++ source/Plugins/Platform/Android/PlatformAndroid.h
@@ -73,6 +73,12 @@
  const FileSpec& destination,
  uint32_t uid = UINT32_MAX,
  uint32_t gid = UINT32_MAX) override;
+
+uint32_t
+GetSdkVersion();
+
+Error
+DisconnectRemote () override;
 
  protected:
 const char *
@@ -86,6 +92,8 @@
 
 private:
 std::string m_device_id;
+uint32_t m_sdk_version;
+
 DISALLOW_COPY_AND_ASSIGN (PlatformAndroid);
 };
 
Index: source/Plugins/Platform/Android/PlatformAndroid.cpp
===
--- source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -13,6 +13,7 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Host/HostInfo.h"
+#include "lldb/Host/StringConvert.h"
 #include "Utility/UriParser.h"
 
 // Project includes
@@ -133,7 +134,8 @@
 }
 
 PlatformAndroid::PlatformAndroid (bool is_host) :
-PlatformLinux(is_host)
+PlatformLinux(is_host),
+m_sdk_version(0)
 {
 }
 
@@ -257,3 +259,40 @@
 
 return GetFile (src_file_spec, dst_file_spec);
 }
+
+Error
+PlatformAndroid::DisconnectRemote()
+{
+Error error = PlatformLinux::DisconnectRemote();
+if (error.Success())
+{
+m_device_id.clear();
+m_sdk_version = 0;
+}
+return error;
+}
+
+uint32_t
+PlatformAndroid::GetSdkVersion()
+{
+if (!IsConnected())
+return 0;
+
+if (m_sdk_version != 0)
+return m_sdk_version;
+
+int status = 0;
+std::string version_string;
+Error error = RunShellCommand("getprop ro.build.version.sdk",
+  GetWorkingDirectory(),
+  &status,
+  nullptr,
+  &version_string,
+  1);
+if (error.Fail() || status != 0 || version_string.empty())
+return 0;
+version_string.erase(version_string.size() - 1); // Remove trailing new line
+
+m_

Re: [Lldb-commits] [PATCH] D11935: Fetch SDK version from PlatformAndroid

2015-08-11 Thread Oleksiy Vyalov via lldb-commits
ovyalov accepted this revision.
ovyalov added a comment.
This revision is now accepted and ready to land.

Looks good.



Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:292
@@ +291,3 @@
+  1);
+if (error.Fail() || status != 0 || version_string.empty())
+return 0;

Please add logging in case of error.


http://reviews.llvm.org/D11935



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


Re: [Lldb-commits] [PATCH] D11790: Fix ObjC++ types Class and id being defined in C and C++ expressions.

2015-08-11 Thread Paul Herman via lldb-commits
paulherman added a comment.

The idea is that, as I user, I do not expect the identifiers "Class" and "id" 
to not be available - I don't think I've seen a warning or notice about that 
when evaluating expressions.

I believe that setting the language based on the current frame is a good guess. 
I think evaluating something in the language of the current frame is more 
common than evaluating something that is in ObjC++ and the current frame is C++.

The idea about target-level language is that it only selects a specific 
language (i.e. not the default ObjC++) if all the compile units are in the same 
language. I believe this to be right since a debugger is not a REPL, hence we 
shouldn't expect the users to evaluate something in ObjC++ if their binary 
doesn't contain anything related to that language.


http://reviews.llvm.org/D11790



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


Re: [Lldb-commits] [PATCH] D11672: [MIPS] Handle false positives for MIPS hardware watchpoints

2015-08-11 Thread Greg Clayton via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

Looks fine.


Repository:
  rL LLVM

http://reviews.llvm.org/D11672



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


Re: [Lldb-commits] [PATCH] D11930: [MIPS]Handle floating point and aggregate return types in SysV-mips [32 bit] ABI

2015-08-11 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Init the variables and this is good to go.



Comment at: source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp:426-428
@@ -425,3 +425,5 @@
 
 bool is_signed;
+bool is_complex;
+uint32_t count;
 

Initialize these with default values in case the code is changed/reorganized 
later.


Repository:
  rL LLVM

http://reviews.llvm.org/D11930



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


Re: [Lldb-commits] [PATCH] D11519: [MIPS] Use qfThreadID if qC packet is not supported by target

2015-08-11 Thread Greg Clayton via lldb-commits
clayborg added a comment.

Lets just not send the OS then since it is very unreliable when the target if 
first attaching or launching and just always back up to using qfThreadID if 
first qProcessInfo and then qC are not implemented. We need some way to get the 
pid, so lets just do it.



Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:1101
@@ -1100,3 +1100,3 @@
 {
-lldb::pid_t pid = GetCurrentProcessID ();
+lldb::pid_t pid = GetCurrentProcessID (true, 
process->GetTarget().GetArchitecture().GetTriple().getOS());
 if (pid != LLDB_INVALID_PROCESS_ID)

Revert this and don't send the OS, see main comment below.


Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:1428
@@ -1427,3 +1427,3 @@
 lldb::pid_t
-GDBRemoteCommunicationClient::GetCurrentProcessID (bool allow_lazy)
+GDBRemoteCommunicationClient::GetCurrentProcessID (bool allow_lazy, 
llvm::Triple::OSType ostype)
 {

Revert this and don't send the OS, see main comment below.


Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:1464
@@ +1463,3 @@
+// If we don't get a response for $qC, check if $qfThreadID gives us a 
result.
+if (m_curr_pid == LLDB_INVALID_PROCESS_ID && ostype == 
llvm::Triple::UnknownOS)
+{

remove the ostype check, see main comment below.


Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h:112
@@ -111,3 +111,3 @@
 lldb::pid_t
-GetCurrentProcessID (bool allow_lazy = true);
+GetCurrentProcessID (bool allow_lazy = true, llvm::Triple::OSType ostype = 
llvm::Triple::OSType::UnknownOS);
 

Revert this and don't send the OS, see main comment below.


Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:761-762
@@ -760,3 +760,4 @@
 
-lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID ();
+const ArchSpec &target_arch = GetTarget().GetArchitecture();
+lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID (true, 
target_arch.GetTriple().getOS());
 if (pid == LLDB_INVALID_PROCESS_ID)

Revert this and don't send the OS, see main comment below.


Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:1016-1017
@@ -1014,3 +1015,4 @@
 {
-SetID (m_gdb_comm.GetCurrentProcessID ());
+const ArchSpec &target_arch = 
GetTarget().GetArchitecture();
+SetID (m_gdb_comm.GetCurrentProcessID (true, 
target_arch.GetTriple().getOS()));
 }

Revert this and don't send the OS, see main comment below.


Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:2323-2324
@@ -2320,3 +2322,4 @@
 {
-lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID ();
+const ArchSpec &target_arch = 
GetTarget().GetArchitecture();
+lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID (true, 
target_arch.GetTriple().getOS());
 if (pid != LLDB_INVALID_PROCESS_ID)

Revert this and don't send the OS, see main comment below.


Repository:
  rL LLVM

http://reviews.llvm.org/D11519



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


Re: [Lldb-commits] [PATCH] D11936: Download symbol file for .oat files on android

2015-08-11 Thread Tamas Berghammer via lldb-commits
tberghammer updated this revision to Diff 31826.
tberghammer marked 8 inline comments as done.
tberghammer added a comment.

Address comments


http://reviews.llvm.org/D11936

Files:
  include/lldb/Target/Platform.h
  source/Plugins/Platform/Android/PlatformAndroid.cpp
  source/Plugins/Platform/Android/PlatformAndroid.h
  source/Target/Platform.cpp
  source/Utility/ModuleCache.cpp
  source/Utility/ModuleCache.h

Index: source/Utility/ModuleCache.h
===
--- source/Utility/ModuleCache.h
+++ source/Utility/ModuleCache.h
@@ -46,22 +46,25 @@
 class ModuleCache
 {
 public:
-using Downloader = std::function;
+using ModuleDownloader = std::function;
+using SymfileDownloader = std::function;
 
 Error
 GetAndPut(const FileSpec &root_dir_spec,
   const char *hostname,
   const ModuleSpec &module_spec,
-  const Downloader &downloader,
+  const ModuleDownloader &module_downloader,
+  const SymfileDownloader &symfile_downloader,
   lldb::ModuleSP &cached_module_sp,
   bool *did_create_ptr);
 
 private:
 Error
 Put (const FileSpec &root_dir_spec,
  const char *hostname,
  const ModuleSpec &module_spec,
- const FileSpec &tmp_file);
+ const FileSpec &tmp_file,
+ const FileSpec &target_file);
 
 Error
 Get (const FileSpec &root_dir_spec,
Index: source/Utility/ModuleCache.cpp
===
--- source/Utility/ModuleCache.cpp
+++ source/Utility/ModuleCache.cpp
@@ -29,6 +29,8 @@
 const char* kModulesSubdir = ".cache";
 const char* kLockFileName = ".lock";
 const char* kTempFileName = ".temp";
+const char* kTempSymFileName = ".symtemp";
+const char* kSymFileExtension = ".sym";
 
 FileSpec
 JoinPath (const FileSpec &path1, const char* path2)
@@ -80,18 +82,19 @@
 ModuleCache::Put (const FileSpec &root_dir_spec,
   const char *hostname,
   const ModuleSpec &module_spec,
-  const FileSpec &tmp_file)
+  const FileSpec &tmp_file,
+  const FileSpec &target_file)
 {
 const auto module_spec_dir = GetModuleDirectory (root_dir_spec, module_spec.GetUUID ());
-const auto module_file_path = JoinPath (module_spec_dir, module_spec.GetFileSpec ().GetFilename ().AsCString ());
+const auto module_file_path = JoinPath (module_spec_dir, target_file.GetFilename ().AsCString ());
 
 const auto tmp_file_path = tmp_file.GetPath ();
 const auto err_code = llvm::sys::fs::rename (tmp_file_path.c_str (), module_file_path.GetPath ().c_str ());
 if (err_code)
 return Error ("Failed to rename file %s to %s: %s",
   tmp_file_path.c_str (), module_file_path.GetPath ().c_str (), err_code.message ().c_str ());
 
-const auto error = CreateHostSysRootModuleLink(root_dir_spec, hostname, module_spec.GetFileSpec(), module_file_path);
+const auto error = CreateHostSysRootModuleLink(root_dir_spec, hostname, target_file, module_file_path);
 if (error.Fail ())
 return Error ("Failed to create link to %s: %s", module_file_path.GetPath ().c_str (), error.AsCString ());
 return Error ();
@@ -131,6 +134,11 @@
 cached_module_spec.GetFileSpec () = module_file_path;
 cached_module_spec.GetPlatformFileSpec () = module_spec.GetFileSpec ();
 cached_module_sp.reset (new Module (cached_module_spec));
+
+FileSpec symfile_spec((cached_module_sp->GetFileSpec ().GetPath () + kSymFileExtension).c_str (), false);
+if (symfile_spec.Exists ())
+cached_module_sp->SetSymbolFileFileSpec (symfile_spec);
+
 if (did_create_ptr)
 *did_create_ptr = true;
 
@@ -143,7 +151,8 @@
 ModuleCache::GetAndPut (const FileSpec &root_dir_spec,
 const char *hostname,
 const ModuleSpec &module_spec,
-const Downloader &downloader,
+const ModuleDownloader &module_downloader,
+const SymfileDownloader &symfile_downloader,
 lldb::ModuleSP &cached_module_sp,
 bool *did_create_ptr)
 {
@@ -171,16 +180,37 @@
 return error;
 
 const auto tmp_download_file_spec = JoinPath (module_spec_dir, kTempFileName);
-error = downloader (module_spec, tmp_download_file_spec);
+error = module_downloader (module_spec, tmp_download_file_spec);
 llvm::FileRemover tmp_file_remover (tmp_download_file_spec.GetPath ().c_str ());
 if (error.Fail ())
 return Error("Failed to download module: %s", error.AsCString ());
 
 // Put downloaded file into local module cache.
-error = Put (root_dir_spec, hostname, module_spec, tmp_download_file_spec);
+error = Put (root_dir_spec, hostname, module_spec, tmp_download_file_spec, module_spec.GetFileSpec ());
 if (error.Fail ())
   

Re: [Lldb-commits] [PATCH] D11936: Download symbol file for .oat files on android

2015-08-11 Thread Tamas Berghammer via lldb-commits
tberghammer added a comment.

See responds inline



Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:325
@@ +324,3 @@
+  &tmpdir,
+  1);
+

ovyalov wrote:
> Please add constant for timeout.
Added a comment next to the value instead. I prefer that style but I can use a 
constant if you want.


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:342
@@ +341,3 @@
+  nullptr,
+  1);
+}

ovyalov wrote:
> Can we have a bigger timeout? 1 sec might not be enough.
I think 1 second should be enough in almost every case but increase it to 5 
seconds just in case the device is very busy.


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:353
@@ +352,3 @@
+   module_sp->GetPlatformFileSpec().GetCString(),
+   symfile_platform_filespec.GetCString());
+error = RunShellCommand(command.GetData(),

ovyalov wrote:
> ditto - please verify that it works as expected from Windows.
At the moment I don't have Windows environment but I will try to find a way to 
test it.


Comment at: source/Utility/ModuleCache.cpp:207
@@ +206,3 @@
+FileSpec symfile_spec((cached_module_sp->GetFileSpec ().GetPath () + 
".sym").c_str (), false);
+error = Put (root_dir_spec, hostname, module_spec, 
tmp_download_sym_file_spec, symfile_spec);
+if (error.Fail ())

ovyalov wrote:
> Do we really want to have a link for sym file in sys root? 
> I'd rather moved code for sym file download from GetAndPut into Put method 
> and skip link creation for symbol file.
At the moment I think we don't use the sys root at all, but I might be wrong. 
If anywhere we use the sys root then we will need the symbol file next to the 
actual file to find it. The reason I put the file download here because we need 
a Module object to do it (find out if we have symtab) what means we have to do 
it after the Get. I think moving it to Put will make the implementation more 
complicated.


http://reviews.llvm.org/D11936



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


[Lldb-commits] [PATCH] D11947: Improve instruction emulation based stack unwinding

2015-08-11 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added a reviewer: jasonmolenda.
tberghammer added a subscriber: lldb-commits.
Herald added a subscriber: aemerson.

Improve instruction emulation based stack unwinding

On ARM there is no difference between a pop and a load instruction so
a register can be loaded multiple times during the function. Add check
to threat the load as a restore only if it do the restore from the
same location where the register was saved.

http://reviews.llvm.org/D11947

Files:
  source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
  source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
  source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp

Index: source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
===
--- source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -580,8 +580,15 @@
 const uint32_t generic_regnum = reg_info->kinds[eRegisterKindGeneric];
 if (reg_num != LLDB_INVALID_REGNUM && generic_regnum != LLDB_REGNUM_GENERIC_SP)
 {
-m_curr_row->SetRegisterLocationToSame (reg_num, /*must_replace*/ false);
-m_curr_row_modified = true;
+if (m_pushed_regs.find (reg_num) == m_pushed_regs.end() &&
+context.info_type == EmulateInstruction::eInfoTypeAddress &&
+context.info.address == m_pushed_regs[reg_num])
+{
+m_curr_row->SetRegisterLocationToSame (reg_num, /*must_replace*/ false);
+m_curr_row_modified = true;
+}
+else
+assert (!"unhandled case, add code to handle this!");
 }
 }
 }
Index: source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
===
--- source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
+++ source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
@@ -768,8 +768,6 @@
 Context context_t;
 Context context_t2;
 
-context_t.SetRegisterToRegisterPlusOffset (reg_info_Rt, reg_info_base, 0);
-context_t2.SetRegisterToRegisterPlusOffset (reg_info_Rt2, reg_info_base, size);
 uint8_t buffer [RegisterValue::kMaxRegisterByteSize];
 Error error;
 
@@ -787,6 +785,8 @@
 context_t.type = eContextRegisterStore;
 context_t2.type = eContextRegisterStore;
 }
+context_t.SetRegisterToRegisterPlusOffset (reg_info_Rt, reg_info_base, 0);
+context_t2.SetRegisterToRegisterPlusOffset (reg_info_Rt2, reg_info_base, size);
 
 if (!ReadRegister (®_info_Rt, data_Rt))
 return false;
@@ -820,6 +820,8 @@
 context_t.type = eContextRegisterLoad;
 context_t2.type = eContextRegisterLoad;
 }
+context_t.SetAddress(address);
+context_t2.SetAddress(address + size);
 
 if (rt_unknown)
 memset (buffer, 'U', reg_info_Rt.byte_size);
@@ -950,15 +952,14 @@
 return false;
 
 Context context;
-context.SetRegisterToRegisterPlusOffset (reg_info_Rt, reg_info_base, postindex ? 0 : offset);
-
 switch (memop)
 {
 case MemOp_STORE:
 if (n == 31 || n == GetFramePointerRegisterNumber()) // if this store is based off of the sp or fp register
 context.type = eContextPushRegisterOnStack;
 else
 context.type = eContextRegisterStore;
+context.SetRegisterToRegisterPlusOffset (reg_info_Rt, reg_info_base, postindex ? 0 : offset);
 
 if (!ReadRegister (®_info_Rt, data_Rt))
 return false;
@@ -975,6 +976,7 @@
 context.type = eContextPopRegisterOffStack;
 else
 context.type = eContextRegisterLoad;
+context.SetAddress(address);
 
 if (!ReadMemory (context, address, buffer, reg_info_Rt.byte_size))
 return false;
Index: source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
===
--- source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
+++ source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
@@ -578,7 +578,7 @@
 {
 if (BitIsSet (registers, i))
 {
-context.SetRegisterPlusOffset (sp_reg, addr - sp);
+context.SetAddress(addr);
 data = MemARead(context, addr, 4, 0, &success);
 if (!success)
 return false;
@@ -2214,7 +2214,7 @@
 for (i=0; i

Re: [Lldb-commits] [PATCH] D11947: Improve instruction emulation based stack unwinding

2015-08-11 Thread Tamas Berghammer via lldb-commits
tberghammer updated this revision to Diff 31828.

http://reviews.llvm.org/D11947

Files:
  source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
  source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
  source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp

Index: source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
===
--- source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
+++ source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
@@ -580,8 +580,15 @@
 const uint32_t generic_regnum = reg_info->kinds[eRegisterKindGeneric];
 if (reg_num != LLDB_INVALID_REGNUM && generic_regnum != LLDB_REGNUM_GENERIC_SP)
 {
-m_curr_row->SetRegisterLocationToSame (reg_num, /*must_replace*/ false);
-m_curr_row_modified = true;
+if (m_pushed_regs.find (reg_num) != m_pushed_regs.end() &&
+context.info_type == EmulateInstruction::eInfoTypeAddress &&
+context.info.address == m_pushed_regs[reg_num])
+{
+m_curr_row->SetRegisterLocationToSame (reg_num, /*must_replace*/ false);
+m_curr_row_modified = true;
+}
+else
+assert (!"unhandled case, add code to handle this!");
 }
 }
 }
Index: source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
===
--- source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
+++ source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
@@ -768,8 +768,6 @@
 Context context_t;
 Context context_t2;
 
-context_t.SetRegisterToRegisterPlusOffset (reg_info_Rt, reg_info_base, 0);
-context_t2.SetRegisterToRegisterPlusOffset (reg_info_Rt2, reg_info_base, size);
 uint8_t buffer [RegisterValue::kMaxRegisterByteSize];
 Error error;
 
@@ -787,6 +785,8 @@
 context_t.type = eContextRegisterStore;
 context_t2.type = eContextRegisterStore;
 }
+context_t.SetRegisterToRegisterPlusOffset (reg_info_Rt, reg_info_base, 0);
+context_t2.SetRegisterToRegisterPlusOffset (reg_info_Rt2, reg_info_base, size);
 
 if (!ReadRegister (®_info_Rt, data_Rt))
 return false;
@@ -820,6 +820,8 @@
 context_t.type = eContextRegisterLoad;
 context_t2.type = eContextRegisterLoad;
 }
+context_t.SetAddress(address);
+context_t2.SetAddress(address + size);
 
 if (rt_unknown)
 memset (buffer, 'U', reg_info_Rt.byte_size);
@@ -950,15 +952,14 @@
 return false;
 
 Context context;
-context.SetRegisterToRegisterPlusOffset (reg_info_Rt, reg_info_base, postindex ? 0 : offset);
-
 switch (memop)
 {
 case MemOp_STORE:
 if (n == 31 || n == GetFramePointerRegisterNumber()) // if this store is based off of the sp or fp register
 context.type = eContextPushRegisterOnStack;
 else
 context.type = eContextRegisterStore;
+context.SetRegisterToRegisterPlusOffset (reg_info_Rt, reg_info_base, postindex ? 0 : offset);
 
 if (!ReadRegister (®_info_Rt, data_Rt))
 return false;
@@ -975,6 +976,7 @@
 context.type = eContextPopRegisterOffStack;
 else
 context.type = eContextRegisterLoad;
+context.SetAddress(address);
 
 if (!ReadMemory (context, address, buffer, reg_info_Rt.byte_size))
 return false;
Index: source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
===
--- source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
+++ source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
@@ -578,7 +578,7 @@
 {
 if (BitIsSet (registers, i))
 {
-context.SetRegisterPlusOffset (sp_reg, addr - sp);
+context.SetAddress(addr);
 data = MemARead(context, addr, 4, 0, &success);
 if (!success)
 return false;
@@ -2214,7 +2214,7 @@
 for (i=0; i___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11747: [MIPS] Support standard GDB remote stop reply packet for watchpoint

2015-08-11 Thread Greg Clayton via lldb-commits
clayborg added a subscriber: clayborg.
clayborg requested changes to this revision.
clayborg added a reviewer: clayborg.
clayborg added a comment.
This revision now requires changes to proceed.

See inlined comments.



Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:2475-2476
@@ -2474,4 +2474,4 @@
 
 lldb_private::Error
-GDBRemoteCommunicationClient::GetWatchpointSupportInfo (uint32_t &num, bool& 
after)
+GDBRemoteCommunicationClient::GetWatchpointSupportInfo (uint32_t &num, bool& 
after, llvm::Triple::ArchType atype)
 {

Change to the last argument: "llvm::Triple::ArchType atype" to "const ArchSpec 
&arch" in case we need to check the vendor or OS for some reason...


Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:2485
@@ -2484,3 +2484,3 @@
 lldb_private::Error
-GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction (bool 
&after)
+GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction (bool 
&after, llvm::Triple::ArchType atype)
 {

Change to the last argument: "llvm::Triple::ArchType atype" to "const ArchSpec 
&arch" in case we need to check the vendor or OS for some reason...


Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:27
@@ -26,2 +26,3 @@
 #include 
+#include 
 

Please use StreamString from:

```
#include "lldb/Core/StreamString.h"
```

instead of sstream


Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:2498-2500
@@ +2497,5 @@
+reason = "watchpoint";
+std::ostringstream ostr;
+ostr << wp_addr << " " << wp_index;
+description = ostr.str();
+}

Not sure if you need to do this, try not setting this and see how the 
description comes out. The watchpoint stop info should set this correctly?


Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:3103-3104
@@ -3086,3 +3102,4 @@
 {
-Error error (m_gdb_comm.GetWatchpointSupportInfo (num, after));
+const ArchSpec &target_arch = GetTarget().GetArchitecture();
+Error error (m_gdb_comm.GetWatchpointSupportInfo (num, after, 
target_arch.GetMachine()));
 return error;

I would just pass a "const ArchSpec & arch" instead of just the machine.


Repository:
  rL LLVM

http://reviews.llvm.org/D11747



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


Re: [Lldb-commits] [PATCH] D11936: Download symbol file for .oat files on android

2015-08-11 Thread Oleksiy Vyalov via lldb-commits
ovyalov accepted this revision.
ovyalov added a comment.
This revision is now accepted and ready to land.

LGTM



Comment at: source/Utility/ModuleCache.cpp:207
@@ +206,3 @@
+
+FileSpec symfile_spec((cached_module_sp->GetFileSpec ().GetPath () + 
".sym").c_str (), false);
+error = Put (root_dir_spec, hostname, module_spec, 
tmp_download_sym_file_spec, symfile_spec);

s/.sym/kSymFileExtension
Or maybe introduce a function that returns symbol file spec by given module 
file spec in order to re-use it here and in ModuleCache::Get


http://reviews.llvm.org/D11936



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


Re: [Lldb-commits] [lldb] r243091 - Handle old style S packet correctly

2015-08-11 Thread Hans Wennborg via lldb-commits
Ping?

On Wed, Aug 5, 2015 at 1:20 PM, Hans Wennborg  wrote:
> Ping?
>
> On Wed, Jul 29, 2015 at 8:56 AM, Hans Wennborg  wrote:
>> Greg, I believe you're the code owner here. OK to merge?
>>
>> On Tue, Jul 28, 2015 at 9:05 PM, Bhushan Attarde
>>  wrote:
>>> Hi Hans,
>>>
>>> Could you please add this to the release branch?
>>>
>>> Thanks
>>> Bhushan
>>>
>>> -Original Message-
>>> From: lldb-commits-boun...@cs.uiuc.edu 
>>> [mailto:lldb-commits-boun...@cs.uiuc.edu] On Behalf Of Bhushan Attarde
>>> Sent: 24 July 2015 09:36
>>> To: lldb-comm...@cs.uiuc.edu
>>> Subject: [Lldb-commits] [lldb] r243091 - Handle old style S packet correctly
>>>
>>> Author: bhushan.attarde
>>> Date: Thu Jul 23 23:06:20 2015
>>> New Revision: 243091
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=243091&view=rev
>>> Log:
>>> Handle old style S packet correctly
>>>
>>> SUMMARY:
>>> This patch fixes couple of issues:
>>> 1. A thread tries to lock a mutex which is already locked.
>>> 2. Updating a thread list before the stop packet is parsed so that it 
>>> can get a valid thread id and allows to set the stop info correctly.
>>>
>>> Reviewers: clayborg
>>> Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits
>>> Differential Revision: http://reviews.llvm.org/D11449
>>>
>>> Modified:
>>> lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
>>>
>>> Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=243091&r1=243090&r2=243091&view=diff
>>> ==
>>> --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
>>> (original)
>>> +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
>>> +++ Thu Jul 23 23:06:20 2015
>>> @@ -371,7 +371,7 @@ ProcessGDBRemote::ProcessGDBRemote(Targe
>>>  m_flags (0),
>>>  m_gdb_comm (),
>>>  m_debugserver_pid (LLDB_INVALID_PROCESS_ID),
>>> -m_last_stop_packet_mutex (Mutex::eMutexTypeNormal),
>>> +m_last_stop_packet_mutex (Mutex::eMutexTypeRecursive),
>>>  m_register_info (),
>>>  m_async_broadcaster (NULL, 
>>> "lldb.process.gdb-remote.async-broadcaster"),
>>>  m_async_thread_state_mutex(Mutex::eMutexTypeRecursive),
>>> @@ -2485,6 +2485,18 @@ ProcessGDBRemote::SetThreadStopInfo (Str
>>>  }
>>>  }
>>>
>>> +if (tid == LLDB_INVALID_THREAD_ID)
>>> +{
>>> +// A thread id may be invalid if the response is old style 
>>> 'S' packet which does not provide the
>>> +// thread information. So update the thread list and 
>>> choose the first one.
>>> +UpdateThreadIDList ();
>>> +
>>> +if (!m_thread_ids.empty ())
>>> +{
>>> +tid = m_thread_ids.front ();
>>> +}
>>> +}
>>> +
>>>  ThreadSP thread_sp = SetThreadStopInfo (tid,
>>>  expedited_register_map,
>>>  signo, @@ -2499,19 
>>> +2511,6 @@ ProcessGDBRemote::SetThreadStopInfo (Str
>>>  queue_kind,
>>>  queue_serial);
>>>
>>> -// If the response is old style 'S' packet which does not 
>>> provide us with thread information
>>> -// then update the thread list and choose the first one.
>>> -if (!thread_sp)
>>> -{
>>> -UpdateThreadIDList ();
>>> -
>>> -if (!m_thread_ids.empty ())
>>> -{
>>> -Mutex::Locker locker (m_thread_list_real.GetMutex ());
>>> -thread_sp = m_thread_list_real.FindThreadByProtocolID 
>>> (m_thread_ids.front (), false);
>>> -}
>>> -}
>>> -
>>>  return eStateStopped;
>>>  }
>>>  break;
>>>
>>>
>>> ___
>>> lldb-commits mailing list
>>> lldb-comm...@cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r244663 - Don't crash if the file we want to touch doesn't exist.

2015-08-11 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Tue Aug 11 16:01:32 2015
New Revision: 244663

URL: http://llvm.org/viewvc/llvm-project?rev=244663&view=rev
Log:
Don't crash if the file we want to touch doesn't exist.


Modified:
lldb/trunk/test/dosep.py

Modified: lldb/trunk/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?rev=244663&r1=244662&r2=244663&view=diff
==
--- lldb/trunk/test/dosep.py (original)
+++ lldb/trunk/test/dosep.py Tue Aug 11 16:01:32 2015
@@ -305,9 +305,8 @@ def getDefaultTimeout(platform_name):
 else:
 return "4m"
 
-
 def touch(fname, times=None):
-with open(fname, 'a'):
+if os.path.exists(fname):
 os.utime(fname, times)
 
 def find(pattern, path):


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


Re: [Lldb-commits] [lldb] r243091 - Handle old style S packet correctly

2015-08-11 Thread Hans Wennborg via lldb-commits
(cc'ing the new list address)

On Tue, Aug 11, 2015 at 2:03 PM, Hans Wennborg  wrote:
> r244664.
>
> Thanks,
> Hans
>
> On Tue, Aug 11, 2015 at 1:59 PM, Greg Clayton  wrote:
>> Yep, OK to merge.
>>
>>> On Jul 29, 2015, at 8:56 AM, Hans Wennborg  wrote:
>>>
>>> Greg, I believe you're the code owner here. OK to merge?
>>>
>>> On Tue, Jul 28, 2015 at 9:05 PM, Bhushan Attarde
>>>  wrote:
 Hi Hans,

 Could you please add this to the release branch?

 Thanks
 Bhushan

 -Original Message-
 From: lldb-commits-boun...@cs.uiuc.edu 
 [mailto:lldb-commits-boun...@cs.uiuc.edu] On Behalf Of Bhushan Attarde
 Sent: 24 July 2015 09:36
 To: lldb-comm...@cs.uiuc.edu
 Subject: [Lldb-commits] [lldb] r243091 - Handle old style S packet 
 correctly

 Author: bhushan.attarde
 Date: Thu Jul 23 23:06:20 2015
 New Revision: 243091

 URL: http://llvm.org/viewvc/llvm-project?rev=243091&view=rev
 Log:
 Handle old style S packet correctly

SUMMARY:
This patch fixes couple of issues:
1. A thread tries to lock a mutex which is already locked.
2. Updating a thread list before the stop packet is parsed so that it 
 can get a valid thread id and allows to set the stop info correctly.

Reviewers: clayborg
Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits
Differential Revision: http://reviews.llvm.org/D11449

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

 Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
 URL: 
 http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=243091&r1=243090&r2=243091&view=diff
 ==
 --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
 (original)
 +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
 +++ Thu Jul 23 23:06:20 2015
 @@ -371,7 +371,7 @@ ProcessGDBRemote::ProcessGDBRemote(Targe
 m_flags (0),
 m_gdb_comm (),
 m_debugserver_pid (LLDB_INVALID_PROCESS_ID),
 -m_last_stop_packet_mutex (Mutex::eMutexTypeNormal),
 +m_last_stop_packet_mutex (Mutex::eMutexTypeRecursive),
 m_register_info (),
 m_async_broadcaster (NULL, 
 "lldb.process.gdb-remote.async-broadcaster"),
 m_async_thread_state_mutex(Mutex::eMutexTypeRecursive),
 @@ -2485,6 +2485,18 @@ ProcessGDBRemote::SetThreadStopInfo (Str
 }
 }

 +if (tid == LLDB_INVALID_THREAD_ID)
 +{
 +// A thread id may be invalid if the response is old 
 style 'S' packet which does not provide the
 +// thread information. So update the thread list and 
 choose the first one.
 +UpdateThreadIDList ();
 +
 +if (!m_thread_ids.empty ())
 +{
 +tid = m_thread_ids.front ();
 +}
 +}
 +
 ThreadSP thread_sp = SetThreadStopInfo (tid,
 expedited_register_map,
 signo, @@ -2499,19 
 +2511,6 @@ ProcessGDBRemote::SetThreadStopInfo (Str
 queue_kind,
 queue_serial);

 -// If the response is old style 'S' packet which does not 
 provide us with thread information
 -// then update the thread list and choose the first one.
 -if (!thread_sp)
 -{
 -UpdateThreadIDList ();
 -
 -if (!m_thread_ids.empty ())
 -{
 -Mutex::Locker locker (m_thread_list_real.GetMutex ());
 -thread_sp = m_thread_list_real.FindThreadByProtocolID 
 (m_thread_ids.front (), false);
 -}
 -}
 -
 return eStateStopped;
 }
 break;


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


[Lldb-commits] [lldb] r244681 - Added missing files from checking regarding:

2015-08-11 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Tue Aug 11 16:49:32 2015
New Revision: 244681

URL: http://llvm.org/viewvc/llvm-project?rev=244681&view=rev
Log:
Added missing files from checking regarding:

http://reviews.llvm.org/D8712


Added:
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Symbol/TypeSystem.cpp

Added: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=244681&view=auto
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (added)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Tue Aug 11 16:49:32 2015
@@ -0,0 +1,331 @@
+//===-- TypeSystem.h --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_TypeSystem_h_
+#define liblldb_TypeSystem_h_
+
+#include 
+#include "lldb/lldb-private.h"
+#include "lldb/Core/ClangForward.h"
+#include "clang/AST/Type.h"
+
+namespace lldb_private {
+
+//--
+// Interface for representing the Type Systems in different languages.
+//--
+class TypeSystem
+{
+public:
+//--
+// Constructors and Destructors
+//--
+TypeSystem ();
+
+virtual ~TypeSystem ();
+
+virtual ClangASTContext *
+AsClangASTContext() = 0;
+
+//--
+// Tests
+//--
+
+virtual bool
+IsArrayType (void * type,
+ ClangASTType *element_type,
+ uint64_t *size,
+ bool *is_incomplete) = 0;
+
+virtual bool
+IsAggregateType (void * type) = 0;
+
+virtual bool
+IsCharType (void * type) = 0;
+
+virtual bool
+IsCompleteType (void * type) = 0;
+
+virtual bool
+IsDefined(void * type) = 0;
+
+virtual bool
+IsFloatingPointType (void * type, uint32_t &count, bool &is_complex) = 0;
+
+virtual bool
+IsFunctionType (void * type, bool *is_variadic_ptr) = 0;
+
+virtual size_t
+GetNumberOfFunctionArguments (void * type) = 0;
+
+virtual ClangASTType
+GetFunctionArgumentAtIndex (void * type, const size_t index) = 0;
+
+virtual bool
+IsFunctionPointerType (void * type) = 0;
+
+virtual bool
+IsIntegerType (void * type, bool &is_signed) = 0;
+
+virtual bool
+IsPossibleDynamicType (void * type,
+   ClangASTType *target_type, // Can pass NULL
+   bool check_cplusplus,
+   bool check_objc) = 0;
+
+virtual bool
+IsPointerType (void * type, ClangASTType *pointee_type) = 0;
+
+virtual bool
+IsScalarType (void * type) = 0;
+
+virtual bool
+IsVoidType (void * type) = 0;
+
+//--
+// Type Completion
+//--
+
+virtual bool
+GetCompleteType (void * type) = 0;
+
+//--
+// AST related queries
+//--
+
+virtual uint32_t
+GetPointerByteSize () = 0;
+
+//--
+// Accessors
+//--
+
+virtual ConstString
+GetTypeName (void * type) = 0;
+
+virtual uint32_t
+GetTypeInfo (void * type, ClangASTType *pointee_or_element_clang_type) = 0;
+
+virtual lldb::LanguageType
+GetMinimumLanguage (void * type) = 0;
+
+virtual lldb::TypeClass
+GetTypeClass (void * type) = 0;
+
+//--
+// Creating related types
+//--
+
+virtual ClangASTType
+GetArrayElementType (void * type, uint64_t *stride) = 0;
+
+virtual ClangASTType
+GetCanonicalType (void * type) = 0;
+
+// Returns -1 if this isn't a function of if the function doesn't have a 
prototype
+// Returns a value >= 0 if there is a prototype.
+virtual int
+GetFunctionArgumentCount (void * type) = 0;
+
+virtual ClangASTType

Re: [Lldb-commits] [PATCH] D8712: Introduce a TypeSystem interface to support adding non-clang languages.

2015-08-11 Thread Greg Clayton via lldb-commits
clayborg closed this revision.
clayborg added a comment.

Committed an updated version of this with the following two revisions:

Committed revision 244679.
Committed revision 244681.


Repository:
  rL LLVM

http://reviews.llvm.org/D8712



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


[Lldb-commits] [lldb] r244683 - Fix a infinite loop when killing a process that is in the middle of loading shared libraries.

2015-08-11 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Tue Aug 11 17:07:46 2015
New Revision: 244683

URL: http://llvm.org/viewvc/llvm-project?rev=244683&view=rev
Log:
Fix a infinite loop when killing a process that is in the middle of loading 
shared libraries.

The issue was we were sending a "qSymbol::" packet and it we were already 
disconnected were weren't exiting the while loop if we didn't successfully send 
the qSymbol packet.

 


Modified:

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

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=244683&r1=244682&r2=244683&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Tue Aug 11 17:07:46 2015
@@ -4314,100 +4314,97 @@ GDBRemoteCommunicationClient::ServeSymbo
 {
 StreamString packet;
 packet.PutCString ("qSymbol::");
-while (1)
+StringExtractorGDBRemote response;
+while (SendPacketAndWaitForResponseNoLock(packet.GetData(), 
packet.GetSize(), response) == PacketResult::Success)
 {
-StringExtractorGDBRemote response;
-if (SendPacketAndWaitForResponseNoLock(packet.GetData(), 
packet.GetSize(), response) == PacketResult::Success)
+if (response.IsOKResponse())
 {
-if (response.IsOKResponse())
-{
-// We are done serving symbols requests
-return;
-}
+// We are done serving symbols requests
+return;
+}
 
-if (response.IsUnsupportedResponse())
-{
-// qSymbol is not supported by the current GDB server 
we are connected to
-m_supports_qSymbol = false;
-return;
-}
-else
+if (response.IsUnsupportedResponse())
+{
+// qSymbol is not supported by the current GDB server we 
are connected to
+m_supports_qSymbol = false;
+return;
+}
+else
+{
+llvm::StringRef response_str(response.GetStringRef());
+if (response_str.startswith("qSymbol:"))
 {
-llvm::StringRef response_str(response.GetStringRef());
-if (response_str.startswith("qSymbol:"))
+response.SetFilePos(strlen("qSymbol:"));
+std::string symbol_name;
+if (response.GetHexByteString(symbol_name))
 {
-response.SetFilePos(strlen("qSymbol:"));
-std::string symbol_name;
-if (response.GetHexByteString(symbol_name))
-{
-if (symbol_name.empty())
-return;
+if (symbol_name.empty())
+return;
 
-addr_t symbol_load_addr = LLDB_INVALID_ADDRESS;
-lldb_private::SymbolContextList sc_list;
-if 
(process->GetTarget().GetImages().FindSymbolsWithNameAndType(ConstString(symbol_name),
 eSymbolTypeAny, sc_list))
+addr_t symbol_load_addr = LLDB_INVALID_ADDRESS;
+lldb_private::SymbolContextList sc_list;
+if 
(process->GetTarget().GetImages().FindSymbolsWithNameAndType(ConstString(symbol_name),
 eSymbolTypeAny, sc_list))
+{
+const size_t num_scs = sc_list.GetSize();
+for (size_t sc_idx=0; sc_idxGetType())
 {
-switch (sc.symbol->GetType())
-{
-case eSymbolTypeInvalid:
-case eSymbolTypeAbsolute:
-case eSymbolTypeUndefined:
-case eSymbolTypeSourceFile:
-case eSymbolTypeHeaderFile:
-case eSymbolTypeObjectFile:
-case 

[Lldb-commits] [PATCH] D11962: Mark TestCModules as XFAIL on OSX

2015-08-11 Thread Oleksiy Vyalov via lldb-commits
ovyalov created this revision.
ovyalov added reviewers: spyffe, chying, clayborg.
ovyalov added a subscriber: lldb-commits.

Mark TestCModules as XFAIL on OSX in order to make build bot green - 
http://lab.llvm.org:8011/builders/lldb-x86_64-darwin-13.4/builds/4722

http://reviews.llvm.org/D11962

Files:
  test/lang/c/modules/TestCModules.py

Index: test/lang/c/modules/TestCModules.py
===
--- test/lang/c/modules/TestCModules.py
+++ test/lang/c/modules/TestCModules.py
@@ -16,12 +16,14 @@
 
 @skipUnlessDarwin
 @dsym_test
+@expectedFailureDarwin # use of undeclared identifier 'MIN'
 def test_expr_with_dsym(self):
 self.buildDsym()
 self.expr()
 
 @dwarf_test
 @skipIfFreeBSD
+@expectedFailureDarwin # use of undeclared identifier 'MIN'
 @expectedFailureLinux('http://llvm.org/pr23456') # 'fopen' has unknown 
return type
 def test_expr_with_dwarf(self):
 self.buildDwarf()


Index: test/lang/c/modules/TestCModules.py
===
--- test/lang/c/modules/TestCModules.py
+++ test/lang/c/modules/TestCModules.py
@@ -16,12 +16,14 @@
 
 @skipUnlessDarwin
 @dsym_test
+@expectedFailureDarwin # use of undeclared identifier 'MIN'
 def test_expr_with_dsym(self):
 self.buildDsym()
 self.expr()
 
 @dwarf_test
 @skipIfFreeBSD
+@expectedFailureDarwin # use of undeclared identifier 'MIN'
 @expectedFailureLinux('http://llvm.org/pr23456') # 'fopen' has unknown return type
 def test_expr_with_dwarf(self):
 self.buildDwarf()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D11967: Export snprintf to avoid linking error with liblldb on Windows.

2015-08-11 Thread Chaoren Lin via lldb-commits
chaoren created this revision.
chaoren added reviewers: zturner, ovyalov.
chaoren added a subscriber: lldb-commits.

http://reviews.llvm.org/D11967

Files:
  include/lldb/Host/windows/win32.h

Index: include/lldb/Host/windows/win32.h
===
--- include/lldb/Host/windows/win32.h
+++ include/lldb/Host/windows/win32.h
@@ -65,7 +65,8 @@
 int strncasecmp(const char* s1, const char* s2, size_t n);
 
 #if _MSC_VER < 1900
-int snprintf(char *buffer, size_t count, const char *format, ...);
+int __declspec(dllexport)
+snprintf(char *buffer, size_t count, const char *format, ...);
 #endif
 
 #define STDIN_FILENO  0


Index: include/lldb/Host/windows/win32.h
===
--- include/lldb/Host/windows/win32.h
+++ include/lldb/Host/windows/win32.h
@@ -65,7 +65,8 @@
 int strncasecmp(const char* s1, const char* s2, size_t n);
 
 #if _MSC_VER < 1900
-int snprintf(char *buffer, size_t count, const char *format, ...);
+int __declspec(dllexport)
+snprintf(char *buffer, size_t count, const char *format, ...);
 #endif
 
 #define STDIN_FILENO  0
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11843: Make dosep output status by overwriting the same line.

2015-08-11 Thread Chaoren Lin via lldb-commits
chaoren added a comment.

Ping?


http://reviews.llvm.org/D11843



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


Re: [Lldb-commits] [PATCH] D11962: Mark TestCModules as XFAIL on OSX

2015-08-11 Thread Ying Chen via lldb-commits
chying added a comment.

Could you add the related bug to comments or argument? 
llvm.org/pr24302


http://reviews.llvm.org/D11962



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


[Lldb-commits] [lldb] r244710 - Export snprintf to avoid linking error with liblldb on Windows.

2015-08-11 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Tue Aug 11 20:22:24 2015
New Revision: 244710

URL: http://llvm.org/viewvc/llvm-project?rev=244710&view=rev
Log:
Export snprintf to avoid linking error with liblldb on Windows.

Reviewers: zturner, ovyalov

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D11967

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

Modified: lldb/trunk/include/lldb/Host/windows/win32.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/win32.h?rev=244710&r1=244709&r2=244710&view=diff
==
--- lldb/trunk/include/lldb/Host/windows/win32.h (original)
+++ lldb/trunk/include/lldb/Host/windows/win32.h Tue Aug 11 20:22:24 2015
@@ -65,7 +65,8 @@ int strcasecmp(const char* s1, const cha
 int strncasecmp(const char* s1, const char* s2, size_t n);
 
 #if _MSC_VER < 1900
-int snprintf(char *buffer, size_t count, const char *format, ...);
+int __declspec(dllexport)
+snprintf(char *buffer, size_t count, const char *format, ...);
 #endif
 
 #define STDIN_FILENO  0


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


Re: [Lldb-commits] [PATCH] D11967: Export snprintf to avoid linking error with liblldb on Windows.

2015-08-11 Thread Oleksiy Vyalov via lldb-commits
ovyalov accepted this revision.
ovyalov added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D11967



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


Re: [Lldb-commits] [PATCH] D11967: Export snprintf to avoid linking error with liblldb on Windows.

2015-08-11 Thread Chaoren Lin via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244710: Export snprintf to avoid linking error with liblldb 
on Windows. (authored by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D11967?vs=31884&id=31896#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11967

Files:
  lldb/trunk/include/lldb/Host/windows/win32.h

Index: lldb/trunk/include/lldb/Host/windows/win32.h
===
--- lldb/trunk/include/lldb/Host/windows/win32.h
+++ lldb/trunk/include/lldb/Host/windows/win32.h
@@ -65,7 +65,8 @@
 int strncasecmp(const char* s1, const char* s2, size_t n);
 
 #if _MSC_VER < 1900
-int snprintf(char *buffer, size_t count, const char *format, ...);
+int __declspec(dllexport)
+snprintf(char *buffer, size_t count, const char *format, ...);
 #endif
 
 #define STDIN_FILENO  0


Index: lldb/trunk/include/lldb/Host/windows/win32.h
===
--- lldb/trunk/include/lldb/Host/windows/win32.h
+++ lldb/trunk/include/lldb/Host/windows/win32.h
@@ -65,7 +65,8 @@
 int strncasecmp(const char* s1, const char* s2, size_t n);
 
 #if _MSC_VER < 1900
-int snprintf(char *buffer, size_t count, const char *format, ...);
+int __declspec(dllexport)
+snprintf(char *buffer, size_t count, const char *format, ...);
 #endif
 
 #define STDIN_FILENO  0
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11843: Make dosep output status by overwriting the same line.

2015-08-11 Thread Zachary Turner via lldb-commits
Sorry, will get to this first thing tomorroow

On Tue, Aug 11, 2015 at 4:47 PM Chaoren Lin  wrote:

> chaoren added a comment.
>
> Ping?
>
>
> http://reviews.llvm.org/D11843
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11967: Export snprintf to avoid linking error with liblldb on Windows.

2015-08-11 Thread Zachary Turner via lldb-commits
You need to use LIBLLDB_API instead of __declspec(export).  Otherwise
someone linking against liblldb and trying to call this won't work
correctly.  Check the annotation given to the classes in the SB headers for
the exact name of the macro.

On Tue, Aug 11, 2015 at 6:23 PM Chaoren Lin  wrote:

> This revision was automatically updated to reflect the committed changes.
> Closed by commit rL244710: Export snprintf to avoid linking error with
> liblldb on Windows. (authored by chaoren).
>
> Changed prior to commit:
>   http://reviews.llvm.org/D11967?vs=31884&id=31896#toc
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D11967
>
> Files:
>   lldb/trunk/include/lldb/Host/windows/win32.h
>
> Index: lldb/trunk/include/lldb/Host/windows/win32.h
> ===
> --- lldb/trunk/include/lldb/Host/windows/win32.h
> +++ lldb/trunk/include/lldb/Host/windows/win32.h
> @@ -65,7 +65,8 @@
>  int strncasecmp(const char* s1, const char* s2, size_t n);
>
>  #if _MSC_VER < 1900
> -int snprintf(char *buffer, size_t count, const char *format, ...);
> +int __declspec(dllexport)
> +snprintf(char *buffer, size_t count, const char *format, ...);
>  #endif
>
>  #define STDIN_FILENO  0
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11967: Export snprintf to avoid linking error with liblldb on Windows.

2015-08-11 Thread Chaoren Lin via lldb-commits
chaoren added a subscriber: chaoren.
chaoren added a comment.

Sorry! I'll fix this as soon as I get home.

I have a question though, isn't this only a problem if whatever's linking
against lldb includes this header? This isn't in the API, so that shouldn't
happen. I also don't know if it's correct to label it LLDB_API when it's
not actually part of the API.


Repository:
  rL LLVM

http://reviews.llvm.org/D11967



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


Re: [Lldb-commits] [PATCH] D11962: Mark TestCModules as XFAIL on OSX

2015-08-11 Thread Ying Chen via lldb-commits
chying accepted this revision.
chying added a comment.
This revision is now accepted and ready to land.

Sorry I mean in the code, like,
@expectedFailureDarwin('llvm.org/pr24302')
Otherwise, looks good to me.


http://reviews.llvm.org/D11962



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


Re: [Lldb-commits] [PATCH] D11967: Export snprintf to avoid linking error with liblldb on Windows.

2015-08-11 Thread Zachary Turner via lldb-commits
True that it only needs to be included if it's part of the api.  Are we
sure it can't happen through a transitive include?

As long as the user of liblldb doesn't see the declaration it shouldn't be
a problem.

On Tue, Aug 11, 2015 at 6:54 PM Chaoren Lin via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> chaoren added a subscriber: chaoren.
> chaoren added a comment.
>
> Sorry! I'll fix this as soon as I get home.
>
> I have a question though, isn't this only a problem if whatever's linking
> against lldb includes this header? This isn't in the API, so that shouldn't
> happen. I also don't know if it's correct to label it LLDB_API when it's
> not actually part of the API.
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D11967
>
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11967: Export snprintf to avoid linking error with liblldb on Windows.

2015-08-11 Thread Chaoren Lin via lldb-commits
> Are we sure it can't happen through a transitive include?

In that case, whatever included it is breaking the API Coding rules
.

On Tue, Aug 11, 2015 at 7:12 PM, Zachary Turner  wrote:

> True that it only needs to be included if it's part of the api.  Are we
> sure it can't happen through a transitive include?
>
> As long as the user of liblldb doesn't see the declaration it shouldn't be
> a problem.
>
> On Tue, Aug 11, 2015 at 6:54 PM Chaoren Lin via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> chaoren added a subscriber: chaoren.
>> chaoren added a comment.
>>
>> Sorry! I'll fix this as soon as I get home.
>>
>> I have a question though, isn't this only a problem if whatever's linking
>> against lldb includes this header? This isn't in the API, so that
>> shouldn't
>> happen. I also don't know if it's correct to label it LLDB_API when it's
>> not actually part of the API.
>>
>>
>> Repository:
>>   rL LLVM
>>
>> http://reviews.llvm.org/D11967
>>
>>
>>
>> ___
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r244716 - Have debugserver send the OS version string plus

2015-08-11 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Tue Aug 11 22:27:33 2015
New Revision: 244716

URL: http://llvm.org/viewvc/llvm-project?rev=244716&view=rev
Log:
Have debugserver send the OS version string plus
major, minor, and patchlevel in the qHostInfo reply.  
Document that qHostInfo may report major/minor/patch
separately / in addition to the version: combination.

 

Modified:
lldb/trunk/docs/lldb-gdb-remote.txt
lldb/trunk/tools/debugserver/source/DNB.cpp
lldb/trunk/tools/debugserver/source/DNB.h
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/docs/lldb-gdb-remote.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/lldb-gdb-remote.txt?rev=244716&r1=244715&r2=244716&view=diff
==
--- lldb/trunk/docs/lldb-gdb-remote.txt (original)
+++ lldb/trunk/docs/lldb-gdb-remote.txt Tue Aug 11 22:27:33 2015
@@ -569,7 +569,7 @@ cputype: is a number that is the mach-o
 cpusubtype: is a number that is the mach-o CPU subtype type that is being 
debugged (base 10)
 triple: a string for the target triple (x86_64-apple-macosx) that can be used 
to specify arch + vendor + os in one entry
 vendor: a string for the vendor (apple), not needed if "triple" is specified
-ostype: a string for the OS being debugged (darwin, linux, freebsd), not 
needed if "triple" is specified
+ostype: a string for the OS being debugged (macosx, linux, freebsd, ios, 
watchos), not needed if "triple" is specified
 endian: is one of "little", "big", or "pdp"
 ptrsize: an unsigned number that represents how big pointers are in bytes on 
the debug target
 hostname: the hostname of the host that is running the GDB server if available
@@ -579,6 +579,9 @@ os_version: a version string that repres
 watchpoint_exceptions_received: one of "before" or "after" to specify if a 
watchpoint is triggered before or after the pc when it stops
 default_packet_timeout: an unsigned number that specifies the default timeout 
in seconds
 distribution_id: optional. For linux, specifies distribution id (e.g. ubuntu, 
fedora, etc.)
+osmajor: optional, specifies the major version number of the OS (e.g. for Mac 
OS X 10.11.2, it would be 10)
+osminor: optional, specifies the minor version number of the OS (e.g. for Mac 
OS X 10.11.2, it would be 11)
+ospatch: optional, specifies the patch level number of the OS (e.g. for Mac OS 
X 10.11.2, it would be 2)
 
 //--
 // "qGDBServerVersion"

Modified: lldb/trunk/tools/debugserver/source/DNB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.cpp?rev=244716&r1=244715&r2=244716&view=diff
==
--- lldb/trunk/tools/debugserver/source/DNB.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNB.cpp Tue Aug 11 22:27:33 2015
@@ -1936,6 +1936,12 @@ DNBResolveExecutablePath (const char *pa
 return false;
 }
 
+bool
+DNBGetOSVersionNumbers (uint64_t *major, uint64_t *minor, uint64_t *patch)
+{
+return MachProcess::GetOSVersionNumbers (major, minor, patch);
+}
+
 
 void
 DNBInitialize()

Modified: lldb/trunk/tools/debugserver/source/DNB.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNB.h?rev=244716&r1=244715&r2=244716&view=diff
==
--- lldb/trunk/tools/debugserver/source/DNB.h (original)
+++ lldb/trunk/tools/debugserver/source/DNB.h Tue Aug 11 22:27:33 2015
@@ -168,5 +168,6 @@ nub_bool_t  DNBGetRegisterInfoByName
 //--
 const char *DNBStateAsString (nub_state_t state);
 nub_bool_t  DNBResolveExecutablePath (const char *path, char 
*resolved_path, size_t resolved_path_size);
+boolDNBGetOSVersionNumbers (uint64_t *major, uint64_t *minor, 
uint64_t *patch);
 
 #endif

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h?rev=244716&r1=244715&r2=244716&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h Tue Aug 11 
22:27:33 2015
@@ -80,6 +80,7 @@ public:
 static const void * PrepareForAttach (const char *path, 
nub_launch_flavor_t launch_flavor, bool waitfor, DNBError &err_str);
 static void CleanupAfterAttach (const void *attach_token, bool 
success, DNBError &err_str);
 static nub_process_tCheckForProcess (const void *attach_token);
+static bool GetOSVersionNumbers (uint64_t *major, uint64_t 
*minor, uint64_t *patch);
 #i

Re: [Lldb-commits] [PATCH] D11672: [MIPS] Handle false positives for MIPS hardware watchpoints

2015-08-11 Thread Jaydeep Patil via lldb-commits
jaydeep added a comment.

Hi jingham,
Could you please review this?
Thanks.


Repository:
  rL LLVM

http://reviews.llvm.org/D11672



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


[Lldb-commits] [PATCH] D11971: Remove DNBConfig.h

2015-08-11 Thread Bruce Mitchener via lldb-commits
brucem created this revision.
brucem added reviewers: clayborg, jasonmolenda.
brucem added a subscriber: lldb-commits.

This was no longer needed and hasn't been needed since r143244
in 2011.  This removes everything associated with generating
or using it.

http://reviews.llvm.org/D11971

Files:
  tools/debugserver/CMakeLists.txt
  tools/debugserver/Makefile
  tools/debugserver/debugserver.xcodeproj/project.pbxproj
  tools/debugserver/scripts/CMakeLists.txt
  tools/debugserver/scripts/Makefile
  tools/debugserver/scripts/dbgnub-config.pl
  tools/debugserver/source/CMakeLists.txt
  tools/debugserver/source/MacOSX/CMakeLists.txt
  tools/debugserver/source/MacOSX/MachException.h
  tools/debugserver/source/MacOSX/dbgnub-mig.defs

Index: tools/debugserver/source/MacOSX/dbgnub-mig.defs
===
--- tools/debugserver/source/MacOSX/dbgnub-mig.defs
+++ tools/debugserver/source/MacOSX/dbgnub-mig.defs
@@ -2,15 +2,4 @@
  * nub.defs
  */
  
-/*
- * DNBConfig.h is autogenerated by a perl script that is run as a build
- * script in XCode. XCode is responsible for calling the script and setting
- * the include paths correctly to locate it. The file will exist in the
- * derived sources directory in the build folder.
- *
- */
-
-#include "DNBConfig.h"
-
-
 #import 
Index: tools/debugserver/source/MacOSX/MachException.h
===
--- tools/debugserver/source/MacOSX/MachException.h
+++ tools/debugserver/source/MacOSX/MachException.h
@@ -17,7 +17,6 @@
 
 #include 
 #include 
-#include "DNBConfig.h"
 
 class MachProcess;
 class PThreadMutex;
Index: tools/debugserver/source/MacOSX/CMakeLists.txt
===
--- tools/debugserver/source/MacOSX/CMakeLists.txt
+++ tools/debugserver/source/MacOSX/CMakeLists.txt
@@ -14,8 +14,7 @@
   ${CMAKE_CURRENT_BINARY_DIR}/mach_excUser.c
   )
 add_custom_command(OUTPUT ${generated_mach_interfaces}
-  COMMAND mig -I${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/dbgnub-mig.defs
-  DEPENDS ${dnbconfig_header}
+  COMMAND mig ${CMAKE_CURRENT_SOURCE_DIR}/dbgnub-mig.defs
   )
 
 set(DEBUGSERVER_VERS_GENERATED_FILE ${CMAKE_CURRENT_BINARY_DIR}/debugserver_vers.c)
@@ -34,7 +33,6 @@
   )
 
 add_lldb_executable(debugserver
-  ${dnbconfig_header}
   HasAVX.s
   CFBundle.cpp
   CFData.cpp
@@ -57,7 +55,6 @@
   PROPERTIES LANGUAGE C COMPILE_FLAGS "-x assembler-with-cpp"
   )
 
-add_dependencies(debugserver generate_dnbconfig)
 target_link_libraries(debugserver ${DEBUGSERVER_USED_LIBS})
 
 # Sign the debugserver binary
Index: tools/debugserver/source/CMakeLists.txt
===
--- tools/debugserver/source/CMakeLists.txt
+++ tools/debugserver/source/CMakeLists.txt
@@ -41,7 +41,6 @@
 endif ()
 
 add_library(lldbDebugserverCommon
-  #${dnbconfig_header}
   debugserver.cpp
   DNBArch.cpp
   DNBBreakpoint.cpp
@@ -63,8 +62,6 @@
   TTYState.cpp
   )
 
-add_dependencies(lldbDebugserverCommon generate_dnbconfig)
-
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   find_library(COCOA_LIBRARY Cocoa)
   target_link_libraries(lldbDebugserverCommon ${COCOA_LIBRARY})
Index: tools/debugserver/scripts/dbgnub-config.pl
===
--- tools/debugserver/scripts/dbgnub-config.pl
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-my $config_file = "$ENV{SCRIPT_OUTPUT_FILE_0}";
-
-# Define the tests we need to run during this configuration
-my @config_tests = (
-	{
-		NAME => "HAVE_64_BIT_MACH_EXCEPTIONS",
-		TEST => "-e '$ENV{SDKROOT}/usr/include/mach/mach_exc.defs'",
-		COMMENT => "// Defined if we can use 64 bit mach exceptions",
-		FAIL => "#undef HAVE_64_BIT_MACH_EXCEPTIONS\
-#define mach_exception_data_t exception_data_t\
-#define mach_exception_data_type_t exception_data_type_t\
-#define mach_exc_server exc_server\
-#define MACH_EXCEPTION_CODES 0\n",
-		SUCCESS => "#define HAVE_64_BIT_MACH_EXCEPTIONS 1\n",
-	}
-);
-
-#--
-# Open the config file
-#--
-open(CONFIG, "> $config_file") || die "Couldn't open '$config_file' for writing: $!\n";
-print CONFIG "//" . "-" x 72 . "\n";
-print CONFIG "// This file is auto generated by a dbgnub-config.pl, do not edit by hand!\n";
-print CONFIG "//" . "-" x 72 . "\n";
-print CONFIG "// COMMAND LINE\n";
-print CONFIG "//	" . join(' ', @ARGV) . "\n";
-print CONFIG "//" . "-" x 72 . "\n";
-print CONFIG "// ENVIRONMENT\n";
-my $key;
-my $val;
-while (($key, $val) = each %ENV) 
-{
-	$val =~ s/\n/\n\/\/	/g;
-	printf CONFIG "//	%s = %s\n", $key, $val;
-}
-print CONFIG "//" . "-" x 72 . "\n";
-print CONFIG "// SETTINGS\n";
-print CONFIG "//	config_file: '$config_file'\n";
-print CONFIG "//" . "-" x 72 . "\n";
-print CONFIG "\n\n";
-print CONFIG "#ifndef __DBGNUB_CONFIG__\