Re: [Lldb-commits] [PATCH] D40475: DWZ 12/12: DWZ test mode

2017-12-04 Thread Pavel Labath via lldb-commits
On 1 December 2017 at 19:42, Jim Ingham  wrote:
> This certainly should be cleared up and centralized.  I'm not quite as sure 
> it should be in Platform however.  For instance, macOS has the DebugSymbols 
> framework that allows users to specify a local lookup tool to find symbol 
> files given a UUID.  That runs only on MacOS and requires MacOS specific 
> headers to build.  So that makes it a Host facility.  But there's no reason 
> you couldn't use this mechanism for finding Linux symbol files when cross 
> debugging.  So that makes it sound more like this Platform symbol finding 
> facility you're envisioning.  I'm still a little unclear about the 
> distinction between Host, Platform when the platform isn't the same as the 
> Host, and Platform when it happens to be the same as the Host.
>
> But maybe this is clear and I just haven't studied the more recent 
> manifestations of the code recently.

I agree that the host/platform split is not very clear currently.
We'll need to think about it when the time comes. Maybe we just need
to peel off one layer from the Host here and move it somewhere. For
example the concrete details of how to invoke the DebugSymbols
framework can stay in Host (roughly the
LocateMacOSXFilesUsingDebugSymbols function, I guess), but then all
the smartness about what to do with it can live somewhere else.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r319472 - Fix this test so that the breakpoints you set are

2017-12-04 Thread Pavel Labath via lldb-commits
Gdb has no issues with this use case. I'm pretty sure this is a
problem with how our posix dynamic linker plugin catches these events.
I've asked eugene to look into that.

On 1 December 2017 at 18:58, Jim Ingham  wrote:
> The fact that this passes on macOS likely does mean the general mechanism 
> works but that the Linux library loading hook gets called too late, so you 
> probably can't fix it in lldb.  Be interesting to see if gdb has the same 
> problem.
>
> Jim
>
>> On Dec 1, 2017, at 3:09 AM, Pavel Labath  wrote:
>>
>> cool. thanks.
>>
>> On 30 November 2017 at 20:43, Jim Ingham via lldb-commits
>>  wrote:
>>> Author: jingham
>>> Date: Thu Nov 30 12:43:00 2017
>>> New Revision: 319472
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=319472&view=rev
>>> Log:
>>> Fix this test so that the breakpoints you set are
>>> unambiguously on one bit of code.  On macOS these
>>> lines mapped to two distinct locations, and that
>>> was artificially throwing off the test.
>>>
>>> Modified:
>>>
>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp
>>>
>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp
>>>
>>> Modified: 
>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp?rev=319472&r1=319471&r2=319472&view=diff
>>> ==
>>> --- 
>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp
>>>  (original)
>>> +++ 
>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/foo.cpp
>>>  Thu Nov 30 12:43:00 2017
>>> @@ -1,5 +1,7 @@
>>> #include "foo.h"
>>>
>>> -Foo::Foo() : x(42) {} // !BR_foo
>>> +Foo::Foo() : x(42) {
>>> +bool some_code = x == 42;  // !BR_foo
>>> +}
>>>
>>> Foo FooObj;
>>>
>>> Modified: 
>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp?rev=319472&r1=319471&r2=319472&view=diff
>>> ==
>>> --- 
>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp
>>>  (original)
>>> +++ 
>>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/breakpoint/global_constructor/main.cpp
>>>  Thu Nov 30 12:43:00 2017
>>> @@ -5,7 +5,9 @@ struct Main {
>>>   int x;
>>> };
>>>
>>> -Main::Main() : x(47) {} // !BR_main
>>> +Main::Main() : x(47) {
>>> +bool some_code = x == 47; // !BR_main
>>> +}
>>>
>>> Main MainObj;
>>>
>>>
>>>
>>> ___
>>> lldb-commits mailing list
>>> lldb-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D40757: Disable warnings related to anonymous types

2017-12-04 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

If the "excuse" for not following llvm here is that these structs mirror apple 
headers, should we restrict these warnings only to the relevant files (e.g. 
everything in `source/Plugins/Language/ObjC`)?

I don't particularly care about whether we do, but I wanted to throw the idea 
out there, as this is the reason why I haven't done something similar yet 
(although the warnings are quite annoying).


https://reviews.llvm.org/D40757



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


Re: [Lldb-commits] [PATCH] D40745: Add a clang-ast subcommand to lldb-test

2017-12-04 Thread Pavel Labath via lldb-commits
The reason you hit the assert there, is because you're running lldb on
an un-linked object file. When you link the file, the linker will
resolve these relocations and they will disappear. This is also the
reason you got those errors after removing the assert  (you were
trying to parse unrelocated dwarf). To run your tests, you'll need to
run the object file through the linker (something like ld -shared -o
foo.so foo.o should suffice)

The fact that we crash there is certainly a bug, but the bug may be
that we are even accepting these files in the first place. It might be
interesting to make lldb read these files, if for nothing else, then
for the sake of testing, but that is not a trivial task. Right now
that relocating code is completely wrong (e.g. it assumes all
relocations are x86 relocations).

On 1 December 2017 at 20:49, Zachary Turner via Phabricator
 wrote:
> zturner created this revision.
> Herald added a subscriber: emaste.
>
> This is the bare minimum needed to dump `ClangASTContext`s via `lldb-test`.
>
> Within the first 10 seconds of using this, I already found a bug.  A `FIXME` 
> note and repro is included in the comments in this patch.
>
> With this, it should be possible to do deep testing of otherwise difficult to 
> test scenarios involving `ClangASTContext`.
>
>
> https://reviews.llvm.org/D40745
>
> Files:
>   lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
>   lldb/tools/lldb-test/lldb-test.cpp
>
>
> Index: lldb/tools/lldb-test/lldb-test.cpp
> ===
> --- lldb/tools/lldb-test/lldb-test.cpp
> +++ lldb/tools/lldb-test/lldb-test.cpp
> @@ -10,11 +10,15 @@
>  #include "FormatUtil.h"
>  #include "SystemInitializerTest.h"
>
> +#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
>  #include "lldb/Core/Debugger.h"
>  #include "lldb/Core/Module.h"
>  #include "lldb/Core/Section.h"
>  #include "lldb/Initialization/SystemLifetimeManager.h"
> +#include "lldb/Symbol/ClangASTContext.h"
> +#include "lldb/Symbol/ClangASTImporter.h"
>  #include "lldb/Utility/DataExtractor.h"
> +#include "lldb/Utility/StreamString.h"
>
>  #include "llvm/ADT/StringRef.h"
>  #include "llvm/Support/CommandLine.h"
> @@ -30,26 +34,48 @@
>  namespace opts {
>  cl::SubCommand ModuleSubcommand("module-sections",
>  "Display LLDB Module Information");
> +cl::SubCommand ClangASTSubcommand("clang-ast", "Dump Clang AST for input 
> file");
>
>  namespace module {
>  cl::opt SectionContents("contents",
>cl::desc("Dump each section's contents"),
>cl::sub(ModuleSubcommand));
>  cl::list InputFilenames(cl::Positional, cl::desc(" files>"),
>   cl::OneOrMore, 
> cl::sub(ModuleSubcommand));
>  } // namespace module
> +
> +namespace clang_ast {
> +cl::list InputFilenames(cl::Positional, cl::desc(" files>"),
> + cl::OneOrMore,
> + cl::sub(ClangASTSubcommand));
> +}
>  } // namespace opts
>
>  static llvm::ManagedStatic DebuggerLifetime;
>
> +static void dumpClangASTContext(Debugger &Dbg) {
> +  for (const auto &File : opts::clang_ast::InputFilenames) {
> +ModuleSpec Spec{FileSpec(File, false)};
> +Spec.GetSymbolFileSpec().SetFile(File, false);
> +
> +auto ModulePtr = std::make_shared(Spec);
> +
> +StreamString Stream;
> +ModulePtr->ParseAllDebugSymbols();
> +ModulePtr->Dump(&Stream);
> +llvm::outs() << Stream.GetData() << "\n";
> +llvm::outs().flush();
> +  }
> +}
> +
>  static void dumpModules(Debugger &Dbg) {
>LinePrinter Printer(4, llvm::outs());
>
>for (const auto &File : opts::module::InputFilenames) {
>  ModuleSpec Spec{FileSpec(File, false)};
>  Spec.GetSymbolFileSpec().SetFile(File, false);
>
> -auto ModulePtr = std::make_shared(Spec);
> +auto ModulePtr = std::make_shared(Spec);
>  SectionList *Sections = ModulePtr->GetSectionList();
>  if (!Sections) {
>llvm::errs() << "Could not load sections for module " << File << "\n";
> @@ -92,6 +118,8 @@
>
>if (opts::ModuleSubcommand)
>  dumpModules(*Dbg);
> +  else if (opts::ClangASTSubcommand)
> +dumpClangASTContext(*Dbg);
>
>DebuggerLifetime->Terminate();
>return 0;
> Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> ===
> --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> +++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> @@ -2764,6 +2764,14 @@
>case R_386_32:
>case R_386_PC32:
>default:
> +// FIXME: This asserts with this input:
> +//
> +// foo.cpp
> +// int main(int argc, char **argv) { return 0; }
> +//
> +// clang++.exe --target=i686-unknown-linux-gnu -g -c foo.cpp -o foo.o
> +//
> +// and running this on the foo.o module.
>  assert(false && 

[Lldb-commits] [PATCH] D40717: Makefile.rules: compile all tests with -fno-limit-debug-info

2017-12-04 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL319653: Makefile.rules: compile all tests with 
-fno-limit-debug-info (authored by labath).

Repository:
  rL LLVM

https://reviews.llvm.org/D40717

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/expression_command/fixits/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_completion/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/stl/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/Makefile
  lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/trunk/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile

Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile
@@ -2,11 +2,4 @@
 
 CXX_SOURCES := main.cpp
 
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets.  Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
-  CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
 include $(LEVEL)/Makefile.rules
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/fixits/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/fixits/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/fixits/Makefile
@@ -2,11 +2,4 @@
 
 CXX_SOURCES := main.cpp
 
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets.  Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
-  CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
 include $(LEVEL)/Makefile.rules
Index: lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
@@ -2,13 +2,6 @@
 
 CXX_SOURCES := main.cpp
 
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets.  Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
-  CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
 include $(LEVEL)/Makefile.rules
 
 clean::
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
@@ -2,6 +2,4 @@
 
 CXX_SOURCES := main.cpp
 
-CFLAGS_EXTRAS += $(NO_LIMIT_DEBUG_INFO_FLAGS)
-
 include $(LEVEL)/Makefile.

[Lldb-commits] [lldb] r319653 - Makefile.rules: compile all tests with -fno-limit-debug-info

2017-12-04 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Dec  4 05:31:56 2017
New Revision: 319653

URL: http://llvm.org/viewvc/llvm-project?rev=319653&view=rev
Log:
Makefile.rules: compile all tests with -fno-limit-debug-info

Summary:
This flag is on by default for darwin and freebsd, but off for linux.
Without it, clang will sometimes not emit debug info for types like
std::string. Whether it does this, and which tests will fail because of
that depends on the linux distro and c++ library version.

A bunch of tests were already setting these flags manually, but here
instead I take a whole sale approach and enable this flag for all tests.
Any test which does not want to have this flag (right now we have one
such test) can turn it off explicitly via
CFLAGS_EXTRAS+=$(LIMIT_DEBUG_INFO_FLAGS)

This fixes a bunch of data formatter tests on red-hat.

Reviewers: davide, jankratochvil

Subscribers: emaste, aprantl, krytarowski, JDevlieghere, lldb-commits

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
lldb/trunk/packages/Python/lldbsuite/test/expression_command/fixits/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-skip-summary/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/iterator/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/string/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/tuple/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/unique_ptr/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synth/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/dump_dynamic/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/stringprinter/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/summary-string-onfail/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/var-in-aggregate-misuse/Makefile

lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_completion/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/stl/Makefile
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/Makefile
lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

lldb/trunk/packages/Python/lldbsuite/test/python_api/sbvalue_persist/Makefile

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile?rev=319653&r1=319652&r2=319653&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/Makefile
 Mon Dec  4 05:31:56 2017
@@ -2,11 +2,4 @@ LEVEL = ../../make
 
 CXX_SOURCES := main.cpp
 
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets.  Other targets do not, which causes this test to fail.
-# This flag enables FullDebugInfo for all targets.
-ifneq (,$(findstring clang,$(CC)))
-  CFLAGS_EXTRAS += -fno-limit-debug-info
-endif
-
 include $(LEVEL)/Makefile.rules

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/Makefile?rev=319653&r1=319652&r2=319653&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/Makefile
 Mon Dec  4 05:31:56 2017
@@ -2,13 +2,6 @@ LEVEL = ../../make
 
 CXX_SOURCES := main.cpp
 
-# clang-3.5+ outputs FullDebugInfo by default for Darwin/FreeBSD
-# targets.  Other targets do not

Re: [Lldb-commits] [lldb] r319596 - Fix warnings in JSON.cpp, NFC

2017-12-04 Thread Stephane Sezer via lldb-commits
Yeah, just a quick note about ds2, this is the current status of supported
platforms:
* Linux (x86/x86_64/arm/aarch64), used for debugging processes on "classic"
linux (Ubuntu, centOS, etc), Android, as well as Tizen.
* Windows (x86/x86_64/arm), used to debug processes on Windows Desktop,
Windows Phone, and even on Xbox. Aarch64 support on Windows hasn't been
needed so far so we didn't do it, but it would be trivial to add.
* There is also some support for macOS debugging but some features are
still missing there. I'm planning on working on that in the next couple of
months, at least for x86 and x86_64 targets.

We also run the lldb test suite by substituting the default debug server
with ds2 and we pass the vast majority of tests there. (A lot of tests are
broken or flaky regardless of which debug server is used unfortunately.)

If people in the lldb community are interested in unifying LLDB's debug
servers and have a single small, self-contained binary, we can discuss what
would be required to go in that direction.

Jim pointed out some embedded Apple targets that require debugserver
currently. Aren't all these targets based on Darwin? I imagine if we have
Darwin-x86_64 fully supported in ds2, adding specific architectures there
would a reasonable amount of work.

On Fri, Dec 1, 2017 at 4:13 PM Zachary Turner  wrote:

> There was also some discussion from some Facebook people about using their
> own in-house ds2.  It sounds like a large effort, but IIUC it's compatible
> with debugserver, and supports more platforms than lldb-server.
>
> +stephane and saleem since they know more about it.
>
> Actually, +greg too since I guess he now works at Facebook.
>
>
> On Fri, Dec 1, 2017 at 4:06 PM Jim Ingham  wrote:
>
>> If somebody finds themselves ambitious to work on debugserver, they
>> should divert that energy to porting lldb-server to macOS IMHO.
>>
>> Jim
>>
>>
>> > On Dec 1, 2017, at 4:04 PM, Jim Ingham  wrote:
>> >
>> > Yes, we don't use llvm code in debugserver.  It doesn't actually use
>> any lldb classes either, it's its own standalone thing.
>> >
>> > Jim
>> >
>> >
>> >> On Dec 1, 2017, at 4:01 PM, Zachary Turner via lldb-commits <
>> lldb-commits@lists.llvm.org> wrote:
>> >>
>> >> I don't recall, is there a hard restriction on debugserver not being
>> allowed to use llvm code?  Because YAML is a superset of JSON
>> >>
>> >> On Fri, Dec 1, 2017 at 3:36 PM Davide Italiano via lldb-commits <
>> lldb-commits@lists.llvm.org> wrote:
>> >> Also, FWIW, this is blatantly not the correct way of using assertions.
>> >> It should either be assert(false && "patatino") or the more canonical
>> >> llvm_unreachable("patatino").
>> >> Relying on the implicit conversion from string to bool seems risky
>> >> (and not really useful).
>> >>
>> >> On Fri, Dec 1, 2017 at 3:29 PM, Vedant Kumar via lldb-commits
>> >>  wrote:
>> >>> Author: vedantk
>> >>> Date: Fri Dec  1 15:29:04 2017
>> >>> New Revision: 319596
>> >>>
>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=319596&view=rev
>> >>> Log:
>> >>> Fix warnings in JSON.cpp, NFC
>> >>>
>> >>> These asserts are no-ops, and are supplanted by -Wcovered-switch.
>> >>>
>> >>> Modified:
>> >>>lldb/trunk/tools/debugserver/source/JSON.cpp
>> >>>
>> >>> Modified: lldb/trunk/tools/debugserver/source/JSON.cpp
>> >>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/JSON.cpp?rev=319596&r1=319595&r2=319596&view=diff
>> >>>
>> ==
>> >>> --- lldb/trunk/tools/debugserver/source/JSON.cpp (original)
>> >>> +++ lldb/trunk/tools/debugserver/source/JSON.cpp Fri Dec  1 15:29:04
>> 2017
>> >>> @@ -58,7 +58,6 @@ uint64_t JSONNumber::GetAsUnsigned() con
>> >>>   case DataType::Double:
>> >>> return (uint64_t)m_data.m_double;
>> >>>   }
>> >>> -  assert("Unhandled data type");
>> >>> }
>> >>>
>> >>> int64_t JSONNumber::GetAsSigned() const {
>> >>> @@ -70,7 +69,6 @@ int64_t JSONNumber::GetAsSigned() const
>> >>>   case DataType::Double:
>> >>> return (int64_t)m_data.m_double;
>> >>>   }
>> >>> -  assert("Unhandled data type");
>> >>> }
>> >>>
>> >>> double JSONNumber::GetAsDouble() const {
>> >>> @@ -82,7 +80,6 @@ double JSONNumber::GetAsDouble() const {
>> >>>   case DataType::Double:
>> >>> return m_data.m_double;
>> >>>   }
>> >>> -  assert("Unhandled data type");
>> >>> }
>> >>>
>> >>> void JSONNumber::Write(std::ostream &s) {
>> >>>
>> >>>
>> >>> ___
>> >>> lldb-commits mailing list
>> >>> lldb-commits@lists.llvm.org
>> >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>> >> ___
>> >> lldb-commits mailing list
>> >> lldb-commits@lists.llvm.org
>> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>> >> ___
>> >> lldb-commits mailing list
>> >> lldb-commits@lists.llvm.org
>> >> http://lists.llvm.org/cgi-bin/mailman/l

Re: [Lldb-commits] [lldb] r319598 - Don't use llvm::EnablePrettyStackTrace on macOS.

2017-12-04 Thread Jim Ingham via lldb-commits

> On Dec 2, 2017, at 3:36 PM, Zachary Turner  wrote:
> 
> That said, it does seem to make more sense as something you would do in the 
> main lldb executable, and not in library code.
> 

Yes, if we want to support it we need to make an SB API to turn it on.  You 
can't turn it on in the driver by hand because the framework doesn't export 
llvm functions.

> On Sat, Dec 2, 2017 at 12:26 PM Zachary Turner  wrote:
> I'm curious why it's not working as it's supposed to work on these platforms. 
>  When it does work, it's quite helpful

At present all I have is a bunch of non-reproducible crash reports, I don't 
know why it isn't working.

Jim


> 
> On Sat, Dec 2, 2017 at 12:24 PM Davide Italiano  wrote:
> Maybe we should remove this feature altogether?
> 
> On Fri, Dec 1, 2017 at 4:11 PM, Jim Ingham via lldb-commits
>  wrote:
> > Author: jingham
> > Date: Fri Dec  1 16:11:18 2017
> > New Revision: 319598
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=319598&view=rev
> > Log:
> > Don't use llvm::EnablePrettyStackTrace on macOS.
> >
> > LLDB.framework gets loaded into Xcode and other
> > frameworks, and this is inserting a signal handler into
> > the process even when lldb isn't used.  I have a bunch
> > of reports of this SignalHandler blowing out the stack,
> > which renders crash reports for the crash useless.
> >
> > And in any case libraries really shouldn't be installing
> > signal handlers.
> >
> > I only turned this off for APPLE platforms, I'll let
> > the maintainers of other platforms decide what policy
> > they want to have w.r.t. this.
> >
> > Modified:
> > lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
> >
> > Modified: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
> > URL: 
> > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemInitializerCommon.cpp?rev=319598&r1=319597&r2=319598&view=diff
> > ==
> > --- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp (original)
> > +++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp Fri Dec  1 
> > 16:11:18 2017
> > @@ -69,7 +69,9 @@ void SystemInitializerCommon::Initialize
> >}
> >  #endif
> >
> > +#if not defined(__APPLE__)
> >llvm::EnablePrettyStackTrace();
> > +#endif
> >Log::Initialize();
> >HostInfo::Initialize();
> >static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
> >
> >
> > ___
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


[Lldb-commits] [lldb] r319694 - Switch from C++1z to C++17; corresponds to r319688 in Clang.

2017-12-04 Thread Aaron Ballman via lldb-commits
Author: aaronballman
Date: Mon Dec  4 12:46:43 2017
New Revision: 319694

URL: http://llvm.org/viewvc/llvm-project?rev=319694&view=rev
Log:
Switch from C++1z to C++17; corresponds to r319688 in Clang.

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

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp?rev=319694&r1=319693&r2=319694&view=diff
==
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp 
(original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp Mon 
Dec  4 12:46:43 2017
@@ -628,7 +628,7 @@ static const clang::LangOptions &GetLang
 g_options.CPlusPlus = true;
 g_options.CPlusPlus11 = true;
 g_options.CPlusPlus14 = true;
-g_options.CPlusPlus1z = true;
+g_options.CPlusPlus17 = true;
   });
   return g_options;
 }


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


