[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

The functionality seems fine, and I like how you got rid of the extra callbacks 
in the plugin manager in favour of passing the sets explicitly. I'm not really 
a fan of inheriting from standard containers. And though the motivation here is 
stronger than in the previous case, it is not without its problems -- for 
instance half of this patch uses the new `LanguageSet` type, whereas the other 
(SymbolFile::FindTypes) still uses llvm::SmallBitVector. This also nicely 
demonstrates the main problem with inheriting from classes which aren't meant 
to be inherited (that they can be accidentally sliced) and means that this 
isn't as type safe as one might hope..

Now, I am not sure what all of that means here. This functionality is not so 
widespread that it makes sense to develop a full-blown class to do what you 
need here, so it may be best to just go with what you have here, and possibly 
rework this if it becomes more widespread in the future It's a pitty that 
std::bitset does not have a richer interface for accessing the bits. Otherwise, 
you could just do `typedef std::bitset LanguageSet` and be done 
with it..




Comment at: lldb/source/Symbol/TypeSystem.cpp:36-37
+: llvm::SmallBitVector(num_small_bitvector_bits, 0) {
+  uint32_t mask32[2];
+  memcpy(mask32, &mask, 8);
+  setBitsInMask(mask32, num_small_bitvector_bits / 8);

Will this work correctly on big endian too?


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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [PATCH] D66536: [lldb][NFC] Remove WordComplete mode, make result array indexed from 0 and remove any undocumented/redundant return values

2019-08-22 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369624: [lldb][NFC] Remove WordComplete mode, make result 
array indexed from 0 and… (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66536?vs=216398&id=216554#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66536

Files:
  lldb/trunk/include/lldb/Core/FormatEntity.h
  lldb/trunk/include/lldb/Core/IOHandler.h
  lldb/trunk/include/lldb/Core/PluginManager.h
  lldb/trunk/include/lldb/Expression/REPL.h
  lldb/trunk/include/lldb/Host/Editline.h
  lldb/trunk/include/lldb/Interpreter/CommandAlias.h
  lldb/trunk/include/lldb/Interpreter/CommandCompletions.h
  lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
  lldb/trunk/include/lldb/Interpreter/CommandObject.h
  lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h
  lldb/trunk/include/lldb/Interpreter/CommandObjectRegexCommand.h
  lldb/trunk/include/lldb/Interpreter/OptionValue.h
  lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
  lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h
  lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h
  lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
  lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h
  lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h
  lldb/trunk/include/lldb/Symbol/Variable.h
  lldb/trunk/include/lldb/Utility/ArchSpec.h
  lldb/trunk/include/lldb/Utility/CompletionRequest.h
  lldb/trunk/source/API/SBCommandInterpreter.cpp
  lldb/trunk/source/Commands/CommandCompletions.cpp
  lldb/trunk/source/Commands/CommandObjectCommands.cpp
  lldb/trunk/source/Commands/CommandObjectExpression.cpp
  lldb/trunk/source/Commands/CommandObjectExpression.h
  lldb/trunk/source/Commands/CommandObjectFrame.cpp
  lldb/trunk/source/Commands/CommandObjectHelp.cpp
  lldb/trunk/source/Commands/CommandObjectHelp.h
  lldb/trunk/source/Commands/CommandObjectMultiword.cpp
  lldb/trunk/source/Commands/CommandObjectPlatform.cpp
  lldb/trunk/source/Commands/CommandObjectPlugin.cpp
  lldb/trunk/source/Commands/CommandObjectProcess.cpp
  lldb/trunk/source/Commands/CommandObjectSettings.cpp
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Core/FormatEntity.cpp
  lldb/trunk/source/Core/IOHandler.cpp
  lldb/trunk/source/Core/PluginManager.cpp
  lldb/trunk/source/Expression/REPL.cpp
  lldb/trunk/source/Host/common/Editline.cpp
  lldb/trunk/source/Interpreter/CommandAlias.cpp
  lldb/trunk/source/Interpreter/CommandInterpreter.cpp
  lldb/trunk/source/Interpreter/CommandObject.cpp
  lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp
  lldb/trunk/source/Interpreter/OptionValue.cpp
  lldb/trunk/source/Interpreter/OptionValueArch.cpp
  lldb/trunk/source/Interpreter/OptionValueBoolean.cpp
  lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
  lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
  lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp
  lldb/trunk/source/Interpreter/OptionValueUUID.cpp
  lldb/trunk/source/Interpreter/Options.cpp
  lldb/trunk/source/Symbol/Variable.cpp
  lldb/trunk/source/Utility/ArchSpec.cpp
  lldb/trunk/source/Utility/CompletionRequest.cpp
  lldb/trunk/unittests/Interpreter/TestCompletion.cpp
  lldb/trunk/unittests/Utility/CompletionRequestTest.cpp

Index: lldb/trunk/include/lldb/Core/IOHandler.h
===
--- lldb/trunk/include/lldb/Core/IOHandler.h
+++ lldb/trunk/include/lldb/Core/IOHandler.h
@@ -199,8 +199,8 @@
 
   virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
 
-  virtual int IOHandlerComplete(IOHandler &io_handler,
-CompletionRequest &request);
+  virtual void IOHandlerComplete(IOHandler &io_handler,
+ CompletionRequest &request);
 
   virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
 
@@ -414,7 +414,7 @@
   static int FixIndentationCallback(Editline *editline, const StringList &lines,
 int cursor_position, void *baton);
 
-  static int AutoCompleteCallback(CompletionRequest &request, void *baton);
+  static void AutoCompleteCallback(CompletionRequest &request, void *baton);
 #endif
 
 protected:
@@ -445,8 +445,8 @@
 
   bool GetResponse() const { return m_user_response; }
 
-  int IOHandlerComplete(IOHandler &io_handler,
-CompletionRequest &request) override;
+  void IOHandlerComplete(IOHandler &io_handler,
+ CompletionRequest &request) override;
 
   void IOHandlerInputComplete(IOHandler &io_handler,
   std::string &data) override;
Index: lldb/trunk/include/lldb/Core/PluginManager.h
===
--- lldb/trunk/in

[Lldb-commits] [lldb] r369625 - [lldb][NFC] Remove dead code that is supposed to handle invalid command options

2019-08-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Aug 22 01:08:05 2019
New Revision: 369625

URL: http://llvm.org/viewvc/llvm-project?rev=369625&view=rev
Log:
[lldb][NFC] Remove dead code that is supposed to handle invalid command options

Summary:
We currently have a bunch of code that is supposed to handle invalid command 
options, but
all this code is unreachable because invalid options are already handled in 
`Options::Parse`.
The only way we can reach this code is when we declare but then not implement 
an option
(which will be made impossible with D65386, which is also when we can 
completely remove
the `default` cases).

This patch replaces all this code with `llvm_unreachable` to make clear this is 
dead code
that can't be reached.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectHelp.h
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectRegister.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Commands/CommandObjectSource.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp
lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
lldb/trunk/source/Interpreter/OptionGroupUUID.cpp
lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
lldb/trunk/source/Interpreter/OptionGroupVariable.cpp
lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=369625&r1=369624&r2=369625&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Thu Aug 22 01:08:05 
2019
@@ -141,9 +141,7 @@ public:
 }
 break;
 default:
-  error.SetErrorStringWithFormat("unrecognized option '%c'",
- short_option);
-  break;
+  llvm_unreachable("Unimplemented option");
 }
 
 return error;
@@ -206,9 +204,7 @@ public:
 m_use_dummy = true;
 break;
 default:
-  error.SetErrorStringWithFormat("unrecognized option '%c'",
- short_option);
-  break;
+  llvm_unreachable("Unimplemented option");
 }
 
 return error;
@@ -486,9 +482,7 @@ public:
 break;
 
   default:
-error.SetErrorStringWithFormat("unrecognized option '%c'",
-   short_option);
-break;
+llvm_unreachable("Unimplemented option");
   }
 
   return error;
@@ -1208,9 +1202,7 @@ public:
 m_internal = true;
 break;
   default:
-error.SetErrorStringWithFormat("unrecognized option '%c'",
-   short_option);
-break;
+llvm_unreachable("Unimplemented option");
   }
 
   return error;
@@ -1342,9 +1334,7 @@ public:
 break;
 
   default:
-error.SetErrorStringWithFormat("unrecognized option '%c'",
-   short_option);
-break;
+llvm_unreachable("Unimplemented option");
   }
 
   return error;
@@ -1496,9 +1486,7 @@ public:
 break;
 
   default:
-error.SetErrorStringWithFormat("unrecognized option '%c'",
-   short_option);
-break;
+llvm_unreachable("Unimplemented option");
   }
 
   return error;
@@ -1643,9 +1631,7 @@ public:
   break;
 
 default:
-  error.SetErrorStringWithFormat("unrecognized short option '%c'",
- short_option);
-  break;
+  llvm_unreachable("Unimplemented option");
 }
 return error;
   }
@@ -1713,7 +1699,8 @@ public:
   "invalid boolean value '%s' passed for -L option",

[Lldb-commits] [PATCH] D66522: [lldb][NFC] Remove dead code that is supposed to handle invalid command options

2019-08-22 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369625: [lldb][NFC] Remove dead code that is supposed to 
handle invalid command options (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66522?vs=216385&id=216557#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66522

Files:
  lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
  lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/trunk/source/Commands/CommandObjectCommands.cpp
  lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
  lldb/trunk/source/Commands/CommandObjectExpression.cpp
  lldb/trunk/source/Commands/CommandObjectFrame.cpp
  lldb/trunk/source/Commands/CommandObjectHelp.h
  lldb/trunk/source/Commands/CommandObjectLog.cpp
  lldb/trunk/source/Commands/CommandObjectMemory.cpp
  lldb/trunk/source/Commands/CommandObjectPlatform.cpp
  lldb/trunk/source/Commands/CommandObjectProcess.cpp
  lldb/trunk/source/Commands/CommandObjectRegister.cpp
  lldb/trunk/source/Commands/CommandObjectSettings.cpp
  lldb/trunk/source/Commands/CommandObjectSource.cpp
  lldb/trunk/source/Commands/CommandObjectTarget.cpp
  lldb/trunk/source/Commands/CommandObjectThread.cpp
  lldb/trunk/source/Commands/CommandObjectType.cpp
  lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
  lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp
  lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
  lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
  lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
  lldb/trunk/source/Interpreter/OptionGroupUUID.cpp
  lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
  lldb/trunk/source/Interpreter/OptionGroupVariable.cpp
  lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp

Index: lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
===
--- lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
+++ lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
@@ -152,8 +152,7 @@
 break;
 
   default:
-error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
-break;
+llvm_unreachable("Unimplemented option");
   }
 
   return error;
Index: lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
===
--- lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
+++ lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
@@ -113,8 +113,7 @@
 break;
 
   default:
-error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
-break;
+llvm_unreachable("Unimplemented option");
   }
   return error;
 }
Index: lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp
===
--- lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp
+++ lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp
@@ -46,8 +46,7 @@
 break;
 
   default:
-error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
-break;
+llvm_unreachable("Unimplemented option");
   }
 
   return error;
Index: lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp
===
--- lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp
+++ lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp
@@ -101,9 +101,7 @@
 break;
 
   default:
-error.SetErrorStringWithFormat("unrecognized short option '%c'",
-   short_option);
-break;
+llvm_unreachable("Unimplemented option");
   }
 
   return error;
Index: lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
===
--- lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
+++ lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
@@ -50,8 +50,7 @@
 break;
 
   default:
-error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
-break;
+llvm_unreachable("Unimplemented option");
   }
 
   return error;
Index: lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
===
--- lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
+++ lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
@@ -160,8 +160,7 @@
   } break;
 
   default:
-error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
-break;
+llvm_unreachable("Unimplemented option");
   }
 
   return error;
Index: lldb/trunk/source/Interpreter/OptionGroupVariable.cpp
===
--- lldb/trunk/source/Interpreter/OptionGroupVariabl

[Lldb-commits] [lldb] r369632 - [lldb][NFC] NFC cleanup for the completion code

2019-08-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Aug 22 02:02:54 2019
New Revision: 369632

URL: http://llvm.org/viewvc/llvm-project?rev=369632&view=rev
Log:
[lldb][NFC] NFC cleanup for the completion code

Modified:
lldb/trunk/source/Commands/CommandObjectHelp.cpp
lldb/trunk/source/Commands/CommandObjectMultiword.cpp
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Core/IOHandler.cpp
lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
lldb/trunk/source/Interpreter/OptionValueUUID.cpp

Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=369632&r1=369631&r2=369632&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Thu Aug 22 02:02:54 2019
@@ -205,20 +205,20 @@ void CommandObjectHelp::HandleCompletion
   // Return the completions of the commands in the help system:
   if (request.GetCursorIndex() == 0) {
 m_interpreter.HandleCompletionMatches(request);
-  } else {
-CommandObject *cmd_obj =
-m_interpreter.GetCommandObject(request.GetParsedLine()[0].ref);
+return;
+  }
+  CommandObject *cmd_obj =
+  m_interpreter.GetCommandObject(request.GetParsedLine()[0].ref);
 
-// The command that they are getting help on might be ambiguous, in which
-// case we should complete that, otherwise complete with the command the
-// user is getting help on...
+  // The command that they are getting help on might be ambiguous, in which
+  // case we should complete that, otherwise complete with the command the
+  // user is getting help on...
 
-if (cmd_obj) {
-  request.GetParsedLine().Shift();
-  request.SetCursorIndex(request.GetCursorIndex() - 1);
-  cmd_obj->HandleCompletion(request);
-} else {
-  m_interpreter.HandleCompletionMatches(request);
-}
+  if (cmd_obj) {
+request.GetParsedLine().Shift();
+request.SetCursorIndex(request.GetCursorIndex() - 1);
+cmd_obj->HandleCompletion(request);
+return;
   }
+  m_interpreter.HandleCompletionMatches(request);
 }

Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=369632&r1=369631&r2=369632&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Thu Aug 22 02:02:54 
2019
@@ -201,20 +201,22 @@ void CommandObjectMultiword::HandleCompl
 }
   }
 }
-  } else {
-StringList new_matches;
-CommandObject *sub_command_object = GetSubcommandObject(arg0, 
&new_matches);
-if (sub_command_object == nullptr) {
-  request.AddCompletions(new_matches);
-} else {
-  // Remove the one match that we got from calling GetSubcommandObject.
-  new_matches.DeleteStringAtIndex(0);
-  request.AddCompletions(new_matches);
-  request.GetParsedLine().Shift();
-  request.SetCursorIndex(request.GetCursorIndex() - 1);
-  return sub_command_object->HandleCompletion(request);
-}
+return;
+  }
+
+  StringList new_matches;
+  CommandObject *sub_command_object = GetSubcommandObject(arg0, &new_matches);
+  if (sub_command_object == nullptr) {
+request.AddCompletions(new_matches);
+return;
   }
