Re: [Lldb-commits] [PATCH] D13158: Allow to construct CMIUtilString using std::string directly + cleanup CMIUtilString (MI)

2015-09-25 Thread Ilia K via lldb-commits
ki.stfu added a comment.

I perceive it as a simple patch, so I am going to go ahead.


http://reviews.llvm.org/D13158



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


Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-09-25 Thread Ilia K via lldb-commits
ki.stfu requested changes to this revision.
This revision now requires changes to proceed.


Comment at: include/lldb/API/SBTypeSummary.h:125-126
@@ -124,1 +124,4 @@
+
+bool
+DoesPrintValue (const SBValue& value);
 

You can use clang-format to follow the LLDB coding style, or just do the 
following:
```
bool
DoesPrintValue (const SBValue &value);
```


Comment at: source/API/SBTypeSummary.cpp:290
@@ +289,3 @@
+bool
+SBTypeSummary::DoesPrintValue(const SBValue& value)
+{

ditto


Comment at: test/tools/lldb-mi/variable/TestMiVar.py:355
@@ +354,3 @@
+self.runCmd("-var-create - * std_string")
+
self.expect('\^done,name="var\d+",numchild="[0-9]+",value=""hello"",type="std::[\S]*string",thread-id="1",has_more="0"')
+

Use lazy regex:
```
self.expect('\^done,name="var\d+",numchild="[0-9]+",value=""hello"",type="std::[\S]*?string",thread-id="1",has_more="0"')
```


Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:173-174
@@ +172,4 @@
+// (for example with AddCXXSummary) as simple value
+if (TryGetValueSummary(vwrValue))
+return MIstatus::success;
+}

```
vwrValue = GetValueSummary();
if (!vwrValue.empty)
  return MIstatus::success;
```


Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:191-193
@@ -182,1 +190,5 @@
 {
+CMIUtilString summary;
+if (TryGetValueSummary(summary))
+return summary;
+

```
const CMIUtilString summary = GetValueSummary();
if (!summary.empty())
return summary;
```


Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:242-244
@@ -229,1 +241,5 @@
 
+CMIUtilString summary;
+if (TryGetValueSummary(summary))
+return summary;
+

```
const CMIUtilString summary = GetValueSummary();
if (!summary.empty())
return summary;
```


Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:285-287
@@ -268,1 +284,5 @@
 {
+CMIUtilString summary;
+if (TryGetValueSummary(summary))
+return summary;
+

```
const CMIUtilString summary = GetValueSummary();
if (!summary.empty())
return summary;
```


Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.h:58
@@ -57,3 +57,3 @@
 bool GetCompositeValue(const bool vbPrintFieldNames, CMICmnMIValueTuple 
&vwrMiValueTuple, const MIuint vnDepth = 1) const;
-
+bool TryGetValueSummary(CMIUtilString &vrValue) const;
 // Statics:

It is better:
```
CMIUtilString GetValueSummary(CMIUtilString &vrValue) const
```


http://reviews.llvm.org/D13058



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


Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-09-25 Thread Eugene Leviant via lldb-commits
evgeny777 added inline comments.


Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.h:58
@@ -57,3 +57,3 @@
 bool GetCompositeValue(const bool vbPrintFieldNames, CMICmnMIValueTuple 
&vwrMiValueTuple, const MIuint vnDepth = 1) const;
-
+bool TryGetValueSummary(CMIUtilString &vrValue) const;
 // Statics:

ki.stfu wrote:
> It is better:
> ```
> CMIUtilString GetValueSummary(CMIUtilString &vrValue) const
> ```
Really?

Did you mean
const  CMIUtilString& GetValueSummary(void) const ?





http://reviews.llvm.org/D13058



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


Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-09-25 Thread Eugene Leviant via lldb-commits
evgeny777 added inline comments.


Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:191-193
@@ -182,1 +190,5 @@
 {
+CMIUtilString summary;
+if (TryGetValueSummary(summary))
+return summary;
+

ki.stfu wrote:
> ```
> const CMIUtilString summary = GetValueSummary();
> if (!summary.empty())
> return summary;
> ```
const CMIUtilString**&** summary = GetValueSummary();  ???


http://reviews.llvm.org/D13058



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


Re: [Lldb-commits] [PATCH] D13158: Allow to construct CMIUtilString using std::string directly + cleanup CMIUtilString (MI)

2015-09-25 Thread Ilia K via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL248566: Allow to construct CMIUtilString using std::string 
directly + cleanup… (authored by ki.stfu).

Changed prior to commit:
  http://reviews.llvm.org/D13158?vs=35703&id=35708#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13158

Files:
  lldb/trunk/tools/lldb-mi/MICmdArgContext.cpp
  lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp
  lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp
  lldb/trunk/tools/lldb-mi/MICmdArgValThreadGrp.cpp
  lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
  lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
  lldb/trunk/tools/lldb-mi/MICmdInterpreter.cpp
  lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
  lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
  lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
  lldb/trunk/tools/lldb-mi/MIDriver.cpp
  lldb/trunk/tools/lldb-mi/MIUtilString.cpp
  lldb/trunk/tools/lldb-mi/MIUtilString.h

Index: lldb/trunk/tools/lldb-mi/MIUtilString.h
===
--- lldb/trunk/tools/lldb-mi/MIUtilString.h
+++ lldb/trunk/tools/lldb-mi/MIUtilString.h
@@ -43,8 +43,7 @@
   public:
 /* ctor */ CMIUtilString();
 /* ctor */ CMIUtilString(const char *vpData);
-/* ctor */ CMIUtilString(const char *const *vpData);
-/* ctor */ CMIUtilString(const char *vpData, size_t nLen);
+/* ctor */ CMIUtilString(const std::string& vrStr);
 //
 bool ExtractNumber(MIint64 &vwrNumber) const;
 CMIUtilString FindAndReplace(const CMIUtilString &vFind, const CMIUtilString &vReplaceWith) const;
Index: lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
@@ -505,7 +505,7 @@
 addr += sizeof(ch);
 }
 
-return result.c_str();
+return result;
 }
 
 //++ 
Index: lldb/trunk/tools/lldb-mi/MICmdArgContext.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmdArgContext.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdArgContext.cpp
@@ -130,7 +130,7 @@
 }
 
 const size_t nPosEnd = nLen + nExtraSpace;
-m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.replace(nPos, nPosEnd, "").c_str();
+m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.replace(nPos, nPosEnd, "");
 m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.Trim();
 
 return MIstatus::success;
Index: lldb/trunk/tools/lldb-mi/MIDriver.cpp
===
--- lldb/trunk/tools/lldb-mi/MIDriver.cpp
+++ lldb/trunk/tools/lldb-mi/MIDriver.cpp
@@ -893,7 +893,7 @@
const std::string vToken(vTextLine.begin(), vTextLine.begin() + nCommandOffset);
// 001target create "/path/to/file"
//^ -- CLI command
-   const CMIUtilString vCliCommand(std::string(vTextLine, nCommandOffset).c_str());
+   const CMIUtilString vCliCommand(std::string(vTextLine, nCommandOffset));
 
