[Lldb-commits] [PATCH] D58330: 01/03: new SectionPart for Section subranges (for effective .debug_types concatenation)

2019-02-18 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D58330#1400812 , @labath wrote:

> It also appears that we will still end up mmapping the object file, and then 
> copying all of the debug info out of it into a heap buffer.


In all usual cases at least on Linux LLDB should use just the mmap part, 
without any copying - see the block on line 691 of 
`SymbolFileDWARF::get_debug_info_data()`: 
https://reviews.llvm.org/D51578#C1361566NL682

The question is how hard to optimize the corner cases of `IsInMemory()`, 
`SHF_COMPRESSED` with `.debug_types` etc.  Originally I did not optimize it but 
I think this is what @clayborg did not like: 
https://reviews.llvm.org/D51578#1383458

> What's the reason we're trying so hard to concatenate things? IIRC, it was 
> because it makes things appear DWARF5-like, but this is now creating a lot of 
> infrastructure that will be completely unused in the dwarf5 case, so I think 
> we're missing that goal.

In part yes, I agree. I cannot much agree with the "//completely unused in the 
dwarf5 case//" as for DWZ I need the same so if we do not implement it for 
`.debug_types` I need to implement it for DWZ anyway. Which is why I also do 
that - to justify some way such refactorization for DWZ. Red Hat does not use 
`.debug_types` and DWARF-5 does not have this problem anyway as you say.

Currently DWZ solves it on line 164 - DWZRedirect(): 
https://reviews.llvm.org/D40474#C1183882NL164
Although there the two sections to be merged (main `.debug_info` and 
`.debug_info` from DWZ common file - from `/usr/lib/debug/.dwz/` directory) 
come from two different files.  I haven't coded that yet.
Currently DWZ also needs D40473  full of 
`GetMainDWARF()` vs. original `GetDWARF()` and I hope I could drop this by also 
merging `.debug_abbrev` (and maybe some others).  But I haven't yet tried to 
rebase the DWZ patchset on top of this merging patchset if there isn't some 
catch.

From the higher point of view: `.debug_types` is not needed thanks to DWARF-5 
and Red Hat could replace DWZ with `-fdebug-types-section` or at least just not 
to use DWZ `-m|--multifile` option (the DWZ common files so we would stay at 
just one file). But then we live in a real world and people want to debug 
existing code built with `.debug_types` and RHELs deployed out there do use DWZ 
with `-m|--multifile`. And both do work in GDB now.