+
+  // Remove the one match that we got from calling GetSubcommandObject.
+  new_matches.DeleteStringAtIndex(0);
+  request.AddCompletions(new_matches);
+  request.GetParsedLine().Shift();
+  request.SetCursorIndex(request.GetCursorIndex() - 1);
+  sub_command_object->HandleCompletion(request);
 }
 
 const char *CommandObjectMultiword::GetRepeatCommand(Args 
¤t_command_args,

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=369632&r1=369631&r2=369632&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Thu Aug 22 02:02:54 
2019
@@ -1440,36 +1440,37 @@ public:
 
   // We are only completing the name option for now...
 
-  if (GetDefinitions()[opt_defs_index].short_option == 'n') {
-// Are we in the name?
-
-// Look to see if there is a -P argument provided, and if so use that
-// plugin, otherwise use the default plugin.
-
-const char *partial_name = nullptr;
-partial_name = request.GetParsedLine().GetArgumentAtIndex(opt_arg_pos);
-
-PlatformSP platform_sp(interpreter.GetPlatform(true));
-

[Lldb-commits] [lldb] r369635 - [lldb][NFC] Remove unused return value from HandleOptionArgumentCompletion

2019-08-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Aug 22 02:14:42 2019
New Revision: 369635

URL: http://llvm.org/viewvc/llvm-project?rev=369635&view=rev
Log:
[lldb][NFC] Remove unused return value from HandleOptionArgumentCompletion

Modified:
lldb/trunk/include/lldb/Interpreter/Options.h
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Interpreter/Options.cpp

Modified: lldb/trunk/include/lldb/Interpreter/Options.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Options.h?rev=369635&r1=369634&r2=369635&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/Options.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Options.h Thu Aug 22 02:14:42 2019
@@ -187,14 +187,7 @@ public:
   ///
   /// \param[in] interpreter
   ///The command interpreter doing the completion.
-  ///
-  /// FIXME: This is the wrong return value, since we also need to
-  /// make a distinction between total number of matches, and the window the
-  /// user wants returned.
-  ///
-  /// \return
-  /// \btrue if we were in an option, \bfalse otherwise.
-  virtual bool
+  virtual void
   HandleOptionArgumentCompletion(lldb_private::CompletionRequest &request,
  OptionElementVector &opt_element_vector,
  int opt_element_index,

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=369635&r1=369634&r2=369635&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Thu Aug 22 02:14:42 
2019
@@ -1432,7 +1432,7 @@ public:
   return llvm::makeArrayRef(g_platform_process_attach_options);
 }
 
-bool HandleOptionArgumentCompletion(
+void HandleOptionArgumentCompletion(
 CompletionRequest &request, OptionElementVector &opt_element_vector,
 int opt_element_index, CommandInterpreter &interpreter) override {
   int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
@@ -1442,7 +1442,7 @@ public:
 
   // Are we in the name?
   if (GetDefinitions()[opt_defs_index].short_option != 'n')
-return false;
+return;
 
   // Look to see if there is a -P argument provided, and if so use that
   // plugin, otherwise use the default plugin.
@@ -1452,7 +1452,7 @@ public:
 
   PlatformSP platform_sp(interpreter.GetPlatform(true));
   if (!platform_sp)
-return false;
+return;
 
   ProcessInstanceInfoList process_infos;
   ProcessInstanceInfoMatch match_info;
@@ -1464,14 +1464,14 @@ public:
   platform_sp->FindProcesses(match_info, process_infos);
   const uint32_t num_matches = process_infos.GetSize();
   if (num_matches == 0)
-return false;
+return;
 
   for (uint32_t i = 0; i < num_matches; ++i) {
 request.AddCompletion(
 llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
 process_infos.GetProcessNameLengthAtIndex(i)));
   }
-  return false;
+  return;
 }
 
 // Options table: Required for subclasses of Options.

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=369635&r1=369634&r2=369635&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Aug 22 02:14:42 2019
@@ -320,7 +320,7 @@ public:
   return llvm::makeArrayRef(g_process_attach_options);
 }
 
-bool HandleOptionArgumentCompletion(
+void HandleOptionArgumentCompletion(
 CompletionRequest &request, OptionElementVector &opt_element_vector,
 int opt_element_index, CommandInterpreter &interpreter) override {
   int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
@@ -330,7 +330,7 @@ public:
 
   // Are we in the name?
   if (GetDefinitions()[opt_defs_index].short_option != 'n')
-return false;
+return;
 
   // Look to see if there is a -P argument provided, and if so use that
   // plugin, otherwise use the default plugin.
@@ -340,7 +340,7 @@ public:
 
   PlatformSP platform_sp(interpreter.GetPlatform(true));
   if (!platform_sp)
-return false;
+return;
   ProcessInstanceInfoList process_infos;
   ProcessInstanceInfoMatch match_info;
   if (partial_name) {
@@ -351,14 +351,12 @@ public:
   platform_sp->FindProcesses(match_info, process_infos);
   const size_t num_matches = process_infos.GetSize();

[Lldb-commits] [PATCH] D66581: [lldb] Construct the dummy target when the first Dummy object is constructed

2019-08-22 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: labath.
Herald added subscribers: lldb-commits, abidh.
Herald added a project: LLDB.

We should always have a dummy target, so we might as well construct it directly 
when we create a Debugger object.

The idea is that if this patch doesn't cause any problems that we can get rid 
of all the logic
that handles situations where we don't have a dummy target (as all that code is 
currently
untested as there seems to be no way to have no dummy target in LLDB).


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D66581

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/source/Core/Debugger.cpp


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -721,6 +721,9 @@
   assert(default_platform_sp);
   m_platform_list.Append(default_platform_sp, true);
 
+  m_dummy_target = m_target_list.GetDummyTarget(*this);
+  assert(m_dummy_target.get() && "Couldn't construct dummy target?");
+
   m_collection_sp->Initialize(g_debugger_properties);
   m_collection_sp->AppendProperty(
   ConstString("target"),
@@ -1603,9 +1606,7 @@
   }
 }
 
-Target *Debugger::GetDummyTarget() {
-  return m_target_list.GetDummyTarget(*this).get();
-}
+Target *Debugger::GetDummyTarget() { return m_dummy_target.get(); }
 
 Target *Debugger::GetSelectedOrDummyTarget(bool prefer_dummy) {
   Target *target = nullptr;
Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -400,6 +400,7 @@
   Broadcaster m_sync_broadcaster;
   lldb::ListenerSP m_forward_listener_sp;
   llvm::once_flag m_clear_once;
+  lldb::TargetSP m_dummy_target;
 
   // Events for m_sync_broadcaster
   enum {


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -721,6 +721,9 @@
   assert(default_platform_sp);
   m_platform_list.Append(default_platform_sp, true);
 
+  m_dummy_target = m_target_list.GetDummyTarget(*this);
+  assert(m_dummy_target.get() && "Couldn't construct dummy target?");
+
   m_collection_sp->Initialize(g_debugger_properties);
   m_collection_sp->AppendProperty(
   ConstString("target"),
@@ -1603,9 +1606,7 @@
   }
 }
 
-Target *Debugger::GetDummyTarget() {
-  return m_target_list.GetDummyTarget(*this).get();
-}
+Target *Debugger::GetDummyTarget() { return m_dummy_target.get(); }
 
 Target *Debugger::GetSelectedOrDummyTarget(bool prefer_dummy) {
   Target *target = nullptr;
Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -400,6 +400,7 @@
   Broadcaster m_sync_broadcaster;
   lldb::ListenerSP m_forward_listener_sp;
   llvm::once_flag m_clear_once;
+  lldb::TargetSP m_dummy_target;
 
   // Events for m_sync_broadcaster
   enum {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66581: [lldb] Construct the dummy target when the first Dummy object is constructed

2019-08-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a reviewer: jingham.
labath accepted this revision.
labath added a subscriber: jingham.
labath added a comment.
This revision is now accepted and ready to land.

This looks good to me (I wanted to do something like that myself at one point), 
but maybe let @jingham have a say too. (Overall, I would say that shouldn't be 
any reason why constructing a dummy target should ever fail, nor a reason for 
its creation to consume a large chunk of any kind of resource, so we can save 
ourselves a lot of second-guessing by just ensuring that the dummy target 
really always is there.)




Comment at: lldb/include/lldb/Core/Debugger.h:403
   llvm::once_flag m_clear_once;
+  lldb::TargetSP m_dummy_target;
 

this would be `m_dummy_target_sp`, according to the lldb style.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66581



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


[Lldb-commits] [PATCH] D66581: [lldb] Construct the dummy target when the first Dummy object is constructed

2019-08-22 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 216581.
teemperor added a comment.

- Fix variable name.
- Move GetDummyTarget to header as it's only a one-liner.


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

https://reviews.llvm.org/D66581

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/source/Core/Debugger.cpp


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -721,6 +721,9 @@
   assert(default_platform_sp);
   m_platform_list.Append(default_platform_sp, true);
 
+  m_dummy_target_sp = m_target_list.GetDummyTarget(*this);
+  assert(m_dummy_target_sp.get() && "Couldn't construct dummy target?");
+
   m_collection_sp->Initialize(g_debugger_properties);
   m_collection_sp->AppendProperty(
   ConstString("target"),
@@ -1603,10 +1606,6 @@
   }
 }
 
-Target *Debugger::GetDummyTarget() {
-  return m_target_list.GetDummyTarget(*this).get();
-}
-
 Target *Debugger::GetSelectedOrDummyTarget(bool prefer_dummy) {
   Target *target = nullptr;
   if (!prefer_dummy) {
Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -311,7 +311,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 *GetDummyTarget();
+  Target *GetDummyTarget() { return m_dummy_target_sp.get(); }
 
   lldb::BroadcasterManagerSP GetBroadcasterManager() {
 return m_broadcaster_manager_sp;
@@ -400,6 +400,7 @@
   Broadcaster m_sync_broadcaster;
   lldb::ListenerSP m_forward_listener_sp;
   llvm::once_flag m_clear_once;
+  lldb::TargetSP m_dummy_target_sp;
 
   // Events for m_sync_broadcaster
   enum {


Index: lldb/source/Core/Debugger.cpp
===
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -721,6 +721,9 @@
   assert(default_platform_sp);
   m_platform_list.Append(default_platform_sp, true);
 
+  m_dummy_target_sp = m_target_list.GetDummyTarget(*this);
+  assert(m_dummy_target_sp.get() && "Couldn't construct dummy target?");
+
   m_collection_sp->Initialize(g_debugger_properties);
   m_collection_sp->AppendProperty(
   ConstString("target"),
@@ -1603,10 +1606,6 @@
   }
 }
 
-Target *Debugger::GetDummyTarget() {
-  return m_target_list.GetDummyTarget(*this).get();
-}
-
 Target *Debugger::GetSelectedOrDummyTarget(bool prefer_dummy) {
   Target *target = nullptr;
   if (!prefer_dummy) {
Index: lldb/include/lldb/Core/Debugger.h
===
--- lldb/include/lldb/Core/Debugger.h
+++ lldb/include/lldb/Core/Debugger.h
@@ -311,7 +311,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 *GetDummyTarget();
+  Target *GetDummyTarget() { return m_dummy_target_sp.get(); }
 
   lldb::BroadcasterManagerSP GetBroadcasterManager() {
 return m_broadcaster_manager_sp;
@@ -400,6 +400,7 @@
   Broadcaster m_sync_broadcaster;
   lldb::ListenerSP m_forward_listener_sp;
   llvm::once_flag m_clear_once;
+  lldb::TargetSP m_dummy_target_sp;
 
   // Events for m_sync_broadcaster
   enum {
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66398: 2/2: Fix `TestDataFormatterStdList` regression

2019-08-22 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D66398#1635344 , @labath wrote:

> Since it seems that there is a need for disambiguation (libc++ can be 
> configured to have any name for the inline namespace, so there's no way to 
> make its regex not match the libstdc++ one),


This is regression from D57466 . If you 
configure libc++ to have the same name ("__cxx11") as libstdc++ then LLDB 
really cannot recognize it is libc++ behind.

> I think we should just use the registration order to disambiguate. Then we 
> just need to make sure the libstdc++ formatter is registered before the 
> libc++ one, which should be both easy to achieve and understandable.
> 
> Since you've recently touched this code, how hard do you think it would be to 
> exchange the std::map in FormattersContainer for a std::vector? Would you be 
> willing to give that a try?

From IRC:
That `std::vector` there is not easy.  First some methods were already using 
`.find()` on it so I had to change them to iterate through that vector.
Also some iterating in `FormattersContainer` (`Delete_Impl`, `GetExact_Impl`) 
were now iterating for comparison despite they could use `.find()` so by moving 
to `std::vector` we lose this improvement possibility.
labath: if replace that by a single entry then the nondeterminism goes away
labath: `std::.*::list -> { if (inline_namespace == "__cxx11") return 
"libstdc++ formatter" else return "libc++ formatter" }`

I have somehow find that dispatching implemented C++ not so simple, why not 
just to remove the ambiguity from the regexes?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66398



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


[Lldb-commits] [PATCH] D66398: 2/2: Fix `TestDataFormatterStdList` regression

2019-08-22 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 216585.
jankratochvil edited the summary of this revision.
jankratochvil added a comment.

It just makes now the regexes unambiguous.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66398

Files:
  lldb/include/lldb/DataFormatters/FormattersContainer.h
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp


Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -486,8 +486,11 @@
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
   "libc++ std::list synthetic children",
-  ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"), stl_deref_flags,
-  true);
+  // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( 
)?&)?$"
+  // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
+  ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
+  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
+  stl_deref_flags, true);
   AddCXXSynthetic(
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
@@ -583,11 +586,14 @@
 "libc++ std::list summary provider",
 ConstString("^std::__[[:alnum:]]+::forward_list<.+>(( )?&)?$"),
 stl_summary_flags, true);
-  AddCXXSummary(cpp_category_sp,
-lldb_private::formatters::LibcxxContainerSummaryProvider,
-"libc++ std::list summary provider",
-ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"),
-stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, 
lldb_private::formatters::LibcxxContainerSummaryProvider,
+  "libc++ std::list summary provider",
+  // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( 
)?&)?$"
+  // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
+  ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
+  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
+  stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxContainerSummaryProvider,
 "libc++ std::map summary provider",
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
@@ -130,6 +130,10 @@
 self.expect("frame variable int_array",
 substrs=['1,2'])
 
+# "int []" gets converted by FixArrayTypeNameWithRegex into "int 
\[[0-9]+\]"
+# which becomes ambiguous for some string against "int \[[0-9]\]".
+self.runCmd("type summary clear")
+
 self.runCmd(
 'type summary add --summary-string \"${var[0-1]}\" "int []"')
 
Index: lldb/include/lldb/DataFormatters/FormattersContainer.h
===
--- lldb/include/lldb/DataFormatters/FormattersContainer.h
+++ lldb/include/lldb/DataFormatters/FormattersContainer.h
@@ -296,14 +296,24 @@
 llvm::StringRef key_str = key.GetStringRef();
 std::lock_guard guard(m_format_map.mutex());
 MapIterator pos, end = m_format_map.map().end();
+MapIterator found = end;
 for (pos = m_format_map.map().begin(); pos != end; pos++) {
   lldb::RegularExpressionSP regex = pos->first;
   if (regex->Execute(key_str)) {
-value = pos->second;
-return true;
+if (found != end) {
+  llvm::errs() << "Two regexes (\"" << found->first->GetText()
+   << "\" and \"" << regex->GetText()
+   << "\") ambiguously match the same string \"" << key_str
+   << "\".\n";
+  return false;
+}
+found = pos;
   }
 }
-return false;
+if (found == end)
+  return false;
+value = found->second;
+return true;
   }
 
   bool GetExact_Impl(ConstString key, MapValueType &value,


Index: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -486,8 +486,11 @@
  

[Lldb-commits] [PATCH] D66398: 2/2: Fix `TestDataFormatterStdList` regression

2019-08-22 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

In D66398#1640840 , @jankratochvil 
wrote:

> It just makes now the regexes unambiguous.


I think this is fine too, but I would also only consider it a stop-gap, because 
these kinds of regular are horrid.

What was the problem with the dispatching solution? If it is hard to 
programatically access the inline namespace name (though I expect you should at 
least be able to to something like `type.GetName().startswith("std::__cxx11")`, 
then we can dispatch based on some other property. The presence of some member 
variable for instance? This would technically be even more correct as it would 
also work in the case when someone sadistically configures libc++ to use the 
`__cxx11` namespace. And since the formatters need have knowledge of the member 
variables then I think dispatching based on them is fair game too...




Comment at: lldb/include/lldb/DataFormatters/FormattersContainer.h:299-316
+MapIterator found = end;
 for (pos = m_format_map.map().begin(); pos != end; pos++) {
   lldb::RegularExpressionSP regex = pos->first;
   if (regex->Execute(key_str)) {
-value = pos->second;
-return true;
+if (found != end) {
+  llvm::errs() << "Two regexes (\"" << found->first->GetText()
+   << "\" and \"" << regex->GetText()

Let's make a separate patch for this. I think it would be better to print this 
error through proper channels, but that might require some plumbing.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66398



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


[Lldb-commits] [lldb] r369646 - [lldb][NFC] Add test for target stop-hook disable/enable/delete

2019-08-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Aug 22 06:09:02 2019
New Revision: 369646

URL: http://llvm.org/viewvc/llvm-project?rev=369646&view=rev
Log:
[lldb][NFC] Add test for target stop-hook disable/enable/delete

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py?rev=369646&r1=369645&r2=369646&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/target_command/TestTargetCommand.py
 Thu Aug 22 06:09:02 2019
@@ -22,20 +22,25 @@ class targetCommandTestCase(TestBase):
 self.line_b = line_number('b.c', '// Set break point at this line.')
 self.line_c = line_number('c.c', '// Set break point at this line.')
 
-def test_target_command(self):
-"""Test some target commands: create, list, select."""
+def buildB(self):
+db = {'C_SOURCES': 'b.c', 'EXE': self.getBuildArtifact('b.out')}
+self.build(dictionary=db)
+self.addTearDownCleanup(dictionary=db)
+
+def buildAll(self):
 da = {'C_SOURCES': 'a.c', 'EXE': self.getBuildArtifact('a.out')}
 self.build(dictionary=da)
 self.addTearDownCleanup(dictionary=da)
 
-db = {'C_SOURCES': 'b.c', 'EXE': self.getBuildArtifact('b.out')}
-self.build(dictionary=db)
-self.addTearDownCleanup(dictionary=db)
+self.buildB()
 
 dc = {'C_SOURCES': 'c.c', 'EXE': self.getBuildArtifact('c.out')}
 self.build(dictionary=dc)
 self.addTearDownCleanup(dictionary=dc)
 
+def test_target_command(self):
+"""Test some target commands: create, list, select."""
+self.buildAll()
 self.do_target_command()
 
 def test_target_variable_command(self):
@@ -270,3 +275,21 @@ class targetCommandTestCase(TestBase):
 substrs=[
 "my_global_char",
 "'X'"])
+
+@no_debug_info_test
+def test_target_stop_hook_disable_enable(self):
+self.buildB()
+self.runCmd("file " + self.getBuildArtifact("b.out"), 
CURRENT_EXECUTABLE_SET)
+
+self.expect("target stop-hook disable 1", error=True, 
substrs=['unknown stop hook id: "1"'])
+self.expect("target stop-hook disable blub", error=True, 
substrs=['invalid stop hook id: "blub"'])
+self.expect("target stop-hook enable 1", error=True, substrs=['unknown 
stop hook id: "1"'])
+self.expect("target stop-hook enable blub", error=True, 
substrs=['invalid stop hook id: "blub"'])
+
+@no_debug_info_test
+def test_target_stop_hook_delete(self):
+self.buildB()
+self.runCmd("file " + self.getBuildArtifact("b.out"), 
CURRENT_EXECUTABLE_SET)
+
+self.expect("target stop-hook delete 1", error=True, substrs=['unknown 
stop hook id: "1"'])
+self.expect("target stop-hook delete blub", error=True, 
substrs=['invalid stop hook id: "blub"'])


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


[Lldb-commits] [lldb] r369652 - [lldb][NFC] Fix indentation in CommandObjectProcess

2019-08-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Aug 22 06:50:54 2019
New Revision: 369652

URL: http://llvm.org/viewvc/llvm-project?rev=369652&view=rev
Log:
[lldb][NFC] Fix indentation in CommandObjectProcess

Modified:
lldb/trunk/source/Commands/CommandObjectProcess.cpp

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=369652&r1=369651&r2=369652&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Aug 22 06:50:54 2019
@@ -348,15 +348,15 @@ public:
 partial_name, FileSpec::Style::native);
 match_info.SetNameMatchType(NameMatch::StartsWith);
   }
-  platform_sp->FindProcesses(match_info, process_infos);
-  const size_t num_matches = process_infos.GetSize();
-  if (num_matches == 0)
-return;
-  for (size_t i = 0; i < num_matches; ++i) {
-request.AddCompletion(
-llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
-process_infos.GetProcessNameLengthAtIndex(i)));
-  }
+  platform_sp->FindProcesses(match_info, process_infos);
+  const size_t num_matches = process_infos.GetSize();
+  if (num_matches == 0)
+return;
+  for (size_t i = 0; i < num_matches; ++i) {
+request.AddCompletion(
+llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
+process_infos.GetProcessNameLengthAtIndex(i;
+  }
 }
 
 // Instance variables to hold the values for command options.


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


[Lldb-commits] [lldb] r369655 - [lldb] Fix `TestDataFormatterStdList` regression

2019-08-22 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Thu Aug 22 07:29:52 2019
New Revision: 369655

URL: http://llvm.org/viewvc/llvm-project?rev=369655&view=rev
Log:
[lldb] Fix `TestDataFormatterStdList` regression

Since D66174 I see failures of TestDataFormatterStdList in about 50% of runs on
Fedora 30 x86_64 libstdc++. I have found out that LLDB internally expects these
RegularExpressions to be matched in their alphabetical order:
^std::(__cxx11::)?list<.+>(( )?&)?$
^std::__[[:alnum:]]+::list<.+>(( )?&)?$

But since D66174 they are sometimes matched in reverse order. In fact it was
only some luck it worked before as there is internally
std::map (FormattersContainer).

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

Modified:
lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp?rev=369655&r1=369654&r2=369655&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
(original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp Thu Aug 
22 07:29:52 2019
@@ -486,8 +486,11 @@ static void LoadLibCxxFormatters(lldb::T
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
   "libc++ std::list synthetic children",
-  ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"), stl_deref_flags,
-  true);
+  // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( 
)?&)?$"
+  // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
+  ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
+  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
+  stl_deref_flags, true);
   AddCXXSynthetic(
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
@@ -583,11 +586,14 @@ static void LoadLibCxxFormatters(lldb::T
 "libc++ std::list summary provider",
 ConstString("^std::__[[:alnum:]]+::forward_list<.+>(( )?&)?$"),
 stl_summary_flags, true);
-  AddCXXSummary(cpp_category_sp,
-lldb_private::formatters::LibcxxContainerSummaryProvider,
-"libc++ std::list summary provider",
-ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"),
-stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, 
lldb_private::formatters::LibcxxContainerSummaryProvider,
+  "libc++ std::list summary provider",
+  // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( 
)?&)?$"
+  // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
+  ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
+  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
+  stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxContainerSummaryProvider,
 "libc++ std::map summary provider",


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


[Lldb-commits] [PATCH] D66398: 2/2: Fix `TestDataFormatterStdList` regression

2019-08-22 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369655: [lldb] Fix `TestDataFormatterStdList` regression 
(authored by jankratochvil, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66398?vs=216585&id=216617#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66398

Files:
  lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp


Index: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -486,8 +486,11 @@
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
   "libc++ std::list synthetic children",
-  ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"), stl_deref_flags,
-  true);
+  // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( 
)?&)?$"
+  // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
+  ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
+  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
+  stl_deref_flags, true);
   AddCXXSynthetic(
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
@@ -583,11 +586,14 @@
 "libc++ std::list summary provider",
 ConstString("^std::__[[:alnum:]]+::forward_list<.+>(( )?&)?$"),
 stl_summary_flags, true);
-  AddCXXSummary(cpp_category_sp,
-lldb_private::formatters::LibcxxContainerSummaryProvider,
-"libc++ std::list summary provider",
-ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"),
-stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, 
lldb_private::formatters::LibcxxContainerSummaryProvider,
+  "libc++ std::list summary provider",
+  // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( 
)?&)?$"
+  // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
+  ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
+  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
+  stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxContainerSummaryProvider,
 "libc++ std::map summary provider",


Index: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
===
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -486,8 +486,11 @@
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdListSyntheticFrontEndCreator,
   "libc++ std::list synthetic children",
-  ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"), stl_deref_flags,
-  true);
+  // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( )?&)?$"
+  // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
+  ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
+  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
+  stl_deref_flags, true);
   AddCXXSynthetic(
   cpp_category_sp,
   lldb_private::formatters::LibcxxStdMapSyntheticFrontEndCreator,
@@ -583,11 +586,14 @@
 "libc++ std::list summary provider",
 ConstString("^std::__[[:alnum:]]+::forward_list<.+>(( )?&)?$"),
 stl_summary_flags, true);
-  AddCXXSummary(cpp_category_sp,
-lldb_private::formatters::LibcxxContainerSummaryProvider,
-"libc++ std::list summary provider",
-ConstString("^std::__[[:alnum:]]+::list<.+>(( )?&)?$"),
-stl_summary_flags, true);
+  AddCXXSummary(
+  cpp_category_sp, lldb_private::formatters::LibcxxContainerSummaryProvider,
+  "libc++ std::list summary provider",
+  // A POSIX variant of: "^std::__(?!cxx11:)[[:alnum:]]+::list<.+>(( )?&)?$"
+  // so that it does not clash with: "^std::(__cxx11::)?list<.+>(( )?&)?$"
+  ConstString("^std::__([A-Zabd-z0-9]|cx?[A-Za-wyz0-9]|cxx1?[A-Za-z02-9]|"
+  "cxx11[[:alnum:]])[[:alnum:]]*::list<.+>(( )?&)?$"),
+  stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxContainerSummaryProvider,
 "libc++ std::map summary provider",
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66398: 2/2: Fix `TestDataFormatterStdList` regression

2019-08-22 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D66398#1640871 , @labath wrote:

> because these kinds of regular are horrid.


Yes, they are. So let's link with PCRE  (BSD licensed).

> What was the problem with the dispatching solution?

I do not find it so easy as libc++ formatter is using static function 
`LibcxxStdListSyntheticFrontEndCreator` while libstdc++ is using new object 
instance `ScriptedSyntheticChildren`. The dispatching should be in 
`LibcxxStdListSyntheticFrontEndCreator` so should it store `new 
ScriptedSyntheticChildren` as a static variable?

And then I do not like that solution anyway. Currently the dispatching is based 
on type name strings so why not just do that? KISS 


> we can dispatch based on some other property. The presence of some member 
> variable for instance?

So let's drop the type name completely and make the matching duck typed 
. Why to divert from how it is 
currently done?

Anyway sure feel free to rewrite it but the regression is fixed now.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66398



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


[Lldb-commits] [lldb] r369660 - [lldb] Remove ')' to fix the build

2019-08-22 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Aug 22 08:18:40 2019
New Revision: 369660

URL: http://llvm.org/viewvc/llvm-project?rev=369660&view=rev
Log:
[lldb] Remove ')' to fix the build

That ')' slipped in by accident in the reformatting commit.

Modified:
lldb/trunk/source/Commands/CommandObjectProcess.cpp

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=369660&r1=369659&r2=369660&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Aug 22 08:18:40 2019
@@ -355,7 +355,7 @@ public:
   for (size_t i = 0; i < num_matches; ++i) {
 request.AddCompletion(
 llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
-process_infos.GetProcessNameLengthAtIndex(i;
+process_infos.GetProcessNameLengthAtIndex(i)));
   }
 }
 


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


Re: [Lldb-commits] [lldb] r369652 - [lldb][NFC] Fix indentation in CommandObjectProcess

2019-08-22 Thread Alexander Kornienko via lldb-commits
This commit breaks buildbots:
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/8107

On Thu, Aug 22, 2019 at 3:49 PM Raphael Isemann via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: teemperor
> Date: Thu Aug 22 06:50:54 2019
> New Revision: 369652
>
> URL: http://llvm.org/viewvc/llvm-project?rev=369652&view=rev
> Log:
> [lldb][NFC] Fix indentation in CommandObjectProcess
>
> Modified:
> lldb/trunk/source/Commands/CommandObjectProcess.cpp
>
> Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=369652&r1=369651&r2=369652&view=diff
>
> ==
> --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
> +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Aug 22
> 06:50:54 2019
> @@ -348,15 +348,15 @@ public:
>  partial_name, FileSpec::Style::native);
>  match_info.SetNameMatchType(NameMatch::StartsWith);
>}
> -  platform_sp->FindProcesses(match_info, process_infos);
> -  const size_t num_matches = process_infos.GetSize();
> -  if (num_matches == 0)
> -return;
> -  for (size_t i = 0; i < num_matches; ++i) {
> -request.AddCompletion(
> -llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
> -
> process_infos.GetProcessNameLengthAtIndex(i)));
> -  }
> +  platform_sp->FindProcesses(match_info, process_infos);
> +  const size_t num_matches = process_infos.GetSize();
> +  if (num_matches == 0)
> +return;
> +  for (size_t i = 0; i < num_matches; ++i) {
> +request.AddCompletion(
> +llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
> +
> process_infos.GetProcessNameLengthAtIndex(i;
> +  }
>  }
>
>  // Instance variables to hold the values for command options.
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r369652 - [lldb][NFC] Fix indentation in CommandObjectProcess

2019-08-22 Thread Raphael “Teemperor” Isemann via lldb-commits
Fix is already committed as 369660, sorry for that.
- Raphael

> On Aug 22, 2019, at 5:28 PM, Alexander Kornienko via lldb-commits 
>  wrote:
> 
> This commit breaks buildbots: 
> http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/8107 
> 
> On Thu, Aug 22, 2019 at 3:49 PM Raphael Isemann via lldb-commits 
> mailto:lldb-commits@lists.llvm.org>> wrote:
> Author: teemperor
> Date: Thu Aug 22 06:50:54 2019
> New Revision: 369652
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=369652&view=rev 
> 
> Log:
> [lldb][NFC] Fix indentation in CommandObjectProcess
> 
> Modified:
> lldb/trunk/source/Commands/CommandObjectProcess.cpp
> 
> Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=369652&r1=369651&r2=369652&view=diff
>  
> 
> ==
> --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
> +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Aug 22 06:50:54 
> 2019
> @@ -348,15 +348,15 @@ public:
>  partial_name, FileSpec::Style::native);
>  match_info.SetNameMatchType(NameMatch::StartsWith);
>}
> -  platform_sp->FindProcesses(match_info, process_infos);
> -  const size_t num_matches = process_infos.GetSize();
> -  if (num_matches == 0)
> -return;
> -  for (size_t i = 0; i < num_matches; ++i) {
> -request.AddCompletion(
> -llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
> -
> process_infos.GetProcessNameLengthAtIndex(i)));
> -  }
> +  platform_sp->FindProcesses(match_info, process_infos);
> +  const size_t num_matches = process_infos.GetSize();
> +  if (num_matches == 0)
> +return;
> +  for (size_t i = 0; i < num_matches; ++i) {
> +request.AddCompletion(
> +llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
> +process_infos.GetProcessNameLengthAtIndex(i;
> +  }
>  }
> 
>  // Instance variables to hold the values for command options.
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org 
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


Re: [Lldb-commits] [lldb] r369652 - [lldb][NFC] Fix indentation in CommandObjectProcess

2019-08-22 Thread Alexander Kornienko via lldb-commits
Thanks for the quick fix!

On Thu, Aug 22, 2019 at 5:29 PM Raphael “Teemperor” Isemann <
teempe...@gmail.com> wrote:

> Fix is already committed as 369660, sorry for that.
> - Raphael
>
> On Aug 22, 2019, at 5:28 PM, Alexander Kornienko via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
> This commit breaks buildbots:
> http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/8107
>
> On Thu, Aug 22, 2019 at 3:49 PM Raphael Isemann via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> Author: teemperor
>> Date: Thu Aug 22 06:50:54 2019
>> New Revision: 369652
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=369652&view=rev
>> Log:
>> [lldb][NFC] Fix indentation in CommandObjectProcess
>>
>> Modified:
>> lldb/trunk/source/Commands/CommandObjectProcess.cpp
>>
>> Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=369652&r1=369651&r2=369652&view=diff
>>
>> ==
>> --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
>> +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Aug 22
>> 06:50:54 2019
>> @@ -348,15 +348,15 @@ public:
>>  partial_name, FileSpec::Style::native);
>>  match_info.SetNameMatchType(NameMatch::StartsWith);
>>}
>> -  platform_sp->FindProcesses(match_info, process_infos);
>> -  const size_t num_matches = process_infos.GetSize();
>> -  if (num_matches == 0)
>> -return;
>> -  for (size_t i = 0; i < num_matches; ++i) {
>> -request.AddCompletion(
>> -llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
>> -
>> process_infos.GetProcessNameLengthAtIndex(i)));
>> -  }
>> +  platform_sp->FindProcesses(match_info, process_infos);
>> +  const size_t num_matches = process_infos.GetSize();
>> +  if (num_matches == 0)
>> +return;
>> +  for (size_t i = 0; i < num_matches; ++i) {
>> +request.AddCompletion(
>> +llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
>> +
>> process_infos.GetProcessNameLengthAtIndex(i;
>> +  }
>>  }
>>
>>  // Instance variables to hold the values for command options.
>>
>>
>> ___
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66445: Explicitly Cast Constants to DWORD

2019-08-22 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

Is this necessary?  I see

  C++
  #define STATUS_BREAKPOINT((DWORD   )0x8003L)
  #define STATUS_SINGLE_STEP   ((DWORD   )0x8004L)

in  C:\Program Files (x86)\Windows Kits\8.1\Include\um\winnt.h


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66445



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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 216644.
aprantl added a comment.

Here's an improved version:

- got rid of the completely unnecessary optimization that use memcpy
- made the struct have a SmallBitVector member instead of inheriting from it.

The new struct has an LLVM-like interface for many use-cases, and still exposes 
the bitvector where necessary, but is explicit about it.


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

https://reviews.llvm.org/D66546

Files:
  lldb/include/lldb/Core/PluginManager.h
  lldb/include/lldb/Symbol/ClangASTContext.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/include/lldb/Target/Language.h
  lldb/include/lldb/lldb-private-interfaces.h
  lldb/lit/SymbolFile/DWARF/compilercontext.ll
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/PluginManager.cpp
  lldb/source/Interpreter/OptionValueLanguage.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Symbol/ClangASTContext.cpp
  lldb/source/Symbol/SymbolFile.cpp
  lldb/source/Symbol/TypeSystem.cpp
  lldb/source/Target/Language.cpp
  lldb/source/Target/Target.cpp
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -26,6 +26,7 @@
 #include "lldb/Symbol/TypeList.h"
 #include "lldb/Symbol/TypeMap.h"
 #include "lldb/Symbol/VariableList.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/CleanUp.h"
@@ -144,6 +145,10 @@
 cl::desc("Specify a compiler context as \"kind:name,...\"."),
 cl::value_desc("context"), cl::sub(SymbolsSubcommand));
 
