[Lldb-commits] [PATCH] D58410: [Reproducers] Initialize reproducers before initializing the debugger.

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

I think this looks mostly fine. See my comment about not using SB classes in 
the reproducer api. I still kind of like the idea of naming the reproducer 
class in some special way, to make it more obvious that it is not "just 
another" SB class, but I'm not sure if that would be just more confusing.




Comment at: lldb/include/lldb/API/SBReproducer.h:18-20
   static bool Replay();
+  static lldb::SBError InitializeCapture(const char *path);
+  static lldb::SBError InitializeReplay(const char *path);

So, in this new world, how are we expected to perform the replay? 
`InitializeReplay()`, followed by `Replay()` ? Could we fold those two calls 
into one? I don't see what meaningful work could the user do between those two 
calls, as all sb calls (including SBDebugger::Initialize) will now be recorded 
(right?).



Comment at: lldb/source/API/SBDebugger.cpp:127
 void SBDebugger::Initialize() {
-  SBInitializerOptions options;
-  SBDebugger::Initialize(options);
+  SBError ignored = SBDebugger::InitializeWithErrorHandling();
 }

I think the usual way to do that is to just cast the result to void.



Comment at: lldb/source/API/SBReproducer.cpp:49
+SBError SBReproducer::InitializeCapture(const char *path) {
+  SBError error;
+  if (auto e = Reproducer::Initialize(ReproducerMode::Capture, FileSpec(path)))

JDevlieghere wrote:
> The SBError is a problem. We can create it after the initialization, but then 
> we’d need a bogus repro::Record to make sure the api boundary is correctly 
> registered. Let me know if you can think of an alternative.
Maybe this function should not return an SBError at all (just like it does not 
accept an SBFileSpec due to bootstrapping problems). You could just return a 
std::string, and have an empty string denote success. This would be consistent 
with the idea that the repro API is not a part of SB API, but rather something 
sitting slightly above (or at least, besides) it.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58410



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


[Lldb-commits] [PATCH] D54670: 03/03: .debug_types: Update of D32167 (.debug_types) on top of D51578 (section concatenation)

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

I am still worried about the divergence from llvm's dwarf reader here. We now 
have a relatively nice Object API, which presents a view of the object file 
that everybody is used to (i.e., as a bunch of sections). This includes the 
llvm object and dwarf readers, and the DWARF spec (!). But now we are drilling 
a hole in that API, which basically reverts the sections and gives us back the 
a view of the object file as a stream of bytes. And if the object file happens 
to be compressed, then we have to mock up a new uncompressed buffer with all of 
the data, even though the compression is supposed to be transparent and 
unobtrusive (and it mostly is, if you stick to viewing the object file as a 
collection of sections). All because our dwarf reader cannot handle the fact 
that the debug info can come from multiple sections? How come nobody else has 
this problem?

Treating dwarf data as a single buffer with various chunks starting at random 
offsets should essentially be isomorphous with treating it as a collection of 
independent buffers. We are here introducing a function called 
`get_debug_types_offset`. Why not have `get_debug_types_data_extractor()` 
instead? That may mean some functions need to be changed so that they take an 
additional buffer argument, instead of just assuming everything refers to the 
single grand buffer, but I think that's a good thing, because it brings us 
closer to reality instead of continuing to fabricate ever more complicated 
fiction. BTW, I don't see a `get_debug_info_offset()`. AFAIK, there's no 
requirement that .debug_info has to come first in an object file. What would 
happen if the order of the sections in the object file is reversed?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54670



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


[Lldb-commits] [PATCH] D58394: Add --auto-continue to stop-hooks, fix up a few tests

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

Thank you for jumping onto this. I've tried the patch out on linux, and the 
stop-hook-threads.test now passes. However, the basic test now fails for me 
because the stop hook isn't fired in the "run" command. it is caused by the "is 
hijacked" check in `ProcessEventData::DoOnRemoval`, as removing that condition 
causes to hook to fire, but that's probably not the right thing to do here. The 
difference here is probably caused by PlatformLinux hijacking the process 
events during the launch sequence 
https://github.com/llvm-mirror/lldb/blob/76c0545e7f24cd6636df61292472df64cfa2900e/source/Plugins/Platform/Linux/PlatformLinux.cpp#L337,
 but I am not sure where is the error here. I definitely know that there is 
something fishy going on in PlatformLinux, as e.g. we don't get a "Process XXX 
stopped" message when launching with the --stop-at-entry flag, so it's quite 
possible the error is there. If you think that the general behavior is right 
there, then we can just XFAIL this test for linux, and one of us will get to 
fixing PlatformLinux eventually.




Comment at: lit/ExecControl/StopHook/stop-hook-threads.test:36
 # When we don't filter, we expect to count 12 stopped threads in the thread 
list output
-# CHECK-NO-FILTER-COUNT-12: at stop-hook-threads.cpp{{.*}} stop reason = 
breakpoint
\ No newline at end of file
+# CHECK-NO-FILTER-COUNT-12: , stop reason = breakpoint 3.1

BTW, this check is fairly dodgy, because in the case of two threads hitting a 
breakpoint simultaneously, we will get 4 stop reasons instead of two ("thread 
list" will be executed twice, and each instance will print the stop reason for 
both threads). It might be better to replace "thread list" with a different 
command, or add synchronization to the test to prevent two threads from hitting 
the breakpoint at once, depending on what we want to test.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58394



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


[Lldb-commits] [PATCH] D58398: Add Facebook Minidump directory streams and options to dump them.

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

lgtm


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58398



___
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-20 Thread Pavel Labath via Phabricator via lldb-commits
labath marked 2 inline comments as done.
labath added inline comments.



Comment at: source/Core/Module.cpp:1451-1454
+// Clear the unwind table too, as that may also be affected by the
+// symbol file information.
+m_unwind_table.reset();
+

jasonmolenda wrote:
> clayborg wrote:
> > Are we sure no one is holding onto info that was given out from an existing 
> > UnwindTable? What if we do a backtrace, then load symbol files and then do 
> > another backtrace? Seems like we will want to keep our existing info and 
> > just call m_unwind_table->Clear()?
> I THINK it will be OK.  RegisterContextLLDB holds shared pointers to the 
> UnwindPlans that it got from the UnwindTable, so those will stay alive.  An 
> UnwindPlan doesn't refer back to the UnwindTable it came from.
I agree with Jason. Nobody should store any pointers to the unwind table, and 
the FuncUnwinders and UnwindPlan objects are already handed out as shared 
pointers (but those shouldn't persist for long either, or otherwise our new 
unwind info wouldn't be effective).  If we find a good reason to store the old 
unwind table, we can always do the thing like we do for SymbolFiles (where the 
Module keeps a list of all SymbolFile objects it ever had), but I hope that 
will not be necessary.


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

https://reviews.llvm.org/D58347



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


[Lldb-commits] [PATCH] D54670: 03/03: .debug_types: Update of D32167 (.debug_types) on top of D51578 (section concatenation)

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

In D54670#1403642 , @labath wrote:

> I am still worried about the divergence from llvm's dwarf reader here.


I am still going to investigate your `DW_FORM_*` dispatching suggestion 
.  It looks too simple to work, maybe 
it is the right way forward.

> the debug info can come from multiple sections? How come nobody else has this 
> problem?

Because GDB does not need to return back to DWARF after it is parsed - but then 
for LLDB the multiple-sections dispatching could be done only for `user_id_t`

> Why not have `get_debug_types_data_extractor()` instead?

Because DataExtractor accesses always start at offset 0.

> BTW, I don't see a `get_debug_info_offset()`. AFAIK, there's no requirement 
> that .debug_info has to come first in an object file. What would happen if 
> the order of the sections in the object file is reversed?

It would fall back to the section-reading (instead of section-mmapping) less 
performing fallback in `get_debug_info_data()`.  If there are any such files 
out there sure the code could be extended to handle both orders of 
`.debug_info` and `.debug_types` but personally I do not think it is worth the 
code complication given there is the fallback anyway. I can put a warning there 
for such case so that it would be easily noticed in the future - but then maybe 
one could already rather extend the code, any suggestions what to choose?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54670



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


[Lldb-commits] [PATCH] D54670: 03/03: .debug_types: Update of D32167 (.debug_types) on top of D51578 (section concatenation)

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

In D54670#1403670 , @jankratochvil 
wrote:

> In D54670#1403642 , @labath wrote:
>
> > I am still worried about the divergence from llvm's dwarf reader here.
>
>
> I am still going to investigate your `DW_FORM_*` dispatching suggestion 
> .  It looks too simple to work, 
> maybe it is the right way forward.


Thank you for doing that. Please don't feel like I'm taking this all out to 
you, I know that you are following the direction that has already been set out. 
My comment is directed at everyone who has interest in the state of lldb's 
dwarf parser.

And I am fully aware that my proposal is a gross oversimplification, and that 
doing that might be hard, but I believe the end goal is worth it, and that we 
can reach it incrementally.

One of the problems we'll probably have to tackle is the encoding of the 
user_id_t, which is currently very wastefull. Despite it being 64 bits, we can 
only encode 4GB of debug info. That's still a fairly large number, but it's 
still not that hard to surpass it. If we slice one bit out of that,  we'll get 
2GB, which will be just too small. So we'll either have to increase the size of 
that type, use a more rational encoding (we already have compile units and dies 
sitting in a vector, so maybe index into that vector?), or use some 
concatenation scheme just for the purposes of user_id_t, but then bail out and 
decompose that very early on.

>> Why not have `get_debug_types_data_extractor()` instead?
> 
> Because DataExtractor accesses always start at offset 0.

Yes, that's part of the idea. :) Starting at zero is the right thing to do 
here, as that's the base any intra-section references will be using. (and for 
inter-section refs, you have to manually fiddle with the offsets anyway)

> 
> 
>> BTW, I don't see a `get_debug_info_offset()`. AFAIK, there's no requirement 
>> that .debug_info has to come first in an object file. What would happen if 
>> the order of the sections in the object file is reversed?
> 
> It would fall back to the section-reading (instead of section-mmapping) less 
> performing fallback in `get_debug_info_data()`.  If there are any such files 
> out there sure the code could be extended to handle both orders of 
> `.debug_info` and `.debug_types` but personally I do not think it is worth 
> the code complication given there is the fallback anyway. I can put a warning 
> there for such case so that it would be easily noticed in the future - but 
> then maybe one could already rather extend the code, any suggestions what to 
> choose?

Hm... ok, I'm glad you've thought about all of the possibilities. Though I 
would say that this just show that we have an incorrect abstraction here. :)

Of the two options I would say only adding the warning makes sense, since I 
believe making everything aware of the fact that .debug_info can start at a 
non-zero offset is equivalent to teaching it that it can start in a different 
section.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54670



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


[Lldb-commits] [lldb] r354466 - [lldb] [ObjectFile/ELF] Fix recognizing NetBSD images

2019-02-20 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Wed Feb 20 06:31:06 2019
New Revision: 354466

