[Lldb-commits] [lldb] r299417 - Enable lldm-mi commands -stack-list-locals -stack-list-variables and -var-create to work only with variables in scope

2017-04-04 Thread Ilia K via lldb-commits
Author: ki.stfu
Date: Tue Apr  4 03:00:28 2017
New Revision: 299417

URL: http://llvm.org/viewvc/llvm-project?rev=299417&view=rev
Log:
Enable lldm-mi commands -stack-list-locals -stack-list-variables and 
-var-create to work only with variables in scope

Patch by ayuckhulk

Reviewers: abidh, lldb-commits, ki.stfu

Reviewed By: ki.stfu

Tags: #lldb

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


Added:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/Makefile

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/TestMiLexicalScope.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/main.cpp
Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdStack.cpp
lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/Makefile?rev=299417&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/Makefile 
(added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/Makefile 
Tue Apr  4 03:00:28 2017
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/TestMiLexicalScope.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/TestMiLexicalScope.py?rev=299417&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/TestMiLexicalScope.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/TestMiLexicalScope.py
 Tue Apr  4 03:00:28 2017
@@ -0,0 +1,68 @@
+"""
+Test lldb-mi -stack-list-locals -stack-list-variables and -var-create commands
+for variables with the same name in sibling lexical scopes.
+"""
+
+from __future__ import print_function
+
+
+import lldbmi_testcase
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MiLexicalScopeTestCase(lldbmi_testcase.MiTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
+@skipIfRemote   # We do not currently support remote debugging via the MI.
+def test_lldbmi_var_create_in_sibling_scope(self):
+"""Test that 'lldb-mi --interpreter' works with sibling lexical 
scopes."""
+
+self.spawnLldbMi(args=None)
+
+# Load executable
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+# Breakpoint inside first scope
+line = line_number('main.cpp', '// BP_first')
+self.runCmd("-break-insert --file main.cpp:%d" % line)
+self.expect("\^done,bkpt={number=\"\d+\"")
+
+# Breakpoint inside second scope
+line = line_number('main.cpp', '// BP_second')
+self.runCmd("-break-insert --file main.cpp:%d" % line)
+self.expect("\^done,bkpt={number=\"\d+\"")
+
+# Run to the first scope
+self.runCmd("-exec-run")
+self.expect("\^running")
+self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+# Check that only variables a and b exist with expected values
+self.runCmd("-stack-list-locals --thread 1 --frame 0 --all-values")
+
self.expect("\^done,locals=\[{name=\"a\",value=\"1\"},{name=\"b\",value=\"2\"}\]")
+
+# Create variable object for local variable b
+self.runCmd("-var-create - * \"b\"")
+self.expect(
+
"\^done,name=\"var\d+\",numchild=\"0\",value=\"2\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+
+# Run to the second scope
+self.runCmd("-exec-continue")
+self.expect("\^running")
+self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+# Check that only variables a and b exist with expected values,
+# but variable b is different from previous breakpoint
+self.runCmd("-stack-list-variables --thread 1 --frame 0 --all-values")
+
self.expect("\^done,variables=\[{name=\"a\",value=\"1\"},{name=\"b\",value=\"3\"}\]")
+
+# Create variable object for local variable b
+self.runCmd("-var-create - * \"b\"")
+self.expect(
+
"\^done,name=\"var\d+\",numchild=\"0\",value=\"3\",type=\"short\",thread-id=\"1\",has_more=\"0\"")

Added: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lexical_scope/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages

[Lldb-commits] [PATCH] D25486: Fix lookup path for lldb-mi

2016-10-11 Thread Ilia K via lldb-commits
ki.stfu added inline comments.



Comment at: packages/Python/lldbsuite/test/dotest.py:676-677
 # If not found, disable the lldb-mi tests
-lldbMiExec = None
-if lldbtest_config.lldbExec and is_exe(lldbtest_config.lldbExec + "-mi"):
-lldbMiExec = lldbtest_config.lldbExec + "-mi"
-if not lldbMiExec:
+lldbDir = os.path.dirname(lldbtest_config.lldbExec)
+lldbMiExec = os.path.join(lldbDir, "lldb-mi")
+if is_exe(lldbMiExec):

Maybe it would be better to replace "lldb" with "lldb-mi" in 
lldbtest_config.lldbExec? So we will take into account their versions instead 
of ignoring them.


https://reviews.llvm.org/D25486



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


[Lldb-commits] [PATCH] D25592: [LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class

2016-10-13 Thread Ilia K via lldb-commits
ki.stfu requested changes to this revision.
ki.stfu added inline comments.
This revision now requires changes to proceed.



Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:21-22
 
+static const char *kUnknownValue = "??";
+static const char *kCompositeValuePlaceholder = "{...}";
+

use unnamed namespace here



Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:22
+static const char *kUnknownValue = "??";
+static const char *kCompositeValuePlaceholder = "{...}";
+

I dislike Placeholder suffix because the previous one is also a placeholder for 
unknown values. How about renaming to 
kUnresolvedValue/kUnresolvedCompositeValue?


Repository:
  rL LLVM

https://reviews.llvm.org/D25592



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


[Lldb-commits] [PATCH] D25592: [LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class

2016-10-14 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added inline comments.
This revision is now accepted and ready to land.



Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:21-22
 
+static const char *kUnknownValue = "??";
+static const char *kCompositeValuePlaceholder = "{...}";
+

enlight wrote:
> ki.stfu wrote:
> > use unnamed namespace here
> I would like to use an anonymous namespace but the [[ 
> http://llvm.org/docs/CodingStandards.html#anonymous-namespaces | LLVM coding 
> standards ]] say
> 
> > make anonymous namespaces as small as possible, and only use them for class 
> > declarations
> 
> I don't really buy their reasoning, but we are supposed to be following their 
> style now aren't we?
> 
> kUnresolvedValue/kUnresolvedCompositeValue does sound better, I'll rename 
> them.
Okay, we have to follow the coding style. 



Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:22
+static const char *kUnknownValue = "??";
+static const char *kCompositeValuePlaceholder = "{...}";
+

ki.stfu wrote:
> I dislike Placeholder suffix because the previous one is also a placeholder 
> for unknown values. How about renaming to 
> kUnresolvedValue/kUnresolvedCompositeValue?
Actually I like kUnknownValue and I meant to rename the second one only. But it 
looks good to me also. 


Repository:
  rL LLVM

https://reviews.llvm.org/D25592



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


[Lldb-commits] [PATCH] D25592: [LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class

2016-10-14 Thread Ilia K via lldb-commits
ki.stfu requested changes to this revision.
ki.stfu added inline comments.
This revision now requires changes to proceed.



Comment at: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp:116
   if (!bOk)
-return m_pUnkwn;
+return kUnresolvedValue;
 

After couple of minutes I see the lack of logic there: the value is still 
composite but we return kUnresolvedValue instead of kUnresolvedCompositeValue.

I think we have to rename kUnresolvedValue back to kUnknownValue.


Repository:
  rL LLVM

https://reviews.llvm.org/D25592



___
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-30 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.

lgtm



Comment at: test/tools/lldb-mi/control/TestMiExec.py:16
@@ +15,3 @@
+@skipIfFreeBSD # Failure presumably due to StopAtEntry most likely not 
implemented
+@expectedFailureAll("llvm.org/pr25000", oslist=["linux"])
+def test_lldbmi_exec_run(self):

KLapshin wrote:
> It looks like lldb-mi didn't received SIGSTOP evbent on Linux platform 
> because event was not rebroadcasted because "Process::WaitForProcessToStop 
> (timeout = (nil))
> Process::WaitForProcessToStop returning without waiting for events; process 
> private and public states are already 'stopped'.
> " - see full log (process, event channel) attached to llvm.org/pr25000 bug.
just use
```
@expectedFailureLinux # llvm.org/pr25000: lldb-mi does not receive broadcasted 
notification from Core/Process about process stopped ...
```


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


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

2015-10-02 Thread Ilia K via lldb-commits
ki.stfu added a comment.

In http://reviews.llvm.org/D13058#258903, @dawn wrote:

> This patch is good to commit now right?  It's not marked "accepted" for some 
> reason.


It's not "accepted" because @clayborg rejected this CL and hasn't changed his 
decision. But I think he doesn't mind if you will go ahead.


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] D14060: Deprecate -m/+m dotest options in favor of test categories

2015-10-26 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.
This revision is now accepted and ready to land.

lgtm


http://reviews.llvm.org/D14060



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


Re: [Lldb-commits] [PATCH] D14177: Better handle the arguments common to all MI commands.

2015-10-29 Thread Ilia K via lldb-commits
ki.stfu added inline comments.


Comment at: tools/lldb-mi/MICmdBase.h:68
@@ -67,2 +67,3 @@
 virtual MIuint GetGUID();
+void ParseCommonArgs();
 

How about renaming it to AddCommonArgs and making it protected?


Comment at: tools/lldb-mi/MICmdInvoker.cpp:192
@@ -191,3 +191,3 @@
 
-if (bOk && !vCmd.ParseArgs())
+if(bOk)
 {

nic: add a space please


http://reviews.llvm.org/D14177



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


Re: [Lldb-commits] [PATCH] D14177: Better handle the arguments common to all MI commands.

2015-10-29 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.
This revision is now accepted and ready to land.

LGTM



Comment at: tools/lldb-mi/MICmdBase.h:68
@@ -67,2 +67,3 @@
 virtual MIuint GetGUID();
+void AddCommonArgs();
 

abidh wrote:
> Changed name. But it cant be protected as it is called from the outside.
OK


http://reviews.llvm.org/D14177



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


Re: [Lldb-commits] [PATCH] D14197: Handle the options and parameters separator in every MI command

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


Comment at: tools/lldb-mi/MICmdBase.cpp:102
@@ -99,2 +101,3 @@
 m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgFrame, 
m_FrameArgMandatory, true, CMICmdArgValListBase::eArgValType_Number, 1));
+m_setCmdArgs.Add(new CMICmdArgValConsume(m_constStrArgConsume, false));
 }

The -data-disassemble command has '--' mandatory argument, but now it's always 
optional argument. Should it use m_ConsumeArgMandatory as it works for 
--thread/--frame etc?


Comment at: tools/lldb-mi/MICmdCmdData.cpp:280
@@ -279,3 +278,2 @@
 new CMICmdArgValOptionShort(m_constStrArgAddrEnd, true, true, 
CMICmdArgValListBase::eArgValType_StringQuotedNumber, 1));
-m_setCmdArgs.Add(new CMICmdArgValConsume(m_constStrArgConsume, true));
 m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgMode, true, true));

Please expand MiDataTestCase.test_lldbmi_data_disassemble test to check that it 
still gives an error without '--' argument.


http://reviews.llvm.org/D14197



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


Re: [Lldb-commits] [PATCH] D14197: Handle the options and parameters separator in every MI command

2015-11-02 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.
This revision is now accepted and ready to land.

lgtm



Comment at: tools/lldb-mi/MICmdBase.cpp:102
@@ -99,2 +101,3 @@
 m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgFrame, 
m_FrameArgMandatory, true, CMICmdArgValListBase::eArgValType_Number, 1));
+m_setCmdArgs.Add(new CMICmdArgValConsume(m_constStrArgConsume, false));
 }

Well, I thought it's mandatory argument according to its spec: 
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Data-Manipulation.html
```
  -data-disassemble
 [ -s start-addr -e end-addr ]
   | [ -f filename -l linenum [ -n lines ] ]
   -- mode
```

But I think we can follow to the GDB syntax.


Comment at: tools/lldb-mi/MICmdCmdData.cpp:280
@@ -279,3 +278,2 @@
 new CMICmdArgValOptionShort(m_constStrArgAddrEnd, true, true, 
CMICmdArgValListBase::eArgValType_StringQuotedNumber, 1));
-m_setCmdArgs.Add(new CMICmdArgValConsume(m_constStrArgConsume, true));
 m_setCmdArgs.Add(new CMICmdArgValNumber(m_constStrArgMode, true, true));

ok, thanks.


http://reviews.llvm.org/D14197



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


Re: [Lldb-commits] [PATCH] D14197: Handle the options and parameters separator in every MI command

2015-11-02 Thread Ilia K via lldb-commits
ki.stfu added inline comments.


Comment at: tools/lldb-mi/MICmdBase.cpp:102
@@ -99,2 +101,3 @@
 m_setCmdArgs.Add(new CMICmdArgValOptionLong(m_constStrArgFrame, 
m_FrameArgMandatory, true, CMICmdArgValListBase::eArgValType_Number, 1));
+m_setCmdArgs.Add(new CMICmdArgValConsume(m_constStrArgConsume, false));
 }

abidh wrote:
> ki.stfu wrote:
> > Well, I thought it's mandatory argument according to its spec: 
> > https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Data-Manipulation.html
> > ```
> >   -data-disassemble
> >  [ -s start-addr -e end-addr ]
> >| [ -f filename -l linenum [ -n lines ] ]
> >-- mode
> > ```
> > 
> > But I think we can follow to the GDB syntax.
> If you read the following, you will see that "--" is not mandatory. It says 
> "Options occur first in the parameter list and can be delimited from normal 
> parameters using ‘--’ (this is useful when some parameters begin with a 
> dash)."
> 
> https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Input-Syntax.html#GDB_002fMI-Input-Syntax
As for me, it says that dashes aren't mandatory in general cases (i.e. unless 
otherwise specified in command's spec). In case of -data-disassemble, we know 
that `mode` is either 0, 1, 2, or 3, and therefore according to your [[ 
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Input-Syntax.html#GDB_002fMI-Input-Syntax
 | link ]], the syntax would be:
```
-data-disassemble [ -s start-addr -e end-addr ] | [ -f filename -l linenum [ -n 
lines ] ] [--] mode
```
(i.e. "--" is optional)

But the [[ 
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Data-Manipulation.html | 
spec ]] says that '--' is mandatory argument and I perceive it as a special 
case of usage '--'. Therefore I supposed that it's mandatory argument.


http://reviews.llvm.org/D14197



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


Re: [Lldb-commits] [PATCH] D21757: Fix lldb-mi disable/enable breakpoints commands

2016-07-13 Thread Ilia K via lldb-commits
ki.stfu added a comment.

Hi Chuck! Sorry for delay, didn't see this CL. I'll check it tomorrow, so pls 
wait one more day.


Repository:
  rL LLVM

http://reviews.llvm.org/D21757



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


Re: [Lldb-commits] [PATCH] D21757: Fix lldb-mi disable/enable breakpoints commands

2016-07-14 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.

@faxue, thank you for your patch! The fixes look good, but if you don't mind I 
gonna improve your tests. After that I'll commit this patch.


Repository:
  rL LLVM

http://reviews.llvm.org/D21757



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


Re: [Lldb-commits] [PATCH] D21757: Fix lldb-mi disable/enable breakpoints commands

2016-07-14 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 63928.
ki.stfu added a comment.

add checks for =breakpoint-modified


http://reviews.llvm.org/D21757

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
  tools/lldb-mi/MICmdCmdBreak.cpp

Index: tools/lldb-mi/MICmdCmdBreak.cpp
===
--- tools/lldb-mi/MICmdCmdBreak.cpp
+++ tools/lldb-mi/MICmdCmdBreak.cpp
@@ -568,19 +568,9 @@
 {
 if (m_bBrkPtDisabledOk)
 {
-const CMICmnMIValueConst miValueConst(CMIUtilString::Format("%d", m_nBrkPtId));
-const CMICmnMIValueResult miValueResult("number", miValueConst);
-CMICmnMIValueTuple miValueTuple(miValueResult);
-const CMICmnMIValueConst miValueConst2("n");
-const CMICmnMIValueResult miValueResult2("enabled", miValueConst2);
-miValueTuple.Add(miValueResult2);
-const CMICmnMIValueResult miValueResult3("bkpt", miValueTuple);
-const CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointModified, miValueResult3);
-bool bOk = CMICmnStreamStdout::TextToStdout(miOutOfBandRecord.GetString());
-
 const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
 m_miResultRecord = miRecordResult;
-return bOk;
+return MIstatus::success;
 }
 
 const CMIUtilString strBrkPtId(CMIUtilString::Format("%d", m_nBrkPtId));
@@ -683,7 +673,7 @@
 if (brkPt.IsValid())
 {
 m_bBrkPtEnabledOk = true;
-brkPt.SetEnabled(false);
+brkPt.SetEnabled(true);
 m_nBrkPtId = nBrk;
 }
 
@@ -704,19 +694,9 @@
 {
 if (m_bBrkPtEnabledOk)
 {
-const CMICmnMIValueConst miValueConst(CMIUtilString::Format("%d", m_nBrkPtId));
-const CMICmnMIValueResult miValueResult("number", miValueConst);
-CMICmnMIValueTuple miValueTuple(miValueResult);
-const CMICmnMIValueConst miValueConst2("y");
-const CMICmnMIValueResult miValueResult2("enabled", miValueConst2);
-miValueTuple.Add(miValueResult2);
-const CMICmnMIValueResult miValueResult3("bkpt", miValueTuple);
-const CMICmnMIOutOfBandRecord miOutOfBandRecord(CMICmnMIOutOfBandRecord::eOutOfBand_BreakPointModified, miValueResult3);
-bool bOk = CMICmnStreamStdout::TextToStdout(miOutOfBandRecord.GetString());
-
 const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done);
 m_miResultRecord = miRecordResult;
-return bOk;
+return MIstatus::success;
 }
 
 const CMIUtilString strBrkPtId(CMIUtilString::Format("%d", m_nBrkPtId));
