[Lldb-commits] [lldb] r366415 - [lldb][NFC] Tablegenify type commands

2019-07-18 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Jul 18 01:22:19 2019
New Revision: 366415

URL: http://llvm.org/viewvc/llvm-project?rev=366415&view=rev
Log:
[lldb][NFC] Tablegenify type commands

Modified:
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Commands/Options.td

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=366415&r1=366414&r2=366415&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Thu Jul 18 01:22:19 2019
@@ -96,23 +96,8 @@ static bool WarnOnPotentialUnquotedUnsig
 }
 
 static constexpr OptionDefinition g_type_summary_add_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_ALL,false, "category",'w', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName,   "Add 
this to the given category instead of the default one." },
-  { LLDB_OPT_SET_ALL,false, "cascade", 'C', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean,"If 
true, cascade through typedef chains." },
-  { LLDB_OPT_SET_ALL,false, "no-value",'v', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,   "Don't 
show the value, just show the summary, for this type." },
-  { LLDB_OPT_SET_ALL,false, "skip-pointers",   'p', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,   "Don't 
use this format for pointers-to-type objects." },
-  { LLDB_OPT_SET_ALL,false, "skip-references", 'r', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,   "Don't 
use this format for references-to-type objects." },
-  { LLDB_OPT_SET_ALL,false, "regex",   'x', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,   "Type 
names are actually regular expressions." },
-  { LLDB_OPT_SET_1,  true,  "inline-children", 'c', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,   "If 
true, inline all child values into summary string." },
-  { LLDB_OPT_SET_1,  false, "omit-names",  'O', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,   "If 
true, omit value names in the summary display." },
-  { LLDB_OPT_SET_2,  true,  "summary-string",  's', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeSummaryString,  
"Summary string used to display text and object contents." },
-  { LLDB_OPT_SET_3,  false, "python-script",   'o', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePythonScript,   "Give 
a one-liner Python script as part of the command." },
-  { LLDB_OPT_SET_3,  false, "python-function", 'F', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypePythonFunction, "Give 
the name of a Python function to use for this type." },
-  { LLDB_OPT_SET_3,  false, "input-python",'P', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,   "Input 
Python code to use for this type manually." },
-  { LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "expand",  'e', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,   
"Expand aggregate data types to show children on separate lines." },
-  { LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "hide-empty",  'h', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,   "Do 
not expand aggregate data types with no children." },
-  { LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "name",'n', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName,   "A 
name for this summary string." }
-// clang-format on
+#define LLDB_OPTIONS_type_summary_add
+#include "CommandOptions.inc"
 };
 
 class CommandObjectTypeSummaryAdd : public CommandObjectParsed,
@@ -298,15 +283,8 @@ static const char *g_synth_addreader_ins
 "class synthProvider:\n";
 
 static constexpr OptionDefinition g_type_synth_add_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_ALL, false, "cascade", 'C', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "If true, 
cascade through typedef chains." },
-  { LLDB_OPT_SET_ALL, false, "skip-pointers",   'p', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,"Don't 
use this format for pointers-to-type objects." },
-  { LLDB_OPT_SET_ALL, false, "skip-references", 'r', 
OptionParser::eNoArgument,   nullptr, {}, 0, eArgTypeNone,"Don't 
use this format for references-to-type objects." },
-  { LLDB_OPT_SET_ALL, false, "category",'w', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeName,"Add this 
to the given category instead of the default one." },
-  { LLDB_OPT_SET_2,   false, "python-class",'

[Lldb-commits] [lldb] r366414 - [lldb] Don't double emit option groups

2019-07-18 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Jul 18 01:22:11 2019
New Revision: 366414

URL: http://llvm.org/viewvc/llvm-project?rev=366414&view=rev
Log:
[lldb] Don't double emit option groups

We currently emit the option groups twice if Groups<[1,2,3]> is
used in the tablegen. This leads to compilation errors. This
patch just removes the line that accidentially emits the option
group a second time.

Modified:
lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp

Modified: lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp?rev=366414&r1=366413&r2=366414&view=diff
==
--- lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp (original)
+++ lldb/trunk/utils/TableGen/LLDBOptionDefEmitter.cpp Thu Jul 18 01:22:11 2019
@@ -44,7 +44,6 @@ static void emitOption(Record *Option, r
 auto Groups = Option->getValueAsListOfInts("Groups");
 for (int Group : Groups)
   GroupsArg.push_back("LLDB_OPT_SET_" + std::to_string(Group));
-OS << llvm::join(GroupsArg.begin(), GroupsArg.end(), " | ");
   } else if (Option->getValue("GroupStart")) {
 // The user specified a range of groups (with potentially only one 
element).
 int GroupStart = Option->getValueAsInt("GroupStart");


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


[Lldb-commits] [PATCH] D64013: Correctly use GetLoadedModuleList to take advantage of libraries-svr4

2019-07-18 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.

lgtm




Comment at: 
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp:185-207
+  if (
+  // When the previous and current states are consistent this is the first
+  // time we have been asked to update.  Just take a snapshot of the
+  // currently loaded modules.
+  (m_previous.state == eConsistent && m_current.state == eConsistent) ||
+  // If we are about to add or remove a shared object clear out the current
+  // state and take a snapshot of the currently loaded images.

aadsm wrote:
> labath wrote:
> > This logic is pretty hard to follow. I'd suggest trying to structure as 
> > some switch statements. Something like:
> > ```
> > switch(current_state) {
> > case Consistent:
> >   switch (previous_state) {
> > case Consistent: return TakeSnapshot;
> > case Add: return Add;
> > case Remove: return Remove;
> >   }
> > case Add: case Remove:
> >   @#%@#%!@%
> > }
> > ```
> Interesting, I actually think it's easier to follow than breaking it down to 
> nested switches. I wanted to code to reflect the mental model that decides 
> which action to take.
> 
> That's why I structured it in the way of:
> ```
> if (state A) do action 1
> if (state B) do action 2
> ...
> ```
> The switch statement basically creates a logic decision tree that I 
> personally find harder to follow. If I want to know what states makes us take 
> a snapshot I need to search the entire code for return eTakeSnapshot and then 
> go up the nested switch for each one of them and collect all the cases. In 
> the other one I can focus my attention just to the condition for "do action 
> 1".
> 
> Here's how it looks like:
> ```
> switch (m_current.state) {
> case eConsistent:
>   switch (m_previous.state) {
> case eConsistent: return eTakeSnapshot;
> case eAdd: return eAddModules;
> case eDelete: return eRemoveModules;
>   }
>   break;
> case eAdd:
> case eDelete: 
>   switch (m_previous.state) {
> case eConsistent: return eTakeSnapshot;
> case eAdd: if (m_current.state == eDelete)
>   return eTakeSnapshot;
>   }
>   }
>   
>   return eNoAction;
> ```
> 
> I also wanted to make the hacks a bit more obvious so I came up with this 
> which I think strikes a good balance in making the decision clear and 
> isolates the hack we have for android loaders:
> 
> ```
> if (m_current.state == eConsistent) {
> switch (m_previous.state) {
>   // When the previous and current states are consistent this is the first
>   // time we have been asked to update.  Just take a snapshot of the
>   // currently loaded modules.
>   case eConsistent: return eTakeSnapshot;
>   // If we are about to add or remove a shared object clear out the 
> current
>   // state and take a snapshot of the currently loaded images.
>   case eAdd: return eAddModules;
>   case eDelete: return eRemoveModules;
> }
> return eNoAction;
>   }
>   
>   if (m_current.state == eAdd || m_current.state == eDelete) {
> // Some versions of the android dynamic linker might send two
> // notifications with state == eAdd back to back. Ignore them until we
> // get an eConsistent notification.
> if (!(m_previous.state == eConsistent ||
>   (m_previous.state == eAdd && m_current.state == eDelete)))
>   return eNoAction;
> 
> return eTakeSnapshot;
>   }
>   
>   return eNoAction;
> ```
> 
> Thoughts?
This would be fine too. I was mainly concerned about the huge if condition with 
embedded comments. I was staring at it for 10 minutes, and I still wasn't sure 
I understood the conditions it would fire in...



Comment at: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:2383
+  LLDB_LOG_ERROR(log, std::move(error),
+ "ProcessGDBRemote::{1} failed to load modules: {0}",
+ __FUNCTION__);

btw, LLDB_LOG macros are smart enough to embed file and function information 
into the log message themselves (if you use "log enable -F"), so you don't need 
to repeat it here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64013



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


[Lldb-commits] [PATCH] D64881: [Cmake] Use the modern way to find Python when possible

2019-07-18 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I haven't been keeping up with all the python cmake patches, but I'm not sure 
this will help the situation, as it will add another dimension to the 
configuration matrix. If we're still going to support cmake<3.12, then we're 
going to need to make the other branch of this work anyway... Maybe once cmake 
3.12 gets a bit older (widely available), we could just switch to the other 
method and say that cmake>=3.12 is required if you're going to build lldb...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64881



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


[Lldb-commits] [lldb] r366425 - [lldb] Tablegenify thread commands and fix completion bug for thread step-*

2019-07-18 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Jul 18 04:12:00 2019
New Revision: 366425

URL: http://llvm.org/viewvc/llvm-project?rev=366425&view=rev
Log:
[lldb] Tablegenify thread commands and fix completion bug for thread step-*

Beside turning the options into the new tablegen format, this patch
also fixes that a few commands had source file completions for the
"count" and "end-linenumber" arguments (which both accepted only
integers). Reason for that are that somehow we added a '1' instead
of our usual '0' value to the initial value for completion.

Modified:
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/Options.td

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=366425&r1=366424&r2=366425&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Thu Jul 18 04:12:00 2019
@@ -239,11 +239,8 @@ protected:
 // CommandObjectThreadBacktrace
 
 static constexpr OptionDefinition g_thread_backtrace_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "count",'c', OptionParser::eRequiredArgument, 
nullptr, {}, 0, eArgTypeCount,  "How many frames to display (-1 for all)" },
-  { LLDB_OPT_SET_1, false, "start",'s', OptionParser::eRequiredArgument, 
nullptr, {}, 0, eArgTypeFrameIndex, "Frame in which to start the backtrace" },
-  { LLDB_OPT_SET_1, false, "extended", 'e', OptionParser::eRequiredArgument, 
nullptr, {}, 0, eArgTypeBoolean,"Show the extended backtrace, if available" 
}
-// clang-format on
+#define LLDB_OPTIONS_thread_backtrace
+#include "CommandOptions.inc"
 };
 
 class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads {
@@ -407,16 +404,8 @@ static constexpr OptionEnumValues TriRun
 }
 
 static constexpr OptionDefinition g_thread_step_scope_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "step-in-avoids-no-debug",   'a', 
OptionParser::eRequiredArgument, nullptr, {},0, 
eArgTypeBoolean,   "A boolean value that sets whether stepping into 
functions will step over functions with no debug information." },
-  { LLDB_OPT_SET_1, false, "step-out-avoids-no-debug",  'A', 
OptionParser::eRequiredArgument, nullptr, {},0, 
eArgTypeBoolean,   "A boolean value, if true stepping out of functions 
will continue to step out till it hits a function with debug information." },
-  { LLDB_OPT_SET_1, false, "count", 'c', 
OptionParser::eRequiredArgument, nullptr, {},1, eArgTypeCount,  
   "How many times to perform the stepping operation - currently only 
supported for step-inst and next-inst." },
-  { LLDB_OPT_SET_1, false, "end-linenumber",'e', 
OptionParser::eRequiredArgument, nullptr, {},1, 
eArgTypeLineNum,   "The line at which to stop stepping - defaults to 
the next line and only supported for step-in and step-over.  You can also pass 
the string 'block' to step to the end of the current block.  This is 
particularly useful in conjunction with --step-target to step through a complex 
calling sequence." },
-  { LLDB_OPT_SET_1, false, "run-mode",  'm', 
OptionParser::eRequiredArgument, nullptr, TriRunningModes(), 0, 
eArgTypeRunMode,   "Determine how to run other threads while stepping 
the current thread." },
-  { LLDB_OPT_SET_1, false, "step-over-regexp",  'r', 
OptionParser::eRequiredArgument, nullptr, {},0, 
eArgTypeRegularExpression, "A regular expression that defines function names to 
not to stop at when stepping in." },
-  { LLDB_OPT_SET_1, false, "step-in-target",'t', 
OptionParser::eRequiredArgument, nullptr, {},0, 
eArgTypeFunctionName,  "The name of the directly called function step in 
should stop at when stepping into." },
-  { LLDB_OPT_SET_2, false, "python-class",  'C', 
OptionParser::eRequiredArgument, nullptr, {},0, 
eArgTypePythonClass,   "The name of the class that will manage this step - 
only supported for Scripted Step." }
-// clang-format on
+#define LLDB_OPTIONS_thread_step_scope
+#include "CommandOptions.inc"
 };
 
 class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed {
@@ -995,12 +984,8 @@ static constexpr OptionEnumValues DuoRun
 }
 
 static constexpr OptionDefinition g_thread_until_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "frame",   'f', OptionParser::eRequiredArgument, 
nullptr, {},0, eArgTypeFrameIndex,  "Frame index for 
until operation - defaults to 0" },
-  { LLDB_OPT_SET_1, false, "thread",  't', OptionParser::eRequiredArgument, 
nullptr, {},0, eArgTypeThreadIndex, "Thread index for 
the thread for u

[Lldb-commits] [lldb] r366426 - [lldb][NFC] Format 'type' commands in Options.td

2019-07-18 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Jul 18 04:43:45 2019
New Revision: 366426

URL: http://llvm.org/viewvc/llvm-project?rev=366426&view=rev
Log:
[lldb][NFC] Format 'type' commands in Options.td

Modified:
lldb/trunk/source/Commands/Options.td

Modified: lldb/trunk/source/Commands/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/Options.td?rev=366426&r1=366425&r2=366426&view=diff
==
--- lldb/trunk/source/Commands/Options.td (original)
+++ lldb/trunk/source/Commands/Options.td Thu Jul 18 04:43:45 2019
@@ -139,82 +139,134 @@ let Command = "thread plan list" in {
 }
 
 let Command = "type summary add" in {
-  def type_summary_add_category : Option<"category", "w">, Arg<"Name">, 
Desc<"Add this to the given category instead of the default one.">;
-  def type_summary_add_cascade : Option<"cascade", "C">, Arg<"Boolean">, 
Desc<"If true, cascade through typedef chains.">;
-  def type_summary_add_no_value : Option<"no-value", "v">, Desc<"Don't show 
the value, just show the summary, for this type.">;
-  def type_summary_add_skip_pointers : Option<"skip-pointers", "p">, 
Desc<"Don't use this format for pointers-to-type objects.">;
-  def type_summary_add_skip_references : Option<"skip-references", "r">, 
Desc<"Don't use this format for references-to-type objects.">;
-  def type_summary_add_regex : Option<"regex", "x">, Desc<"Type names are 
actually regular expressions.">;
-  def type_summary_add_inline_children : Option<"inline-children", "c">, 
Group<1>, Required, Desc<"If true, inline all child values into summary 
string.">;
-  def type_summary_add_omit_names : Option<"omit-names", "O">, Group<1>, 
Desc<"If true, omit value names in the summary display.">;
-  def type_summary_add_summary_string : Option<"summary-string", "s">, 
Group<2>, Arg<"SummaryString">, Required, Desc<"Summary string used to display 
text and object contents.">;
-  def type_summary_add_python_script : Option<"python-script", "o">, Group<3>, 
Arg<"PythonScript">, Desc<"Give a one-liner Python script as part of the 
command.">;
-  def type_summary_add_python_function : Option<"python-function", "F">, 
Group<3>, Arg<"PythonFunction">, Desc<"Give the name of a Python function to 
use for this type.">;
-  def type_summary_add_input_python : Option<"input-python", "P">, Group<3>, 
Desc<"Input Python code to use for this type manually.">;
-  def type_summary_add_expand : Option<"expand", "e">, Groups<[2,3]>, 
Desc<"Expand aggregate data types to show children on separate lines.">;
-  def type_summary_add_hide_empty : Option<"hide-empty", "h">, Groups<[2,3]>, 
Desc<"Do not expand aggregate data types with no children.">;
-  def type_summary_add_name : Option<"name", "n">, Groups<[2,3]>, Arg<"Name">, 
Desc<"A name for this summary string.">;
+  def type_summary_add_category : Option<"category", "w">, Arg<"Name">,
+Desc<"Add this to the given category instead of the default one.">;
+  def type_summary_add_cascade : Option<"cascade", "C">, Arg<"Boolean">,
+Desc<"If true, cascade through typedef chains.">;
+  def type_summary_add_no_value : Option<"no-value", "v">,
+Desc<"Don't show the value, just show the summary, for this type.">;
+  def type_summary_add_skip_pointers : Option<"skip-pointers", "p">,
+Desc<"Don't use this format for pointers-to-type objects.">;
+  def type_summary_add_skip_references : Option<"skip-references", "r">,
+Desc<"Don't use this format for references-to-type objects.">;
+  def type_summary_add_regex : Option<"regex", "x">,
+Desc<"Type names are actually regular expressions.">;
+  def type_summary_add_inline_children : Option<"inline-children", "c">,
+Group<1>, Required,
+Desc<"If true, inline all child values into summary string.">;
+  def type_summary_add_omit_names : Option<"omit-names", "O">, Group<1>,
+Desc<"If true, omit value names in the summary display.">;
+  def type_summary_add_summary_string : Option<"summary-string", "s">, 
Group<2>,
+Arg<"SummaryString">, Required,
+Desc<"Summary string used to display text and object contents.">;
+  def type_summary_add_python_script : Option<"python-script", "o">, Group<3>,
+Arg<"PythonScript">,
+Desc<"Give a one-liner Python script as part of the command.">;
+  def type_summary_add_python_function : Option<"python-function", "F">,
+Group<3>, Arg<"PythonFunction">,
+Desc<"Give the name of a Python function to use for this type.">;
+  def type_summary_add_input_python : Option<"input-python", "P">, Group<3>,
+Desc<"Input Python code to use for this type manually.">;
+  def type_summary_add_expand : Option<"expand", "e">, Groups<[2,3]>,
+Desc<"Expand aggregate data types to show children on separate lines.">;
+  def type_summary_add_hide_empty : Option<"hide-empty", "h">, Groups<[2,3]>,
+Desc<"Do not expand aggregate data types with no children.">;
+  def type_summary_add_name : Option<"name", "n">, Group

[Lldb-commits] [PATCH] D64917: Add offsetof support to expression evaluator.

2019-07-18 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: shafik, davide.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

We currently don't support offsetof in the expression evaluator as it is 
implemented as a macro
(which then calls __builtin_offsetof) in stddef.h. The best solution would be 
to include that
header (or even better, import Clang's builtin module), but header-parsing and
(cross-platform) importing modules is not ready yet.

Until we get this working with modules I would say we add the macro to our 
existing macro list
as we already do with other macros from stddef.h/stdint.h. We should be able to 
drop all of them
once we can import the relevant modules by default.

rdar://26040641


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D64917

Files:
  lldb/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile
  lldb/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py
  lldb/packages/Python/lldbsuite/test/lang/c/offsetof/main.c
  lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py
  lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp


Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
@@ -30,6 +30,9 @@
 using namespace lldb_private;
 
 const char *ClangExpressionSourceCode::g_expression_prefix = R"(
+#ifndef offsetof
+#define offsetof(t, d) __builtin_offsetof(t, d)
+#endif
 #ifndef NULL
 #define NULL (__null)
 #endif
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
@@ -0,0 +1,25 @@
+#include 
+
+class Base {
+  int32_t a;
+};
+class Class1 : Base {
+public:
+  int32_t b;
+};
+
+class EmptyBase {
+};
+class Class2 : EmptyBase {
+public:
+  int32_t b;
+};
+
+int main(int argc, char **argv) {
+  Class1 c1;
+  Class2 c2;
+  //% self.expect("expr offsetof(Base, a)", substrs=["= 0"])
+  //% self.expect("expr offsetof(Class1, b)", substrs=["= 4"])
+  //% self.expect("expr offsetof(Class2, b)", substrs=["= 0"])
+  return c1.b + c2.b;
+}
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py
@@ -0,0 +1,3 @@
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules
Index: lldb/packages/Python/lldbsuite/test/lang/c/offsetof/main.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/c/offsetof/main.c
@@ -0,0 +1,12 @@
+#include 
+
+struct Foo {
+  int8_t a;
+  int16_t b;
+};
+
+int main (int argc, char const *argv[]) {
+struct Foo f;
+return f.a; //% self.expect("expr offsetof(Foo, a)", substrs = ['= 0'])
+//% self.expect("expr offsetof(Foo, b)", substrs = ['= 2'])
+}
Index: lldb/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py
@@ -0,0 +1,3 @@
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())
Index: lldb/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules


Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
@@ -30,6 +30,9 @@
 using namespace lldb_private;
 
 const char *ClangExpressionSourceCode::g_expression_prefix = R"(
+#ifndef offsetof
+#define offsetof(t, d) __builtin_offsetof(t, d)
+#endif
 #ifndef NULL
 #define NULL (__null)
 #endif
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
===

[Lldb-commits] [lldb] r366433 - [CMake] Always build debugserver on Darwin and allow tests to use the system's one

2019-07-18 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Thu Jul 18 06:30:37 2019
New Revision: 366433

URL: http://llvm.org/viewvc/llvm-project?rev=366433&view=rev
Log:
[CMake] Always build debugserver on Darwin and allow tests to use the system's 
one

Summary:
We can always build debugserver, but we can't always sign it to be useable for 
testing. `LLDB_USE_SYSTEM_DEBUGSERVER` should only tell whether or not the 
system debugserver should be used for testing.
The old behavior complicated the logic around debugserver a lot. The new logic 
sorts out most of it.

Please note that this patch is in early stage and needs some more testing. It 
should not affect platfroms other than Darwin. It builds on Davide's approach 
to validate the code-signing identity at configuration time.

What do you think?

Reviewers: xiaobai, JDevlieghere, davide, compnerd, friss, labath, mgorny, 
jasonmolenda

Reviewed By: JDevlieghere

Subscribers: lldb-commits, #lldb

Tags: #lldb

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

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/cmake/modules/LLDBConfig.cmake
lldb/trunk/test/CMakeLists.txt
lldb/trunk/tools/debugserver/source/CMakeLists.txt
lldb/trunk/unittests/CMakeLists.txt
lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=366433&r1=366432&r2=366433&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Thu Jul 18 06:30:37 2019
@@ -107,10 +107,6 @@ if(LLDB_INCLUDE_TESTS)
 list(APPEND LLDB_TEST_DEPS lldb-server)
   endif()
 
-  if(TARGET debugserver)
-list(APPEND LLDB_TEST_DEPS debugserver)
-  endif()
-
   if(TARGET lldb-mi)
 list(APPEND LLDB_TEST_DEPS lldb-mi)
   endif()

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=366433&r1=366432&r2=366433&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Thu Jul 18 06:30:37 2019
@@ -276,3 +276,27 @@ function(lldb_setup_rpaths name)
 INSTALL_RPATH "${LIST_INSTALL_RPATH}"
   )
 endfunction()
+
+function(lldb_find_system_debugserver path)
+  execute_process(COMMAND xcode-select -p
+  RESULT_VARIABLE exit_code
+  OUTPUT_VARIABLE xcode_dev_dir
+  ERROR_VARIABLE error_msg
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+  if(exit_code)
+message(WARNING "`xcode-select -p` failed:\n${error_msg}")
+  else()
+set(subpath "LLDB.framework/Resources/debugserver")
+set(path_shared "${xcode_dev_dir}/../SharedFrameworks/${subpath}")
+set(path_private "${xcode_dev_dir}/Library/PrivateFrameworks/${subpath}")
+
+if(EXISTS ${path_shared})
+  set(${path} ${path_shared} PARENT_SCOPE)
+elseif(EXISTS ${path_private})
+  set(${path} ${path_private} PARENT_SCOPE)
+else()
+  message(WARNING "System debugserver requested, but not found. "
+  "Candidates don't exist: 
${path_shared}\n${path_private}")
+endif()
+  endif()
+endfunction()

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=366433&r1=366432&r2=366433&view=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Thu Jul 18 06:30:37 2019
@@ -50,6 +50,7 @@ option(LLDB_USE_SYSTEM_SIX "Use six.py s
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)
 option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
 option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in 
binaries" OFF)
+option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing 
(Darwin only)." OFF)
 
 if(LLDB_BUILD_FRAMEWORK)
   if(NOT APPLE)

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=366433&r1=366432&r2=366433&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Thu Jul 18 06:30:37 2019
@@ -74,15 +74,6 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows"
   endif()
 endif()
 
-if(LLDB_CODESIGN_IDENTITY_USED)
-  list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity 
"${LLDB_CODESIGN_IDENTITY_USED}")
-endif()
-
-if(LLDB_BUILD_FRAMEWORK)
-  get_target_property(framework_target_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
-  list(APPEND LLDB_TEST_COMMON_ARGS --framework 
${framework_target_dir}/LLDB.framework)
-endif()
-
 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
   

[Lldb-commits] [PATCH] D64806: [CMake] Always build debugserver on Darwin and allow tests to use the system's one

2019-07-18 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366433: [CMake] Always build debugserver on Darwin and allow 
tests to use the system's… (authored by stefan.graenitz, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64806?vs=210448&id=210546#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64806

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/cmake/modules/AddLLDB.cmake
  lldb/trunk/cmake/modules/LLDBConfig.cmake
  lldb/trunk/test/CMakeLists.txt
  lldb/trunk/tools/debugserver/source/CMakeLists.txt
  lldb/trunk/unittests/CMakeLists.txt
  lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt

Index: lldb/trunk/cmake/modules/AddLLDB.cmake
===
--- lldb/trunk/cmake/modules/AddLLDB.cmake
+++ lldb/trunk/cmake/modules/AddLLDB.cmake
@@ -276,3 +276,27 @@
 INSTALL_RPATH "${LIST_INSTALL_RPATH}"
   )
 endfunction()
+
+function(lldb_find_system_debugserver path)
+  execute_process(COMMAND xcode-select -p
+  RESULT_VARIABLE exit_code
+  OUTPUT_VARIABLE xcode_dev_dir
+  ERROR_VARIABLE error_msg
+  OUTPUT_STRIP_TRAILING_WHITESPACE)
+  if(exit_code)
+message(WARNING "`xcode-select -p` failed:\n${error_msg}")
+  else()
+set(subpath "LLDB.framework/Resources/debugserver")
+set(path_shared "${xcode_dev_dir}/../SharedFrameworks/${subpath}")
+set(path_private "${xcode_dev_dir}/Library/PrivateFrameworks/${subpath}")
+
+if(EXISTS ${path_shared})
+  set(${path} ${path_shared} PARENT_SCOPE)
+elseif(EXISTS ${path_private})
+  set(${path} ${path_private} PARENT_SCOPE)
+else()
+  message(WARNING "System debugserver requested, but not found. "
+  "Candidates don't exist: ${path_shared}\n${path_private}")
+endif()
+  endif()
+endfunction()
Index: lldb/trunk/cmake/modules/LLDBConfig.cmake
===
--- lldb/trunk/cmake/modules/LLDBConfig.cmake
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake
@@ -50,6 +50,7 @@
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON)
 option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
 option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in binaries" OFF)
+option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing (Darwin only)." OFF)
 
 if(LLDB_BUILD_FRAMEWORK)
   if(NOT APPLE)
Index: lldb/trunk/test/CMakeLists.txt
===
--- lldb/trunk/test/CMakeLists.txt
+++ lldb/trunk/test/CMakeLists.txt
@@ -74,15 +74,6 @@
   endif()
 endif()
 
-if(LLDB_CODESIGN_IDENTITY_USED)
-  list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity "${LLDB_CODESIGN_IDENTITY_USED}")
-endif()
-
-if(LLDB_BUILD_FRAMEWORK)
-  get_target_property(framework_target_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
-  list(APPEND LLDB_TEST_COMMON_ARGS --framework ${framework_target_dir}/LLDB.framework)
-endif()
-
 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
   list(APPEND LLDB_TEST_COMMON_ARGS
 --env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY})
@@ -94,12 +85,28 @@
   endif()
 endif()
 
-if(CMAKE_HOST_APPLE AND DEBUGSERVER_PATH)
-  list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH})
-endif()
+if(CMAKE_HOST_APPLE)
+  if(LLDB_BUILD_FRAMEWORK)
+get_target_property(framework_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
+list(APPEND LLDB_TEST_COMMON_ARGS --framework ${framework_build_dir}/LLDB.framework)
+  endif()
+
+  # Use the same identity for testing
+  get_property(code_sign_identity_used GLOBAL PROPERTY LLDB_DEBUGSERVER_CODESIGN_IDENTITY)
+  if(code_sign_identity_used)
+list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity "${code_sign_identity_used}")
+  endif()
 
-if(SKIP_TEST_DEBUGSERVER)
-  list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
+  if(LLDB_USE_SYSTEM_DEBUGSERVER)
+lldb_find_system_debugserver(system_debugserver_path)
+message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}")
+list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
+  else()
+set(debugserver_path ${LLVM_RUNTIME_OUTPUT_INTDIR}/debugserver)
+message(STATUS "LLDB Tests use just-built debugserver: ${debugserver_path}")
+list(APPEND LLDB_TEST_COMMON_ARGS --server ${debugserver_path})
+add_dependencies(lldb-test-deps debugserver)
+  endif()
 endif()
 
 set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS})
Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -107,10 +107,6 @@
 list(APPEND LLDB_TEST_DEPS lldb-server)
   endif()
 
-  if(TARGET debugse

[Lldb-commits] [lldb] r366440 - [lldb][NFC] Tablegenify alias/regex/history/source/script

2019-07-18 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Jul 18 07:10:49 2019
New Revision: 366440

URL: http://llvm.org/viewvc/llvm-project?rev=366440&view=rev
Log:
[lldb][NFC] Tablegenify alias/regex/history/source/script

(Converting these commands together as they are all simple commands
that share the same file).

Modified:
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/Options.td

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=366440&r1=366439&r2=366440&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Thu Jul 18 07:10:49 
2019
@@ -32,12 +32,8 @@ using namespace lldb_private;
 // CommandObjectCommandsSource
 
 static constexpr OptionDefinition g_history_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "count",   'c', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, "How 
many history commands to print." },
-  { LLDB_OPT_SET_1, false, "start-index", 's', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, 
"Index at which to start printing history commands (or end to mean tail mode)." 
},
-  { LLDB_OPT_SET_1, false, "end-index",   'e', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeUnsignedInteger, 
"Index at which to stop printing history commands." },
-  { LLDB_OPT_SET_2, false, "clear",   'C', OptionParser::eNoArgument,  
 nullptr, {}, 0, eArgTypeBoolean, "Clears the current command history." 
},
-// clang-format on
+#define LLDB_OPTIONS_history
+#include "CommandOptions.inc"
 };
 
 class CommandObjectCommandsHistory : public CommandObjectParsed {
@@ -189,11 +185,8 @@ protected:
 // CommandObjectCommandsSource
 
 static constexpr OptionDefinition g_source_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_ALL, false, "stop-on-error",'e', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "If true, 
stop executing commands on error." },
-  { LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "If true, 
stop executing commands on continue." },
-  { LLDB_OPT_SET_ALL, false, "silent-run",   's', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean, "If true 
don't echo commands while executing." },
-// clang-format on
+#define LLDB_OPTIONS_source
+#include "CommandOptions.inc"
 };
 
 class CommandObjectCommandsSource : public CommandObjectParsed {
@@ -344,10 +337,8 @@ protected:
 // CommandObjectCommandsAlias
 
 static constexpr OptionDefinition g_alias_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_ALL, false, "help",  'h', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeHelpText, "Help text 
for this command" },
-  { LLDB_OPT_SET_ALL, false, "long-help", 'H', 
OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeHelpText, "Long help 
text for this command" },
-// clang-format on
+#define LLDB_OPTIONS_alias
+#include "CommandOptions.inc"
 };
 
 static const char *g_python_command_instructions =
@@ -912,10 +903,8 @@ protected:
 // CommandObjectCommandsAddRegex
 
 static constexpr OptionDefinition g_regex_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "help"  , 'h', OptionParser::eRequiredArgument, 
nullptr, {}, 0, eArgTypeNone, "The help text to display for this command." },
-  { LLDB_OPT_SET_1, false, "syntax", 's', OptionParser::eRequiredArgument, 
nullptr, {}, 0, eArgTypeNone, "A syntax string showing the typical usage 
syntax." },
-// clang-format on
+#define LLDB_OPTIONS_regex
+#include "CommandOptions.inc"
 };
 
 #pragma mark CommandObjectCommandsAddRegex
@@ -1387,9 +1376,8 @@ private:
 // CommandObjectCommandsScriptImport
 
 static constexpr OptionDefinition g_script_import_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1, false, "allow-reload", 'r', OptionParser::eNoArgument, 
nullptr, {}, 0, eArgTypeNone, "Allow the script to be loaded even if it was 
already loaded before. This argument exists for backwards compatibility, but 
reloading is always allowed, whether you specify it or not." },
-// clang-format on
+#define LLDB_OPTIONS_script_import
+#include "CommandOptions.inc"
 };
 
 class CommandObjectCommandsScriptImport : public CommandObjectParsed {
@@ -1521,12 +1509,8 @@ static constexpr OptionEnumValues Script
 }
 
 static constexpr OptionDefinition g_script_add_options[] = {
-// clang-format off
-  { LLDB_OPT_SET_1,   false, "function",  'f', 
OptionParser::eRequiredArgument, nullptr, {},  0, 
eArgTypePythonFunction,   "Name of the Python function to bind to 
this command name." },
-  { LLDB_OPT_SET_2,   false, "class", 'c', 
OptionParser::eRequiredArgument, nullptr, {}, 

[Lldb-commits] [PATCH] D64917: Add offsetof support to expression evaluator.

2019-07-18 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

nice!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64917



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


[Lldb-commits] [PATCH] D64917: Add offsetof support to expression evaluator.

2019-07-18 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

This is good for now. I would add a comment explaining what you explained in 
the differential at the beginning of the macro section.
Great work!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64917



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


[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes

2019-07-18 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I am sorry, but the code still seems a lot more verbose to me than it should be 
needed to implement the given functionality. I'd like to understand why/if it's 
that necessary..




Comment at: 
lldb/source/Plugins/Process/Utility/RegisterContextWindows_WoW64.cpp:72-105
+static const RegisterInfo *GetRegisterInfoPtr(const ArchSpec &target_arch) {
+  switch (target_arch.GetMachine()) {
+  case llvm::Triple::x86:
+return g_register_infos_WoW64;
+  default:
+llvm_unreachable("Unhandled target architecture.");
+  }

This is very verbose. You could just have `GetRegisterInfo` return 
`g_register_infos_WoW64` directly (and similarly for other functions. Then all 
you'd be left with is putting an `assert(target_arch.GetMachine() == 
llvm::Triple::x86)` into the RegisterContextWindows_WoW64 constructor. Same 
goes for other register context classes.



Comment at: 
lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp:141
+GetRegisterInfo_WoW64(const lldb_private::ArchSpec &arch) {
+  // A WoW64 register info is the same as the i386's.
+  std::vector &g_register_infos =

Why is all of this complexity necessary? Couldn't you just switch on the target 
architecture in `CreateRegisterInfoInterface` in 
NativeRegisterContextWindows_x86_64.cpp and create either 
`RegisterContextWindows_WoW64` or `RegisterContextWindows_x86_64` ?

In fact, if RegisterContextWindows_WoW64 is identical to 
RegisterContextWindows_i386, then why do you even need the _WoW64 version of 
the class in the first place? FWIW, linux also does not have a 
RegisterContextLinux_32_bit_process_on_64_bit_kernel class...



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp:285-286
+NativeProcessWindows::GetAuxvData() const {
+  // Not available on this target.
+  return nullptr;
+}

I think it would be better to return an error here. `llvm::errc::not_supported` 
?



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp:311-337
+  Status error;
+  if (!m_loaded_modules.empty())
+return Status();
+
+  // Retrieve loaded modules by a Target/Module free implemenation.
+  AutoHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetID()));
+  if (snapshot.IsValid()) {

This doesn't seem right. You only retrieve the module list the first time this 
function was called, but the list of loaded modules can change over time. You 
probably need to invalidate this cache every time the process is resumed...



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h:45-49
+  NativeProcessWindows(ProcessLaunchInfo &launch_info, NativeDelegate 
&delegate,
+   llvm::Error &E);
+
+  NativeProcessWindows(lldb::pid_t pid, int terminal_fd,
+   NativeDelegate &delegate, llvm::Error &E);

labath wrote:
> I guess these shouldn't be public as these object should be constructed 
> through the factory, right?
This doesn't seem to be addressed.



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp:104-109
+  if (::SuspendThread(thread_handle) == -1) {
+error.SetError(GetLastError(), eErrorTypeWin32);
+LLDB_LOG(log, "{0} ResumeThread failed with error {1}", __FUNCTION__,
+ error);
+return error;
+  }

Are these suspend/resume calls necessary? You should be able to assume that the 
process is stopped (due to breakpoint, exception or whatever). Nobody will be 
calling functions that get/set registers on a running process. (linux does not 
support that either, but we don't bother explicitly stopping the process before 
we attempt to do this).



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeThreadWindows.cpp:139-199
+Status NativeThreadWindows::SetWatchpoint(lldb::addr_t addr, size_t size,
+  uint32_t watch_flags, bool hardware) 
{
+  if (!hardware)
+return Status("not implemented");
+
+  if (m_state == eStateLaunching)
+return Status();

IIUC, none of the current register contexts implement watchpoint support right 
now. Which means this code is dead/untested. Let's remove it for the time 
being...



Comment at: lldb/unittests/tools/lldb-server/tests/TestClient.cpp:258-260
+// No SIGHUP on Windows to notify llgs that a user terminal already exits.
+// As a result of that, llgs will stay connected and an ErrorReplyTimeout
+// result will be expected. Here we check the connection on timeout.

This doesn't sound right. If the inferior exits, lldb-server should exit too. 
It doesn't matter if that's implemented via SIGHUP, or whatever. If some of the 
tests don't pass because of this, maybe you can disable the test

[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes

2019-07-18 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth requested changes to this revision.
amccarth added a comment.
This revision now requires changes to proceed.

In D63165#1541944 , @clayborg wrote:

> In D63165#1540606 , @Hui wrote:
>
> > > In D63165#1539118 , @amccarth 
> > > wrote:
> > > 
> > >> Sorry for the stupid question, but ...
> > >>
> > >> What exactly is meant here by "Native"?  How is a NativeProcessWindows 
> > >> different from ProcessWindows?
> > > 
> > > 
> > > The Native*** classes are meant to be used from lldb-server. They look 
> > > somewhat similar to their non-native counterpart because they still do 
> > > debugging, but they're a lot dumber, because they only deal with basic 
> > > process control, and none of the fancy symbolic stuff that you'd need 
> > > debug info for.
> >
> > They differ in APIs but most of them have common implementations. The APIs 
> > from native process classes are more easy to apply process/thread control.
> >  Hope the native and non-native ones can be merged. The similar thing to 
> > the RegisterContext and NativeRegisterContext classes.
> >
> > The other thing is that using "native" classes can avoid linking a lot of 
> > unnecessary lldb libs (LLDB plugins or whatever comes with the plugins) to 
> > lldb-server.
> >  The nativeprocesswindows could just be a pass-through to processwindows 
> > plugin, but the usage is a sort of strange since the
> >  lldb-server needs to initialize the plugin, create a target, and create a 
> > instance just like what lldb does. This means literally
> >  there will be two lldb debuggers, one on host and the other one on remote. 
> > It is  doable, but not that applicable.
>
>
> So the idea is ProcessWindows will be deleted once lldb-server supports 
> windows debugging. A bit of history here: when we first started we started 
> making Process for each platform (mac, linux, windows). Then we thought 
> about remote debugging and decided to have everyone just make a lldb-server 
> for their platform and even when we are locally debugging, we launch a 
> lldb-server. This is how linux, macOS, the BSDs and other targets do it. Why? 
> Because if you do it the other way you have more code to support: one native 
> plug-in and one remote plug-in. This means the remote debugging usually has 
> more issues since it is the less tested debugging scenario. It also means 
> that if you had a native process implementation only, like ProcessWindows is 
> currently, you can't remotely debug to a windows machine.
>
> So yes there is duplicated code for now, but ProcessWindows.cpp and 
> ThreadWindows.cpp should go away in the near future once lldb-server takes 
> over so the temporary code duplication is just to keep things working until 
> lldb-server takes over.


Thanks for all the clarification.  "Native" is an overloaded term in LLDB.

I'm trying to think through the implications of this always-use-an-lldb-server 
approach on cross-platform postmortem debugging.  I'll have to do some 
studying, but I guess this patch doesn't change anything in that regard.




Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp:95
+
+// Resume the debug loop.
+ExceptionRecordSP active_exception =

This code appears to be based on `ProcessWindows::DoResume`, which has a 
pending patch to fix a race condition by moving the checking of the exception 
record to later in the function.  I assume this will need the same fix.  See 
https://reviews.llvm.org/D62183 for details.


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

https://reviews.llvm.org/D63165



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


[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes

2019-07-18 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D63165#1591665 , @amccarth wrote:

> I'm trying to think through the implications of this 
> always-use-an-lldb-server approach on cross-platform postmortem debugging.  
> I'll have to do some studying, but I guess this patch doesn't change anything 
> in that regard.


I think the implications of this are zero. In the post mortem case we would 
still create an (in-process) instance of ProcessMinidump, and it work the the 
same way as it does now. Just like we create a ProcessElfCore for opening linux 
core files even though we always use lldb-server (via ProcessGdbRemote) for 
live debugging.

Pretty much nothing of what lldb-server does is useful for debugging core files 
anyway. (Though I have had some ideas about creating a mock lldb-server 
operating on core files for the purposes of testing lldb.)


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

https://reviews.llvm.org/D63165



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


[Lldb-commits] [PATCH] D64881: [Cmake] Use the modern way to find Python when possible

2019-07-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere abandoned this revision.
JDevlieghere added a comment.

Alright, it appears that the consensus is that this isn't desirable for now.

From our side, r366447 fixed all the issues we were experiencing, so I'm 
abandoning this.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64881



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


[Lldb-commits] [PATCH] D64865: [CMake] Polish folders in generated Xcode project

2019-07-18 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

I am going to land this, its cosmetics and the 9.0 branch was cut.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64865



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


[Lldb-commits] [lldb] r366459 - [CMake] Polish folders in generated Xcode project

2019-07-18 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Thu Jul 18 09:44:45 2019
New Revision: 366459

URL: http://llvm.org/viewvc/llvm-project?rev=366459&view=rev
Log:
[CMake] Polish folders in generated Xcode project

Summary: Group plugins by subfolder. Move liblldb-resource-headers to `lldb 
misc`. Avoid install-distribution related targets in IDE-enabled builds.

Reviewers: jingham, mib, stella.stamenova

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/cmake/modules/AddLLDB.cmake
lldb/trunk/cmake/modules/LLDBFramework.cmake

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=366459&r1=366458&r2=366459&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Thu Jul 18 09:44:45 2019
@@ -234,6 +234,6 @@ if (NOT LLDB_DISABLE_PYTHON)
 endif ()
 endif ()
 
-if(LLDB_BUILT_STANDALONE)
+if(LLDB_BUILT_STANDALONE AND NOT LLVM_ENABLE_IDE)
   llvm_distribution_add_targets()
 endif()

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=366459&r1=366458&r2=366459&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Thu Jul 18 09:44:45 2019
@@ -122,7 +122,11 @@ function(add_lldb_library name)
   target_compile_options(${name} PRIVATE ${PARAM_EXTRA_CXXFLAGS})
 
   if(PARAM_PLUGIN)
-set_target_properties(${name} PROPERTIES FOLDER "lldb plugins")
+get_property(parent_dir DIRECTORY PROPERTY PARENT_DIRECTORY)
+if(EXISTS ${parent_dir})
+  get_filename_component(category ${parent_dir} NAME)
+  set_target_properties(${name} PROPERTIES FOLDER "lldb 
plugins/${category}")
+endif()
   else()
 set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
   endif()

Modified: lldb/trunk/cmake/modules/LLDBFramework.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBFramework.cmake?rev=366459&r1=366458&r2=366459&view=diff
==
--- lldb/trunk/cmake/modules/LLDBFramework.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBFramework.cmake Thu Jul 18 09:44:45 2019
@@ -78,6 +78,7 @@ endforeach()
 
 # Wrap output in a target, so lldb-framework can depend on it.
 add_custom_target(liblldb-resource-headers DEPENDS ${lldb_staged_headers})
+set_target_properties(liblldb-resource-headers PROPERTIES FOLDER "lldb misc")
 add_dependencies(liblldb liblldb-resource-headers)
 
 # At build time, copy the staged headers into the framework bundle (and do


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


[Lldb-commits] [PATCH] D64865: [CMake] Polish folders in generated Xcode project

2019-07-18 Thread Phabricator via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366459: [CMake] Polish folders in generated Xcode project 
(authored by stefan.graenitz, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64865?vs=210311&id=210611#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64865

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/cmake/modules/AddLLDB.cmake
  lldb/trunk/cmake/modules/LLDBFramework.cmake


Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -234,6 +234,6 @@
 endif ()
 endif ()
 
-if(LLDB_BUILT_STANDALONE)
+if(LLDB_BUILT_STANDALONE AND NOT LLVM_ENABLE_IDE)
   llvm_distribution_add_targets()
 endif()
Index: lldb/trunk/cmake/modules/LLDBFramework.cmake
===
--- lldb/trunk/cmake/modules/LLDBFramework.cmake
+++ lldb/trunk/cmake/modules/LLDBFramework.cmake
@@ -78,6 +78,7 @@
 
 # Wrap output in a target, so lldb-framework can depend on it.
 add_custom_target(liblldb-resource-headers DEPENDS ${lldb_staged_headers})
+set_target_properties(liblldb-resource-headers PROPERTIES FOLDER "lldb misc")
 add_dependencies(liblldb liblldb-resource-headers)
 
 # At build time, copy the staged headers into the framework bundle (and do
Index: lldb/trunk/cmake/modules/AddLLDB.cmake
===
--- lldb/trunk/cmake/modules/AddLLDB.cmake
+++ lldb/trunk/cmake/modules/AddLLDB.cmake
@@ -122,7 +122,11 @@
   target_compile_options(${name} PRIVATE ${PARAM_EXTRA_CXXFLAGS})
 
   if(PARAM_PLUGIN)
-set_target_properties(${name} PROPERTIES FOLDER "lldb plugins")
+get_property(parent_dir DIRECTORY PROPERTY PARENT_DIRECTORY)
+if(EXISTS ${parent_dir})
+  get_filename_component(category ${parent_dir} NAME)
+  set_target_properties(${name} PROPERTIES FOLDER "lldb 
plugins/${category}")
+endif()
   else()
 set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
   endif()


Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -234,6 +234,6 @@
 endif ()
 endif ()
 
-if(LLDB_BUILT_STANDALONE)
+if(LLDB_BUILT_STANDALONE AND NOT LLVM_ENABLE_IDE)
   llvm_distribution_add_targets()
 endif()
Index: lldb/trunk/cmake/modules/LLDBFramework.cmake
===
--- lldb/trunk/cmake/modules/LLDBFramework.cmake
+++ lldb/trunk/cmake/modules/LLDBFramework.cmake
@@ -78,6 +78,7 @@
 
 # Wrap output in a target, so lldb-framework can depend on it.
 add_custom_target(liblldb-resource-headers DEPENDS ${lldb_staged_headers})
+set_target_properties(liblldb-resource-headers PROPERTIES FOLDER "lldb misc")
 add_dependencies(liblldb liblldb-resource-headers)
 
 # At build time, copy the staged headers into the framework bundle (and do
Index: lldb/trunk/cmake/modules/AddLLDB.cmake
===
--- lldb/trunk/cmake/modules/AddLLDB.cmake
+++ lldb/trunk/cmake/modules/AddLLDB.cmake
@@ -122,7 +122,11 @@
   target_compile_options(${name} PRIVATE ${PARAM_EXTRA_CXXFLAGS})
 
   if(PARAM_PLUGIN)
-set_target_properties(${name} PROPERTIES FOLDER "lldb plugins")
+get_property(parent_dir DIRECTORY PROPERTY PARENT_DIRECTORY)
+if(EXISTS ${parent_dir})
+  get_filename_component(category ${parent_dir} NAME)
+  set_target_properties(${name} PROPERTIES FOLDER "lldb plugins/${category}")
+endif()
   else()
 set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
   endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64255: Remove lldb-mi

2019-07-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG37fed664022e: [LLDB] Remove lldb-mi (authored by 
JDevlieghere).

Changed prior to commit:
  https://reviews.llvm.org/D64255?vs=208202&id=210622#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64255

Files:
  lldb/lit/tools/lldb-instr/Inputs/foo.cpp
  lldb/lit/tools/lldb-instr/Inputs/foo.h
  lldb/lit/tools/lldb-instr/TestInstrumentationRecord.test
  lldb/lit/tools/lldb-instr/TestInstrumentationRegister.test
  lldb/lit/tools/lldb-instr/lit.local.cfg
  lldb/lit/tools/lldb-mi/breakpoint/break-insert-enable-pending.test
  lldb/lit/tools/lldb-mi/breakpoint/break-insert.test
  lldb/lit/tools/lldb-mi/breakpoint/inputs/break-insert-pending.c
  lldb/lit/tools/lldb-mi/breakpoint/inputs/break-insert.c
  lldb/lit/tools/lldb-mi/breakpoint/lit.local.cfg
  lldb/lit/tools/lldb-mi/data/data-info-line.test
  lldb/lit/tools/lldb-mi/data/inputs/data-info-line.c
  lldb/lit/tools/lldb-mi/data/lit.local.cfg
  lldb/lit/tools/lldb-mi/exec/exec-continue.test
  lldb/lit/tools/lldb-mi/exec/exec-finish.test
  lldb/lit/tools/lldb-mi/exec/exec-interrupt.test
  lldb/lit/tools/lldb-mi/exec/exec-next-instruction.test
  lldb/lit/tools/lldb-mi/exec/exec-next.test
  lldb/lit/tools/lldb-mi/exec/exec-run-wrong-binary.test
  lldb/lit/tools/lldb-mi/exec/exec-step-instruction.test
  lldb/lit/tools/lldb-mi/exec/exec-step.test
  lldb/lit/tools/lldb-mi/exec/inputs/main.c
  lldb/lit/tools/lldb-mi/exec/lit.local.cfg
  lldb/lit/tools/lldb-mi/lit.local.cfg
  lldb/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.c
  lldb/lit/tools/lldb-mi/symbol/inputs/list-lines-helper.h
  lldb/lit/tools/lldb-mi/symbol/inputs/main.c
  lldb/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.c
  lldb/lit/tools/lldb-mi/symbol/inputs/symbol-list-lines.h
  lldb/lit/tools/lldb-mi/symbol/lit.local.cfg
  lldb/lit/tools/lldb-mi/symbol/symbol-list-lines.test
  lldb/lit/tools/lldb-mi/target/inputs/main.c
  lldb/lit/tools/lldb-mi/target/inputs/target-select-so-path.py
  lldb/lit/tools/lldb-mi/target/lit.local.cfg
  lldb/lit/tools/lldb-mi/target/target-select-so-path.test
  lldb/lit/tools/lldb-server/TestGdbserverPort.test
  lldb/tools/CMakeLists.txt
  lldb/tools/lldb-mi/CMakeLists.txt
  lldb/tools/lldb-mi/MICmdArgContext.cpp
  lldb/tools/lldb-mi/MICmdArgContext.h
  lldb/tools/lldb-mi/MICmdArgSet.cpp
  lldb/tools/lldb-mi/MICmdArgSet.h
  lldb/tools/lldb-mi/MICmdArgValBase.cpp
  lldb/tools/lldb-mi/MICmdArgValBase.h
  lldb/tools/lldb-mi/MICmdArgValConsume.cpp
  lldb/tools/lldb-mi/MICmdArgValConsume.h
  lldb/tools/lldb-mi/MICmdArgValFile.cpp
  lldb/tools/lldb-mi/MICmdArgValFile.h
  lldb/tools/lldb-mi/MICmdArgValListBase.cpp
  lldb/tools/lldb-mi/MICmdArgValListBase.h
  lldb/tools/lldb-mi/MICmdArgValListOfN.cpp
  lldb/tools/lldb-mi/MICmdArgValListOfN.h
  lldb/tools/lldb-mi/MICmdArgValNumber.cpp
  lldb/tools/lldb-mi/MICmdArgValNumber.h
  lldb/tools/lldb-mi/MICmdArgValOptionLong.cpp
  lldb/tools/lldb-mi/MICmdArgValOptionLong.h
  lldb/tools/lldb-mi/MICmdArgValOptionShort.cpp
  lldb/tools/lldb-mi/MICmdArgValOptionShort.h
  lldb/tools/lldb-mi/MICmdArgValPrintValues.cpp
  lldb/tools/lldb-mi/MICmdArgValPrintValues.h
  lldb/tools/lldb-mi/MICmdArgValString.cpp
  lldb/tools/lldb-mi/MICmdArgValString.h
  lldb/tools/lldb-mi/MICmdArgValThreadGrp.cpp
  lldb/tools/lldb-mi/MICmdArgValThreadGrp.h
  lldb/tools/lldb-mi/MICmdBase.cpp
  lldb/tools/lldb-mi/MICmdBase.h
  lldb/tools/lldb-mi/MICmdCmd.cpp
  lldb/tools/lldb-mi/MICmdCmd.h
  lldb/tools/lldb-mi/MICmdCmdBreak.cpp
  lldb/tools/lldb-mi/MICmdCmdBreak.h
  lldb/tools/lldb-mi/MICmdCmdData.cpp
  lldb/tools/lldb-mi/MICmdCmdData.h
  lldb/tools/lldb-mi/MICmdCmdEnviro.cpp
  lldb/tools/lldb-mi/MICmdCmdEnviro.h
  lldb/tools/lldb-mi/MICmdCmdExec.cpp
  lldb/tools/lldb-mi/MICmdCmdExec.h
  lldb/tools/lldb-mi/MICmdCmdFile.cpp
  lldb/tools/lldb-mi/MICmdCmdFile.h
  lldb/tools/lldb-mi/MICmdCmdGdbInfo.cpp
  lldb/tools/lldb-mi/MICmdCmdGdbInfo.h
  lldb/tools/lldb-mi/MICmdCmdGdbSet.cpp
  lldb/tools/lldb-mi/MICmdCmdGdbSet.h
  lldb/tools/lldb-mi/MICmdCmdGdbShow.cpp
  lldb/tools/lldb-mi/MICmdCmdGdbShow.h
  lldb/tools/lldb-mi/MICmdCmdGdbThread.cpp
  lldb/tools/lldb-mi/MICmdCmdGdbThread.h
  lldb/tools/lldb-mi/MICmdCmdMiscellanous.cpp
  lldb/tools/lldb-mi/MICmdCmdMiscellanous.h
  lldb/tools/lldb-mi/MICmdCmdStack.cpp
  lldb/tools/lldb-mi/MICmdCmdStack.h
  lldb/tools/lldb-mi/MICmdCmdSupportInfo.cpp
  lldb/tools/lldb-mi/MICmdCmdSupportInfo.h
  lldb/tools/lldb-mi/MICmdCmdSupportList.cpp
  lldb/tools/lldb-mi/MICmdCmdSupportList.h
  lldb/tools/lldb-mi/MICmdCmdSymbol.cpp
  lldb/tools/lldb-mi/MICmdCmdSymbol.h
  lldb/tools/lldb-mi/MICmdCmdTarget.cpp
  lldb/tools/lldb-mi/MICmdCmdTarget.h
  lldb/tools/lldb-mi/MICmdCmdThread.cpp
  lldb/tools/lldb-mi/MICmdCmdThread.h
  lldb/tools/lldb-mi/MICmdCmdTrace.cpp
  lldb/tools/lldb-mi/MICmdCmdTrace.h
  lldb/tools/lldb-mi/MICmdCmdVar.cpp
  lldb/tools/lldb-mi/MICmdCmdVar.h
  lldb

[Lldb-commits] [lldb] r366471 - [swig] Enable autodoc feature

2019-07-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Jul 18 10:40:30 2019
New Revision: 366471

URL: http://llvm.org/viewvc/llvm-project?rev=366471&view=rev
Log:
[swig] Enable autodoc feature

This patch enables the SWIG `autodoc` feature so that the generated
Python reference [1] includes class properties.

[1] https://lldb.llvm.org/python_reference/index.html

Modified:
lldb/trunk/scripts/Python/prepare_binding_Python.py

Modified: lldb/trunk/scripts/Python/prepare_binding_Python.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/prepare_binding_Python.py?rev=366471&r1=366470&r2=366471&view=diff
==
--- lldb/trunk/scripts/Python/prepare_binding_Python.py (original)
+++ lldb/trunk/scripts/Python/prepare_binding_Python.py Thu Jul 18 10:40:30 2019
@@ -204,6 +204,7 @@ def do_swig_rebuild(options, dependency_
 "-c++",
 "-shadow",
 "-python",
+"-features autodoc"
 "-threads",
 "-I" + os.path.normpath(os.path.join(options.src_root, "include")),
 "-I" + os.path.curdir,


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


[Lldb-commits] [lldb] r366476 - Add offsetof support to expression evaluator.

2019-07-18 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Thu Jul 18 10:58:04 2019
New Revision: 366476

URL: http://llvm.org/viewvc/llvm-project?rev=366476&view=rev
Log:
Add offsetof support to expression evaluator.

Summary:
We currently don't support offsetof in the expression evaluator as it is 
implemented as a macro
(which then calls __builtin_offsetof) in stddef.h. The best solution would be 
to include that
header (or even better, import Clang's builtin module), but header-parsing and
(cross-platform) importing modules is not ready yet.

Until we get this working with modules I would say we add the macro to our 
existing macro list
as we already do with other macros from stddef.h/stdint.h. We should be able to 
drop all of them
once we can import the relevant modules by default.

rdar://26040641

Reviewers: shafik, davide

Reviewed By: davide

Subscribers: clayborg, lldb-commits

Tags: #lldb

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

Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/
lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/main.c
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
Modified:

lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile?rev=366476&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile Thu Jul 
18 10:58:04 2019
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py?rev=366476&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py 
Thu Jul 18 10:58:04 2019
@@ -0,0 +1,3 @@
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/main.c?rev=366476&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/main.c (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/offsetof/main.c Thu Jul 18 
10:58:04 2019
@@ -0,0 +1,12 @@
+#include 
+
+struct Foo {
+  int8_t a;
+  int16_t b;
+};
+
+int main (int argc, char const *argv[]) {
+struct Foo f;
+return f.a; //% self.expect("expr offsetof(Foo, a)", substrs = ['= 0'])
+//% self.expect("expr offsetof(Foo, b)", substrs = ['= 2'])
+}

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile?rev=366476&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile Thu 
Jul 18 10:58:04 2019
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py?rev=366476&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py 
(added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py 
Thu Jul 18 10:58:04 2019
@@ -0,0 +1,3 @@
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp?rev=366476&view=auto
==
--- lldb/trunk/packag

[Lldb-commits] [PATCH] D64917: Add offsetof support to expression evaluator.

2019-07-18 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe21fc8770ca4: Add offsetof support to expression evaluator. 
(authored by teemperor).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64917

Files:
  lldb/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile
  lldb/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py
  lldb/packages/Python/lldbsuite/test/lang/c/offsetof/main.c
  lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py
  lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp


Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
@@ -30,6 +30,9 @@
 using namespace lldb_private;
 
 const char *ClangExpressionSourceCode::g_expression_prefix = R"(
+#ifndef offsetof
+#define offsetof(t, d) __builtin_offsetof(t, d)
+#endif
 #ifndef NULL
 #define NULL (__null)
 #endif
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
@@ -0,0 +1,25 @@
+#include 
+
+class Base {
+  int32_t a;
+};
+class Class1 : Base {
+public:
+  int32_t b;
+};
+
+class EmptyBase {
+};
+class Class2 : EmptyBase {
+public:
+  int32_t b;
+};
+
+int main(int argc, char **argv) {
+  Class1 c1;
+  Class2 c2;
+  //% self.expect("expr offsetof(Base, a)", substrs=["= 0"])
+  //% self.expect("expr offsetof(Class1, b)", substrs=["= 4"])
+  //% self.expect("expr offsetof(Class2, b)", substrs=["= 0"])
+  return c1.b + c2.b;
+}
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/TestOffsetofCpp.py
@@ -0,0 +1,3 @@
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules
Index: lldb/packages/Python/lldbsuite/test/lang/c/offsetof/main.c
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/c/offsetof/main.c
@@ -0,0 +1,12 @@
+#include 
+
+struct Foo {
+  int8_t a;
+  int16_t b;
+};
+
+int main (int argc, char const *argv[]) {
+struct Foo f;
+return f.a; //% self.expect("expr offsetof(Foo, a)", substrs = ['= 0'])
+//% self.expect("expr offsetof(Foo, b)", substrs = ['= 2'])
+}
Index: lldb/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/c/offsetof/TestOffsetof.py
@@ -0,0 +1,3 @@
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())
Index: lldb/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/c/offsetof/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+C_SOURCES := main.c
+include $(LEVEL)/Makefile.rules


Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
@@ -30,6 +30,9 @@
 using namespace lldb_private;
 
 const char *ClangExpressionSourceCode::g_expression_prefix = R"(
+#ifndef offsetof
+#define offsetof(t, d) __builtin_offsetof(t, d)
+#endif
 #ifndef NULL
 #define NULL (__null)
 #endif
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/offsetof/main.cpp
@@ -0,0 +1,25 @@
+#include 
+
+class Base {
+  int32_t a;
+};
+class Class1 : Base {
+public:
+  int32_t b;
+};
+
+class EmptyBase {
+};
+class Class2 : EmptyBase {
+public:
+  int32_t b;
+};
+
+int main(int argc, char **argv) {
+  Class1 c1;
+  Class2 c2;
+  //% self.expect("expr offsetof(Base, a)", substrs=["= 0"])
+  //% self.expect("expr offsetof(Class1, b)", substrs=["= 4"])
+  //% self.exp

[Lldb-commits] [lldb] r366489 - [FileSpecList] Add EmplaceBack method (NFC)

2019-07-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Jul 18 13:19:24 2019
New Revision: 366489

URL: http://llvm.org/viewvc/llvm-project?rev=366489&view=rev
Log:
[FileSpecList] Add EmplaceBack method (NFC)

Instead of having to write FileSpecList::Append(FileSpec(args)) you can
now call FileSpecList::EmplaceBack(args), similar to
std::vector<>::emplace_back.

Modified:
lldb/trunk/include/lldb/Core/FileSpecList.h
lldb/trunk/source/Core/SearchFilter.cpp

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/include/lldb/Core/FileSpecList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FileSpecList.h?rev=366489&r1=366488&r2=366489&view=diff
==
--- lldb/trunk/include/lldb/Core/FileSpecList.h (original)
+++ lldb/trunk/include/lldb/Core/FileSpecList.h Thu Jul 18 13:19:24 2019
@@ -76,6 +76,15 @@ public:
   /// \b true if the file was appended, \b false otherwise.
   bool AppendIfUnique(const FileSpec &file);
 
+  /// Inserts a new FileSpec into the FileSpecList constructed in-place with
+  /// the given arguments.
+  ///
+  /// \param[in] args
+  /// Arguments to create the FileSpec
+  template  void EmplaceBack(Args &&... args) {
+m_files.emplace_back(std::forward(args)...);
+  }
+
   /// Clears the file list.
   void Clear();
 

Modified: lldb/trunk/source/Core/SearchFilter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SearchFilter.cpp?rev=366489&r1=366488&r2=366489&view=diff
==
--- lldb/trunk/source/Core/SearchFilter.cpp (original)
+++ lldb/trunk/source/Core/SearchFilter.cpp Thu Jul 18 13:19:24 2019
@@ -640,7 +640,7 @@ SearchFilterSP SearchFilterByModuleList:
 "SFBM::CFSD: filter module item %zu not a string.", i);
 return nullptr;
   }
-  modules.Append(FileSpec(module));
+  modules.EmplaceBack(module);
 }
   }
 
@@ -703,7 +703,7 @@ lldb::SearchFilterSP SearchFilterByModul
 "SFBM::CFSD: filter module item %zu not a string.", i);
 return result_sp;
   }
-  modules.Append(FileSpec(module));
+  modules.EmplaceBack(module);
 }
   }
 
@@ -725,7 +725,7 @@ lldb::SearchFilterSP SearchFilterByModul
   "SFBM::CFSD: filter cu item %zu not a string.", i);
   return nullptr;
 }
-cus.Append(FileSpec(cu));
+cus.EmplaceBack(cu);
   }
 
   return std::make_shared(

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=366489&r1=366488&r2=366489&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
 Thu Jul 18 13:19:24 2019
@@ -471,8 +471,8 @@ lldb::SearchFilterSP ItaniumABILanguageR
   if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) 
{
 // Limit the number of modules that are searched for these breakpoints for
 // Apple binaries.
-filter_modules.Append(FileSpec("libc++abi.dylib"));
-filter_modules.Append(FileSpec("libSystem.B.dylib"));
+filter_modules.EmplaceBack("libc++abi.dylib");
+filter_modules.EmplaceBack("libSystem.B.dylib");
   }
   return target.GetSearchFilterForModuleList(&filter_modules);
 }

Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=366489&r1=366488&r2=366489&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Thu Jul 18 
13:19:24 2019
@@ -946,10 +946,10 @@ uint32_t ObjectFilePECOFF::ParseDependen
 dll_specs.GetDirectory().SetString(m_file.GetDirectory().GetCString());
 
 if (!llvm::sys::fs::real_path(dll_specs.GetPath(), dll_fullpath))
-  m_deps_filespec->Append(FileSpec(dll_fullpath));
+  m_deps_filespec->EmplaceBack(dll_fullpath);
 else {
   // Known DLLs or DLL not found in the object file directory.
-  m_deps_filespec->Append(FileSpec(dll_name));
+  m_deps_filespec->EmplaceBack(dll_name);
 }
   }
   return m_deps_filespec->GetSize();

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: 
http://llvm.org

[Lldb-commits] [PATCH] D62570: Use LLVM's debug line parser in LLDB

2019-07-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 210659.
JDevlieghere marked 3 inline comments as done.
JDevlieghere added a comment.

Keep the indices correct when remapping a file fails.


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

https://reviews.llvm.org/D62570

Files:
  lldb/include/lldb/Core/FileSpecList.h
  lldb/include/lldb/Symbol/CompileUnit.h
  lldb/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Symbol/CompileUnit.cpp

Index: lldb/source/Symbol/CompileUnit.cpp
===
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -202,6 +202,10 @@
   m_line_table_up.reset(line_table);
 }
 
+void CompileUnit::SetSupportFiles(const FileSpecList &support_files) {
+  m_support_files = support_files;
+}
+
 DebugMacros *CompileUnit::GetDebugMacros() {
   if (m_debug_macros_sp.get() == nullptr) {
 if (m_flags.IsClear(flagsParsedDebugMacros)) {
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -58,7 +58,6 @@
 #include "DWARFDebugAbbrev.h"
 #include "DWARFDebugAranges.h"
 #include "DWARFDebugInfo.h"
-#include "DWARFDebugLine.h"
 #include "DWARFDebugMacro.h"
 #include "DWARFDebugRanges.h"
 #include "DWARFDeclContext.h"
@@ -72,6 +71,7 @@
 #include "SymbolFileDWARFDwo.h"
 #include "SymbolFileDWARFDwp.h"
 
+#include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/Support/FileSystem.h"
 
 #include 
@@ -161,6 +161,63 @@
 
 } // anonymous namespace end
 
+static const llvm::DWARFDebugLine::LineTable *
+ParseLLVMLineTable(lldb_private::DWARFContext &context,
+   llvm::DWARFDebugLine &line, dw_offset_t line_offset,
+   dw_offset_t unit_offset) {
+  Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+
+  llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVM();
+  llvm::DWARFContext &ctx = context.GetAsLLVM();
+  llvm::Expected line_table =
+  line.getOrParseLineTable(
+  data, line_offset, ctx, nullptr, [&](llvm::Error e) {
+LLDB_LOG_ERROR(log, std::move(e),
+   "SymbolFileDWARF::ParseLineTable failed to parse");
+  });
+
+  if (!line_table) {
+LLDB_LOG_ERROR(log, line_table.takeError(),
+   "SymbolFileDWARF::ParseLineTable failed to parse");
+return nullptr;
+  }
+  return *line_table;
+}
+
+static void
+ParseSupportFilesFromPrologue(const lldb::ModuleSP &module,
+  const llvm::DWARFDebugLine::Prologue &prologue,
+  llvm::StringRef compile_dir,
+  FileSpecList &support_files) {
+  support_files.EmplaceBack();
+
+  const size_t number_of_files = prologue.FileNames.size();
+  for (size_t idx = 1; idx <= number_of_files; ++idx) {
+std::string original_file;
+if (!prologue.getFileNameByIndex(
+idx, compile_dir,
+llvm::DILineInfoSpecifier::FileLineInfoKind::Default,
+original_file)) {
+  // Always add an entry so the indexes remain correct.
+  support_files.EmplaceBack();
+  continue;
+}
+
+std::string remapped_file;
+if (!prologue.getFileNameByIndex(
+idx, compile_dir,
+llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
+remapped_file)) {
+  // Always add an entry so the indexes remain correct.
+  support_files.EmplaceBack(original_file, FileSpec::Style::native);
+  continue;
+}
+
+module->RemapSourceFile(llvm::StringRef(original_file), remapped_file);
+support_files.EmplaceBack(remapped_file, FileSpec::Style::native);
+  }
+}
+
 FileSpecList SymbolFileDWARF::GetSymlinkPaths() {
   return GetGlobalPluginProperties()->GetSymLinkPaths();
 }
@@ -792,19 +849,9 @@
 
 bool SymbolFileDWARF::ParseSupportFiles(CompileUnit &comp_unit,
 FileSpecList &support_files) {
-  ASSERT_MODULE_LOCK(this);
-  if (DWARFUnit *unit = GetDWARFCompileUnit(&comp_unit)) {
-const dw_offset_t stmt_list = unit->GetLineTableOffset();
-if (stmt_list != DW_INVALID_OFFSET) {
-  // All file indexes in DWARF are one based and a file of index zero is
-  // supposed to be the compile unit itself.
-  support_files.Append(comp_unit);
-  return DWARFDebugLine::ParseSupportFiles(comp_unit.GetModule(),
-   m_context.getOrLoadLineData(),
-   stmt_list, support_files, unit);
-}
-  }
-  return false;
+  if (!comp_unit.GetLineTable())
+ParseLineTable(comp_unit);

[Lldb-commits] [PATCH] D62570: Use LLVM's debug line parser in LLDB

2019-07-18 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

We also need to test to ensure this doesn't regress parsing speed. Need a large 
C++ project, like LLDB with debug clang and debug llvm, and something that 
forces all line tables to be parsed (not just the prologues like when setting a 
breakpoint) and see how things compare between the two methods.


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

https://reviews.llvm.org/D62570



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


[Lldb-commits] [lldb] r366493 - Fall back to dyld's _dyld_start when no LC_MAIN / main() func can be found

2019-07-18 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Thu Jul 18 13:55:24 2019
New Revision: 366493

URL: http://llvm.org/viewvc/llvm-project?rev=366493&view=rev
Log:
Fall back to dyld's _dyld_start when no LC_MAIN / main() func can be found

The new DriverKit user-land kernel drivers in macOS 10.15 / Catalina 
do not have a main() function or an LC_MAIN load command.  lldb uses
the address of main() as the return address for inferior function
calls; it puts a breakpoint on main, runs the inferior function call,
and when the main() breakpoint is hit, lldb knows unambiguously that
the inferior function call ran to completion - no other function calls
main.

This change hoists the logic for finding the "entry address" from 
ThreadPlanCallFunction to Target.  It changes the logic to first
try to get the entry address from the main executable module,
but if that module does not have one, it will iterate through all
modules looking for an entry address.

The patch also adds code to ObjectFileMachO to use dyld's 
_dyld_start function as an entry address.

 

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

Modified:
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/ThreadPlanCallFunction.cpp

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=366493&r1=366492&r2=366493&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Thu Jul 18 13:55:24 2019
@@ -1116,6 +1116,24 @@ public:
 
   lldb::addr_t GetPersistentSymbol(ConstString name);
 
+  /// This method will return the address of the starting function for
+  /// this binary, e.g. main() or its equivalent.  This can be used as
+  /// an address of a function that is not called once a binary has 
+  /// started running - e.g. as a return address for inferior function
+  /// calls that are unambiguous completion of the function call, not
+  /// called during the course of the inferior function code running.
+  ///
+  /// If no entry point can be found, an invalid address is returned.
+  ///
+  /// \param [out] err
+  /// This object will be set to failure if no entry address could
+  /// be found, and may contain a helpful error message.
+  //
+  /// \return
+  /// Returns the entry address for this program, LLDB_INVALID_ADDRESS
+  /// if none can be found.
+  lldb_private::Address GetEntryPointAddress(Status &err);
+
   // Target Stop Hooks
   class StopHook : public UserID {
   public:

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=366493&r1=366492&r2=366493&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Jul 18 
13:55:24 2019
@@ -1144,6 +1144,10 @@ bool ObjectFileMachO::IsExecutable() con
   return m_header.filetype == MH_EXECUTE;
 }
 
+bool ObjectFileMachO::IsDynamicLoader() const {
+  return m_header.filetype == MH_DYLINKER;
+}
+
 uint32_t ObjectFileMachO::GetAddressByteSize() const {
   return m_data.GetAddressByteSize();
 }
@@ -5177,8 +5181,10 @@ lldb_private::Address ObjectFileMachO::G
   // return that. If m_entry_point_address is valid it means we've found it
   // already, so return the cached value.
 
-  if (!IsExecutable() || m_entry_point_address.IsValid())
+  if ((!IsExecutable() && !IsDynamicLoader()) || 
+  m_entry_point_address.IsValid()) {
 return m_entry_point_address;
+  }
 
   // Otherwise, look for the UnixThread or Thread command.  The data for the
   // Thread command is given in /usr/include/mach-o.h, but it is basically:
@@ -5300,6 +5306,17 @@ lldb_private::Address ObjectFileMachO::G
   offset = cmd_offset + load_cmd.cmdsize;
 }
 
+if (start_address == LLDB_INVALID_ADDRESS && IsDynamicLoader()) {
+  if (GetSymtab()) {
+Symbol *dyld_start_sym = GetSymtab()->FindFirstSymbolWithNameAndType(
+  ConstString("_dyld_start"), SymbolType::eSymbolTypeCode, 
+  Symtab::eDebugAny, Symtab::eVisibilityAny);
+if (dyld_start_sym && dyld_start_sym->GetAddress().IsValid()) {
+  start_address = dyld_start_sym->GetAddress().GetFileAddress();
+}
+  }
+}
+
 if (start_address != LLDB_INVALID_ADDRESS) {
   // We got the start address from the load commands, so now resolve that
   // address in the sections of this ObjectFile:

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
URL: 
http://llvm.org/viewv

[Lldb-commits] [PATCH] D64897: Move start-address finding to Target, implement fallback if main executable does not have a start address

2019-07-18 Thread Phabricator via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366493: Fall back to dyld's _dyld_start when no LC_MAIN 
/ main() func can be found (authored by jmolenda, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64897?vs=210461&id=210664#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64897

Files:
  lldb/trunk/include/lldb/Target/Target.h
  lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
  lldb/trunk/source/Target/Target.cpp
  lldb/trunk/source/Target/ThreadPlanCallFunction.cpp

Index: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
===
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
@@ -65,38 +65,17 @@
 return false;
   }
 
-  Module *exe_module = GetTarget().GetExecutableModulePointer();
+  m_start_addr = GetTarget().GetEntryPointAddress(error);
 
-  if (exe_module == nullptr) {
-m_constructor_errors.Printf(
-"Can't execute code without an executable module.");
-if (log)
-  log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast(this),
-  m_constructor_errors.GetData());
+  if (log && error.Fail()) {
+m_constructor_errors.Printf("%s", error.AsCString());
+log->Printf("ThreadPlanCallFunction(%p): %s.", static_cast(this),
+ m_constructor_errors.GetData());
 return false;
-  } else {
-ObjectFile *objectFile = exe_module->GetObjectFile();
-if (!objectFile) {
-  m_constructor_errors.Printf(
-  "Could not find object file for module \"%s\".",
-  exe_module->GetFileSpec().GetFilename().AsCString());
-
-  if (log)
-log->Printf("ThreadPlanCallFunction(%p): %s.",
-static_cast(this), m_constructor_errors.GetData());
-  return false;
-}
+  }
 
-m_start_addr = objectFile->GetEntryPointAddress();
-if (!m_start_addr.IsValid()) {
-  m_constructor_errors.Printf(
-  "Could not find entry point address for executable module \"%s\".",
-  exe_module->GetFileSpec().GetFilename().AsCString());
-  if (log)
-log->Printf("ThreadPlanCallFunction(%p): %s.",
-static_cast(this), m_constructor_errors.GetData());
-  return false;
-}
+  if (!m_start_addr.IsValid()) {
+return false;
   }
 
   start_load_addr = m_start_addr.GetLoadAddress(&GetTarget());
Index: lldb/trunk/source/Target/Target.cpp
===
--- lldb/trunk/source/Target/Target.cpp
+++ lldb/trunk/source/Target/Target.cpp
@@ -2448,6 +2448,44 @@
   return address;
 }
 
+lldb_private::Address Target::GetEntryPointAddress(Status &err) {
+  err.Clear();
+  Address entry_addr;
+  Module *exe_module = GetExecutableModulePointer();
+
+  if (!exe_module || !exe_module->GetObjectFile()) {
+err.SetErrorStringWithFormat("No primary executable found");
+  } else {
+entry_addr = exe_module->GetObjectFile()->GetEntryPointAddress();
+if (!entry_addr.IsValid()) {
+  err.SetErrorStringWithFormat(
+ "Could not find entry point address for executable module \"%s\".",
+ exe_module->GetFileSpec().GetFilename().AsCString());
+}
+  }
+
+  if (!entry_addr.IsValid()) {
+const ModuleList &modules = GetImages();
+const size_t num_images = modules.GetSize();
+for (size_t idx = 0; idx < num_images; ++idx) {
+  ModuleSP module_sp(modules.GetModuleAtIndex(idx));
+  if (module_sp && module_sp->GetObjectFile()) {
+entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
+if (entry_addr.IsValid()) {
+  // Clear out any old error messages from the original
+  // main-executable-binary search; one of the other modules
+  // was able to provide an address.
+  err.Clear();
+  break;
+}
+  }
+}
+  }
+
+  return entry_addr;
+}
+
+
 lldb::addr_t Target::GetCallableLoadAddress(lldb::addr_t load_addr,
 AddressClass addr_class) const {
   auto arch_plugin = GetArchitecturePlugin();
Index: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1144,6 +1144,10 @@
   return m_header.filetype == MH_EXECUTE;
 }
 
+bool ObjectFileMachO::IsDynamicLoader() const {
+  return m_header.filetype == MH_DYLINKER;
+}
+
 uint32_t ObjectFileMachO::GetAddressByteSize() const {
   return m_data.Get

[Lldb-commits] [lldb] r366495 - [Breakpoint] Replace use of ClangASTContext with TypeSystem

2019-07-18 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Thu Jul 18 13:58:24 2019
New Revision: 366495

URL: http://llvm.org/viewvc/llvm-project?rev=366495&view=rev
Log:
[Breakpoint] Replace use of ClangASTContext with TypeSystem

Modified:
lldb/trunk/source/Breakpoint/Watchpoint.cpp

Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=366495&r1=366494&r2=366495&view=diff
==
--- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Thu Jul 18 13:58:24 2019
@@ -13,7 +13,7 @@
 #include "lldb/Core/ValueObject.h"
 #include "lldb/Core/ValueObjectMemory.h"
 #include "lldb/Expression/UserExpression.h"
-#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/TypeSystem.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadSpec.h"
@@ -35,7 +35,8 @@ Watchpoint::Watchpoint(Target &target, l
   else {
 // If we don't have a known type, then we force it to unsigned int of the
 // right size.
-ClangASTContext *ast_context = target.GetScratchClangASTContext();
+TypeSystem *ast_context =
+target.GetScratchTypeSystemForLanguage(nullptr, eLanguageTypeC);
 m_type = ast_context->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint,
   8 * size);
   }


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


[Lldb-commits] [lldb] r366506 - The switch to table-genning command options broke

2019-07-18 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Jul 18 15:18:50 2019
New Revision: 366506

URL: http://llvm.org/viewvc/llvm-project?rev=366506&view=rev
Log:
The switch to table-genning command options broke
the xcode project.  This gets it a little closer to
working, but I still have to figure out how to generate
the lldb tablegen backend from the Xcode project.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

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


[Lldb-commits] [lldb] r366507 - Add an expectedFailure test for type finding.

2019-07-18 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Jul 18 15:21:16 2019
New Revision: 366507

URL: http://llvm.org/viewvc/llvm-project?rev=366507&view=rev
Log:
Add an expectedFailure test for type finding.

When two .c files define a type of the same name, lldb
just picks one and uses it regardless of context.  That is
not correct.  When stopped in a frame in one of the .c files
that define this type, it should use that local definition.

This commit just adds a test that checks for the correct
behavior.  It is currently xfailed.

Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/

lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/TestUseClosestType.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/main.c
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/other.c

Added: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/TestUseClosestType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/TestUseClosestType.py?rev=366507&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/TestUseClosestType.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/TestUseClosestType.py
 Thu Jul 18 15:21:16 2019
@@ -0,0 +1,56 @@
+"""
+If there is a definition of a type in the current
+Execution Context's CU, then we should use that type
+even if there are other definitions of the type in other
+CU's.  Assert that that is true.
+"""
+
+from __future__ import print_function
+
+
+import os
+import time
+import re
+import lldb
+import lldbsuite.test.lldbutil as lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+
+class TestUseClosestType(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+NO_DEBUG_INFO_TESTCASE = True
+
+@expectedFailureAll(bugnumber="")
+def test_use_in_expr(self):
+"""Use the shadowed type directly, see if we get a conflicting type 
definition."""
+self.build()
+self.main_source_file = lldb.SBFileSpec("main.c")
+self.expr_test()
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+
+def run_and_check_expr(self, num_children, child_type):
+frame = self.thread.GetFrameAtIndex(0)
+result = frame.EvaluateExpression("struct Foo *$mine = (struct Foo *) 
malloc(sizeof(struct Foo)); $mine")
+self.assertTrue(result.GetError().Success(), "Failed to parse an 
expression using a multiply defined type: %s"%(result.GetError().GetCString()), 
)
+self.assertEqual(result.GetTypeName(), "struct Foo *", "The result has 
the right typename.")
+self.assertEqual(result.GetNumChildren(), num_children, "Got the right 
number of children")
+self.assertEqual(result.GetChildAtIndex(0).GetTypeName(), child_type, 
"Got the right type.")
+
+def expr_test(self):
+""" Run to a breakpoint in main.c, check that an expression referring 
to Foo gets the
+local three int version.  Then run to a breakpoint in other.c and 
check that an
+expression referring to Foo gets the two char* version. """
+
+(target, process, self.thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
+   "Set a breakpoint in main", 
self.main_source_file)
+
+self.run_and_check_expr(3, "int")
+lldbutil.run_to_source_breakpoint(self, "Set a breakpoint in other", 
lldb.SBFileSpec("other.c"))
+self.run_and_check_expr(2, "char *")
+

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/main.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/main.c?rev=366507&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/main.c (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/main.c Thu Jul 
18 15:21:16 2019
@@ -0,0 +1,16 @@
+extern int callme(int input);
+
+struct Foo {
+  int a;
+  int b;
+  int c;
+};
+
+int
+main(int argc, char **argv)
+{
+  // Set a breakpoint in main
+  struct Foo mine = {callme(argc), 10, 20};
+  return mine.a;
+}
+

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/other.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/other.c?rev=366507&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/other.c (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/c/local_types/other.c Thu 
Jul 18 15:21:16 2019
@@ -0,0 +1,11 @@
+struct Foo {
+  char *ptr1;
+  char *ptr2;
+};
+
+int
+callme(int input)
+{
+  struct Foo myFoo = { "string one", "Set a breakpoint in other"};
+  return myFoo.ptr1[0] 

[Lldb-commits] [lldb] r366508 - Remember to sort the Xcode project!!!

2019-07-18 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Jul 18 15:25:56 2019
New Revision: 366508

URL: http://llvm.org/viewvc/llvm-project?rev=366508&view=rev
Log:
Remember to sort the Xcode project!!!

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

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


[Lldb-commits] [PATCH] D64251: Don't depend on psutil on AIX

2019-07-18 Thread Dan Liew via Phabricator via lldb-commits
delcypher added a comment.

@daltenty Other than the minor nit, LGTM.




Comment at: llvm/utils/lit/lit/util.py:449
+(recursively). It is currently implemented using the psutil module on some
+plaftorms which provides a simple platform neutral implementation.
 

Minor nit. s/plaftorms/platforms/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64251



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


[Lldb-commits] [PATCH] D64806: [CMake] Always build debugserver on Darwin and allow tests to use the system's one

2019-07-18 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added inline comments.



Comment at: lldb/trunk/tools/debugserver/source/CMakeLists.txt:50
-
-option(LLDB_NO_DEBUGSERVER "Disable the debugserver target" OFF)
-option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver instead of 
building it from source (Darwin only)." OFF)

Could we actually preserve `LLDB_NO_DEBUGSERVER`? After pulling this patch down 
into my tree and modifying my caches, I realize that I never really change or 
test debugserver and would like to avoid building it at all.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D64806



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


[Lldb-commits] [PATCH] D64964: [API] Remove use of ClangASTContext from SBTarget

2019-07-18 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: JDevlieghere, jingham, clayborg, compnerd.

The methods to find types in a Target aren't clang specific and are
pretty generalizable to type systems. Additionally, to support some of
the use cases in SBTarget, I've added a "GetScratchTypeSystems" method
to Target to support getting all type systems for a target we are
debugging.


https://reviews.llvm.org/D64964

Files:
  include/lldb/Target/Target.h
  source/API/SBTarget.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2199,6 +2199,29 @@
 create_on_demand);
 }
 
+std::vector Target::GetScratchTypeSystems(Status *error,
+bool create_on_demand) {
+  if (!m_valid)
+return {};
+
+  std::vector scratch_type_systems;
+
+  std::set languages_for_types;
+  std::set languages_for_expressions;
+
+  Language::GetLanguagesSupportingTypeSystems(languages_for_types,
+  languages_for_expressions);
+
+  for (auto lang : languages_for_expressions) {
+if (auto *type_system =
+GetScratchTypeSystemForLanguage(error, lang, create_on_demand)) {
+  scratch_type_systems.emplace_back(type_system);
+}
+  }
+
+  return scratch_type_systems;
+}
+
 PersistentExpressionState *
 Target::GetPersistentExpressionStateForLanguage(lldb::LanguageType language) {
   TypeSystem *type_system =
Index: source/API/SBTarget.cpp
===
--- source/API/SBTarget.cpp
+++ source/API/SBTarget.cpp
@@ -44,11 +44,11 @@
 #include "lldb/Core/ValueObjectList.h"
 #include "lldb/Core/ValueObjectVariable.h"
 #include "lldb/Host/Host.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/DeclVendor.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/SymbolVendor.h"
+#include "lldb/Symbol/TypeSystem.h"
 #include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/Language.h"
@@ -1858,11 +1858,12 @@
 }
 
 // No matches, search for basic typename matches
-ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
-if (clang_ast)
-  return LLDB_RECORD_RESULT(SBType(ClangASTContext::GetBasicType(
-  clang_ast->getASTContext(), const_typename)));
+for (auto *type_system :
+ target_sp->GetScratchTypeSystems(/*error*/ nullptr))
+  if (auto type = type_system->GetBuiltinTypeByName(const_typename))
+return LLDB_RECORD_RESULT(SBType(type));
   }
+
   return LLDB_RECORD_RESULT(SBType());
 }
 
@@ -1872,10 +1873,10 @@
 
   TargetSP target_sp(GetSP());
   if (target_sp) {
-ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
-if (clang_ast)
-  return LLDB_RECORD_RESULT(SBType(
-  ClangASTContext::GetBasicType(clang_ast->getASTContext(), type)));
+for (auto *type_system :
+ target_sp->GetScratchTypeSystems(/*error*/ nullptr))
+  if (auto compiler_type = type_system->GetBasicTypeFromAST(type))
+return LLDB_RECORD_RESULT(SBType(compiler_type));
   }
   return LLDB_RECORD_RESULT(SBType());
 }
@@ -1918,10 +1919,11 @@
 
 if (sb_type_list.GetSize() == 0) {
   // No matches, search for basic typename matches
-  ClangASTContext *clang_ast = target_sp->GetScratchClangASTContext();
-  if (clang_ast)
-sb_type_list.Append(SBType(ClangASTContext::GetBasicType(
-clang_ast->getASTContext(), const_typename)));
+  for (auto *type_system :
+   target_sp->GetScratchTypeSystems(/*error*/ nullptr))
+if (auto compiler_type =
+type_system->GetBuiltinTypeByName(const_typename))
+  sb_type_list.Append(SBType(compiler_type));
 }
   }
   return LLDB_RECORD_RESULT(sb_type_list);
Index: include/lldb/Target/Target.h
===
--- include/lldb/Target/Target.h
+++ include/lldb/Target/Target.h
@@ -1031,6 +1031,9 @@
   lldb::LanguageType language,
   bool create_on_demand = true);
 
+  std::vector GetScratchTypeSystems(Status *error,
+  bool create_on_demand = true);
+
   PersistentExpressionState *
   GetPersistentExpressionStateForLanguage(lldb::LanguageType language);
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r366517 - [Commands] Remove unused header from CommandObjectFrame

2019-07-18 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Thu Jul 18 17:26:31 2019
New Revision: 366517

URL: http://llvm.org/viewvc/llvm-project?rev=366517&view=rev
Log:
[Commands] Remove unused header from CommandObjectFrame

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

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=366517&r1=366516&r2=366517&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Thu Jul 18 17:26:31 2019
@@ -23,7 +23,6 @@
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
 #include "lldb/Interpreter/OptionGroupVariable.h"
 #include "lldb/Interpreter/Options.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/ObjectFile.h"


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


[Lldb-commits] [PATCH] D64964: [API] Remove use of ClangASTContext from SBTarget

2019-07-18 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.

This looks fine to me.  Makes it really clear that we need 
SBTarget::FindFirstTypeForLanguage, etc.  But FindFirstType was always a 
crapshoot anyway...


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

https://reviews.llvm.org/D64964



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


[Lldb-commits] [lldb] r366519 - [NFC] Remove instances of unused ClangASTContext header

2019-07-18 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Thu Jul 18 17:39:51 2019
New Revision: 366519

URL: http://llvm.org/viewvc/llvm-project?rev=366519&view=rev
Log:
[NFC] Remove instances of unused ClangASTContext header

Modified:
lldb/trunk/source/Expression/LLVMUserExpression.cpp
lldb/trunk/source/Expression/Materializer.cpp
lldb/trunk/source/Symbol/SymbolContext.cpp

Modified: lldb/trunk/source/Expression/LLVMUserExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/LLVMUserExpression.cpp?rev=366519&r1=366518&r2=366519&view=diff
==
--- lldb/trunk/source/Expression/LLVMUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/LLVMUserExpression.cpp Thu Jul 18 17:39:51 2019
@@ -12,12 +12,12 @@
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/ValueObjectConstResult.h"
 #include "lldb/Expression/DiagnosticManager.h"
+#include "lldb/Expression/ExpressionVariable.h"
 #include "lldb/Expression/IRExecutionUnit.h"
 #include "lldb/Expression/IRInterpreter.h"
 #include "lldb/Expression/Materializer.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Symbol/Block.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangExternalASTSourceCommon.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/ObjectFile.h"

Modified: lldb/trunk/source/Expression/Materializer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=366519&r1=366518&r2=366519&view=diff
==
--- lldb/trunk/source/Expression/Materializer.cpp (original)
+++ lldb/trunk/source/Expression/Materializer.cpp Thu Jul 18 17:39:51 2019
@@ -11,7 +11,6 @@
 #include "lldb/Core/ValueObjectConstResult.h"
 #include "lldb/Core/ValueObjectVariable.h"
 #include "lldb/Expression/ExpressionVariable.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/Type.h"
 #include "lldb/Symbol/Variable.h"

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=366519&r1=366518&r2=366519&view=diff
==
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Thu Jul 18 17:39:51 2019
@@ -13,7 +13,6 @@
 #include "lldb/Host/Host.h"
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Symbol/Block.h"
-#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Symbol.h"
@@ -22,6 +21,7 @@
 #include "lldb/Symbol/Variable.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/StreamString.h"
 
 using namespace lldb;
 using namespace lldb_private;


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


[Lldb-commits] [lldb] r366521 - [Target] Return an llvm::Expected from GetEntryPointAddress (NFC)

2019-07-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Jul 18 17:52:08 2019
New Revision: 366521

URL: http://llvm.org/viewvc/llvm-project?rev=366521&view=rev
Log:
[Target] Return an llvm::Expected from  GetEntryPointAddress (NFC)

Instead of taking a status and potentially returning an invalid address,
return an expected which is guaranteed to contain a valid address.

Modified:
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/ThreadPlanCallFunction.cpp

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=366521&r1=366520&r2=366521&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Thu Jul 18 17:52:08 2019
@@ -1118,7 +1118,7 @@ public:
 
   /// This method will return the address of the starting function for
   /// this binary, e.g. main() or its equivalent.  This can be used as
-  /// an address of a function that is not called once a binary has 
+  /// an address of a function that is not called once a binary has
   /// started running - e.g. as a return address for inferior function
   /// calls that are unambiguous completion of the function call, not
   /// called during the course of the inferior function code running.
@@ -1130,9 +1130,9 @@ public:
   /// be found, and may contain a helpful error message.
   //
   /// \return
-  /// Returns the entry address for this program, LLDB_INVALID_ADDRESS
+  /// Returns the entry address for this program, or an error
   /// if none can be found.
-  lldb_private::Address GetEntryPointAddress(Status &err);
+  llvm::Expected GetEntryPointAddress();
 
   // Target Stop Hooks
   class StopHook : public UserID {

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=366521&r1=366520&r2=366521&view=diff
==
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Thu Jul 18 17:52:08 2019
@@ -2448,44 +2448,43 @@ lldb::addr_t Target::GetPersistentSymbol
   return address;
 }
 
-lldb_private::Address Target::GetEntryPointAddress(Status &err) {
-  err.Clear();
-  Address entry_addr;
+llvm::Expected Target::GetEntryPointAddress() {
   Module *exe_module = GetExecutableModulePointer();
+  llvm::Error error = llvm::Error::success();
+  assert(!error); // Check the success value when assertions are enabled.
 
   if (!exe_module || !exe_module->GetObjectFile()) {
-err.SetErrorStringWithFormat("No primary executable found");
+error = llvm::make_error("No primary executable found",
+
llvm::inconvertibleErrorCode());
   } else {
-entry_addr = exe_module->GetObjectFile()->GetEntryPointAddress();
-if (!entry_addr.IsValid()) {
-  err.SetErrorStringWithFormat(
- "Could not find entry point address for executable module \"%s\".",
- exe_module->GetFileSpec().GetFilename().AsCString());
-}
+Address entry_addr = exe_module->GetObjectFile()->GetEntryPointAddress();
+if (entry_addr.IsValid())
+  return entry_addr;
+
+error = llvm::make_error(
+"Could not find entry point address for executable module \"" +
+exe_module->GetFileSpec().GetFilename().GetStringRef() + "\"",
+llvm::inconvertibleErrorCode());
   }
 
-  if (!entry_addr.IsValid()) {
 const ModuleList &modules = GetImages();
 const size_t num_images = modules.GetSize();
 for (size_t idx = 0; idx < num_images; ++idx) {
   ModuleSP module_sp(modules.GetModuleAtIndex(idx));
-  if (module_sp && module_sp->GetObjectFile()) {
-entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
-if (entry_addr.IsValid()) {
-  // Clear out any old error messages from the original
-  // main-executable-binary search; one of the other modules
-  // was able to provide an address.
-  err.Clear();
-  break;
-}
-  }
+  if (!module_sp || !module_sp->GetObjectFile())
+continue;
+
+  Address entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
+  if (entry_addr.IsValid()) {
+// Discard the error.
+llvm::consumeError(std::move(error));
+return entry_addr;
 }
   }
 
-  return entry_addr;
+  return std::move(error);
 }
 
-
 lldb::addr_t Target::GetCallableLoadAddress(lldb::addr_t load_addr,
 AddressClass addr_class) const {
   auto arch_plugin = GetArchitecturePlugin();

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=366521&r1=366520&r2=366521&view=diff
==

[Lldb-commits] [lldb] r366522 - [Target] Fix formatting and whitespace (NFC)

2019-07-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Jul 18 17:56:26 2019
New Revision: 366522

URL: http://llvm.org/viewvc/llvm-project?rev=366522&view=rev
Log:
[Target] Fix formatting and whitespace (NFC)

Modified:
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/include/lldb/Target/Target.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=366522&r1=366521&r2=366522&view=diff
==
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Thu Jul 18 17:56:26 2019
@@ -121,7 +121,7 @@ public:
 
   FileSpecList GetExecutableSearchPaths();
 
-  void AppendExecutableSearchPaths(const FileSpec&);
+  void AppendExecutableSearchPaths(const FileSpec &);
 
   FileSpecList GetDebugFileSearchPaths();
 
@@ -495,7 +495,7 @@ public:
 
   static void SetDefaultArchitecture(const ArchSpec &arch);
 
-  /// Find a binary on the system and return its Module, 
+  /// Find a binary on the system and return its Module,
   /// or return an existing Module that is already in the Target.
   ///
   /// Given a ModuleSpec, find a binary satisifying that specification,
@@ -507,27 +507,26 @@ public:
   /// e.g. UUID, architecture, file path.
   ///
   /// \param[in] notify
-  /// If notify is true, and the Module is new to this Target, 
-  /// Target::ModulesDidLoad will be called.  
-  /// If notify is false, it is assumed that the caller is adding 
-  /// multiple Modules and will call ModulesDidLoad with the 
+  /// If notify is true, and the Module is new to this Target,
+  /// Target::ModulesDidLoad will be called.
+  /// If notify is false, it is assumed that the caller is adding
+  /// multiple Modules and will call ModulesDidLoad with the
   /// full list at the end.
   /// ModulesDidLoad must be called when a Module/Modules have
   /// been added to the target, one way or the other.
   ///
   /// \param[out] error_ptr
-  /// Optional argument, pointing to a Status object to fill in 
+  /// Optional argument, pointing to a Status object to fill in
   /// with any results / messages while attempting to find/load
   /// this binary.  Many callers will be internal functions that
   /// will handle / summarize the failures in a custom way and
   /// don't use these messages.
   ///
-  /// \return 
+  /// \return
   /// An empty ModuleSP will be returned if no matching file
   /// was found.  If error_ptr was non-nullptr, an error message
   /// will likely be provided.
-  lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec,
-   bool notify,
+  lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify,
Status *error_ptr = nullptr);
 
   // Settings accessors
@@ -644,14 +643,11 @@ public:
 Args *additional_args = nullptr,
 Status *additional_args_error = nullptr);
 
-  lldb::BreakpointSP
-  CreateScriptedBreakpoint(const llvm::StringRef class_name,
-   const FileSpecList *containingModules,
-   const FileSpecList *containingSourceFiles,
-   bool internal,
-   bool request_hardware,
-   StructuredData::ObjectSP extra_args_sp,
-   Status *creation_error = nullptr);
+  lldb::BreakpointSP CreateScriptedBreakpoint(
+  const llvm::StringRef class_name, const FileSpecList *containingModules,
+  const FileSpecList *containingSourceFiles, bool internal,
+  bool request_hardware, StructuredData::ObjectSP extra_args_sp,
+  Status *creation_error = nullptr);
 
   // This is the same as the func_name breakpoint except that you can specify a
   // vector of names.  This is cheaper than a regular expression breakpoint in
@@ -690,43 +686,42 @@ public:
   }
 
   WatchpointList &GetWatchpointList() { return m_watchpoint_list; }
-  
+
   // Manages breakpoint names:
   void AddNameToBreakpoint(BreakpointID &id, const char *name, Status &error);
-  
-  void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name, 
+
+  void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name,
Status &error);
-  
-  void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, 
-ConstString name);
-  
-  BreakpointName *FindBreakpointName(ConstString name, bool can_create, 
+
+  void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, ConstString name);
+
+  BreakpointName *FindBreakpointName(ConstString name, bool can_create,
  Status &error);
- 
+
   void DeleteBreakpointName(ConstString name);
-  
+
   void ConfigureBreakpointName(BreakpointName &bp

[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes

2019-07-18 Thread Hui Huang via Phabricator via lldb-commits
Hui added inline comments.



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h:45-49
+  NativeProcessWindows(ProcessLaunchInfo &launch_info, NativeDelegate 
&delegate,
+   llvm::Error &E);
+
+  NativeProcessWindows(lldb::pid_t pid, int terminal_fd,
+   NativeDelegate &delegate, llvm::Error &E);

labath wrote:
> labath wrote:
> > I guess these shouldn't be public as these object should be constructed 
> > through the factory, right?
> This doesn't seem to be addressed.
These constructors contain a call to function template make_unique that is not 
allowed to access private members of NativeProcessWindows.
Simply do the following could address this concern.

```

-  auto process_up =
-  std::make_unique(launch_info, native_delegate, E);

+  auto process_up = std::unique_ptr(
+  new NativeProcessWindows(launch_info, native_delegate, E));
```



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

https://reviews.llvm.org/D63165



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


[Lldb-commits] [PATCH] D64964: [API] Remove use of ClangASTContext from SBTarget

2019-07-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere requested changes to this revision.
JDevlieghere added a comment.
This revision now requires changes to proceed.

All uses of this new function drop the error on the ground. Does that mean it 
doesn't matter? If it does, should we return an expected instead? Should we 
stop on the first error, or is it fine to overwrite when iterating over 
`languages_for_expressions`? It seems like the error handling needs some more 
work here.


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

https://reviews.llvm.org/D64964



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


[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes

2019-07-18 Thread Hui Huang via Phabricator via lldb-commits
Hui added inline comments.



Comment at: 
lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp:104-109
+  if (::SuspendThread(thread_handle) == -1) {
+error.SetError(GetLastError(), eErrorTypeWin32);
+LLDB_LOG(log, "{0} ResumeThread failed with error {1}", __FUNCTION__,
+ error);
+return error;
+  }

labath wrote:
> Are these suspend/resume calls necessary? You should be able to assume that 
> the process is stopped (due to breakpoint, exception or whatever). Nobody 
> will be calling functions that get/set registers on a running process. (linux 
> does not support that either, but we don't bother explicitly stopping the 
> process before we attempt to do this).
Yes, agreed. But such codes are added to be consistent with what is now in 
upstream from https://reviews.llvm.org/rL364216. (CacheAllRegisterValues).



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

https://reviews.llvm.org/D63165



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


[Lldb-commits] [PATCH] D64964: [API] Remove use of ClangASTContext from SBTarget

2019-07-18 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

In D64964#1592851 , @JDevlieghere 
wrote:

> All uses of this new function drop the error on the ground. Does that mean it 
> doesn't matter? If it does, should we return an expected instead? Should we 
> stop on the first error, or is it fine to overwrite when iterating over 
> `languages_for_expressions`? It seems like the error handling needs some more 
> work here.


If you at the actual function `GetScratchTypeSystemForLanguage`, the error is 
completely unused. I think dropping the Status returning an llvm::Expected is 
probably the right thing to do. In that case, I don't think we should stop if 
`GetScratchTypeSystemForLanguage` returns a None value. I'll update this 
tomorrow.


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

https://reviews.llvm.org/D64964



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


[Lldb-commits] [PATCH] D63165: Initial support for native debugging of x86/x64 Windows processes

2019-07-18 Thread Hui Huang via Phabricator via lldb-commits
Hui added inline comments.



Comment at: 
lldb/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp:141
+GetRegisterInfo_WoW64(const lldb_private::ArchSpec &arch) {
+  // A WoW64 register info is the same as the i386's.
+  std::vector &g_register_infos =

labath wrote:
> Why is all of this complexity necessary? Couldn't you just switch on the 
> target architecture in `CreateRegisterInfoInterface` in 
> NativeRegisterContextWindows_x86_64.cpp and create either 
> `RegisterContextWindows_WoW64` or `RegisterContextWindows_x86_64` ?
> 
> In fact, if RegisterContextWindows_WoW64 is identical to 
> RegisterContextWindows_i386, then why do you even need the _WoW64 version of 
> the class in the first place? FWIW, linux also does not have a 
> RegisterContextLinux_32_bit_process_on_64_bit_kernel class...
I think WoW64 is i686 that shall deserve a separate arch specific 
implementation?


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

https://reviews.llvm.org/D63165



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