// 5. Escape special characters and embed the command in a string
// Result: it looks like -- target create \"/path/to/file\".
Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
@@ -585,7 +585,7 @@
 while (it != m_mapIdToEventMask.end())
 {
 const CMIUtilString &rId((*it).first);
-if (rId.find(vBroadcasterClass.c_str()) != std::string::npos)
+if (rId.find(vBroadcasterClass) != std::string::npos)
 {
 const MIuint clientsMask = (*it).second;
 mask |= clientsMask;
@@ -678,9 +678,7 @@
 return MIstatus::failure;
 }
 
-CMIUtilString strId(vBroadcasterClass.c_str());
-strId += vClientName;
-
+const CMIUtilString strId(vBroadcasterClass + vClientName);
 const MapIdToEventMask_t::const_iterator it = m_mapIdToEventMask.find(strId);
 if (it != m_mapIdToEventMask.end())
 {
Index: lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp
@@ -115,6 +115,6 @@
 bool
 CMICmdArgValOptionShort::ArgNameMatch(const CMIUtilString &vrTxt) const
 {
-const CMIUtilString strArg = vrTxt.substr(1).c_str();
+const CMIUtilString strArg = vrTxt.substr(1);
 return (strArg == GetName());
 }
Index: lldb/trunk/tools/lldb-mi/MICmdArgValThreadGrp.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmdArgValThreadGrp.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdArgValThreadGrp.cpp
@@ -121,7 +121,7 @@
 if (nPos != 0)
 

[Lldb-commits] [lldb] r248566 - Allow to construct CMIUtilString using std::string directly + cleanup CMIUtilString (MI)

2015-09-25 Thread Ilia K via lldb-commits
Author: ki.stfu
Date: Fri Sep 25 03:28:58 2015
New Revision: 248566

URL: http://llvm.org/viewvc/llvm-project?rev=248566&view=rev
Log:
Allow to construct CMIUtilString using std::string directly + cleanup 
CMIUtilString (MI)

Summary:
Allow to construct CMIUtilString using std::string directly + cleanup 
CMIUtilString (MI)

This patch cleans up lldb-mi code, and serves to simplify
the following case:
```
  std::string strGoodbye = "!Hello";
  CMIUtilString strHello(strGoodbye.substr(1).c_str());
```

With CMIUtilString(std::string) we can omit .c_str():
```
  std::string strGoodbye = "!Hello";
  CMIUtilString strHello(strGoodbye.substr(1));
```

Also, it removes 2 ctors because they aren't needed:
# CMIUtilString::CMIUtilString(const char *const *vpData)
# CMIUtilString::CMIUtilString(const char *vpData, size_t nLen)
and cleans up CMIUtilString::operator=(const std::string &vrRhs).

Reviewers: brucem, abidh

Subscribers: lldb-commits, brucem, abidh

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

Modified:
lldb/trunk/tools/lldb-mi/MICmdArgContext.cpp
lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp
lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp
lldb/trunk/tools/lldb-mi/MICmdArgValThreadGrp.cpp
lldb/trunk/tools/lldb-mi/MICmdCmdData.cpp
lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
lldb/trunk/tools/lldb-mi/MICmdInterpreter.cpp
lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp
lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
lldb/trunk/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
lldb/trunk/tools/lldb-mi/MIDriver.cpp
lldb/trunk/tools/lldb-mi/MIUtilString.cpp
lldb/trunk/tools/lldb-mi/MIUtilString.h

Modified: lldb/trunk/tools/lldb-mi/MICmdArgContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgContext.cpp?rev=248566&r1=248565&r2=248566&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdArgContext.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgContext.cpp Fri Sep 25 03:28:58 2015
@@ -130,7 +130,7 @@ CMICmdArgContext::RemoveArg(const CMIUti
 }
 
 const size_t nPosEnd = nLen + nExtraSpace;
-m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.replace(nPos, nPosEnd, 
"").c_str();
+m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.replace(nPos, nPosEnd, "");
 m_strCmdArgsAndOptions = m_strCmdArgsAndOptions.Trim();
 
 return MIstatus::success;

Modified: lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp?rev=248566&r1=248565&r2=248566&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp Fri Sep 25 03:28:58 2015
@@ -261,7 +261,7 @@ CMICmdArgValOptionLong::IsArgLongOption(
 if (vrTxt.length() < 3)
 return false;
 
-const CMIUtilString strArg = vrTxt.substr(2).c_str();
+const CMIUtilString strArg = vrTxt.substr(2);
 if (strArg.IsNumber())
 return false;
 
@@ -293,7 +293,7 @@ CMICmdArgValOptionLong::IsArgOptionCorre
 bool
 CMICmdArgValOptionLong::ArgNameMatch(const CMIUtilString &vrTxt) const
 {
-const CMIUtilString strArg = vrTxt.substr(2).c_str();
+const CMIUtilString strArg = vrTxt.substr(2);
 return (strArg == GetName());
 }
 

Modified: lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp?rev=248566&r1=248565&r2=248566&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValOptionShort.cpp Fri Sep 25 03:28:58 2015
@@ -115,6 +115,6 @@ CMICmdArgValOptionShort::IsArgOptionCorr
 bool
 CMICmdArgValOptionShort::ArgNameMatch(const CMIUtilString &vrTxt) const
 {
-const CMIUtilString strArg = vrTxt.substr(1).c_str();
+const CMIUtilString strArg = vrTxt.substr(1);
 return (strArg == GetName());
 }

Modified: lldb/trunk/tools/lldb-mi/MICmdArgValThreadGrp.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValThreadGrp.cpp?rev=248566&r1=248565&r2=248566&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdArgValThreadGrp.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValThreadGrp.cpp Fri Sep 25 03:28:58 2015
@@ -121,7 +121,7 @@ CMICmdArgValThreadGrp::IsArgThreadGrp(co
 if (nPos != 0)
 return false;
 
-const CMIUtilString strNum = vrTxt.substr(1).c_str();
+const CMIUtilString strNum = vrTxt.substr(1);
 if (!strNum.IsNumber())
 return false;
 
@@ -139,7 +139,7 @@ CMICmdArgValThreadGrp::IsArgThreadGrp(co
 bool
 CMICmdArgValThreadGrp::ExtractNumber(const CMIUtilString &vrTxt)
 {
-

Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-09-25 Thread Ilia K via lldb-commits
ki.stfu added inline comments.


Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:191-193
@@ -182,1 +190,5 @@
 {
+CMIUtilString summary;
+if (TryGetValueSummary(summary))
+return summary;
+

evgeny777 wrote:
> ki.stfu wrote:
> > ```
> > const CMIUtilString summary = GetValueSummary();
> > if (!summary.empty())
> > return summary;
> > ```
> const CMIUtilString**&** summary = GetValueSummary();  ???
Yes, it's ok.


Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.h:58
@@ -57,3 +57,3 @@
 bool GetCompositeValue(const bool vbPrintFieldNames, CMICmnMIValueTuple 
&vwrMiValueTuple, const MIuint vnDepth = 1) const;
-
+bool TryGetValueSummary(CMIUtilString &vrValue) const;
 // Statics:

evgeny777 wrote:
> ki.stfu wrote:
> > It is better:
> > ```
> > CMIUtilString GetValueSummary(CMIUtilString &vrValue) const
> > ```
> Really?
> 
> Did you mean
> const  CMIUtilString& GetValueSummary(void) const ?
> 
> 
> 
Sorry, I mistyped.
```
CMIUtilString GetValueSummary() const
```


http://reviews.llvm.org/D13058



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


[Lldb-commits] [PATCH] D13162: Change oat symbolization code for android to work on non-rooted devices

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

Change oat symbolization code for android to work on non-rooted devices

On android when debugging an apk we run lldb-server as application user
because the sell user (on non-rooted device) can't attach to an
application. The problem is that "adb pull" will run as a shell user
what can't access to files created by lldb-server because they will be
owned by the application user. This CL changes the oat symbolization
code to run "oatdump --symbolize" to generate an output what is owned
by the shell user.

http://reviews.llvm.org/D13162

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

Index: source/Plugins/Platform/Android/PlatformAndroid.cpp
===
--- source/Plugins/Platform/Android/PlatformAndroid.cpp
+++ source/Plugins/Platform/Android/PlatformAndroid.cpp
@@ -325,33 +325,23 @@
 if (module_sp->GetSectionList()->FindSectionByName(ConstString(".symtab")) != nullptr)
 return Error("Symtab already available in the module");
 
-int status = 0;
-std::string tmpdir;
-StreamString command;
-command.Printf("mktemp --directory --tmpdir %s", GetWorkingDirectory().GetCString());
-Error error = RunShellCommand(command.GetData(),
-  GetWorkingDirectory(),
-  &status,
-  nullptr,
-  &tmpdir,
-  5 /* timeout (s) */);
+AdbClient adb(m_device_id);
 
-if (error.Fail() || status != 0 || tmpdir.empty())
+std::string tmpdir;
+Error error = adb.Shell("mktemp --directory --tmpdir /data/local/tmp", 5000 /* ms */, &tmpdir);
+if (error.Fail() || tmpdir.empty())
 return Error("Failed to generate temporary directory on the device (%s)", error.AsCString());
 tmpdir.erase(tmpdir.size() - 1); // Remove trailing new line
 
 // Create file remover for the temporary directory created on the device
 std::unique_ptr> tmpdir_remover(
 &tmpdir,
 [this](std::string* s) {
+AdbClient adb(m_device_id);
+
 StreamString command;
 command.Printf("rm -rf %s", s->c_str());
-Error error = this->RunShellCommand(command.GetData(),
-GetWorkingDirectory(),
-nullptr,
-nullptr,
-nullptr,
-5 /* timeout (s) */);
+Error error = adb.Shell(command.GetData(), 5000 /* ms */, nullptr);
 
 Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM));
 if (error.Fail())
@@ -363,17 +353,13 @@
 symfile_platform_filespec.AppendPathComponent("symbolized.oat");
 
 // Execute oatdump on the remote device to generate a file with symtab
-command.Clear();
+StreamString command;
 command.Printf("oatdump --symbolize=%s --output=%s",
module_sp->GetPlatformFileSpec().GetCString(false),
symfile_platform_filespec.GetCString(false));
-error = RunShellCommand(command.GetData(),
-GetWorkingDirectory(),
-&status,
-nullptr,
-nullptr,
-60 /* timeout (s) */);
-if (error.Fail() || status != 0)
+std::string output;
+error = adb.Shell(command.GetData(), 6 /* ms */, &output);
+if (error.Fail())
 return Error("Oatdump failed: %s", error.AsCString());
 
 // Download the symbolfile from the remote device
Index: source/Plugins/Platform/Android/AdbClient.h
===
--- source/Plugins/Platform/Android/AdbClient.h
+++ source/Plugins/Platform/Android/AdbClient.h
@@ -62,6 +62,9 @@
 Error
 Stat (const FileSpec &remote_file, uint32_t &mode, uint32_t &size, uint32_t &mtime);
 
+Error
+Shell (const char* command, uint32_t timeout_ms, std::string* output);
+
 private:
 Error
 Connect ();
@@ -85,6 +88,9 @@
 ReadMessage (std::vector &message);
 
 Error
+ReadMessageStream (std::vector &message, uint32_t timeout_ms);
+
+Error
 GetResponseError (const char *response_id);
 
 Error
Index: source/Plugins/Platform/Android/AdbClient.cpp
===
--- source/Plugins/Platform/Android/AdbClient.cpp
+++ source/Plugins/Platform/Android/AdbClient.cpp
@@ -12,6 +12,7 @@
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/DataEncoder.h"

[Lldb-commits] [lldb] r248571 - Eliminate a potential crash in the struct layout code with a gracefull fallback

2015-09-25 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Sep 25 07:50:51 2015
New Revision: 248571

URL: http://llvm.org/viewvc/llvm-project?rev=248571&view=rev
Log:
Eliminate a potential crash in the struct layout code with a gracefull fallback

Differential revision: http://reviews.llvm.org/D12963

Modified:
lldb/trunk/source/Expression/ClangASTSource.cpp

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=248571&r1=248570&r2=248571&view=diff
==
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Fri Sep 25 07:50:51 2015
@@ -1674,7 +1674,8 @@ ClangASTSource::layoutRecordType(const R
 
 ClangASTContext::GetCompleteDecl(&origin_record->getASTContext(), 
const_cast(origin_record.decl));
 
-if (!origin_record.decl->getDefinition())
+clang::RecordDecl* definition = origin_record.decl->getDefinition();
+if (!definition || !definition->isCompleteDefinition())
 return false;
 
 const ASTRecordLayout 
&record_layout(origin_record->getASTContext().getASTRecordLayout(origin_record.decl));


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


Re: [Lldb-commits] [PATCH] D12963: Eliminate a potential crash in the struct layout code with a gracefull fallback

2015-09-25 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL248571: Eliminate a potential crash in the struct layout 
code with a gracefull fallback (authored by tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D12963?vs=35084&id=35717#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12963

Files:
  lldb/trunk/source/Expression/ClangASTSource.cpp

Index: lldb/trunk/source/Expression/ClangASTSource.cpp
===
--- lldb/trunk/source/Expression/ClangASTSource.cpp
+++ lldb/trunk/source/Expression/ClangASTSource.cpp
@@ -1674,7 +1674,8 @@
 
 ClangASTContext::GetCompleteDecl(&origin_record->getASTContext(), 
const_cast(origin_record.decl));
 
-if (!origin_record.decl->getDefinition())
+clang::RecordDecl* definition = origin_record.decl->getDefinition();
+if (!definition || !definition->isCompleteDefinition())
 return false;
 
 const ASTRecordLayout 
&record_layout(origin_record->getASTContext().getASTRecordLayout(origin_record.decl));


Index: lldb/trunk/source/Expression/ClangASTSource.cpp
===
--- lldb/trunk/source/Expression/ClangASTSource.cpp
+++ lldb/trunk/source/Expression/ClangASTSource.cpp
@@ -1674,7 +1674,8 @@
 
 ClangASTContext::GetCompleteDecl(&origin_record->getASTContext(), const_cast(origin_record.decl));
 
-if (!origin_record.decl->getDefinition())
+clang::RecordDecl* definition = origin_record.decl->getDefinition();
+if (!definition || !definition->isCompleteDefinition())
 return false;
 
 const ASTRecordLayout &record_layout(origin_record->getASTContext().getASTRecordLayout(origin_record.decl));
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-09-25 Thread Eugene Leviant via lldb-commits
evgeny777 added inline comments.


Comment at: source/API/SBTypeSummary.cpp:290
@@ +289,3 @@
+bool
+SBTypeSummary::DoesPrintValue(const SBValue& value)
+{

ki.stfu wrote:
> ditto
I used clang-format with style file taken from lldb directory here, but 
formatting didn't change. So I'm curious what's the problem is


http://reviews.llvm.org/D13058



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


Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-09-25 Thread Eugene Leviant via lldb-commits
evgeny777 updated this revision to Diff 35725.
evgeny777 added a comment.

Revised with changes requested by ki.stfu


http://reviews.llvm.org/D13058

Files:
  include/lldb/API/SBTypeSummary.h
  source/API/SBTypeSummary.cpp
  test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py
  test/tools/lldb-mi/variable/TestMiVar.py
  test/tools/lldb-mi/variable/main.cpp
  tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
  tools/lldb-mi/MICmnLLDBUtilSBValue.h

Index: tools/lldb-mi/MICmnLLDBUtilSBValue.h
===
--- tools/lldb-mi/MICmnLLDBUtilSBValue.h
+++ tools/lldb-mi/MICmnLLDBUtilSBValue.h
@@ -55,7 +55,7 @@
 CMIUtilString GetSimpleValueCStringPointer() const;
 CMIUtilString GetSimpleValueCStringArray() const;
 bool GetCompositeValue(const bool vbPrintFieldNames, CMICmnMIValueTuple &vwrMiValueTuple, const MIuint vnDepth = 1) const;
-
+CMIUtilString GetValueSummary() const;
 // Statics:
   private:
 static bool IsCharBasicType(lldb::BasicType eType);
Index: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
===
--- tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
+++ tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
@@ -17,6 +17,7 @@
 #include "MICmnMIValueTuple.h"
 #include "MIUtilString.h"
 
+#include "lldb/API/SBTypeSummary.h"
 //++ 
 // Details: CMICmnLLDBUtilSBValue constructor.
 // Type:Method.
@@ -165,6 +166,14 @@
 return MIstatus::success;
 }
 }
+else
+{
+// Treat composite value which has registered summary
+// (for example with AddCXXSummary) as simple value
+vwrValue = GetValueSummary();
+if (!vwrValue.empty())
+return MIstatus::success;
+}
 
 // Composite variable type i.e. struct
 return MIstatus::failure;
@@ -180,6 +189,10 @@
 CMIUtilString
 CMICmnLLDBUtilSBValue::GetSimpleValueChar() const
 {
+const CMIUtilString& summary = GetValueSummary();
+if (!summary.empty())
+return summary;
+
 const uint64_t value = m_rValue.GetValueAsUnsigned();
 if (value == 0)
 {
@@ -227,6 +240,10 @@
 if (value == nullptr)
 return m_pUnkwn;
 
+const CMIUtilString& summary = GetValueSummary();
+if (!summary.empty())
+return summary;
+
 lldb::SBValue child = m_rValue.GetChildAtIndex(0);
 const lldb::BasicType eType = child.GetType().GetBasicType();
 switch (eType)
@@ -266,6 +283,10 @@
 CMIUtilString
 CMICmnLLDBUtilSBValue::GetSimpleValueCStringArray() const
 {
+const CMIUtilString& summary = GetValueSummary();
+if (!summary.empty())
+return summary;
+
 const MIuint nChildren = m_rValue.GetNumChildren();
 lldb::SBValue child = m_rValue.GetChildAtIndex(0);
 const lldb::BasicType eType = child.GetType().GetBasicType();
@@ -347,6 +368,30 @@
 return MIstatus::success;
 }
 
+CMIUtilString
+CMICmnLLDBUtilSBValue::GetValueSummary() const
+{
+CMIUtilString valSummary;
+if (m_rValue.IsValid())
+{
+const char *c_str = m_rValue.GetSummary();
+if (c_str && c_str[0])
+{
+valSummary = c_str;
+lldb::SBTypeSummary summary = m_rValue.GetTypeSummary();
+if (summary.IsValid() && summary.DoesPrintValue(m_rValue))
+{
+c_str = m_rValue.GetValue();
+if (c_str && c_str[0])
+{
+valSummary.insert(0, std::string(c_str) + " ");
+}
+}
+}
+}
+return valSummary;
+}
+
 //++ 
 // Details: Check that basic type is a char type. Char type can be signed or unsigned.
 // Type:Static.
Index: test/tools/lldb-mi/variable/main.cpp
===
--- test/tools/lldb-mi/variable/main.cpp
+++ test/tools/lldb-mi/variable/main.cpp
@@ -8,6 +8,7 @@
 //===--===//
 
 #include 
+#include 
 
 struct complex_type
 {
@@ -64,9 +65,21 @@
 const char32_t *u32p = U"\t\"hello\"\n";
 const char32_t u32a[] = U"\t\"hello\"\n";
 
+const char16_t* u16p_rus = u"\\Аламо-сквер";
+const char16_t  u16a_rus[] = u"\\Бейвью";
+const char32_t* u32p_rus = U"\\Чайнатаун";
+const char32_t  u32a_rus[] = U"\\Догпатч";
+
 // BP_gdb_set_show_print_char_array_as_string_test
 }
 
+void
+cpp_stl_types_test(void)
+{
+std::string std_string = "hello";
+// BP_cpp_stl_types_test
+}
+
 struct not_str
 {
 not_str(char _c, int _f)
@@ -105,6 +118,7 @@
 var_update_test();
 var_list_children_test();
 gdb_set_show_print_char_array_as_string_test();
+cpp_stl_types_test();
 gdb_set_show_print_expand_aggregates();
 gdb_set_show_print_aggregate_field_names();
 return 0; // BP_return
Index:

[Lldb-commits] [lldb] r248574 - Re-enable some skipped tests on FreeBSD

2015-09-25 Thread Ed Maste via lldb-commits
Author: emaste
Date: Fri Sep 25 10:36:30 2015
New Revision: 248574

URL: http://llvm.org/viewvc/llvm-project?rev=248574&view=rev
Log:
Re-enable some skipped tests on FreeBSD

These tests were skipped because they hung the old FreeBSD buildbot.
They pass (and do not hang) when run locally so enable them again.  We
will investigate further if they hang again once the new FreeBSD
buildbot is installed.

llvm.org/pr16684
llvm.org/pr18200
llvm.org/pr18230

Modified:
lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py
lldb/trunk/test/functionalities/register/TestRegisters.py

Modified: lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py?rev=248574&r1=248573&r2=248574&view=diff
==
--- lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py 
(original)
+++ lldb/trunk/test/functionalities/process_launch/TestProcessLaunch.py Fri Sep 
25 10:36:30 2015
@@ -125,7 +125,6 @@ class ProcessLaunchTestCase(TestBase):
 self.setTearDownCleanup(self.d)
 self.my_working_dir_test()
 
-@skipIfFreeBSD # llvm.org/pr16684
 @expectedFailureLinux("llvm.org/pr20265")
 @dwarf_test
 def test_set_working_dir_with_dwarf (self):

Modified: lldb/trunk/test/functionalities/register/TestRegisters.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/register/TestRegisters.py?rev=248574&r1=248573&r2=248574&view=diff
==
--- lldb/trunk/test/functionalities/register/TestRegisters.py (original)
+++ lldb/trunk/test/functionalities/register/TestRegisters.py Fri Sep 25 
10:36:30 2015
@@ -59,8 +59,6 @@ class RegisterCommandsTestCase(TestBase)
 self.buildDefault()
 self.convenience_registers()
 
-@skipIfFreeBSD # llvm.org/pr16684
-@expectedFailureFreeBSD("llvm.org/pr18200")
 def test_convenience_registers_with_process_attach(self):
 """Test convenience registers after a 'process attach'."""
 if not self.getArchitecture() in ['amd64', 'x86_64']:
@@ -68,8 +66,6 @@ class RegisterCommandsTestCase(TestBase)
 self.buildDefault()
 self.convenience_registers_with_process_attach(test_16bit_regs=False)
 
-@skipIfFreeBSD # llvm.org/pr18230
-@expectedFailureFreeBSD("llvm.org/pr18200")
 def test_convenience_registers_16bit_with_process_attach(self):
 """Test convenience registers after a 'process attach'."""
 if not self.getArchitecture() in ['amd64', 'x86_64']:


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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-25 Thread Zachary Turner via lldb-commits
+100, great :)  Once it's in it will be much more easy to press for others
to move their platform specific bits into this module, or to do it myself
when I'm writing platform specific stuff.

On Thu, Sep 24, 2015 at 9:56 PM Todd Fiala  wrote:

> tfiala added a comment.
>
> > That's a good idea. I'm (somewhat slowly) attempting to work in some
> clean up each time I touch it. I'll hit that at some point. I'll start
> winding down on changes to the test infrastructure soon-ish. If I don't hit
> that by the time I stop heavy changes, definitely feel free to jump on it!
>
>
> Okay, I couldn't help myself.  I'm taking a bit more time on this as I set
> it up much more nicely.  I'm pulling all the process management into
> another module and breaking out some platform-specific bits into a
> per-platform helper.
>
> I won't have something up until tomorrow later on at the earliest.
>
>
> http://reviews.llvm.org/D13124
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r248577 - Re-enable FreeBSD tests do not hang locally

2015-09-25 Thread Ed Maste via lldb-commits
Author: emaste
Date: Fri Sep 25 11:10:40 2015
New Revision: 248577

URL: http://llvm.org/viewvc/llvm-project?rev=248577&view=rev
Log:
Re-enable FreeBSD tests do not hang locally

These tests used to hang on the old FreeBSD buildbot, which has been
retired.  They do not hang when run locally, but do fail.

llvm.org/pr24939

Modified:
lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py

lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py

Modified: 
lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py?rev=248577&r1=248576&r2=248577&view=diff
==
--- lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py 
(original)
+++ lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py 
Fri Sep 25 11:10:40 2015
@@ -72,7 +72,7 @@ class CrashingInferiorTestCase(TestBase)
 self.buildDsym()
 self.inferior_crashing_step_after_break()
 
-@skipIfFreeBSD # llvm.org/pr16684
+@expectedFailureFreeBSD('llvm.org/pr24939')
 @expectedFailureWindows("llvm.org/pr24778")
 @expectedFailureAndroid(archs=['aarch64'], api_levels=range(21 + 1)) # No 
eh_frame for sa_restorer
 def test_inferior_crashing_step_after_break_dwarf(self):

Modified: 
lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py?rev=248577&r1=248576&r2=248577&view=diff
==
--- 
lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
 (original)
+++ 
lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
 Fri Sep 25 11:10:40 2015
@@ -72,7 +72,7 @@ class CrashingRecursiveInferiorTestCase(
 self.buildDsym()
 self.recursive_inferior_crashing_step_after_break()
 
-@skipIfFreeBSD # llvm.org/pr16684
+@expectedFailureFreeBSD('llvm.org/pr24939')
 @expectedFailureWindows("llvm.org/pr24778")
 @expectedFailureAndroid(archs=['aarch64'], api_levels=range(21 + 1)) # No 
eh_frame for sa_restorer
 def test_recursive_inferior_crashing_step_after_break_dwarf(self):


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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-25 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#253476, @zturner wrote:

> +100, great :)


:-)


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run

2015-09-25 Thread Kirill Lapshin via lldb-commits
KLapshin updated the summary for this revision.
KLapshin updated this revision to Diff 35740.
KLapshin added a comment.

Patch reworked for suggested "-exec-run --start" manner, no "CLI" interpreter 
use and check if --start option supported via -list-features.


Repository:
  rL LLVM

http://reviews.llvm.org/D12977

Files:
  test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
  tools/lldb-mi/MICmdCmdExec.cpp
  tools/lldb-mi/MICmdCmdExec.h
  tools/lldb-mi/MICmdCmdSupportList.cpp

Index: tools/lldb-mi/MICmdCmdExec.cpp
===
--- tools/lldb-mi/MICmdCmdExec.cpp
+++ tools/lldb-mi/MICmdCmdExec.cpp
@@ -48,6 +48,7 @@
 // Throws:  None.
 //--
 CMICmdCmdExecRun::CMICmdCmdExecRun()
+: m_constStrArgStart("start")
 {
 // Command factory matches this name with that received from the stdin stream
 m_strMiCmd = "exec-run";
@@ -68,6 +69,23 @@
 }
 
 //++ 
+// Details: The invoker requires this function. The parses the command line options
+//  arguments to extract values for each of those arguments.
+// Type:Overridden.
+// Args:None.
+// Return:  MIstatus::success - Functional succeeded.
+//  MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMICmdCmdExecRun::ParseArgs()
+{
+m_setCmdArgs.Add(
+new CMICmdArgValOptionLong(m_constStrArgStart, false, true, CMICmdArgValListBase::eArgValType_OptionLong, 0));
+return ParseValidateCmdOptions();
+}
+
+//++ 
 // Details: The invoker requires this function. The command does work in this function.
 //  The command is likely to communicate with the LLDB SBDebugger in here.
 // Type:Overridden.
@@ -84,6 +102,15 @@
 lldb::SBStream errMsg;
 lldb::SBLaunchInfo launchInfo = rSessionInfo.GetTarget().GetLaunchInfo();
 launchInfo.SetListener(rSessionInfo.GetListener());
+
+CMICMDBASE_GETOPTION(pArgStart, OptionLong, m_constStrArgStart);
+
+// Run to first instruction or main() requested ?
+if (pArgStart->GetFound())
+{
+launchInfo.SetLaunchFlags(launchInfo.GetLaunchFlags() | lldb::eLaunchFlagStopAtEntry);
+}
+
 lldb::SBProcess process = rSessionInfo.GetTarget().Launch(launchInfo, error);
 if ((!process.IsValid()) || (error.Fail()))
 {
Index: tools/lldb-mi/MICmdCmdExec.h
===
--- tools/lldb-mi/MICmdCmdExec.h
+++ tools/lldb-mi/MICmdCmdExec.h
@@ -55,6 +55,7 @@
 // From CMICmdInvoker::ICmd
 bool Execute() override;
 bool Acknowledge() override;
+bool ParseArgs() override;
 // From CMICmnBase
 /* dtor */ ~CMICmdCmdExecRun() override;
 
@@ -61,6 +62,7 @@
 // Attributes:
   private:
 lldb::SBCommandReturnObject m_lldbResult;
+const CMIUtilString m_constStrArgStart; // StopAtEntry - run to first instruction or main(), just run process if not specified
 };
 
 //++ 
Index: tools/lldb-mi/MICmdCmdSupportList.cpp
===
--- tools/lldb-mi/MICmdCmdSupportList.cpp
+++ tools/lldb-mi/MICmdCmdSupportList.cpp
@@ -71,8 +71,13 @@
 bool
 CMICmdCmdSupportListFeatures::Acknowledge()
 {
-const CMICmnMIValueConst miValueConst("data-read-memory-bytes");
-const CMICmnMIValueList miValueList(miValueConst);
+// Declare supported features here
+const CMICmnMIValueConst miValueConst1("data-read-memory-bytes");
+const CMICmnMIValueConst miValueConst2("exec-run-start-option");
+CMICmnMIValueList miValueList(true);
+// Some of features may depend on host or/and target, decide what to add below
+miValueList.Add(miValueConst1);
+miValueList.Add(miValueConst2);
 const CMICmnMIValueResult miValueResult("features", miValueList);
 const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done, miValueResult);
 m_miResultRecord = miRecordResult;
Index: test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
===
--- test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
+++ test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
@@ -12,6 +12,26 @@
 
 @lldbmi_test
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD # Failure presumably due to StopAtEntry most likely not implemented
+def test_lldbmi_gdb_set_process_stopatentry_on(self):
+"""Test that 'lldb-mi --interpreter' can stop at entry."""
+
+self.spawnLldbMi(args = None)
+
+# Load executable
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+# Test that program is stopped at entry
+sel

Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run

2015-09-25 Thread Kirill Lapshin via lldb-commits
KLapshin marked an inline comment as done.
KLapshin added a comment.

"CLI" intepreter not used in ExecRun handler in reworked patch.


Repository:
  rL LLVM

http://reviews.llvm.org/D12977



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


[Lldb-commits] [lldb] r248597 - [lldb-mi] Fix assignment operator in CMIUtilString

2015-09-25 Thread Dawn Perchik via lldb-commits
Author: dperchik
Date: Fri Sep 25 13:08:45 2015
New Revision: 248597

URL: http://llvm.org/viewvc/llvm-project?rev=248597&view=rev
Log:
[lldb-mi] Fix assignment operator in CMIUtilString

Fix assignment operator in CMIUtilString to not crash the debugger if it
is passed a NULL pointer, which can happen in code like the following:

SBValue val;
CMIUtilString s;
//...
s = val.GetSummary();

Patch from evgeny.levi...@gmail.com
Reviewed by: clayborg, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13094

Modified:
lldb/trunk/tools/lldb-mi/MIUtilString.cpp

Modified: lldb/trunk/tools/lldb-mi/MIUtilString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MIUtilString.cpp?rev=248597&r1=248596&r2=248597&view=diff
==
--- lldb/trunk/tools/lldb-mi/MIUtilString.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MIUtilString.cpp Fri Sep 25 13:08:45 2015
@@ -63,14 +63,7 @@ CMIUtilString::CMIUtilString(const std::
 //--
 CMIUtilString &CMIUtilString::operator=(const char *vpRhs)
 {
-if (*this == vpRhs)
-return *this;
-
-if (vpRhs != nullptr)
-{
-assign(vpRhs);
-}
-
+assign(vpRhs);
 return *this;
 }
 


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


Re: [Lldb-commits] [PATCH] D13094: LLDB-MI: Fix assignment operator in CMIUtilString

2015-09-25 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL248597: [lldb-mi] Fix assignment operator in CMIUtilString 
(authored by dperchik).

Changed prior to commit:
  http://reviews.llvm.org/D13094?vs=35620&id=35741#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13094

Files:
  lldb/trunk/tools/lldb-mi/MIUtilString.cpp

Index: lldb/trunk/tools/lldb-mi/MIUtilString.cpp
===
--- lldb/trunk/tools/lldb-mi/MIUtilString.cpp
+++ lldb/trunk/tools/lldb-mi/MIUtilString.cpp
@@ -63,14 +63,7 @@
 //--
 CMIUtilString &CMIUtilString::operator=(const char *vpRhs)
 {
-if (*this == vpRhs)
-return *this;
-
-if (vpRhs != nullptr)
-{
-assign(vpRhs);
-}
-
+assign(vpRhs);
 return *this;
 }
 


Index: lldb/trunk/tools/lldb-mi/MIUtilString.cpp
===
--- lldb/trunk/tools/lldb-mi/MIUtilString.cpp
+++ lldb/trunk/tools/lldb-mi/MIUtilString.cpp
@@ -63,14 +63,7 @@
 //--
 CMIUtilString &CMIUtilString::operator=(const char *vpRhs)
 {
-if (*this == vpRhs)
-return *this;
-
-if (vpRhs != nullptr)
-{
-assign(vpRhs);
-}
-
+assign(vpRhs);
 return *this;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r248601 - Add comment in StringExtractor::GetHexU8

2015-09-25 Thread Dawn Perchik via lldb-commits
Author: dperchik
Date: Fri Sep 25 13:23:50 2015
New Revision: 248601

URL: http://llvm.org/viewvc/llvm-project?rev=248601&view=rev
Log:
Add comment in StringExtractor::GetHexU8

Modified:
lldb/trunk/source/Utility/StringExtractor.cpp

Modified: lldb/trunk/source/Utility/StringExtractor.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/StringExtractor.cpp?rev=248601&r1=248600&r2=248601&view=diff
==
--- lldb/trunk/source/Utility/StringExtractor.cpp (original)
+++ lldb/trunk/source/Utility/StringExtractor.cpp Fri Sep 25 13:23:50 2015
@@ -120,11 +120,13 @@ StringExtractor::DecodeHexU8()
 
 //--
 // Extract an unsigned character from two hex ASCII chars in the packet
-// string
+// string, or return fail_value on failure
 //--
 uint8_t
 StringExtractor::GetHexU8 (uint8_t fail_value, bool set_eof_on_fail)
 {
+// On success, fail_value will be overwritten with the next
+// character in the stream
 GetHexU8Ex(fail_value, set_eof_on_fail);
 return fail_value;
 }


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


Re: [Lldb-commits] [PATCH] D13162: Change oat symbolization code for android to work on non-rooted devices

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

Minor comments



Comment at: source/Plugins/Platform/Android/AdbClient.cpp:231
@@ +230,3 @@
+
+size_t n = m_conn.Read(buffer, sizeof(buffer), 1000 * (timeout_ms - 
elapsed_time), status, &error);
+message.insert(message.end(), &buffer[0], &buffer[n]);

Could you add checks for error and that n > 0?


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:340
@@ -346,1 +339,3 @@
 [this](std::string* s) {
+AdbClient adb(m_device_id);
+

Could you reuse adb variable defined before - e.g., wrap with shared_ptr? 


Comment at: source/Plugins/Platform/Android/PlatformAndroid.cpp:361
@@ +360,3 @@
+std::string output;
+error = adb.Shell(command.GetData(), 6 /* ms */, &output);
+if (error.Fail())

s/&output/nullptr ?


http://reviews.llvm.org/D13162



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


Re: [Lldb-commits] [PATCH] D12977: LLDB MI addition for getting process stopped at first instruction right after launch via -exec-run

2015-09-25 Thread Dawn Perchik via lldb-commits
dawn accepted this revision.
dawn added a comment.

lgtm.  Much improved.



Comment at: tools/lldb-mi/MICmdCmdSupportList.cpp:78
@@ +77,3 @@
+CMICmnMIValueList miValueList(true);
+// Some of features may depend on host or/and target, decide what to add 
below
+miValueList.Add(miValueConst1);

Fix comment: Some of features => Some features


Repository:
  rL LLVM

http://reviews.llvm.org/D12977



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


[Lldb-commits] [lldb] r248631 - Moved ClangExpressionHelper.h into the Clang expression parser plug-in.

2015-09-25 Thread Sean Callanan via lldb-commits
Author: spyffe
Date: Fri Sep 25 17:47:07 2015
New Revision: 248631

URL: http://llvm.org/viewvc/llvm-project?rev=248631&view=rev
Log:
Moved ClangExpressionHelper.h into the Clang expression parser plug-in.

Added:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
  - copied unchanged from r248629, 
lldb/trunk/include/lldb/Expression/ClangExpressionHelper.h
Removed:
lldb/trunk/include/lldb/Expression/ClangExpressionHelper.h
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h

Removed: lldb/trunk/include/lldb/Expression/ClangExpressionHelper.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionHelper.h?rev=248630&view=auto
==
--- lldb/trunk/include/lldb/Expression/ClangExpressionHelper.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionHelper.h (removed)
@@ -1,79 +0,0 @@
-//===-- ClangExpression.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_ClangExpression_h_
-#define liblldb_ClangExpression_h_
-
-// C Includes
-// C++ Includes
-#include 
-#include 
-#include 
-
-// Other libraries and framework includes
-// Project includes
-
-#include "lldb/lldb-forward.h"
-#include "lldb/lldb-private.h"
-#include "lldb/Core/ClangForward.h"
-#include "lldb/Expression/ExpressionTypeSystemHelper.h"
-
-namespace lldb_private {
-
-class RecordingMemoryManager;
-
-//--
-// ClangExpressionHelper
-//--
-class ClangExpressionHelper : public ExpressionTypeSystemHelper
-{
-public:
-static bool classof(const ExpressionTypeSystemHelper *ts)
-{
-return ts->getKind() == eKindClangHelper;
-}
-
-ClangExpressionHelper () :
-
ExpressionTypeSystemHelper(ExpressionTypeSystemHelper::LLVMCastKind::eKindClangHelper)
-{
-}
-
-//--
-/// Destructor
-//--
-virtual ~ClangExpressionHelper ()
-{
-}
-
-//--
-/// Return the object that the parser should use when resolving external
-/// values.  May be NULL if everything should be self-contained.
-//--
-virtual ClangExpressionDeclMap *
-DeclMap () = 0;
-
-//--
-/// Return the object that the parser should allow to access ASTs.
-/// May be NULL if the ASTs do not need to be transformed.
-///
-/// @param[in] passthrough
-/// The ASTConsumer that the returned transformer should send
-/// the ASTs to after transformation.
-//--
-virtual clang::ASTConsumer *
-ASTTransformer (clang::ASTConsumer *passthrough) = 0;
-
-
-protected:
-
-};
-
-} // namespace lldb_private
-
-#endif  // liblldb_ClangExpression_h_

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=248631&r1=248630&r2=248631&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Sep 25 17:47:07 2015
@@ -1880,7 +1880,7 @@
26BC7D8410F1B77400F91463 /* ValueObjectList.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
ValueObjectList.h; path = include/lldb/Core/ValueObjectList.h; sourceTree = 
""; };
26BC7D8510F1B77400F91463 /* ValueObjectVariable.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
ValueObjectVariable.h; path = include/lldb/Core/ValueObjectVariable.h; 
sourceTree = ""; };
26BC7D8610F1B77400F91463 /* VMRange.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
VMRange.h; path = include/lldb/Core/VMRange.h; sourceTree = ""; };
-   26BC7DC010F1B79500F91463 /* ClangExpressionHelper.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
ClangExpressionHelper.h; path = 
include/lldb/Expression/ClangExpressionHelper.h; sourceTree = "

Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-25 Thread Todd Fiala via lldb-commits
tfiala updated this revision to Diff 35788.
tfiala added a comment.

Work in progess.

This patch is working and timing out consistently on Linux (on a Jenkins bot), 
and is running normally on OS X.  I haven't coerced a timeout on OS X yet.

I'll be adding some tests for the timeout and core generation, and plan to add 
a --no-core-for-timeout option since I don't think that is universally 
desirable.  (Right now it always attempts to generates cores via SIGQUIT on 
Posix-like systems, but the code is there to do a SIGTERM instead if no cores 
are desired.  I just haven't hooked it up).

Zachary, you can see what I've got in place on the Windows side.  If you know 
some of that is wrong, feel free to let me now ahead of time and I can change 
it.

Hope to get those tests in tonight and have a formal "eval this patch" setup.


http://reviews.llvm.org/D13124

Files:
  test/dosep.py
  test/lldb_utils.py
  test/process_control.py

Index: test/process_control.py
===
--- /dev/null
+++ test/process_control.py
@@ -0,0 +1,474 @@
+"""
+The LLVM Compiler Infrastructure
+
+This file is distributed under the University of Illinois Open Source
+License. See LICENSE.TXT for details.
+
+Provides classes used by the test results reporting infrastructure
+within the LLDB test suite.
+
+
+This module provides process-management support for the LLDB test
+running infrasructure.
+"""
+
+# System imports
+import os
+import re
+import signal
+import subprocess
+import sys
+import threading
+
+
+class CommunicatorThread(threading.Thread):
+"""Provides a thread class that communicates with a subprocess."""
+def __init__(self, process, event, output_file):
+super(CommunicatorThread, self).__init__()
+# Don't let this thread prevent shutdown.
+self.daemon = True
+self.process = process
+self.pid = process.pid
+self.event = event
+self.output_file = output_file
+self.output = None
+
+def run(self):
+try:
+# Communicate with the child process.
+# This will not complete until the child process terminates.
+self.output = self.process.communicate()
+except Exception as exception:  # pylint: disable=broad-except
+if self.output_file:
+self.output_file.write(
+"exception while using communicate() for pid: {}\n".format(
+exception))
+finally:
+# Signal that the thread's run is complete.
+self.event.set()
+
+
+# Provides a regular expression for matching gtimeout-based durations.
+TIMEOUT_REGEX = re.compile(r"(^\d+)([smhd])?$")
+
+
+def timeout_to_seconds(timeout):
+"""Converts timeout/gtimeout timeout values into seconds.
+
+@param timeout a timeout in the form of xm representing x minutes.
+
+@return None if timeout is None, or the number of seconds as a float
+if a valid timeout format was specified.
+"""
+if timeout is None:
+return None
+else:
+match = TIMEOUT_REGEX.match(timeout)
+if match:
+value = float(match.group(1))
+units = match.group(2)
+if units is None:
+# default is seconds.  No conversion necessary.
+return value
+elif units == 's':
+# Seconds.  No conversion necessary.
+return value
+elif units == 'm':
+# Value is in minutes.
+return 60.0 * value
+elif units == 'h':
+# Value is in hours.
+return (60.0 * 60.0) * value
+elif units == 'd':
+# Value is in days.
+return 24 * (60.0 * 60.0) * value
+else:
+raise Exception("unexpected units value '{}'".format(units))
+else:
+raise Exception("could not parse TIMEOUT spec '{}'".format(
+timeout))
+
+
+class ProcessHelper(object):
+"""Provides an interface for accessing process-related functionality.
+
+This class provides a factory method that gives the caller a
+platform-specific implementation instance of the class.
+
+Clients of the class should stick to the methods provided in this
+base class.
+
+@see ProcessHelper.process_helper()
+"""
+def __init__(self):
+super(ProcessHelper, self).__init__()
+
+@classmethod
+def process_helper(cls):
+"""Returns a platform-specific ProcessHelper instance.
+@return a ProcessHelper instance that does the right thing for
+the current platform.
+"""
+if os.name == "nt":
+return WindowsProcessHelper()
+else:
+return UnixProcessHelper()
+
+def create_piped_process(self, command, new_process_group=True):
+# pylint: disable=no-self-use,unused-argument
+# As expected. 

Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-25 Thread Todd Fiala via lldb-commits
tfiala added inline comments.


Comment at: test/dosep.py:245
@@ +244,3 @@
+# binary should have called the results-generation code.
+raise Exception("no test results were generated whatsoever")
+return process_driver.results

This message should include the filename.


Comment at: test/process_control.py:273
@@ +272,3 @@
+
+def create_piped_process(self, command, new_process_group=True):
+if new_process_group:

This will want to store the popen_process.using_process_groups property like I 
do on the Posix side if the terminate would do something different based on the 
presence or absence of using process groups.  Oversight for not storing.


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-25 Thread Zachary Turner via lldb-commits
I won't be able to have a serious look until Monday, as I'm still remote.
Hopefully you arent working on weekends :)

On Fri, Sep 25, 2015 at 6:30 PM Todd Fiala  wrote:

> tfiala added inline comments.
>
> 
> Comment at: test/dosep.py:245
> @@ +244,3 @@
> +# binary should have called the results-generation code.
> +raise Exception("no test results were generated whatsoever")
> +return process_driver.results
> 
> This message should include the filename.
>
> 
> Comment at: test/process_control.py:273
> @@ +272,3 @@
> +
> +def create_piped_process(self, command, new_process_group=True):
> +if new_process_group:
> 
> This will want to store the popen_process.using_process_groups property
> like I do on the Posix side if the terminate would do something different
> based on the presence or absence of using process groups.  Oversight for
> not storing.
>
>
> http://reviews.llvm.org/D13124
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13056: Fix race condition during process detach

2015-09-25 Thread Oleksiy Vyalov via lldb-commits
ovyalov added a subscriber: ovyalov.
ovyalov added a comment.

It looks like this CL is introducing additional latency when destroying process 
- I noticed 10 seconds delay when destroying Android process and got logs for 
code with this CL and without:

1443231085.125153000 Process::StopForDestroyOrDetach() About to stop.
1443231085.125225000 Process::WaitForProcessToStop (timeout = 0x7fa9fb5fab28)
1443231085.125243000 Process::WaitForStateChangedEvents (timeout = 
0x7fa9fb5fab28, event_sp)...
1443231085.125284000 Process::RunPrivateStateThread (arg = 0x7fa9ec38d470, pid 
= 20579) woke up with an interrupt - Halting.
1443231085.137527000 Process::SetPrivateState (stopped)
1443231085.137569000 Process::SetPrivateState (stopped) stop_id = 13
1443231085.137646000 Process::WaitForEventsPrivate (timeout = (nil), 
event_sp)...
1443231085.13909 Process::ShouldBroadcastEvent (0x7fa9e4003a10) stopped due 
to an interrupt, state: stopped
1443231085.139159000 Process::ShouldBroadcastEvent (0x7fa9e4003a10) => new 
state: stopped, last broadcast state: stopped - YES
1443231085.139166000 Process::HandlePrivateEvent (pid = 20579) broadcasting new 
state stopped (old state running) to public
1443231085.139184000 Process::WaitForEventsPrivate (timeout = (nil), 
event_sp)...
1443231085.139267000 Process::SetPublicState (state = stopped, restarted = 0)
1443231085.139336000 Process::SetPublicState (stopped) -- unlocking run lock
1443231095.125328000 Process::WaitForStateChangedEvents (timeout = 
0x7fa9fb5fab28, event_sp) => invalid
1443231095.125507000 Process::StopForDestroyOrDetach() failed to stop, state 
is: invalid




1443231549.351362000 Process::HaltForDestroyOrDetach() About to halt.
1443231549.36446 Process::SetPrivateState (stopped)
1443231549.364475000 Process::SetPrivateState (stopped) stop_id = 13
1443231549.364499000 Process::WaitForProcessToStop (timeout = 0x7f4f34ff6b18)
1443231549.364508000 Process::WaitForStateChangedEvents (timeout = 
0x7f4f34ff6b18, event_sp)...
1443231549.364973000 Process::ShouldBroadcastEvent (0x7f4f1c002150) stopped due 
to an interrupt, state: stopped
1443231549.36504 Process::ShouldBroadcastEvent (0x7f4f1c002150) => new 
state: stopped, last broadcast state: stopped - YES
1443231549.365046000 Process::HandlePrivateEvent (pid = 20768) broadcasting new 
state stopped (old state running) to public
1443231549.365062000 Process::WaitForEventsPrivate (timeout = (nil), 
event_sp)...
1443231549.365095000 Process::SetPublicState (state = stopped, restarted = 0)
1443231549.365117000 Process::SetPublicState (stopped) -- unlocking run lock
1443231550.364602000 Process::WaitForStateChangedEvents (timeout = 
0x7f4f34ff6b18, event_sp) => invalid
1443231550.364682000 Process::HaltForDestroyOrDetach() Halt failed to stop, 
state is: invalid

So, I believe there is still a problem with stopped state delivery within 
WaitForProcessToStop which should be fixed in long-term. As quick workaround we 
can either revert this CL or reduce timeout to avoid 10 second delay upon 
process termination.


Repository:
  rL LLVM

http://reviews.llvm.org/D13056



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


Re: [Lldb-commits] [PATCH] D13124: test runner: switch to pure-Python timeout mechanism

2015-09-25 Thread Todd Fiala via lldb-commits
tfiala added a comment.

In http://reviews.llvm.org/D13124#254082, @zturner wrote:

> I won't be able to have a serious look until Monday, as I'm still remote.


Oh no worries.

> Hopefully you arent working on weekends :)


:-P


http://reviews.llvm.org/D13124



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


Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-09-25 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.

lgtm


http://reviews.llvm.org/D13058



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


Re: [Lldb-commits] [PATCH] D13058: LLDB-MI: Bug when evaluating strings containing characters from non-ascii range

2015-09-25 Thread Ilia K via lldb-commits
ki.stfu added a comment.

But you still should get lgtm from @clayborg and @granata.enrico before landing.


http://reviews.llvm.org/D13058



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