> Can't we just admit that we are dealing with two sections here, and use one 
> bit from the user_id_t (or whereever it's needed) to tell which one are we 
> talking about?

Been there, done that - with `offset_t` (although by offseting it and not by 
one bit but that is similar) - the `FORWARDER()` dispatching of 
`DWARFDataExtractor`: https://reviews.llvm.org/D51578?id=170342#C1214469NL1
The problem is that it has some percents of performance impact which @clayborg 
did not like.
I think `user_id_t` is too high for this functionality as all the inter-DWARF 
references already use only `offset_t` inside the DWARF code.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58330



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


[Lldb-commits] [PATCH] D58330: 01/03: new SectionPart for Section subranges (for effective .debug_types concatenation)

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

In D58330#1400825 , @jankratochvil 
wrote:

> In D58330#1400812 , @labath wrote:
>
> > It also appears that we will still end up mmapping the object file, and 
> > then copying all of the debug info out of it into a heap buffer.
>
>
> In all usual cases at least on Linux LLDB should use just the mmap part, 
> without any copying - see the block on line 691 of 
> `SymbolFileDWARF::get_debug_info_data()`: 
> https://reviews.llvm.org/D51578#C1361566NL682
>
> The question is how hard to optimize the corner cases of `IsInMemory()`, 
> `SHF_COMPRESSED` with `.debug_types` etc.  Originally I did not optimize it 
> but I think this is what @clayborg did not like: 
> https://reviews.llvm.org/D51578#1383458


Ok, I see what you mean. It's nice that we don't have this regression in the 
base case. Though I guess we will still do the copying as soon as debug_types 
sections appear. From one POV, that's fine, because it's a strict improvement 
over just not supporting debug_types at all. However, the fact that will have 
to do that in some cases anyway makes me think whether we have the right 
abstraction here.

> 
> 
>> What's the reason we're trying so hard to concatenate things? IIRC, it was 
>> because it makes things appear DWARF5-like, but this is now creating a lot 
>> of infrastructure that will be completely unused in the dwarf5 case, so I 
>> think we're missing that goal.
> 
> In part yes, I agree. I cannot much agree with the "//completely unused in 
> the dwarf5 case//" as for DWZ I need the same so if we do not implement it 
> for `.debug_types` I need to implement it for DWZ anyway. Which is why I also 
> do that - to justify some way such refactorization for DWZ. Red Hat does not 
> use `.debug_types` and DWARF-5 does not have this problem anyway as you say.
> 
> Currently DWZ solves it on line 164 - DWZRedirect(): 
> https://reviews.llvm.org/D40474#C1183882NL164
>  Although there the two sections to be merged (main `.debug_info` and 
> `.debug_info` from DWZ common file - from `/usr/lib/debug/.dwz/` directory) 
> come from two different files.  I haven't coded that yet.
>  Currently DWZ also needs D40473  full of 
> `GetMainDWARF()` vs. original `GetDWARF()` and I hope I could drop this by 
> also merging `.debug_abbrev` (and maybe some others).  But I haven't yet 
> tried to rebase the DWZ patchset on top of this merging patchset if there 
> isn't some catch.
> 
> From the higher point of view: `.debug_types` is not needed thanks to DWARF-5 
> and Red Hat could replace DWZ with `-fdebug-types-section` or at least just 
> not to use DWZ `-m|--multifile` option (the DWZ common files so we would stay 
> at just one file). But then we live in a real world and people want to debug 
> existing code built with `.debug_types` and RHELs deployed out there do use 
> DWZ with `-m|--multifile`. And both do work in GDB now.

I am not suggesting we shouldn't implement debug_types _at all_ because it is 
"solved" by DWARF5. However, i am questioning the "concatenation is the best 
vehicle to implement this support because it makes things similar to DWARF5" 
line of reasoning, because it seems to me that we will be greatly diverging 
from the DWARF5 code path anyway.

> 
> 
>> Can't we just admit that we are dealing with two sections here, and use one 
>> bit from the user_id_t (or whereever it's needed) to tell which one are we 
>> talking about?
> 
> Been there, done that - with `offset_t` (although by offseting it and not by 
> one bit but that is similar) - the `FORWARDER()` dispatching of 
> `DWARFDataExtractor`: https://reviews.llvm.org/D51578?id=170342#C1214469NL1
>  The problem is that it has some percents of performance impact which 
> @clayborg did not like.

The forwarding implementation is the closest to what I have in mind, but it is 
not exactly that. I am imagining this to work at a slightly different level. 
Instead of changing the DataExtractor class at all, i'd have a new object, 
let's call it DataRegistry for the purposes of this explanation. Then when you 
want to look up some, which can potentially reside in another chunk of data 
(this should always be clear from the context, because DWARF is not meant to be 
consumed as concatenated) you do something like:

  switch(form) {
  case DW_FORM_which_refers_to_this_compile_unit:
return {current_data_extractor, form_value};
  case DW_FORM_which_refers_to_stuff_that_may_live_elsewhere:
return 
{data_registry.lookup_the_data_extractor_for_the_potentially_external_entity(form_value),
 figure_out_the_offset_in_that_entity(form_value)};
  }

The registry should contain the code necessary to produce the right section 
given the information known to the caller (I guess these would be things like 
the dwarf form, type unit signature, whatever info DWZs use to locate the 
external data, etc.)

The user_id_t comes 

[Lldb-commits] [PATCH] D58279: Set cmake policy CMP0075 to NEW

2019-02-18 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL354251: Set cmake policy CMP0075 to NEW (authored by labath, 
committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D58279

Files:
  lldb/trunk/CMakeLists.txt


Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -1,5 +1,9 @@
 cmake_minimum_required(VERSION 3.4.3)
 
+if(POLICY CMP0075)
+  cmake_policy(SET CMP0075 NEW)
+endif()
+
 # Add path for custom modules
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}


Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -1,5 +1,9 @@
 cmake_minimum_required(VERSION 3.4.3)
 
+if(POLICY CMP0075)
+  cmake_policy(SET CMP0075 NEW)
+endif()
+
 # Add path for custom modules
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r354251 - Set cmake policy CMP0075 to NEW

2019-02-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Feb 18 02:09:29 2019
New Revision: 354251

URL: http://llvm.org/viewvc/llvm-project?rev=354251&view=rev
Log:
Set cmake policy CMP0075 to NEW

Summary:
The policy is about cmake_include_files ignoring
CMAKE_REQUIRED_LIBRARIES in the OLD behavior. Llvm already sets this
policy to NEW, but that is overridden by our cmake_minimum_required
command.

This makes our cmake policy setup consistent with the llvm build files
and avoids a warning when using newer versions of cmake.

Reviewers: sgraenitz, xiaobai

Subscribers: mgorny, lldb-commits

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

Modified:
lldb/trunk/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=354251&r1=354250&r2=354251&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Mon Feb 18 02:09:29 2019
@@ -1,5 +1,9 @@
 cmake_minimum_required(VERSION 3.4.3)
 
+if(POLICY CMP0075)
+  cmake_policy(SET CMP0075 NEW)
+endif()
+
 # Add path for custom modules
 set(CMAKE_MODULE_PATH
   ${CMAKE_MODULE_PATH}


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


[Lldb-commits] [PATCH] D58167: Refactor user/group name resolving code

2019-02-18 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added inline comments.



Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp:439
   if (uid != UINT32_MAX) {
-std::string name;
-if (HostInfo::LookupUserName(uid, name)) {
+if (auto name = HostInfo::GetUserIDResolver().GetUserName(uid)) {
   StreamString response;

jingham wrote:
> labath wrote:
> > jingham wrote:
> > > Do we need auto here?  Since we have a bunch of API's returning 
> > > StringRef's now when I see strings returned I get paranoid about their 
> > > lifespan.  auto hides the fact that I don't need to worry...
> > I've removed the auto, though I am not sure if that alleviates your fears, 
> > as the returned type is StringRef. There is still nothing to worry about 
> > though, as the backing storage is held by the resolver object.
> So how do I reason about the lifespan of this StringRef, then?  Now I have to 
> know that GetUserIDResolver doesn't make a temporary UserIDResolver, but a 
> reference to one that persists - for how long again?
Yes, that would be line of reasoning I envisioned. The returned resolver (and, 
transitively, the storage backing the StringRef) ought to exist at least while 
the "HostInfo" class is valid, so from HostInfo::Initialize() and until 
HostInfo::Finalize(). In practice it will be even longer because the resolver 
is constructed lazily on first use, and will be destroyed only by llvm_shutdown 
(which we don't call ever), but that's not what I would promise. For the 
"platform" version of the GetUserIDResolver function, the resolver ought to 
exist for as long as the platform instance you got it from is alive.

I can put this into the method comments, but it seems pretty straigh-forward to 
me (e.g. I would expect this comment to apply to all HostInfo functions. I 
definitely know that HostInfo::GetArchitecture blows up if called before 
`Initialize()`).


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

https://reviews.llvm.org/D58167



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


Re: [Lldb-commits] [lldb] r353642 - lldb: Fix compilation on OpenBSD

2019-02-18 Thread Hans Wennborg via lldb-commits
Merged to release_80 in r354253.

On Sun, Feb 10, 2019 at 4:23 PM Raphael Isemann via lldb-commits
 wrote:
>
> Author: teemperor
> Date: Sun Feb 10 07:23:58 2019
> New Revision: 353642
>
> URL: http://llvm.org/viewvc/llvm-project?rev=353642&view=rev
> Log:
> lldb: Fix compilation on OpenBSD
>
> Summary: Update the OpenBSD Host.cpp for the new SetFile() function 
> signature. Fixes compiling lldb on OpenBSD.
>
> Reviewers: krytarowski
>
> Reviewed By: krytarowski
>
> Subscribers: lldb-commits
>
> Tags: #lldb
>
> Differential Revision: https://reviews.llvm.org/D57907
>
> Modified:
> lldb/trunk/source/Host/openbsd/Host.cpp
>
> Modified: lldb/trunk/source/Host/openbsd/Host.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/openbsd/Host.cpp?rev=353642&r1=353641&r2=353642&view=diff
> ==
> --- lldb/trunk/source/Host/openbsd/Host.cpp (original)
> +++ lldb/trunk/source/Host/openbsd/Host.cpp Sun Feb 10 07:23:58 2019
> @@ -67,8 +67,7 @@ GetOpenBSDProcessArgs(const ProcessInsta
>
>cstr = data.GetCStr(&offset);
>if (cstr) {
> -process_info.GetExecutableFile().SetFile(cstr, false,
> - FileSpec::Style::native);
> +process_info.GetExecutableFile().SetFile(cstr, 
> FileSpec::Style::native);
>
>  if (!(match_info_ptr == NULL ||
>NameMatches(
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r354029 - [lldb] [MainLoop] Report errno for failed kevent()

2019-02-18 Thread Hans Wennborg via lldb-commits
Merged to release_80 in r354254.

On Thu, Feb 14, 2019 at 2:51 PM Michal Gorny via lldb-commits
 wrote:
>
> Author: mgorny
> Date: Thu Feb 14 05:52:31 2019
> New Revision: 354029
>
> URL: http://llvm.org/viewvc/llvm-project?rev=354029&view=rev
> Log:
> [lldb] [MainLoop] Report errno for failed kevent()
>
> Modify the kevent() error reporting to use errno rather than returning
> the return value.  At least on FreeBSD and NetBSD, kevent() always
> returns -1 in case of error, and the actual error is returned via errno.
>
> Differential Revision: https://reviews.llvm.org/D58229
>
> Modified:
> lldb/trunk/source/Host/common/MainLoop.cpp
>
> Modified: lldb/trunk/source/Host/common/MainLoop.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/MainLoop.cpp?rev=354029&r1=354028&r2=354029&view=diff
> ==
> --- lldb/trunk/source/Host/common/MainLoop.cpp (original)
> +++ lldb/trunk/source/Host/common/MainLoop.cpp Thu Feb 14 05:52:31 2019
> @@ -108,7 +108,7 @@ Status MainLoop::RunImpl::Poll() {
>out_events, llvm::array_lengthof(out_events), nullptr);
>
>if (num_events < 0)
> -return Status("kevent() failed with error %d\n", num_events);
> +return Status(errno, eErrorTypePOSIX);
>return Status();
>  }
>
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r354122 - [lldb] [MainLoop] Add kevent() EINTR handling

2019-02-18 Thread Hans Wennborg via lldb-commits
Merged to release_80 in r354255.

On Fri, Feb 15, 2019 at 1:12 PM Michal Gorny via lldb-commits
 wrote:
>
> Author: mgorny
> Date: Fri Feb 15 04:13:02 2019
> New Revision: 354122
>
> URL: http://llvm.org/viewvc/llvm-project?rev=354122&view=rev
> Log:
> [lldb] [MainLoop] Add kevent() EINTR handling
>
> Add missing EINTR handling for kevent() calls.  If the call is
> interrupted, return from Poll() as if zero events were returned and let
> the polling resume on next iteration.  This fixes test flakiness
> on NetBSD.
>
> Includes a test case suggested by Pavel Labath on D42206.
>
> Differential Revision: https://reviews.llvm.org/D58230
>
> Modified:
> lldb/trunk/source/Host/common/MainLoop.cpp
> lldb/trunk/unittests/Host/MainLoopTest.cpp
>
> Modified: lldb/trunk/source/Host/common/MainLoop.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/MainLoop.cpp?rev=354122&r1=354121&r2=354122&view=diff
> ==
> --- lldb/trunk/source/Host/common/MainLoop.cpp (original)
> +++ lldb/trunk/source/Host/common/MainLoop.cpp Fri Feb 15 04:13:02 2019
> @@ -107,8 +107,14 @@ Status MainLoop::RunImpl::Poll() {
>num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(),
>out_events, llvm::array_lengthof(out_events), nullptr);
>
> -  if (num_events < 0)
> -return Status(errno, eErrorTypePOSIX);
> +  if (num_events < 0) {
> +if (errno == EINTR) {
> +  // in case of EINTR, let the main loop run one iteration
> +  // we need to zero num_events to avoid assertions failing
> +  num_events = 0;
> +} else
> +  return Status(errno, eErrorTypePOSIX);
> +  }
>return Status();
>  }
>
>
> Modified: lldb/trunk/unittests/Host/MainLoopTest.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/MainLoopTest.cpp?rev=354122&r1=354121&r2=354122&view=diff
> ==
> --- lldb/trunk/unittests/Host/MainLoopTest.cpp (original)
> +++ lldb/trunk/unittests/Host/MainLoopTest.cpp Fri Feb 15 04:13:02 2019
> @@ -141,4 +141,28 @@ TEST_F(MainLoopTest, Signal) {
>ASSERT_TRUE(loop.Run().Success());
>ASSERT_EQ(1u, callback_count);
>  }
> +
> +// Test that a signal which is not monitored by the MainLoop does not
> +// cause a premature exit.
> +TEST_F(MainLoopTest, UnmonitoredSignal) {
> +  MainLoop loop;
> +  Status error;
> +  struct sigaction sa;
> +  sa.sa_sigaction = [](int, siginfo_t *, void *) { };
> +  sa.sa_flags = SA_SIGINFO; // important: no SA_RESTART
> +  sigemptyset(&sa.sa_mask);
> +  ASSERT_EQ(0, sigaction(SIGUSR2, &sa, nullptr));
> +
> +  auto handle = loop.RegisterSignal(SIGUSR1, make_callback(), error);
> +  ASSERT_TRUE(error.Success());
> +  std::thread killer([]() {
> +sleep(1);
> +kill(getpid(), SIGUSR2);
> +sleep(1);
> +kill(getpid(), SIGUSR1);
> +  });
> +  ASSERT_TRUE(loop.Run().Success());
> +  killer.join();
> +  ASSERT_EQ(1u, callback_count);
> +}
>  #endif
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D58339: Changes for running LLDB test suite for Swift on PowerPC64LE

2019-02-18 Thread Sarvesh Tamba via Phabricator via lldb-commits
sarveshtamba added a comment.

Hi @labath , Should I be submitting this patch request directly to 
"https://github.com/apple/swift-lldb";?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58339



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


[Lldb-commits] [lldb] r354256 - Return better error message from GDBRemoteCommunication::ConnectLocally

2019-02-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Feb 18 02:36:23 2019
New Revision: 354256

URL: http://llvm.org/viewvc/llvm-project?rev=354256&view=rev
Log:
Return better error message from GDBRemoteCommunication::ConnectLocally

Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=354256&r1=354255&r2=354256&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Mon 
Feb 18 02:36:23 2019
@@ -1287,9 +1287,10 @@ GDBRemoteCommunication::ConnectLocally(G
 
   std::unique_ptr conn_up(
   new ConnectionFileDescriptor());
-  if (conn_up->Connect(remote_addr, nullptr) != lldb::eConnectionStatusSuccess)
-return llvm::make_error("Unable to connect",
-   llvm::inconvertibleErrorCode());
+  Status status;
+  if (conn_up->Connect(remote_addr, &status) != lldb::eConnectionStatusSuccess)
+return llvm::createStringError(llvm::inconvertibleErrorCode(),
+   "Unable to connect: %s", 
status.AsCString());
 
   client.SetConnection(conn_up.release());
   if (llvm::Error error = accept_status.get().ToError())


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


[Lldb-commits] [PATCH] D58339: Changes for running LLDB test suite for Swift on PowerPC64LE

2019-02-18 Thread Pavel Labath via Phabricator via lldb-commits
labath added a subscriber: davide.
labath added a comment.

I think so, but @davide (or someone else) can confirm that. In any case, it 
definitely shouldn't be here, as the llvm repo does not contain any of the 
swift code.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58339



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


[Lldb-commits] [PATCH] D58050: PECOFF: Implement GetBaseAddress

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

Thank you. It looks like windows is green now, so I'll go ahead and commit this.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58050



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


[Lldb-commits] [PATCH] D58330: 01/03: new SectionPart for Section subranges (for effective .debug_types concatenation)

2019-02-18 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

In D58330#1400847 , @labath wrote:

> Ok, I see what you mean. It's nice that we don't have this regression in the 
> base case. Though I guess we will still do the copying as soon as debug_types 
> sections appear.


That is not the case. If both `.debug_info` and `.debug_types` are uncompressed 
then the concatenated section just points to the start of `.debug_info` and 
ends at the end of `.debug_types` section, ignoring some "garbage" between 
those two sections (containing sections bettern `.debug_info` and 
`.debug_types`).

I will try to investigate your DW_FORM_* suggestion more thoroughly, thanks.  
It should have the same performance just the code may be more simple.

> I assume there has to be a place where you take something which refers to a 
> DIE in a different section, and then add the magic offset to account for the 
> concatenation, because the magic offset will not be present in dwarf.

D40474  patches `DWARFFormValue::Reference()`. 
Common `DW_FORM_ref*` are CU-relative so they need no change.  One needs the 
magic offset (`dwz_debug_info_data.GetByteSize()`) only for `DW_FORM_ref_addr`. 
And then also DWZ-specific `DW_FORM_GNU_ref_alt`.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58330



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


[Lldb-commits] [lldb] r354258 - PECOFF: Implement GetBaseAddress

2019-02-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Feb 18 03:06:57 2019
New Revision: 354258

URL: http://llvm.org/viewvc/llvm-project?rev=354258&view=rev
Log:
PECOFF: Implement GetBaseAddress

COFF files are modelled in lldb as having one big container section
spanning the entire module image, with the actual sections being
subsections of that. In this model, the base address is simply the
address of the first byte of that section.

This also removes the hack where ObjectFilePECOFF was using the
m_file_offset field to communicate this information. Using file offset
for this purpose is completely wrong, as that is supposed to indicate
where is this ObjectFile located in the file on disk. This field is only
meaningful for fat binaries, and should normally be 0.

Both PDB plugins have been updated to use GetBaseAddress instead of
GetFileOffset.

Added:
lldb/trunk/lit/Modules/PECOFF/basic-info.yaml
Modified:
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp

Added: lldb/trunk/lit/Modules/PECOFF/basic-info.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/PECOFF/basic-info.yaml?rev=354258&view=auto
==
--- lldb/trunk/lit/Modules/PECOFF/basic-info.yaml (added)
+++ lldb/trunk/lit/Modules/PECOFF/basic-info.yaml Mon Feb 18 03:06:57 2019
@@ -0,0 +1,86 @@
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+
+# CHECK: Plugin name: pe-coff
+# CHECK: Architecture: x86_64-pc-windows-msvc
+# CHECK: UUID: 
+# CHECK: Executable: true
+# CHECK: Stripped: false
+# CHECK: Type: executable
+# CHECK: Strata: user
+# CHECK: Base VM address: 0x47000
+
+--- !COFF
+OptionalHeader:  
+  AddressOfEntryPoint: 4096
+  ImageBase:   290816
+  SectionAlignment: 4096
+  FileAlignment:   512
+  MajorOperatingSystemVersion: 6
+  MinorOperatingSystemVersion: 0
+  MajorImageVersion: 0
+  MinorImageVersion: 0
+  MajorSubsystemVersion: 6
+  MinorSubsystemVersion: 0
+  Subsystem:   IMAGE_SUBSYSTEM_WINDOWS_CUI
+  DLLCharacteristics: [ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA, 
IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE, IMAGE_DLL_CHARACTERISTICS_NX_COMPAT, 
IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE ]
+  SizeOfStackReserve: 1048576
+  SizeOfStackCommit: 4096
+  SizeOfHeapReserve: 1048576
+  SizeOfHeapCommit: 4096
+  ExportTable: 
+RelativeVirtualAddress: 0
+Size:0
+  ImportTable: 
+RelativeVirtualAddress: 0
+Size:0
+  ResourceTable:   
+RelativeVirtualAddress: 0
+Size:0
+  ExceptionTable:  
+RelativeVirtualAddress: 0
+Size:0
+  CertificateTable: 
+RelativeVirtualAddress: 0
+Size:0
+  BaseRelocationTable: 
+RelativeVirtualAddress: 0
+Size:0
+  Debug:   
+RelativeVirtualAddress: 0
+Size:0
+  Architecture:
+RelativeVirtualAddress: 0
+Size:0
+  GlobalPtr:   
+RelativeVirtualAddress: 0
+Size:0
+  TlsTable:
+RelativeVirtualAddress: 0
+Size:0
+  LoadConfigTable: 
+RelativeVirtualAddress: 0
+Size:0
+  BoundImport: 
+RelativeVirtualAddress: 0
+Size:0
+  IAT: 
+RelativeVirtualAddress: 0
+Size:0
+  DelayImportDescriptor: 
+RelativeVirtualAddress: 0
+Size:0
+  ClrRuntimeHeader: 
+RelativeVirtualAddress: 0
+Size:0
+header:  
+  Machine: IMAGE_FILE_MACHINE_AMD64
+  Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, 
IMAGE_FILE_LARGE_ADDRESS_AWARE ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, 
IMAGE_SCN_MEM_READ ]
+VirtualAddress:  4096
+VirtualSize: 1
+SectionData: C3
+symbols: []
+...

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=354258&r1=354257&r2=354258&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Mon Feb 18 
03:06:57 2019
@@ -457,7 +457,6 @@ bool ObjectFilePECOFF::ParseCOFFOptional
   m_coff_header_opt.data_dirs[i].vmsize = m_data.GetU32(offset_ptr);
 }
 
-m_file_offset = m_coff_header_opt.image_base;
 m_image_base = m_coff_header_opt.image_base;
   }
 }
@@ -927,6 +926,10 @@ lldb_private::Address ObjectFilePECOFF::
   return m_entry_point_address;
 }
 
+Address ObjectFilePECOFF::GetBaseAddress() {
+  return Address(G

[Lldb-commits] [lldb] r354263 - minidump: Add ability to attach (breakpad) symbol files to placeholder modules

2019-02-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Feb 18 03:55:01 2019
New Revision: 354263

URL: http://llvm.org/viewvc/llvm-project?rev=354263&view=rev
Log:
minidump: Add ability to attach (breakpad) symbol files to placeholder modules

This re-commits r353677, which was reverted due to test failures on the
windows bot. The issue there was that ObjectFilePECOFF vended its base
address through the incorrect interface. SymbolFilePDB depended on that,
which lead to assertion failures when SymbolFilePDB was attempting to
use the placeholder object files as a base. This has been fixed in
r354258

It also fixes one small problem in the original patch. The issue was that the
Module class would attempt to overwrite the object file we created in
CreateModuleFromObjectFile if the file corresponding to the placeholder object
file happened to exist (but we have already disqualified it due to UUID
mismatch. The fix is simple -- we set the m_did_load_objfile flag to properly
record the fact that we have already created an object file for the module.

The original commit message was:

The reason this wasn't working was that ProcessMinidump was creating odd
object-file-less modules, and SymbolFileBreakpad required the module to
have an associated object file because it needed to get its base
address.

This fixes that by introducing a PlaceholderObjectFile to serve as a
dummy object file. The general idea for this is taken from D55142, but
I've reworked it a bit to avoid the need for the PlaceholderModule
class. Now that we have an object file, our modules are sufficiently
similar to regular modules that we can use the regular Module class
almost out of the box -- the only thing I needed to tweak was the
Module::CreateModuleFromObjectFile functon to set the module's FileSpec
in addition to it's architecture. This wasn't needed for ObjectFileJIT
(the other user of CreateModuleFromObjectFile), but it shouldn't hurt it
either, and the change seems like a straightforward extension of this
function.

Reviewers: clayborg, lemo, amccarth

Subscribers: lldb-commits

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

Added:
lldb/trunk/lit/Minidump/Inputs/linux-x86_64.dmp
lldb/trunk/lit/Minidump/Inputs/linux-x86_64.syms
lldb/trunk/lit/Minidump/breakpad-symbols.test
Modified:
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=354263&r1=354262&r2=354263&view=diff
==
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Mon Feb 18 03:55:01 2019
@@ -163,15 +163,19 @@ public:
 lldb::ModuleSP module_sp(new Module());
 module_sp->m_objfile_sp =
 std::make_shared(module_sp, 
std::forward(args)...);
+module_sp->m_did_load_objfile.store(true, std::memory_order_relaxed);
 
-// Once we get the object file, update our module with the object file's
-// architecture since it might differ in vendor/os if some parts were
-// unknown.
-if (ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture()) {
-  module_sp->m_arch = arch;
-  return module_sp;
-}
-return nullptr;
+// Once we get the object file, set module ArchSpec to the one we get from
+// the object file. If the object file does not have an architecture, we
+// consider the creation a failure.
+ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture();
+if (!arch)
+  return nullptr;
+module_sp->m_arch = arch;
+
+// Also copy the object file's FileSpec.
+module_sp->m_file = module_sp->m_objfile_sp->GetFileSpec();
+return module_sp;
   }
 
   //--

Added: lldb/trunk/lit/Minidump/Inputs/linux-x86_64.dmp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Minidump/Inputs/linux-x86_64.dmp?rev=354263&view=auto
==
Binary files lldb/trunk/lit/Minidump/Inputs/linux-x86_64.dmp (added) and 
lldb/trunk/lit/Minidump/Inputs/linux-x86_64.dmp Mon Feb 18 03:55:01 2019 differ

Added: lldb/trunk/lit/Minidump/Inputs/linux-x86_64.syms
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Minidump/Inputs/linux-x86_64.syms?rev=354263&view=auto
==
--- lldb/trunk/lit/Minidump/Inputs/linux-x86_64.syms (added)
+++ lldb/trunk/lit/Minidump/Inputs/linux-x86_64.syms Mon Feb 18 03:55:01 2019
@@ -0,0 +1,4 @@
+MODULE Linux x86_64 3B285CE327C387C262DB788BF5A4078B0 linux-x86_64
+INFO CODE_ID E35C283BC327C28762DB788BF5A4078BE2351448
+FUNC 3d0 18 0 crash()
+FUNC 3f0 10 0 _start

Added: lldb/trunk/lit/Minidump/breakpad-symbols.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Minidump/breakpad-symbols.test?rev=

[Lldb-commits] [PATCH] D58050: PECOFF: Implement GetBaseAddress

2019-02-18 Thread Pavel Labath via Phabricator via lldb-commits
labath closed this revision.
labath added a comment.

Committed in r354258.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58050



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


[Lldb-commits] [PATCH] D58193: Do not explicitly depend on llvm tools during standalone build

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

Ok, I see. Thanks for explaining that. I agree that it would be great if we 
could reduce the differences between an in-tree and a standalone build to a 
minimum.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58193



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


[Lldb-commits] [PATCH] D58193: Do not explicitly depend on llvm tools during standalone build

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

Yap, will try and come up with a proposal soon.

@serge-sans-paille Sorry for diverging the discussion so much. Is it working 
for you now or are you still eager to get this patch in?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58193



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


[Lldb-commits] [PATCH] D58347: Reinitialize UnwindTable when the SymbolFile changes

2019-02-18 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, jasonmolenda.
Herald added a reviewer: alexshap.
Herald added a subscriber: jdoerfert.

This is a preparatory step to enable adding of unwind plans by symbol
file plugins.

Although at the surface it seems that currently symbol files have
nothing to do with unwinding, this isn't entirely correct even now. The
mere act of adding a symbol file can have the effect of making more
sections (typically .debug_frame) available to the unwinding machinery,
so that it can have more unwind strategies to choose from.

Up until now, we've had a bug, which went largely unnoticed, where
unwind info in the manually added symbols files (target symbols add) was
being ignored during unwinding. Reinitializing the UnwindTable fixes
that bug too.


https://reviews.llvm.org/D58347

Files:
  include/lldb/Core/Module.h
  lit/SymbolFile/Inputs/target-symbols-add-unwind.c
  lit/SymbolFile/target-symbols-add-unwind.test
  source/Core/Module.cpp
  source/Symbol/UnwindTable.cpp

Index: source/Symbol/UnwindTable.cpp
===
--- source/Symbol/UnwindTable.cpp
+++ source/Symbol/UnwindTable.cpp
@@ -46,7 +46,7 @@
   if (!object_file)
 return;
 
-  SectionList *sl = object_file->GetSectionList();
+  SectionList *sl = m_module.GetSectionList();
   if (!sl)
 return;
 
Index: source/Core/Module.cpp
===
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -1296,6 +1296,12 @@
 sym_vendor->SectionFileAddressesChanged();
 }
 
+UnwindTable &Module::GetUnwindTable() {
+  if (!m_unwind_table)
+m_unwind_table.emplace(*this);
+  return *m_unwind_table;
+}
+
 SectionList *Module::GetUnifiedSectionList() {
   if (!m_sections_up)
 m_sections_up = llvm::make_unique();
@@ -1442,6 +1448,10 @@
 // one
 obj_file->ClearSymtab();
 
+// Clear the unwind table too, as that may also be affected by the
+// symbol file information.
+m_unwind_table.reset();
+
 // The symbol file might be a directory bundle ("/tmp/a.out.dSYM")
 // instead of a full path to the symbol file within the bundle
 // ("/tmp/a.out.dSYM/Contents/Resources/DWARF/a.out"). So we need to
Index: lit/SymbolFile/target-symbols-add-unwind.test
===
--- /dev/null
+++ lit/SymbolFile/target-symbols-add-unwind.test
@@ -0,0 +1,26 @@
+# TODO: When it's possible to run "image show-unwind" without a running
+# process, we can remove the unsupported line below, and hard-code an ELF
+# triple in the test.
+# UNSUPPORTED: system-windows, system-darwin
+
+# RUN: cd %T
+# RUN: %clang %S/Inputs/target-symbols-add-unwind.c -nostdlib -g \
+# RUN:   -fno-unwind-tables -o target-symbols-add-unwind.debug
+# RUN: llvm-objcopy --strip-debug target-symbols-add-unwind.debug \
+# RUN:   target-symbols-add-unwind.stripped
+# RUN: %lldb target-symbols-add-unwind.stripped -s %s -o quit | FileCheck %s
+
+process launch --stop-at-entry
+image show-unwind -n _start
+# CHECK-LABEL: image show-unwind -n _start
+# CHECK-NOT: debug_frame UnwindPlan:
+
+target symbols add -s target-symbols-add-unwind.stripped target-symbols-add-unwind.debug
+# CHECK-LABEL: target symbols add
+# CHECK: symbol file {{.*}} has been added to {{.*}}
+
+image show-unwind -n _start
+# CHECK-LABEL: image show-unwind -n _start
+# CHECK: debug_frame UnwindPlan:
+# CHECK-NEXT: This UnwindPlan originally sourced from DWARF CFI
+# CHECK-NEXT: This UnwindPlan is sourced from the compiler: yes.
Index: lit/SymbolFile/Inputs/target-symbols-add-unwind.c
===
--- /dev/null
+++ lit/SymbolFile/Inputs/target-symbols-add-unwind.c
@@ -0,0 +1 @@
+void _start() {}
Index: include/lldb/Core/Module.h
===
--- include/lldb/Core/Module.h
+++ include/lldb/Core/Module.h
@@ -710,7 +710,7 @@
   /// Returns the unwind table for this module. If this object has no
   /// associated object file, an empty UnwindTable is returned.
   //--
-  UnwindTable &GetUnwindTable() { return m_unwind_table; }
+  UnwindTable &GetUnwindTable();
 
   llvm::VersionTuple GetVersion();
 
@@ -1109,8 +1109,9 @@
   lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file
///parser for this module as it may or may
///not be shared with the SymbolFile
-  UnwindTable m_unwind_table{*this}; ///< Table of FuncUnwinders objects created
- /// for this Module's functions
+  llvm::Optional m_unwind_table; ///< Table of FuncUnwinders
+  /// objects created for this
+  /// Module's functions

[Lldb-commits] [PATCH] D42870: Correct recognition of NetBSD images

2019-02-18 Thread Michał Górny via Phabricator via lldb-commits
mgorny marked an inline comment as done.
mgorny added inline comments.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1359
+  // p = patchlevel
+  const uint32_t version_major = version_info / 1;
+  const uint32_t version_minor = (version_info % 1) / 100;

Would it be crazy to rewrite this into `std::div` (i.e. to get both quotient 
and remainder in one call)?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D42870



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


[Lldb-commits] [PATCH] D58193: Do not explicitly depend on llvm tools during standalone build

2019-02-18 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

@sgraenitz I currently have this patch applied to LLVM 8rc1 source tree for 
fedora, because it wasn't working automagically otherwise. Reading the 
discussion, I don't think I missed some configuration stuff, or what did I miss 
when configuring the build of lldb in standalone mode?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58193



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


[Lldb-commits] [PATCH] D58193: Do not explicitly depend on llvm tools during standalone build

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

In D58193#1401137 , @serge-sans-paille 
wrote:

> @sgraenitz I currently have this patch applied to LLVM 8rc1 source tree for 
> fedora,


Could you check what's the state of the master branch? It's possible some of 
the changes we've been talking about didn't make the 8.0 cut. We still have the 
time to cherry-pick it over, but it's going to run out soon.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58193



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


[Lldb-commits] [PATCH] D58350: Insert random blocks of python code with swig instead of modify-python-lldb.py

2019-02-18 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: zturner, jingham.
Herald added a reviewer: serge-sans-paille.
Herald added a subscriber: jdoerfert.

Swig is perfectly capable of inserting blocks of python code into its
output (and we use those fascilities already), so there's no need for
this to be done in a post-process step.

lldb_iter is a general-purpose utility used from many classes, so I add
it to the main swig file. The other two blocks are tied to a specific
class, so I add it to the interface file of that class.


https://reviews.llvm.org/D58350

Files:
  scripts/Python/modify-python-lldb.py
  scripts/interface/SBModule.i
  scripts/interface/SBValue.i
  scripts/lldb.swig

Index: scripts/lldb.swig
===
--- scripts/lldb.swig
+++ scripts/lldb.swig
@@ -81,6 +81,26 @@
 %enddef
 EMBED_VERSION(SWIG_VERSION)
 
+%pythoncode%{
+# ===
+# Iterator for lldb container objects
+# ===
+def lldb_iter(obj, getsize, getelem):
+"""A generator adaptor to support iteration for lldb container objects."""
+size = getattr(obj, getsize)
+elem = getattr(obj, getelem)
+for i in range(size()):
+yield elem(i)
+
+# ==
+# The modify-python-lldb.py script is responsible for post-processing this SWIG-
+# generated lldb.py module.  It is responsible for adding support for: iteration
+# protocol: __iter__, rich comparison methods: __eq__ and __ne__, truth value
+# testing (and built-in operation bool()): __nonzero__, and built-in function
+# len(): __len__.
+# ==
+%}
+
 %include "./Python/python-typemaps.swig"
 
 /* C++ headers to be included. */
Index: scripts/interface/SBValue.i
===
--- scripts/interface/SBValue.i
+++ scripts/interface/SBValue.i
@@ -601,6 +601,61 @@
 child.SetSyntheticChildrenGenerated(True)
 return child
 
+def __eol_test(val):
+"""Default function for end of list test takes an SBValue object.
+
+Return True if val is invalid or it corresponds to a null pointer.
+Otherwise, return False.
+"""
+if not val or val.GetValueAsUnsigned() == 0:
+return True
+else:
+return False
+
+# ==
+# Iterator for lldb.SBValue treated as a linked list
+# ==
+def linked_list_iter(self, next_item_name, end_of_list_test=__eol_test):
+"""Generator adaptor to support iteration for SBValue as a linked list.
+
+linked_list_iter() is a special purpose iterator to treat the SBValue as
+the head of a list data structure, where you specify the child member
+name which points to the next item on the list and you specify the
+end-of-list test function which takes an SBValue for an item and returns
+True if EOL is reached and False if not.
+
+linked_list_iter() also detects infinite loop and bails out early.
+
+The end_of_list_test arg, if omitted, defaults to the __eol_test
+function above.
+
+For example,
+
+# Get Frame #0.
+...
+
+# Get variable 'task_head'.
+task_head = frame0.FindVariable('task_head')
+...
+
+for t in task_head.linked_list_iter('next'):
+print t
+"""
+if end_of_list_test(self):
+return
+item = self
+visited = set()
+try:
+while not end_of_list_test(item) and not item.GetValueAsUnsigned() in visited:
+visited.add(item.GetValueAsUnsigned())
+yield item
+# Prepare for the next iteration.
+item = item.GetChildMemberWithName(next_item_name)
+except:
+# Exception occurred.  Stop the generator.
+pass
+
+return
 %}
 
 };
Index: scripts/interface/SBModule.i
===
--- scripts/interface/SBModule.i
+++ scripts/interface/SBModule.i
@@ -8,6 +8,29 @@
 
 namespace lldb {
 
+%pythoncode%{
+# ==
+# Helper function for SBModule class
+# ==
+def in_range(symbol, section):
+"""Test whether a symbol is within the range of a section."""
+symSA = symbol.GetStartAddress().GetFileAddress()
+symEA = symbol.GetEndAddress().GetFileAddress()
+secSA = section.GetFileAddress()
+secEA = secSA + section.GetByteSize()
+
+if symEA != LLDB_INVALID_ADDRESS:

[Lldb-commits] [lldb] r354273 - Fix TestLinuxCore for python3

2019-02-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Feb 18 07:04:33 2019
New Revision: 354273

URL: http://llvm.org/viewvc/llvm-project?rev=354273&view=rev
Log:
Fix TestLinuxCore for python3

- dictionaries don't have iteritems()
- division returns floats

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py?rev=354273&r1=354272&r2=354273&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 Mon Feb 18 07:04:33 2019
@@ -2,7 +2,7 @@
 Test basics of linux core file debugging.
 """
 
-from __future__ import print_function
+from __future__ import division, print_function
 
 import shutil
 import struct
@@ -190,7 +190,7 @@ class LinuxCoreTestCase(TestBase):
 values["xmm6"] = "{0xf8 0xf1 0x8b 0x4f 0xf8 0xf1 0x8b 0x4f 0xf8 0xf1 
0x8b 0x4f 0xf8 0xf1 0x8b 0x4f}"
 values["xmm7"] = "{0x13 0xf1 0x30 0xcd 0x13 0xf1 0x30 0xcd 0x13 0xf1 
0x30 0xcd 0x13 0xf1 0x30 0xcd}"
 
-for regname, value in values.iteritems():
+for regname, value in values.items():
 self.expect("register read {}".format(regname), substrs=["{} = 
{}".format(regname, value)])
 
 
@@ -201,7 +201,7 @@ class LinuxCoreTestCase(TestBase):
 
 values["fioff"] = "0x080480cc"
 
-for regname, value in values.iteritems():
+for regname, value in values.items():
 self.expect("register read {}".format(regname), substrs=["{} = 
{}".format(regname, value)])
 
 @expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
@@ -260,7 +260,7 @@ class LinuxCoreTestCase(TestBase):
 # Test an address in the middle of a region returns it's enclosing
 # region.
 middle_address = (region.GetRegionBase() +
-  region.GetRegionEnd()) / 2
+  region.GetRegionEnd()) // 2
 region_at_middle = lldb.SBMemoryRegionInfo()
 error = process.GetMemoryRegionInfo(
 middle_address, region_at_middle)


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


[Lldb-commits] [lldb] r354278 - Un-XFAIL TestLinuxCore for windows

2019-02-18 Thread Pavel Labath via lldb-commits
Author: labath
Date: Mon Feb 18 08:05:26 2019
New Revision: 354278

URL: http://llvm.org/viewvc/llvm-project?rev=354278&view=rev
Log:
Un-XFAIL TestLinuxCore for windows

It turns out all that was needed to get this test passing was to fix the
python3 incompatibility.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py?rev=354278&r1=354277&r2=354278&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/elf-core/TestLinuxCore.py
 Mon Feb 18 08:05:26 2019
@@ -41,35 +41,30 @@ class LinuxCoreTestCase(TestBase):
 lldb.DBG.SetSelectedPlatform(self._initial_platform)
 super(LinuxCoreTestCase, self).tearDown()
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIf(triple='^mips')
 @skipIfLLVMTargetMissing("X86")
 def test_i386(self):
 """Test that lldb can read the process information from an i386 linux 
core file."""
 self.do_test("linux-i386", self._i386_pid, self._i386_regions, "a.out")
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIfLLVMTargetMissing("Mips")
 def test_mips_o32(self):
 """Test that lldb can read the process information from an MIPS O32 
linux core file."""
 self.do_test("linux-mipsel-gnuabio32", self._mips_o32_pid,
 self._mips_regions, "linux-mipsel-gn")
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIfLLVMTargetMissing("Mips")
 def test_mips_n32(self):
 """Test that lldb can read the process information from an MIPS N32 
linux core file """
 self.do_test("linux-mips64el-gnuabin32", self._mips64_n32_pid,
 self._mips_regions, "linux-mips64el-")
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIfLLVMTargetMissing("Mips")
 def test_mips_n64(self):
 """Test that lldb can read the process information from an MIPS N64 
linux core file """
 self.do_test("linux-mips64el-gnuabi64", self._mips64_n64_pid,
 self._mips_regions, "linux-mips64el-")
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIf(triple='^mips')
 @skipIfLLVMTargetMissing("PowerPC")
 def test_ppc64le(self):
@@ -77,7 +72,6 @@ class LinuxCoreTestCase(TestBase):
 self.do_test("linux-ppc64le", self._ppc64le_pid, self._ppc64le_regions,
 "linux-ppc64le.ou")
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIf(triple='^mips')
 @skipIfLLVMTargetMissing("X86")
 def test_x86_64(self):
@@ -85,7 +79,6 @@ class LinuxCoreTestCase(TestBase):
 self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions,
 "a.out")
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIf(triple='^mips')
 @skipIfLLVMTargetMissing("SystemZ")
 def test_s390x(self):
@@ -93,7 +86,6 @@ class LinuxCoreTestCase(TestBase):
 self.do_test("linux-s390x", self._s390x_pid, self._s390x_regions,
 "a.out")
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIf(triple='^mips')
 @skipIfLLVMTargetMissing("X86")
 def test_same_pid_running(self):
@@ -122,7 +114,6 @@ class LinuxCoreTestCase(TestBase):
 self.do_test(self.getBuildArtifact("linux-x86_64-pid"), os.getpid(),
 self._x86_64_regions, "a.out")
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIf(triple='^mips')
 @skipIfLLVMTargetMissing("X86")
 def test_two_cores_same_pid(self):
@@ -153,7 +144,6 @@ class LinuxCoreTestCase(TestBase):
 self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions,
 "a.out")
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIf(triple='^mips')
 @skipIfLLVMTargetMissing("X86")
 def test_FPR_SSE(self):
@@ -204,7 +194,6 @@ class LinuxCoreTestCase(TestBase):
 for regname, value in values.items():
 self.expect("register read {}".format(regname), substrs=["{} = 
{}".format(regname, value)])
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
 @skipIf(triple='^mips')
 @skipIfLLVMTargetMissing("X86")
 def test_i386_sysroot(self):


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
ht

[Lldb-commits] [PATCH] D42870: [lldb] [ObjectFile/ELF] Correct recognition of NetBSD images

2019-02-18 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 187254.
mgorny marked an inline comment as done and an inline comment as not done.
mgorny retitled this revision from "Correct recognition of NetBSD images" to 
"[lldb] [ObjectFile/ELF] Correct recognition of NetBSD images".
mgorny edited the summary of this revision.
mgorny added a comment.

Added tests. I'm using yaml2obj for the regular executable, and binary file for 
the core dump (I've stripped it to initial 4k since that seems enough for lldb 
to recognize it).


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

https://reviews.llvm.org/D42870

Files:
  lldb/lit/Modules/ELF/Inputs/netbsd.core
  lldb/lit/Modules/ELF/netbsd-core.test
  lldb/lit/Modules/ELF/netbsd-exec.yaml
  lldb/lit/Modules/lit.local.cfg
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -55,6 +55,7 @@
 const char *const LLDB_NT_OWNER_FREEBSD = "FreeBSD";
 const char *const LLDB_NT_OWNER_GNU = "GNU";
 const char *const LLDB_NT_OWNER_NETBSD = "NetBSD";
+const char *const LLDB_NT_OWNER_NETBSDCORE = "NetBSD-CORE";
 const char *const LLDB_NT_OWNER_OPENBSD = "OpenBSD";
 const char *const LLDB_NT_OWNER_CSR = "csr";
 const char *const LLDB_NT_OWNER_ANDROID = "Android";
@@ -70,8 +71,10 @@
 
 const elf_word LLDB_NT_GNU_BUILD_ID_TAG = 0x03;
 
-const elf_word LLDB_NT_NETBSD_ABI_TAG = 0x01;
-const elf_word LLDB_NT_NETBSD_ABI_SIZE = 4;
+const elf_word LLDB_NT_NETBSD_NT_NETBSD_IDENT_TAG = 1;
+const elf_word LLDB_NT_NETBSD_NT_NETBSD_IDENT_DESCSZ = 4;
+const elf_word LLDB_NT_NETBSD_NT_NETBSD_IDENT_NAMESZ = 7;
+const elf_word LLDB_NT_NETBSD_NT_PROCINFO = 1;
 
 // GNU ABI note OS constants
 const elf_word LLDB_NT_GNU_ABI_OS_LINUX = 0x00;
@@ -1294,25 +1297,39 @@
 // The note.n_name == LLDB_NT_OWNER_GNU is valid for Linux platform
 arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
 }
-// Process NetBSD ELF notes.
+// Process NetBSD ELF executables and shared libraries
 else if ((note.n_name == LLDB_NT_OWNER_NETBSD) &&
- (note.n_type == LLDB_NT_NETBSD_ABI_TAG) &&
- (note.n_descsz == LLDB_NT_NETBSD_ABI_SIZE)) {
-  // Pull out the min version info.
+ (note.n_type == LLDB_NT_NETBSD_NT_NETBSD_IDENT_TAG) &&
+ (note.n_descsz == LLDB_NT_NETBSD_NT_NETBSD_IDENT_DESCSZ) &&
+ (note.n_namesz == LLDB_NT_NETBSD_NT_NETBSD_IDENT_NAMESZ)) {
+  // Pull out the version info.
   uint32_t version_info;
   if (data.GetU32(&offset, &version_info, 1) == nullptr) {
 error.SetErrorString("failed to read NetBSD ABI note payload");
 return error;
   }
-
+  // Convert the version info into a major/minor/patch number.
+  // #define __NetBSD_Version__ MMmmrrpp00
+  //
+  // M = major version
+  // m = minor version; a minor number of 99 indicates current.
+  // r = 0 (since NetBSD 3.0 not used)
+  // p = patchlevel
+  const uint32_t version_major = version_info / 1;
+  const uint32_t version_minor = (version_info % 1) / 100;
+  const uint32_t version_patch = (version_info % 1) / 100;
+  // Set the elf OS version to NetBSD.  Also clear the vendor.
+  arch_spec.GetTriple().setOSName(
+  llvm::formatv("netbsd{0}.{1}.{2}", version_major, version_minor,
+version_patch).str());
+  arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::UnknownVendor);
+}
+// Process NetBSD ELF core(5) notes
+else if ((note.n_name == LLDB_NT_OWNER_NETBSDCORE) &&
+ (note.n_type == LLDB_NT_NETBSD_NT_PROCINFO)) {
   // Set the elf OS version to NetBSD.  Also clear the vendor.
   arch_spec.GetTriple().setOS(llvm::Triple::OSType::NetBSD);
   arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::UnknownVendor);
-
-  if (log)
-log->Printf(
-"ObjectFileELF::%s detected NetBSD, min version constant %" PRIu32,
-__FUNCTION__, version_info);
 }
 // Process OpenBSD ELF notes.
 else if (note.n_name == LLDB_NT_OWNER_OPENBSD) {
Index: lldb/lit/Modules/lit.local.cfg
===
--- lldb/lit/Modules/lit.local.cfg
+++ lldb/lit/Modules/lit.local.cfg
@@ -1 +1 @@
-config.suffixes = ['.s', '.yaml']
+config.suffixes = ['.s', '.test', '.yaml']
Index: lldb/lit/Modules/ELF/netbsd-exec.yaml
===
--- /dev/null
+++ lldb/lit/Modules/ELF/netbsd-exec.yaml
@@ -0,0 +1,335 @@
+# Test whether NetBSD executables are recognized correctly.
+
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+# CHECK: Architecture: x86_64--netbsd8.99.30
+# CHECK: Type: executable
+

[Lldb-commits] [PATCH] D42870: [lldb] [ObjectFile/ELF] Correct recognition of NetBSD images

2019-02-18 Thread Michał Górny via Phabricator via lldb-commits
mgorny marked an inline comment as done.
mgorny added inline comments.



Comment at: lldb/lit/Modules/ELF/netbsd-exec.yaml:1
+# Test whether NetBSD executables are recognized correctly.
+

I'm not sure if we should keep the whole file or try to strip this a bit.


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

https://reviews.llvm.org/D42870



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


[Lldb-commits] [PATCH] D58125: Add ability to import std module into expression parser to improve C++ debugging

2019-02-18 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/expression_command/import-std-module/conflicts/Makefile:3
+USE_LIBCPP := 1
+CXXFLAGS += -std=c++11 -fmodules -glldb -fimplicit-module-maps
+CXX_SOURCES := main.cpp

teemperor wrote:
> aprantl wrote:
> > Makefile.rules defines MANDATORY_MODULE_BUILD_FLAGS for this. Can you 
> > instead add -fimplicit-module-maps to that variable and use it here?
> Well, we would need to add `-glldb` (needed on Linux at least, where this is 
> not default) and `-fimplicit-module-maps` to that flag (and maybe even 
> `-fcxx-modules` on macOS, but I'm not sure about that). Also I'm not sure if 
> we want to have `-gmodules` in the same flag set as the importing of `std` 
> should also work without. What about a separate 
> `MANDATORY_CXXMODULE_BUILD_FLAGS` that we use in all the tests?
That works for me. The bit I really care about is the `-fmodules-cache-path`. 
If we don't set it an incremental bot may blow up when upstream clang changes 
the serialization format.


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

https://reviews.llvm.org/D58125



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


[Lldb-commits] [PATCH] D42870: [lldb] [ObjectFile/ELF] Correct recognition of NetBSD images

2019-02-18 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:1359
+  // p = patchlevel
+  const uint32_t version_major = version_info / 1;
+  const uint32_t version_minor = (version_info % 1) / 100;

mgorny wrote:
> Would it be crazy to rewrite this into `std::div` (i.e. to get both quotient 
> and remainder in one call)?
If it will be more readable OK.


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

https://reviews.llvm.org/D42870



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


[Lldb-commits] [PATCH] D42870: [lldb] [ObjectFile/ELF] Correct recognition of NetBSD images

2019-02-18 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: lldb/lit/Modules/ELF/netbsd-core.test:3
+
+# RUN: lldb-test object-file %S/Inputs/netbsd.core | FileCheck %s
+# CHECK: Architecture: x86_64-unknown-netbsd

I propose to keep it as netbsd$VERSION-$ARCH.core

We will want multiple core(5) files and possible with variations (FPU layout).


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

https://reviews.llvm.org/D42870



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


[Lldb-commits] [PATCH] D42870: [lldb] [ObjectFile/ELF] Correct recognition of NetBSD images

2019-02-18 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 187261.
mgorny added a comment.

Rename tests as requested.


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

https://reviews.llvm.org/D42870

Files:
  lldb/lit/Modules/ELF/Inputs/netbsd-amd64.core
  lldb/lit/Modules/ELF/netbsd-core-amd64.test
  lldb/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
  lldb/lit/Modules/lit.local.cfg
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -55,6 +55,7 @@
 const char *const LLDB_NT_OWNER_FREEBSD = "FreeBSD";
 const char *const LLDB_NT_OWNER_GNU = "GNU";
 const char *const LLDB_NT_OWNER_NETBSD = "NetBSD";
+const char *const LLDB_NT_OWNER_NETBSDCORE = "NetBSD-CORE";
 const char *const LLDB_NT_OWNER_OPENBSD = "OpenBSD";
 const char *const LLDB_NT_OWNER_CSR = "csr";
 const char *const LLDB_NT_OWNER_ANDROID = "Android";
@@ -70,8 +71,10 @@
 
 const elf_word LLDB_NT_GNU_BUILD_ID_TAG = 0x03;
 
-const elf_word LLDB_NT_NETBSD_ABI_TAG = 0x01;
-const elf_word LLDB_NT_NETBSD_ABI_SIZE = 4;
+const elf_word LLDB_NT_NETBSD_NT_NETBSD_IDENT_TAG = 1;
+const elf_word LLDB_NT_NETBSD_NT_NETBSD_IDENT_DESCSZ = 4;
+const elf_word LLDB_NT_NETBSD_NT_NETBSD_IDENT_NAMESZ = 7;
+const elf_word LLDB_NT_NETBSD_NT_PROCINFO = 1;
 
 // GNU ABI note OS constants
 const elf_word LLDB_NT_GNU_ABI_OS_LINUX = 0x00;
@@ -1294,25 +1297,39 @@
 // The note.n_name == LLDB_NT_OWNER_GNU is valid for Linux platform
 arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
 }
-// Process NetBSD ELF notes.
+// Process NetBSD ELF executables and shared libraries
 else if ((note.n_name == LLDB_NT_OWNER_NETBSD) &&
- (note.n_type == LLDB_NT_NETBSD_ABI_TAG) &&
- (note.n_descsz == LLDB_NT_NETBSD_ABI_SIZE)) {
-  // Pull out the min version info.
+ (note.n_type == LLDB_NT_NETBSD_NT_NETBSD_IDENT_TAG) &&
+ (note.n_descsz == LLDB_NT_NETBSD_NT_NETBSD_IDENT_DESCSZ) &&
+ (note.n_namesz == LLDB_NT_NETBSD_NT_NETBSD_IDENT_NAMESZ)) {
+  // Pull out the version info.
   uint32_t version_info;
   if (data.GetU32(&offset, &version_info, 1) == nullptr) {
 error.SetErrorString("failed to read NetBSD ABI note payload");
 return error;
   }
-
+  // Convert the version info into a major/minor/patch number.
+  // #define __NetBSD_Version__ MMmmrrpp00
+  //
+  // M = major version
+  // m = minor version; a minor number of 99 indicates current.
+  // r = 0 (since NetBSD 3.0 not used)
+  // p = patchlevel
+  const uint32_t version_major = version_info / 1;
+  const uint32_t version_minor = (version_info % 1) / 100;
+  const uint32_t version_patch = (version_info % 1) / 100;
+  // Set the elf OS version to NetBSD.  Also clear the vendor.
+  arch_spec.GetTriple().setOSName(
+  llvm::formatv("netbsd{0}.{1}.{2}", version_major, version_minor,
+version_patch).str());
+  arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::UnknownVendor);
+}
+// Process NetBSD ELF core(5) notes
+else if ((note.n_name == LLDB_NT_OWNER_NETBSDCORE) &&
+ (note.n_type == LLDB_NT_NETBSD_NT_PROCINFO)) {
   // Set the elf OS version to NetBSD.  Also clear the vendor.
   arch_spec.GetTriple().setOS(llvm::Triple::OSType::NetBSD);
   arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::UnknownVendor);
-
-  if (log)
-log->Printf(
-"ObjectFileELF::%s detected NetBSD, min version constant %" PRIu32,
-__FUNCTION__, version_info);
 }
 // Process OpenBSD ELF notes.
 else if (note.n_name == LLDB_NT_OWNER_OPENBSD) {
Index: lldb/lit/Modules/lit.local.cfg
===
--- lldb/lit/Modules/lit.local.cfg
+++ lldb/lit/Modules/lit.local.cfg
@@ -1 +1 @@
-config.suffixes = ['.s', '.yaml']
+config.suffixes = ['.s', '.test', '.yaml']
Index: lldb/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
===
--- /dev/null
+++ lldb/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
@@ -0,0 +1,335 @@
+# Test whether NetBSD executables are recognized correctly.
+
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+# CHECK: Architecture: x86_64--netbsd8.99.30
+# CHECK: Type: executable
+
+--- !ELF
+FileHeader:  
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_X86_64
+  Entry:   0x002006F0
+Sections:
+  - Name:.interp
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC ]
+Address: 0x00200200
+Add

[Lldb-commits] [PATCH] D42870: [lldb] [ObjectFile/ELF] Correct recognition of NetBSD images

2019-02-18 Thread Kamil Rytarowski via Phabricator via lldb-commits
krytarowski added inline comments.



Comment at: lldb/lit/Modules/ELF/netbsd-core.test:3
+
+# RUN: lldb-test object-file %S/Inputs/netbsd.core | FileCheck %s
+# CHECK: Architecture: x86_64-unknown-netbsd

krytarowski wrote:
> I propose to keep it as netbsd$VERSION-$ARCH.core
> 
> We will want multiple core(5) files and possible with variations (FPU layout).
> We will want multiple core(5) files and possible with variations (FPU layout).

Actually such variations will be applicable for https://reviews.llvm.org/D32149 
Here we just want `$ARCH`-`$VERSION`.


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

https://reviews.llvm.org/D42870



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


[Lldb-commits] [PATCH] D42870: [lldb] [ObjectFile/ELF] Correct recognition of NetBSD images

2019-02-18 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 187264.
mgorny added a comment.
Herald added a subscriber: jdoerfert.

Added comments on how test data was generated.


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

https://reviews.llvm.org/D42870

Files:
  lldb/lit/Modules/ELF/Inputs/netbsd-amd64.core
  lldb/lit/Modules/ELF/netbsd-core-amd64.test
  lldb/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
  lldb/lit/Modules/lit.local.cfg
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -55,6 +55,7 @@
 const char *const LLDB_NT_OWNER_FREEBSD = "FreeBSD";
 const char *const LLDB_NT_OWNER_GNU = "GNU";
 const char *const LLDB_NT_OWNER_NETBSD = "NetBSD";
+const char *const LLDB_NT_OWNER_NETBSDCORE = "NetBSD-CORE";
 const char *const LLDB_NT_OWNER_OPENBSD = "OpenBSD";
 const char *const LLDB_NT_OWNER_CSR = "csr";
 const char *const LLDB_NT_OWNER_ANDROID = "Android";
@@ -70,8 +71,10 @@
 
 const elf_word LLDB_NT_GNU_BUILD_ID_TAG = 0x03;
 
-const elf_word LLDB_NT_NETBSD_ABI_TAG = 0x01;
-const elf_word LLDB_NT_NETBSD_ABI_SIZE = 4;
+const elf_word LLDB_NT_NETBSD_NT_NETBSD_IDENT_TAG = 1;
+const elf_word LLDB_NT_NETBSD_NT_NETBSD_IDENT_DESCSZ = 4;
+const elf_word LLDB_NT_NETBSD_NT_NETBSD_IDENT_NAMESZ = 7;
+const elf_word LLDB_NT_NETBSD_NT_PROCINFO = 1;
 
 // GNU ABI note OS constants
 const elf_word LLDB_NT_GNU_ABI_OS_LINUX = 0x00;
@@ -1294,25 +1297,39 @@
 // The note.n_name == LLDB_NT_OWNER_GNU is valid for Linux platform
 arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
 }
-// Process NetBSD ELF notes.
+// Process NetBSD ELF executables and shared libraries
 else if ((note.n_name == LLDB_NT_OWNER_NETBSD) &&
- (note.n_type == LLDB_NT_NETBSD_ABI_TAG) &&
- (note.n_descsz == LLDB_NT_NETBSD_ABI_SIZE)) {
-  // Pull out the min version info.
+ (note.n_type == LLDB_NT_NETBSD_NT_NETBSD_IDENT_TAG) &&
+ (note.n_descsz == LLDB_NT_NETBSD_NT_NETBSD_IDENT_DESCSZ) &&
+ (note.n_namesz == LLDB_NT_NETBSD_NT_NETBSD_IDENT_NAMESZ)) {
+  // Pull out the version info.
   uint32_t version_info;
   if (data.GetU32(&offset, &version_info, 1) == nullptr) {
 error.SetErrorString("failed to read NetBSD ABI note payload");
 return error;
   }
-
+  // Convert the version info into a major/minor/patch number.
+  // #define __NetBSD_Version__ MMmmrrpp00
+  //
+  // M = major version
+  // m = minor version; a minor number of 99 indicates current.
+  // r = 0 (since NetBSD 3.0 not used)
+  // p = patchlevel
+  const uint32_t version_major = version_info / 1;
+  const uint32_t version_minor = (version_info % 1) / 100;
+  const uint32_t version_patch = (version_info % 1) / 100;
+  // Set the elf OS version to NetBSD.  Also clear the vendor.
+  arch_spec.GetTriple().setOSName(
+  llvm::formatv("netbsd{0}.{1}.{2}", version_major, version_minor,
+version_patch).str());
+  arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::UnknownVendor);
+}
+// Process NetBSD ELF core(5) notes
+else if ((note.n_name == LLDB_NT_OWNER_NETBSDCORE) &&
+ (note.n_type == LLDB_NT_NETBSD_NT_PROCINFO)) {
   // Set the elf OS version to NetBSD.  Also clear the vendor.
   arch_spec.GetTriple().setOS(llvm::Triple::OSType::NetBSD);
   arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::UnknownVendor);
-
-  if (log)
-log->Printf(
-"ObjectFileELF::%s detected NetBSD, min version constant %" PRIu32,
-__FUNCTION__, version_info);
 }
 // Process OpenBSD ELF notes.
 else if (note.n_name == LLDB_NT_OWNER_OPENBSD) {
Index: lldb/lit/Modules/lit.local.cfg
===
--- lldb/lit/Modules/lit.local.cfg
+++ lldb/lit/Modules/lit.local.cfg
@@ -1 +1 @@
-config.suffixes = ['.s', '.yaml']
+config.suffixes = ['.s', '.test', '.yaml']
Index: lldb/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
===
--- /dev/null
+++ lldb/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
@@ -0,0 +1,341 @@
+# Test whether NetBSD executables are recognized correctly.
+
+# Data obtained from compiling the following program:
+# int main() {
+#   return 0;
+# }
+# Then converting it using obj2yaml.
+
+# RUN: yaml2obj %s > %t
+# RUN: lldb-test object-file %t | FileCheck %s
+# CHECK: Architecture: x86_64--netbsd8.99.30
+# CHECK: Type: executable
+
+--- !ELF
+FileHeader:  
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_X86_64
+  Entry:  

[Lldb-commits] [PATCH] D58193: Do not explicitly depend on llvm tools during standalone build

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

In D58193#1401137 , @serge-sans-paille 
wrote:

> @sgraenitz I currently have this patch applied to LLVM 8rc1 source tree for 
> fedora, because it wasn't working automagically otherwise. Reading the 
> discussion, I don't think I missed some configuration stuff, or what did I 
> miss when configuring the build of lldb in standalone mode?


You build against an installed LLVM and you want to run LLDB tests? AFAIK you 
need to:

- configure LLVM with `LLVM_INSTALL_UTILS=ON`
- configure standalone LLDB with 
`LLVM_EXTERNAL_LIT=/path/to/llvm-build-tree/bin/llvm-lit`

However, llc and dsymutil are tools and they should not be affected.
If you don't want to run the test suite, pass `LLDB_INCLUDE_TESTS=OFF`.

Maybe @mgorny can add some info here?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58193



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


[Lldb-commits] [lldb] r354283 - [Reproducers] Make clang use lldb's VFS.

2019-02-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Feb 18 12:31:18 2019
New Revision: 354283

URL: http://llvm.org/viewvc/llvm-project?rev=354283&view=rev
Log:
[Reproducers] Make clang use lldb's VFS.

In r353906 we hooked up clang and lldb's reproducer infrastructure to
capture files used by clang. This patch adds the necessary logic to have
clang reuse the files from lldb's reproducer during replay.

Differential revision: https://reviews.llvm.org/D58309

Added:
lldb/trunk/lit/Reproducer/Modules/
lldb/trunk/lit/Reproducer/Modules/Inputs/
lldb/trunk/lit/Reproducer/Modules/Inputs/Bar.h
lldb/trunk/lit/Reproducer/Modules/Inputs/Foo.h
lldb/trunk/lit/Reproducer/Modules/Inputs/ModuleCXX.in
lldb/trunk/lit/Reproducer/Modules/Inputs/main.cpp
lldb/trunk/lit/Reproducer/Modules/Inputs/module.modulemap
lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test
Removed:
lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in
lldb/trunk/lit/Reproducer/TestClangFileRepro.test
Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/trunk/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/unittests/Language/Highlighting/HighlighterTest.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=354283&r1=354282&r2=354283&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Mon Feb 18 12:31:18 2019
@@ -181,6 +181,10 @@ public:
   llvm::ErrorOr GetExternalPath(const llvm::Twine &path);
   llvm::ErrorOr GetExternalPath(const FileSpec &file_spec);
 
+  llvm::IntrusiveRefCntPtr GetVirtualFileSystem() {
+return m_fs;
+  }
+
 private:
   static llvm::Optional &InstanceImpl();
   llvm::IntrusiveRefCntPtr m_fs;

Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=354283&r1=354282&r2=354283&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Mon Feb 18 12:31:18 2019
@@ -21,6 +21,7 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/FileSystemOptions.h"
 
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Symbol/CompilerDeclContext.h"
 #include "lldb/lldb-types.h"
 
@@ -93,7 +94,9 @@ public:
 vbase_offsets;
   };
 
-  ClangASTImporter() : m_file_manager(clang::FileSystemOptions()) {}
+  ClangASTImporter()
+  : m_file_manager(clang::FileSystemOptions(),
+   FileSystem::Instance().GetVirtualFileSystem()) {}
 
   clang::QualType CopyType(clang::ASTContext *dst_ctx,
clang::ASTContext *src_ctx, clang::QualType type);

Removed: lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in?rev=354282&view=auto
==
--- lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in (original)
+++ lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in (removed)
@@ -1,2 +0,0 @@
-expr -- @import Cocoa
-reproducer generate

Added: lldb/trunk/lit/Reproducer/Modules/Inputs/Bar.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Modules/Inputs/Bar.h?rev=354283&view=auto
==
--- lldb/trunk/lit/Reproducer/Modules/Inputs/Bar.h (added)
+++ lldb/trunk/lit/Reproducer/Modules/Inputs/Bar.h Mon Feb 18 12:31:18 2019
@@ -0,0 +1,3 @@
+struct Bar {
+  int success;
+};

Added: lldb/trunk/lit/Reproducer/Modules/Inputs/Foo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Modules/Inputs/Foo.h?rev=354283&view=auto
==
--- lldb/trunk/lit/Reproducer/Modules/Inputs/Foo.h (added)
+++ lldb/trunk/lit/Reproducer/Modules/Inputs/Foo.h Mon Feb 18 12:31:18 2019
@@ -0,0 +1 @@
+struct Foo {};

Added: lldb/trunk/lit/Reproducer/Modules/Inputs/ModuleCXX.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Modules/Inputs/ModuleCXX.in?rev=354283&view=auto
==
--- lldb/trunk/lit/Reproducer/Modules/Inputs/ModuleCXX.in (added)
+++ lldb/trunk/lit/Reproducer/Modules/Inputs/ModuleCXX.in Mon Feb 18 12:31:18 
2019
@@ -0,0 +1,6 @@
+breakpoint set -f main.cpp -l 5
+run
+expr -l Objective-C++ -- @import Foo
+expr -l Objective-C++ -- @import 

[Lldb-commits] [PATCH] D58309: [Reproducers] Have clang make use of lldb's VFS.

2019-02-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL354283: [Reproducers] Make clang use lldb's VFS. 
(authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D58309?vs=187116&id=187269#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D58309

Files:
  lldb/trunk/include/lldb/Host/FileSystem.h
  lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
  lldb/trunk/lit/Reproducer/Inputs/ModuleCapture.in
  lldb/trunk/lit/Reproducer/Modules/Inputs/Bar.h
  lldb/trunk/lit/Reproducer/Modules/Inputs/Foo.h
  lldb/trunk/lit/Reproducer/Modules/Inputs/ModuleCXX.in
  lldb/trunk/lit/Reproducer/Modules/Inputs/main.cpp
  lldb/trunk/lit/Reproducer/Modules/Inputs/module.modulemap
  lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test
  lldb/trunk/lit/Reproducer/TestClangFileRepro.test
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  lldb/trunk/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
  lldb/trunk/source/Symbol/ClangASTContext.cpp
  lldb/trunk/unittests/Language/Highlighting/HighlighterTest.cpp

Index: lldb/trunk/unittests/Language/Highlighting/HighlighterTest.cpp
===
--- lldb/trunk/unittests/Language/Highlighting/HighlighterTest.cpp
+++ lldb/trunk/unittests/Language/Highlighting/HighlighterTest.cpp
@@ -9,6 +9,7 @@
 #include "gtest/gtest.h"
 
 #include "lldb/Core/Highlighter.h"
+#include "lldb/Host/FileSystem.h"
 
 #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
 #include "Plugins/Language/ObjC/ObjCLanguage.h"
@@ -27,6 +28,7 @@
 void HighlighterTest::SetUpTestCase() {
   // The HighlighterManager uses the language plugins under the hood, so we
   // have to initialize them here for our test process.
+  FileSystem::Initialize();
   CPlusPlusLanguage::Initialize();
   ObjCLanguage::Initialize();
   ObjCPlusPlusLanguage::Initialize();
@@ -36,6 +38,7 @@
   CPlusPlusLanguage::Terminate();
   ObjCLanguage::Terminate();
   ObjCPlusPlusLanguage::Terminate();
+  FileSystem::Terminate();
 }
 
 static std::string getName(lldb::LanguageType type) {
Index: lldb/trunk/source/Symbol/ClangASTContext.cpp
===
--- lldb/trunk/source/Symbol/ClangASTContext.cpp
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp
@@ -911,7 +911,8 @@
 clang::FileManager *ClangASTContext::getFileManager() {
   if (m_file_manager_up == nullptr) {
 clang::FileSystemOptions file_system_options;
-m_file_manager_up.reset(new clang::FileManager(file_system_options));
+m_file_manager_up.reset(new clang::FileManager(
+file_system_options, FileSystem::Instance().GetVirtualFileSystem()));
   }
   return m_file_manager_up.get();
 }
Index: lldb/trunk/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
===
--- lldb/trunk/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
+++ lldb/trunk/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp
@@ -8,6 +8,7 @@
 
 #include "ClangHighlighter.h"
 
+#include "lldb/Host/FileSystem.h"
 #include "lldb/Target/Language.h"
 #include "lldb/Utility/AnsiTerminal.h"
 #include "lldb/Utility/StreamString.h"
@@ -135,7 +136,8 @@
   using namespace clang;
 
   FileSystemOptions file_opts;
-  FileManager file_mgr(file_opts);
+  FileManager file_mgr(file_opts,
+   FileSystem::Instance().GetVirtualFileSystem());
 
   unsigned line_number = previous_lines.count('\n') + 1U;
 
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -661,6 +661,8 @@
 opts.IncludeModuleFiles = true;
   }
 
+  // Make sure clang uses the same VFS as LLDB.
+  instance->setVirtualFileSystem(FileSystem::Instance().GetVirtualFileSystem());
   instance->setDiagnostics(diagnostics_engine.get());
   instance->setInvocation(invocation);
 
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -258,6 +258,10 @@
 opts.IncludeModuleFiles = true;
   }
 
+  // Make sure clang uses the same VFS as LLDB.
+  m_compiler->setVirtualFileSystem(
+  FileSystem::Instance().GetVirtualFileSystem());
+
   lldb::LanguageType frame_lang =
   expr.Language(); // defaults to lldb::eLanguageTypeUnknown
   boo

[Lldb-commits] [lldb] r354286 - [Python3] Fix TestObjCMethods.py to work with py2 and 3.

2019-02-18 Thread Davide Italiano via lldb-commits
Author: davide
Date: Mon Feb 18 13:53:02 2019
New Revision: 354286

URL: http://llvm.org/viewvc/llvm-project?rev=354286&view=rev
Log:
[Python3] Fix TestObjCMethods.py to work with py2 and 3.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py?rev=354286&r1=354285&r2=354286&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
 Mon Feb 18 13:53:02 2019
@@ -317,7 +317,7 @@ class FoundationTestCase(TestBase):
 lines = f.readlines()
 num_errors = 0
 for line in lines:
-if string.find(line, "$__lldb") != -1:
+if "$__lldb" in line:
 if num_errors == 0:
 print(
 "error: found spurious name lookups when 
evaluating an expression:")


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


[Lldb-commits] [lldb] r354287 - Clean up an unused variable warning when building this for

2019-02-18 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Feb 18 14:10:23 2019
New Revision: 354287

URL: http://llvm.org/viewvc/llvm-project?rev=354287&view=rev
Log:
Clean up an unused variable warning when building this for
mac native.

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=354287&r1=354286&r2=354287&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Mon Feb 18 
14:10:23 2019
@@ -3918,7 +3918,10 @@ void MachProcess::CalculateBoardStatus()
   if (m_pid == 0)
 return;
 
+#if defined (WITH_FBS) || defined (WITH_BKS)
 bool found_app_flavor = false;
+#endif
+
 #if defined(WITH_FBS)
 if (!found_app_flavor && IsFBSProcess(m_pid)) {
   found_app_flavor = true;
@@ -3930,6 +3933,7 @@ void MachProcess::CalculateBoardStatus()
   m_flags |= eMachProcessFlagsUsingBKS;
 }
 #endif
+
 m_flags |= eMachProcessFlagsBoardCalculated;
 }
 


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


[Lldb-commits] [lldb] r354288 - Ah, misunderstood Jonas' feedback - fix this so we'll

2019-02-18 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Feb 18 14:13:34 2019
New Revision: 354288

URL: http://llvm.org/viewvc/llvm-project?rev=354288&view=rev
Log:
Ah, misunderstood Jonas' feedback - fix this so we'll
do the right thing when both API are available.  We
want to try both of them if the first one fails.

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=354288&r1=354287&r2=354288&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Mon Feb 18 
14:13:34 2019
@@ -3927,7 +3927,8 @@ void MachProcess::CalculateBoardStatus()
   found_app_flavor = true;
   m_flags |= eMachProcessFlagsUsingFBS;
 }
-#elif defined(WITH_BKS)
+#endif
+#if defined(WITH_BKS)
 if (!found_app_flavor && IsBKSProcess(m_pid)) {
   found_app_flavor = true;
   m_flags |= eMachProcessFlagsUsingBKS;


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


[Lldb-commits] [lldb] r354289 - One more fix while I'm looking at this - remove the

2019-02-18 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Feb 18 14:18:11 2019
New Revision: 354289

URL: http://llvm.org/viewvc/llvm-project?rev=354289&view=rev
Log:
One more fix while I'm looking at this - remove the 
unused IsSBProcess method, and have IsFBSProcess
return false if we don't have API that we can use to
make that determination, so we'll try other API
if we can.

Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=354289&r1=354288&r2=354289&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Mon Feb 18 
14:18:11 2019
@@ -50,12 +50,6 @@
 #include 
 #include 
 
-static bool IsSBProcess(nub_process_t pid) {
-  CFReleaser appIdsForPID(
-  ::SBSCopyDisplayIdentifiersForProcessID(pid));
-  return appIdsForPID.get() != NULL;
-}
-
 #endif // WITH_SPRINGBOARD
 
 #if defined(WITH_SPRINGBOARD) || defined(WITH_BKS) || defined(WITH_FBS)
@@ -333,7 +327,7 @@ static bool IsFBSProcess(nub_process_t p
 #else
 static bool IsFBSProcess(nub_process_t pid) {
   // FIXME: What is the FBS equivalent of BKSApplicationStateMonitor
-  return true;
+  return false;
 }
 #endif
 


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


[Lldb-commits] [lldb] r354294 - [lldb-instr] Add constructor and move test into lit/tools

2019-02-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Feb 18 14:59:52 2019
New Revision: 354294

URL: http://llvm.org/viewvc/llvm-project?rev=354294&view=rev
Log:
[lldb-instr] Add constructor and move test into lit/tools

The test had an implicit constructor for the Foo struct. Also, as the
instrumentation doesn't have to be reproducer specific, I moved the
tests into the lit/tools directory.

Added:
lldb/trunk/lit/tools/lldb-instr/
lldb/trunk/lit/tools/lldb-instr/Inputs/
lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp
lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h
lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test
lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test
Removed:
lldb/trunk/lit/Reproducer/Inputs/foo.cpp
lldb/trunk/lit/Reproducer/TestInstrumentationRecord.test
lldb/trunk/lit/Reproducer/TestInstrumentationRegister.test

Removed: lldb/trunk/lit/Reproducer/Inputs/foo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Inputs/foo.cpp?rev=354293&view=auto
==
--- lldb/trunk/lit/Reproducer/Inputs/foo.cpp (original)
+++ lldb/trunk/lit/Reproducer/Inputs/foo.cpp (removed)
@@ -1,18 +0,0 @@
-struct Foo {
-  Foo();
-  Foo(int i);
-
-  void A();
-  void B(int i);
-  int C(int i);
-  int D(bool b) const;
-  static void E();
-  static int F(int i);
-};
-
-void Foo::A() {}
-void Foo::B(int i) {}
-int Foo::C(int i) { return i; }
-int Foo::D(bool b) const { return 1; }
-void Foo::E() {}
-int Foo::F(int i) { return i; }

Removed: lldb/trunk/lit/Reproducer/TestInstrumentationRecord.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestInstrumentationRecord.test?rev=354293&view=auto
==
--- lldb/trunk/lit/Reproducer/TestInstrumentationRecord.test (original)
+++ lldb/trunk/lit/Reproducer/TestInstrumentationRecord.test (removed)
@@ -1,10 +0,0 @@
-# RUN: cp %p/Inputs/foo.cpp %t.cpp
-# RUN: lldb-instr %t.cpp
-# RUN: cat %t.cpp | FileCheck %s
-
-# CHECK: LLDB_RECORD_METHOD_NO_ARGS(void, Foo, A);
-# CHECK: LLDB_RECORD_METHOD(void, Foo, B, (int), i);
-# CHECK: LLDB_RECORD_METHOD(int, Foo, C, (int), i);
-# CHECK: LLDB_RECORD_METHOD_CONST(int, Foo, D, (bool), b);
-# CHECK: LLDB_RECORD_STATIC_METHOD_NO_ARGS(void, Foo, E);
-# CHECK: LLDB_RECORD_STATIC_METHOD(int, Foo, F, (int), i);

Removed: lldb/trunk/lit/Reproducer/TestInstrumentationRegister.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestInstrumentationRegister.test?rev=354293&view=auto
==
--- lldb/trunk/lit/Reproducer/TestInstrumentationRegister.test (original)
+++ lldb/trunk/lit/Reproducer/TestInstrumentationRegister.test (removed)
@@ -1,9 +0,0 @@
-# RUN: cp %p/Inputs/foo.cpp %t.cpp
-# RUN: lldb-instr %t.cpp | FileCheck %s
-
-# CHECK: LLDB_REGISTER_METHOD(void, Foo, A, ());
-# CHECK: LLDB_REGISTER_METHOD(void, Foo, B, (int));
-# CHECK: LLDB_REGISTER_METHOD(int, Foo, C, (int));
-# CHECK: LLDB_REGISTER_METHOD_CONST(int, Foo, D, (bool));
-# CHECK: LLDB_REGISTER_STATIC_METHOD(void, Foo, E, ());
-# CHECK: LLDB_REGISTER_STATIC_METHOD(int, Foo, F, (int));

Added: lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp?rev=354294&view=auto
==
--- lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp (added)
+++ lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp Mon Feb 18 14:59:52 2019
@@ -0,0 +1,9 @@
+#include "foo.h"
+
+Foo::Foo() {}
+void Foo::A() {}
+void Foo::B(int i) {}
+int Foo::C(int i) { return i; }
+int Foo::D(bool b) const { return 1; }
+void Foo::E() {}
+int Foo::F(int i) { return i; }

Added: lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h?rev=354294&view=auto
==
--- lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h (added)
+++ lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h Mon Feb 18 14:59:52 2019
@@ -0,0 +1,12 @@
+struct Foo {
+  Foo();
+  Foo(int i);
+
+  void A();
+  void B(int i);
+  int C(int i);
+  int D(bool b) const;
+  static void E();
+  static int F(int i);
+  int G() { return 0; }
+};

Added: lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test?rev=354294&view=auto
==
--- lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test (added)
+++ lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test Mon Feb 18 
14:59:52 2019
@@ -0,0 +1,14 @@
+# RUN: mkdir -p %t.dir
+# RUN: cp %p/Inputs/foo.cpp %t.dir/foo.cpp
+# RUN: cp %p/Inputs/foo.h %t.d

[Lldb-commits] [lldb] r354297 - [lldbtest] Fix some code to be compatible between py2 and py3.

2019-02-18 Thread Davide Italiano via lldb-commits
Author: davide
Date: Mon Feb 18 15:18:14 2019
New Revision: 354297

URL: http://llvm.org/viewvc/llvm-project?rev=354297&view=rev
Log:
[lldbtest] Fix some code to be compatible between py2 and py3.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=354297&r1=354296&r2=354297&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Feb 18 15:18:14 
2019
@@ -438,27 +438,13 @@ def system(commands, **kwargs):
 stdout=PIPE,
 stderr=PIPE,
 shell=True,
-universal_newlines=True,
+#encoding="utf-8",
+#universal_newlines=True,
 **kwargs)
 pid = process.pid
 this_output, this_error = process.communicate()
 retcode = process.poll()
 
-# Enable trace on failure return while tracking down FreeBSD buildbot
-# issues
-trace = traceAlways
-if not trace and retcode and sys.platform.startswith("freebsd"):
-trace = True
-
-with recording(test, trace) as sbuf:
-print(file=sbuf)
-print("os command:", shellCommand, file=sbuf)
-print("with pid:", pid, file=sbuf)
-print("stdout:", this_output, file=sbuf)
-print("stderr:", this_error, file=sbuf)
-print("retcode:", retcode, file=sbuf)
-print(file=sbuf)
-
 if retcode:
 cmd = kwargs.get("args")
 if cmd is None:
@@ -471,8 +457,8 @@ def system(commands, **kwargs):
 "command": shellCommand
 }
 raise cpe
-output = output + this_output
-error = error + this_error
+output = output + this_output.decode("utf-8")
+error = error + this_error.decode("utf-8")
 return (output, error)
 
 


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


[Lldb-commits] [lldb] r354300 - Disable TestModuleCXX.test on Windows

2019-02-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Feb 18 16:08:10 2019
New Revision: 354300

URL: http://llvm.org/viewvc/llvm-project?rev=354300&view=rev
Log:
Disable TestModuleCXX.test on Windows

Importing cxx modules doesn't seem to work on Windows:

error: a.out :: Class 'tagARRAYDESC' has a member 'tdescElem' of type
  'tagTYPEDESC' which does not have a complete definition.
error: a.out :: Class 'tagPARAMDESCEX' has a member 'varDefaultValue' of type
  'tagVARIANT' which does not have a complete definition.

Modified:
lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test

Modified: lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test?rev=354300&r1=354299&r2=354300&view=diff
==
--- lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test (original)
+++ lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test Mon Feb 18 16:08:10 
2019
@@ -1,3 +1,5 @@
+# REQUIRES: nowindows
+
 # Start fresh.
 # RUN: rm -rf %t.root
 # RUN: rm -rf %t.clang-cache


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


[Lldb-commits] [lldb] r354301 - [lldb-instr] Wrap returns of struct/classes in LLDB_RECORD_RESULT

2019-02-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Feb 18 17:04:31 2019
New Revision: 354301

URL: http://llvm.org/viewvc/llvm-project?rev=354301&view=rev
Log:
[lldb-instr] Wrap returns of struct/classes in LLDB_RECORD_RESULT

The instrumentation framework requires return values of custom classes
and structs to be wrapped in the LLDB_RECORD_RESULT macro.

Modified:
lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp
lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h
lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test
lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test
lldb/trunk/tools/lldb-instr/Instrument.cpp

Modified: lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp?rev=354301&r1=354300&r2=354301&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp (original)
+++ lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp Mon Feb 18 17:04:31 2019
@@ -7,3 +7,5 @@ int Foo::C(int i) { return i; }
 int Foo::D(bool b) const { return 1; }
 void Foo::E() {}
 int Foo::F(int i) { return i; }
+void Foo::G(const char *fmt...) {}
+Foo Foo::H() { return Foo(); }

Modified: lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h?rev=354301&r1=354300&r2=354301&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h (original)
+++ lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h Mon Feb 18 17:04:31 2019
@@ -8,5 +8,6 @@ struct Foo {
   int D(bool b) const;
   static void E();
   static int F(int i);
-  int G() { return 0; }
+  void G(const char* fmt...);
+  static Foo H();
 };

Modified: lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test?rev=354301&r1=354300&r2=354301&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test (original)
+++ lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test Mon Feb 18 
17:04:31 2019
@@ -12,3 +12,6 @@
 # CHECK: LLDB_RECORD_METHOD_CONST(int, Foo, D, (bool), b);
 # CHECK: LLDB_RECORD_STATIC_METHOD_NO_ARGS(void, Foo, E);
 # CHECK: LLDB_RECORD_STATIC_METHOD(int, Foo, F, (int), i);
+# CHECK-NOT: LLDB_RECORD_STATIC_METHOD(void, Foo, G
+# CHECK: LLDB_RECORD_STATIC_METHOD_NO_ARGS(Foo, Foo, H);
+# CHECK: LLDB_RECORD_RESULT(Foo())

Modified: lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test?rev=354301&r1=354300&r2=354301&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test (original)
+++ lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRegister.test Mon Feb 18 
17:04:31 2019
@@ -10,3 +10,4 @@
 # CHECK: LLDB_REGISTER_METHOD_CONST(int, Foo, D, (bool));
 # CHECK: LLDB_REGISTER_STATIC_METHOD(void, Foo, E, ());
 # CHECK: LLDB_REGISTER_STATIC_METHOD(int, Foo, F, (int));
+# CHECK-NOT: LLDB_REGISTER_STATIC_METHOD(void, Foo, G

Modified: lldb/trunk/tools/lldb-instr/Instrument.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-instr/Instrument.cpp?rev=354301&r1=354300&r2=354301&view=diff
==
--- lldb/trunk/tools/lldb-instr/Instrument.cpp (original)
+++ lldb/trunk/tools/lldb-instr/Instrument.cpp Mon Feb 18 17:04:31 2019
@@ -120,6 +120,33 @@ static std::string GetRegisterMethodMacr
   return OS.str();
 }
 
+class SBReturnVisitor : public RecursiveASTVisitor {
+public:
+  SBReturnVisitor(Rewriter &R) : MyRewriter(R) {}
+
+  bool VisitReturnStmt(ReturnStmt *Stmt) {
+Expr *E = Stmt->getRetValue();
+
+if (E->getBeginLoc().isMacroID())
+  return false;
+
+SourceRange R(E->getBeginLoc(), E->getEndLoc());
+
+StringRef WrittenExpr = Lexer::getSourceText(
+CharSourceRange::getTokenRange(R), MyRewriter.getSourceMgr(),
+MyRewriter.getLangOpts());
+
+std::string ReplacementText =
+"LLDB_RECORD_RESULT(" + WrittenExpr.str() + ")";
+MyRewriter.ReplaceText(R, ReplacementText);
+
+return true;
+  }
+
+private:
+  Rewriter &MyRewriter;
+};
+
 class SBVisitor : public RecursiveASTVisitor {
 public:
   SBVisitor(Rewriter &R, ASTContext &Context)
@@ -200,6 +227,13 @@ public:
 MyRewriter.getLangOpts());
 MyRewriter.InsertTextAfter(InsertLoc, Macro);
 
+// If the function returns a class or struct, we need to wrap its return
+// statement(s).
+if (ReturnType->isStructureOrClassType()) {
+  SBReturnVisitor Visitor(MyRewriter);
+  Visitor.TraverseDecl(Decl);
+}
+
 return true;
   }

Re: [Lldb-commits] [lldb] r354105 - Use sys.executable in lldb-dotest

2019-02-18 Thread Jonas Devlieghere via lldb-commits
Great!

On Thu, Feb 14, 2019 at 11:40 PM Pavel Labath via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: labath
> Date: Thu Feb 14 23:41:17 2019
> New Revision: 354105
>
> URL: http://llvm.org/viewvc/llvm-project?rev=354105&view=rev
> Log:
> Use sys.executable in lldb-dotest
>
> Without that, dotest.py would be executed with the default python
> interpreter, which may not be the same one that lldb is built with.
>
> This still requires the user do know which python interpreter to use
> when running lldb-dotest, but now he is at least able to choose it, if
> he knows which one to use.
>
> Modified:
> lldb/trunk/utils/lldb-dotest/lldb-dotest.in
>
> Modified: lldb/trunk/utils/lldb-dotest/lldb-dotest.in
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lldb-dotest/lldb-dotest.in?rev=354105&r1=354104&r2=354105&view=diff
>
> ==
> --- lldb/trunk/utils/lldb-dotest/lldb-dotest.in (original)
> +++ lldb/trunk/utils/lldb-dotest/lldb-dotest.in Thu Feb 14 23:41:17 2019
> @@ -9,7 +9,7 @@ if __name__ == '__main__':
>  wrapper_args = sys.argv[1:]
>  dotest_args = dotest_args_str.split(';')
>  # Build dotest.py command.
> -cmd = [dotest_path, '-q']
> +cmd = [sys.executable, dotest_path, '-q']
>  cmd.extend(dotest_args)
>  cmd.extend(wrapper_args)
>  # Invoke dotest.py and return exit code.
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r354303 - [lldb-instr] Test that we ignore existing macros.

2019-02-18 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Feb 18 17:20:49 2019
New Revision: 354303

URL: http://llvm.org/viewvc/llvm-project?rev=354303&view=rev
Log:
[lldb-instr] Test that we ignore existing macros.

Although the functionality was already present, it wasn't tested.

Modified:
lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp
lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h
lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test

Modified: lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp?rev=354303&r1=354302&r2=354303&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp (original)
+++ lldb/trunk/lit/tools/lldb-instr/Inputs/foo.cpp Mon Feb 18 17:20:49 2019
@@ -1,5 +1,9 @@
 #include "foo.h"
 
+#define MACRO_FOO  
\
+  { void; }
+#define MACRO_BAR(B) B
+
 Foo::Foo() {}
 void Foo::A() {}
 void Foo::B(int i) {}
@@ -9,3 +13,5 @@ void Foo::E() {}
 int Foo::F(int i) { return i; }
 void Foo::G(const char *fmt...) {}
 Foo Foo::H() { return Foo(); }
+void Foo::I() const { MACRO_FOO; }
+Bar Foo::J() const { return MACRO_BAR(Bar()); }

Modified: lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h?rev=354303&r1=354302&r2=354303&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h (original)
+++ lldb/trunk/lit/tools/lldb-instr/Inputs/foo.h Mon Feb 18 17:20:49 2019
@@ -1,3 +1,4 @@
+struct Bar {};
 struct Foo {
   Foo();
   Foo(int i);
@@ -8,6 +9,8 @@ struct Foo {
   int D(bool b) const;
   static void E();
   static int F(int i);
-  void G(const char* fmt...);
+  void G(const char *fmt...);
   static Foo H();
+  void I() const;
+  Bar J() const;
 };

Modified: lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test?rev=354303&r1=354302&r2=354303&view=diff
==
--- lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test (original)
+++ lldb/trunk/lit/tools/lldb-instr/TestInstrumentationRecord.test Mon Feb 18 
17:20:49 2019
@@ -15,3 +15,6 @@
 # CHECK-NOT: LLDB_RECORD_STATIC_METHOD(void, Foo, G
 # CHECK: LLDB_RECORD_STATIC_METHOD_NO_ARGS(Foo, Foo, H);
 # CHECK: LLDB_RECORD_RESULT(Foo())
+# CHECK-NOT: LLDB_RECORD_METHOD_CONST_NO_ARGS(void, Foo, I);
+# CHECK: LLDB_RECORD_METHOD_CONST_NO_ARGS(Bar, Foo, J);
+# CHECK-NOT: LLDB_RECORD_RESULT(Bar());


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


[Lldb-commits] [PATCH] D57475: [Reproducers] Add SBReproducer macros

2019-02-18 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 187287.
JDevlieghere added a comment.
Herald added a subscriber: jdoerfert.

- Rebase
- Re-ran the latest version of the tool to insert `LLDB_RECORD_RESULT`


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

https://reviews.llvm.org/D57475

Files:
  lldb/source/API/SBAddress.cpp
  lldb/source/API/SBAttachInfo.cpp
  lldb/source/API/SBBlock.cpp
  lldb/source/API/SBBreakpoint.cpp
  lldb/source/API/SBBreakpointLocation.cpp
  lldb/source/API/SBBreakpointName.cpp
  lldb/source/API/SBBreakpointOptionCommon.cpp
  lldb/source/API/SBBroadcaster.cpp
  lldb/source/API/SBCommandInterpreter.cpp
  lldb/source/API/SBCommandReturnObject.cpp
  lldb/source/API/SBCommunication.cpp
  lldb/source/API/SBCompileUnit.cpp
  lldb/source/API/SBData.cpp
  lldb/source/API/SBDebugger.cpp
  lldb/source/API/SBDeclaration.cpp
  lldb/source/API/SBError.cpp
  lldb/source/API/SBEvent.cpp
  lldb/source/API/SBExecutionContext.cpp
  lldb/source/API/SBExpressionOptions.cpp
  lldb/source/API/SBFileSpec.cpp
  lldb/source/API/SBFileSpecList.cpp
  lldb/source/API/SBFrame.cpp
  lldb/source/API/SBFunction.cpp
  lldb/source/API/SBHostOS.cpp
  lldb/source/API/SBInitializerOptions.cpp
  lldb/source/API/SBInstruction.cpp
  lldb/source/API/SBInstructionList.cpp
  lldb/source/API/SBLanguageRuntime.cpp
  lldb/source/API/SBLaunchInfo.cpp
  lldb/source/API/SBLineEntry.cpp
  lldb/source/API/SBListener.cpp
  lldb/source/API/SBMemoryRegionInfo.cpp
  lldb/source/API/SBMemoryRegionInfoList.cpp
  lldb/source/API/SBModule.cpp
  lldb/source/API/SBModuleSpec.cpp
  lldb/source/API/SBPlatform.cpp
  lldb/source/API/SBProcess.cpp
  lldb/source/API/SBProcessInfo.cpp
  lldb/source/API/SBQueue.cpp
  lldb/source/API/SBQueueItem.cpp
  lldb/source/API/SBReproducer.cpp
  lldb/source/API/SBSection.cpp
  lldb/source/API/SBSourceManager.cpp
  lldb/source/API/SBStream.cpp
  lldb/source/API/SBStringList.cpp
  lldb/source/API/SBStructuredData.cpp
  lldb/source/API/SBSymbol.cpp
  lldb/source/API/SBSymbolContext.cpp
  lldb/source/API/SBSymbolContextList.cpp
  lldb/source/API/SBTarget.cpp
  lldb/source/API/SBThread.cpp
  lldb/source/API/SBThreadCollection.cpp
  lldb/source/API/SBThreadPlan.cpp
  lldb/source/API/SBTrace.cpp
  lldb/source/API/SBTraceOptions.cpp
  lldb/source/API/SBType.cpp
  lldb/source/API/SBTypeCategory.cpp
  lldb/source/API/SBTypeEnumMember.cpp
  lldb/source/API/SBTypeFilter.cpp
  lldb/source/API/SBTypeFormat.cpp
  lldb/source/API/SBTypeNameSpecifier.cpp
  lldb/source/API/SBTypeSummary.cpp
  lldb/source/API/SBTypeSynthetic.cpp
  lldb/source/API/SBUnixSignals.cpp
  lldb/source/API/SBValue.cpp
  lldb/source/API/SBValueList.cpp
  lldb/source/API/SBVariablesOptions.cpp
  lldb/source/API/SBWatchpoint.cpp



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


[Lldb-commits] [PATCH] D57475: [Reproducers] Add SBReproducer macros

2019-02-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


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

https://reviews.llvm.org/D57475



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