[Lldb-commits] [PATCH] D40757: Disable warnings related to anonymous types

2017-12-04 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

In https://reviews.llvm.org/D40757#943483, @labath wrote:

> If the "excuse" for not following llvm here is that these structs mirror 
> apple headers, should we restrict these warnings only to the relevant files 
> (e.g. everything in `source/Plugins/Language/ObjC`)?
>
> I don't particularly care about whether we do, but I wanted to throw the idea 
> out there, as this is the reason why I haven't done something similar yet 
> (although the warnings are quite annoying).


I'd like to make this a narrower change as well, but unfortunately, I haven't 
found a way to add in extra CXX flags through the add_library or 
llvm_add_library utilities. Somebody tried to do this once in AddLLDB.cmake 
(see "set(CMAKE_CXX_FLAGS ...)"), but it's busted, and does not do anything, 
AFAICT.

In this case, I think it should be safe to disable these warnings project-wide, 
because they're not often (ever?) immediate indicators of correctness issues / 
undefined behavior. Given all of that, @labath are you OK with the patch as-is?




Comment at: cmake/modules/LLDBConfig.cmake:241
+check_cxx_compiler_flag("-Wno-nested-anon-types"
+CXX_SUPPORTS_NO_GNU_ANONYMOUS_STRUCT)
+if (CXX_SUPPORTS_NO_GNU_ANONYMOUS_STRUCT)