URL: http://llvm.org/viewvc/llvm-project?rev=354466&view=rev
Log:
[lldb] [ObjectFile/ELF] Fix recognizing NetBSD images

Split the recognition into NetBSD executables & shared libraries
and core(5) files.

Introduce new owner type: "NetBSD-CORE", as core(5) files are not tagged
in the same way as regular NetBSD executables.

Stop using incorrectly ABI_TAG and ABI_SIZE.  Introduce IDENT_TAG,
IDENT_DECSZ, IDENT_NAMESZ and PROCINFO.

The new values detect correctly the NetBSD images.

The patch has been originally written by Kamil Rytarowski.  I've added
tests and applied minor code changes per review.  The work has been
sponsored by the NetBSD Foundation.

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

Added:
lldb/trunk/lit/Modules/ELF/Inputs/netbsd-amd64.core   (with props)
lldb/trunk/lit/Modules/ELF/netbsd-core-amd64.test
lldb/trunk/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
Modified:
lldb/trunk/lit/Modules/lit.local.cfg
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Added: lldb/trunk/lit/Modules/ELF/Inputs/netbsd-amd64.core
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/Inputs/netbsd-amd64.core?rev=354466&view=auto
==
Binary file - no diff available.

Propchange: lldb/trunk/lit/Modules/ELF/Inputs/netbsd-amd64.core
--
svn:mime-type = application/x-coredump

Added: lldb/trunk/lit/Modules/ELF/netbsd-core-amd64.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/netbsd-core-amd64.test?rev=354466&view=auto
==
--- lldb/trunk/lit/Modules/ELF/netbsd-core-amd64.test (added)
+++ lldb/trunk/lit/Modules/ELF/netbsd-core-amd64.test Wed Feb 20 06:31:06 2019
@@ -0,0 +1,12 @@
+# Test whether NetBSD core dumps are recognized correctly.
+
+# Core dump generated by the following program:
+# int main() {
+#   void* v = 0;
+#   *v = 1;
+#   return 0;
+# }
+
+# RUN: lldb-test object-file %S/Inputs/netbsd-amd64.core | FileCheck %s
+# CHECK: Architecture: x86_64-unknown-netbsd
+# CHECK: Type: core file

Added: lldb/trunk/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml?rev=354466&view=auto
==
--- lldb/trunk/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml (added)
+++ lldb/trunk/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml Wed Feb 20 
06:31:06 2019
@@ -0,0 +1,22 @@
+# 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:.note.netbsd.ident
+Type:SHT_NOTE
+Flags:   [ SHF_ALLOC ]
+Address: 0x002005A8
+AddressAlign:0x0004
+Content: 0700040001004E657442534478B29535
+...

