[Lldb-commits] [lldb] r370570 - [lldb][NFC] Remove unused prompt variable in TestMultilineCompletion.py

2019-08-31 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Sat Aug 31 02:40:26 2019
New Revision: 370570

URL: http://llvm.org/viewvc/llvm-project?rev=370570&view=rev
Log:
[lldb][NFC] Remove unused prompt variable in TestMultilineCompletion.py

Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py?rev=370570&r1=370569&r2=370570&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/multiline-completion/TestMultilineCompletion.py
 Sat Aug 31 02:40:26 2019
@@ -15,8 +15,6 @@ class MultilineCompletionTest(PExpectTes
 """Test that we can complete a simple multiline expression"""
 self.build()
 
-prompt = "(lldb) "
-
 self.launch(executable=self.getBuildArtifact("a.out"))
 self.expect("b main", substrs=["Breakpoint 1", "address ="])
 self.expect("run", substrs=["stop reason ="])


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


[Lldb-commits] [lldb] r370571 - [lldb] Unify target checking in CommandObject

2019-08-31 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Sat Aug 31 02:41:25 2019
New Revision: 370571

URL: http://llvm.org/viewvc/llvm-project?rev=370571&view=rev
Log:
[lldb] Unify target checking in CommandObject

Summary:
We currently have several CommandObjects that manually reimplement the checking 
for a selected target
or a target in the execution context (which is the selected target when they 
are invoked). This patch removes
all these checks and replaces them by setting the eCommandRequiresTarget flag 
that Pavel suggested. With
this flag we are doing the same check but without having to duplicate this code 
in all these CommandObjects.

I also added a `GetSelectedTarget()` variant of the 
`GetSelectedOrDummyTarget()` function to the
CommandObject that checks that the flag is set and then returns a reference to 
the target. I didn't rewrite
all the `target` variables from `Target *` to `Target &` in this patch as last 
time this change caused a lot of merge
conflicts in Swift and I would prefer having that in a separate NFC commit.

Reviewers: labath, clayborg

Reviewed By: labath, clayborg

Subscribers: clayborg, JDevlieghere, jingham, amccarth, abidh, lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/include/lldb/Interpreter/CommandObject.h
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp

Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=370571&r1=370570&r2=370571&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Sat Aug 31 02:41:25 2019
@@ -331,6 +331,7 @@ protected:
   // selected target, or if no target is present you want to prime the dummy
   // target with entities that will be copied over to new targets.
   Target &GetSelectedOrDummyTarget(bool prefer_dummy = false);
+  Target &GetSelectedTarget();
   Target &GetDummyTarget();
 
   // If a command needs to use the "current" thread, use this call. Command

Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=370571&r1=370570&r2=370571&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Sat Aug 31 
02:41:25 2019
@@ -589,10 +589,10 @@ private:
 class CommandObjectBreakpointCommandList : public CommandObjectParsed {
 public:
   CommandObjectBreakpointCommandList(CommandInterpreter &interpreter)
-  : CommandObjectParsed(interpreter, "list", "List the script or set of "
- "commands to be executed when 
"
- "the breakpoint is hit.",
-nullptr) {
+  : CommandObjectParsed(interpreter, "list",
+"List the script or set of commands to be "
+"executed when the breakpoint is hit.",
+nullptr, eCommandRequiresTarget) {
 CommandArgumentEntry arg;
 CommandArgumentData bp_id_arg;
 
@@ -612,14 +612,7 @@ public:
 
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) override {
-Target *target = GetDebugger().GetSelectedTarget().get();
-
-if (target == nullptr) {
-  result.AppendError("There is not a current executable; there are no "
- "breakpoints for which to list commands");
-  result.SetStatus(eReturnStatusFailed);
-  return false;
-}
+Target *target = &GetSelectedTarget();
 
 const BreakpointList &breakpoints = target->GetBreakpointList();
 size_t num_breakpoints = breakpoints.GetSize();

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=370571&r1=370570&r2=370571&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Sat Aug 31 02:41:25 
2019
@@ -212,20 +212,15 @@ CommandObjectDisassemble::CommandObjectD
   "Disassemble specified instructions in the current targe

[Lldb-commits] [PATCH] D66863: [lldb] Unify target checking in CommandObject

2019-08-31 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL370571: [lldb] Unify target checking in CommandObject 
(authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66863?vs=218117&id=218207#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66863

Files:
  lldb/trunk/include/lldb/Interpreter/CommandObject.h
  lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
  lldb/trunk/source/Commands/CommandObjectProcess.cpp
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Commands/CommandObjectThread.cpp
  lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
  lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/trunk/source/Interpreter/CommandObject.cpp

Index: lldb/trunk/include/lldb/Interpreter/CommandObject.h
===
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h
@@ -331,6 +331,7 @@
   // selected target, or if no target is present you want to prime the dummy
   // target with entities that will be copied over to new targets.
   Target &GetSelectedOrDummyTarget(bool prefer_dummy = false);
+  Target &GetSelectedTarget();
   Target &GetDummyTarget();
 
   // If a command needs to use the "current" thread, use this call. Command
Index: lldb/trunk/source/Interpreter/CommandObject.cpp
===
--- lldb/trunk/source/Interpreter/CommandObject.cpp
+++ lldb/trunk/source/Interpreter/CommandObject.cpp
@@ -925,6 +925,15 @@
   return *m_interpreter.GetDebugger().GetSelectedOrDummyTarget(prefer_dummy);
 }
 
+Target &CommandObject::GetSelectedTarget() {
+  assert(m_flags.AnySet(eCommandRequiresTarget | eCommandProcessMustBePaused |
+eCommandProcessMustBeLaunched | eCommandRequiresFrame |
+eCommandRequiresThread | eCommandRequiresProcess |
+eCommandRequiresRegContext) &&
+ "GetSelectedTarget called from object that may have no target");
+  return *m_interpreter.GetDebugger().GetSelectedTarget();
+}
+
 Thread *CommandObject::GetDefaultThread() {
   Thread *thread_to_use = m_exe_ctx.GetThreadPtr();
   if (thread_to_use)
Index: lldb/trunk/source/Commands/CommandObjectThread.cpp
===
--- lldb/trunk/source/Commands/CommandObjectThread.cpp
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp
@@ -819,13 +819,6 @@
   bool DoExecute(Args &command, CommandReturnObject &result) override {
 bool synchronous_execution = m_interpreter.GetSynchronous();
 
-if (!GetDebugger().GetSelectedTarget()) {
-  result.AppendError("invalid target, create a debug target using the "
- "'target create' command");
-  result.SetStatus(eReturnStatusFailed);
-  return false;
-}
-
 Process *process = m_exe_ctx.GetProcessPtr();
 if (process == nullptr) {
   result.AppendError("no process exists. Cannot continue");
@@ -1091,13 +1084,7 @@
   bool DoExecute(Args &command, CommandReturnObject &result) override {
 bool synchronous_execution = m_interpreter.GetSynchronous();
 
-Target *target = GetDebugger().GetSelectedTarget().get();
-if (target == nullptr) {
-  result.AppendError("invalid target, create a debug target using the "
- "'target create' command");
-  result.SetStatus(eReturnStatusFailed);
-  return false;
-}
+Target *target = &GetSelectedTarget();
 
 Process *process = m_exe_ctx.GetProcessPtr();
 if (process == nullptr) {
Index: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
===
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -589,10 +589,10 @@
 class CommandObjectBreakpointCommandList : public CommandObjectParsed {
 public:
   CommandObjectBreakpointCommandList(CommandInterpreter &interpreter)
-  : CommandObjectParsed(interpreter, "list", "List the script or set of "
- "commands to be executed when "
- "the breakpoint is hit.",
-nullptr) {
+  : CommandObjectParsed(interpreter, "list",
+"List the script or set of commands to be "
+"executed when the breakpoint is hit.",
+nullptr, eCommandRequiresTarget) {
 CommandArgumentEntry arg;
 CommandArgumentData bp_id_arg;
 
@@ -612,14 +612,7 @@
 
 protected:
   bool 

[Lldb-commits] [PATCH] D67001: [lldb] Limit the amount of zeroes we use for padding when printing small floats

2019-08-31 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor requested review of this revision.
teemperor added a comment.

Well, seems like we don't actually test this functionality anywhere else in the 
test suite ( :( ) so this is good to review.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D67001



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