+static cl::opt
+Language("language", cl::desc("Specify a language type, like C99."),
+ cl::value_desc("language"), cl::sub(SymbolsSubcommand));
+
 static cl::list FunctionNameFlags(
 "function-flags", cl::desc("Function search flags:"),
 cl::values(clEnumValN(eFunctionNameTypeAuto, "auto",
@@ -507,13 +512,17 @@
   CompilerDeclContext *ContextPtr =
   ContextOr->IsValid() ? &*ContextOr : nullptr;
 
+  SmallBitVector languages(eNumLanguageTypes);
+  if (!Language.empty())
+languages.set(Language::GetLanguageTypeFromString(Language));
+  
   DenseSet SearchedFiles;
   TypeMap Map;
   if (!Name.empty())
 Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
   SearchedFiles, Map);
   else
-Symfile.FindTypes({parseCompilerContext()}, true, Map);
+Symfile.FindTypes({parseCompilerContext()}, languages, true, Map);
 
   outs() << formatv("Found {0} types:\n", Map.GetSize());
   StreamString Stream;
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -206,13 +206,11 @@
 lldb::REPLSP Target::GetREPL(Status &err, lldb::LanguageType language,
  const char *repl_options, bool can_create) {
   if (language == eLanguageTypeUnknown) {
-std::set repl_languages;
+LanguageSet repl_languages = Language::GetLanguagesSupportingREPLs();
 
-Language::GetLanguagesSupportingREPLs(repl_languages);
-
-if (repl_languages.size() == 1) {
-  language = *repl_languages.begin();
-} else if (repl_languages.size() == 0) {
+if (auto single_lang = repl_languages.GetSingularLanguage()) {
+  language = *single_lang;
+} else if (repl_languages.Empty()) {
   err.SetErrorStringWithFormat(
   "LLDB isn't configured with REPL support for any languages.");
   return REPLSP();
@@ -2129,23 +2127,18 @@
   if (language == eLanguageTypeMipsAssembler // GNU AS and LLVM use it for all
  // assembly code
   || language == eLanguageTypeUnknown) {
-std::set languages_for_types;
-std::set languages_for_expressions;
-
-Language::GetLanguagesSupportingTypeSystems(languages_for_types,
-languages_for_expressions);
+LanguageSet languages_for_expressions =
+Language::GetLanguagesSupportingTypeSystemsForExpressions();
 
-if (languages_for_expressions.count(eLanguageTypeC)) {
+if (languages_for_expressions[eLanguageTypeC]) {
   language = eLanguageTypeC; // LLDB's default.  Override by setting the
  

[Lldb-commits] [PATCH] D66445: Explicitly Cast Constants to DWORD

2019-08-22 Thread Gwen Mittertreiner via Phabricator via lldb-commits
jmittert added a comment.

I believe it's using the one in ntstatus.h

  10.0.16299.0\shared\ntstatus.h
  #define STATUS_BREAKPOINT((NTSTATUS)0x8003L)// winnt

And `NTSTATUS` is defined as a `LONG` in powerbase.h

  10.0.16299.0\um\powerbase.h
  #define NTSTATUS LONG

which would make it a signed (negative) number.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D66445



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


[Lldb-commits] [lldb] r369669 - Doxygenify comments.

2019-08-22 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Aug 22 09:52:37 2019
New Revision: 369669

URL: http://llvm.org/viewvc/llvm-project?rev=369669&view=rev
Log:
Doxygenify comments.

Modified:
lldb/trunk/include/lldb/lldb-enumerations.h

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=369669&r1=369668&r2=369669&view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Thu Aug 22 09:52:37 2019
@@ -69,21 +69,22 @@
 
 namespace lldb {
 
-// Process and Thread States
+/// Process and Thread States.
 enum StateType {
   eStateInvalid = 0,
   eStateUnloaded,  ///< Process is object is valid, but not currently loaded
   eStateConnected, ///< Process is connected to remote debug services, but not
-   ///launched or attached to anything yet
+   /// launched or attached to anything yet
   eStateAttaching, ///< Process is currently trying to attach
   eStateLaunching, ///< Process is in the process of launching
-  // The state changes eStateAttaching and eStateLaunching are both sent while 
the
-  // private state thread is either not yet started or paused. For that 
reason, they
-  // should only be signaled as public state changes, and not private state 
changes.
+  // The state changes eStateAttaching and eStateLaunching are both sent while
+  // the private state thread is either not yet started or paused. For that
+  // reason, they should only be signaled as public state changes, and not
+  // private state changes.
   eStateStopped,   ///< Process or thread is stopped and can be examined.
   eStateRunning,   ///< Process or thread is running and can't be examined.
   eStateStepping,  ///< Process or thread is in the process of stepping and can
-   ///not be examined.
+   /// not be examined.
   eStateCrashed,   ///< Process or thread has crashed and can be examined.
   eStateDetached,  ///< Process has been detached and can't be examined.
   eStateExited,///< Process has exited and can't be examined.
@@ -93,16 +94,17 @@ enum StateType {
   kLastStateType = eStateSuspended
 };
 
-// Launch Flags
+/// Launch Flags.
 FLAGS_ENUM(LaunchFlags){
 eLaunchFlagNone = 0u,
 eLaunchFlagExec = (1u << 0),  ///< Exec when launching and turn the calling
-  ///process into a new process
+  /// process into a new process
 eLaunchFlagDebug = (1u << 1), ///< Stop as soon as the process launches to
-  ///allow the process to be debugged
-eLaunchFlagStopAtEntry = (1u << 2), ///< Stop at the program entry point
-///instead of auto-continuing when
-///launching or attaching at entry 
point
+  /// allow the process to be debugged
+eLaunchFlagStopAtEntry = (1u
+  << 2), ///< Stop at the program entry point
+ /// instead of auto-continuing when
+ /// launching or attaching at entry point
 eLaunchFlagDisableASLR =
 (1u << 3), ///< Disable Address Space Layout Randomization
 eLaunchFlagDisableSTDIO =
@@ -113,23 +115,23 @@ FLAGS_ENUM(LaunchFlags){
 (1u << 6), ///< Launch the process inside a shell to get shell 
expansion
 eLaunchFlagLaunchInSeparateProcessGroup =
 (1u << 7), ///< Launch the process in a separate process group
-eLaunchFlagDontSetExitStatus = (1u << 8), ///< If you are going to hand the
-  ///process off (e.g. to
-  ///debugserver)
+   ///< If you are going to hand the process off (e.g. to
+   ///< debugserver)
+eLaunchFlagDontSetExitStatus = (1u << 8),
 ///< set this flag so lldb & the handee don't race to set its exit status.
 eLaunchFlagDetachOnError = (1u << 9), ///< If set, then the client stub
-  ///should detach rather than killing
-  ///the debugee
+  ///< should detach rather than 
killing
+  ///< the debugee
   ///< if it loses connection with 
lldb.
 eLaunchFlagShellExpandArguments =
 (1u << 10), ///< Perform shell-style argument expansion
 eLaunchFlagCloseTTYOnExit = (1u << 11), ///< Close the open TTY on exit
 };
 
-// Thread Run Modes
+/// Thread Run Modes.
 enum RunMode { eOnlyThisThread, eAllThreads, eOnlyDuringStepping };
 
-// Byte ordering definitions
+/// Byte ordering definitions.
 enum ByteOrder {
   eByteOrderInvalid = 0,
   eB

[Lldb-commits] [lldb] r369670 - Remove redundant curly braces.

2019-08-22 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Aug 22 09:58:56 2019
New Revision: 369670

URL: http://llvm.org/viewvc/llvm-project?rev=369670&view=rev
Log:
Remove redundant curly braces.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=369670&r1=369669&r2=369670&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Thu Aug 
22 09:58:56 2019
@@ -148,7 +148,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
   die.GetDeclContext(decl_context);
   TypeMap dwo_types;
 
-  if (!dwo_module_sp->GetSymbolFile()->FindTypes({decl_context}, true,
+  if (!dwo_module_sp->GetSymbolFile()->FindTypes(decl_context, true,
  dwo_types)) {
 if (!IsClangModuleFwdDecl(die))
   return TypeSP();
@@ -159,7 +159,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
 for (const auto &name_module : sym_file.getExternalTypeModules()) {
   if (!name_module.second)
 continue;
-  if (name_module.second->GetSymbolFile()->FindTypes({decl_context}, true,
+  if (name_module.second->GetSymbolFile()->FindTypes(decl_context, true,
  dwo_types))
 break;
 }

Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-test/lldb-test.cpp?rev=369670&r1=369669&r2=369670&view=diff
==
--- lldb/trunk/tools/lldb-test/lldb-test.cpp (original)
+++ lldb/trunk/tools/lldb-test/lldb-test.cpp Thu Aug 22 09:58:56 2019
@@ -513,7 +513,7 @@ Error opts::symbols::findTypes(lldb_priv
 Symfile.FindTypes(ConstString(Name), ContextPtr, true, UINT32_MAX,
   SearchedFiles, Map);
   else
-Symfile.FindTypes({parseCompilerContext()}, true, Map);
+Symfile.FindTypes(parseCompilerContext(), true, Map);
 
   outs() << formatv("Found {0} types:\n", Map.GetSize());
   StreamString Stream;


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


[Lldb-commits] [PATCH] D66581: [lldb] Construct the dummy target when the first Dummy object is constructed

2019-08-22 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.

You can go a long time without actually using the Dummy target, which is why I 
made it lazily.

Thinking of lldb as the command line program, we tend to think "I'll only ever 
make one debugger" so making one extra per-debugger thing doesn't seem very 
important.  But since the Debugger holds the Console, most UI's make one 
Debugger per debugging session, and may have many of them.  So if making the 
one-per-debugger thing is not trivial, you do need to think a little harder 
about the cost.

OTOH, as Pavel says, a target with no executables that never connects to any 
platforms, or gets any expressions run in it, should be really cheap.  So I'm 
fine with this change.


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

https://reviews.llvm.org/D66581



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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Looks good overall. Just a question of it we want to return "const LanguageSet 
&" to avoid copies. Also switch static functions that currently return 
"LanguageSet" over to use static variables and llvm::once to init them and then 
return "const LanguageSet &".




Comment at: lldb/include/lldb/Target/Language.h:269-271
+  static LanguageSet GetLanguagesSupportingTypeSystems();
+  static LanguageSet GetLanguagesSupportingTypeSystemsForExpressions();
+  static LanguageSet GetLanguagesSupportingREPLs();

return a "const LanguageSet &" to avoid copies?



Comment at: lldb/source/Core/Debugger.cpp:1626
   if (language == eLanguageTypeUnknown) {
-std::set repl_languages;
+LanguageSet repl_languages = Language::GetLanguagesSupportingREPLs();
 

"const LanguageSet &" to avoid copies?



Comment at: lldb/source/Core/PluginManager.cpp:2172
+  for (unsigned i = 0; i < instances.size(); ++i)
+all.bitvector |= instances[i].supported_languages_for_types.bitvector;
+  return all;

Add a LanguageSet method to do this? We are playing with internals here. Maybe:
```
all.Merge(instances[i]);
```



Comment at: lldb/source/Core/PluginManager.cpp:2265-2266
+LanguageSet PluginManager::GetREPLAllTypeSystemSupportedLanguages() {
   std::lock_guard guard(GetREPLMutex());
+  LanguageSet all;
   REPLInstances &instances = GetREPLInstances();

This function is static. Should we return a "const LanguageSet &" here? Also 
use std::once/llvm::once?:

```
static LanguageSet g_langs;
std::once once(...) {
  ... do work to populate
});
return g_langs;
```




Comment at: lldb/source/Interpreter/OptionValueLanguage.cpp:43
 ConstString lang_name(value.trim());
-std::set languages_for_types;
-std::set languages_for_expressions;
-Language::GetLanguagesSupportingTypeSystems(languages_for_types,
-languages_for_expressions);
-
+LanguageSet languages_for_types = 
Language::GetLanguagesSupportingTypeSystems();
 LanguageType new_type =

"const LanguageSet &"?



Comment at: lldb/source/Symbol/ClangASTContext.cpp:737
 
-void ClangASTContext::EnumerateSupportedLanguages(
-std::set &languages_for_types,
-std::set &languages_for_expressions) {
-  static std::vector s_supported_languages_for_types(
-  {lldb::eLanguageTypeC89, lldb::eLanguageTypeC, lldb::eLanguageTypeC11,
-   lldb::eLanguageTypeC_plus_plus, lldb::eLanguageTypeC99,
-   lldb::eLanguageTypeObjC, lldb::eLanguageTypeObjC_plus_plus,
-   lldb::eLanguageTypeC_plus_plus_03, lldb::eLanguageTypeC_plus_plus_11,
-   lldb::eLanguageTypeC11, lldb::eLanguageTypeC_plus_plus_14});
-
-  static std::vector s_supported_languages_for_expressions(
-  {lldb::eLanguageTypeC_plus_plus, lldb::eLanguageTypeObjC_plus_plus,
-   lldb::eLanguageTypeC_plus_plus_03, lldb::eLanguageTypeC_plus_plus_11,
-   lldb::eLanguageTypeC_plus_plus_14});
-
-  languages_for_types.insert(s_supported_languages_for_types.begin(),
- s_supported_languages_for_types.end());
-  languages_for_expressions.insert(
-  s_supported_languages_for_expressions.begin(),
-  s_supported_languages_for_expressions.end());
+LanguageSet ClangASTContext::GetSupportedLanguagesForTypes() {
+  LanguageSet languages;

return "const LanguageSet &"? Then make "static LanguageSet g_languages;" and 
use llvm::once to control one time init?



Comment at: lldb/source/Symbol/ClangASTContext.cpp:754
+LanguageSet ClangASTContext::GetSupportedLanguagesForExpressions() {
+  LanguageSet languages;
+  languages.Insert(lldb::eLanguageTypeC_plus_plus);

return "const LanguageSet &"? Then make "static LanguageSet g_languages;" and 
use llvm::once to control one time init?


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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

> Looks good overall. Just a question of it we want to return "const 
> LanguageSet &" to avoid copies. Also switch static functions that currently 
> return "LanguageSet" over to use static variables and llvm::once to init them 
> and then return "const LanguageSet &".

The point of the static_assert in TypeSystem.cpp is to make sure that a 
LanguageSet is exactly 64 bits in size so it is cheap to pass it by value.


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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

In D66546#1641435 , @aprantl wrote:

> > Looks good overall. Just a question of it we want to return "const 
> > LanguageSet &" to avoid copies. Also switch static functions that currently 
> > return "LanguageSet" over to use static variables and llvm::once to init 
> > them and then return "const LanguageSet &".
>
> The point of the static_assert in TypeSystem.cpp is to make sure that a 
> LanguageSet is exactly 64 bits in size so it is cheap to pass it by value.


Actually, on a 64-bit system it is *always* 64 bits in size, but the 
static_assert guarantees that now memory is allocated.


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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Sounds good about LanguageSet being cheap to pass by value. Are there any paths 
that will call this over and over where we still will be calculating the 
LangaugeSet over and over in a type system? We might benefit from using 
llvm::once and a static LanguageSet in the static functions that return 
LanguageSets if that is the case?


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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

In D66546#1641492 , @clayborg wrote:

> Sounds good about LanguageSet being cheap to pass by value. Are there any 
> paths that will call this over and over where we still will be calculating 
> the LangaugeSet over and over in a type system? We might benefit from using 
> llvm::once and a static LanguageSet in the static functions that return 
> LanguageSets if that is the case?


No, the most "expensive" function is 
ClangASTContext::GetSupportedLanguagesForTypes() which is called once by the 
ClangASTContext constructor.


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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

In D66546#1641534 , @aprantl wrote:

> No, the most "expensive" function is 
> ClangASTContext::GetSupportedLanguagesForTypes() which is called once by the 
> ClangASTContext constructor.


... "expensive" in quotes, because a sufficiently smart compiler should 
optimize it into returning a 64-bit constant.


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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [PATCH] D65952: SymbolVendor: Have plugins return symbol files directly

2019-08-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D65952#1624799 , @labath wrote:

> In D65952#1623297 , @clayborg wrote:
>
> > So I am confused. Are we keeping SymbolVendor around for locating symbols 
> > files or are we getting rid of it entirely?
>
>
> Well... right now my idea was to keep it around as an class with just some 
> static methods for the purposes of locating symbol files, though I'm open to 
> other ideas too. After this patch the SymbolVendor class will contain just 
> one method (FindPlugin), but I think that in the future it could be used to 
> host functionality that is common for different symbol vendors. Here, I'm 
> mainly thinking of `Symbols/LocateSymbolFile.cpp` (formerly 
> `Host/Symbols.cpp`), which contains a bunch of functionality for searching 
> for symbol files (so it could fall under the symbol vendor mandate), and it 
> is currently being called by other symbol vendors to do their job. However, 
> it is also being called from placed other than symbol vendors, and so more 
> refactoring would be needed for that to fit in neatly.


IMHO: The functionality that locates symbol files should be moved into the 
Platform and we can get rid of SymbolVendor completely. So sounds like 
refactoring around that is a good idea. I am fine with this patch standing and 
addressing that refactor in a next patch?


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

https://reviews.llvm.org/D65952



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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

This sounds like a good compromise.




Comment at: lldb/include/lldb/Symbol/SymbolFile.h:197
+  virtual size_t FindTypes(llvm::ArrayRef pattern,
+   llvm::SmallBitVector languages, bool append,
TypeMap &types);

Is there a reason for using a SmallBitVector instead of the LanguageSet type 
here?


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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [lldb] r369684 - [heap.py] Add missing declaration for malloc_get_all_zones

2019-08-22 Thread Vedant Kumar via lldb-commits
Author: vedantk
Date: Thu Aug 22 11:51:03 2019
New Revision: 369684

URL: http://llvm.org/viewvc/llvm-project?rev=369684&view=rev
Log:
[heap.py] Add missing declaration for malloc_get_all_zones

The evaluation context isn't guaranteed to have this declaration.

Fixes "error: use of undeclared identifier 'malloc_get_all_zones'" bugs.

Modified:
lldb/trunk/examples/darwin/heap_find/heap.py

Modified: lldb/trunk/examples/darwin/heap_find/heap.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/darwin/heap_find/heap.py?rev=369684&r1=369683&r2=369684&view=diff
==
--- lldb/trunk/examples/darwin/heap_find/heap.py (original)
+++ lldb/trunk/examples/darwin/heap_find/heap.py Thu Aug 22 11:51:03 2019
@@ -129,6 +129,7 @@ typedef struct malloc_zone_t {
 void *reserved1[12];
 struct malloc_introspection_t  *introspect;
 } malloc_zone_t;
+kern_return_t malloc_get_all_zones(task_t task, memory_reader_t reader, 
vm_address_t **addresses, unsigned *count);
 memory_reader_t task_peek = [](task_t task, vm_address_t remote_address, 
vm_size_t size, void **local_memory) -> kern_return_t {
 *local_memory = (void*) remote_address;
 return KERN_SUCCESS;


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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl marked an inline comment as done.
aprantl added inline comments.



Comment at: lldb/include/lldb/Symbol/SymbolFile.h:197
+  virtual size_t FindTypes(llvm::ArrayRef pattern,
+   llvm::SmallBitVector languages, bool append,
TypeMap &types);

labath wrote:
> Is there a reason for using a SmallBitVector instead of the LanguageSet type 
> here?
No! Thanks. That's a leftover.


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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [lldb] r369690 - Extend FindTypes with CompilerContext to allow filtering by language.

2019-08-22 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Aug 22 12:24:55 2019
New Revision: 369690

URL: http://llvm.org/viewvc/llvm-project?rev=369690&view=rev
Log:
Extend FindTypes with CompilerContext to allow filtering by language.

This patch is also motivated by the Swift branch and is effectively NFC for the 
single-TypeSystem llvm.org branch.

In multi-language projects it is extremely common to have, e.g., a
Clang type and a similarly-named rendition of that same type in
another language. When searching for a type It is much cheaper to pass
a set of supported languages to the SymbolFile than having it
materialize every result and then rejecting the materialized types
that have the wrong language.

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



Modified:
lldb/trunk/include/lldb/Core/PluginManager.h
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/include/lldb/lldb-private-interfaces.h
lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Interpreter/OptionValueLanguage.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp
lldb/trunk/source/Target/Language.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/include/lldb/Core/PluginManager.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginManager.h?rev=369690&r1=369689&r2=369690&view=diff
==
--- lldb/trunk/include/lldb/Core/PluginManager.h (original)
+++ lldb/trunk/include/lldb/Core/PluginManager.h Thu Aug 22 12:24:55 2019
@@ -384,10 +384,10 @@ public:
   GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
 
   // TypeSystem
-  static bool RegisterPlugin(
-  ConstString name, const char *description,
-  TypeSystemCreateInstance create_callback,
-  TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
+  static bool RegisterPlugin(ConstString name, const char *description,
+ TypeSystemCreateInstance create_callback,
+ LanguageSet supported_languages_for_types,
+ LanguageSet supported_languages_for_expressions);
 
   static bool UnregisterPlugin(TypeSystemCreateInstance create_callback);
 
@@ -397,18 +397,14 @@ public:
   static TypeSystemCreateInstance
   GetTypeSystemCreateCallbackForPluginName(ConstString name);
 
-  static TypeSystemEnumerateSupportedLanguages
-  GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
+  static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes();
 
-  static TypeSystemEnumerateSupportedLanguages
-  GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName(
-  ConstString name);
+  static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions();
 
   // REPL
-  static bool
-  RegisterPlugin(ConstString name, const char *description,
- REPLCreateInstance create_callback,
- REPLEnumerateSupportedLanguages enumerate_languages_callback);
+  static bool RegisterPlugin(ConstString name, const char *description,
+ REPLCreateInstance create_callback,
+ LanguageSet supported_languages);
 
   static bool UnregisterPlugin(REPLCreateInstance create_callback);
 
@@ -417,12 +413,7 @@ public:
   static REPLCreateInstance
   GetREPLCreateCallbackForPluginName(ConstString name);
 
-  static REPLEnumerateSupportedLanguages
-  GetREPLEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
-
-  static REPLEnumerateSupportedLanguages
-  GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName(
-  ConstString name);
+  static LanguageSet GetREPLAllTypeSystemSupportedLanguages();
 
   // Some plug-ins might register a DebuggerInitializeCallback callback when
   // registering the plug-in. After a new Debugger instance is created, this
@@ -440,32 +431,28 @@ public:
   ConstString description, bool is_global_property);
 
   static lldb::OptionValuePropertiesSP
-  GetSetting

[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369690: Extend FindTypes with CompilerContext to allow 
filtering by language. (authored by adrian, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66546?vs=216644&id=216689#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66546

Files:
  lldb/trunk/include/lldb/Core/PluginManager.h
  lldb/trunk/include/lldb/Symbol/ClangASTContext.h
  lldb/trunk/include/lldb/Symbol/SymbolFile.h
  lldb/trunk/include/lldb/Symbol/TypeSystem.h
  lldb/trunk/include/lldb/Target/Language.h
  lldb/trunk/include/lldb/lldb-private-interfaces.h
  lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
  lldb/trunk/source/Core/Debugger.cpp
  lldb/trunk/source/Core/PluginManager.cpp
  lldb/trunk/source/Interpreter/OptionValueLanguage.cpp
  lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/trunk/source/Symbol/ClangASTContext.cpp
  lldb/trunk/source/Symbol/SymbolFile.cpp
  lldb/trunk/source/Symbol/TypeSystem.cpp
  lldb/trunk/source/Target/Language.cpp
  lldb/trunk/source/Target/Target.cpp
  lldb/trunk/tools/lldb-test/lldb-test.cpp

Index: lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
===
--- lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
+++ lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
@@ -1,18 +1,21 @@
 ; Test finding types by CompilerContext.
 ; RUN: llc %s -filetype=obj -o %t.o
-; RUN: lldb-test symbols %t.o -find=type \
+; RUN: lldb-test symbols %t.o -find=type --language=C99 \
 ; RUN:   -compiler-context="Module:CModule,Module:SubModule,Struct:FromSubmoduleX" \
 ; RUN:   | FileCheck %s --check-prefix=NORESULTS
-; RUN: lldb-test symbols %t.o -find=type \
+; RUN: lldb-test symbols %t.o -find=type --language=C++ \
+; RUN:   -compiler-context="Module:CModule,Module:SubModule,Struct:FromSubmodule" \
+; RUN:   | FileCheck %s --check-prefix=NORESULTS
+; RUN: lldb-test symbols %t.o -find=type --language=C99 \
 ; RUN:   -compiler-context="Module:CModule,Module:SubModule,Struct:FromSubmodule" \
 ; RUN:   | FileCheck %s
-; RUN: lldb-test symbols %t.o -find=type \
+; RUN: lldb-test symbols %t.o -find=type --language=C99 \
 ; RUN:   -compiler-context="Module:CModule,AnyModule:*,Struct:FromSubmodule" \
 ; RUN:   | FileCheck %s
-; RUN: lldb-test symbols %t.o -find=type \
+; RUN: lldb-test symbols %t.o -find=type --language=C99 \
 ; RUN:   -compiler-context="AnyModule:*,Struct:FromSubmodule" \
 ; RUN:   | FileCheck %s
-; RUN: lldb-test symbols %t.o -find=type \
+; RUN: lldb-test symbols %t.o -find=type --language=C99 \
 ; RUN:   -compiler-context="Module:CModule,Module:SubModule,AnyType:FromSubmodule" \
 ; RUN:   | FileCheck %s
 ;
Index: lldb/trunk/include/lldb/lldb-private-interfaces.h
===
--- lldb/trunk/include/lldb/lldb-private-interfaces.h
+++ lldb/trunk/include/lldb/lldb-private-interfaces.h
@@ -102,11 +102,6 @@
lldb::LanguageType language,
Debugger *debugger, Target *target,
const char *repl_options);
-typedef void (*TypeSystemEnumerateSupportedLanguages)(
-std::set &languages_for_types,
-std::set &languages_for_expressions);
-typedef void (*REPLEnumerateSupportedLanguages)(
-std::set &languages);
 typedef int (*ComparisonFunction)(const void *, const void *);
 typedef void (*DebuggerInitializeCallback)(Debugger &debugger);
 
Index: lldb/trunk/include/lldb/Core/PluginManager.h
===
--- lldb/trunk/include/lldb/Core/PluginManager.h
+++ lldb/trunk/include/lldb/Core/PluginManager.h
@@ -384,10 +384,10 @@
   GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
 
   // TypeSystem
-  static bool RegisterPlugin(
-  ConstString name, const char *description,
-  TypeSystemCreateInstance create_callback,
-  TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
+  static bool RegisterPlugin(ConstString name, const char *description,
+ TypeSystemCreateInstance create_callback,
+ LanguageSet supported_languages_for_types,

[Lldb-commits] [lldb] r369691 - Add missing include

2019-08-22 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Aug 22 12:30:10 2019
New Revision: 369691

URL: http://llvm.org/viewvc/llvm-project?rev=369691&view=rev
Log:
Add missing include

Modified:
lldb/trunk/include/lldb/Target/Language.h

Modified: lldb/trunk/include/lldb/Target/Language.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=369691&r1=369690&r2=369691&view=diff
==
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Thu Aug 22 12:30:10 2019
@@ -20,6 +20,7 @@
 #include "lldb/DataFormatters/DumpValueObjectOptions.h"
 #include "lldb/DataFormatters/FormatClasses.h"
 #include "lldb/DataFormatters/StringPrinter.h"
+#include "lldb/Symbol/TypeSystem.h"
 #include "lldb/lldb-private.h"
 #include "lldb/lldb-public.h"
 


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


[Lldb-commits] [lldb] r369692 - Add missing include

2019-08-22 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Aug 22 12:32:24 2019
New Revision: 369692

URL: http://llvm.org/viewvc/llvm-project?rev=369692&view=rev
Log:
Add missing include

Modified:
lldb/trunk/include/lldb/Core/PluginManager.h

Modified: lldb/trunk/include/lldb/Core/PluginManager.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginManager.h?rev=369692&r1=369691&r2=369692&view=diff
==
--- lldb/trunk/include/lldb/Core/PluginManager.h (original)
+++ lldb/trunk/include/lldb/Core/PluginManager.h Thu Aug 22 12:32:24 2019
@@ -10,6 +10,7 @@
 #define liblldb_PluginManager_h_
 
 #include "lldb/Core/Architecture.h"
+#include "lldb/Symbol/TypeSystem.h"
 #include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"


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


[Lldb-commits] [lldb] r369698 - Rename lldb/source/Interpreter/OptionValueFileSpecLIst.cpp to

2019-08-22 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Aug 22 13:08:46 2019
New Revision: 369698

URL: http://llvm.org/viewvc/llvm-project?rev=369698&view=rev
Log:
Rename lldb/source/Interpreter/OptionValueFileSpecLIst.cpp to
   lldb/source/Interpreter/OptionValueFileSpecListTmp.cpp (NFC)

Added:
lldb/trunk/source/Interpreter/OptionValueFileSpecListTmp.cpp
Removed:
lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp
Modified:
lldb/trunk/source/Interpreter/CMakeLists.txt

Modified: lldb/trunk/source/Interpreter/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CMakeLists.txt?rev=369698&r1=369697&r2=369698&view=diff
==
--- lldb/trunk/source/Interpreter/CMakeLists.txt (original)
+++ lldb/trunk/source/Interpreter/CMakeLists.txt Thu Aug 22 13:08:46 2019
@@ -35,7 +35,7 @@ add_lldb_library(lldbInterpreter
   OptionValueDictionary.cpp
   OptionValueEnumeration.cpp
   OptionValueFileSpec.cpp
-  OptionValueFileSpecLIst.cpp
+  OptionValueFileSpecListTmp.cpp
   OptionValueFormat.cpp
   OptionValueFormatEntity.cpp
   OptionValueLanguage.cpp

Removed: lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp?rev=369697&view=auto
==
--- lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp (removed)
@@ -1,170 +0,0 @@
-//===-- OptionValueFileSpecLIst.cpp -*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "lldb/Interpreter/OptionValueFileSpecList.h"
-
-#include "lldb/Host/StringConvert.h"
-#include "lldb/Utility/Args.h"
-#include "lldb/Utility/Stream.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx,
-Stream &strm, uint32_t dump_mask) {
-  std::lock_guard lock(m_mutex);
-  if (dump_mask & eDumpOptionType)
-strm.Printf("(%s)", GetTypeAsCString());
-  if (dump_mask & eDumpOptionValue) {
-const bool one_line = dump_mask & eDumpOptionCommand;
-const uint32_t size = m_current_value.GetSize();
-if (dump_mask & eDumpOptionType)
-  strm.Printf(" =%s",
-  (m_current_value.GetSize() > 0 && !one_line) ? "\n" : "");
-if (!one_line)
-  strm.IndentMore();
-for (uint32_t i = 0; i < size; ++i) {
-  if (!one_line) {
-strm.Indent();
-strm.Printf("[%u]: ", i);
-  }
-  m_current_value.GetFileSpecAtIndex(i).Dump(&strm);
-  if (one_line)
-strm << ' ';
-}
-if (!one_line)
-  strm.IndentLess();
-  }
-}
-
-Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
-   VarSetOperationType op) {
-  std::lock_guard lock(m_mutex);
-  Status error;
-  Args args(value.str());
-  const size_t argc = args.GetArgumentCount();
-
-  switch (op) {
-  case eVarSetOperationClear:
-Clear();
-NotifyValueChanged();
-break;
-
-  case eVarSetOperationReplace:
-if (argc > 1) {
-  uint32_t idx =
-  StringConvert::ToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX);
-  const uint32_t count = m_current_value.GetSize();
-  if (idx > count) {
-error.SetErrorStringWithFormat(
-"invalid file list index %u, index must be 0 through %u", idx,
-count);
-  } else {
-for (size_t i = 1; i < argc; ++i, ++idx) {
-  FileSpec file(args.GetArgumentAtIndex(i));
-  if (idx < count)
-m_current_value.Replace(idx, file);
-  else
-m_current_value.Append(file);
-}
-NotifyValueChanged();
-  }
-} else {
-  error.SetErrorString("replace operation takes an array index followed by 
"
-   "one or more values");
-}
-break;
-
-  case eVarSetOperationAssign:
-m_current_value.Clear();
-// Fall through to append case
-LLVM_FALLTHROUGH;
-  case eVarSetOperationAppend:
-if (argc > 0) {
-  m_value_was_set = true;
-  for (size_t i = 0; i < argc; ++i) {
-FileSpec file(args.GetArgumentAtIndex(i));
-m_current_value.Append(file);
-  }
-  NotifyValueChanged();
-} else {
-  error.SetErrorString(
-  "assign operation takes at least one file path argument");
-}
-break;
-
-  case eVarSetOperationInsertBefore:
-  case eVarSetOperationInsertAfter:
-if (argc > 1) {
-  uint32_t idx =
-  StringConvert::ToUInt32(args.GetArgume

[Lldb-commits] [lldb] r369699 - Rename lldb/source/Interpreter/OptionValueFileSpecListTmp.cpp to

2019-08-22 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Aug 22 13:10:24 2019
New Revision: 369699

URL: http://llvm.org/viewvc/llvm-project?rev=369699&view=rev
Log:
Rename lldb/source/Interpreter/OptionValueFileSpecListTmp.cpp to
   lldb/source/Interpreter/OptionValueFileSpecList.cpp (NFC)

Added:
lldb/trunk/source/Interpreter/OptionValueFileSpecList.cpp
Removed:
lldb/trunk/source/Interpreter/OptionValueFileSpecListTmp.cpp
Modified:
lldb/trunk/source/Interpreter/CMakeLists.txt

Modified: lldb/trunk/source/Interpreter/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CMakeLists.txt?rev=369699&r1=369698&r2=369699&view=diff
==
--- lldb/trunk/source/Interpreter/CMakeLists.txt (original)
+++ lldb/trunk/source/Interpreter/CMakeLists.txt Thu Aug 22 13:10:24 2019
@@ -35,7 +35,7 @@ add_lldb_library(lldbInterpreter
   OptionValueDictionary.cpp
   OptionValueEnumeration.cpp
   OptionValueFileSpec.cpp
-  OptionValueFileSpecListTmp.cpp
+  OptionValueFileSpecList.cpp
   OptionValueFormat.cpp
   OptionValueFormatEntity.cpp
   OptionValueLanguage.cpp

Added: lldb/trunk/source/Interpreter/OptionValueFileSpecList.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpecList.cpp?rev=369699&view=auto
==
--- lldb/trunk/source/Interpreter/OptionValueFileSpecList.cpp (added)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpecList.cpp Thu Aug 22 
13:10:24 2019
@@ -0,0 +1,170 @@
+//===-- OptionValueFileSpecList.cpp 
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Interpreter/OptionValueFileSpecList.h"
+
+#include "lldb/Host/StringConvert.h"
+#include "lldb/Utility/Args.h"
+#include "lldb/Utility/Stream.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx,
+Stream &strm, uint32_t dump_mask) {
+  std::lock_guard lock(m_mutex);
+  if (dump_mask & eDumpOptionType)
+strm.Printf("(%s)", GetTypeAsCString());
+  if (dump_mask & eDumpOptionValue) {
+const bool one_line = dump_mask & eDumpOptionCommand;
+const uint32_t size = m_current_value.GetSize();
+if (dump_mask & eDumpOptionType)
+  strm.Printf(" =%s",
+  (m_current_value.GetSize() > 0 && !one_line) ? "\n" : "");
+if (!one_line)
+  strm.IndentMore();
+for (uint32_t i = 0; i < size; ++i) {
+  if (!one_line) {
+strm.Indent();
+strm.Printf("[%u]: ", i);
+  }
+  m_current_value.GetFileSpecAtIndex(i).Dump(&strm);
+  if (one_line)
+strm << ' ';
+}
+if (!one_line)
+  strm.IndentLess();
+  }
+}
+
+Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
+   VarSetOperationType op) {
+  std::lock_guard lock(m_mutex);
+  Status error;
+  Args args(value.str());
+  const size_t argc = args.GetArgumentCount();
+
+  switch (op) {
+  case eVarSetOperationClear:
+Clear();
+NotifyValueChanged();
+break;
+
+  case eVarSetOperationReplace:
+if (argc > 1) {
+  uint32_t idx =
+  StringConvert::ToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX);
+  const uint32_t count = m_current_value.GetSize();
+  if (idx > count) {
+error.SetErrorStringWithFormat(
+"invalid file list index %u, index must be 0 through %u", idx,
+count);
+  } else {
+for (size_t i = 1; i < argc; ++i, ++idx) {
+  FileSpec file(args.GetArgumentAtIndex(i));
+  if (idx < count)
+m_current_value.Replace(idx, file);
+  else
+m_current_value.Append(file);
+}
+NotifyValueChanged();
+  }
+} else {
+  error.SetErrorString("replace operation takes an array index followed by 
"
+   "one or more values");
+}
+break;
+
+  case eVarSetOperationAssign:
+m_current_value.Clear();
+// Fall through to append case
+LLVM_FALLTHROUGH;
+  case eVarSetOperationAppend:
+if (argc > 0) {
+  m_value_was_set = true;
+  for (size_t i = 0; i < argc; ++i) {
+FileSpec file(args.GetArgumentAtIndex(i));
+m_current_value.Append(file);
+  }
+  NotifyValueChanged();
+} else {
+  error.SetErrorString(
+  "assign operation takes at least one file path argument");
+}
+break;
+
+  case eVarSetOperationInsertBefore:
+  case eVarSetOperationInsertAfter:
+if (argc > 1) {
+  uint32_t idx =
+  StringConvert::ToUInt32(arg

[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

It looks like this broke the windows build bot:

http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/8120


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [lldb] r369702 - Revert Extend FindTypes with CompilerContext to allow filtering by language.

2019-08-22 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Aug 22 13:41:16 2019
New Revision: 369702

URL: http://llvm.org/viewvc/llvm-project?rev=369702&view=rev
Log:
Revert Extend FindTypes with CompilerContext to allow filtering by language.

This reverts r369690 (git commit aa3a564efa6b5fff2129f81a4041069a0233168f)

Modified:
lldb/trunk/include/lldb/Core/PluginManager.h
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/include/lldb/lldb-private-interfaces.h
lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Interpreter/OptionValueLanguage.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp
lldb/trunk/source/Target/Language.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/include/lldb/Core/PluginManager.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginManager.h?rev=369702&r1=369701&r2=369702&view=diff
==
--- lldb/trunk/include/lldb/Core/PluginManager.h (original)
+++ lldb/trunk/include/lldb/Core/PluginManager.h Thu Aug 22 13:41:16 2019
@@ -385,10 +385,10 @@ public:
   GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
 
   // TypeSystem
-  static bool RegisterPlugin(ConstString name, const char *description,
- TypeSystemCreateInstance create_callback,
- LanguageSet supported_languages_for_types,
- LanguageSet supported_languages_for_expressions);
+  static bool RegisterPlugin(
+  ConstString name, const char *description,
+  TypeSystemCreateInstance create_callback,
+  TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
 
   static bool UnregisterPlugin(TypeSystemCreateInstance create_callback);
 
@@ -398,14 +398,18 @@ public:
   static TypeSystemCreateInstance
   GetTypeSystemCreateCallbackForPluginName(ConstString name);
 
-  static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes();
+  static TypeSystemEnumerateSupportedLanguages
+  GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
 
-  static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions();
+  static TypeSystemEnumerateSupportedLanguages
+  GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName(
+  ConstString name);
 
   // REPL
-  static bool RegisterPlugin(ConstString name, const char *description,
- REPLCreateInstance create_callback,
- LanguageSet supported_languages);
+  static bool
+  RegisterPlugin(ConstString name, const char *description,
+ REPLCreateInstance create_callback,
+ REPLEnumerateSupportedLanguages enumerate_languages_callback);
 
   static bool UnregisterPlugin(REPLCreateInstance create_callback);
 
@@ -414,7 +418,12 @@ public:
   static REPLCreateInstance
   GetREPLCreateCallbackForPluginName(ConstString name);
 
-  static LanguageSet GetREPLAllTypeSystemSupportedLanguages();
+  static REPLEnumerateSupportedLanguages
+  GetREPLEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
+
+  static REPLEnumerateSupportedLanguages
+  GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName(
+  ConstString name);
 
   // Some plug-ins might register a DebuggerInitializeCallback callback when
   // registering the plug-in. After a new Debugger instance is created, this
@@ -432,28 +441,32 @@ public:
   ConstString description, bool is_global_property);
 
   static lldb::OptionValuePropertiesSP
-  GetSettingForPlatformPlugin(Debugger &debugger, ConstString setting_name);
+  GetSettingForPlatformPlugin(Debugger &debugger,
+  ConstString setting_name);
 
   static bool CreateSettingForPlatformPlugin(
   Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
   ConstString description, bool is_global_property);
 
   static lldb::OptionValuePropertiesSP
-  GetSettingForProcessPlugin(Debugger &debugger, Co

[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Yeah, I'm trying to get behind what happened there, but I may need some help 
later on.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Looks like this also broke other platforms, which is good because I can debug 
it! I reverted the patch for now.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66546



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


Re: [Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Stella Stamenova via lldb-commits
Thanks!

Thanks,
- Stella

From: Adrian Prantl via Phabricator 
Sent: Thursday, August 22, 2019 1:42:13 PM
To: apra...@apple.com ; pa...@labath.sk ; 
clayb...@gmail.com ; jmole...@apple.com 
; jo...@devlieghere.com 
Cc: Stella Stamenova ; llvm-comm...@lists.llvm.org 
; lldb-commits@lists.llvm.org 

Subject: [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering 
by language

aprantl added a comment.

Looks like this also broke other platforms, which is good because I can debug 
it! I reverted the patch for now.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.llvm.org%2FD66546%2Fnew%2F&data=02%7C01%7Cstilis%40microsoft.com%7C7c488b0f46e542c0c17808d72741371b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637021033365048191&sdata=6al5vRHQa%2B2L2YwDsToI4x0CSIQOq89uu5lG0PCxwlQ%3D&reserved=0

https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.llvm.org%2FD66546&data=02%7C01%7Cstilis%40microsoft.com%7C7c488b0f46e542c0c17808d72741371b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637021033365048191&sdata=3%2FjiQrs2PZWFro6EByuqqjI6ZlaYIEQsbsDX1sowQeg%3D&reserved=0



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


[Lldb-commits] [lldb] r369706 - Revert [heap.py] Add missing declaration for malloc_get_all_zones

2019-08-22 Thread Vedant Kumar via lldb-commits
Author: vedantk
Date: Thu Aug 22 14:01:45 2019
New Revision: 369706

URL: http://llvm.org/viewvc/llvm-project?rev=369706&view=rev
Log:
Revert [heap.py] Add missing declaration for malloc_get_all_zones

This reverts r369684 (git commit cc62e38d258f414c196b566374c606e83a85a034)

Adding a declaration doesn't appear to be a sufficient fix.

Modified:
lldb/trunk/examples/darwin/heap_find/heap.py

Modified: lldb/trunk/examples/darwin/heap_find/heap.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/darwin/heap_find/heap.py?rev=369706&r1=369705&r2=369706&view=diff
==
--- lldb/trunk/examples/darwin/heap_find/heap.py (original)
+++ lldb/trunk/examples/darwin/heap_find/heap.py Thu Aug 22 14:01:45 2019
@@ -129,7 +129,6 @@ typedef struct malloc_zone_t {
 void *reserved1[12];
 struct malloc_introspection_t  *introspect;
 } malloc_zone_t;
-kern_return_t malloc_get_all_zones(task_t task, memory_reader_t reader, 
vm_address_t **addresses, unsigned *count);
 memory_reader_t task_peek = [](task_t task, vm_address_t remote_address, 
vm_size_t size, void **local_memory) -> kern_return_t {
 *local_memory = (void*) remote_address;
 return KERN_SUCCESS;


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


[Lldb-commits] [PATCH] D66546: Extend FindTypes w/ CompilerContext to allow filtering by language

2019-08-22 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Turns out I accidentally deleted the constructor of LanguageSet in my very last 
refactoring.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66546



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


[Lldb-commits] [PATCH] D66447: Add char8_t support (C++20)

2019-08-22 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

A couple inline comments.  I think this is looking pretty good.




Comment at: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp:1
+#include 
+

Is this include necessary?



Comment at: lldb/trunk/source/Symbol/ClangASTContext.cpp:1391
   return CompilerType(this, ast->Char32Ty.getAsOpaquePtr());
-}
+else if (streq(type_name, "char8_t"))
+  return CompilerType(this, ast->Char8Ty.getAsOpaquePtr());

I think the current style is to omit the `else` keywords on these, since each 
`if` returns.  That would at least be consistent with several cases above.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66447



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


[Lldb-commits] [lldb] r369709 - TestAppleSimulatorOSType: Pass the --standalone argument to simctl

2019-08-22 Thread Frederic Riss via lldb-commits
Author: friss
Date: Thu Aug 22 14:44:10 2019
New Revision: 369709

URL: http://llvm.org/viewvc/llvm-project?rev=369709&view=rev
Log:
TestAppleSimulatorOSType: Pass the --standalone argument to simctl

It looks like running without this argument was supported
for legacy reasons, but a Xcode 11 beta made the argument
mandatory for our usecase.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py?rev=369709&r1=369708&r2=369709&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestAppleSimulatorOSType.py
 Thu Aug 22 14:44:10 2019
@@ -46,7 +46,7 @@ class TestAppleSimulatorOSType(gdbremote
 self.build(dictionary={ 'EXE': exe_name, 'SDKROOT': sdkroot.strip(),
 'ARCH': arch })
 exe_path = self.getBuildArtifact(exe_name)
-sim_launcher = subprocess.Popen(['xcrun', 'simctl', 'spawn',
+sim_launcher = subprocess.Popen(['xcrun', 'simctl', 'spawn', '-s',
  deviceUDID, exe_path,
  'print-pid', 'sleep:10'],
 stderr=subprocess.PIPE)


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


[Lldb-commits] [lldb] r369710 - Extend FindTypes with CompilerContext to allow filtering by language.

2019-08-22 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Aug 22 14:45:58 2019
New Revision: 369710

URL: http://llvm.org/viewvc/llvm-project?rev=369710&view=rev
Log:
Extend FindTypes with CompilerContext to allow filtering by language.

This patch is also motivated by the Swift branch and is effectively NFC for the 
single-TypeSystem llvm.org branch.

In multi-language projects it is extremely common to have, e.g., a
Clang type and a similarly-named rendition of that same type in
another language. When searching for a type It is much cheaper to pass
a set of supported languages to the SymbolFile than having it
materialize every result and then rejecting the materialized types
that have the wrong language.

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



This reapplies r369690 with a previously missing constructor for LanguageSet.

Modified:
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Core/PluginManager.h
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/SymbolFile.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/include/lldb/lldb-private-interfaces.h
lldb/trunk/lit/SymbolFile/DWARF/compilercontext.ll
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Interpreter/OptionValueLanguage.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/SymbolFile.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp
lldb/trunk/source/Target/Language.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=369710&r1=369709&r2=369710&view=diff
==
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Thu Aug 22 14:45:58 2019
@@ -454,6 +454,14 @@ public:
 llvm::DenseSet &searched_symbol_files,
 TypeList &types);
 
+  /// Find types by name.
+  ///
+  /// This behaves like the other FindTypes method but allows to
+  /// specify a DeclContext and a language for the type being searched
+  /// for.
+  size_t FindTypes(llvm::ArrayRef pattern,
+   LanguageSet languages, bool append, TypeMap &types);
+
   lldb::TypeSP FindFirstType(const SymbolContext &sc,
  ConstString type_name, bool exact_match);
 

Modified: lldb/trunk/include/lldb/Core/PluginManager.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginManager.h?rev=369710&r1=369709&r2=369710&view=diff
==
--- lldb/trunk/include/lldb/Core/PluginManager.h (original)
+++ lldb/trunk/include/lldb/Core/PluginManager.h Thu Aug 22 14:45:58 2019
@@ -385,10 +385,10 @@ public:
   GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
 
   // TypeSystem
-  static bool RegisterPlugin(
-  ConstString name, const char *description,
-  TypeSystemCreateInstance create_callback,
-  TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
+  static bool RegisterPlugin(ConstString name, const char *description,
+ TypeSystemCreateInstance create_callback,
+ LanguageSet supported_languages_for_types,
+ LanguageSet supported_languages_for_expressions);
 
   static bool UnregisterPlugin(TypeSystemCreateInstance create_callback);
 
@@ -398,18 +398,14 @@ public:
   static TypeSystemCreateInstance
   GetTypeSystemCreateCallbackForPluginName(ConstString name);
 
-  static TypeSystemEnumerateSupportedLanguages
-  GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
+  static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes();
 
-  static TypeSystemEnumerateSupportedLanguages
-  GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName(
-  ConstString name);
+  static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions();
 
   // REPL
-  static bool
-  RegisterPlugin(ConstString name, const char *description,
- REPLCreateInstance create_callback,
-  

Re: [Lldb-commits] [PATCH] D66445: Explicitly Cast Constants to DWORD

2019-08-22 Thread Aaron Smith via lldb-commits
The reason for the define is it’s not possible currently to include winnt.h 
without build errors. Definitely something to cleanup.

> On Aug 22, 2019, at 9:47 AM, Gwen Mittertreiner via Phabricator 
>  wrote:
> 
> jmittert added a comment.
> 
> I believe it's using the one in ntstatus.h
> 
>  10.0.16299.0\shared\ntstatus.h
>  #define STATUS_BREAKPOINT((NTSTATUS)0x8003L)// winnt
> 
> And `NTSTATUS` is defined as a `LONG` in powerbase.h
> 
>  10.0.16299.0\um\powerbase.h
>  #define NTSTATUS LONG
> 
> which would make it a signed (negative) number.
> 
> 
> Repository:
>  rLLDB LLDB
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D66445/new/
> 
> https://reviews.llvm.org/D66445
> 
> 
> 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D66357: Fix GetDIEForDeclContext so it only returns entries matching the provided context

2019-08-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Now that obj2yaml is a library, we might be able to make some real DWARF to 
exercise this? I can custom make any DWARF you want as I have a DWARF generator.

Though this test does verify that the searching process works correctly. Not 
sure how maintenance free this will be over time though. But I am fine with 
this for now and we can fix it later if it becomes an issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66357



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


[Lldb-commits] [lldb] r369712 - Add missing dot.

2019-08-22 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Aug 22 15:28:18 2019
New Revision: 369712

URL: http://llvm.org/viewvc/llvm-project?rev=369712&view=rev
Log:
Add missing dot.

Modified:
lldb/trunk/include/lldb/lldb-enumerations.h

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=369712&r1=369711&r2=369712&view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Thu Aug 22 15:28:18 2019
@@ -805,7 +805,7 @@ enum TemplateArgumentKind {
   eTemplateArgumentKindNullPtr,
 };
 
-/// Options that can be set for a formatter to alter its behavior Not
+/// Options that can be set for a formatter to alter its behavior. Not
 /// all of these are applicable to all formatter types.
 FLAGS_ENUM(TypeOptions){eTypeOptionNone = (0u),
 eTypeOptionCascade = (1u << 0),


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


[Lldb-commits] [PATCH] D66357: Fix GetDIEForDeclContext so it only returns entries matching the provided context

2019-08-22 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade added a comment.

Sounds good, thank you!

Can someone please merge this for me?

  ninja check-lldb
  Testing Time: 163.56s
Expected Passes: 1603
Expected Failures  : 4
Unsupported Tests  : 85


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66357



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


[Lldb-commits] [PATCH] D66248: [JIT][Command] Add "inject-condition" flag to conditional breakpoints

2019-08-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 216745.
mib added a comment.

Rename `cli` to `use_interpreter` in test.

Use early returns on SB API classes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66248

Files:
  lldb/include/lldb/API/SBBreakpoint.h
  lldb/include/lldb/API/SBBreakpointLocation.h
  lldb/include/lldb/Breakpoint/Breakpoint.h
  lldb/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/include/lldb/Breakpoint/BreakpointOptions.h
  lldb/include/lldb/Target/Target.h
  lldb/include/lldb/lldb-enumerations.h
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/TestFastConditionalBreakpoints.py
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/main.c
  lldb/scripts/interface/SBBreakpoint.i
  lldb/scripts/interface/SBBreakpointLocation.i
  lldb/source/API/SBBreakpoint.cpp
  lldb/source/API/SBBreakpointLocation.cpp
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/BreakpointOptions.cpp
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Commands/Options.td

Index: lldb/source/Commands/Options.td
===
--- lldb/source/Commands/Options.td
+++ lldb/source/Commands/Options.td
@@ -87,6 +87,9 @@
 Arg<"Command">,
 Desc<"A command to run when the breakpoint is hit, can be provided more "
 "than once, the commands will get run in order left to right.">;
+  def breakpoint_modify_inject_condition : Option<"inject-condition", "I">,
+  Desc<"The breakpoint injects the condition expression into the process "
+  "machine code. Enables Fast Conditional Breakpoints.">;
 }
 
 let Command = "breakpoint dummy" in {
Index: lldb/source/Commands/CommandObjectBreakpoint.cpp
===
--- lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -102,6 +102,13 @@
 m_bp_opts.SetIgnoreCount(ignore_count);
 }
 break;
+case 'I': {
+  if (!m_bp_opts.IsOptionSet(BreakpointOptions::eCondition))
+error.SetErrorString("inject-condition option only available for "
+ "conditional breakpoints");
+  else
+m_bp_opts.SetInjectCondition(true);
+} break;
 case 'o': {
   bool value, success;
   value = OptionArgParser::ToBoolean(option_arg, false, &success);
Index: lldb/source/Breakpoint/BreakpointOptions.cpp
===
--- lldb/source/Breakpoint/BreakpointOptions.cpp
+++ lldb/source/Breakpoint/BreakpointOptions.cpp
@@ -109,8 +109,8 @@
 
 const char *BreakpointOptions::g_option_names[(
 size_t)BreakpointOptions::OptionNames::LastOptionName]{
-"ConditionText", "IgnoreCount", 
-"EnabledState", "OneShotState", "AutoContinue"};
+"ConditionText", "IgnoreCount",  "EnabledState",
+"OneShotState",  "AutoContinue", "JITCondition"};
 
 bool BreakpointOptions::NullCallback(void *baton,
  StoppointCallbackContext *context,
@@ -124,25 +124,23 @@
 : m_callback(BreakpointOptions::NullCallback), m_callback_baton_sp(),
   m_baton_is_command_baton(false), m_callback_is_synchronous(false),
   m_enabled(true), m_one_shot(false), m_ignore_count(0), m_thread_spec_up(),
-  m_condition_text(), m_condition_text_hash(0), m_auto_continue(false),
-  m_set_flags(0) {
+  m_condition_text(), m_condition_text_hash(0), m_inject_condition(false),
+  m_auto_continue(false), m_set_flags(0) {
   if (all_flags_set)
 m_set_flags.Set(~((Flags::ValueType)0));
 }
 
 BreakpointOptions::BreakpointOptions(const char *condition, bool enabled,
- int32_t ignore, bool one_shot, 
- bool auto_continue)
+ int32_t ignore, bool one_shot,
+ bool auto_continue, bool inject_condition)
 : m_callback(nullptr), m_baton_is_command_baton(false),
   m_callback_is_synchronous(false), m_enabled(enabled),
-  m_one_shot(one_shot), m_ignore_count(ignore),
-  m_condition_text_hash(0), m_auto_continue(auto_continue)
-{
-m_set_flags.Set(eEnabled | eIgnoreCount | eOneShot 
-   | eAutoContinue);
-if (condition && *condition != '\0') {
-  SetCondition(condition);
-}
+  m_one_shot(one_shot), m_ignore_count(ignore), m_condition_text_hash(0),
+  m_inject_condition(inject_condition), m_auto_continue(auto_continue) {
+  m_set_flags.Set(eEnabled | eIgnoreCount 

[Lldb-commits] [PATCH] D66249: [JIT][Breakpoint] Add "BreakpointInjectedSite" and FCB Trampoline

2019-08-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added inline comments.



Comment at: lldb/include/lldb/Breakpoint/BreakpointSite.h:54-56
+   static bool classof(const BreakpointSite *bp_site) {
+ return bp_site->getKind() == eKindBreakpointSite;
+   }

labath wrote:
> This is weird. So, in OO terminology, `BreakpointInjectedSite` "is-a" 
> `BreakpointSite`, but if you ask `llvm::isa(injected_site)`, 
> it will return false?
No, it returns **true**.



Comment at: lldb/include/lldb/Expression/ExpressionVariable.h:210
+public:
+  typedef AdaptedIterable

labath wrote:
> What is the purpose of this `AdaptedIterable`, and why is it better than just 
> returning  say `ArrayRef`, but I don't see 
why using it would be better, + it might break things (e.g. ArrayRef doesn't 
implement some of the `std` containers method like `erase()` or `clear()`).



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/TestFastConditionalBreakpoints.py:181
+# FCB falls back to regular conditional breakpoint that get hit once.
+self.assertTrue(breakpoint.GetHitCount() == 1)

aprantl wrote:
> how does this test ensure that the breakpoint was actually injected and that 
> it didn't fall back to a regular breakpoint?
The breakpoint doesn't get injected if we fallback to a regular breakpoint.
And I check the state of the breakpoint on the command above: 
```
self.assertFalse(location.GetInjectCondition(), VALID_BREAKPOINT_LOCATION)
```



Comment at: lldb/source/Breakpoint/BreakpointInjectedSite.cpp:47
+   loc_sp->GetConditionText());
+  return false;
+}

aprantl wrote:
> Should this return an error instead of logging and returning false?
Error is handled on the upper function, at the process level.



Comment at: lldb/source/Breakpoint/BreakpointInjectedSite.cpp:443
+  int64_t operand = op.getRawOperand(0);
+  expr += "   src_addr = " + std::to_string(operand) +
+  ";\n"

aprantl wrote:
> This seems unnecessarily slow. Perhaps use an llvm::Twine?
As discussed, using `llvm::Twine` doesn't fit the implementation. Since this 
part of the code will probably change in the future, to support more DWARF 
Expression, I'll leave it as is for now, and try to come up with a more 
efficient approach in the coming patches.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66249



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


[Lldb-commits] [PATCH] D66249: [JIT][Breakpoint] Add "BreakpointInjectedSite" and FCB Trampoline

2019-08-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 216747.
mib marked 16 inline comments as done.
mib added a comment.

Add doxygen documentation.

Move `ArgumentMetadata` struct inside `BreakpointInjectedSite`.

Change string format for logging.

Make `$__lldb_create_args_struct` generation architecture-independent.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66249

Files:
  lldb/include/lldb/API/SBBreakpoint.h
  lldb/include/lldb/API/SBBreakpointLocation.h
  lldb/include/lldb/Breakpoint/Breakpoint.h
  lldb/include/lldb/Breakpoint/BreakpointInjectedSite.h
  lldb/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/include/lldb/Breakpoint/BreakpointOptions.h
  lldb/include/lldb/Breakpoint/BreakpointSite.h
  lldb/include/lldb/Core/Disassembler.h
  lldb/include/lldb/Core/Opcode.h
  lldb/include/lldb/Expression/Expression.h
  lldb/include/lldb/Expression/ExpressionVariable.h
  lldb/include/lldb/Expression/LLVMUserExpression.h
  lldb/include/lldb/Symbol/VariableList.h
  lldb/include/lldb/Target/ABI.h
  lldb/include/lldb/Target/ExecutionContextScope.h
  lldb/include/lldb/Target/Process.h
  lldb/include/lldb/Target/Target.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/include/lldb/lldb-forward.h
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/TestFastConditionalBreakpoints.py
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/main.c
  lldb/scripts/interface/SBBreakpoint.i
  lldb/scripts/interface/SBBreakpointLocation.i
  lldb/source/API/SBBreakpoint.cpp
  lldb/source/API/SBBreakpointLocation.cpp
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointInjectedSite.cpp
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/BreakpointOptions.cpp
  lldb/source/Breakpoint/BreakpointSite.cpp
  lldb/source/Breakpoint/CMakeLists.txt
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Commands/Options.td
  lldb/source/Expression/LLVMUserExpression.cpp
  lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
  lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/source/Symbol/ClangASTContext.cpp
  lldb/source/Target/Process.cpp

Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -1612,9 +1612,22 @@
   return error;
 }
 
+lldb::break_id_t
+Process::FallbackToRegularBreakpointSite(const BreakpointLocationSP &owner,
+ bool use_hardware, Log *log,
+ const char *error) {
+  LLDB_LOG(log, error);
+  LLDB_LOG(log, "Disabling JIT-ed condition and falling back to regular "
+"conditional breakpoint");
+  owner->SetInjectCondition(false);
+  return CreateBreakpointSite(owner, use_hardware);
+}
+
 lldb::break_id_t
 Process::CreateBreakpointSite(const BreakpointLocationSP &owner,
   bool use_hardware) {
+  Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER));
+
   addr_t load_addr = LLDB_INVALID_ADDRESS;
 
   bool show_error = true;
@@ -1675,11 +1688,72 @@
 
 if (bp_site_sp) {
   bp_site_sp->AddOwner(owner);
+
+  if (owner->GetInjectCondition()) {
+BreakpointSite *bp_site = bp_site_sp.get();
+
+BreakpointInjectedSite *bp_jitted_site_sp =
+llvm::dyn_cast(bp_site);
+bp_jitted_site_sp->BuildConditionExpression();
+  }
+
   owner->SetBreakpointSite(bp_site_sp);
   return bp_site_sp->GetID();
 } else {
-  bp_site_sp.reset(new BreakpointSite(&m_breakpoint_site_list, owner,
-  load_addr, use_hardware));
+  if (owner->GetInjectCondition() && GetABI()->ImplementsJIT()) {
+// Build user expression's IR from condition
+BreakpointInjectedSite *bp_injected_site = new BreakpointInjectedSite(
+&m_breakpoint_site_list, owner, load_addr);
+
+std::string error;
+// Setup a call before the copied instructions
+if (!bp_injected_site->BuildConditionExpression()) {
+  error = "FCB: Couldn't build the condition expression";
+  return FallbackToRegularBreakpointSite(owner, use_hardware, log,
+ error.c_str());
+ 

[Lldb-commits] [PATCH] D66249: [JIT][Breakpoint] Add "BreakpointInjectedSite" and FCB Trampoline

2019-08-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 216749.
mib added a comment.

Add error handling


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66249

Files:
  lldb/include/lldb/API/SBBreakpoint.h
  lldb/include/lldb/API/SBBreakpointLocation.h
  lldb/include/lldb/Breakpoint/Breakpoint.h
  lldb/include/lldb/Breakpoint/BreakpointInjectedSite.h
  lldb/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/include/lldb/Breakpoint/BreakpointOptions.h
  lldb/include/lldb/Breakpoint/BreakpointSite.h
  lldb/include/lldb/Core/Disassembler.h
  lldb/include/lldb/Core/Opcode.h
  lldb/include/lldb/Expression/Expression.h
  lldb/include/lldb/Expression/ExpressionVariable.h
  lldb/include/lldb/Expression/LLVMUserExpression.h
  lldb/include/lldb/Symbol/VariableList.h
  lldb/include/lldb/Target/ABI.h
  lldb/include/lldb/Target/ExecutionContextScope.h
  lldb/include/lldb/Target/Process.h
  lldb/include/lldb/Target/Target.h
  lldb/include/lldb/lldb-enumerations.h
  lldb/include/lldb/lldb-forward.h
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/TestFastConditionalBreakpoints.py
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/main.c
  lldb/scripts/interface/SBBreakpoint.i
  lldb/scripts/interface/SBBreakpointLocation.i
  lldb/source/API/SBBreakpoint.cpp
  lldb/source/API/SBBreakpointLocation.cpp
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointInjectedSite.cpp
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/BreakpointOptions.cpp
  lldb/source/Breakpoint/BreakpointSite.cpp
  lldb/source/Breakpoint/CMakeLists.txt
  lldb/source/Commands/CommandObjectBreakpoint.cpp
  lldb/source/Commands/Options.td
  lldb/source/Expression/LLVMUserExpression.cpp
  lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
  lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  lldb/source/Symbol/ClangASTContext.cpp
  lldb/source/Target/Process.cpp

Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -1612,9 +1612,22 @@
   return error;
 }
 
+lldb::break_id_t
+Process::FallbackToRegularBreakpointSite(const BreakpointLocationSP &owner,
+ bool use_hardware, Log *log,
+ const char *error) {
+  LLDB_LOG(log, error);
+  LLDB_LOG(log, "Disabling JIT-ed condition and falling back to regular "
+"conditional breakpoint");
+  owner->SetInjectCondition(false);
+  return CreateBreakpointSite(owner, use_hardware);
+}
+
 lldb::break_id_t
 Process::CreateBreakpointSite(const BreakpointLocationSP &owner,
   bool use_hardware) {
+  Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_JIT_LOADER));
+
   addr_t load_addr = LLDB_INVALID_ADDRESS;
 
   bool show_error = true;
@@ -1675,11 +1688,79 @@
 
 if (bp_site_sp) {
   bp_site_sp->AddOwner(owner);
+
+  if (owner->GetInjectCondition()) {
+BreakpointSite *bp_site = bp_site_sp.get();
+
+BreakpointInjectedSite *bp_injected_site_sp =
+llvm::dyn_cast(bp_site);
+
+std::string error;
+
+if (!bp_injected_site_sp->BuildConditionExpression()) {
+  error = "FCB: Couldn't build the condition expression";
+  return FallbackToRegularBreakpointSite(owner, use_hardware, log,
+ error.c_str());
+}
+  }
+
   owner->SetBreakpointSite(bp_site_sp);
   return bp_site_sp->GetID();
 } else {
-  bp_site_sp.reset(new BreakpointSite(&m_breakpoint_site_list, owner,
-  load_addr, use_hardware));
+  if (owner->GetInjectCondition() && GetABI()->ImplementsJIT()) {
+// Build user expression's IR from condition
+BreakpointInjectedSite *bp_injected_site = new BreakpointInjectedSite(
+&m_breakpoint_site_list, owner, load_addr);
+
+std::string error;
+// Setup a call before the copied instructions
+if (!bp_injected_site->BuildConditionExpression()) {
+  error = "FCB: Couldn't build the condition expression";
+  return FallbackToRegularBreakpointSite(owner, use_hardware, log,
+   

[Lldb-commits] [PATCH] D66628: [Symbol] Decouple clang from DeclVendor

2019-08-22 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: JDevlieghere, clayborg, jingham, teemperor.
Herald added subscribers: kadircet, arphaman, mgorny.
Herald added a project: LLDB.

This removes DeclVendor's dependency on clang (and ClangASTContext).
DeclVendor has no need to know about specific TypeSystems.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66628

Files:
  lldb/include/lldb/Symbol/ClangASTContext.h
  lldb/include/lldb/Symbol/DeclVendor.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
  lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
  lldb/source/Symbol/ClangASTContext.cpp
  lldb/source/Symbol/DeclVendor.cpp

Index: lldb/source/Symbol/DeclVendor.cpp
===
--- lldb/source/Symbol/DeclVendor.cpp
+++ lldb/source/Symbol/DeclVendor.cpp
@@ -7,8 +7,8 @@
 //===--===//
 
 #include "lldb/Symbol/DeclVendor.h"
-
-#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/CompilerDecl.h"
+#include "lldb/Symbol/TypeSystem.h"
 
 #include 
 
@@ -20,10 +20,11 @@
   // FIXME: This depends on clang, but should be able to support any
   // TypeSystem.
   std::vector ret;
-  std::vector decls;
+  std::vector decls;
   if (FindDecls(name, /*append*/ true, max_matches, decls))
-for (auto *decl : decls)
-  if (auto type = ClangASTContext::GetTypeForDecl(decl))
+for (auto decl : decls)
+  if (auto type =
+  decl.GetTypeSystem()->GetTypeForDecl(decl.GetOpaqueDecl()))
 ret.push_back(type);
   return ret;
 }
Index: lldb/source/Symbol/ClangASTContext.cpp
===
--- lldb/source/Symbol/ClangASTContext.cpp
+++ lldb/source/Symbol/ClangASTContext.cpp
@@ -1473,6 +1473,16 @@
   return ast->getASTContext()->hasSameType(type1_qual, type2_qual);
 }
 
+CompilerType ClangASTContext::GetTypeForDecl(void *opaque_decl) {
+  if (!opaque_decl)
+return CompilerType();
+
+  clang::Decl *decl = static_cast(opaque_decl);
+  if (auto *named_decl = llvm::dyn_cast(decl))
+return GetTypeForDecl(named_decl);
+  return CompilerType();
+}
+
 CompilerType ClangASTContext::GetTypeForDecl(clang::NamedDecl *decl) {
   if (clang::ObjCInterfaceDecl *interface_decl =
   llvm::dyn_cast(decl))
Index: lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
+++ lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
@@ -17,6 +17,7 @@
 #include "llvm/Support/Casting.h"
 
 #include "lldb/Breakpoint/BreakpointPrecondition.h"
+#include "lldb/Core/ClangForward.h"
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Core/ThreadSafeDenseMap.h"
 #include "lldb/Symbol/CompilerType.h"
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
@@ -9,6 +9,7 @@
 #ifndef liblldb_ClangDeclVendor_h_
 #define liblldb_ClangDeclVendor_h_
 
+#include "lldb/Core/ClangForward.h"
 #include "lldb/Symbol/DeclVendor.h"
 
 #include "clang/AST/ExternalASTMerger.h"
@@ -29,6 +30,13 @@
   /// An ImporterSource for this ClangDeclVendor.
   virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;
 
+  uint32_t FindDecls(ConstString name, bool append, uint32_t max_matches,
+ std::vector &decls) override;
+
+  virtual uint32_t FindDecls(ConstString name, bool append,
+ uint32_t max_matches,
+ std::vector &decls) = 0;
+
   static bool classof(const DeclVendor *vendor) {
 return vendor->GetKind() >= eClangDeclVendor &&
vendor->GetKind() < eLastClangDeclVendor;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
===
--- /dev/null
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
@@ -0,0 +1,30 @@
+//===-- ClangDeclVendor.cpp -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h"
+
+#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Utility/ConstString.h"
+
+using 

[Lldb-commits] [PATCH] D66250: [JIT][Unwinder] Add Trampoline ObjectFile and UnwindPlan support for FCB

2019-08-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib added inline comments.



Comment at: lldb/source/Target/ABI.cpp:10
 #include "lldb/Target/ABI.h"
+#include "Plugins/ObjectFile/Trampoline/ObjectFileTrampoline.h"
+#include "lldb/Core/Module.h"

labath wrote:
> If this is going to be something that is called directly from core lldb code, 
> then it not a "plugin" by any stretch of imagination. I think we should put 
> this file some place else.
Any suggestion on where to put it ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66250



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


[Lldb-commits] [PATCH] D66628: [Symbol] Decouple clang from DeclVendor

2019-08-22 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66628



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


[Lldb-commits] [PATCH] D66250: [JIT][Unwinder] Add Trampoline ObjectFile and UnwindPlan support for FCB

2019-08-22 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked an inline comment as done.
mib added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/fast_conditional_breakpoints/TestFastConditionalBreakpoints.py:159
+#self.assertEqual(var.GetValue(), "9")
+
 def inject_invalid_fast_conditional_breakpoint(self):

jasonmolenda wrote:
> Is this an SB API problem, or a more basic lldb problem?  If you did 'frame 
> variable local_count' in this frame, would you get 9 or a different value?
For some obscure reasons, when I try to resolve the variable value through the 
SB API in the test suite, `local_count = 0`.
However, when I test it using the Python `script` Interpreter with the same 
commands, `local_count = 9`.

I'll investigate this bug and uncomment those line as soon as it's fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66250



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


[Lldb-commits] [PATCH] D66248: [JIT][Command] Add "inject-condition" flag to conditional breakpoints

2019-08-22 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision as: JDevlieghere.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

A few small nits, but otherwise this LGTM.




Comment at: lldb/include/lldb/Breakpoint/BreakpointOptions.h:120
+  ///
   BreakpointOptions(const char *condition, bool enabled = true,
 int32_t ignore = 0, bool one_shot = false,

shafik wrote:
> mib wrote:
> > shafik wrote:
> > > You have a lot of `bool` parameters, these are hard to distinguish when 
> > > calling the function and easy to get mixed up during refactors and 
> > > subsequent merge conflicts. It would probably be better to combine these 
> > > `bool` options into a `struct` and then each option has an explicit name 
> > > that that will be assigned to which makes it explicit which options are 
> > > being chosen at the call site.
> > I only added the `bool inject_condition` parameter to the 
> > `BreakpointOptions` constructor. I also added documentation that was 
> > missing for the other parameters. I don't think having a struct for those 
> > options is a necessary since that's what the `BreakpointOptions` class is 
> > for. 
> Sadly we won't have designated initializers until C++20 [see 
> godbolt](https://godbolt.org/z/2xlti5) but instead of `bool` we can use enums 
> and that would clarify the code at the calling site. As discussed this can be 
> done as a patch after landing this change,
I agree with Shafik, but on the other hand that's the way the API is today. I 
don't really like the idea of a struct, because that just hides the booleans. 
Maybe we can use the OptionKind enum directly? Regardless, as you said, that's 
definitely outside the scope of this patch. 



Comment at: lldb/include/lldb/Breakpoint/BreakpointOptions.h:364
+  void SetInjectCondition(bool inject_condition) {
+m_inject_condition = inject_condition;
+m_set_flags.Set(eInjectCondition);

Any reason this should be in the header?



Comment at: lldb/source/Breakpoint/BreakpointOptions.cpp:113
+"ConditionText", "IgnoreCount",  "EnabledState",
+"OneShotState",  "AutoContinue", "JITCondition"};
 

Inject(ed)Condition?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66248



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


[Lldb-commits] [lldb] r369731 - [LLDB] Address post-commit code review feedback.

2019-08-22 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Aug 22 21:11:38 2019
New Revision: 369731

URL: http://llvm.org/viewvc/llvm-project?rev=369731&view=rev
Log:
[LLDB] Address post-commit code review feedback.

This patch addresses Adrian McCarthy's code review feedback in
https://reviews.llvm.org/D66447

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp?rev=369731&r1=369730&r2=369731&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/char8_t/main.cpp Thu Aug 
22 21:11:38 2019
@@ -1,5 +1,3 @@
-#include 
-
 char8_t a  = u8'a';
 const char8_t* ab = u8"你好";
 char8_t abc[9] = u8"你好";

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=369731&r1=369730&r2=369731&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Aug 22 21:11:38 2019
@@ -1390,9 +1390,9 @@ CompilerType ClangASTContext::GetBuiltin
   if (type_name) {
 if (streq(type_name, "char16_t"))
   return CompilerType(this, ast->Char16Ty.getAsOpaquePtr());
-else if (streq(type_name, "char32_t"))
+if (streq(type_name, "char32_t"))
   return CompilerType(this, ast->Char32Ty.getAsOpaquePtr());
-else if (streq(type_name, "char8_t"))
+if (streq(type_name, "char8_t"))
   return CompilerType(this, ast->Char8Ty.getAsOpaquePtr());
   }
   break;


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


[Lldb-commits] [PATCH] D66250: [JIT][Unwinder] Add Trampoline ObjectFile and UnwindPlan support for FCB

2019-08-22 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added inline comments.



Comment at: lldb/source/Target/ABI.cpp:10
 #include "lldb/Target/ABI.h"
+#include "Plugins/ObjectFile/Trampoline/ObjectFileTrampoline.h"
+#include "lldb/Core/Module.h"

mib wrote:
> labath wrote:
> > If this is going to be something that is called directly from core lldb 
> > code, then it not a "plugin" by any stretch of imagination. I think we 
> > should put this file some place else.
> Any suggestion on where to put it ?
Maybe in source/Symbol along with the ObjectFile.cpp base class.  I agree with 
Pavel that this isn't a plugin; it subclasses ObjectFile so it probably has to 
implement the plugin methods, but it's not something that will ever be created 
by iterating through the active ObjectFile plugins or anything like that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66250



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


[Lldb-commits] [lldb] r369735 - [Symbol] Decouple clang from DeclVendor

2019-08-22 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Thu Aug 22 23:11:32 2019
New Revision: 369735

URL: http://llvm.org/viewvc/llvm-project?rev=369735&view=rev
Log:
[Symbol] Decouple clang from DeclVendor

Summary:
This removes DeclVendor's dependency on clang (and ClangASTContext).
DeclVendor has no need to know about specific TypeSystems.

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

Added:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/DeclVendor.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/DeclVendor.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=369735&r1=369734&r2=369735&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Aug 22 23:11:32 2019
@@ -465,6 +465,8 @@ public:
   CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
size_t arg_idx) override;
 
+  CompilerType GetTypeForDecl(void *opaque_decl) override;
+
   // CompilerDeclContext override functions
 
   std::vector

Modified: lldb/trunk/include/lldb/Symbol/DeclVendor.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DeclVendor.h?rev=369735&r1=369734&r2=369735&view=diff
==
--- lldb/trunk/include/lldb/Symbol/DeclVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/DeclVendor.h Thu Aug 22 23:11:32 2019
@@ -9,7 +9,6 @@
 #ifndef liblldb_DeclVendor_h_
 #define liblldb_DeclVendor_h_
 
-#include "lldb/Core/ClangForward.h"
 #include "lldb/lldb-defines.h"
 
 #include 
@@ -51,7 +50,7 @@ public:
   /// max_matches.
   virtual uint32_t FindDecls(ConstString name, bool append,
  uint32_t max_matches,
- std::vector &decls) = 0;
+ std::vector &decls) = 0;
 
   /// Look up the types that the DeclVendor currently knows about matching a
   /// given name.

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=369735&r1=369734&r2=369735&view=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Thu Aug 22 23:11:32 2019
@@ -126,6 +126,8 @@ public:
   virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
size_t arg_idx);
 
+  virtual CompilerType GetTypeForDecl(void *opaque_decl) = 0;
+
   // CompilerDeclContext functions
 
   virtual std::vector

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt?rev=369735&r1=369734&r2=369735&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt Thu Aug 22 
23:11:32 2019
@@ -8,6 +8,7 @@ add_lldb_library(lldbPluginExpressionPar
   ASTStructExtractor.cpp
   ASTUtils.cpp
   ClangASTSource.cpp
+  ClangDeclVendor.cpp
   ClangExpressionDeclMap.cpp
   ClangExpressionParser.cpp
   ClangExpressionSourceCode.cpp

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=369735&r1=369734&r2=369735&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Thu Aug 
22 23:11:32 2019
@@ -9,6 +9,7 @@
 #include "ClangASTSource.h"
 
 #include "ASTDumper.h"
+#include "ClangDeclVendor.h"
 #include "ClangModulesDeclVendor.h"
 
 #include "lldb/Core/Module.h"
@@ -971,7 +972,8 @@ void ClangASTSource::FindExternalVisible
 uint32_t max_matches = 1;
 std::vector decls;
 
-if (!decl_vendor->FindDecls(name, append, max_matches, decls))
+auto *clang_decl_vendor = llvm::cast(decl_vendor);
+if (!clang_decl_vendor->FindDecls(name, append, max_matche

[Lldb-commits] [PATCH] D66628: [Symbol] Decouple clang from DeclVendor

2019-08-22 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369735: [Symbol] Decouple clang from DeclVendor (authored by 
xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66628?vs=216750&id=216770#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66628

Files:
  lldb/trunk/include/lldb/Symbol/ClangASTContext.h
  lldb/trunk/include/lldb/Symbol/DeclVendor.h
  lldb/trunk/include/lldb/Symbol/TypeSystem.h
  lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
  lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
  lldb/trunk/source/Symbol/ClangASTContext.cpp
  lldb/trunk/source/Symbol/DeclVendor.cpp

Index: lldb/trunk/include/lldb/Symbol/TypeSystem.h
===
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h
@@ -126,6 +126,8 @@
   virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
size_t arg_idx);
 
+  virtual CompilerType GetTypeForDecl(void *opaque_decl) = 0;
+
   // CompilerDeclContext functions
 
   virtual std::vector
Index: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
===
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h
@@ -465,6 +465,8 @@
   CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
size_t arg_idx) override;
 
+  CompilerType GetTypeForDecl(void *opaque_decl) override;
+
   // CompilerDeclContext override functions
 
   std::vector
Index: lldb/trunk/include/lldb/Symbol/DeclVendor.h
===
--- lldb/trunk/include/lldb/Symbol/DeclVendor.h
+++ lldb/trunk/include/lldb/Symbol/DeclVendor.h
@@ -9,7 +9,6 @@
 #ifndef liblldb_DeclVendor_h_
 #define liblldb_DeclVendor_h_
 
-#include "lldb/Core/ClangForward.h"
 #include "lldb/lldb-defines.h"
 
 #include 
@@ -51,7 +50,7 @@
   /// max_matches.
   virtual uint32_t FindDecls(ConstString name, bool append,
  uint32_t max_matches,
- std::vector &decls) = 0;
+ std::vector &decls) = 0;
 
   /// Look up the types that the DeclVendor currently knows about matching a
   /// given name.
Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
===
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
@@ -17,6 +17,7 @@
 #include "llvm/Support/Casting.h"
 
 #include "lldb/Breakpoint/BreakpointPrecondition.h"
+#include "lldb/Core/ClangForward.h"
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Core/ThreadSafeDenseMap.h"
 #include "lldb/Symbol/CompilerType.h"
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
@@ -8,6 +8,7 @@
   ASTStructExtractor.cpp
   ASTUtils.cpp
   ClangASTSource.cpp
+  ClangDeclVendor.cpp
   ClangExpressionDeclMap.cpp
   ClangExpressionParser.cpp
   ClangExpressionSourceCode.cpp
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
@@ -0,0 +1,30 @@
+//===-- ClangDeclVendor.cpp -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h"
+
+#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Utility/ConstString.h"
+
+using namespace lldb_private;
+
+uint32_t ClangDeclVendor::FindDecls(ConstString name, bool append,
+uint32_t max_matches,
+std::vector &decls) {
+  if (!append)
+decls.clear();
+
+  std::vector named_decls;
+  uint32_t ret = FindDecls(name, /*append*/ false, max_ma