Modified: lldb/trunk/lit/Modules/lit.local.cfg
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/lit.local.cfg?rev=354466&r1=354465&r2=354466&view=diff
==
--- lldb/trunk/lit/Modules/lit.local.cfg (original)
+++ lldb/trunk/lit/Modules/lit.local.cfg Wed Feb 20 06:31:06 2019
@@ -1 +1 @@
-config.suffixes = ['.s', '.yaml']
+config.suffixes = ['.s', '.test', '.yaml']

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=354466&r1=354465&r2=354466&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Wed Feb 20 
06:31:06 2019
@@ -55,6 +55,7 @@ namespace {
 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_ABI_SIZE = 16
 
 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_IDENT_TAG = 1;
+const elf_wo

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

2019-02-20 Thread Michał Górny via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB354466: [lldb] [ObjectFile/ELF] Fix recognizing NetBSD 
images (authored by mgorny, committed by ).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D42870?vs=187358&id=187565#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D42870

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

Index: lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
===
--- lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
+++ lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
@@ -0,0 +1,22 @@
+# 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:.note.netbsd.ident
+Type:SHT_NOTE
+Flags:   [ SHF_ALLOC ]
+Address: 0x002005A8
+AddressAlign:0x0004
+Content: 0700040001004E657442534478B29535
+...
Index: lit/Modules/ELF/netbsd-core-amd64.test
===
--- lit/Modules/ELF/netbsd-core-amd64.test
+++ lit/Modules/ELF/netbsd-core-amd64.test
@@ -0,0 +1,12 @@
+# Test whether NetBSD core dumps are recognized correctly.
+
+# Core dump generated by the following program:
+# int main() {
+#   void* v = 0;
+#   *v = 1;
+#   return 0;
+# }
+
+# RUN: lldb-test object-file %S/Inputs/netbsd-amd64.core | FileCheck %s
+# CHECK: Architecture: x86_64-unknown-netbsd
+# CHECK: Type: core file
Index: lit/Modules/lit.local.cfg
===
--- lit/Modules/lit.local.cfg
+++ lit/Modules/lit.local.cfg
@@ -1 +1 @@
-config.suffixes = ['.s', '.yaml']
+config.suffixes = ['.s', '.test', '.yaml']
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ 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_IDENT_TAG = 1;
+const elf_word LLDB_NT_NETBSD_IDENT_DESCSZ = 4;
+const elf_word LLDB_NT_NETBSD_IDENT_NAMESZ = 7;
+const elf_word LLDB_NT_NETBSD_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_IDENT_TAG) &&
+ (note.n_descsz == LLDB_NT_NETBSD_IDENT_DESCSZ) &&
+ (note.n_namesz == LLDB_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.

Re: [Lldb-commits] [lldb] r354466 - [lldb] [ObjectFile/ELF] Fix recognizing NetBSD images

2019-02-20 Thread Davide Italiano via lldb-commits
This broke the bots, link:

http://green.lab.llvm.org/green/job/lldb-cmake/20047/

Can you please take a look and see what's needed to fix (and revert otherwise)?

Thanks

On Wed, Feb 20, 2019 at 6:30 AM Michal Gorny via lldb-commits
 wrote:
>
> Author: mgorny
> Date: Wed Feb 20 06:31:06 2019
> New Revision: 354466
>
> URL: http://llvm.org/viewvc/llvm-project?rev=354466&view=rev
> Log:
> [lldb] [ObjectFile/ELF] Fix recognizing NetBSD images
>
> Split the recognition into NetBSD executables & shared libraries
> and core(5) files.
>
> Introduce new owner type: "NetBSD-CORE", as core(5) files are not tagged
> in the same way as regular NetBSD executables.
>
> Stop using incorrectly ABI_TAG and ABI_SIZE.  Introduce IDENT_TAG,
> IDENT_DECSZ, IDENT_NAMESZ and PROCINFO.
>
> The new values detect correctly the NetBSD images.
>
> The patch has been originally written by Kamil Rytarowski.  I've added
> tests and applied minor code changes per review.  The work has been
> sponsored by the NetBSD Foundation.
>
> Differential Revision: https://reviews.llvm.org/D42870
>
> Added:
> lldb/trunk/lit/Modules/ELF/Inputs/netbsd-amd64.core   (with props)
> lldb/trunk/lit/Modules/ELF/netbsd-core-amd64.test
> lldb/trunk/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
> Modified:
> lldb/trunk/lit/Modules/lit.local.cfg
> lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
>
> Added: lldb/trunk/lit/Modules/ELF/Inputs/netbsd-amd64.core
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/Inputs/netbsd-amd64.core?rev=354466&view=auto
> ==
> Binary file - no diff available.
>
> Propchange: lldb/trunk/lit/Modules/ELF/Inputs/netbsd-amd64.core
> --
> svn:mime-type = application/x-coredump
>
> Added: lldb/trunk/lit/Modules/ELF/netbsd-core-amd64.test
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/netbsd-core-amd64.test?rev=354466&view=auto
> ==
> --- lldb/trunk/lit/Modules/ELF/netbsd-core-amd64.test (added)
> +++ lldb/trunk/lit/Modules/ELF/netbsd-core-amd64.test Wed Feb 20 06:31:06 2019
> @@ -0,0 +1,12 @@
> +# Test whether NetBSD core dumps are recognized correctly.
> +
> +# Core dump generated by the following program:
> +# int main() {
> +#   void* v = 0;
> +#   *v = 1;
> +#   return 0;
> +# }
> +
> +# RUN: lldb-test object-file %S/Inputs/netbsd-amd64.core | FileCheck %s
> +# CHECK: Architecture: x86_64-unknown-netbsd
> +# CHECK: Type: core file
>
> Added: lldb/trunk/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml?rev=354466&view=auto
> ==
> --- lldb/trunk/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml (added)
> +++ lldb/trunk/lit/Modules/ELF/netbsd-exec-8.99.30-amd64.yaml Wed Feb 20 
> 06:31:06 2019
> @@ -0,0 +1,22 @@
> +# 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:.note.netbsd.ident
> +Type:SHT_NOTE
> +Flags:   [ SHF_ALLOC ]
> +Address: 0x002005A8
> +AddressAlign:0x0004
> +Content: 0700040001004E657442534478B29535
> +...
>
> Modified: lldb/trunk/lit/Modules/lit.local.cfg
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/lit.local.cfg?rev=354466&r1=354465&r2=354466&view=diff
> ==
> --- lldb/trunk/lit/Modules/lit.local.cfg (original)
> +++ lldb/trunk/lit/Modules/lit.local.cfg Wed Feb 20 06:31:06 2019
> @@ -1 +1 @@
> -config.suffixes = ['.s', '.yaml']
> +config.suffixes = ['.s', '.test', '.yaml']
>
> Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=354466&r1=354465&r2=354466&view=diff
> ==
> --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
> +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Wed Feb 20 
> 06:31:06 2019
> @@ -55,6 +55,7 @@ namespace {
>  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_OWNE

[Lldb-commits] [lldb] r354483 - [lldb] [test] Fix expected netbsd output for TestImageListMultiArchitecture

2019-02-20 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Wed Feb 20 09:10:34 2019
New Revision: 354483

URL: http://llvm.org/viewvc/llvm-project?rev=354483&view=rev
Log:
[lldb] [test] Fix expected netbsd output for TestImageListMultiArchitecture

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py?rev=354483&r1=354482&r2=354483&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/object-file/TestImageListMultiArchitecture.py
 Wed Feb 20 09:10:34 2019
@@ -27,7 +27,7 @@ class TestImageListMultiArchitecture(Tes
 images = {
 "hello-freebsd-10.0-x86_64-clang-3.3": 
re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
 "hello-freebsd-10.0-x86_64-gcc-4.7.3": 
re.compile(r"x86_64-(\*)?-freebsd10.0(-unknown)? x86_64"),
-"hello-netbsd-6.1-x86_64-gcc-4.5.3": 
re.compile(r"x86_64-(\*)?-netbsd(-unknown)? x86_64"),
+"hello-netbsd-6.1-x86_64-gcc-4.5.3": 
re.compile(r"x86_64-(\*)?-netbsd6.1.4(-unknown)? x86_64"),
 "hello-ubuntu-14.04-x86_64-gcc-4.8.2": 
re.compile(r"x86_64-(\*)?-linux(-unknown)? x86_64"),
 "hello-ubuntu-14.04-x86_64-clang-3.5pre": 
re.compile(r"x86_64-(\*)?-linux(-unknown)? x86_64"),
 "hello-unknown-kalimba_arch4-kcc-36": 
re.compile(r"kalimba4-csr-(unknown|\*)(-unknown)? kalimba"),


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


Re: [Lldb-commits] [lldb] r354466 - [lldb] [ObjectFile/ELF] Fix recognizing NetBSD images

2019-02-20 Thread Michał Górny via lldb-commits
On Wed, 2019-02-20 at 08:39 -0800, Davide Italiano wrote:
> This broke the bots, link:
> 
> http://green.lab.llvm.org/green/job/lldb-cmake/20047/
> 
> Can you please take a look and see what's needed to fix (and revert 
> otherwise)?
> 

Thanks for the ping.  I've just committed the update for this test.
If it doesn't resolve it, I'm going to revert the changes.

-- 
Best regards,
Michał Górny


signature.asc
Description: This is a digitally signed message part
___
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-20 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

This broke the windows bot:

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


Repository:
  rLLDB LLDB

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


Re: [Lldb-commits] [lldb] r354425 - [TestModuleCXX] Use UNSUPPORTED instead of REQUIRES

2019-02-20 Thread Jan Kratochvil via lldb-commits
On Wed, 20 Feb 2019 02:49:16 +0100, Jonas Devlieghere via lldb-commits wrote:
> Author: jdevlieghere
> Date: Tue Feb 19 17:49:16 2019
> New Revision: 354425
...
> --- lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test (original)
> +++ lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test Tue Feb 19 17:49:16 
> 2019
> @@ -1,4 +1,4 @@
> -# REQUIRES: nowindows
> +# UNSUPPORTED: system-windows

It has started failing on Linux (Fedora 29 x86_64).  Is it expected?
I haven't tried to debug it yet.


Jan


--
[bash]jkrat...@host1.jankratochvil.net:/home/jkratoch/redhat/llvm-monorepo-clang#
 ./bin/llvm-lit -sv tools/lldb/lit --filter TestModuleCXX;echo $?
llvm-lit: 
/home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337: 
note: using clang: /home/jkratoch/redhat/llvm-monorepo-clang/bin/clang
llvm-lit: 
/home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337: 
note: using ld.lld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/ld.lld
llvm-lit: 
/home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337: 
note: using lld-link: /home/jkratoch/redhat/llvm-monorepo-clang/bin/lld-link
llvm-lit: 
/home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337: 
note: using ld64.lld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/ld64.lld
llvm-lit: 
/home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337: 
note: using wasm-ld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/wasm-ld
FAIL: LLDB :: Reproducer/Modules/TestModuleCXX.test (1 of 1)
 TEST 'LLDB :: Reproducer/Modules/TestModuleCXX.test' 
FAILED 
Script:
--
: 'RUN: at line 4';   rm -rf 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 5';   rm -rf 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
: 'RUN: at line 6';   rm -rf 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache
: 'RUN: at line 9';   mkdir -p 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 10';   mkdir -p 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
: 'RUN: at line 11';   mkdir -p 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache
: 'RUN: at line 12';   cp 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/main.cpp 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 13';   cp 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/Foo.h 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 14';   cp 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/Bar.h 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 15';   cp 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/module.modulemap
 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
: 'RUN: at line 18';   /home/jkratoch/redhat/llvm-monorepo-clang/bin/clang 
-pthread 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/main.cpp
 -g -fmodules -fcxx-modules 
-fmodules-cache-path=/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
 -o 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/a.out
: 'RUN: at line 21';   /home/jkratoch/redhat/llvm-monorepo-clang/bin/lldb 
--no-lldbinit -S /home/jkratoch/redhat/llvm-monorepo/lldb/lit/lit-lldb-init -x 
-b -o 'settings set symbols.clang-modules-cache-path 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache'
 -s 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/ModuleCXX.in
 --capture 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.repro
 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/a.out
 | /home/jkratoch/redhat/llvm-monorepo-clang/bin/FileCheck 
/home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/TestModuleCXX.test
 --check-prefix CAPTURE
: 'RUN: at line 24';   cat 
/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.repro/files.yaml
 | /home/jkratoch/redhat/llvm-monorepo-clang/bin/Fil

[Lldb-commits] [PATCH] D58410: [Reproducers] Initialize reproducers before initializing the debugger.

2019-02-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 187598.
JDevlieghere added a comment.

- Return a string instead of an SBError
- Make InitializeReplay perform the actual replay.


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

https://reviews.llvm.org/D58410

Files:
  lldb/include/lldb/API/SBDebugger.h
  lldb/include/lldb/API/SBDefines.h
  lldb/include/lldb/API/SBError.h
  lldb/include/lldb/API/SBFileSpec.h
  lldb/include/lldb/API/SBInitializerOptions.h
  lldb/include/lldb/API/SBReproducer.h
  lldb/include/lldb/Initialization/SystemInitializer.h
  lldb/include/lldb/Initialization/SystemInitializerCommon.h
  lldb/include/lldb/Initialization/SystemLifetimeManager.h
  lldb/include/lldb/Utility/Reproducer.h
  lldb/lldb.xcodeproj/project.pbxproj
  lldb/scripts/interface/SBDebugger.i
  lldb/scripts/interface/SBInitializerOptions.i
  lldb/scripts/lldb.swig
  lldb/source/API/CMakeLists.txt
  lldb/source/API/SBDebugger.cpp
  lldb/source/API/SBInitializerOptions.cpp
  lldb/source/API/SBReproducer.cpp
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/API/SystemInitializerFull.h
  lldb/source/Initialization/SystemInitializerCommon.cpp
  lldb/source/Initialization/SystemLifetimeManager.cpp
  lldb/source/Utility/Reproducer.cpp
  lldb/tools/driver/Driver.cpp
  lldb/tools/lldb-server/SystemInitializerLLGS.cpp
  lldb/tools/lldb-server/SystemInitializerLLGS.h
  lldb/tools/lldb-server/lldb-server.cpp
  lldb/tools/lldb-test/SystemInitializerTest.cpp
  lldb/tools/lldb-test/SystemInitializerTest.h
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -963,7 +963,7 @@
 
   SystemLifetimeManager DebuggerLifetime;
   if (auto e = DebuggerLifetime.Initialize(
-  llvm::make_unique(), {}, nullptr)) {
+  llvm::make_unique(), nullptr)) {
 WithColor::error() << "initialization failed: " << toString(std::move(e))
<< '\n';
 return 1;
Index: lldb/tools/lldb-test/SystemInitializerTest.h
===
--- lldb/tools/lldb-test/SystemInitializerTest.h
+++ lldb/tools/lldb-test/SystemInitializerTest.h
@@ -25,7 +25,7 @@
   SystemInitializerTest();
   ~SystemInitializerTest() override;
 
-  llvm::Error Initialize(const InitializerOptions &options) override;
+  llvm::Error Initialize() override;
   void Terminate() override;
 };
 
Index: lldb/tools/lldb-test/SystemInitializerTest.cpp
===
--- lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -112,9 +112,8 @@
 
 SystemInitializerTest::~SystemInitializerTest() {}
 
-llvm::Error
-SystemInitializerTest::Initialize(const InitializerOptions &options) {
-  if (auto e = SystemInitializerCommon::Initialize(options))
+llvm::Error SystemInitializerTest::Initialize() {
+  if (auto e = SystemInitializerCommon::Initialize())
 return e;
 
   breakpad::ObjectFileBreakpad::Initialize();
Index: lldb/tools/lldb-server/lldb-server.cpp
===
--- lldb/tools/lldb-server/lldb-server.cpp
+++ lldb/tools/lldb-server/lldb-server.cpp
@@ -38,7 +38,7 @@
 
 static void initialize() {
   if (auto e = g_debugger_lifetime->Initialize(
-  llvm::make_unique(), {}, nullptr))
+  llvm::make_unique(), nullptr))
 llvm::consumeError(std::move(e));
 }
 
Index: lldb/tools/lldb-server/SystemInitializerLLGS.h
===
--- lldb/tools/lldb-server/SystemInitializerLLGS.h
+++ lldb/tools/lldb-server/SystemInitializerLLGS.h
@@ -14,8 +14,7 @@
 
 class SystemInitializerLLGS : public lldb_private::SystemInitializerCommon {
 public:
-  llvm::Error
-  Initialize(const lldb_private::InitializerOptions &options) override;
+  llvm::Error Initialize() override;
   void Terminate() override;
 };
 
Index: lldb/tools/lldb-server/SystemInitializerLLGS.cpp
===
--- lldb/tools/lldb-server/SystemInitializerLLGS.cpp
+++ lldb/tools/lldb-server/SystemInitializerLLGS.cpp
@@ -21,9 +21,8 @@
 
 using namespace lldb_private;
 
-llvm::Error
-SystemInitializerLLGS::Initialize(const InitializerOptions &options) {
-  if (auto e = SystemInitializerCommon::Initialize(options))
+llvm::Error SystemInitializerLLGS::Initialize() {
+  if (auto e = SystemInitializerCommon::Initialize())
 return e;
 
   HostObjectFile::Initialize();
Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -13,6 +13,7 @@
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBHostOS.h"
 #include "lldb/API/SBLanguageRuntime.h"
+#include "lldb/API/SBReproducer.h"
 #include "lldb/

[Lldb-commits] [PATCH] D58410: [Reproducers] Initialize reproducers before initializing the debugger.

2019-02-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D58410#1403630 , @labath wrote:

> I think this looks mostly fine. See my comment about not using SB classes in 
> the reproducer api. I still kind of like the idea of naming the reproducer 
> class in some special way, to make it more obvious that it is not "just 
> another" SB class, but I'm not sure if that would be just more confusing.


I'm afraid it's going to be confusing. I'll add a comment to the SBReproducer 
class to point out that we cannot rely on any other SB* objects because of 
bootstrapping.


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

https://reviews.llvm.org/D58410



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


[Lldb-commits] [PATCH] D58410: [Reproducers] Initialize reproducers before initializing the debugger.

2019-02-20 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 187601.
JDevlieghere added a comment.

- Add comment to SBReproducer.h explaining we cannot use any SB objects in the 
interface or implementation.


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

https://reviews.llvm.org/D58410

Files:
  lldb/include/lldb/API/SBDebugger.h
  lldb/include/lldb/API/SBDefines.h
  lldb/include/lldb/API/SBError.h
  lldb/include/lldb/API/SBFileSpec.h
  lldb/include/lldb/API/SBInitializerOptions.h
  lldb/include/lldb/API/SBReproducer.h
  lldb/include/lldb/Initialization/SystemInitializer.h
  lldb/include/lldb/Initialization/SystemInitializerCommon.h
  lldb/include/lldb/Initialization/SystemLifetimeManager.h
  lldb/include/lldb/Utility/Reproducer.h
  lldb/lldb.xcodeproj/project.pbxproj
  lldb/scripts/interface/SBDebugger.i
  lldb/scripts/interface/SBInitializerOptions.i
  lldb/scripts/lldb.swig
  lldb/source/API/CMakeLists.txt
  lldb/source/API/SBDebugger.cpp
  lldb/source/API/SBInitializerOptions.cpp
  lldb/source/API/SBReproducer.cpp
  lldb/source/API/SystemInitializerFull.cpp
  lldb/source/API/SystemInitializerFull.h
  lldb/source/Initialization/SystemInitializerCommon.cpp
  lldb/source/Initialization/SystemLifetimeManager.cpp
  lldb/source/Utility/Reproducer.cpp
  lldb/tools/driver/Driver.cpp
  lldb/tools/lldb-server/SystemInitializerLLGS.cpp
  lldb/tools/lldb-server/SystemInitializerLLGS.h
  lldb/tools/lldb-server/lldb-server.cpp
  lldb/tools/lldb-test/SystemInitializerTest.cpp
  lldb/tools/lldb-test/SystemInitializerTest.h
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -963,7 +963,7 @@
 
   SystemLifetimeManager DebuggerLifetime;
   if (auto e = DebuggerLifetime.Initialize(
-  llvm::make_unique(), {}, nullptr)) {
+  llvm::make_unique(), nullptr)) {
 WithColor::error() << "initialization failed: " << toString(std::move(e))
<< '\n';
 return 1;
Index: lldb/tools/lldb-test/SystemInitializerTest.h
===
--- lldb/tools/lldb-test/SystemInitializerTest.h
+++ lldb/tools/lldb-test/SystemInitializerTest.h
@@ -25,7 +25,7 @@
   SystemInitializerTest();
   ~SystemInitializerTest() override;
 
-  llvm::Error Initialize(const InitializerOptions &options) override;
+  llvm::Error Initialize() override;
   void Terminate() override;
 };
 
Index: lldb/tools/lldb-test/SystemInitializerTest.cpp
===
--- lldb/tools/lldb-test/SystemInitializerTest.cpp
+++ lldb/tools/lldb-test/SystemInitializerTest.cpp
@@ -112,9 +112,8 @@
 
 SystemInitializerTest::~SystemInitializerTest() {}
 
-llvm::Error
-SystemInitializerTest::Initialize(const InitializerOptions &options) {
-  if (auto e = SystemInitializerCommon::Initialize(options))
+llvm::Error SystemInitializerTest::Initialize() {
+  if (auto e = SystemInitializerCommon::Initialize())
 return e;
 
   breakpad::ObjectFileBreakpad::Initialize();
Index: lldb/tools/lldb-server/lldb-server.cpp
===
--- lldb/tools/lldb-server/lldb-server.cpp
+++ lldb/tools/lldb-server/lldb-server.cpp
@@ -38,7 +38,7 @@
 
 static void initialize() {
   if (auto e = g_debugger_lifetime->Initialize(
-  llvm::make_unique(), {}, nullptr))
+  llvm::make_unique(), nullptr))
 llvm::consumeError(std::move(e));
 }
 
Index: lldb/tools/lldb-server/SystemInitializerLLGS.h
===
--- lldb/tools/lldb-server/SystemInitializerLLGS.h
+++ lldb/tools/lldb-server/SystemInitializerLLGS.h
@@ -14,8 +14,7 @@
 
 class SystemInitializerLLGS : public lldb_private::SystemInitializerCommon {
 public:
-  llvm::Error
-  Initialize(const lldb_private::InitializerOptions &options) override;
+  llvm::Error Initialize() override;
   void Terminate() override;
 };
 
Index: lldb/tools/lldb-server/SystemInitializerLLGS.cpp
===
--- lldb/tools/lldb-server/SystemInitializerLLGS.cpp
+++ lldb/tools/lldb-server/SystemInitializerLLGS.cpp
@@ -21,9 +21,8 @@
 
 using namespace lldb_private;
 
-llvm::Error
-SystemInitializerLLGS::Initialize(const InitializerOptions &options) {
-  if (auto e = SystemInitializerCommon::Initialize(options))
+llvm::Error SystemInitializerLLGS::Initialize() {
+  if (auto e = SystemInitializerCommon::Initialize())
 return e;
 
   HostObjectFile::Initialize();
Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -13,6 +13,7 @@
 #include "lldb/API/SBDebugger.h"
 #include "lldb/API/SBHostOS.h"
 #include "lldb/API/SBLanguageRuntime.h"
+#include "lldb/API/SBReproducer.h

Re: [Lldb-commits] [lldb] r354425 - [TestModuleCXX] Use UNSUPPORTED instead of REQUIRES

2019-02-20 Thread Jonas Devlieghere via lldb-commits
Based on the decorators of the other modules test it looks like this should
be Darwin only. I'll update the test.

On Wed, Feb 20, 2019 at 9:31 AM Jan Kratochvil 
wrote:

> On Wed, 20 Feb 2019 02:49:16 +0100, Jonas Devlieghere via lldb-commits
> wrote:
> > Author: jdevlieghere
> > Date: Tue Feb 19 17:49:16 2019
> > New Revision: 354425
> ...
> > --- lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test (original)
> > +++ lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test Tue Feb 19
> 17:49:16 2019
> > @@ -1,4 +1,4 @@
> > -# REQUIRES: nowindows
> > +# UNSUPPORTED: system-windows
>
> It has started failing on Linux (Fedora 29 x86_64).  Is it expected?
> I haven't tried to debug it yet.
>
>
> Jan
>
>
>
> --
> [bash]jkrat...@host1.jankratochvil.net:/home/jkratoch/redhat/llvm-monorepo-clang#
> ./bin/llvm-lit -sv tools/lldb/lit --filter TestModuleCXX;echo $?
> llvm-lit:
> /home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337:
> note: using clang: /home/jkratoch/redhat/llvm-monorepo-clang/bin/clang
> llvm-lit:
> /home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337:
> note: using ld.lld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/ld.lld
> llvm-lit:
> /home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337:
> note: using lld-link: /home/jkratoch/redhat/llvm-monorepo-clang/bin/lld-link
> llvm-lit:
> /home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337:
> note: using ld64.lld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/ld64.lld
> llvm-lit:
> /home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337:
> note: using wasm-ld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/wasm-ld
> FAIL: LLDB :: Reproducer/Modules/TestModuleCXX.test (1 of 1)
>  TEST 'LLDB :: Reproducer/Modules/TestModuleCXX.test'
> FAILED 
> Script:
> --
> : 'RUN: at line 4';   rm -rf
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
> : 'RUN: at line 5';   rm -rf
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
> : 'RUN: at line 6';   rm -rf
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache
> : 'RUN: at line 9';   mkdir -p
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
> : 'RUN: at line 10';   mkdir -p
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
> : 'RUN: at line 11';   mkdir -p
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache
> : 'RUN: at line 12';   cp
> /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/main.cpp
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
> : 'RUN: at line 13';   cp
> /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/Foo.h
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
> : 'RUN: at line 14';   cp
> /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/Bar.h
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
> : 'RUN: at line 15';   cp
> /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/module.modulemap
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
> : 'RUN: at line 18';   /home/jkratoch/redhat/llvm-monorepo-clang/bin/clang
> -pthread
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/main.cpp
> -g -fmodules -fcxx-modules
> -fmodules-cache-path=/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
> -o
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/a.out
> : 'RUN: at line 21';   /home/jkratoch/redhat/llvm-monorepo-clang/bin/lldb
> --no-lldbinit -S /home/jkratoch/redhat/llvm-monorepo/lldb/lit/lit-lldb-init
> -x -b -o 'settings set symbols.clang-modules-cache-path
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache'
> -s
> /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/ModuleCXX.in
> --capture
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.repro
> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/a.out
> | /home/jkratoch/redhat/llvm-monorepo-clang/bin/FileCheck
> /home/jkratoch/redh

[Lldb-commits] [lldb] r354487 - [TestModuleCXX] Make this test Darwin-only.

2019-02-20 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Feb 20 09:43:34 2019
New Revision: 354487

URL: http://llvm.org/viewvc/llvm-project?rev=354487&view=rev
Log:
[TestModuleCXX] Make this test Darwin-only.

Apparently this functionality is not expected to work on non-Darwin
systems. I should've checked the decorator on the original test.

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=354487&r1=354486&r2=354487&view=diff
==
--- lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test (original)
+++ lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test Wed Feb 20 09:43:34 
2019
@@ -1,4 +1,4 @@
-# UNSUPPORTED: system-windows
+# REQUIRES: system-darwin
 
 # Start fresh.
 # RUN: rm -rf %t.root


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


Re: [Lldb-commits] [lldb] r354466 - [lldb] [ObjectFile/ELF] Fix recognizing NetBSD images

2019-02-20 Thread Davide Italiano via lldb-commits
The bot is now green, thanks for your fix!

On Wed, Feb 20, 2019 at 9:10 AM Michał Górny  wrote:
>
> On Wed, 2019-02-20 at 08:39 -0800, Davide Italiano wrote:
> > This broke the bots, link:
> >
> > http://green.lab.llvm.org/green/job/lldb-cmake/20047/
> >
> > Can you please take a look and see what's needed to fix (and revert 
> > otherwise)?
> >
>
> Thanks for the ping.  I've just committed the update for this test.
> If it doesn't resolve it, I'm going to revert the changes.
>
> --
> Best regards,
> Michał Górny
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r354425 - [TestModuleCXX] Use UNSUPPORTED instead of REQUIRES

2019-02-20 Thread Jonas Devlieghere via lldb-commits
Done in r354487. Thanks for the heads up!

On Wed, Feb 20, 2019 at 9:41 AM Jonas Devlieghere 
wrote:

> Based on the decorators of the other modules test it looks like this
> should be Darwin only. I'll update the test.
>
> On Wed, Feb 20, 2019 at 9:31 AM Jan Kratochvil 
> wrote:
>
>> On Wed, 20 Feb 2019 02:49:16 +0100, Jonas Devlieghere via lldb-commits
>> wrote:
>> > Author: jdevlieghere
>> > Date: Tue Feb 19 17:49:16 2019
>> > New Revision: 354425
>> ...
>> > --- lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test (original)
>> > +++ lldb/trunk/lit/Reproducer/Modules/TestModuleCXX.test Tue Feb 19
>> 17:49:16 2019
>> > @@ -1,4 +1,4 @@
>> > -# REQUIRES: nowindows
>> > +# UNSUPPORTED: system-windows
>>
>> It has started failing on Linux (Fedora 29 x86_64).  Is it expected?
>> I haven't tried to debug it yet.
>>
>>
>> Jan
>>
>>
>>
>> --
>> [bash]jkrat...@host1.jankratochvil.net:/home/jkratoch/redhat/llvm-monorepo-clang#
>> ./bin/llvm-lit -sv tools/lldb/lit --filter TestModuleCXX;echo $?
>> llvm-lit:
>> /home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337:
>> note: using clang: /home/jkratoch/redhat/llvm-monorepo-clang/bin/clang
>> llvm-lit:
>> /home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337:
>> note: using ld.lld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/ld.lld
>> llvm-lit:
>> /home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337:
>> note: using lld-link: /home/jkratoch/redhat/llvm-monorepo-clang/bin/lld-link
>> llvm-lit:
>> /home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337:
>> note: using ld64.lld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/ld64.lld
>> llvm-lit:
>> /home/jkratoch/redhat/llvm-monorepo/llvm/utils/lit/lit/llvm/config.py:337:
>> note: using wasm-ld: /home/jkratoch/redhat/llvm-monorepo-clang/bin/wasm-ld
>> FAIL: LLDB :: Reproducer/Modules/TestModuleCXX.test (1 of 1)
>>  TEST 'LLDB :: Reproducer/Modules/TestModuleCXX.test'
>> FAILED 
>> Script:
>> --
>> : 'RUN: at line 4';   rm -rf
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
>> : 'RUN: at line 5';   rm -rf
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
>> : 'RUN: at line 6';   rm -rf
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache
>> : 'RUN: at line 9';   mkdir -p
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
>> : 'RUN: at line 10';   mkdir -p
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
>> : 'RUN: at line 11';   mkdir -p
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache
>> : 'RUN: at line 12';   cp
>> /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/main.cpp
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
>> : 'RUN: at line 13';   cp
>> /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/Foo.h
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
>> : 'RUN: at line 14';   cp
>> /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/Bar.h
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
>> : 'RUN: at line 15';   cp
>> /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/module.modulemap
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root
>> : 'RUN: at line 18';
>>  /home/jkratoch/redhat/llvm-monorepo-clang/bin/clang -pthread
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/main.cpp
>> -g -fmodules -fcxx-modules
>> -fmodules-cache-path=/home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.clang-cache
>> -o
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.root/a.out
>> : 'RUN: at line 21';   /home/jkratoch/redhat/llvm-monorepo-clang/bin/lldb
>> --no-lldbinit -S /home/jkratoch/redhat/llvm-monorepo/lldb/lit/lit-lldb-init
>> -x -b -o 'settings set symbols.clang-modules-cache-path
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.lldb-cache'
>> -s
>> /home/jkratoch/redhat/llvm-monorepo/lldb/lit/Reproducer/Modules/Inputs/ModuleCXX.in
>> --capture
>> /home/jkratoch/redhat/llvm-monorepo-clang/tools/lldb/lit/Reproducer/Modules/Output/TestModuleCXX.test.tmp.repro
>> /ho

[Lldb-commits] [PATCH] D55653: [lldb-mi] Check raw pointers before passing them to std::string ctor/assignment

2019-02-20 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 187597.
tatyana-krasnukha added a comment.

Thanks for the review!

> So Format() and Printf() don't handle nullptr arguments already?

They just forward arguments to `vsprintf`/`vsnprintf`. Otherwise, the would 
have to do twice the work parsing format string.

> +1 in general (but it may be a bigger effort)

Since lldb-mi has its own wrapper for strings, we would have a conversion 
`const char*` -> `StringRef` -> `CMIUtilString` everywhere. This looks 
redundant to me and it is easy to forget converting a result of SB class's 
function to the `StringRef`.


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

https://reviews.llvm.org/D55653

Files:
  tools/lldb-mi/MICmdCmdMiscellanous.cpp
  tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
  tools/lldb-mi/MICmnLLDBDebugger.cpp
  tools/lldb-mi/MICmnMIOutOfBandRecord.cpp
  tools/lldb-mi/MICmnMIResultRecord.cpp
  tools/lldb-mi/MIDriverMgr.cpp
  tools/lldb-mi/MIUtilString.cpp
  tools/lldb-mi/MIUtilString.h
  unittests/tools/CMakeLists.txt
  unittests/tools/lldb-mi/CMakeLists.txt
  unittests/tools/lldb-mi/utils/CMakeLists.txt
  unittests/tools/lldb-mi/utils/StringTest.cpp

Index: unittests/tools/lldb-mi/utils/StringTest.cpp
===
--- unittests/tools/lldb-mi/utils/StringTest.cpp
+++ unittests/tools/lldb-mi/utils/StringTest.cpp
@@ -0,0 +1,32 @@
+//===-- StringTest.cpp --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "MIUtilString.h"
+#include "gtest/gtest.h"
+
+TEST(StringTest, ConstructFromNullptr) {
+  auto str = CMIUtilString(nullptr);
+  EXPECT_TRUE(str.empty());
+  EXPECT_NE(nullptr, str.c_str());
+  EXPECT_EQ(CMIUtilString(""), str);
+}
+
+TEST(StringTest, AssignNullptr) {
+  CMIUtilString str;
+  str = nullptr;
+  EXPECT_TRUE(str.empty());
+  EXPECT_NE(nullptr, str.c_str());
+  EXPECT_EQ(CMIUtilString(""), str);
+}
+
+TEST(StringTest, IsAllValidAlphaAndNumeric) {
+  EXPECT_TRUE(CMIUtilString::IsAllValidAlphaAndNumeric("123abc"));
+  EXPECT_FALSE(CMIUtilString::IsAllValidAlphaAndNumeric(""));
+  EXPECT_FALSE(CMIUtilString::IsAllValidAlphaAndNumeric(nullptr));
+}
+
Index: unittests/tools/lldb-mi/utils/CMakeLists.txt
===
--- unittests/tools/lldb-mi/utils/CMakeLists.txt
+++ unittests/tools/lldb-mi/utils/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_library(lldb-mi-utils OBJECT
+  ${LLDB_SOURCE_DIR}/tools/lldb-mi/MIUtilString.cpp
+  )
+
+add_lldb_unittest(LLDBMiUtilTests
+  StringTest.cpp
+
+  LINK_COMPONENTS
+Support
+  )
+
+target_sources(LLDBMiUtilTests PRIVATE $)
Index: unittests/tools/lldb-mi/CMakeLists.txt
===
--- unittests/tools/lldb-mi/CMakeLists.txt
+++ unittests/tools/lldb-mi/CMakeLists.txt
@@ -0,0 +1,2 @@
+include_directories(${LLDB_PROJECT_ROOT}/tools/lldb-mi)
+add_subdirectory(utils)
Index: unittests/tools/CMakeLists.txt
===
--- unittests/tools/CMakeLists.txt
+++ unittests/tools/CMakeLists.txt
@@ -1,3 +1,4 @@
+add_subdirectory(lldb-mi)
 if(CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|Linux|NetBSD")
   if ((CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_TEST_DEBUGSERVER) OR (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_LLDB_SERVER_BUILD))
 # These tests are meant to test lldb-server/debugserver in isolation, and
Index: tools/lldb-mi/MIUtilString.h
===
--- tools/lldb-mi/MIUtilString.h
+++ tools/lldb-mi/MIUtilString.h
@@ -33,7 +33,13 @@
   static CMIUtilString FormatBinary(const MIuint64 vnDecimal);
   static CMIUtilString FormatValist(const CMIUtilString &vrFormating,
 va_list vArgs);
+
   static bool IsAllValidAlphaAndNumeric(const char *vpText);
+
+  static const char *WithNullAsEmpty(const char *vpText) {
+return vpText ? vpText : "";
+  }
+
   static bool Compare(const CMIUtilString &vrLhs, const CMIUtilString &vrRhs);
   static CMIUtilString ConvertToPrintableASCII(const char vChar,
bool bEscapeQuotes = false);
Index: tools/lldb-mi/MIUtilString.cpp
===
--- tools/lldb-mi/MIUtilString.cpp
+++ tools/lldb-mi/MIUtilString.cpp
@@ -37,7 +37,8 @@
 // Return:  None.
 // Throws:  None.
 //--
-CMIUtilString::CMIUtilString(const char *vpData) : std::string(vpData) {}
+CMIUtilString::CMIUtilString(const char *vpData)
+  : std::string(WithNullAsEmpty(vpData)) {}
 
 //++
 //-

[Lldb-commits] [PATCH] D55653: [lldb-mi] Check raw pointers before passing them to std::string ctor/assignment

2019-02-20 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 187613.
tatyana-krasnukha added a comment.

LLDB_PROJECT_ROOT -> LLDB_SOURCE_DIR


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

https://reviews.llvm.org/D55653

Files:
  tools/lldb-mi/MICmdCmdMiscellanous.cpp
  tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
  tools/lldb-mi/MICmnLLDBDebugger.cpp
  tools/lldb-mi/MICmnMIOutOfBandRecord.cpp
  tools/lldb-mi/MICmnMIResultRecord.cpp
  tools/lldb-mi/MIDriverMgr.cpp
  tools/lldb-mi/MIUtilString.cpp
  tools/lldb-mi/MIUtilString.h
  unittests/tools/CMakeLists.txt
  unittests/tools/lldb-mi/CMakeLists.txt
  unittests/tools/lldb-mi/utils/CMakeLists.txt
  unittests/tools/lldb-mi/utils/StringTest.cpp

Index: unittests/tools/lldb-mi/utils/StringTest.cpp
===
--- unittests/tools/lldb-mi/utils/StringTest.cpp
+++ unittests/tools/lldb-mi/utils/StringTest.cpp
@@ -0,0 +1,32 @@
+//===-- StringTest.cpp --*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "MIUtilString.h"
+#include "gtest/gtest.h"
+
+TEST(StringTest, ConstructFromNullptr) {
+  auto str = CMIUtilString(nullptr);
+  EXPECT_TRUE(str.empty());
+  EXPECT_NE(nullptr, str.c_str());
+  EXPECT_EQ(CMIUtilString(""), str);
+}
+
+TEST(StringTest, AssignNullptr) {
+  CMIUtilString str;
+  str = nullptr;
+  EXPECT_TRUE(str.empty());
+  EXPECT_NE(nullptr, str.c_str());
+  EXPECT_EQ(CMIUtilString(""), str);
+}
+
+TEST(StringTest, IsAllValidAlphaAndNumeric) {
+  EXPECT_TRUE(CMIUtilString::IsAllValidAlphaAndNumeric("123abc"));
+  EXPECT_FALSE(CMIUtilString::IsAllValidAlphaAndNumeric(""));
+  EXPECT_FALSE(CMIUtilString::IsAllValidAlphaAndNumeric(nullptr));
+}
+
Index: unittests/tools/lldb-mi/utils/CMakeLists.txt
===
--- unittests/tools/lldb-mi/utils/CMakeLists.txt
+++ unittests/tools/lldb-mi/utils/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_library(lldb-mi-utils OBJECT
+  ${LLDB_SOURCE_DIR}/tools/lldb-mi/MIUtilString.cpp
+  )
+
+add_lldb_unittest(LLDBMiUtilTests
+  StringTest.cpp
+
+  LINK_COMPONENTS
+Support
+  )
+
+target_sources(LLDBMiUtilTests PRIVATE $)
Index: unittests/tools/lldb-mi/CMakeLists.txt
===
--- unittests/tools/lldb-mi/CMakeLists.txt
+++ unittests/tools/lldb-mi/CMakeLists.txt
@@ -0,0 +1,2 @@
+include_directories(${LLDB_SOURCE_DIR}/tools/lldb-mi)
+add_subdirectory(utils)
Index: unittests/tools/CMakeLists.txt
===
--- unittests/tools/CMakeLists.txt
+++ unittests/tools/CMakeLists.txt
@@ -1,3 +1,4 @@
+add_subdirectory(lldb-mi)
 if(CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|Linux|NetBSD")
   if ((CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_TEST_DEBUGSERVER) OR (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_LLDB_SERVER_BUILD))
 # These tests are meant to test lldb-server/debugserver in isolation, and
Index: tools/lldb-mi/MIUtilString.h
===
--- tools/lldb-mi/MIUtilString.h
+++ tools/lldb-mi/MIUtilString.h
@@ -33,7 +33,13 @@
   static CMIUtilString FormatBinary(const MIuint64 vnDecimal);
   static CMIUtilString FormatValist(const CMIUtilString &vrFormating,
 va_list vArgs);
+
   static bool IsAllValidAlphaAndNumeric(const char *vpText);
+
+  static const char *WithNullAsEmpty(const char *vpText) {
+return vpText ? vpText : "";
+  }
+
   static bool Compare(const CMIUtilString &vrLhs, const CMIUtilString &vrRhs);
   static CMIUtilString ConvertToPrintableASCII(const char vChar,
bool bEscapeQuotes = false);
Index: tools/lldb-mi/MIUtilString.cpp
===
--- tools/lldb-mi/MIUtilString.cpp
+++ tools/lldb-mi/MIUtilString.cpp
@@ -37,7 +37,8 @@
 // Return:  None.
 // Throws:  None.
 //--
-CMIUtilString::CMIUtilString(const char *vpData) : std::string(vpData) {}
+CMIUtilString::CMIUtilString(const char *vpData)
+  : std::string(WithNullAsEmpty(vpData)) {}
 
 //++
 //
@@ -58,7 +59,7 @@
 // Throws:  None.
 //--
 CMIUtilString &CMIUtilString::operator=(const char *vpRhs) {
-  assign(vpRhs);
+  assign(WithNullAsEmpty(vpRhs));
   return *this;
 }
 
@@ -103,12 +104,10 @@
   MIint n = vrFormat.size();
 
   // IOR: mysterious crash in this function on some windows builds not able to
-  // duplicate
-  // but found article which may be related. Crash occurs in vsnprintf() or
-  // va_copy()
+  // duplicate but found article whic

[Lldb-commits] [lldb] r354494 - [lldb-mi] Remove a test that uses pexpect().

2019-02-20 Thread Davide Italiano via lldb-commits
Author: davide
Date: Wed Feb 20 10:27:29 2019
New Revision: 354494

URL: http://llvm.org/viewvc/llvm-project?rev=354494&view=rev
Log:
[lldb-mi] Remove a test that uses pexpect().

Summary:
Its functionality is entirely covered by exec-run.test (which
doesn't use pexpect)

Reviewers: serge-sans-paille

Subscribers: ki.stfu, jdoerfert, llvm-commits

Tags: #llvm

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

Removed:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py

Removed: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py?rev=354493&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py 
(removed)
@@ -1,82 +0,0 @@
-"""
-Test lldb-mi -file-xxx commands.
-"""
-
-from __future__ import print_function
-
-
-import lldbmi_testcase
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class MiFileTestCase(lldbmi_testcase.MiTestCaseBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_file_exec_and_symbols_file(self):
-"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols 
exe."""
-
-self.spawnLldbMi(args=None)
-
-# Test that -file-exec-and-symbols works for filename
-self.runCmd("-file-exec-and-symbols %s" % self.myexe)
-self.expect("\^done")
-
-# Run
-self.runCmd("-exec-run")
-self.expect("\^running")
-self.expect("\*stopped,reason=\"exited-normally\"")
-
-@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_file_exec_and_symbols_absolute_path(self):
-"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols 
fullpath/exe."""
-
-self.spawnLldbMi(args=None)
-
-# Test that -file-exec-and-symbols works for absolute path
-self.runCmd("-file-exec-and-symbols \"%s\"" % self.myexe)
-self.expect("\^done")
-
-# Run
-self.runCmd("-exec-run")
-self.expect("\^running")
-self.expect("\*stopped,reason=\"exited-normally\"")
-
-@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_file_exec_and_symbols_relative_path(self):
-"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols 
relpath/exe."""
-
-self.spawnLldbMi(args=None)
-
-# Test that -file-exec-and-symbols works for relative path
-import os
-path = os.path.relpath(self.myexe, self.getBuildDir())
-self.runCmd("-file-exec-and-symbols %s" % path)
-self.expect("\^done")
-
-# Run
-self.runCmd("-exec-run")
-self.expect("\^running")
-self.expect("\*stopped,reason=\"exited-normally\"")
-
-@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_file_exec_and_symbols_unknown_path(self):
-"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols 
badpath/exe."""
-
-self.spawnLldbMi(args=None)
-
-# Test that -file-exec-and-symbols fails on unknown path
-path = "unknown_dir/%s" % self.myexe
-self.runCmd("-file-exec-and-symbols %s" % path)
-self.expect("\^error")


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


[Lldb-commits] [PATCH] D58459: [lldb-mi] Remove a test that uses pexpect().

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

LGTM


Repository:
  rL LLVM

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

https://reviews.llvm.org/D58459



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


[Lldb-commits] [PATCH] D58459: [lldb-mi] Remove a test that uses pexpect().

2019-02-20 Thread Davide Italiano via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB354494: [lldb-mi] Remove a test that uses pexpect(). 
(authored by davide, committed by ).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D58459?vs=187604&id=187615#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58459

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py


Index: packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py
@@ -1,82 +0,0 @@
-"""
-Test lldb-mi -file-xxx commands.
-"""
-
-from __future__ import print_function
-
-
-import lldbmi_testcase
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class MiFileTestCase(lldbmi_testcase.MiTestCaseBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_file_exec_and_symbols_file(self):
-"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols 
exe."""
-
-self.spawnLldbMi(args=None)
-
-# Test that -file-exec-and-symbols works for filename
-self.runCmd("-file-exec-and-symbols %s" % self.myexe)
-self.expect("\^done")
-
-# Run
-self.runCmd("-exec-run")
-self.expect("\^running")
-self.expect("\*stopped,reason=\"exited-normally\"")
-
-@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_file_exec_and_symbols_absolute_path(self):
-"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols 
fullpath/exe."""
-
-self.spawnLldbMi(args=None)
-
-# Test that -file-exec-and-symbols works for absolute path
-self.runCmd("-file-exec-and-symbols \"%s\"" % self.myexe)
-self.expect("\^done")
-
-# Run
-self.runCmd("-exec-run")
-self.expect("\^running")
-self.expect("\*stopped,reason=\"exited-normally\"")
-
-@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_file_exec_and_symbols_relative_path(self):
-"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols 
relpath/exe."""
-
-self.spawnLldbMi(args=None)
-
-# Test that -file-exec-and-symbols works for relative path
-import os
-path = os.path.relpath(self.myexe, self.getBuildDir())
-self.runCmd("-file-exec-and-symbols %s" % path)
-self.expect("\^done")
-
-# Run
-self.runCmd("-exec-run")
-self.expect("\^running")
-self.expect("\*stopped,reason=\"exited-normally\"")
-
-@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_file_exec_and_symbols_unknown_path(self):
-"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols 
badpath/exe."""
-
-self.spawnLldbMi(args=None)
-
-# Test that -file-exec-and-symbols fails on unknown path
-path = "unknown_dir/%s" % self.myexe
-self.runCmd("-file-exec-and-symbols %s" % path)
-self.expect("\^error")


Index: packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py
@@ -1,82 +0,0 @@
-"""
-Test lldb-mi -file-xxx commands.
-"""
-
-from __future__ import print_function
-
-
-import lldbmi_testcase
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class MiFileTestCase(lldbmi_testcase.MiTestCaseBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_file_exec_and_symbols_file(se

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

2019-02-20 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz accepted this revision.
sgraenitz added a subscriber: hans.
sgraenitz added a comment.
This revision is now accepted and ready to land.

@serge-sans-paille After all, it appears to me that your issue is caused by 
something else, but if this change fixes it, I am not against taking it for 
now. It shouldn't do any harm. Please get in touch with @hans if this is really 
relevant for `release_80`.

However, please note that your patch base is not up-to-date with `master` [1] 
or `release_80` [2] branches. The meanwhile changes shouldn't affect the 
`dsymutil` or `llc` targets, but maybe it's a hint towards the actual problem.
Also note that the lines you want to modify are there since May [3] and 
September [4] respectively, so it's been this way already in the 7.0 release.

(I am off till early March and will only check my inbox rarely. Hope 
everything's gonna work out well.)

[1] https://github.com/llvm-mirror/lldb/blob/master/lit/CMakeLists.txt
[2] https://github.com/llvm-mirror/lldb/blob/release_80/lit/CMakeLists.txt
[3] https://reviews.llvm.org/rL331447#change-GVDgVmL1F2CA
[4] https://reviews.llvm.org/rL342733#change-GVDgVmL1F2CA


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] D58394: Add --auto-continue to stop-hooks, fix up a few tests

2019-02-20 Thread Jim Ingham via Phabricator via lldb-commits
jingham updated this revision to Diff 187616.
jingham added a comment.

Trying to guess how thread list output is going to look is indeed a losing game.

I changed the stop hook to set a global variable in the target, then just print 
the value at the end.  If we ran the stop hook the right number of times, the 
variable will have the right value.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58394

Files:
  include/lldb/Target/Process.h
  include/lldb/Target/Target.h
  lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
  lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
  lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
  lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
  lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp
  lit/ExecControl/StopHook/stop-hook-threads.test
  source/Commands/CommandObjectTarget.cpp
  source/Target/Process.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2554,12 +2554,14 @@
 
   StopHookCollection::iterator pos, end = m_stop_hooks.end();
 
-  // If there aren't any active stop hooks, don't bother either:
+  // If there aren't any active stop hooks, don't bother either.
+  // Also see if any of the active hooks want to auto-continue.
   bool any_active_hooks = false;
-  for (pos = m_stop_hooks.begin(); pos != end; pos++) {
-if ((*pos).second->IsActive()) {
+  bool auto_continue = false;
+  for (auto hook : m_stop_hooks) {
+if (hook.second->IsActive()) {
   any_active_hooks = true;
-  break;
+  auto_continue |= hook.second->GetAutoContinue();
 }
   }
   if (!any_active_hooks)
@@ -2595,6 +2597,7 @@
   bool hooks_ran = false;
   bool print_hook_header = (m_stop_hooks.size() != 1);
   bool print_thread_header = (num_exe_ctx != 1);
+  bool did_restart = false;
 
   for (pos = m_stop_hooks.begin(); keep_going && pos != end; pos++) {
 // result.Clear();
@@ -2639,10 +2642,13 @@
 options.SetPrintResults(true);
 options.SetAddToHistory(false);
 
+// Force Async:
+bool old_async = GetDebugger().GetAsyncExecution();
+GetDebugger().SetAsyncExecution(true);
 GetDebugger().GetCommandInterpreter().HandleCommands(
 cur_hook_sp->GetCommands(), &exc_ctx_with_reasons[i], options,
 result);
-
+GetDebugger().SetAsyncExecution(old_async);
 // If the command started the target going again, we should bag out of
 // running the stop hooks.
 if ((result.GetStatus() == eReturnStatusSuccessContinuingNoResult) ||
@@ -2651,13 +2657,19 @@
   StopHookCollection::iterator tmp = pos;
   if (++tmp != end)
 result.AppendMessageWithFormat("\nAborting stop hooks, hook %" PRIu64
-   " set the program running.\n",
+   " set the program running.\n"
+   "  Consider using '-G true' to make "
+   "stop hooks auto-continue.\n",
cur_hook_sp->GetID());
   keep_going = false;
+  did_restart = true;
 }
   }
 }
   }
+  // Finally, if auto-continue was requested, do it now:
+  if (!did_restart && auto_continue)
+m_process_sp->PrivateResume();
 
   result.GetImmediateOutputStream()->Flush();
   result.GetImmediateErrorStream()->Flush();
@@ -3143,12 +3155,13 @@
 //--
 Target::StopHook::StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid)
 : UserID(uid), m_target_sp(target_sp), m_commands(), m_specifier_sp(),
-  m_thread_spec_up(), m_active(true) {}
+  m_thread_spec_up() {}
 
 Target::StopHook::StopHook(const StopHook &rhs)
 : UserID(rhs.GetID()), m_target_sp(rhs.m_target_sp),
   m_commands(rhs.m_commands), m_specifier_sp(rhs.m_specifier_sp),
-  m_thread_spec_up(), m_active(rhs.m_active) {
+  m_thread_spec_up(), m_active(rhs.m_active),
+  m_auto_continue(rhs.m_auto_continue) {
   if (rhs.m_thread_spec_up)
 m_thread_spec_up.reset(new ThreadSpec(*rhs.m_thread_spec_up));
 }
@@ -3175,6 +3188,9 @@
   else
 s->Indent("State: disabled\n");
 
+  if (m_auto_continue)
+s->Indent("AutoContinue on\n");
+
   if (m_specifier_sp) {
 s->Indent();
 s->PutCString("Specifier:\n");
Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -1615,6 +1615,8 @@
   return error;
 }
 
+static const char *g_resume_sync_name = "lldb.Process.ResumeSynchronous.hijack";
+
 Status Process::ResumeSynchronous(Stream *stream) {
   Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_STATE |

[Lldb-commits] [PATCH] D58394: Add --auto-continue to stop-hooks, fix up a few tests

2019-02-20 Thread Jim Ingham via Phabricator via lldb-commits
jingham marked 2 inline comments as done.
jingham added a comment.

Pavel, I think the new behavior w.r.t. launching is better.  When the process 
plugins are managing events to handle a launch or attach, they really don't 
want random stop hooks getting in their way.  On MacOS, if you set a stop hook 
before launch you always got one stop message at a place you didn't cause the 
target to stop, which I think was just confusing.




Comment at: lit/ExecControl/StopHook/stop-hook-threads.test:36
 # When we don't filter, we expect to count 12 stopped threads in the thread 
list output
-# CHECK-NO-FILTER-COUNT-12: at stop-hook-threads.cpp{{.*}} stop reason = 
breakpoint
\ No newline at end of file
+# CHECK-NO-FILTER-COUNT-12: , stop reason = breakpoint 3.1

labath wrote:
> BTW, this check is fairly dodgy, because in the case of two threads hitting a 
> breakpoint simultaneously, we will get 4 stop reasons instead of two ("thread 
> list" will be executed twice, and each instance will print the stop reason 
> for both threads). It might be better to replace "thread list" with a 
> different command, or add synchronization to the test to prevent two threads 
> from hitting the breakpoint at once, depending on what we want to test.
Yes, trying to make a good test scraping thread list output is no good.  
Instead I made the stop-hook set a variable in the target.  Then we can just 
check that value to see if we hit and ran the stop hooks the right number of 
times.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58394



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


[Lldb-commits] [PATCH] D58465: testsuite: Fix TestCompDirSymLink on Linux with symlinked build dir

2019-02-20 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil created this revision.
jankratochvil added a project: LLDB.
Herald added subscribers: jdoerfert, aprantl.
Herald added a reviewer: serge-sans-paille.

Getting failure when building in a directory which is symlinked elsewhere:

  Failing Tests (1):
  lldb-Suite :: 
functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py



  runCmd: file 
/home/jkratoch/redhat/llvm-monorepo-clangassert/lldb-test-build.noindex/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.test_symlink_paths_set_procselfcwd_dwarf/CompDirSymLink
  output: Current executable set to 
'/home/jkratoch/redhat/llvm-monorepo-clangassert/lldb-test-build.noindex/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.test_symlink_paths_set_procselfcwd_dwarf/CompDirSymLink'
 (x86_64).
  runCmd: settings set plugin.symbol-file.dwarf.comp-dir-symlink-paths 
/proc/self/cwd
  output: None
  runCmd: breakpoint set -f 
"/home/jkratoch/redhat/llvm-monorepo-clangassert/lldb-test-build.noindex/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.test_symlink_paths_set_procselfcwd_dwarf/relative.cpp"
 -l 11
  output: Breakpoint 1: no locations (pending).
  WARNING:  Unable to resolve breakpoint to any actual locations.

It is because `/proc/self/cwd` (used above for 
`plugin.symbol-file.dwarf.comp-dir-symlink-paths`) points to an already 
resolved directory:

  (cd /tmp;mkdir real;ln -s real symlink;cd symlink;ls -l /proc/self/cwd)
  lrwxrwxrwx 1 jkratoch jkratoch 0 Feb 20 19:55 /proc/self/cwd -> /tmp/real/


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D58465

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py


Index: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
@@ -48,6 +48,8 @@
 "settings set %s %s" %
 (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
 src_path = self.getBuildArtifact(_SRC_FILE)
+# /proc/self/cwd points to a realpath form of current directory.
+src_path = os.path.realpath(src_path)
 lldbutil.run_break_set_by_file_and_line(self, src_path, self.line)
 
 @skipIf(hostoslist=["windows"])


Index: lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
@@ -48,6 +48,8 @@
 "settings set %s %s" %
 (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
 src_path = self.getBuildArtifact(_SRC_FILE)
+# /proc/self/cwd points to a realpath form of current directory.
+src_path = os.path.realpath(src_path)
 lldbutil.run_break_set_by_file_and_line(self, src_path, self.line)
 
 @skipIf(hostoslist=["windows"])
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r354506 - [lldb-mi] Move TestMIPrompt away from pexpect().

2019-02-20 Thread Davide Italiano via lldb-commits
Author: davide
Date: Wed Feb 20 11:25:12 2019
New Revision: 354506

URL: http://llvm.org/viewvc/llvm-project?rev=354506&view=rev
Log:
[lldb-mi] Move TestMIPrompt away from pexpect().

Added:
lldb/trunk/lit/tools/lldb-mi/breakpoint/break-main.test
Removed:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py

Added: lldb/trunk/lit/tools/lldb-mi/breakpoint/break-main.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/breakpoint/break-main.test?rev=354506&view=auto
==
--- lldb/trunk/lit/tools/lldb-mi/breakpoint/break-main.test (added)
+++ lldb/trunk/lit/tools/lldb-mi/breakpoint/break-main.test Wed Feb 20 11:25:12 
2019
@@ -0,0 +1,17 @@
+# RUN: %build %p/inputs/break-insert.c --nodefaultlib -o a.exe
+# RUN: %lldbmi < %s | FileCheck %s
+
+# Test that a breakpoint can be set on a function.
+
+-file-exec-and-symbols a.exe
+# CHECK: ^done
+
+-break-insert -f main
+# CHECK: ^done,bkpt={number="1"
+
+-exec-run
+# CHECK: ^running
+# CHECK: *stopped,reason="breakpoint-hit"
+
+-exec-continue
+# CHECK: ^running

Removed: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py?rev=354505&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py 
(removed)
@@ -1,58 +0,0 @@
-"""
-Test that the lldb-mi driver prints prompt properly.
-"""
-
-from __future__ import print_function
-
-
-import lldbmi_testcase
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class MiPromptTestCase(lldbmi_testcase.MiTestCaseBase):
-
-mydir = TestBase.compute_mydir(__file__)
-
-@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
-@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
-@skipIfRemote   # We do not currently support remote debugging via the MI.
-def test_lldbmi_prompt(self):
-"""Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and 
events."""
-
-self.spawnLldbMi(args=None)
-
-# Test that lldb-mi is ready after unknown command
-self.runCmd("-unknown-command")
-self.expect(
-"\^error,msg=\"Driver\. Received command '-unknown-command'\. It 
was not handled\. Command 'unknown-command' not in Command Factory\"")
-self.expect(self.child_prompt, exactly=True)
-
-# Test that lldb-mi is ready after -file-exec-and-symbols
-self.runCmd("-file-exec-and-symbols %s" % self.myexe)
-self.expect("\^done")
-self.expect(self.child_prompt, exactly=True)
-
-# Test that lldb-mi is ready after -break-insert
-self.runCmd("-break-insert -f main")
-self.expect("\^done,bkpt={number=\"1\"")
-self.expect(self.child_prompt, exactly=True)
-
-# Test that lldb-mi is ready after -exec-run
-self.runCmd("-exec-run")
-self.expect("\*running")
-self.expect(self.child_prompt, exactly=True)
-
-# Test that lldb-mi is ready after BP hit
-self.expect("\*stopped,reason=\"breakpoint-hit\"")
-self.expect(self.child_prompt, exactly=True)
-
-# Test that lldb-mi is ready after -exec-continue
-self.runCmd("-exec-continue")
-self.expect("\^running")
-self.expect(self.child_prompt, exactly=True)
-
-# Test that lldb-mi is ready after program exited
-self.expect("\*stopped,reason=\"exited-normally\"")
-self.expect(self.child_prompt, exactly=True)


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


[Lldb-commits] [PATCH] D58465: testsuite: Fix TestCompDirSymLink and TestSourceManager on Linux with symlinked build dir

2019-02-20 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 187666.
jankratochvil retitled this revision from "testsuite: Fix TestCompDirSymLink on 
Linux with symlinked build dir" to "testsuite: Fix TestCompDirSymLink and 
TestSourceManager on Linux with symlinked build dir".
jankratochvil edited the summary of this revision.
Herald added a subscriber: abidh.

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58465

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
  lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py


Index: lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
===
--- lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
+++ lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
@@ -158,12 +158,15 @@
 error=True,
 substrs=['''error: the replacement path doesn't exist: 
"/q/r/s/t/u"'''])
 
+# Current directory points to its realpath form.
+builddir_real = os.path.realpath(self.getBuildDir())
+hidden_real = os.path.realpath(hidden)
 # Set target.source-map settings.
 self.runCmd("settings set target.source-map %s %s" %
-(self.getBuildDir(), hidden))
+(builddir_real, hidden_real))
 # And verify that the settings work.
 self.expect("settings show target.source-map",
-substrs=[self.getBuildDir(), hidden])
+substrs=[builddir_real, hidden_real])
 
 # Display main() and verify that the source mapping has been kicked in.
 self.expect("source list -n main", SOURCE_DISPLAYED_CORRECTLY,
@@ -238,11 +241,14 @@
 self.build()
 hidden = self.getBuildArtifact("hidden")
 lldbutil.mkdir_p(hidden)
+# Current directory points to its realpath form.
+builddir_real = os.path.realpath(self.getBuildDir())
+hidden_real = os.path.realpath(hidden)
 self.runCmd("settings set target.source-map %s %s" %
-(self.getBuildDir(), hidden))
+(builddir_real, hidden_real))
 
 exe = self.getBuildArtifact("a.out")
-main = os.path.join(self.getBuildDir(), "hidden", "main-copy.c")
+main = os.path.join(builddir_real, "hidden", "main-copy.c")
 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
 lldbutil.run_break_set_by_file_and_line(
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
@@ -48,6 +48,8 @@
 "settings set %s %s" %
 (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
 src_path = self.getBuildArtifact(_SRC_FILE)
+# /proc/self/cwd points to a realpath form of current directory.
+src_path = os.path.realpath(src_path)
 lldbutil.run_break_set_by_file_and_line(self, src_path, self.line)
 
 @skipIf(hostoslist=["windows"])


Index: lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
===
--- lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
+++ lldb/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
@@ -158,12 +158,15 @@
 error=True,
 substrs=['''error: the replacement path doesn't exist: "/q/r/s/t/u"'''])
 
+# Current directory points to its realpath form.
+builddir_real = os.path.realpath(self.getBuildDir())
+hidden_real = os.path.realpath(hidden)
 # Set target.source-map settings.
 self.runCmd("settings set target.source-map %s %s" %
-(self.getBuildDir(), hidden))
+(builddir_real, hidden_real))
 # And verify that the settings work.
 self.expect("settings show target.source-map",
-substrs=[self.getBuildDir(), hidden])
+substrs=[builddir_real, hidden_real])
 
 # Display main() and verify that the source mapping has been kicked in.
 self.expect("source list -n main", SOURCE_DISPLAYED_CORRECTLY,
@@ -238,11 +241,14 @@
 self.build()
 hidden = self.getBuildArtifact("hidden")
 lldbutil.mkdir_p(hidden)
+# Current directory points to its realpath form.
+builddir_real = os.path.realpath(self.getBuildDir())
+hidden_real = os.path.realpath(hidden)
 self.runCmd("settings set target.source-map %s %s" %
-(self.getBuildDir(), hidden))
+  

[Lldb-commits] [PATCH] D58405: Merge target triple into module triple when constructing module from memory

2019-02-20 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

Looks good.


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

https://reviews.llvm.org/D58405



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


[Lldb-commits] [PATCH] D58405: Merge target triple into module triple when constructing module from memory

2019-02-20 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL354526: Merge target triple into module triple when 
constructing module from memory (authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D58405

Files:
  lldb/trunk/source/Core/Module.cpp


Index: lldb/trunk/source/Core/Module.cpp
===
--- lldb/trunk/source/Core/Module.cpp
+++ lldb/trunk/source/Core/Module.cpp
@@ -309,6 +309,10 @@
   // file's architecture since it might differ in vendor/os if some
   // parts were unknown.
   m_arch = m_objfile_sp->GetArchitecture();
+
+  // Augment the arch with the target's information in case
+  // we are unable to extract the os/environment from memory.
+  m_arch.MergeFrom(process_sp->GetTarget().GetArchitecture());
 } else {
   error.SetErrorString("unable to find suitable object file plug-in");
 }


Index: lldb/trunk/source/Core/Module.cpp
===
--- lldb/trunk/source/Core/Module.cpp
+++ lldb/trunk/source/Core/Module.cpp
@@ -309,6 +309,10 @@
   // file's architecture since it might differ in vendor/os if some
   // parts were unknown.
   m_arch = m_objfile_sp->GetArchitecture();
+
+  // Augment the arch with the target's information in case
+  // we are unable to extract the os/environment from memory.
+  m_arch.MergeFrom(process_sp->GetTarget().GetArchitecture());
 } else {
   error.SetErrorString("unable to find suitable object file plug-in");
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r354526 - Merge target triple into module triple when constructing module from memory

2019-02-20 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Wed Feb 20 15:12:56 2019
New Revision: 354526

URL: http://llvm.org/viewvc/llvm-project?rev=354526&view=rev
Log:
Merge target triple into module triple when constructing module from memory

Summary:
While debugging an android process remotely from a windows machine, I
noticed that the modules constructed from an object file in memory only had
information about the architecture. Without knowledge of the OS or environment,
expression evaluation sometimes leads to incorrectly generated code or a
debugger crash. While we cannot know for certain what triple a module
constructed from an in-memory object file will have, we can use the
triple from the target to try and fill in the missing details.

Reviewers: clayborg, zturner, JDevlieghere, compnerd, aprantl, labath

Subscribers: jdoerfert, lldb-commits

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

Modified:
lldb/trunk/source/Core/Module.cpp

Modified: lldb/trunk/source/Core/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=354526&r1=354525&r2=354526&view=diff
==
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Wed Feb 20 15:12:56 2019
@@ -309,6 +309,10 @@ ObjectFile *Module::GetMemoryObjectFile(
   // file's architecture since it might differ in vendor/os if some
   // parts were unknown.
   m_arch = m_objfile_sp->GetArchitecture();
+
+  // Augment the arch with the target's information in case
+  // we are unable to extract the os/environment from memory.
+  m_arch.MergeFrom(process_sp->GetTarget().GetArchitecture());
 } else {
   error.SetErrorString("unable to find suitable object file plug-in");
 }


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


[Lldb-commits] [lldb] r354540 - Revert "[lldb-mi] Move TestMIPrompt away from pexpect()."

2019-02-20 Thread Davide Italiano via lldb-commits
Author: davide
Date: Wed Feb 20 17:55:31 2019
New Revision: 354540

URL: http://llvm.org/viewvc/llvm-project?rev=354540&view=rev
Log:
Revert "[lldb-mi] Move TestMIPrompt away from pexpect()."

I see a test failing on the macOS bots. I can't reproduce
locally, so try to get the bots green before I can investigate.

Added:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py
Removed:
lldb/trunk/lit/tools/lldb-mi/breakpoint/break-main.test

Removed: lldb/trunk/lit/tools/lldb-mi/breakpoint/break-main.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/breakpoint/break-main.test?rev=354539&view=auto
==
--- lldb/trunk/lit/tools/lldb-mi/breakpoint/break-main.test (original)
+++ lldb/trunk/lit/tools/lldb-mi/breakpoint/break-main.test (removed)
@@ -1,17 +0,0 @@
-# RUN: %build %p/inputs/break-insert.c --nodefaultlib -o a.exe
-# RUN: %lldbmi < %s | FileCheck %s
-
-# Test that a breakpoint can be set on a function.
-
--file-exec-and-symbols a.exe
-# CHECK: ^done
-
--break-insert -f main
-# CHECK: ^done,bkpt={number="1"
-
--exec-run
-# CHECK: ^running
-# CHECK: *stopped,reason="breakpoint-hit"
-
--exec-continue
-# CHECK: ^running

Added: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py?rev=354540&view=auto
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py 
(added)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py Wed 
Feb 20 17:55:31 2019
@@ -0,0 +1,58 @@
+"""
+Test that the lldb-mi driver prints prompt properly.
+"""
+
+from __future__ import print_function
+
+
+import lldbmi_testcase
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class MiPromptTestCase(lldbmi_testcase.MiTestCaseBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIfWindows  # llvm.org/pr24452: Get lldb-mi tests working on Windows
+@skipIfFreeBSD  # llvm.org/pr22411: Failure presumably due to known thread 
races
+@skipIfRemote   # We do not currently support remote debugging via the MI.
+def test_lldbmi_prompt(self):
+"""Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and 
events."""
+
+self.spawnLldbMi(args=None)
+
+# Test that lldb-mi is ready after unknown command
+self.runCmd("-unknown-command")
+self.expect(
+"\^error,msg=\"Driver\. Received command '-unknown-command'\. It 
was not handled\. Command 'unknown-command' not in Command Factory\"")
+self.expect(self.child_prompt, exactly=True)
+
+# Test that lldb-mi is ready after -file-exec-and-symbols
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+self.expect(self.child_prompt, exactly=True)
+
+# Test that lldb-mi is ready after -break-insert
+self.runCmd("-break-insert -f main")
+self.expect("\^done,bkpt={number=\"1\"")
+self.expect(self.child_prompt, exactly=True)
+
+# Test that lldb-mi is ready after -exec-run
+self.runCmd("-exec-run")
+self.expect("\*running")
+self.expect(self.child_prompt, exactly=True)
+
+# Test that lldb-mi is ready after BP hit
+self.expect("\*stopped,reason=\"breakpoint-hit\"")
+self.expect(self.child_prompt, exactly=True)
+
+# Test that lldb-mi is ready after -exec-continue
+self.runCmd("-exec-continue")
+self.expect("\^running")
+self.expect(self.child_prompt, exactly=True)
+
+# Test that lldb-mi is ready after program exited
+self.expect("\*stopped,reason=\"exited-normally\"")
+self.expect(self.child_prompt, exactly=True)


___
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-20 Thread serge via Phabricator via lldb-commits
serge-sans-paille added a comment.

@sgraenitz : it's possible that r352382 fixes my issue. I'll double check that 
first!


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] D58410: [Reproducers] Initialize reproducers before initializing the debugger.

2019-02-20 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. I'd maybe rename InitializeReplay into Replay (i.e., do the merging the 
other way around), since the `Initialize` part makes me think the replay will 
not actually commence there.

I forgot that we don't return STL objects through the API. It's a shame we have 
to resort to the `static std::string` hack. Another option would be to 
ConstStringify the string, but as these are functions that are to be called 
just once, this should do too.


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

https://reviews.llvm.org/D58410



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


[Lldb-commits] [PATCH] D58394: Add --auto-continue to stop-hooks, fix up a few tests

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

Ok, LGTM in that case. In terms of the linux decorators, I guess this means 
that the "unsupported" decorator can be removed on the threaded version of the 
test, and an "XFAIL" needs to be added to the non-threaded one.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D58394



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