Index: packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
@@ -246,3 +246,48 @@
 self.runCmd("-exec-continue")
 self.expect("\^running")
 self.expect("\*stopped,reason=\"exited-normally\"")
+
+@skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+def test_lldbmi_break_enable_disable(self):
+"""Test that 'lldb-mi --interpreter' works for enabling / disabling breakpoints."""
+
+self.spawnLldbMi(args = None)
+
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+self.runCmd("-break-insert main")
+self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"main\"")
+self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}")
+
+self.runCmd("-exec-run")
+self.expect("\^running")
+self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}")
+self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"1\"")
+
+self.runCmd("-break-insert ns::foo1")
+self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo1\(\)\"")
+self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}")
+

[Lldb-commits] [lldb] r275381 - Fix -break-enable/-break-disable commands (MI)

2016-07-14 Thread Ilia K via lldb-commits
Author: ki.stfu
Date: Thu Jul 14 02:43:14 2016
New Revision: 275381

URL: http://llvm.org/viewvc/llvm-project?rev=275381&view=rev
Log:
Fix -break-enable/-break-disable commands (MI)

* Previously -break-enable mistakenly set BP's enabled flag to false.
* These commands print fake =breakpoint-modified messages, what's not
  needed anymore because that events are come in normal way.
* Add tests for -break-enable/-break-disable commands

Initial patch from xuefangli...@hotmail.com. The test case was improved by me.

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


Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=275381&r1=275380&r2=275381&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
 Thu Jul 14 02:43:14 2016
@@ -246,3 +246,48 @@ class MiBreakTestCase(lldbmi_testcase.Mi
 self.runCmd("-exec-continue")
 self.expect("\^running")
 self.expect("\*stopped,reason=\"exited-normally\"")
+
+@skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread 
races
+def test_lldbmi_break_enable_disable(self):
+"""Test that 'lldb-mi --interpreter' works for enabling / disabling 
breakpoints."""
+
+self.spawnLldbMi(args = None)
+
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+self.runCmd("-break-insert main")
+
self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"main\"")
+
self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}")
+
+self.runCmd("-exec-run")
+self.expect("\^running")
+
self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}")
+
self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"1\"")
+
+self.runCmd("-break-insert ns::foo1")
+
self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo1\(\)\"")
+
self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}")
+
+self.runCmd("-break-insert ns::foo2")
+
self.expect("\^done,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo2\(\)\"")
+
self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
+
+# disable the 2nd breakpoint
+self.runCmd("-break-disable 2")
+self.expect("\^done")
+
self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}")
+
+# disable the 3rd breakpoint and re-enable
+self.runCmd("-break-disable 3")
+self.expect("\^done")
+
self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
+
+self.runCmd("-break-enable 3")
+self.expect("\^done")
+
self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
+
+self.runCmd("-exec-continue")
+self.expe

Re: [Lldb-commits] [PATCH] D21757: Fix lldb-mi disable/enable breakpoints commands

2016-07-14 Thread Ilia K via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL275381: Fix -break-enable/-break-disable commands (MI) 
(authored by ki.stfu).

Changed prior to commit:
  http://reviews.llvm.org/D21757?vs=63928&id=63932#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21757

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
  lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
@@ -246,3 +246,48 @@
 self.runCmd("-exec-continue")
 self.expect("\^running")
 self.expect("\*stopped,reason=\"exited-normally\"")
+
+@skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+def test_lldbmi_break_enable_disable(self):
+"""Test that 'lldb-mi --interpreter' works for enabling / disabling breakpoints."""
+
+self.spawnLldbMi(args = None)
+
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+self.runCmd("-break-insert main")
+self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"main\"")
+self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}")
+
+self.runCmd("-exec-run")
+self.expect("\^running")
+self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}")
+self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"1\"")
+
+self.runCmd("-break-insert ns::foo1")
+self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo1\(\)\"")
+self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}")
+
+self.runCmd("-break-insert ns::foo2")
+self.expect("\^done,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo2\(\)\"")
+self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
+
+# disable the 2nd breakpoint
+self.runCmd("-break-disable 2")
+self.expect("\^done")
+self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}")
+
+# disable the 3rd breakpoint and re-enable
+self.runCmd("-break-disable 3")
+self.expect("\^done")
+self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
+
+self.runCmd("-break-enable 3")
+self.expect("\^done")
+self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0x)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
+
+self.runCmd("-exec-continue")
+self.expect("\^running")
+self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"3\"")
Index: lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
@@ -568,19 +568,9 @@
 {
 if (m_bBrkPtDisabledOk)
 {
-const CMICmnMIValueConst miValueConst(CMIUtilString::Format("%d", m_nBrkPtId));
-const CMICmnMIValueResult miValueResult("number", miValueConst);
-C

Re: [Lldb-commits] [PATCH] D22902: Fix -break-insert not working when using absolute paths

2016-07-27 Thread Ilia K via lldb-commits
ki.stfu added a comment.

Could you add a test case for this in 
packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py?


https://reviews.llvm.org/D22902



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


Re: [Lldb-commits] [PATCH] D22902: Fix -break-insert not working when using absolute paths

2016-07-28 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.

No. I'm going to land it right now! Thanks!


https://reviews.llvm.org/D22902



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


[Lldb-commits] [lldb] r277117 - Fix -break-insert not working when using absolute paths (MI)

2016-07-28 Thread Ilia K via lldb-commits
Author: ki.stfu
Date: Fri Jul 29 01:01:20 2016
New Revision: 277117

URL: http://llvm.org/viewvc/llvm-project?rev=277117&view=rev
Log:
Fix -break-insert not working when using absolute paths (MI)

Summary:
When trying to parse the -break-insert arguments as a named location, the 
string parsing was not configured to allow directory paths. This patch adds a 
constructor to allow the parsing of string as directory path along with the 
other parameters.

This fixes https://llvm.org/bugs/show_bug.cgi?id=28709

Patch from malape...@gmail.com
Reviewers: clayborg, ki.stfu
Subscribers: lldb-commits, ki.stfu
Differential Revision: https://reviews.llvm.org/D22902


Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
lldb/trunk/tools/lldb-mi/MICmdArgValString.h
lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=277117&r1=277116&r2=277117&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
 Fri Jul 29 01:01:20 2016
@@ -155,7 +155,6 @@ class MiBreakTestCase(lldbmi_testcase.Mi
 
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread 
races
-@unittest2.expectedFailure("-break-insert doesn't work for absolute path")
 def test_lldbmi_break_insert_file_line_absolute_path(self):
 """Test that 'lldb-mi --interpreter' works for file:line 
breakpoints."""
 

Modified: lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp?rev=277117&r1=277116&r2=277117&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp Fri Jul 29 01:01:20 2016
@@ -85,6 +85,30 @@ CMICmdArgValString::CMICmdArgValString(c
 }
 
 //++ 

+// Details: CMICmdArgValString constructor.
+// Type:Method.
+// Args:vrArgName   - (R) Argument's name to search by.
+//  vbMandatory - (R) True = Yes must be present, false = optional 
argument.
+//  vbHandleByCmd   - (R) True = Command processes *this option, false 
= not handled.
+//  vbHandleQuotes  - (R) True = Parse a string surrounded by quotes 
spaces are not delimiters, false = only text up to
+// next delimiting space character.
+//  vbAcceptNumbers - (R) True = Parse a string and accept as a number 
if number, false = numbers not recognised as
+//  vbHandleDirPaths - (R) True = Parse a string and accept as a file 
path if a path, false = file paths are not
+// string types.
+// Return:  None.
+// Throws:  None.
+//--
+CMICmdArgValString::CMICmdArgValString(const CMIUtilString &vrArgName, const 
bool vbMandatory, const bool vbHandleByCmd,
+   const bool vbHandleQuotes, const bool vbAcceptNumbers, const 
bool vbHandleDirPaths)
+: CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd)
+, m_bHandleQuotedString(vbHandleQuotes)
+, m_bAcceptNumbers(vbAcceptNumbers)
+, m_bHandleDirPaths(vbHandleDirPaths)
+, m_bHandleAnything(false)
+{
+}
+
+//++ 

 // Details: CMICmdArgValString destructor.
 // Type:Overridden.
 // Args:None.

Modified: lldb/trunk/tools/lldb-mi/MICmdArgValString.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValString.h?rev=277117&r1=277116&r2=277117&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmdArgValString.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmdArgValString.h Fri Jul 29 01:01:20 2016
@@ -32,6 +32,8 @@ class CMICmdArgValString : public CMICmd
 /* ctor */ CMICmdArgValString(const bool vbHandleQuotes, const bool 
vbAcceptNumbers, const bool vbHandleDirPaths);
 /* ctor */ CMICmdArgValString(const CMIUtilString &vrArgName, const bool 
vbMandatory, const bool vbHandleByCmd,
   const bool vbHandleQuotes = false, const 
bool vbAcceptNumbers = false);
+/* ctor */ CMICmdArgValString(const CMIUtilString &vrArgName, const bool 
vbMandatory, const bool vbHandleByCmd,
+  const bool vbHandleQuotes, const bool 
vbAcceptNumbers, const bool vbHandleDirPaths);
 //
 bool IsStringArg(const CMIUti

Re: [Lldb-commits] [PATCH] D22902: Fix -break-insert not working when using absolute paths

2016-07-28 Thread Ilia K via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL277117: Fix -break-insert not working when using absolute 
paths (MI) (authored by ki.stfu).

Changed prior to commit:
  https://reviews.llvm.org/D22902?vs=66055&id=66079#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D22902

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
  lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
  lldb/trunk/tools/lldb-mi/MICmdArgValString.h
  lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp

Index: lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
@@ -85,6 +85,30 @@
 }
 
 //++ 

+// Details: CMICmdArgValString constructor.
+// Type:Method.
+// Args:vrArgName   - (R) Argument's name to search by.
+//  vbMandatory - (R) True = Yes must be present, false = optional 
argument.
+//  vbHandleByCmd   - (R) True = Command processes *this option, false 
= not handled.
+//  vbHandleQuotes  - (R) True = Parse a string surrounded by quotes 
spaces are not delimiters, false = only text up to
+// next delimiting space character.
+//  vbAcceptNumbers - (R) True = Parse a string and accept as a number 
if number, false = numbers not recognised as
+//  vbHandleDirPaths - (R) True = Parse a string and accept as a file 
path if a path, false = file paths are not
+// string types.
+// Return:  None.
+// Throws:  None.
+//--
+CMICmdArgValString::CMICmdArgValString(const CMIUtilString &vrArgName, const 
bool vbMandatory, const bool vbHandleByCmd,
+   const bool vbHandleQuotes, const bool vbAcceptNumbers, const 
bool vbHandleDirPaths)
+: CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd)
+, m_bHandleQuotedString(vbHandleQuotes)
+, m_bAcceptNumbers(vbAcceptNumbers)
+, m_bHandleDirPaths(vbHandleDirPaths)
+, m_bHandleAnything(false)
+{
+}
+
+//++ 

 // Details: CMICmdArgValString destructor.
 // Type:Overridden.
 // Args:None.
Index: lldb/trunk/tools/lldb-mi/MICmdArgValString.h
===
--- lldb/trunk/tools/lldb-mi/MICmdArgValString.h
+++ lldb/trunk/tools/lldb-mi/MICmdArgValString.h
@@ -32,6 +32,8 @@
 /* ctor */ CMICmdArgValString(const bool vbHandleQuotes, const bool 
vbAcceptNumbers, const bool vbHandleDirPaths);
 /* ctor */ CMICmdArgValString(const CMIUtilString &vrArgName, const bool 
vbMandatory, const bool vbHandleByCmd,
   const bool vbHandleQuotes = false, const 
bool vbAcceptNumbers = false);
+/* ctor */ CMICmdArgValString(const CMIUtilString &vrArgName, const bool 
vbMandatory, const bool vbHandleByCmd,
+  const bool vbHandleQuotes, const bool 
vbAcceptNumbers, const bool vbHandleDirPaths);
 //
 bool IsStringArg(const CMIUtilString &vrTxt) const;
 
Index: lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
@@ -100,7 +100,7 @@
 new CMICmdArgValOptionShort(m_constStrArgNamedInoreCnt, false, true, 
CMICmdArgValListBase::eArgValType_Number, 1));
 m_setCmdArgs.Add(new 
CMICmdArgValOptionShort(m_constStrArgNamedRestrictBrkPtToThreadId, false, true,

CMICmdArgValListBase::eArgValType_Number, 1));
-m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgNamedLocation, false, 
true));
+m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgNamedLocation, false, 
true, false, false, true));
 return ParseValidateCmdOptions();
 }
 
Index: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
@@ -155,7 +155,6 @@
 
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread 
races
-@unittest2.expectedFailure("-break-insert doesn't work for absolute path")
 def test_lldbmi_break_insert_file_line_absolute_path(self):
 """Test that 'lldb-mi --interpreter' works for file:line 
breakpoints."""
 


Index: lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
+++ lldb/trunk/tools/lldb-mi/MICmdArgValStr

Re: [Lldb-commits] [PATCH] D23026: [LLDB-MI] removing requirement of a parameter for -break-insert's -f flag

2016-08-01 Thread Ilia K via lldb-commits
ki.stfu added a comment.

Hi!

So, what you want is to create pending breakpoints without locations?

I'm not sure it's the correct use of -break-insert so that lldb-mi has to exit 
with an error in this case. The other question is why it doesn't do that and 
sets BPs without locations even if -f has not been specified but that's another 
story.


Repository:
  rL LLVM

https://reviews.llvm.org/D23026



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


Re: [Lldb-commits] [lldb] r277117 - Fix -break-insert not working when using absolute paths (MI)

2016-08-02 Thread Ilia K via lldb-commits
Hi Hans!

The author of this commit asks me is there a chance to include this changes
to 3.9 release? I'm not sure about our policy when RC has already been
tagged.

On Fri, Jul 29, 2016 at 9:01 AM, Ilia K via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: ki.stfu
> Date: Fri Jul 29 01:01:20 2016
> New Revision: 277117
>
> URL: http://llvm.org/viewvc/llvm-project?rev=277117&view=rev
> Log:
> Fix -break-insert not working when using absolute paths (MI)
>
> Summary:
> When trying to parse the -break-insert arguments as a named location, the
> string parsing was not configured to allow directory paths. This patch adds
> a constructor to allow the parsing of string as directory path along with
> the other parameters.
>
> This fixes https://llvm.org/bugs/show_bug.cgi?id=28709
>
> Patch from malape...@gmail.com
> Reviewers: clayborg, ki.stfu
> Subscribers: lldb-commits, ki.stfu
> Differential Revision: https://reviews.llvm.org/D22902
>
>
> Modified:
>
> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
> lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
> lldb/trunk/tools/lldb-mi/MICmdArgValString.h
> lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp
>
> Modified:
> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=277117&r1=277116&r2=277117&view=diff
>
> ==
> ---
> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
> (original)
> +++
> lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
> Fri Jul 29 01:01:20 2016
> @@ -155,7 +155,6 @@ class MiBreakTestCase(lldbmi_testcase.Mi
>
>  @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on
> Windows
>  @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known
> thread races
> -@unittest2.expectedFailure("-break-insert doesn't work for absolute
> path")
>  def test_lldbmi_break_insert_file_line_absolute_path(self):
>  """Test that 'lldb-mi --interpreter' works for file:line
> breakpoints."""
>
>
> Modified: lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp?rev=277117&r1=277116&r2=277117&view=diff
>
> ==
> --- lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp (original)
> +++ lldb/trunk/tools/lldb-mi/MICmdArgValString.cpp Fri Jul 29 01:01:20 2016
> @@ -85,6 +85,30 @@ CMICmdArgValString::CMICmdArgValString(c
>  }
>
>  //++
> 
> +// Details: CMICmdArgValString constructor.
> +// Type:Method.
> +// Args:vrArgName   - (R) Argument's name to search by.
> +//  vbMandatory - (R) True = Yes must be present, false =
> optional argument.
> +//  vbHandleByCmd   - (R) True = Command processes *this option,
> false = not handled.
> +//  vbHandleQuotes  - (R) True = Parse a string surrounded by
> quotes spaces are not delimiters, false = only text up to
> +// next delimiting space character.
> +//  vbAcceptNumbers - (R) True = Parse a string and accept as a
> number if number, false = numbers not recognised as
> +//  vbHandleDirPaths - (R) True = Parse a string and accept as a
> file path if a path, false = file paths are not
> +// string types.
> +// Return:  None.
> +// Throws:  None.
> +//--
> +CMICmdArgValString::CMICmdArgValString(const CMIUtilString &vrArgName,
> const bool vbMandatory, const bool vbHandleByCmd,
> +   const bool vbHandleQuotes, const bool vbAcceptNumbers,
> const bool vbHandleDirPaths)
> +: CMICmdArgValBaseTemplate(vrArgName, vbMandatory, vbHandleByCmd)
> +, m_bHandleQuotedString(vbHandleQuotes)
> +, m_bAcceptNumbers(vbAcceptNumbers)
> +, m_bHandleDirPaths(vbHandleDirPaths)
> +, m_bHandleAnything(false)
> +{
> +}
> +
> +//++
> 
>  // Details: CMICmdArgValString destructor.
>  // Type:Overridden.
>  // Args:None.
>
> Modified: lldb/trunk/tools/lldb-mi/MICmdArgValString.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdArgValString.h?rev=277117&r1=277116&r2=277117&view=diff
>
> ==

Re: [Lldb-commits] [PATCH] D23026: [LLDB-MI] removing requirement of a parameter for -break-insert's -f flag

2016-08-02 Thread Ilia K via lldb-commits
ki.stfu added a comment.

Yes, that's what I said. We have to throw an error if location is not passed 
(even if -f is specified).


Repository:
  rL LLVM

https://reviews.llvm.org/D23026



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


Re: [Lldb-commits] [PATCH] D23882: Replace uses of MIUtilParse::CRegexParser with llvm::Regex

2016-08-29 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.
This revision is now accepted and ready to land.

lgtm if tests are passed


https://reviews.llvm.org/D23882



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


[Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-07 Thread Ilia K via lldb-commits
ki.stfu created this revision.
ki.stfu added reviewers: clayborg, jingham, zturner.
ki.stfu added a subscriber: lldb-commits.

It fixes the following compile warnings:
1. '0' flag ignored with precision and ‘%d’ gnu_printf format
2. enumeral and non-enumeral type in conditional expression
3. format ‘%d’ expects argument of type ‘int’, but argument 4 has type ...
4. enumeration value ‘...’ not handled in switch
5. cast from type ‘const uint64_t* {aka ...}’ to type ‘int64_t* {aka ...}’ 
casts away qualifiers
6. extra ‘;’
7. comparison between signed and unsigned integer expressions
8. variable ‘register_operand’ set but not used
9. control reaches end of non-void function

https://reviews.llvm.org/D24331

Files:
  source/Core/Log.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -1279,6 +1279,9 @@
   return std::make_pair(nullptr, 0);
 }
   }
+  default:
+// Make compiler happy with adding default case
+return std::make_pair(nullptr, 0);
   }
 }
 