I should point out that there's a typo here -- I've fixed this so it's spelled 
CXX_SUPPORTS_NO_NESTED_ANON_TYPES locally.


https://reviews.llvm.org/D40757



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


[Lldb-commits] [PATCH] D40812: Remove no-op null checks, NFC

2017-12-04 Thread Vedant Kumar via Phabricator via lldb-commits
vsk created this revision.

Null-checking functions which aren't marked 'weak_import' is a no-op
(the compiler rewrites the check to 'true'), regardless of whether a
library providing its definition is weak-linked.

Remove the no-op checks to clean up the code and silence
-Wpointer-to-bool.


https://reviews.llvm.org/D40812

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1022,10 +1022,7 @@
   std::string avail_name;
 
 #if defined(HAVE_LIBCOMPRESSION)
-  // libcompression is weak linked so test if compression_decode_buffer() is
-  // available
-  if (compression_decode_buffer != NULL &&
-  avail_type == CompressionType::None) {
+  if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   if (compression == "lzfse") {
 avail_type = CompressionType::LZFSE;
@@ -1037,10 +1034,7 @@
 #endif
 
 #if defined(HAVE_LIBCOMPRESSION)
-  // libcompression is weak linked so test if compression_decode_buffer() is
-  // available
-  if (compression_decode_buffer != NULL &&
-  avail_type == CompressionType::None) {
+  if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   if (compression == "zlib-deflate") {
 avail_type = CompressionType::ZlibDeflate;
@@ -1064,10 +1058,7 @@
 #endif
 
 #if defined(HAVE_LIBCOMPRESSION)
-  // libcompression is weak linked so test if compression_decode_buffer() is
-  // available
-  if (compression_decode_buffer != NULL &&
-  avail_type == CompressionType::None) {
+  if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   if (compression == "lz4") {
 avail_type = CompressionType::LZ4;
@@ -1079,10 +1070,7 @@
 #endif
 
 #if defined(HAVE_LIBCOMPRESSION)
-  // libcompression is weak linked so test if compression_decode_buffer() is
-  // available
-  if (compression_decode_buffer != NULL &&
-  avail_type == CompressionType::None) {
+  if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   if (compression == "lzma") {
 avail_type = CompressionType::LZMA;


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1022,10 +1022,7 @@
   std::string avail_name;
 
 #if defined(HAVE_LIBCOMPRESSION)
-  // libcompression is weak linked so test if compression_decode_buffer() is
-  // available
-  if (compression_decode_buffer != NULL &&
-  avail_type == CompressionType::None) {
+  if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   if (compression == "lzfse") {
 avail_type = CompressionType::LZFSE;
@@ -1037,10 +1034,7 @@
 #endif
 
 #if defined(HAVE_LIBCOMPRESSION)
-  // libcompression is weak linked so test if compression_decode_buffer() is
-  // available
-  if (compression_decode_buffer != NULL &&
-  avail_type == CompressionType::None) {
+  if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   if (compression == "zlib-deflate") {
 avail_type = CompressionType::ZlibDeflate;
@@ -1064,10 +1058,7 @@
 #endif
 
 #if defined(HAVE_LIBCOMPRESSION)
-  // libcompression is weak linked so test if compression_decode_buffer() is
-  // available
-  if (compression_decode_buffer != NULL &&
-  avail_type == CompressionType::None) {
+  if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   if (compression == "lz4") {
 avail_type = CompressionType::LZ4;
@@ -1079,10 +1070,7 @@
 #endif
 
 #if defined(HAVE_LIBCOMPRESSION)
-  // libcompression is weak linked so test if compression_decode_buffer() is
-  // available
-  if (compression_decode_buffer != NULL &&
-  avail_type == CompressionType::None) {
+  if (avail_type == CompressionType::None) {
 for (auto compression : supported_compressions) {
   if (compression == "lzma") {
 avail_type = CompressionType::LZMA;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D40812: Remove no-op null checks, NFC

2017-12-04 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

all:
echo 'int foo() { return 5; }' > mylib.c
echo "int foo() __attribute__((weak_import)); int printf(const char *, 
...); int main() { if (foo) printf (\"have foo() %d\\\n\", foo()); else 
printf(\"do not have foo\\\n\"); return 0; }" > main.c
clang -dynamiclib -o libmylib.dylib mylib.c
clang main.c -L. -lmylib
./a.out
echo 'int bar() { return 5; }' > mylib.c
clang -dynamiclib -o libmylib.dylib mylib.c
./a.out


https://reviews.llvm.org/D40812



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


[Lldb-commits] [PATCH] D40812: Remove no-op null checks, NFC

2017-12-04 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

I don't think that is correct.  here's an example in the form of a makefile.  
the main binary calls foo() which is weak linked from a library.  In the first 
run, foo() is present in the library.  In the second run, the library is 
rebuilt so foo() is absent.  The behavior of the program differs.

In this case, we needed an lldb which was built on a system with libcompression 
to be able to run on a system without libcompression.  Although for Apple's 
purposes, we are no longer supporting lldb on systems without libcompression so 
it's not really needed any longer for our uses.


https://reviews.llvm.org/D40812



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


[Lldb-commits] [PATCH] D40812: Remove no-op null checks, NFC

2017-12-04 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

The output looks like this:

% make
echo 'int foo() { return 5; }' > mylib.c
echo "int foo() __attribute__((weak_import)); int printf(const char *, ...); 
int main() { if (foo) printf (\"have foo() %d\\\n\", foo()); else printf(\"do 
not have foo\\\n\"); return 0; }" > main.c
clang -dynamiclib -o libmylib.dylib mylib.c
clang main.c -L. -lmylib
./a.out
have foo() 5
echo 'int bar() { return 5; }' > mylib.c
clang -dynamiclib -o libmylib.dylib mylib.c
./a.out
do not have foo


https://reviews.llvm.org/D40812



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


[Lldb-commits] [PATCH] D40812: Remove no-op null checks, NFC

2017-12-04 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

Ah, sorry, I should have mentioned that the header vending 
compression_decode_buffer() does not provide the 'weak_import' attribute (as 
far as I can see!). If you change your example to drop 'weak_import' from foo, 
I think it will be closer to the current situation.


https://reviews.llvm.org/D40812



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


[Lldb-commits] [PATCH] D40812: Remove no-op null checks, NFC

2017-12-04 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

Ah I see, I bet I assumed it was marked weak but it never was.  patch looks 
good to me.


https://reviews.llvm.org/D40812



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


[Lldb-commits] [PATCH] D40821: Fix const-correctness in RegisterContext methods, NFC

2017-12-04 Thread Vedant Kumar via Phabricator via lldb-commits
vsk created this revision.
Herald added a subscriber: javed.absar.

A few methods in RegisterContext classes accept const objects which are
cast to a non-const thread_state_t. Instead of dropping const-ness, it
might be simpler and more ergonomic to just not mark the objects const.

This fixes a slew of warnings.

One alternative is to drop const-ness in a C++-friendly way, e.g:

  const_cast(static_cast(&X))

This would still leave us in a situation where some RegisterContext
methods accept const objects and others don't, and it doesn't seem
feasible to apply const everywhere here, because of non-const methods
like SetRegisterDataFrom_LC_THREAD.


https://reviews.llvm.org/D40821

Files:
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.cpp
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.h
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp
  source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.h
  source/Plugins/Process/Utility/RegisterContextDarwin_arm.h
  source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
  source/Plugins/Process/Utility/RegisterContextDarwin_i386.h
  source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h
  source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
  source/Plugins/Process/Utility/RegisterContextMach_arm.h
  source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
  source/Plugins/Process/Utility/RegisterContextMach_i386.h
  source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
  source/Plugins/Process/Utility/RegisterContextMach_x86_64.h

Index: source/Plugins/Process/Utility/RegisterContextMach_x86_64.h
===
--- source/Plugins/Process/Utility/RegisterContextMach_x86_64.h
+++ source/Plugins/Process/Utility/RegisterContextMach_x86_64.h
@@ -31,11 +31,11 @@
 
   int DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc);
 
-  int DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr);
+  int DoWriteGPR(lldb::tid_t tid, int flavor, GPR &gpr);
 
-  int DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu);
+  int DoWriteFPU(lldb::tid_t tid, int flavor, FPU &fpu);
 
-  int DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc);
+  int DoWriteEXC(lldb::tid_t tid, int flavor, EXC &exc);
 };
 
 #endif // liblldb_RegisterContextMach_x86_64_h_
Index: source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
===
--- source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
+++ source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
@@ -45,17 +45,17 @@
 }
 
 int RegisterContextMach_x86_64::DoWriteGPR(lldb::tid_t tid, int flavor,
-   const GPR &gpr) {
+   GPR &gpr) {
   return ::thread_set_state(tid, flavor, (thread_state_t)&gpr, GPRWordCount);
 }
 
 int RegisterContextMach_x86_64::DoWriteFPU(lldb::tid_t tid, int flavor,
-   const FPU &fpu) {
+   FPU &fpu) {
   return ::thread_set_state(tid, flavor, (thread_state_t)&fpu, FPUWordCount);
 }
 
 int RegisterContextMach_x86_64::DoWriteEXC(lldb::tid_t tid, int flavor,
-   const EXC &exc) {
+   EXC &exc) {
   return ::thread_set_state(tid, flavor, (thread_state_t)&exc, EXCWordCount);
 }
 
Index: source/Plugins/Process/Utility/RegisterContextMach_i386.h
===
--- source/Plugins/Process/Utility/RegisterContextMach_i386.h
+++ source/Plugins/Process/Utility/RegisterContextMach_i386.h
@@ -30,11 +30,11 @@
 
   int DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc);
 
-  int DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr);
+  int DoWriteGPR(lldb::tid_t tid, int flavor, GPR &gpr);
 
-  int DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu);
+  int DoWriteFPU(lldb::tid_t tid, int flavor, FPU &fpu);
 
-  int DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc);
+  int DoWriteEXC(lldb::tid_t tid, int flavor, EXC &exc);
 };
 
 #endif // liblldb_RegisterContextMach_i386_h_
Index: source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
===
--- source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
+++ source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
@@ -42,17 +42,17 @@
 }
 
 int RegisterContextMach_i386::DoWriteGPR(lldb::tid_t tid, int flavor,
- const GPR &gpr) {
+   

Re: [Lldb-commits] [PATCH] D40821: Fix const-correctness in RegisterContext methods, NFC

2017-12-04 Thread Zachary Turner via lldb-commits
It almost looks to me like this should be using aggregation instead of
inheritance. That would add a 3rd option (mark it mutable). That said,
nothing wrong with using this approach either
On Mon, Dec 4, 2017 at 5:43 PM Vedant Kumar via Phabricator via
lldb-commits  wrote:

> vsk created this revision.
> Herald added a subscriber: javed.absar.
>
> A few methods in RegisterContext classes accept const objects which are
> cast to a non-const thread_state_t. Instead of dropping const-ness, it
> might be simpler and more ergonomic to just not mark the objects const.
>
> This fixes a slew of warnings.
>
> One alternative is to drop const-ness in a C++-friendly way, e.g:
>
>   const_cast(static_cast(&X))
>
> This would still leave us in a situation where some RegisterContext
> methods accept const objects and others don't, and it doesn't seem
> feasible to apply const everywhere here, because of non-const methods
> like SetRegisterDataFrom_LC_THREAD.
>
>
> https://reviews.llvm.org/D40821
>
> Files:
>   source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.cpp
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.h
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.h
>   source/Plugins/Process/Utility/RegisterContextDarwin_arm.h
>   source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
>   source/Plugins/Process/Utility/RegisterContextDarwin_i386.h
>   source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h
>   source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
>   source/Plugins/Process/Utility/RegisterContextMach_arm.h
>   source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
>   source/Plugins/Process/Utility/RegisterContextMach_i386.h
>   source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
>   source/Plugins/Process/Utility/RegisterContextMach_x86_64.h
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D40821: Fix const-correctness in RegisterContext methods, NFC

2017-12-04 Thread Vedant Kumar via lldb-commits

> On Dec 4, 2017, at 6:02 PM, Zachary Turner  wrote:
> 
> It almost looks to me like this should be using aggregation instead of 
> inheritance. That would add a 3rd option (mark it mutable).

I don't have my head wrapped around your suggestion. Do you mean that 'const 
GPR &' and friends should be made mutable members of RegisterContext?

thanks,
vedant

> That said, nothing wrong with using this approach either 
> On Mon, Dec 4, 2017 at 5:43 PM Vedant Kumar via Phabricator via lldb-commits 
> mailto:lldb-commits@lists.llvm.org>> wrote:
> vsk created this revision.
> Herald added a subscriber: javed.absar.
> 
> A few methods in RegisterContext classes accept const objects which are
> cast to a non-const thread_state_t. Instead of dropping const-ness, it
> might be simpler and more ergonomic to just not mark the objects const.
> 
> This fixes a slew of warnings.
> 
> One alternative is to drop const-ness in a C++-friendly way, e.g:
> 
>   const_cast(static_cast(&X))
> 
> This would still leave us in a situation where some RegisterContext
> methods accept const objects and others don't, and it doesn't seem
> feasible to apply const everywhere here, because of non-const methods
> like SetRegisterDataFrom_LC_THREAD.
> 
> 
> https://reviews.llvm.org/D40821 
> 
> Files:
>   source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.cpp
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.h
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp
>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.h
>   source/Plugins/Process/Utility/RegisterContextDarwin_arm.h
>   source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
>   source/Plugins/Process/Utility/RegisterContextDarwin_i386.h
>   source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h
>   source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
>   source/Plugins/Process/Utility/RegisterContextMach_arm.h
>   source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
>   source/Plugins/Process/Utility/RegisterContextMach_i386.h
>   source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
>   source/Plugins/Process/Utility/RegisterContextMach_x86_64.h
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org 
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits 
> 

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


[Lldb-commits] [lldb] r319730 - Clean up stop hook output in case a hook restarts.

2017-12-04 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Mon Dec  4 18:34:05 2017
New Revision: 319730

URL: http://llvm.org/viewvc/llvm-project?rev=319730&view=rev
Log:
Clean up stop hook output in case a hook restarts.

I was warning about the fact that this will abort
further stop hooks, but didn't check that there WAS
a further stop hook.  Also the warning was missing a
newline.

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

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=319730&r1=319729&r2=319730&view=diff
==
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Dec  4 18:34:05 2017
@@ -2679,6 +2679,10 @@ void Target::RunStopHooks() {
 
   if (!m_process_sp)
 return;
+
+  // Somebody might have restarted the process:
+  if (m_process_sp->GetState() != eStateStopped)
+return;
 
   //  make sure we check that we are not stopped
   // because of us running a user expression
@@ -2784,9 +2788,12 @@ void Target::RunStopHooks() {
 // running the stop hooks.
 if ((result.GetStatus() == eReturnStatusSuccessContinuingNoResult) ||
 (result.GetStatus() == eReturnStatusSuccessContinuingResult)) {
-  result.AppendMessageWithFormat("Aborting stop hooks, hook %" PRIu64
- " set the program running.",
- cur_hook_sp->GetID());
+  // But only complain if there were more stop hooks to do:
+  StopHookCollection::iterator tmp = pos;
+  if (++tmp != end)
+result.AppendMessageWithFormat("\nAborting stop hooks, hook %" 
PRIu64
+   " set the program running.\n",
+   cur_hook_sp->GetID());
   keep_going = false;
 }
   }


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


Re: [Lldb-commits] [PATCH] D40821: Fix const-correctness in RegisterContext methods, NFC

2017-12-04 Thread Zachary Turner via lldb-commits
Admittedly I was on mobile when I wrote that so I didn't have code to look
at.  I assumed from the pattern and the few function signatures I saw that
GPR etc were inheriting from thread_state_t, and that was how the cast
worked at all.  A quick look at the code suggests this is not the case
though.

On Mon, Dec 4, 2017 at 6:08 PM Vedant Kumar  wrote:

> On Dec 4, 2017, at 6:02 PM, Zachary Turner  wrote:
>
> It almost looks to me like this should be using aggregation instead of
> inheritance. That would add a 3rd option (mark it mutable).
>
>
> I don't have my head wrapped around your suggestion. Do you mean that
> 'const GPR &' and friends should be made mutable members of RegisterContext?
>
> thanks,
> vedant
>
> That said, nothing wrong with using this approach either
> On Mon, Dec 4, 2017 at 5:43 PM Vedant Kumar via Phabricator via
> lldb-commits  wrote:
>
>> vsk created this revision.
>> Herald added a subscriber: javed.absar.
>>
>> A few methods in RegisterContext classes accept const objects which are
>> cast to a non-const thread_state_t. Instead of dropping const-ness, it
>> might be simpler and more ergonomic to just not mark the objects const.
>>
>> This fixes a slew of warnings.
>>
>> One alternative is to drop const-ness in a C++-friendly way, e.g:
>>
>>   const_cast(static_cast(&X))
>>
>> This would still leave us in a situation where some RegisterContext
>> methods accept const objects and others don't, and it doesn't seem
>> feasible to apply const everywhere here, because of non-const methods
>> like SetRegisterDataFrom_LC_THREAD.
>>
>>
>> https://reviews.llvm.org/D40821
>>
>> Files:
>>   source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
>>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.cpp
>>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h
>>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.cpp
>>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h
>>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.cpp
>>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.h
>>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.cpp
>>   source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.h
>>   source/Plugins/Process/Utility/RegisterContextDarwin_arm.h
>>   source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h
>>   source/Plugins/Process/Utility/RegisterContextDarwin_i386.h
>>   source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.h
>>   source/Plugins/Process/Utility/RegisterContextMach_arm.cpp
>>   source/Plugins/Process/Utility/RegisterContextMach_arm.h
>>   source/Plugins/Process/Utility/RegisterContextMach_i386.cpp
>>   source/Plugins/Process/Utility/RegisterContextMach_i386.h
>>   source/Plugins/Process/Utility/RegisterContextMach_x86_64.cpp
>>   source/Plugins/Process/Utility/RegisterContextMach_x86_64.h
>>
>> ___
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r319731 - Add target.process.stop-on-exec setting, and obey it.

2017-12-04 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Mon Dec  4 18:50:45 2017
New Revision: 319731

URL: http://llvm.org/viewvc/llvm-project?rev=319731&view=rev
Log:
Add target.process.stop-on-exec setting, and obey it.

Also add a test.  There should also be control for this
in ProcessLaunchInfo and a "target launch" flag, but at least
this will allow you to control it somehow.



Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/StopInfo.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=319731&r1=319730&r2=319731&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Mon Dec  4 18:50:45 2017
@@ -99,6 +99,8 @@ public:
 
   bool GetWarningsOptimization() const;
 
+  bool GetStopOnExec() const;
+
 protected:
   static void OptionValueChangedCallback(void *baton,
  OptionValue *option_value);

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py?rev=319731&r1=319730&r2=319731&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/exec/TestExec.py 
Mon Dec  4 18:50:45 2017
@@ -29,7 +29,16 @@ class ExecTestCase(TestBase):
 @skipUnlessDarwin
 @expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
 @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], 
bugnumber="rdar://problem/34559552") # this exec test has problems on ios 
systems
-def test(self):
+def test_hitting_exec (self):
+self.do_test(False)
+
+@skipUnlessDarwin
+@expectedFailureAll(archs=['i386'], bugnumber="rdar://28656532")
+@expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], 
bugnumber="rdar://problem/34559552") # this exec test has problems on ios 
systems
+def test_skipping_exec (self):
+self.do_test(False)
+
+def do_test(self, skip_exec):
 if self.getArchitecture() == 'x86_64':
 source = os.path.join(os.getcwd(), "main.cpp")
 o_file = os.path.join(os.getcwd(), "main.o")
@@ -60,6 +69,16 @@ class ExecTestCase(TestBase):
 None, None, self.get_process_working_directory())
 self.assertTrue(process, PROCESS_IS_VALID)
 
+if skip_exec:
+self.debugger.HandleCommand("settings set 
target.process.stop-on-exec false")
+def cleanup():
+self.runCmd("settings set target.process.stop-on-exec false",
+check=False)
+
+# Execute the cleanup function during test case tear down.
+self.addTearDownHook(cleanup)
+
+
 for i in range(6):
 # The stop reason of the thread should be breakpoint.
 self.assertTrue(process.GetState() == lldb.eStateStopped,
@@ -84,17 +103,18 @@ class ExecTestCase(TestBase):
 # Run and we should stop due to exec
 process.Continue()
 
-self.assertTrue(process.GetState() == lldb.eStateStopped,
-"Process should be stopped at __dyld_start")
+if not skip_exec:
+self.assertTrue(process.GetState() == lldb.eStateStopped,
+"Process should be stopped at __dyld_start")
+
+threads = lldbutil.get_stopped_threads(
+process, lldb.eStopReasonExec)
+self.assertTrue(
+len(threads) == 1,
+"We got a thread stopped for exec.")
 
-threads = lldbutil.get_stopped_threads(
-process, lldb.eStopReasonExec)
-self.assertTrue(
-len(threads) == 1,
-"We got a thread stopped for exec.")
-
-# Run and we should stop at breakpoint in main after exec
-process.Continue()
+# Run and we should stop at breakpoint in main after exec
+process.Continue()
 
 threads = lldbutil.get_threads_stopped_at_breakpoint(
 process, breakpoint)

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=319731&r1=319730&r2=319731&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Mon Dec  4 18:50:45 2017
@@ -144,6 +144,9 @@ s