@@ -1292,7 +1295,7 @@
   }
   return std::make_pair(nullptr, 0);
 }
-};
+}
 
 lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
   TargetSP target_sp = CalculateTarget();
@@ -1421,7 +1424,7 @@
   Error error;
   ValueObjectSP pointee = base->Dereference(error);
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset > 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();
 offset = offset % pointee->GetByteSize();
 const bool can_create = true;
@@ -1602,6 +1605,9 @@
   continue;
 }
 
+// Ignore an unused-variable warning for a register operand.
+(void)register_operand;
+
 // We have an origin operand.  Can we track its value down?
 switch (origin_operand->m_type) {
 default:
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -518,7 +518,7 @@
   // 0x. If we use the unsigned long long
   // it will work as expected.
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *)&uval);
+  result = *((const int64_t *)&uval);
 }
 return result;
   }
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -138,6 +138,8 @@
   case MinidumpCPUArchitecture::ARM64:
 arch_spec.GetTriple().setArch(llvm::Triple::ArchType::aarch64);
 break;
+  default:
+break;
   }
 
   return arch_spec;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3567,7 +3567,7 @@
 error.SetErrorStringWithFormat("configuring StructuredData feature %s "
"failed when sending packet: "
"PacketResult=%d",
-   type_name.AsCString(), result);
+   type_name.AsCString(), (int)result);
   }
   return error;
 }
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -139,9 +139,9 @@
   // Keep a separate map of permissions that that isn't coalesced so all ranges
   // are maintained.
   const uint32_t permissions =
-  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0) |
-  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0) |
-  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0);
+  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0u);
 
   m_core_range_infos.Append(
   VMRangeToPermissions::Entry(addr, header->p_memsz, permissions));
Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-07 Thread Ilia K via lldb-commits
ki.stfu added a comment.

BTW, the following warnings remain:

1. unrecognized command line option ‘-Wno-vla-extension’
2. unrecognized command line option ‘-Wno-deprecated-register’
3. comparison of unsigned expression >= 0 is always true

  [2782/3295] Building CXX object 
tools/lldb/source/Plugins/Instruction/ARM/CMakeFiles/lldbPluginInstructionARM.dir/EmulationStateARM.cpp.o
  ../tools/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp: In member 
function ‘bool EmulationStateARM::StorePseudoRegisterValue(uint32_t, uint64_t)’:
  ../tools/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp:69:17: 
warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
 if ((dwarf_r0 <= reg_num) && (reg_num <= dwarf_cpsr))
   ^
  ../tools/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp: In member 
function ‘uint64_t EmulationStateARM::ReadPseudoRegisterValue(uint32_t, bool&)’:
  ../tools/lldb/source/Plugins/Instruction/ARM/EmulationStateARM.cpp:92:17: 
warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
 if ((dwarf_r0 <= reg_num) && (reg_num <= dwarf_cpsr))
   ^
  ...
  [3136/3295] Building CXX object 
tools/lldb/source/Utility/CMakeFiles/lldbUtility.dir/ARM64_DWARF_Registers.cpp.o
  ../tools/lldb/source/Utility/ARM64_DWARF_Registers.cpp: In function ‘bool 
arm64_dwarf::GetRegisterInfo(unsigned int, lldb_private::RegisterInfo&)’:
  ../tools/lldb/source/Utility/ARM64_DWARF_Registers.cpp:175:15: warning: 
comparison of unsigned expression >= 0 is always true [-Wtype-limits]
 if (reg_num >= x0 && reg_num <= pc) {
 ^

4. format not a string literal and no format arguments

  [3217/3295] Building CXX object 
tools/lldb/source/API/CMakeFiles/liblldb.dir/__/__/scripts/LLDBWrapPython.cpp.o
  tools/lldb/scripts/LLDBWrapPython.cpp: In function ‘PyObject* 
_wrap_SBError_SetErrorStringWithFormat__SWIG_3(PyObject*, PyObject*)’:
  tools/lldb/scripts/LLDBWrapPython.cpp:28426:70: warning: format not a string 
literal and no format arguments [-Wformat-security]
   result = (int)(arg1)->SetErrorStringWithFormat((char const *)arg2);
^

5. comparison between signed and unsigned integer expressions

  tools/lldb/scripts/LLDBWrapPython.cpp: In function ‘PyObject* 
_wrap_SBTarget_BreakpointCreateByNames__SWIG_0(PyObject*, PyObject*)’:
  tools/lldb/scripts/LLDBWrapPython.cpp:55744:21: warning: comparison between 
signed and unsigned integer expressions [-Wsign-compare]
 for (i = 0; i < arg3; i++) {
   ^
  tools/lldb/scripts/LLDBWrapPython.cpp: In function ‘PyObject* 
_wrap_SBTarget_BreakpointCreateByNames__SWIG_1(PyObject*, PyObject*)’:
  tools/lldb/scripts/LLDBWrapPython.cpp:55836:21: warning: comparison between 
signed and unsigned integer expressions [-Wsign-compare]
 for (i = 0; i < arg3; i++) {
   ^
  tools/lldb/scripts/LLDBWrapPython.cpp: In function ‘PyObject* 
_wrap_SBTarget_BreakpointCreateByNames__SWIG_2(PyObject*, PyObject*)’:
  tools/lldb/scripts/LLDBWrapPython.cpp:55937:21: warning: comparison between 
signed and unsigned integer expressions [-Wsign-compare]
 for (i = 0; i < arg3; i++) {
   ^


https://reviews.llvm.org/D24331



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


Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-08 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 70653.
ki.stfu added a comment.

Remove obvious comment


https://reviews.llvm.org/D24331

Files:
  source/Core/Log.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -1279,6 +1279,8 @@
   return std::make_pair(nullptr, 0);
 }
   }
+  default:
+return std::make_pair(nullptr, 0);
   }
 }
 
@@ -1292,7 +1294,7 @@
   }
   return std::make_pair(nullptr, 0);
 }
-};
+}
 
 lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
   TargetSP target_sp = CalculateTarget();
@@ -1421,7 +1423,7 @@
   Error error;
   ValueObjectSP pointee = base->Dereference(error);
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset > 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();
 offset = offset % pointee->GetByteSize();
 const bool can_create = true;
@@ -1602,6 +1604,9 @@
   continue;
 }
 
+// Ignore an unused-variable warning for a register operand.
+(void)register_operand;
+
 // We have an origin operand.  Can we track its value down?
 switch (origin_operand->m_type) {
 default:
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -518,7 +518,7 @@
   // 0x. If we use the unsigned long long
   // it will work as expected.
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *)&uval);
+  result = *((const int64_t *)&uval);
 }
 return result;
   }
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -138,6 +138,8 @@
   case MinidumpCPUArchitecture::ARM64:
 arch_spec.GetTriple().setArch(llvm::Triple::ArchType::aarch64);
 break;
+  default:
+break;
   }
 
   return arch_spec;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3567,7 +3567,7 @@
 error.SetErrorStringWithFormat("configuring StructuredData feature %s "
"failed when sending packet: "
"PacketResult=%d",
-   type_name.AsCString(), result);
+   type_name.AsCString(), (int)result);
   }
   return error;
 }
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -139,9 +139,9 @@
   // Keep a separate map of permissions that that isn't coalesced so all ranges
   // are maintained.
   const uint32_t permissions =
-  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0) |
-  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0) |
-  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0);
+  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0u);
 
   m_core_range_infos.Append(
   VMRangeToPermissions::Entry(addr, header->p_memsz, permissions));
Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1460,11 +1460,11 @@
   if (m_data.GetU32(&offset, &load_cmd.maxprot, 4)) {
 const uint32_t segment_permissions =
 ((load_cmd.initprot & VM_PROT_READ) ? ePermissionsReadable
-: 0) |
+: 0u) |
 ((load_cmd.initprot & VM_PROT_WRITE) ? ePermissionsWritable
- : 0) |

Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-08 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 70654.
ki.stfu added a comment.

Apply clang-format


https://reviews.llvm.org/D24331

Files:
  source/Core/Log.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -853,10 +853,9 @@
 } else {
   ValueObjectSP synthetic = valobj_sp->GetSyntheticValue();
   if (no_synth_child /* synthetic is forbidden */ ||
-  !synthetic /* no synthetic */
-  ||
-  synthetic == valobj_sp) /* synthetic is the same as the
- original object */
+  !synthetic /* no synthetic */
+  || synthetic == valobj_sp) /* synthetic is the same as the
+original object */
   {
 valobj_sp->GetExpressionPath(var_expr_path_strm, false);
 error.SetErrorStringWithFormat(
@@ -1279,6 +1278,8 @@
   return std::make_pair(nullptr, 0);
 }
   }
+  default:
+return std::make_pair(nullptr, 0);
   }
 }
 
@@ -1292,7 +1293,7 @@
   }
   return std::make_pair(nullptr, 0);
 }
-};
+}
 
 lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
   TargetSP target_sp = CalculateTarget();
@@ -1421,7 +1422,7 @@
   Error error;
   ValueObjectSP pointee = base->Dereference(error);
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset > 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();
 offset = offset % pointee->GetByteSize();
 const bool can_create = true;
@@ -1602,6 +1603,9 @@
   continue;
 }
 
+// Ignore an unused-variable warning for a register operand.
+(void)register_operand;
+
 // We have an origin operand.  Can we track its value down?
 switch (origin_operand->m_type) {
 default:
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -518,7 +518,7 @@
   // 0x. If we use the unsigned long long
   // it will work as expected.
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *)&uval);
+  result = *((const int64_t *)&uval);
 }
 return result;
   }
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -138,6 +138,8 @@
   case MinidumpCPUArchitecture::ARM64:
 arch_spec.GetTriple().setArch(llvm::Triple::ArchType::aarch64);
 break;
+  default:
+break;
   }
 
   return arch_spec;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3567,7 +3567,7 @@
 error.SetErrorStringWithFormat("configuring StructuredData feature %s "
"failed when sending packet: "
"PacketResult=%d",
-   type_name.AsCString(), result);
+   type_name.AsCString(), (int)result);
   }
   return error;
 }
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -139,9 +139,9 @@
   // Keep a separate map of permissions that that isn't coalesced so all ranges
   // are maintained.
   const uint32_t permissions =
-  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0) |
-  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0) |
-  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0);
+  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0u);
 
   m_core_range_infos.Ap

Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-08 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 70656.
ki.stfu marked 3 inline comments as done.
ki.stfu added a comment.

Fixes per Zachary's comments


https://reviews.llvm.org/D24331

Files:
  source/Core/Log.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -853,10 +853,9 @@
 } else {
   ValueObjectSP synthetic = valobj_sp->GetSyntheticValue();
   if (no_synth_child /* synthetic is forbidden */ ||
-  !synthetic /* no synthetic */
-  ||
-  synthetic == valobj_sp) /* synthetic is the same as the
- original object */
+  !synthetic /* no synthetic */
+  || synthetic == valobj_sp) /* synthetic is the same as the
+original object */
   {
 valobj_sp->GetExpressionPath(var_expr_path_strm, false);
 error.SetErrorStringWithFormat(
@@ -1279,6 +1278,8 @@
   return std::make_pair(nullptr, 0);
 }
   }
+  default:
+return std::make_pair(nullptr, 0);
   }
 }
 
@@ -1292,7 +1293,7 @@
   }
   return std::make_pair(nullptr, 0);
 }
-};
+}
 
 lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
   TargetSP target_sp = CalculateTarget();
@@ -1421,7 +1422,7 @@
   Error error;
   ValueObjectSP pointee = base->Dereference(error);
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset >= 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();
 offset = offset % pointee->GetByteSize();
 const bool can_create = true;
@@ -1587,17 +1588,16 @@
   continue;
 }
 
-Instruction::Operand *register_operand = nullptr;
 Instruction::Operand *origin_operand = nullptr;
 if (operands[0].m_type == Instruction::Operand::Type::Register &&
 operands[0].m_clobbered == true && operands[0].m_register == reg) {
-  register_operand = &operands[0];
+  // operands[0] is a register operand
   origin_operand = &operands[1];
 } else if (operands[1].m_type == Instruction::Operand::Type::Register &&
operands[1].m_clobbered == true &&
operands[1].m_register == reg) {
-  register_operand = &operands[1];
   origin_operand = &operands[0];
+  // operands[1] is a register operand
 } else {
   continue;
 }
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -518,7 +518,7 @@
   // 0x. If we use the unsigned long long
   // it will work as expected.
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *)&uval);
+  result = static_cast(uval);
 }
 return result;
   }
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -138,6 +138,8 @@
   case MinidumpCPUArchitecture::ARM64:
 arch_spec.GetTriple().setArch(llvm::Triple::ArchType::aarch64);
 break;
+  default:
+break;
   }
 
   return arch_spec;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3567,7 +3567,7 @@
 error.SetErrorStringWithFormat("configuring StructuredData feature %s "
"failed when sending packet: "
"PacketResult=%d",
-   type_name.AsCString(), result);
+   type_name.AsCString(), (int)result);
   }
   return error;
 }
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -139,9 +139,9 @@
   // Keep a separate map of permissions that that isn't coalesced so all ranges
   // are maintai

Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-08 Thread Ilia K via lldb-commits
ki.stfu marked an inline comment as done.


Comment at: source/Target/StackFrame.cpp:1425
@@ -1423,3 +1424,3 @@
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset > 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();

Good point. Thanks!


https://reviews.llvm.org/D24331



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


Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-11 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 70973.
ki.stfu added a comment.

Rebase against ToT


https://reviews.llvm.org/D24331

Files:
  source/Core/Log.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -1278,6 +1278,8 @@
   return std::make_pair(nullptr, 0);
 }
   }
+  default:
+return std::make_pair(nullptr, 0);
   }
 }
 
@@ -1291,7 +1293,7 @@
   }
   return std::make_pair(nullptr, 0);
 }
-};
+}
 
 lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
   TargetSP target_sp = CalculateTarget();
@@ -1420,7 +1422,7 @@
   Error error;
   ValueObjectSP pointee = base->Dereference(error);
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset >= 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();
 offset = offset % pointee->GetByteSize();
 const bool can_create = true;
@@ -1586,17 +1588,16 @@
   continue;
 }
 
-Instruction::Operand *register_operand = nullptr;
 Instruction::Operand *origin_operand = nullptr;
 if (operands[0].m_type == Instruction::Operand::Type::Register &&
 operands[0].m_clobbered == true && operands[0].m_register == reg) {
-  register_operand = &operands[0];
+  // operands[0] is a register operand
   origin_operand = &operands[1];
 } else if (operands[1].m_type == Instruction::Operand::Type::Register &&
operands[1].m_clobbered == true &&
operands[1].m_register == reg) {
-  register_operand = &operands[1];
   origin_operand = &operands[0];
+  // operands[1] is a register operand
 } else {
   continue;
 }
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -518,7 +518,7 @@
   // 0x. If we use the unsigned long long
   // it will work as expected.
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *)&uval);
+  result = static_cast(uval);
 }
 return result;
   }
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -138,6 +138,8 @@
   case MinidumpCPUArchitecture::ARM64:
 arch_spec.GetTriple().setArch(llvm::Triple::ArchType::aarch64);
 break;
+  default:
+break;
   }
 
   return arch_spec;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3653,7 +3653,7 @@
 error.SetErrorStringWithFormat("configuring StructuredData feature %s "
"failed when sending packet: "
"PacketResult=%d",
-   type_name.AsCString(), result);
+   type_name.AsCString(), (int)result);
   }
   return error;
 }
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -139,9 +139,9 @@
   // Keep a separate map of permissions that that isn't coalesced so all ranges
   // are maintained.
   const uint32_t permissions =
-  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0) |
-  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0) |
-  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0);
+  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0u);
 
   m_core_range_infos.Append(
   VMRangeToPermissions::Entry(addr, header->p_memsz, permissions));
Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ source/Plugins/ObjectFile/Mach-O

Re: [Lldb-commits] [PATCH] D24331: Fix about a dozen compile warnings

2016-09-11 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 70976.
ki.stfu added a comment.

Apply clang-format


https://reviews.llvm.org/D24331

Files:
  source/Core/Log.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Target/StackFrame.cpp

Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -1278,6 +1278,8 @@
   return std::make_pair(nullptr, 0);
 }
   }
+  default:
+return std::make_pair(nullptr, 0);
   }
 }
 
@@ -1291,7 +1293,7 @@
   }
   return std::make_pair(nullptr, 0);
 }
-};
+}
 
 lldb::ValueObjectSP StackFrame::GuessValueForAddress(lldb::addr_t addr) {
   TargetSP target_sp = CalculateTarget();
@@ -1420,7 +1422,7 @@
   Error error;
   ValueObjectSP pointee = base->Dereference(error);
 
-  if (offset >= pointee->GetByteSize()) {
+  if (offset >= 0 && uint64_t(offset) >= pointee->GetByteSize()) {
 int64_t index = offset / pointee->GetByteSize();
 offset = offset % pointee->GetByteSize();
 const bool can_create = true;
@@ -1586,17 +1588,16 @@
   continue;
 }
 
-Instruction::Operand *register_operand = nullptr;
 Instruction::Operand *origin_operand = nullptr;
 if (operands[0].m_type == Instruction::Operand::Type::Register &&
 operands[0].m_clobbered == true && operands[0].m_register == reg) {
-  register_operand = &operands[0];
+  // operands[0] is a register operand
   origin_operand = &operands[1];
 } else if (operands[1].m_type == Instruction::Operand::Type::Register &&
operands[1].m_clobbered == true &&
operands[1].m_register == reg) {
-  register_operand = &operands[1];
   origin_operand = &operands[0];
+  // operands[1] is a register operand
 } else {
   continue;
 }
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -518,7 +518,7 @@
   // 0x. If we use the unsigned long long
   // it will work as expected.
   const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj);
-  result = *((int64_t *)&uval);
+  result = static_cast(uval);
 }
 return result;
   }
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -138,6 +138,8 @@
   case MinidumpCPUArchitecture::ARM64:
 arch_spec.GetTriple().setArch(llvm::Triple::ArchType::aarch64);
 break;
+  default:
+break;
   }
 
   return arch_spec;
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -3653,7 +3653,7 @@
 error.SetErrorStringWithFormat("configuring StructuredData feature %s "
"failed when sending packet: "
"PacketResult=%d",
-   type_name.AsCString(), result);
+   type_name.AsCString(), (int)result);
   }
   return error;
 }
Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -139,9 +139,9 @@
   // Keep a separate map of permissions that that isn't coalesced so all ranges
   // are maintained.
   const uint32_t permissions =
-  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0) |
-  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0) |
-  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0);
+  ((header->p_flags & llvm::ELF::PF_R) ? lldb::ePermissionsReadable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_W) ? lldb::ePermissionsWritable : 0u) |
+  ((header->p_flags & llvm::ELF::PF_X) ? lldb::ePermissionsExecutable : 0u);
 
   m_core_range_infos.Append(
   VMRangeToPermissions::Entry(addr, header->p_memsz, permissions));
Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ source/Plugins/ObjectFile/Mach-O

[Lldb-commits] [lldb] r281191 - Fix about a dozen compile warnings

2016-09-11 Thread Ilia K via lldb-commits
Author: ki.stfu
Date: Mon Sep 12 00:25:33 2016
New Revision: 281191

URL: http://llvm.org/viewvc/llvm-project?rev=281191&view=rev
Log:
Fix about a dozen compile warnings

Summary:
It fixes the following compile warnings:
1. '0' flag ignored with precision and ‘%d’ gnu_printf format
2. enumeral and non-enumeral type in conditional expression
3. format ‘%d’ expects argument of type ‘int’, but argument 4 has type ...
4. enumeration value ‘...’ not handled in switch
5. cast from type ‘const uint64_t* {aka ...}’ to type ‘int64_t* {aka ...}’ 
casts away qualifiers
6. extra ‘;’
7. comparison between signed and unsigned integer expressions
8. variable ‘register_operand’ set but not used
9. control reaches end of non-void function

Reviewers: jingham, emaste, zturner, clayborg

Subscribers: lldb-commits

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

Modified:
lldb/trunk/source/Core/Log.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
lldb/trunk/source/Target/StackFrame.cpp

Modified: lldb/trunk/source/Core/Log.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=281191&r1=281190&r2=281191&view=diff
==
--- lldb/trunk/source/Core/Log.cpp (original)
+++ lldb/trunk/source/Core/Log.cpp Mon Sep 12 00:25:33 2016
@@ -82,7 +82,7 @@ void Log::VAPrintf(const char *format, v
 // Timestamp if requested
 if (m_options.Test(LLDB_LOG_OPTION_PREPEND_TIMESTAMP)) {
   TimeValue now = TimeValue::Now();
-  header.Printf("%9d.%09.9d ", now.seconds(), now.nanoseconds());
+  header.Printf("%9d.%9.9d ", now.seconds(), now.nanoseconds());
 }
 
 // Add the process and thread if requested

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=281191&r1=281190&r2=281191&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Mon Sep 12 
00:25:33 2016
@@ -1938,9 +1938,9 @@ void ObjectFileELF::CreateSections(Secti
 sect_type = eSectionTypeGoSymtab;
 
   const uint32_t permissions =
-  ((header.sh_flags & SHF_ALLOC) ? ePermissionsReadable : 0) |
-  ((header.sh_flags & SHF_WRITE) ? ePermissionsWritable : 0) |
-  ((header.sh_flags & SHF_EXECINSTR) ? ePermissionsExecutable : 0);
+  ((header.sh_flags & SHF_ALLOC) ? ePermissionsReadable : 0u) |
+  ((header.sh_flags & SHF_WRITE) ? ePermissionsWritable : 0u) |
+  ((header.sh_flags & SHF_EXECINSTR) ? ePermissionsExecutable : 0u);
   switch (header.sh_type) {
   case SHT_SYMTAB:
 assert(sect_type == eSectionTypeOther);

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=281191&r1=281190&r2=281191&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Mon Sep 12 
00:25:33 2016
@@ -1458,13 +1458,13 @@ void ObjectFileMachO::CreateSections(Sec
 }
   }
   if (m_data.GetU32(&offset, &load_cmd.maxprot, 4)) {
-const uint32_t segment_permissions =
-((load_cmd.initprot & VM_PROT_READ) ? ePermissionsReadable
-: 0) |
-((load_cmd.initprot & VM_PROT_WRITE) ? ePermissionsWritable
- : 0) |
-((load_cmd.initprot & VM_PROT_EXECUTE) ? ePermissionsExecutable
-   : 0);
+uint32_t segment_permissions = 0;
+if (load_cmd.initprot & VM_PROT_READ)
+  segment_permissions |= ePermissionsReadable;
+if (load_cmd.initprot & VM_PROT_WRITE)
+  segment_permissions |= ePermissionsWritable;
+if (load_cmd.initprot & VM_PROT_EXECUTE)
+  segment_permissions |= ePermissionsExecutable;
 
 const bool segment_is_encrypted =
 (load_cmd.flags & SG_PROTECTED_VERSION_1) != 0;
@@ -2621,8 +2621,7 @@ size_t ObjectFileMachO::ParseSymtab() {
   "/System/Library/Caches/com.apple.dyld/", /* 
IPHONE_DYLD_SHARED_CACHE_DI

Re: [Lldb-commits] [PATCH] D23883: Remove MIUtilParse (no longer used)

2016-09-11 Thread Ilia K via lldb-commits
ki.stfu requested changes to this revision.
ki.stfu added a reviewer: ki.stfu.
ki.stfu added a comment.
This revision now requires changes to proceed.

You forgot to remove its header file


https://reviews.llvm.org/D23883



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


Re: [Lldb-commits] [PATCH] D23026: [LLDB-MI] removing requirement of a parameter for -break-insert's -f flag

2016-09-11 Thread Ilia K via lldb-commits
ki.stfu requested changes to this revision.
ki.stfu added a comment.
This revision now requires changes to proceed.

Hi @pieandcakes!

I'm sorry for the delay, have a lot of work. Please folllow my inline comments, 
rebase against ToT and update CL's summary.



Comment at: tools/lldb-mi/MICmdCmdBreak.cpp:156-163
@@ -156,8 +155,10 @@
 m_bBrkPtIsPending = pArgPendingBrkPt->GetFound();
 if (pArgLocation->GetFound())
 m_brkName = pArgLocation->GetValue();
-else if (m_bBrkPtIsPending)
+else 
 {
-pArgPendingBrkPt->GetExpectedOption(m_brkName);
+SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_BRKPT_BAD_LOCATION), 
m_cmdData.strMiCmd.c_str()));
+return MIstatus::failure;
 }
+
 if (pArgIgnoreCnt->GetFound())

I think we can remove these lines and make pArgLocation mandatory.
For this, please specify it during registration of m_constStrArgNamedLocation 
in CMICmdCmdBreakInsert::ParseArgs, and then replaces the highlighted lines 
with:
```
m_brkName = pArgLocation->GetValue();
```


Comment at: tools/lldb-mi/MICmnResources.cpp:222
@@ -221,2 +221,3 @@
 {IDS_CMD_ERR_BRKPT_CNT_EXCEEDED, "Command '%s'. Number of valid breakpoint 
exceeded %d. Cannot create new breakpoint '%s'"},
+{IDS_CMD_ERR_BRKPT_BAD_LOCATION, "Command '%s'. Unable to parse breakpoint 
location."},
 {IDS_CMD_ERR_SOME_ERROR, "Command '%s'. Error: %s"},

revert this


Comment at: tools/lldb-mi/MICmnResources.h:239
@@ -238,2 +238,3 @@
 IDS_CMD_ERR_BRKPT_CNT_EXCEEDED,
+IDS_CMD_ERR_BRKPT_BAD_LOCATION,
 IDS_CMD_ERR_SOME_ERROR,

revert this


Repository:
  rL LLVM

https://reviews.llvm.org/D23026



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


Re: [Lldb-commits] [PATCH] D23026: [LLDB-MI] removing requirement of a parameter for -break-insert's -f flag

2016-09-11 Thread Ilia K via lldb-commits
ki.stfu added a comment.

PS: I think it will look like:

  Index: tools/lldb-mi/MICmdCmdBreak.cpp
  ===
  --- tools/lldb-mi/MICmdCmdBreak.cpp   (revision 281191)
  +++ tools/lldb-mi/MICmdCmdBreak.cpp   (working copy)
  @@ -84,8 +84,7 @@
 // Not implemented m_setCmdArgs.Add(new CMICmdArgValOptionShort(
 // m_constStrArgNamedHWBrkPt, false, false));
 m_setCmdArgs.Add(new CMICmdArgValOptionShort(
  -  m_constStrArgNamedPendinfBrkPt, false, true,
  -  CMICmdArgValListBase::eArgValType_StringQuotedNumberPath, 1));
  +  m_constStrArgNamedPendinfBrkPt, false, true));
 m_setCmdArgs.Add(new 
CMICmdArgValOptionShort(m_constStrArgNamedDisableBrkPt,
  false, false));
 // Not implemented m_setCmdArgs.Add(new CMICmdArgValOptionShort(
  @@ -99,7 +98,7 @@
 m_setCmdArgs.Add(new CMICmdArgValOptionShort(
 m_constStrArgNamedRestrictBrkPtToThreadId, false, true,
 CMICmdArgValListBase::eArgValType_Number, 1));
  -  m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgNamedLocation, false,
  +  m_setCmdArgs.Add(new CMICmdArgValString(m_constStrArgNamedLocation, true,
 true, false, false, true));
 return ParseValidateCmdOptions();
   }
  @@ -158,12 +157,7 @@
   m_strArgOptionThreadGrp = CMIUtilString::Format("i%d", nThreadGrp);
 }
 m_bBrkPtIsPending = pArgPendingBrkPt->GetFound();
  -  if (pArgLocation->GetFound())
  -m_brkName = pArgLocation->GetValue();
  -  else if (m_bBrkPtIsPending) {
  -pArgPendingBrkPt->GetExpectedOption(
  -m_brkName);
  -  }
  +  m_brkName = pArgLocation->GetValue();
 if (pArgIgnoreCnt->GetFound()) {
   pArgIgnoreCnt->GetExpectedOption(
   m_nBrkPtIgnoreCount);


Repository:
  rL LLVM

https://reviews.llvm.org/D23026



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


Re: [Lldb-commits] [PATCH] D24202: [lldb-mi] Fix parsing expressions to evaluate with spaces and optional args

2016-09-11 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.
This revision is now accepted and ready to land.

lgtm

@edmunoz, good job. Thank you! Would you like me to commit?


Repository:
  rL LLVM

https://reviews.llvm.org/D24202



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


Re: [Lldb-commits] [PATCH] D9740: Add MiSyntaxTestCase.test_lldbmi_output_grammar test (MI)

2016-09-11 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 70977.
ki.stfu added a comment.
Herald added a subscriber: ki.stfu.

Rebase against ToT


https://reviews.llvm.org/D9740

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
  tools/lldb-mi/MIDriver.cpp

Index: tools/lldb-mi/MIDriver.cpp
===
--- tools/lldb-mi/MIDriver.cpp
+++ tools/lldb-mi/MIDriver.cpp
@@ -602,9 +602,6 @@
   // Close and wait for the workers to stop
   StopWorkerThreads();
 
-  // Ensure that a new line is sent as the last act of the dying driver
-  m_rStdOut.WriteMIResponse("\n", false);
-
   return MIstatus::success;
 }
 
Index: packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
@@ -84,3 +84,79 @@
 # Test that a process output is wrapped correctly
 self.expect("\@\"'rn\"")
 self.expect("\@\"` - it's nx12\"\"")
+
+@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
+def test_lldbmi_output_grammar(self):
+"""Test that 'lldb-mi --interpreter' uses standard output syntax."""
+
+self.spawnLldbMi(args = None)
+self.child.setecho(False)
+
+# Run all commands simultaneously
+self.runCmd("-unknown-command")
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.runCmd("-break-insert -f main")
+self.runCmd("-gdb-set target-async off")
+self.runCmd("-exec-run")
+self.runCmd("-gdb-set target-async on")
+self.runCmd("-exec-continue")
+self.runCmd("-gdb-exit")
+
+# Test that the program's output matches to the following pattern:
+# ( async-record | stream-record )* [ result-record ] "(gdb)" nl
+async_record  = "^[0-9]*(\*|\+|=).+?\n" # 1
+stream_record = "^(~|@|&).+?\n" # 2
+result_record = "^[0-9]*\^.+?\n"# 3
+prompt= "^\(gdb\)\r\n"  # 4
+command   = "^\r\n" # 5 (it looks like empty line 
for pexpect)
+error = "^.+?\n"# 6
+import pexpect  # 7 (EOF)
+all_patterns = [ async_record, stream_record, result_record, prompt, 
command, error, pexpect.EOF ]
+def get_bit(pattern):  return all_patterns.index(pattern)
+def get_mask(pattern): return 1 << get_bit(pattern)
+def or_op(x, y):   return x | y
+def get_state(*args):  return reduce(or_op, map(get_mask, args))
+
+next_state = get_state(command)
+while True:
+it = self.expect(all_patterns)
+matched_pattern = all_patterns[it]
+
+# Check that state is acceptable
+if not (next_state & get_mask(matched_pattern)):
+self.fail("error: inconsistent pattern '%s' for state %#x 
(matched string: %s)" % (repr(matched_pattern), next_state, self.child.after))
+elif matched_pattern == async_record or matched_pattern == 
stream_record:
+next_state = get_state(async_record, stream_record, 
result_record, prompt)
+elif matched_pattern == result_record:
+# FIXME lldb-mi prints the async-record out of turn
+# ```
+#   ^done
+#   (gdb)
+#   ^running
+#   =thread-group-started,id="i1",pid="13875"
+#   (gdb)
+# ```
+# Therefore to pass that test I changed the grammar's rule:
+#   next_state = get_state(prompt)
+# to:
+next_state = get_state(async_record, prompt)
+elif matched_pattern == prompt:
+# FIXME lldb-mi prints the prompt out of turn
+# ```
+#   ^done
+#   (gdb)
+#   ^running
+#   (gdb)
+#   (gdb)
+# ```
+# Therefore to pass that test I changed the grammar's rule:
+#   next_state = get_state(async_record, stream_record, 
result_record, command, pexpect.EOF)
+# to:
+next_state = get_state(async_record, stream_record, 
result_record, prompt, command, pexpect.EOF)
+elif matched_pattern == command:
+next_state = get_state(async_record, stream_record, 
result_record)
+elif matched_pattern == pexpect.EOF:
+break
+else:
+self.fail("error: pexpect returned an unknown state")


Index: tools/lldb-mi/MIDriver.cpp
=

Re: [Lldb-commits] [PATCH] D9740: Add MiSyntaxTestCase.test_lldbmi_output_grammar test (MI)

2016-09-12 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 70979.
ki.stfu marked 6 inline comments as done.
ki.stfu added a comment.

Rebase against ToT; Apply autopep8


https://reviews.llvm.org/D9740

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
  tools/lldb-mi/MIDriver.cpp

Index: tools/lldb-mi/MIDriver.cpp
===
--- tools/lldb-mi/MIDriver.cpp
+++ tools/lldb-mi/MIDriver.cpp
@@ -602,9 +602,6 @@
   // Close and wait for the workers to stop
   StopWorkerThreads();
 
-  // Ensure that a new line is sent as the last act of the dying driver
-  m_rStdOut.WriteMIResponse("\n", false);
-
   return MIstatus::success;
 }
 
Index: packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
@@ -9,6 +9,7 @@
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
+from functools import reduce
 
 
 class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
@@ -84,3 +85,103 @@
 # Test that a process output is wrapped correctly
 self.expect("\@\"'rn\"")
 self.expect("\@\"` - it's nx12\"\"")
+
+@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread races
+def test_lldbmi_output_grammar(self):
+"""Test that 'lldb-mi --interpreter' uses standard output syntax."""
+
+self.spawnLldbMi(args=None)
+self.child.setecho(False)
+
+# Run all commands simultaneously
+self.runCmd("-unknown-command")
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.runCmd("-break-insert -f main")
+self.runCmd("-gdb-set target-async off")
+self.runCmd("-exec-run")
+self.runCmd("-gdb-set target-async on")
+self.runCmd("-exec-continue")
+self.runCmd("-gdb-exit")
+
+# Test that the program's output matches to the following pattern:
+# ( async-record | stream-record )* [ result-record ] "(gdb)" nl
+async_record = "^[0-9]*(\*|\+|=).+?\n"  # 1
+stream_record = "^(~|@|&).+?\n" # 2
+result_record = "^[0-9]*\^.+?\n"# 3
+prompt = "^\(gdb\)\r\n" # 4
+command = "^\r\n"   # 5 (it looks like empty line for pexpect)
+error = "^.+?\n"# 6
+import pexpect  # 7 (EOF)
+all_patterns = [
+async_record,
+stream_record,
+result_record,
+prompt,
+command,
+error,
+pexpect.EOF]
+
+# Routines to get a bit-mask for the specified list of patterns
+def get_bit(pattern): return all_patterns.index(pattern)
+def get_mask(pattern): return 1 << get_bit(pattern)
+def or_op(x, y): return x | y
+def get_state(*args): return reduce(or_op, map(get_mask, args))
+
+next_state = get_state(command)
+while True:
+it = self.expect(all_patterns)
+matched_pattern = all_patterns[it]
+
+# Check that state is acceptable
+if not (next_state & get_mask(matched_pattern)):
+self.fail(
+"error: inconsistent pattern '%s' for state %#x (matched string: %s)" %
+(repr(matched_pattern), next_state, self.child.after))
+elif matched_pattern == async_record or matched_pattern == stream_record:
+next_state = get_state(
+async_record,
+stream_record,
+result_record,
+prompt)
+elif matched_pattern == result_record:
+# FIXME lldb-mi prints async-records out of turn
+# ```
+#   ^done
+#   (gdb)
+#   ^running
+#   =thread-group-started,id="i1",pid="13875"
+#   (gdb)
+# ```
+# Therefore to pass that test I changed the grammar's rule:
+#   next_state = get_state(prompt)
+# to:
+next_state = get_state(async_record, prompt)
+elif matched_pattern == prompt:
+# FIXME lldb-mi prints the prompt out of turn
+# ```
+#   ^done
+#   (gdb)
+#   ^running
+#   (gdb)
+#   (gdb)
+# ```
+# Therefore to pass that test I changed the grammar's rule:
+#   next_state = get_state(async_record, stream_record, result_record, command, pexpect.EO

Re: [Lldb-commits] [PATCH] D9740: Add MiSyntaxTestCase.test_lldbmi_output_grammar test (MI)

2016-09-12 Thread Ilia K via lldb-commits
This revision was automatically updated to reflect the committed changes.
ki.stfu marked an inline comment as done.
Closed by commit rL281199: Add MiSyntaxTestCase.test_lldbmi_output_grammar test 
(MI) (authored by ki.stfu).

Changed prior to commit:
  https://reviews.llvm.org/D9740?vs=70979&id=70980#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D9740

Files:
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
  lldb/trunk/tools/lldb-mi/MIDriver.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
@@ -9,6 +9,7 @@
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
+from functools import reduce
 
 
 class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
@@ -84,3 +85,103 @@
 # Test that a process output is wrapped correctly
 self.expect("\@\"'rn\"")
 self.expect("\@\"` - it's nx12\"\"")
+
+@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread races
+def test_lldbmi_output_grammar(self):
+"""Test that 'lldb-mi --interpreter' uses standard output syntax."""
+
+self.spawnLldbMi(args=None)
+self.child.setecho(False)
+
+# Run all commands simultaneously
+self.runCmd("-unknown-command")
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.runCmd("-break-insert -f main")
+self.runCmd("-gdb-set target-async off")
+self.runCmd("-exec-run")
+self.runCmd("-gdb-set target-async on")
+self.runCmd("-exec-continue")
+self.runCmd("-gdb-exit")
+
+# Test that the program's output matches to the following pattern:
+# ( async-record | stream-record )* [ result-record ] "(gdb)" nl
+async_record = "^[0-9]*(\*|\+|=).+?\n"  # 1
+stream_record = "^(~|@|&).+?\n" # 2
+result_record = "^[0-9]*\^.+?\n"# 3
+prompt = "^\(gdb\)\r\n" # 4
+command = "^\r\n"   # 5 (it looks like empty line for pexpect)
+error = "^.+?\n"# 6
+import pexpect  # 7 (EOF)
+all_patterns = [
+async_record,
+stream_record,
+result_record,
+prompt,
+command,
+error,
+pexpect.EOF]
+
+# Routines to get a bit-mask for the specified list of patterns
+def get_bit(pattern): return all_patterns.index(pattern)
+def get_mask(pattern): return 1 << get_bit(pattern)
+def or_op(x, y): return x | y
+def get_state(*args): return reduce(or_op, map(get_mask, args))
+
+next_state = get_state(command)
+while True:
+it = self.expect(all_patterns)
+matched_pattern = all_patterns[it]
+
+# Check that state is acceptable
+if not (next_state & get_mask(matched_pattern)):
+self.fail(
+"error: inconsistent pattern '%s' for state %#x (matched string: %s)" %
+(repr(matched_pattern), next_state, self.child.after))
+elif matched_pattern == async_record or matched_pattern == stream_record:
+next_state = get_state(
+async_record,
+stream_record,
+result_record,
+prompt)
+elif matched_pattern == result_record:
+# FIXME lldb-mi prints async-records out of turn
+# ```
+#   ^done
+#   (gdb)
+#   ^running
+#   =thread-group-started,id="i1",pid="13875"
+#   (gdb)
+# ```
+# Therefore to pass that test I changed the grammar's rule:
+#   next_state = get_state(prompt)
+# to:
+next_state = get_state(async_record, prompt)
+elif matched_pattern == prompt:
+# FIXME lldb-mi prints the prompt out of turn
+# ```
+#   ^done
+#   (gdb)
+#   ^running
+#   (gdb)
+#   (gdb)
+# ```
+# Therefore to pass that test I changed the grammar's rule:
+#   next_state = get_state(async_record, stream_record, result_record, command, pexpect.EOF)
+# to:
+next_state = get_state(
+async_record,
+stream_record,
+result_record

[Lldb-commits] [lldb] r281199 - Add MiSyntaxTestCase.test_lldbmi_output_grammar test (MI)

2016-09-12 Thread Ilia K via lldb-commits
Author: ki.stfu
Date: Mon Sep 12 02:14:51 2016
New Revision: 281199

URL: http://llvm.org/viewvc/llvm-project?rev=281199&view=rev
Log:
Add MiSyntaxTestCase.test_lldbmi_output_grammar test (MI)

Summary: This patch adds a new test and fixes extra new-line before exit

Reviewers: abidh

Subscribers: ki.stfu, dawn, lldb-commits, abidh

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
lldb/trunk/tools/lldb-mi/MIDriver.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=281199&r1=281198&r2=281199&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py 
Mon Sep 12 02:14:51 2016
@@ -9,6 +9,7 @@ import lldbmi_testcase
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
+from functools import reduce
 
 
 class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
@@ -84,3 +85,103 @@ class MiSyntaxTestCase(lldbmi_testcase.M
 # Test that a process output is wrapped correctly
 self.expect("\@\"'rn\"")
 self.expect("\@\"` - it's nx12\"\"")
+
+@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
+def test_lldbmi_output_grammar(self):
+"""Test that 'lldb-mi --interpreter' uses standard output syntax."""
+
+self.spawnLldbMi(args=None)
+self.child.setecho(False)
+
+# Run all commands simultaneously
+self.runCmd("-unknown-command")
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.runCmd("-break-insert -f main")
+self.runCmd("-gdb-set target-async off")
+self.runCmd("-exec-run")
+self.runCmd("-gdb-set target-async on")
+self.runCmd("-exec-continue")
+self.runCmd("-gdb-exit")
+
+# Test that the program's output matches to the following pattern:
+# ( async-record | stream-record )* [ result-record ] "(gdb)" nl
+async_record = "^[0-9]*(\*|\+|=).+?\n"  # 1
+stream_record = "^(~|@|&).+?\n" # 2
+result_record = "^[0-9]*\^.+?\n"# 3
+prompt = "^\(gdb\)\r\n" # 4
+command = "^\r\n"   # 5 (it looks like empty line 
for pexpect)
+error = "^.+?\n"# 6
+import pexpect  # 7 (EOF)
+all_patterns = [
+async_record,
+stream_record,
+result_record,
+prompt,
+command,
+error,
+pexpect.EOF]
+
+# Routines to get a bit-mask for the specified list of patterns
+def get_bit(pattern): return all_patterns.index(pattern)
+def get_mask(pattern): return 1 << get_bit(pattern)
+def or_op(x, y): return x | y
+def get_state(*args): return reduce(or_op, map(get_mask, args))
+
+next_state = get_state(command)
+while True:
+it = self.expect(all_patterns)
+matched_pattern = all_patterns[it]
+
+# Check that state is acceptable
+if not (next_state & get_mask(matched_pattern)):
+self.fail(
+"error: inconsistent pattern '%s' for state %#x (matched 
string: %s)" %
+(repr(matched_pattern), next_state, self.child.after))
+elif matched_pattern == async_record or matched_pattern == 
stream_record:
+next_state = get_state(
+async_record,
+stream_record,
+result_record,
+prompt)
+elif matched_pattern == result_record:
+# FIXME lldb-mi prints async-records out of turn
+# ```
+#   ^done
+#   (gdb)
+#   ^running
+#   =thread-group-started,id="i1",pid="13875"
+#   (gdb)
+# ```
+# Therefore to pass that test I changed the grammar's rule:
+#   next_state = get_state(prompt)
+# to:
+next_state = get_state(async_record, prompt)
+elif matched_pattern == prompt:
+# FIXME lldb-mi prints the prompt out of turn
+# ```
+#   ^done
+#   (gdb)
+#   ^running
+#   (gdb)
+#   (gdb)
+# ```
+# Therefore to pas

Re: [Lldb-commits] [PATCH] D23883: Remove MIUtilParse (no longer used)

2016-09-12 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.
This revision is now accepted and ready to land.

lgtm


https://reviews.llvm.org/D23883



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


Re: [Lldb-commits] [PATCH] D24711: [lldb-mi] Fix implementation for a few mi commands

2016-09-18 Thread Ilia K via lldb-commits
ki.stfu requested changes to this revision.
ki.stfu added a comment.
This revision now requires changes to proceed.

Hi! Please add tests for commands that you fixed. I'll take a look later this 
week.


Repository:
  rL LLVM

https://reviews.llvm.org/D24711



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


Re: [Lldb-commits] [PATCH] D24711: [lldb-mi] Fix implementation for a few mi commands

2016-09-20 Thread Ilia K via lldb-commits
ki.stfu added a comment.

yes


Repository:
  rL LLVM

https://reviews.llvm.org/D24711



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


Re: [Lldb-commits] [PATCH] D24202: Fix parsing expressions to evaluate with spaces and optional args (MI)

2016-09-21 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 72136.
ki.stfu added a comment.

Rebase againt ToT; Apply clang-format & autopep; Minor fix in condition


https://reviews.llvm.org/D24202

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
  tools/lldb-mi/MICmdArgValOptionLong.cpp

Index: tools/lldb-mi/MICmdArgValOptionLong.cpp
===
--- tools/lldb-mi/MICmdArgValOptionLong.cpp
+++ tools/lldb-mi/MICmdArgValOptionLong.cpp
@@ -184,16 +184,8 @@
 //--
 bool CMICmdArgValOptionLong::ExtractExpectedOptions(CMICmdArgContext &vrwTxt,
 const MIuint nArgIndex) {
-  CMIUtilString::VecString_t vecOptions;
-  MIuint nOptionsPresent = 0;
-  if ((m_eExpectingOptionType != eArgValType_StringQuoted) &&
-  (m_eExpectingOptionType != eArgValType_StringQuotedNumber) &&
-  (m_eExpectingOptionType != eArgValType_StringQuotedNumberPath))
-nOptionsPresent = vrwTxt.GetArgsLeftToParse().Split(" ", vecOptions);
-  else
-nOptionsPresent =
-vrwTxt.GetArgsLeftToParse().SplitConsiderQuotes(" ", vecOptions);
-  if (nOptionsPresent == 0)
+  CMIUtilString::VecString_t vecOptions = vrwTxt.GetArgs();
+  if (vecOptions.size() == 0)
 return MIstatus::failure;
 
   MIuint nArgIndexCnt = 0;
Index: packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
@@ -61,7 +61,7 @@
 self.expect("\^done,value=\"30\"")
 self.runCmd("-var-update --all-values var2")
 # 
self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-# #FIXME -var-update doesn't work
+# FIXME -var-update doesn't work
 self.runCmd("-var-delete var2")
 self.expect("\^done")
 self.runCmd("-var-create var2 * g_MyVar")
@@ -84,7 +84,7 @@
 self.expect("\^done,value=\"3\"")
 self.runCmd("-var-update --all-values var3")
 # 
self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-# #FIXME -var-update doesn't work
+# FIXME -var-update doesn't work
 self.runCmd("-var-delete var3")
 self.expect("\^done")
 self.runCmd("-var-create var3 * s_MyVar")
@@ -107,7 +107,7 @@
 self.expect("\^done,value=\"2\"")
 self.runCmd("-var-update --all-values var4")
 # 
self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-# #FIXME -var-update doesn't work
+# FIXME -var-update doesn't work
 self.runCmd("-var-delete var4")
 self.expect("\^done")
 self.runCmd("-var-create var4 * b")
@@ -148,6 +148,13 @@
 self.expect(
 
"\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$[0-9]+\",exp=\"\*\$[0-9]+\",numchild=\"0\",type=\"const
 char\",thread-id=\"4294967295\",value=\"47 
'/'\",has_more=\"0\"\}\],has_more=\"0\"")
 
+# Print an expression with spaces and optional arguments
+self.runCmd("-data-evaluate-expression \"a + b\"")
+self.expect("\^done,value=\"12\"")
+self.runCmd("-var-create var7 * \"a + b\" --thread 1 --frame 0")
+self.expect(
+
"\^done,name=\"var7\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfLinux  # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
@@ -315,12 +322,14 @@
 # Test that -var-list-children lists all children with their values
 # (and that from and to are optional)
 self.runCmd("-var-list-children --all-values var_complx")
-
self.expect("\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous
 
struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type
 \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"")
+self.expect(
+
"\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous
 
struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",nu

Re: [Lldb-commits] [PATCH] D24202: Fix parsing expressions to evaluate with spaces and optional args (MI)

2016-09-21 Thread Ilia K via lldb-commits
ki.stfu marked an inline comment as done.


Comment at: tools/lldb-mi/MICmdArgValOptionLong.cpp:187-188
@@ -186,12 +186,4 @@
 const MIuint nArgIndex) {
-  CMIUtilString::VecString_t vecOptions;
-  MIuint nOptionsPresent = 0;
-  if ((m_eExpectingOptionType != eArgValType_StringQuoted) &&
-  (m_eExpectingOptionType != eArgValType_StringQuotedNumber) &&
-  (m_eExpectingOptionType != eArgValType_StringQuotedNumberPath))
-nOptionsPresent = vrwTxt.GetArgsLeftToParse().Split(" ", vecOptions);
-  else
-nOptionsPresent =
-vrwTxt.GetArgsLeftToParse().SplitConsiderQuotes(" ", vecOptions);
-  if (nOptionsPresent == 0)
+  CMIUtilString::VecString_t vecOptions = vrwTxt.GetArgs();
+  if (vecOptions.size() == 0)
 return MIstatus::failure;

@edmunoz: I did it as you suggested.


https://reviews.llvm.org/D24202



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


[Lldb-commits] [lldb] r282135 - Fix parsing expressions to evaluate with spaces and optional args (MI)

2016-09-21 Thread Ilia K via lldb-commits
Author: ki.stfu
Date: Thu Sep 22 00:08:41 2016
New Revision: 282135

URL: http://llvm.org/viewvc/llvm-project?rev=282135&view=rev
Log:
Fix parsing expressions to evaluate with spaces and optional args (MI)

Summary:
When extracting options for long options (starting with `--`), the use of
`MIUtilString::SplitConsiderQuotes` to split all the arguments was being
conditioned on the option type to be expected. This was wrong as this caused
other options to be parsed incorrectly since it was not taking into account the
presence of quotes.

Patch by Ed Munoz 

Reviewers: edmunoz, ki.stfu

Subscribers: ki.stfu, lldb-commits

Projects: #lldb

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py?rev=282135&r1=282134&r2=282135&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py 
(original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py 
Thu Sep 22 00:08:41 2016
@@ -61,7 +61,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 self.expect("\^done,value=\"30\"")
 self.runCmd("-var-update --all-values var2")
 # 
self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-# #FIXME -var-update doesn't work
+# FIXME -var-update doesn't work
 self.runCmd("-var-delete var2")
 self.expect("\^done")
 self.runCmd("-var-create var2 * g_MyVar")
@@ -84,7 +84,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 self.expect("\^done,value=\"3\"")
 self.runCmd("-var-update --all-values var3")
 # 
self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-# #FIXME -var-update doesn't work
+# FIXME -var-update doesn't work
 self.runCmd("-var-delete var3")
 self.expect("\^done")
 self.runCmd("-var-create var3 * s_MyVar")
@@ -107,7 +107,7 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 self.expect("\^done,value=\"2\"")
 self.runCmd("-var-update --all-values var4")
 # 
self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-# #FIXME -var-update doesn't work
+# FIXME -var-update doesn't work
 self.runCmd("-var-delete var4")
 self.expect("\^done")
 self.runCmd("-var-create var4 * b")
@@ -148,6 +148,13 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 self.expect(
 
"\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$[0-9]+\",exp=\"\*\$[0-9]+\",numchild=\"0\",type=\"const
 char\",thread-id=\"4294967295\",value=\"47 
'/'\",has_more=\"0\"\}\],has_more=\"0\"")
 
+# Print an expression with spaces and optional arguments
+self.runCmd("-data-evaluate-expression \"a + b\"")
+self.expect("\^done,value=\"12\"")
+self.runCmd("-var-create var7 * \"a + b\" --thread 1 --frame 0")
+self.expect(
+
"\^done,name=\"var7\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfLinux  # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
@@ -315,12 +322,14 @@ class MiVarTestCase(lldbmi_testcase.MiTe
 # Test that -var-list-children lists all children with their values
 # (and that from and to are optional)
 self.runCmd("-var-list-children --all-values var_complx")
-
self.expect("\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous
 
struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type
 \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"")
+self.expect(
+
"\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous
 
struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"co

Re: [Lldb-commits] [PATCH] D24202: Fix parsing expressions to evaluate with spaces and optional args (MI)

2016-09-21 Thread Ilia K via lldb-commits
This revision was automatically updated to reflect the committed changes.
ki.stfu marked an inline comment as done.
Closed by commit rL282135: Fix parsing expressions to evaluate with spaces and 
optional args (MI) (authored by ki.stfu).

Changed prior to commit:
  https://reviews.llvm.org/D24202?vs=72136&id=72137#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24202

Files:
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
  lldb/trunk/tools/lldb-mi/MICmdArgValOptionLong.cpp

Index: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
@@ -61,7 +61,7 @@
 self.expect("\^done,value=\"30\"")
 self.runCmd("-var-update --all-values var2")
 # 
self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-# #FIXME -var-update doesn't work
+# FIXME -var-update doesn't work
 self.runCmd("-var-delete var2")
 self.expect("\^done")
 self.runCmd("-var-create var2 * g_MyVar")
@@ -84,7 +84,7 @@
 self.expect("\^done,value=\"3\"")
 self.runCmd("-var-update --all-values var3")
 # 
self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-# #FIXME -var-update doesn't work
+# FIXME -var-update doesn't work
 self.runCmd("-var-delete var3")
 self.expect("\^done")
 self.runCmd("-var-create var3 * s_MyVar")
@@ -107,7 +107,7 @@
 self.expect("\^done,value=\"2\"")
 self.runCmd("-var-update --all-values var4")
 # 
self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
-# #FIXME -var-update doesn't work
+# FIXME -var-update doesn't work
 self.runCmd("-var-delete var4")
 self.expect("\^done")
 self.runCmd("-var-create var4 * b")
@@ -148,6 +148,13 @@
 self.expect(
 
"\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$[0-9]+\",exp=\"\*\$[0-9]+\",numchild=\"0\",type=\"const
 char\",thread-id=\"4294967295\",value=\"47 
'/'\",has_more=\"0\"\}\],has_more=\"0\"")
 
+# Print an expression with spaces and optional arguments
+self.runCmd("-data-evaluate-expression \"a + b\"")
+self.expect("\^done,value=\"12\"")
+self.runCmd("-var-create var7 * \"a + b\" --thread 1 --frame 0")
+self.expect(
+
"\^done,name=\"var7\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+
 @skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
 @skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
 @skipIfLinux  # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
@@ -315,12 +322,14 @@
 # Test that -var-list-children lists all children with their values
 # (and that from and to are optional)
 self.runCmd("-var-list-children --all-values var_complx")
-
self.expect("\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous
 
struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type
 \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"")
+self.expect(
+
"\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous
 
struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type
 \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"")
 self.runCmd("-var-list-children --simple-values var_complx_array")
 self.expect(
 
"\^done,numchild=\"2\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
 self.runCmd("-var-list-children 0 var_pcomplx")
-
self.expect("\^done,numchild=\"2\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0

Re: [Lldb-commits] [PATCH] D15593: Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines.

2015-12-17 Thread Ilia K via lldb-commits
ki.stfu requested changes to this revision.
ki.stfu added a comment.
This revision now requires changes to proceed.

clang-format your changes please (there are many deviations from the coding 
style)

I'll check it on Linux and say if everything is OK.



Comment at: source/Commands/CommandObjectTarget.cpp:1510
@@ -1503,2 +1509,3 @@
 
-for (uint32_t i=0; iGetNumCompileUnits();
+for (int i = 0; i < ncus; i++)
 {

use size_t


Comment at: source/Commands/CommandObjectTarget.cpp:1541-1542
@@ +1540,4 @@
+CompUnitSP cu_sp(module->GetCompileUnitAtIndex(i));
+if (!cu_sp)
+continue;
+CompileUnit *cu = cu_sp.get();

Isn't it always false?


Comment at: source/Commands/CommandObjectTarget.cpp:1543
@@ +1542,3 @@
+continue;
+CompileUnit *cu = cu_sp.get();
+const FileSpecList &cu_file_list = cu->GetSupportFiles();

You don't need a raw pointer here, just use cu_sp.get() on line #1587


Comment at: source/Commands/CommandObjectTarget.cpp:1576
@@ +1575,3 @@
+assert(lldb_private::FileSpec::Equal(cu_file_spec, 
line_entry.file, has_path));
+if (cu_header_printed == false)
+{

!cu_header_printed


Comment at: source/Commands/CommandObjectTarget.cpp:1594-1596
@@ +1593,5 @@
+// Anymore after this one?
+start_idx++;
+start_idx = cu->FindLineEntry(start_idx, line, 
&cu_file_spec,
+  /*exact=*/true, 
&line_entry);
+} while (start_idx != UINT32_MAX);

combine it together:
```
cu->FindLineEntry(start_idx + 1, ...)
```


Comment at: source/Commands/CommandObjectTarget.cpp:2689
@@ +2688,3 @@
+default:
+error.SetErrorStringWithFormat ("unrecognized option %c.", 
short_option);
+break;

Please use the most popular pattern:
```
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
```


Comment at: tools/lldb-mi/MICmdCmdSymbol.cpp:85
@@ -84,7 +84,3 @@
 const CMIUtilString &strFilePath(pArgFile->GetValue());
-// FIXME: this won't work for header files!  To try and use existing
-// commands to get this to work for header files would be too slow.
-// Instead, this code should be rewritten to use APIs and/or support
-// should be added to lldb which would work for header files.
-const CMIUtilString strCmd(CMIUtilString::Format("target modules dump 
line-table \"%s\"", strFilePath.AddSlashes().c_str()));
+const CMIUtilString strCmd(CMIUtilString::Format("target modules dump 
lines -u false -e true -r false \"%s\"", strFilePath.AddSlashes().c_str()));
 

Could you use long-options here?


Repository:
  rL LLVM

http://reviews.llvm.org/D15593



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


Re: [Lldb-commits] [PATCH] D15593: Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines.

2015-12-17 Thread Ilia K via lldb-commits
ki.stfu added inline comments.


Comment at: 
packages/Python/lldbsuite/test/tools/lldb-mi/symbol/symbol_list_lines_inline_test.h:20
@@ -19,3 +19,3 @@
 {
-return a + b;
+return a + b; // FUNC_mfunc
 }

and could you pick it up at 1 line above?


Repository:
  rL LLVM

http://reviews.llvm.org/D15593



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


Re: [Lldb-commits] [PATCH] D15593: Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines.

2015-12-17 Thread Ilia K via lldb-commits
ki.stfu added inline comments.


Comment at: source/Commands/CommandObjectTarget.cpp:1536-1537
@@ -1508,1 +1535,4 @@
+bool has_path = (file_spec.GetDirectory().AsCString() != 0);
+int ncus = module->GetNumCompileUnits();
+for (size_t i = 0; i < ncus; i++)
 {

use it on line #1536 too


Comment at: source/Commands/CommandObjectTarget.cpp:1543
@@ +1542,3 @@
+continue;
+CompileUnit *cu = cu_sp.get();
+const FileSpecList &cu_file_list = cu->GetSupportFiles();

That's no problem. Just replace s/cu/cu_sp/ on lines #1544, #1565, #1580, 
#1594, and then use cu_sp.get() on line #1586.


Comment at: source/Commands/CommandObjectTarget.cpp:1594-1596
@@ +1593,5 @@
+start_idx++;
+start_idx = cu->FindLineEntry(start_idx, line, 
&cu_file_spec, /*exact=*/true, &line_entry);
+} while (start_idx != UINT32_MAX);
+
+// Try the next higher line, starting over at start_idx 0.

How about that?
```
start_idx = cu->FindLineEntry(start_idx + 1,
  line,
  &cu_file_spec,
  /*exact=*/true,
  &line_entry);
```


Comment at: source/Commands/CommandObjectTarget.cpp:2689
@@ +2688,3 @@
+break;
+}
+

nit: you forgot the dot


Repository:
  rL LLVM

http://reviews.llvm.org/D15593



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


Re: [Lldb-commits] [PATCH] D15593: Enhance "target modules dump line " and use it to fix MI's -symbol-list-lines.

2015-12-17 Thread Ilia K via lldb-commits
ki.stfu added inline comments.


Comment at: tools/lldb-mi/MICmdCmdSymbol.cpp:226
@@ -225,3 @@
-// Skip entries which don't match the desired source.
-if (strWantFile != strFile)
-continue;

Is strWantFile needed? Seems it's an auxiliary variable.


Repository:
  rL LLVM

http://reviews.llvm.org/D15593



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


Re: [Lldb-commits] [PATCH] D11574: Add size field to library load event

2015-08-10 Thread Ilia K via lldb-commits
ki.stfu added a comment.

In http://reviews.llvm.org/D11574#220627, @paulmaybee wrote:

> Can you please check in in for me. Thanks.


Ok, tomorrow.


http://reviews.llvm.org/D11574



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


[Lldb-commits] [lldb] r244573 - Add size field to library load event (MI)

2015-08-10 Thread Ilia K via lldb-commits
Author: ki.stfu
Date: Tue Aug 11 01:07:14 2015
New Revision: 244573

URL: http://llvm.org/viewvc/llvm-project?rev=244573&view=rev
Log:
Add size field to library load event (MI)

Summary:
(This revision supersedes the abandon: http://reviews.llvm.org/D9716)
Size field is used to let the debugger attribute an address to a specific 
library when symbols are not available. 
For example:
OpenGLESApp4.app!Cube_draw() Line 74C
OpenGLESApp4.app!-[GameViewController 
glkView:drawInRect:](GameViewController * self, SEL _cmd, GLKView * view, 
CGRect rect) Line 89C++
GLKit!
QuartzCore!   
QuartzCore!   
QuartzCore!   
QuartzCore!   
QuartzCore!   
UIKit!
UIKit!
UIKit!
UIKit!
FrontBoardServices!   
CoreFoundation!   

Patch from paul...@microsoft.com

Reviewers: ChuckR, abidh, ki.stfu

Subscribers: greggm, lldb-commits

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


Modified:
lldb/trunk/test/tools/lldb-mi/TestMiLibraryLoaded.py
lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
lldb/trunk/tools/lldb-mi/MIExtensions.txt

Modified: lldb/trunk/test/tools/lldb-mi/TestMiLibraryLoaded.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/TestMiLibraryLoaded.py?rev=244573&r1=244572&r2=244573&view=diff
==
--- lldb/trunk/test/tools/lldb-mi/TestMiLibraryLoaded.py (original)
+++ lldb/trunk/test/tools/lldb-mi/TestMiLibraryLoaded.py Tue Aug 11 01:07:14 
2015
@@ -26,10 +26,9 @@ class MiLibraryLoadedTestCase(lldbmi_tes
 import os
 path = os.path.join(os.getcwd(), self.myexe)
 symbols_path = os.path.join(path + ".dSYM", "Contents", "Resources", 
"DWARF", self.myexe)
-self.expect([
-
"=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"1\",symbols-path=\"%s\",loaded_addr=\"-\""
 % (path, path, path, symbols_path),
-
"=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"0\",loaded_addr=\"-\""
 % (path, path, path)
-], exactly = True)
+def add_slashes(x): return x.replace("\\", "").replace("\"", 
"\\\"").replace("\'", "\\\'").replace("\0", "\\\0")
+self.expect([ 
"=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"1\",symbols-path=\"%s\",loaded_addr=\"-\",size=\"[0-9]+\""
 % (add_slashes(path), add_slashes(path), add_slashes(path), 
add_slashes(symbols_path)),
+  
"=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"0\",loaded_addr=\"-\",size=\"[0-9]+\""
 % (add_slashes(path), add_slashes(path), add_slashes(path)) ])
 
 if __name__ == '__main__':
 unittest2.main()

Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp?rev=244573&r1=244572&r2=244573&view=diff
==
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp Tue Aug 11 
01:07:14 2015
@@ -688,17 +688,17 @@ CMICmnLLDBDebuggerHandleEvents::MiHelpGe
 std::unique_ptr apPath(new char[PATH_MAX]);
 vModule.GetFileSpec().GetPath(apPath.get(), PATH_MAX);
 const CMIUtilString strTargetPath(apPath.get());
-const CMICmnMIValueConst miValueConst(strTargetPath);
+const CMICmnMIValueConst miValueConst(strTargetPath.AddSlashes());
 const CMICmnMIValueResult miValueResult("id", miValueConst);
 vwrMiOutOfBandRecord.Add(miValueResult);
 // Build "target-name" field
-const CMICmnMIValueConst miValueConst2(strTargetPath);
+const CMICmnMIValueConst miValueConst2(strTargetPath.AddSlashes());
 const CMICmnMIValueResult miValueResult2("target-name", miValueConst2);
 vwrMiOutOfBandRecord.Add(miValueResult2);
 // Build "host-name" field
 vModule.GetPlatformFileSpec().GetPath(apPath.get(), PATH_MAX);
 const CMIUtilString strHostPath(apPath.get());
-const CMICmnMIValueConst miValueConst3(strHostPath);
+const CMICmnMIValueConst miValueConst3(strHostPath.AddSlashes());
 const CMICmnMIValueResult miValueResult3("host-name", miValueConst3);
 vwrMiOutOfBandRecord.Add(miValueResult3);
 
@@ -715,12 +715,12 @@ CMICmnLLDBDebuggerHandleEvents::MiHelpGe
 // Build "symbols-path" field
 if (bSymbolsLoaded)
 {
-const CMICmnMIValueConst miValueConst5(strSymbolsPath);
+const CMICmnMIValueConst 
miValueConst5(strSymbolsPath.AddSlashes());
 const CMICmnMIValueResult miValueResult5("symbols-path", 
miValueConst5);
 vwrMiOutOfBandRecord.Add(miValueResult5);
 }
 // Build "loaded_addr" field
- 

Re: [Lldb-commits] [PATCH] D11574: Add size field to library load event

2015-08-10 Thread Ilia K via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244573: Add size field to library load event (MI) (authored 
by ki.stfu).

Changed prior to commit:
  http://reviews.llvm.org/D11574?vs=31038&id=31772#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11574

Files:
  lldb/trunk/test/tools/lldb-mi/TestMiLibraryLoaded.py
  lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
  lldb/trunk/tools/lldb-mi/MIExtensions.txt

Index: lldb/trunk/tools/lldb-mi/MIExtensions.txt
===
--- lldb/trunk/tools/lldb-mi/MIExtensions.txt
+++ lldb/trunk/tools/lldb-mi/MIExtensions.txt
@@ -83,14 +83,15 @@
 
 # =library-loaded notification
 
-The =library-loaded notification has 3 extra fields:
+The =library-loaded notification has 4 extra fields:
 symbols-loaded - indicates that there are symbols for the loaded library
 symbols-path   - if symbols are exist then it contains a path for symbols 
of the loaded library
 loaded_addr- contains an address of the loaded library or "-" if 
address isn't resolved yet
+size   - contains the size in bytes of the section loaded at 
'loaded_addr'
 
 For example:
-
=library-loaded,id="/Users/IliaK/p/hello",target-name="/Users/IliaK/p/hello",host-name="/Users/IliaK/p/hello",symbols-loaded="1",symbols-path="/Users/IliaK/p/hello.dSYM/Contents/Resources/DWARF/hello",loaded_addr="-"
-
=library-loaded,id="/usr/lib/dyld",target-name="/usr/lib/dyld",host-name="/usr/lib/dyld",symbols-loaded="0",loaded_addr="0x7fff5fc0"
+
=library-loaded,id="/Users/IliaK/p/hello",target-name="/Users/IliaK/p/hello",host-name="/Users/IliaK/p/hello",symbols-loaded="1",symbols-path="/Users/IliaK/p/hello.dSYM/Contents/Resources/DWARF/hello",loaded_addr="-",size="4096"
+
=library-loaded,id="/usr/lib/dyld",target-name="/usr/lib/dyld",host-name="/usr/lib/dyld",symbols-loaded="0",loaded_addr="0x7fff5fc0",size="4096"
 
 # -target-attach
 
Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp
@@ -688,17 +688,17 @@
 std::unique_ptr apPath(new char[PATH_MAX]);
 vModule.GetFileSpec().GetPath(apPath.get(), PATH_MAX);
 const CMIUtilString strTargetPath(apPath.get());
-const CMICmnMIValueConst miValueConst(strTargetPath);
+const CMICmnMIValueConst miValueConst(strTargetPath.AddSlashes());
 const CMICmnMIValueResult miValueResult("id", miValueConst);
 vwrMiOutOfBandRecord.Add(miValueResult);
 // Build "target-name" field
-const CMICmnMIValueConst miValueConst2(strTargetPath);
+const CMICmnMIValueConst miValueConst2(strTargetPath.AddSlashes());
 const CMICmnMIValueResult miValueResult2("target-name", miValueConst2);
 vwrMiOutOfBandRecord.Add(miValueResult2);
 // Build "host-name" field
 vModule.GetPlatformFileSpec().GetPath(apPath.get(), PATH_MAX);
 const CMIUtilString strHostPath(apPath.get());
-const CMICmnMIValueConst miValueConst3(strHostPath);
+const CMICmnMIValueConst miValueConst3(strHostPath.AddSlashes());
 const CMICmnMIValueResult miValueResult3("host-name", miValueConst3);
 vwrMiOutOfBandRecord.Add(miValueResult3);
 
@@ -715,19 +715,26 @@
 // Build "symbols-path" field
 if (bSymbolsLoaded)
 {
-const CMICmnMIValueConst miValueConst5(strSymbolsPath);
+const CMICmnMIValueConst 
miValueConst5(strSymbolsPath.AddSlashes());
 const CMICmnMIValueResult miValueResult5("symbols-path", 
miValueConst5);
 vwrMiOutOfBandRecord.Add(miValueResult5);
 }
 // Build "loaded_addr" field
-const lldb::SBAddress sbAddress(vModule.GetObjectFileHeaderAddress());
+lldb::SBAddress sbAddress(vModule.GetObjectFileHeaderAddress());
 CMICmnLLDBDebugSessionInfo 
&rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
 const lldb::addr_t 
nLoadAddress(sbAddress.GetLoadAddress(rSessionInfo.GetTarget()));
 const CMIUtilString strLoadedAddr(nLoadAddress != LLDB_INVALID_ADDRESS 
?
   CMIUtilString::Format("0x%016" 
PRIx64, nLoadAddress) : "-");
 const CMICmnMIValueConst miValueConst6(strLoadedAddr);
 const CMICmnMIValueResult miValueResult6("loaded_addr", miValueConst6);
 vwrMiOutOfBandRecord.Add(miValueResult6);
+
+// Build "size" field
+lldb::SBSection sbSection = sbAddress.GetSection();
+const CMIUtilString strSize(CMIUtilString::Format("%" PRIu64, 
sbSection.GetByteSize()));
+const CMICmnMIValueConst miValueConst7(strSize);
+const CMICmnMIValueResult miValueResult7("size", miValueConst7);
+vwrMiOutOfBandRecord.Add(miValueResult7);
 }
 
 return bOk;
Index: lldb/trunk/

Re: [Lldb-commits] [PATCH] D12634: Fix -data-evaluate-expression for array.

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

Source code looks good but please move the test to TestMiData.py.



Comment at: test/tools/lldb-mi/variable/TestMiVar.py:39-42
@@ -38,2 +38,6 @@
 self.expect("\^error,msg=\"Could not evaluate expression\"")
+
+# Check 2d array 
+self.runCmd("-data-evaluate-expression g_blk")
+self.expect("\^done,value=\"\{\[0\] = \{\[0\] = 1, \[1\] = 2, \[2\] = 
3\}, \[1\] = \{\[0\] = 4, \[1\] = 5, \[2\] = 6\}\}\"")
 

Please move it to a separate @lldmi_test test in data/TestMiData.py


Comment at: test/tools/lldb-mi/variable/main.cpp:105-110
@@ -103,2 +104,8 @@
 int a = 10, b = 20;
+g_blk[0][0] = 1;
+g_blk[0][1] = 2;
+g_blk[0][2] = 3;
+g_blk[1][0] = 4;
+g_blk[1][1] = 5;
+g_blk[1][2] = 6;
 s_MyVar = a + b;

Move it to data/main.cpp and create a separate function for that 
(data_evaluate_expression_test, for example)


http://reviews.llvm.org/D12634



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


Re: [Lldb-commits] [PATCH] D12634: Fix -data-evaluate-expression for array.

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

lgtm


http://reviews.llvm.org/D12634



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


[Lldb-commits] [lldb] r247256 - Fix an AttributeError in dotest.py if --executable points to a wrong place

2015-09-10 Thread Ilia K via lldb-commits
Author: ki.stfu
Date: Thu Sep 10 04:24:43 2015
New Revision: 247256

URL: http://llvm.org/viewvc/llvm-project?rev=247256&view=rev
Log:
Fix an AttributeError in dotest.py if --executable points to a wrong place

This patch fixes the following case:
```
  $ ./dotest.py --executable=~/p/llvm/build_ninja/bin/lldb tools/lldb-mi/
  '~/p/llvm/build_ninja/bin/lldb' is not a path to a valid executable
  Traceback (most recent call last):
File "./dotest.py", line 1306, in 
  setupSysPath()
File "./dotest.py", line 1004, in setupSysPath
  if not lldbtest_config.lldbExec:
  AttributeError: 'module' object has no attribute 'lldbExec'
```

And with this fix:
```
  $ ./dotest.py --executable=~/p/llvm/build_ninja/bin/lldb tools/lldb-mi/
  '~/p/llvm/build_ninja/bin/lldb' is not a path to a valid executable
  The 'lldb' executable cannot be located.  Some of the tests may not be run as 
a result.
```


Modified:
lldb/trunk/test/dotest.py

Modified: lldb/trunk/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=247256&r1=247255&r2=247256&view=diff
==
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Thu Sep 10 04:24:43 2015
@@ -997,7 +997,7 @@ def setupSysPath():
 
 if lldbtest_config.lldbExec and not is_exe(lldbtest_config.lldbExec):
 print "'{}' is not a path to a valid 
executable".format(lldbtest_config.lldbExec)
-del lldbtest_config.lldbExec
+lldbtest_config.lldbExec = None
 
 if not lldbtest_config.lldbExec:
 print "The 'lldb' executable cannot be located.  Some of the tests may 
not be run as a result."


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


Re: [Lldb-commits] [PATCH] D12764: [lldb-mi] Remove MIUtilSystem*.

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

lgtm


http://reviews.llvm.org/D12764



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


Re: [Lldb-commits] [PATCH] D12878: [lldb-mi] Clean up CMICmdArgSet usage.

2015-09-15 Thread Ilia K via lldb-commits
ki.stfu accepted this revision.
ki.stfu added a comment.
This revision is now accepted and ready to land.

lgtm



Comment at: tools/lldb-mi/MICmdArgSet.cpp:92
@@ -91,3 +91,3 @@
 // Type:Method.
 // Args:vArg- (R) A command argument object.
 // Return:  None.

brucem wrote:
> Should this say something other than `(R)` here?
This comment is useless, and for me it looks like an attempt to write something 
to follow the coding style. FMPOV, we should remove all comments like that, and 
move others to corresponding .h files.


http://reviews.llvm.org/D12878



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


Re: [Lldb-commits] [PATCH] D12115: [LLDB-MI] Fix -data-info-line and -symbol-list-lines when Windows filenames are used.

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


Comment at: test/tools/lldb-mi/symbol/main.cpp:12
@@ +11,3 @@
+// included in -symbol-list-lines main.cpp, by checking that all the lines
+// are between 20 and 29.
+// line 13

Don't impose restrictions on the main file which contains test cases for 
symbol-xxx commands. If a new cases should be added, we will be forced to 
modify this test case (or be sure that we are still between 20-29 lines). I 
don't want to care about existing test cases when adding a new one. So please 
keep this file independent of line numbers, and move all your line-dependent 
code to a new file. For me, it should look like:
main.cpp:
```
int main ()  {
  [...]
  symbol_list_lines_for_inline_test();
  [...]
}
```
symbol_list_lines_for_inline_test.cpp:
```
// Skip lines so we can make sure we're not seeing any lines from x.h
[...]
// line 17
// line 18
// line 19
#include "x.h"
extern int j;
extern int gfunc(int i);
int i;
void symbol_list_lines_for_inline_test()  {
i = gfunc(j);
i += ns::s.mfunc();
i += ns::ifunc(i);
}
```

And rename x.[h,cpp] to something more informative 
(symbol_list_lines_for_inline_test_x.[cpp|h] would be better).


Comment at: test/tools/lldb-mi/symbol/x.h:1-14
@@ +1,14 @@
+namespace ns {
+inline int ifunc(int i) {
+   return i;
+}
+struct S {
+   int a;
+   int b;
+   S() : a(3), b(4) {}
+   int mfunc() {
+   return a + b;
+   }
+};
+extern S s;
+}

Please fix the indentation here (for ex, use clang-format)


Comment at: tools/lldb-mi/MIUtilString.cpp:69
@@ +68,3 @@
+}
+
+

Remove this empty line


Repository:
  rL LLVM

http://reviews.llvm.org/D12115



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


Re: [Lldb-commits] [PATCH] D12115: [LLDB-MI] Fix -data-info-line and -symbol-list-lines when Windows filenames are used.

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

lgtm


Repository:
  rL LLVM

http://reviews.llvm.org/D12115



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


Re: [Lldb-commits] [PATCH] D12899: cmake fixups: post-build python step dependency and lldb-server dependency for lldb on Linux

2015-09-18 Thread Ilia K via lldb-commits
ki.stfu added a subscriber: ki.stfu.
ki.stfu added a comment.

Hi guys,

As for me it wasn't a bug and lldb should not require lldb-server and python 
framework. "ninja lldb" means "make a lldb executable please". I don't want to 
build lldb-server or python framework when typing that. If you are really want 
to get all those files, you can use "ninja". Or, if there is some (unknown for 
me) reason why you don't want to use it, perhaps it would better to introduce a 
new meta target named like lldb-bundle which depends on all lldb targets.


http://reviews.llvm.org/D12899



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


Re: [Lldb-commits] [PATCH] D12899: cmake fixups: post-build python step dependency and lldb-server dependency for lldb on Linux

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

i. e. +1 with @zturner


http://reviews.llvm.org/D12899



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


Re: [Lldb-commits] [PATCH] D12899: cmake fixups: post-build python step dependency and lldb-server dependency for lldb on Linux

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

In http://reviews.llvm.org/D12899#248648, @zturner wrote:

> One possible solution is to make an lldb-all target.


As I said, it would much better rather than changing lldb dependencies. But I'm 
still not sure, do we really need something like lldb-all? Why we can't use 
"ninja" (i.e. without arguments) for building a whole LLDB?


http://reviews.llvm.org/D12899



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


Re: [Lldb-commits] [PATCH] D12899: cmake fixups: post-build python step dependency and lldb-server dependency for lldb on Linux

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

In http://reviews.llvm.org/D12899#248657, @tberghammer wrote:

> In http://reviews.llvm.org/D12899#248654, @ki.stfu wrote:
>
> > In http://reviews.llvm.org/D12899#248648, @zturner wrote:
> >
> > > One possible solution is to make an lldb-all target.
> >
> >
> > As I said, it would much better rather than changing lldb dependencies. But 
> > I'm still not sure, do we really need something like lldb-all? Why we can't 
> > use "ninja" (i.e. without arguments) for building a whole LLDB?
>
>
> "ninja" without any argument builds everything including llvm, clang and a 
> lot of related tools what increase the link time by a lot (assuming something 
> changed in the llvm/clang repository since the last build).


cmake/ninja build has no a big difference between "ninja" and "ninja lldb":

  $ ninja -j1
  [1/3214] Building CXX object 
lib/Support/CMakeFiles/LLVMSupport.dir/RandomNumberGenerator.cpp.o^C
  ninja: build stopped: interrupted by user.
  $ ninja -j1 lldb
  [1/2848] Building CXX object 
lib/Support/CMakeFiles/LLVMSupport.dir/RandomNumberGenerator.cpp.o^C
  ninja: build stopped: interrupted by user.

So it doesn't matter what to do: ninja or ninja lldb.


http://reviews.llvm.org/D12899



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


Re: [Lldb-commits] [PATCH] D12968: Fix for lldb-mi crash in Listener code if -exec-abort MI command was invoked without getting process stopped

2015-09-18 Thread Ilia K via lldb-commits
ki.stfu added a subscriber: clayborg.
ki.stfu added a comment.

For me it looks like a workaround because here is assumed the 
SBProcess::Destroy will do all required work.

@clayborg, is it permissible to make a Process::Destroy(force_kill=false) for a 
running process?

If so, it's a bug in lldb core, or we use SBProcess by the wrong way.


Repository:
  rL LLVM

http://reviews.llvm.org/D12968



___
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-22 Thread Ilia K via lldb-commits
ki.stfu added a subscriber: lldb-commits.
ki.stfu added a comment.

Please always add lldb-commits to subscribers


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] D12968: Fix for lldb-mi crash in Listener code if -exec-abort MI command was invoked without getting process stopped

2015-09-22 Thread Ilia K via lldb-commits
ki.stfu added a reviewer: jingham.
ki.stfu added a subscriber: jingham.
ki.stfu added a comment.

+@jingham for changes in Target.



Comment at: source/Target/Process.cpp:3934
@@ +3933,3 @@
+
+ListenerSP listener_sp (new 
Listener("lldb.Process.HaltForDestroyOrDetach.hijack"));
+HijackProcessEvents(listener_sp.get());

btw: please update this line when Process::HaltForDestroyOrDetach will be 
renamed to StopForDestroyOrDetach


Repository:
  rL LLVM

http://reviews.llvm.org/D12968



___
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-23 Thread Ilia K via lldb-commits
ki.stfu requested changes to this revision.
ki.stfu added a comment.

Please, next time make a patch with full context:

  svn diff --diff-cmd diff -x "-U" > mypatch.txt

This will help us to reduce the review time.



Comment at: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py:14
@@ +13,3 @@
+# evaluates array when char-array-as-string is off
+def eval_array(self, name, length, typ):
+self.runCmd("-var-create - * " + name)

Probably it should be named like eval_and_check_array()


Comment at: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py:16-19
@@ +15,6 @@
+self.runCmd("-var-create - * " + name)
+self.expect("\^done,name=\"var\d+\",numchild=\"" + 
+str(length) +
+"\",value=\"\[" + str(length) + "\]\",type=\"" +
+typ + " \[" + str(length) + "\]\",thread-id=\"1\",has_more=\"0\"")
+

Please use '%' operator to format the string.


Comment at: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py:21
@@ +20,3 @@
+
+# evaluates array or pointer when char-array-as-string is on
+def eval_ap(self, name, value, sum_part, typ):

This comment deceives us because you use eval_ap on the line #56 at the time 
when char-array-as-string is "off".


Comment at: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py:22
@@ +21,3 @@
+# evaluates array or pointer when char-array-as-string is on
+def eval_ap(self, name, value, sum_part, typ):
+self.runCmd("-var-create - * " + name)

What is ap stands for?


Comment at: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py:26
@@ +25,3 @@
+value +
+"\\\"t\""+ sum_part 
+"\"n\\\"\",type=\"" +
+typ +

This looks like a magic. \t is a part of the variable's value, so please pass 
it via arguments too.

BTW: Use add_slashes() from MiLibraryLoadedTestCase.test_lldbmi_library_loaded 
test case to reduce amount of '\' characters.


Comment at: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py:62
@@ -46,4 +61,3 @@
 # Test that an char16_t* is expanded to string when print 
char-array-as-string is "off"
-self.runCmd("-var-create - * u16p")
-self.expect("\^done,name=\"var\d+\",numchild=\"1\",value=\"0x[0-9a-f]+ 
u\\\"t\"hello\"n\\\"\",type=\"const
 char16_t \*\",thread-id=\"1\",has_more=\"0\"")
+self.eval_ap("u16p", "0x[0-9a-f]+ u", "hello", "const char16_t \\*")
 

'u' belongs to "hello". Please pass them together.


Comment at: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py:85
@@ -74,4 +84,3 @@
 # Test that an char[] with escape chars is expanded to string when 
print char-array-as-string is "on"
-self.runCmd("-var-create - * ca")
-
self.expect("\^done,name=\"var\d+\",numchild=\"10\",value=\"\\\"t\"hello\"n\\\"\",type=\"const
 char \[10\]\",thread-id=\"1\",has_more=\"0\"")
+self.eval_ap("ca", "", "hello", "const char \\[[0-9]+\\]")
 

Why the size is a regexp (it was 10)?


Comment at: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py:100
@@ +99,3 @@
+# Test russian unicode strings
+rval = "Эмбаркадеро"
+self.eval_ap("u16p_rus", "0x[0-9a-f]+ u", rval, "const char16_t \\*")

Please don't use your company name here.


Comment at: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py:109
@@ +108,3 @@
+# in python regex  -> \
+rval = '' * 7 + '" ' + '' * 2 + 'n'
+self.eval_ap("u16p_esc", "0x[0-9a-f]+ u", rval, "const char16_t \\*")

Where is it from? It must be removed before merging.


Comment at: test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py:121-143
@@ -101,3 +120,25 @@
 
 @lldbmi_test
 @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
+@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread 
races
+@skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+def test_lldbmi_stl_types(self):
+"""Test that 'lldb-mi --interpreter' print summary for STL types."""
+
+self.spawnLldbMi(args = None)
+
+# Load executable
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+# Run to BP_gdb_set_show_print_char_array_as_string_test
+line = line_number('main.cpp', '// BP_cpp_stl_types_test')
+self.runCmd("-break-insert main.cpp:%d" % line)
+self.expect("\^done,bkpt={number=\"1\"")
+self.runCmd("-exec-run")
+self.expect("\^running")
+self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+

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

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

Your fix in assign operator looks good. Others go out of scope of this CL, so 
please revert them.



Comment at: tools/lldb-mi/MIUtilString.cpp:41
@@ -40,3 +40,3 @@
 CMIUtilString::CMIUtilString(const char *vpData)
-: std::string(vpData)
+: std::string(vpData != nullptr ? vpData : "")
 {

Not sure about usefulness of these changes. The NULL usually means an error in 
contrast to "" which means "there is nothing to show". In your case, you can 
check whether it's NULL or not, and then construct an object.

Besides that, you can use operator=:
```
SBValue val;
CMIUtilString s;
if (const char* s_cstr = val.GetSummary())
  s = s_cstr;
```


Comment at: tools/lldb-mi/MIUtilString.cpp:45-56
@@ -44,14 +44,14 @@
 
 //++ 

 // Details: CMIUtilString constructor.
 // Type:Method.
 // Args:vpData  - Pointer to UTF8 text data.
 // Return:  None.
 // Throws:  None.
 //--
 CMIUtilString::CMIUtilString(const char *const *vpData)
-: std::string((const char *)vpData)
+: std::string(vpData != nullptr ? (const char *)vpData : "")
 {
 }
 
 //++ 


Is it really used somewhere?


http://reviews.llvm.org/D13094



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


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

2015-09-24 Thread Ilia K via lldb-commits
ki.stfu created this revision.
ki.stfu added reviewers: abidh, brucem.
ki.stfu added subscribers: abidh, brucem, lldb-commits.

Allow to construct CMIUtilString using std::string directly (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);
```

http://reviews.llvm.org/D13158

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

Index: tools/lldb-mi/MIUtilString.h
===
--- tools/lldb-mi/MIUtilString.h
+++ tools/lldb-mi/MIUtilString.h
@@ -45,6 +45,7 @@
 /* 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: tools/lldb-mi/MIUtilString.cpp
===
--- tools/lldb-mi/MIUtilString.cpp
+++ tools/lldb-mi/MIUtilString.cpp
@@ -68,6 +68,18 @@
 }
 
 //++ 
+// Details: CMIUtilString constructor.
+// Type:Method.
+// Args:vpStr  - Text data.
+// Return:  None.
+// Throws:  None.
+//--
+CMIUtilString::CMIUtilString(const std::string& vrStr)
+: std::string(vrStr)
+{
+}
+
+//++ 
 // Details: CMIUtilString assignment operator.
 // Type:Method.
 // Args:vpRhs   - Pointer to UTF8 text data.
@@ -243,7 +255,7 @@
 // Extract string between delimiters
 const size_t nSectionLen(nNextDelimiterPos - nSectionPos);
 const std::string strSection(substr(nSectionPos, nSectionLen));
-vwVecSplits.push_back(strSection.c_str());
+vwVecSplits.push_back(strSection);
 
 // Next
 nOffset = nNextDelimiterPos + 1;
@@ -299,7 +311,7 @@
 // Extract string between delimiters
 const size_t nSectionLen(nNextDelimiterPos - nSectionPos);
 const std::string strSection(substr(nSectionPos, nSectionLen));
-vwVecSplits.push_back(strSection.c_str());
+vwVecSplits.push_back(strSection);
 
 // Next
 nOffset = nNextDelimiterPos + 1;
@@ -337,7 +349,7 @@
 if (nPos == std::string::npos)
 return *this;
 
-const CMIUtilString strNew(substr(0, nPos).c_str());
+const CMIUtilString strNew(substr(0, nPos));
 
 return strNew;
 }
@@ -542,12 +554,12 @@
 const size_t nPos = find_last_not_of(pWhiteSpace);
 if (nPos != std::string::npos)
 {
-strNew = substr(0, nPos + 1).c_str();
+strNew = substr(0, nPos + 1);
 }
 const size_t nPos2 = strNew.find_first_not_of(pWhiteSpace);
 if (nPos2 != std::string::npos)
 {
-strNew = strNew.substr(nPos2).c_str();
+strNew = strNew.substr(nPos2);
 }
 
 return strNew;
@@ -568,7 +580,7 @@
 if (nLen > 1)
 {
 if ((strNew[0] == vChar) && (strNew[nLen - 1] == vChar))
-strNew = strNew.substr(1, nLen - 2).c_str();
+strNew = strNew.substr(1, nLen - 2);
 }
 
 return strNew;
Index: tools/lldb-mi/MIDriver.cpp
===
--- tools/lldb-mi/MIDriver.cpp
+++ 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: tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
===
--- tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
+++ tools/lldb-mi/MICmnLLDBUtilSBValue.cpp
@@ -505,7 +505,7 @@
 addr += sizeof(ch);
 }
 
-return result.c_str();
+return result;
 }
 
 //++ 

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

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


Comment at: tools/lldb-mi/MICmdInterpreter.cpp:166
@@ -165,3 +165,3 @@
 
 m_miCmdData.strMiCmdToken = strNum.c_str();
 }

brucem wrote:
> Can this one be changed too?
Sure.


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] D13158: Allow to construct CMIUtilString using std::string directly (MI)

2015-09-24 Thread Ilia K via lldb-commits
ki.stfu updated this revision to Diff 35703.
ki.stfu added a comment.

A little fix as @brucem requested; Remove CMIUtilString(const char *const 
*vpData) and CMIUtilString(const char *vpData, size_t nLen) ctors; Cleanup 
CMIUtilString::operator=(const std::string &vrRhs)


http://reviews.llvm.org/D13158

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

Index: tools/lldb-mi/MIUtilString.h
===
--- tools/lldb-mi/MIUtilString.h
+++ 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: tools/lldb-mi/MIUtilString.cpp
===
--- tools/lldb-mi/MIUtilString.cpp
+++ tools/lldb-mi/MIUtilString.cpp
@@ -45,25 +45,12 @@
 //++ 
 // Details: CMIUtilString constructor.
 // Type:Method.
-// Args:vpData  - Pointer to UTF8 text data.
-// Return:  None.
-// Throws:  None.
-//--
-CMIUtilString::CMIUtilString(const char *const *vpData)
-: std::string((const char *)vpData)
-{
-}
-
-//++ 
-// Details: CMIUtilString constructor.
-// Type:Method.
-// Args:vpData  - Pointer to UTF8 text data.
-//  nLen- Length of string.
+// Args:vpStr  - Text data.
 // Return:  None.
 // Throws:  None.
 //--
-CMIUtilString::CMIUtilString(const char *vpData, size_t nLen)
-: std::string(vpData, nLen)
+CMIUtilString::CMIUtilString(const std::string& vrStr)
+: std::string(vrStr)
 {
 }
 
@@ -96,11 +83,7 @@
 //--
 CMIUtilString &CMIUtilString::operator=(const std::string &vrRhs)
 {
-if (*this == vrRhs)
-return *this;
-
 assign(vrRhs);
-
 return *this;
 }
 
@@ -243,7 +226,7 @@
 // Extract string between delimiters
 const size_t nSectionLen(nNextDelimiterPos - nSectionPos);
 const std::string strSection(substr(nSectionPos, nSectionLen));
-vwVecSplits.push_back(strSection.c_str());
+vwVecSplits.push_back(strSection);
 
 // Next
 nOffset = nNextDelimiterPos + 1;
@@ -299,7 +282,7 @@
 // Extract string between delimiters
 const size_t nSectionLen(nNextDelimiterPos - nSectionPos);
 const std::string strSection(substr(nSectionPos, nSectionLen));
-vwVecSplits.push_back(strSection.c_str());
+vwVecSplits.push_back(strSection);
 
 // Next
 nOffset = nNextDelimiterPos + 1;
@@ -337,7 +320,7 @@
 if (nPos == std::string::npos)
 return *this;
 
-const CMIUtilString strNew(substr(0, nPos).c_str());
+const CMIUtilString strNew(substr(0, nPos));
 
 return strNew;
 }
@@ -542,12 +525,12 @@
 const size_t nPos = find_last_not_of(pWhiteSpace);
 if (nPos != std::string::npos)
 {
-strNew = substr(0, nPos + 1).c_str();
+strNew = substr(0, nPos + 1);
 }
 const size_t nPos2 = strNew.find_first_not_of(pWhiteSpace);
 if (nPos2 != std::string::npos)
 {
-strNew = strNew.substr(nPos2).c_str();
+strNew = strNew.substr(nPos2);
 }
 
 return strNew;
@@ -568,7 +551,7 @@
 if (nLen > 1)
 {
 if ((strNew[0] == vChar) && (strNew[nLen - 1] == vChar))
-strNew = strNew.substr(1, nLen - 2).c_str();
+strNew = strNew.substr(1, nLen - 2);
 }
 
 return strNew;
Index: tools/lldb-mi/MIDriver.cpp
===
--- tools/lldb-mi/MIDriver.cpp
+++ 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: tools/lldb-mi/MICmnLLDBUtil

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] 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


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


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

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

Update the summary + a few inline comments below.



Comment at: test/tools/lldb-mi/startup_options/TestMiStartupOptions.py:13-31
@@ -12,3 +12,21 @@
 
 @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
+self.runCmd("-exec-run --start")
+self.expect("\^running")
+
self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*thread-id=\"1\",stopped-threads=\"all\"")
+
+# Test that lldb-mi is ready to execute next commands
+self.expect(self.child_prompt, exactly = True)
+

And move this test case to test/tools/lldb-mi/control/TestMiExec.py


Comment at: test/tools/lldb-mi/startup_options/TestMiStartupOptions.py:16
@@ +15,3 @@
+@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."""

Rename it to
```
def test_lldbmi_exec_run(self):
```


Comment at: test/tools/lldb-mi/startup_options/TestMiStartupOptions.py:28
@@ +27,3 @@
+self.expect("\^running")
+
self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*thread-id=\"1\",stopped-threads=\"all\"")
+

Use lazy regex please:
```
self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*?thread-id=\"1\",stopped-threads=\"all\"")
```


Comment at: tools/lldb-mi/MICmdCmdExec.h:58
@@ -57,2 +57,3 @@
 bool Acknowledge() override;
+bool ParseArgs() override;
 // From CMICmnBase

Please move it on few lines above for consistency with others:
```
bool ParseArgs() override;
bool Execute() override;
[...]
```


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


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

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

lgtm apart a lack of description about the changes in 
tools/lldb-mi/MICmdCmdSupportList.cpp



Comment at: tools/lldb-mi/MICmdCmdExec.h:58
@@ -57,2 +57,3 @@
 bool Acknowledge() override;
+bool ParseArgs() override;
 // From CMICmnBase

KLapshin wrote:
> Ilia, I checked string positions for ParseArgs() method in MICmdCmdExec.h and 
> other command headers - ParseArgs() placed always third, so this change done 
> in accordance with current, at least public, lldb-mi headers and minimal 
> patching as possible.
> 
> What inconsistency you mentioned ?
> 
> Please take a look on ExecRun command class modified with ParseArgs() method 
> added and non-modified classes in lldb-mi - ExecFinish or ExecNext, for 
> example:
> 
> 
> ```
> class CMICmdCmdExecRun : public CMICmdBase
> {
> // Statics:
>   public:
> // Required by the CMICmdFactory when registering *this command
> static CMICmdBase *CreateSelf();
> 
> // Methods:
>   public:
> /* ctor */ CMICmdCmdExecRun();
> 
> // Overridden:
>   public:
> // From CMICmdInvoker::ICmd
> bool Execute() override;
> bool Acknowledge() override;
> bool ParseArgs() override;
> // From CMICmnBase
> /* dtor */ ~CMICmdCmdExecRun() override;
> 
> // Attributes:
>   private:
> lldb::SBCommandReturnObject m_lldbResult;
> const CMIUtilString m_constStrArgStart; // StopAtEntry - run to first 
> instruction or main(), just run process if not specified
> };
> ```
> 
> 
> ```
> class CMICmdCmdExecFinish : public CMICmdBase
> {
> // Statics:
>   public:
> // Required by the CMICmdFactory when registering *this command
> static CMICmdBase *CreateSelf();
> 
> // Methods:
>   public:
> /* ctor */ CMICmdCmdExecFinish();
> 
> // Overridden:
>   public:
> // From CMICmdInvoker::ICmd
> bool Execute() override;
> bool Acknowledge() override;
> bool ParseArgs() override;  <---
> // From CMICmnBase
> /* dtor */ ~CMICmdCmdExecFinish() override;
> 
> // Attributes:
>   private:
> lldb::SBCommandReturnObject m_lldbResult;
> const CMIUtilString m_constStrArgThread; // Not specified in MI spec but 
> Eclipse gives this option
> const CMIUtilString m_constStrArgFrame;  // Not specified in MI spec but 
> Eclipse gives this option
> };
> ```
Ok, I see that it's already in consistency with others. I was baffled because 
::ParseArgs() is followed by ::Execute() in source files.


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


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

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


Comment at: tools/lldb-mi/MICmdCmdExec.h:64
@@ -62,2 +63,3 @@
   private:
 lldb::SBCommandReturnObject m_lldbResult;
+const CMIUtilString m_constStrArgStart; // StopAtEntry - run to first 
instruction or main(), just run process if not specified

I checked that it's unused starting from r215656. Remove this please.


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


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

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

Could you make one additional cleanup here please?


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


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

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


Comment at: test/tools/lldb-mi/control/TestMiExec.py:16
@@ +15,3 @@
+@skipIfFreeBSD # Failure presumably due to StopAtEntry most likely not 
implemented
+def test_lldbmi_exec_run(self):
+"""Test that 'lldb-mi --interpreter' can stop at entry."""

This test doesn't pass on Linux due to missing *stopped notification:
```
$ bin/lldb-mi echo
(gdb)
-file-exec-and-symbols "echo"
^done
(gdb)
=library-loaded,id="/bin/echo",target-name="/bin/echo",host-name="/bin/echo",symbols-loaded="0",loaded_addr="-",size="0"
-exec-run --start
^running
=thread-group-started,id="i1",pid="28031"
(gdb)
=thread-created,id="1",group-id="i1"
=thread-selected,id="1"
(gdb)
=library-loaded,id="/bin/echo",target-name="/bin/echo",host-name="/bin/echo",symbols-loaded="0",loaded_addr="-",size="0"
process status
Process 28031 stopped
* thread #1: tid = 28031, 0x77dd9cd0, name = 'echo', stop reason = 
signal SIGSTOP
frame #0: 0x77dd9cd0
->  0x77dd9cd0: movq   %rsp, %rdi
0x77dd9cd3: callq  0x77dddc30
0x77dd9cd8: movq   %rax, %r12
0x77dd9cdb: movl   0x22310f(%rip), %eax
^done
(gdb)
```

You can XFAIL this test case with the link to the corresponding issue on bug 
tracker (create a new one if needed).


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