[Lldb-commits] [PATCH] D55318: [Expressions] Add support of expressions evaluation in some object's context

2018-12-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Sounds like an interesting feature to me.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55318



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


Re: [Lldb-commits] [PATCH] D54942: [PDB] Make PDB lit tests use the new builder

2018-12-06 Thread Aleksandr Urakov via lldb-commits
Yes, this solution would solve the current problem. But theoretically the
uniqueness may be defined by the directory, where the file is located, not
by the name. It looks very unlikely, but who knows...

I thought about what Stella have said, and it seems that I have found a
good solution for this. We can use something like `tempfile` (
https://docs.python.org/3.7/library/tempfile.html) for every internally
generated file of the script. It will guarantee us the uniqueness of the
file. But for the uniqueness of files named by script parameters the script
user will remain responsible.

What do you think about the such approach?

On Wed, Dec 5, 2018 at 11:55 PM Zachary Turner  wrote:

> I was thinking that we could just automatically compute the output file
> names as:
>
> os.path.join(out_dir, basename(output_file) + '.' + basename(input_file) +
> '.obj')
>
> Currently it's just
>
> os.path.join(out_dir, basename(input_file) + '.obj')
>
> which is why I think the problem occurs.
>
> On Wed, Dec 5, 2018 at 12:47 PM Aleksandr Urakov <
> aleksandr.ura...@jetbrains.com> wrote:
>
>> With such solution there would be even no need to change the current
>> commit. But I'm not sure that it's trivial to do - the output file name may
>> contain path with directories. May be we can replace slashes with
>> underscores in the output file path and concatenate it with the object file
>> name? Or even replace slashes in the source file path and concatenate it
>> with the output file path - so object files will be located in the same
>> place as the output file.
>>
>> Am Mi., 5. Dez. 2018, 23:30 hat Zachary Turner 
>> geschrieben:
>>
>>> It is not possible to specify object file name in compile and link mode.
>>> But perhaps we can just change the default object file name to include
>>> something from the output file as well
>>> On Wed, Dec 5, 2018 at 12:26 PM Aleksandr Urakov via Phabricator <
>>> revi...@reviews.llvm.org> wrote:
>>>
 aleksandr.urakov added a subscriber: zturner.
 aleksandr.urakov added a comment.

 The similar problem with `typedefs.test` is here:
 http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1940/steps/test/logs/stdio

 I have an assumption about the cause of the problem. Are the tests
 running in parallel? In this case `typedefs.test` and `enums-layout.test`
 are writing to the same object file together, because they both are
 compiled from the same source.

 @zturner Is it possible to specify object file's name in
 `compile-and-link` mode? Then we can specify different names in different
 tests for both object files and executables. But I think that splitting the
 source or combining the tests would be a better idea.

 I will fix it only tomorrow, because I'm already at home today. Feel
 free to revert it if needed.


 Repository:
   rL LLVM

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

 https://reviews.llvm.org/D54942





-- 
Aleksandr Urakov
Software Developer
JetBrains
http://www.jetbrains.com
The Drive to Develop
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55142: Minidump debugging using the native PDB reader

2018-12-06 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D55142#1320447 , @lemo wrote:

> I agree with both comments. The intention is to add some tests but I wanted 
> to get the review out early to surface concerns, if any. I also needed more 
> time to investigate a few complex failures uncovered by this change (ex. 
> https://bugs.llvm.org/show_bug.cgi?id=39882 and 
> https://bugs.llvm.org/show_bug.cgi?id=39897)
>
> Yes, this change can also be split in three parts: the reason it's bundled up 
> in this review is that all three parts are required to enable the basic 
> functionality (and overall it's a relatively small change). Maybe it was 
> better if I sent out the parts separately, but right now I'd like to preserve 
> the continuity in the review comments. 
>  I'm about to send out a new revision and once this review satisfies all the 
> comments I'll split it out and send individual reviews.


Sounds good. I think it would be nice to see the isolated patches standing next 
to their tests.




Comment at: source/Plugins/Process/minidump/ProcessMinidump.cpp:134-136
 lldb::SectionSP section_sp(new Section(
 shared_from_this(), // Module to which this section belongs.
+GetObjectFile(),// ObjectFile

I don't know whether you'll run into any problems because of this, but the way 
this works for "normal" object files is that the each object file has a list of 
"own" sections, and then the Module has a "unified" list, which contains the 
sections of the main object file possibly combined with sections from the 
symbol object files. Here you are adding a section to the unified list without 
adding it to the object file, which is a bit nonstandard. I think it would be 
better to just add it to both places.



Comment at: source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:106
 static std::unique_ptr
-loadMatchingPDBFile(std::string exe_path, llvm::BumpPtrAllocator &allocator) {
-  // Try to find a matching PDB for an EXE.
+loadMatchingPDBFile(lldb_private::ObjectFile *obj_file,
+llvm::BumpPtrAllocator &allocator) {

lemo wrote:
> zturner wrote:
> > Perhaps `obj_file` should be a reference just to clarify that it can't be 
> > null.
> That would make sense. Unfortunately, obj_file can't be const 
> (ObjectFile::GetUUID() is non const and it's not easy to surgically fix it)
> 
> So we'd have to pass by non-const ref, which would read "out-parameter", 
> which IMO is more confusing than the non-null part is worth.
I don't think the `ObjectFile&` would be an out-parameter any more than the 
existing `BumpPtrAllocator&` is an out-parameter. So making this a reference 
would also make things locally consistent.



Comment at: source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:150
+auto uuid_bytes = uuid.GetBytes();
+if (uuid_bytes.size() != sizeof(llvm::codeview::GUID) + 4) // CvRecordPdb70
+  return nullptr;

make this `sizeof(guid)` for consistency.



Comment at: source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:171-174
+  // TODO: we need to compare the age, in addition to the GUID
   if (expected_info->getGuid() != guid)
 return nullptr;
+

Mainly out of curiosity, what's the complication here? The llvm interface does 
not provide the means to retrieve the age?


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

https://reviews.llvm.org/D55142



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


Re: [Lldb-commits] [PATCH] D54942: [PDB] Make PDB lit tests use the new builder

2018-12-06 Thread Pavel Labath via lldb-commits

On 06/12/2018 09:25, Aleksandr Urakov via lldb-commits wrote:


I thought about what Stella have said, and it seems that I have found a 
good solution for this. We can use something like `tempfile` 
(https://docs.python.org/3.7/library/tempfile.html) for every internally 
generated file of the script. It will guarantee us the uniqueness of the 
file. But for the uniqueness of files named by script parameters the 
script user will remain responsible.


What do you think about the such approach?


Sounds good to me. That's pretty much what the real compiler driver does 
when you ask it to run in the "compile-and-link" mode.

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


[Lldb-commits] [PATCH] D55356: Add a method to get the "base" file address of an object file

2018-12-06 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, zturner, lemo.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.

Object files generally have a "base" address, which is their preferred
address to be loaded into memory (in the sense that if they are loaded
at this address, then no runtime relocation is required). This is often
the lowest address corresponding to that object file, and various other
addresses are expressed relative to this base (relative virtual
addresses (RVAs) in PE/COFF parlor).

All three of our main object file formats already had such a concept
(it's usually needed to implement SetLoadAddress), but it was not
exposed in any way. The motivation for making this public is that the
symbol address in the breakpad format are written relative to this
address.


https://reviews.llvm.org/D55356

Files:
  include/lldb/Symbol/ObjectFile.h
  lit/Modules/ELF/basic-info.yaml
  lit/Modules/MachO/basic-info.yaml
  lit/Modules/PECOFF/basic-info.yaml
  lit/Modules/build-id-case.yaml
  lit/Modules/compressed-sections.yaml
  lit/Modules/elf-section-types.yaml
  source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.h
  source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  tools/lldb-test/lldb-test.cpp

Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -750,6 +750,7 @@
 Printer.formatLine("Stripped: {0}", ObjectPtr->IsStripped());
 Printer.formatLine("Type: {0}", ObjectPtr->GetType());
 Printer.formatLine("Strata: {0}", ObjectPtr->GetStrata());
+Printer.formatLine("Base VM address: {0:x}", ObjectPtr->GetBaseFileAddress());
 
 size_t Count = Sections->GetNumSections(0);
 Printer.formatLine("Showing {0} sections", Count);
@@ -760,6 +761,7 @@
   Printer.formatLine("Index: {0}", I);
   Printer.formatLine("Name: {0}", S->GetName().GetStringRef());
   Printer.formatLine("Type: {0}", S->GetTypeAsCString());
+  Printer.formatLine("VM address: {0:x}", S->GetFileAddress());
   Printer.formatLine("VM size: {0}", S->GetByteSize());
   Printer.formatLine("File size: {0}", S->GetFileSize());
 
Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
===
--- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -117,6 +117,8 @@
 
   virtual lldb_private::Address GetEntryPointAddress() override;
 
+  lldb::addr_t GetBaseFileAddress() override { return m_image_base; }
+
   ObjectFile::Type CalculateType() override;
 
   ObjectFile::Strata CalculateStrata() override;
Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
===
--- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -106,6 +106,8 @@
 
   lldb_private::Address GetHeaderAddress() override;
 
+  lldb::addr_t GetBaseFileAddress() override;
+
   uint32_t GetNumThreadContexts() override;
 
   std::string GetIdentifierString() override;
Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -5353,6 +5353,12 @@
   return header_addr;
 }
 
+addr_t ObjectFileMachO::GetBaseFileAddress() {
+  if (Section *sect = GetMachHeaderSection())
+return sect->GetFileAddress();
+  return LLDB_INVALID_ADDRESS;
+}
+
 uint32_t ObjectFileMachO::GetNumThreadContexts() {
   ModuleSP module_sp(GetModule());
   if (module_sp) {
Index: source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
===
--- source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
+++ source/Plugins/ObjectFile/JIT/ObjectFileJIT.h
@@ -91,6 +91,8 @@
 
   lldb_private::Address GetHeaderAddress() override;
 
+  lldb::addr_t GetBaseFileAddress() override { return LLDB_INVALID_ADDRESS; }
+
   ObjectFile::Type CalculateType() override;
 
   ObjectFile::Strata CalculateStrata() override;
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.h
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.h
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.h
@@ -134,6 +134,8 @@
 
   lldb_private::Address GetEntryPointAddress() override;
 
+  lldb::addr_t GetBaseFileAddress() override;
+
   ObjectFile::Type CalculateType() override;
 
   ObjectFile::Strata CalculateStrata() override;
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
==

[Lldb-commits] [lldb] r348474 - disable toolchain-clang-cl.test on non-windows

2018-12-06 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Dec  6 01:39:09 2018
New Revision: 348474

URL: http://llvm.org/viewvc/llvm-project?rev=348474&view=rev
Log:
disable toolchain-clang-cl.test on non-windows

The recently added test fail on non-windows platforms.

Modified:
lldb/trunk/lit/BuildScript/toolchain-clang-cl.test

Modified: lldb/trunk/lit/BuildScript/toolchain-clang-cl.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/BuildScript/toolchain-clang-cl.test?rev=348474&r1=348473&r2=348474&view=diff
==
--- lldb/trunk/lit/BuildScript/toolchain-clang-cl.test (original)
+++ lldb/trunk/lit/BuildScript/toolchain-clang-cl.test Thu Dec  6 01:39:09 2018
@@ -1,4 +1,4 @@
-REQUIRES: lld
+REQUIRES: lld, system-windows
 
 RUN: %build -n --verbose --arch=32 --compiler=clang-cl --mode=compile-and-link 
-o %t/foo.exe foobar.c \
 RUN:| FileCheck --check-prefix=CHECK-32 %s


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


[Lldb-commits] [lldb] r348476 - Remove REQUIRES: darwin from a couple of MachO tests

2018-12-06 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Dec  6 01:41:50 2018
New Revision: 348476

URL: http://llvm.org/viewvc/llvm-project?rev=348476&view=rev
Log:
Remove REQUIRES: darwin from a couple of MachO tests

lldb is able to parse MachO files also on other platforms nowadays.

Modified:
lldb/trunk/lit/Modules/lc_build_version.yaml
lldb/trunk/lit/Modules/lc_build_version_notools.yaml

Modified: lldb/trunk/lit/Modules/lc_build_version.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/lc_build_version.yaml?rev=348476&r1=348475&r2=348476&view=diff
==
--- lldb/trunk/lit/Modules/lc_build_version.yaml (original)
+++ lldb/trunk/lit/Modules/lc_build_version.yaml Thu Dec  6 01:41:50 2018
@@ -1,6 +1,5 @@
 # RUN: yaml2obj %s > %t.out
 # RUN: lldb-test symbols %t.out | FileCheck %s
-# REQUIRES: system-darwin
 # Test that the deployment target is parsed from the load commands.
 # CHECK: x86_64-apple-macosx10.14.0
 --- !mach-o

Modified: lldb/trunk/lit/Modules/lc_build_version_notools.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/lc_build_version_notools.yaml?rev=348476&r1=348475&r2=348476&view=diff
==
--- lldb/trunk/lit/Modules/lc_build_version_notools.yaml (original)
+++ lldb/trunk/lit/Modules/lc_build_version_notools.yaml Thu Dec  6 01:41:50 
2018
@@ -1,6 +1,5 @@
 # RUN: yaml2obj %s > %t.out
 # RUN: lldb-test symbols %t.out | FileCheck %s
-# REQUIRES: system-darwin
 # Test that the deployment target is parsed from the load commands.
 # CHECK: x86_64-apple-macosx10.14.0
 --- !mach-o


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


[Lldb-commits] [lldb] r348479 - Make scripts/analyzer-project-deps compatible with python3

2018-12-06 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Dec  6 02:27:38 2018
New Revision: 348479

URL: http://llvm.org/viewvc/llvm-project?rev=348479&view=rev
Log:
Make scripts/analyzer-project-deps compatible with python3

Modified:
lldb/trunk/scripts/analyze-project-deps.py

Modified: lldb/trunk/scripts/analyze-project-deps.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/analyze-project-deps.py?rev=348479&r1=348478&r2=348479&view=diff
==
--- lldb/trunk/scripts/analyze-project-deps.py (original)
+++ lldb/trunk/scripts/analyze-project-deps.py Thu Dec  6 02:27:38 2018
@@ -90,7 +90,7 @@ def is_existing_cycle(path, cycles):
 # at the end), then A -> B -> C is also a cycle.  This is an important
 # optimization which reduces the search space by multiple orders of
 # magnitude.
-for i in xrange(0,len(path)):
+for i in range(0,len(path)):
 if any(is_sublist(x, path) for x in cycles):
 return True
 path = [path[-1]] + path[0:-1]
@@ -129,23 +129,23 @@ def expand(path_queue, path_lengths, cyc
 
 cycles = []
 
-path_queue = [[x] for x in src_map.iterkeys()]
+path_queue = [[x] for x in iter(src_map)]
 path_lens = [1] * len(path_queue)
 
-items = list(src_map.iteritems())
-items.sort(lambda A, B : cmp(A[0], B[0]))
+items = list(src_map.items())
+items.sort(key = lambda A : A[0])
 
 for (path, deps) in items:
-print path + ":"
-sorted_deps = list(deps.iteritems())
+print(path + ":")
+sorted_deps = list(deps.items())
 if args.show_counts:
-sorted_deps.sort(lambda A, B: cmp(A[1], B[1]))
+sorted_deps.sort(key = lambda A: (A[1], A[0]))
 for dep in sorted_deps:
-print "\t{} [{}]".format(dep[0], dep[1])
+print("\t{} [{}]".format(dep[0], dep[1]))
 else:
-sorted_deps.sort(lambda A, B: cmp(A[0], B[0]))
+sorted_deps.sort(key = lambda A: A[0])
 for dep in sorted_deps:
-print "\t{}".format(dep[0])
+print("\t{}".format(dep[0]))
 
 def iter_cycles(cycles):
 global src_map
@@ -161,16 +161,16 @@ def iter_cycles(cycles):
 yield (total, smallest, result)
 
 if args.discover_cycles:
-print "Analyzing cycles..."
+print("Analyzing cycles...")
 
 expand(path_queue, path_lens, cycles, src_map)
 
 average = sum([len(x)+1 for x in cycles]) / len(cycles)
 
-print "Found {} cycles.  Average cycle length = {}.".format(len(cycles), 
average)
+print("Found {} cycles.  Average cycle length = {}.".format(len(cycles), 
average))
 counted = list(iter_cycles(cycles))
 if args.show_counts:
-counted.sort(lambda A, B: cmp(A[0], B[0]))
+counted.sort(key = lambda A: A[0])
 for (total, smallest, cycle) in counted:
 sys.stdout.write("{} deps to break: ".format(total))
 sys.stdout.write(cycle[0][0])
@@ -180,9 +180,9 @@ if args.discover_cycles:
 else:
 for cycle in cycles:
 cycle.append(cycle[0])
-print " -> ".join(cycle)
+print(" -> ".join(cycle))
 
-print "Analyzing islands..."
+print("Analyzing islands...")
 islands = []
 outgoing_counts = defaultdict(int)
 incoming_counts = defaultdict(int)
@@ -195,14 +195,14 @@ if args.discover_cycles:
 disjoints = [x for x in islands if this_cycle.isdisjoint(x)]
 overlaps = [x for x in islands if not this_cycle.isdisjoint(x)]
 islands = disjoints + [set.union(this_cycle, *overlaps)]
-print "Found {} disjoint cycle islands...".format(len(islands))
+print("Found {} disjoint cycle islands...".format(len(islands)))
 for island in islands:
-print "Island ({} elements)".format(len(island))
+print("Island ({} elements)".format(len(island)))
 sorted = []
 for node in island:
 sorted.append((node, incoming_counts[node], outgoing_counts[node]))
-sorted.sort(lambda x, y: cmp(x[1]+x[2], y[1]+y[2]))
+sorted.sort(key = lambda x: x[1]+x[2])
 for (node, inc, outg) in sorted:
-print "  {} [{} in, {} out]".format(node, inc, outg)
+print("  {} [{} in, {} out]".format(node, inc, outg))
 sys.stdout.flush()
 pass


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


[Lldb-commits] [PATCH] D55361: Move Broadcaster+Listener+Event combo from Core into Utility

2018-12-06 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: zturner, jingham, teemperor, clayborg.
Herald added a subscriber: mgorny.

These are general purpose "utility" classes, whose functionality is not
debugger-specific in any way. As such, I believe they belong in the
Utility module.

This doesn't break any particular dependency (yet), but it reduces the
number of Core dependencies across the board.


https://reviews.llvm.org/D55361

Files:
  include/lldb/Breakpoint/Breakpoint.h
  include/lldb/Breakpoint/BreakpointName.h
  include/lldb/Core/Broadcaster.h
  include/lldb/Core/Communication.h
  include/lldb/Core/Debugger.h
  include/lldb/Core/Event.h
  include/lldb/Core/Listener.h
  include/lldb/Core/StructuredDataImpl.h
  include/lldb/Interpreter/CommandInterpreter.h
  include/lldb/Interpreter/ScriptInterpreter.h
  include/lldb/Target/Process.h
  include/lldb/Target/Target.h
  include/lldb/Target/TargetList.h
  include/lldb/Target/Thread.h
  include/lldb/Utility/Broadcaster.h
  include/lldb/Utility/Event.h
  include/lldb/Utility/Listener.h
  source/API/SBBroadcaster.cpp
  source/API/SBCommandInterpreter.cpp
  source/API/SBEvent.cpp
  source/API/SBListener.cpp
  source/API/SBStructuredData.cpp
  source/Core/Broadcaster.cpp
  source/Core/CMakeLists.txt
  source/Core/Communication.cpp
  source/Core/Debugger.cpp
  source/Core/Event.cpp
  source/Core/Listener.cpp
  source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
  source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
  source/Plugins/Process/Utility/HistoryThread.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Target/Process.cpp
  source/Target/Target.cpp
  source/Target/TargetList.cpp
  source/Utility/Broadcaster.cpp
  source/Utility/CMakeLists.txt
  source/Utility/Event.cpp
  source/Utility/Listener.cpp
  unittests/Core/BroadcasterTest.cpp
  unittests/Core/CMakeLists.txt
  unittests/Core/EventTest.cpp
  unittests/Core/ListenerTest.cpp
  unittests/Utility/BroadcasterTest.cpp
  unittests/Utility/CMakeLists.txt
  unittests/Utility/EventTest.cpp
  unittests/Utility/ListenerTest.cpp

Index: unittests/Utility/ListenerTest.cpp
===
--- unittests/Utility/ListenerTest.cpp
+++ unittests/Utility/ListenerTest.cpp
@@ -9,8 +9,8 @@
 
 #include "gtest/gtest.h"
 
-#include "lldb/Core/Broadcaster.h"
-#include "lldb/Core/Listener.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/Listener.h"
 #include 
 #include 
 
Index: unittests/Utility/EventTest.cpp
===
--- unittests/Utility/EventTest.cpp
+++ unittests/Utility/EventTest.cpp
@@ -7,7 +7,7 @@
 //
 //===--===//
 
-#include "lldb/Core/Event.h"
+#include "lldb/Utility/Event.h"
 #include "lldb/Utility/StreamString.h"
 #include "gtest/gtest.h"
 
Index: unittests/Utility/CMakeLists.txt
===
--- unittests/Utility/CMakeLists.txt
+++ unittests/Utility/CMakeLists.txt
@@ -3,14 +3,17 @@
   ArgsTest.cpp
   OptionsWithRawTest.cpp
   ArchSpecTest.cpp
+  BroadcasterTest.cpp
   CleanUpTest.cpp
   ConstStringTest.cpp
   CompletionRequestTest.cpp
   DataExtractorTest.cpp
   EnvironmentTest.cpp
+  EventTest.cpp
   FileSpecTest.cpp
   FlagsTest.cpp
   JSONTest.cpp
+  ListenerTest.cpp
   LogTest.cpp
   NameMatchesTest.cpp
   PredicateTest.cpp
Index: unittests/Utility/BroadcasterTest.cpp
===
--- unittests/Utility/BroadcasterTest.cpp
+++ unittests/Utility/BroadcasterTest.cpp
@@ -9,9 +9,9 @@
 
 #include "gtest/gtest.h"
 
-#include "lldb/Core/Broadcaster.h"
-#include "lldb/Core/Event.h"
-#include "lldb/Core/Listener.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/Event.h"
+#include "lldb/Utility/Listener.h"
 #include "lldb/Utility/Predicate.h"
 
 #include 
Index: unittests/Core/CMakeLists.txt
===
--- unittests/Core/CMakeLists.txt
+++ unittests/Core/CMakeLists.txt
@@ -1,7 +1,4 @@
 add_lldb_unittest(LLDBCoreTests
-  BroadcasterTest.cpp
-  EventTest.cpp
-  ListenerTest.cpp
   MangledTest.cpp
   RangeTest.cpp
   RichManglingContextTest.cpp
Index: source/Utility/Listener.cpp
===
--- source/Utility/Listener.cpp
+++ source/Utility/Listener.cpp
@@ -7,10 +7,10 @@
 //
 //===--===//
 
-#include "lldb/Core/Listener.h"
+#include "lldb/Utility/Listener.h"
 
-#include "lldb/Core/Broadcaster.h"
-#include "lldb/Core/Event.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/Event.h"
 #includ

[Lldb-commits] [PATCH] D55361: Move Broadcaster+Listener+Event combo from Core into Utility

2018-12-06 Thread Bruce Mitchener via Phabricator via lldb-commits
brucem added a comment.

I recognize that it might be dull, but should you re-sort the various include 
lists so that the now-in-Utility headers are listed with the other Utility 
headers?


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

https://reviews.llvm.org/D55361



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


[Lldb-commits] [PATCH] D55361: Move Broadcaster+Listener+Event combo from Core into Utility

2018-12-06 Thread Pavel Labath via Phabricator via lldb-commits
labath updated this revision to Diff 176948.
labath added a comment.

That's a good point, thanks for reminding me.

Re-clang-formatting the changed lines.


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

https://reviews.llvm.org/D55361

Files:
  include/lldb/Breakpoint/Breakpoint.h
  include/lldb/Breakpoint/BreakpointName.h
  include/lldb/Core/Broadcaster.h
  include/lldb/Core/Communication.h
  include/lldb/Core/Debugger.h
  include/lldb/Core/Event.h
  include/lldb/Core/Listener.h
  include/lldb/Core/StructuredDataImpl.h
  include/lldb/Interpreter/CommandInterpreter.h
  include/lldb/Interpreter/ScriptInterpreter.h
  include/lldb/Target/Process.h
  include/lldb/Target/Target.h
  include/lldb/Target/TargetList.h
  include/lldb/Target/Thread.h
  include/lldb/Utility/Broadcaster.h
  include/lldb/Utility/Event.h
  include/lldb/Utility/Listener.h
  source/API/SBBroadcaster.cpp
  source/API/SBCommandInterpreter.cpp
  source/API/SBEvent.cpp
  source/API/SBListener.cpp
  source/API/SBStructuredData.cpp
  source/Core/Broadcaster.cpp
  source/Core/CMakeLists.txt
  source/Core/Communication.cpp
  source/Core/Debugger.cpp
  source/Core/Event.cpp
  source/Core/Listener.cpp
  source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
  source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
  source/Plugins/Process/Utility/HistoryThread.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
  source/Target/Process.cpp
  source/Target/Target.cpp
  source/Target/TargetList.cpp
  source/Utility/Broadcaster.cpp
  source/Utility/CMakeLists.txt
  source/Utility/Event.cpp
  source/Utility/Listener.cpp
  unittests/Core/BroadcasterTest.cpp
  unittests/Core/CMakeLists.txt
  unittests/Core/EventTest.cpp
  unittests/Core/ListenerTest.cpp
  unittests/Utility/BroadcasterTest.cpp
  unittests/Utility/CMakeLists.txt
  unittests/Utility/EventTest.cpp
  unittests/Utility/ListenerTest.cpp

Index: unittests/Utility/ListenerTest.cpp
===
--- unittests/Utility/ListenerTest.cpp
+++ unittests/Utility/ListenerTest.cpp
@@ -9,8 +9,8 @@
 
 #include "gtest/gtest.h"
 
-#include "lldb/Core/Broadcaster.h"
-#include "lldb/Core/Listener.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/Listener.h"
 #include 
 #include 
 
Index: unittests/Utility/EventTest.cpp
===
--- unittests/Utility/EventTest.cpp
+++ unittests/Utility/EventTest.cpp
@@ -7,7 +7,7 @@
 //
 //===--===//
 
-#include "lldb/Core/Event.h"
+#include "lldb/Utility/Event.h"
 #include "lldb/Utility/StreamString.h"
 #include "gtest/gtest.h"
 
Index: unittests/Utility/CMakeLists.txt
===
--- unittests/Utility/CMakeLists.txt
+++ unittests/Utility/CMakeLists.txt
@@ -3,14 +3,17 @@
   ArgsTest.cpp
   OptionsWithRawTest.cpp
   ArchSpecTest.cpp
+  BroadcasterTest.cpp
   CleanUpTest.cpp
   ConstStringTest.cpp
   CompletionRequestTest.cpp
   DataExtractorTest.cpp
   EnvironmentTest.cpp
+  EventTest.cpp
   FileSpecTest.cpp
   FlagsTest.cpp
   JSONTest.cpp
+  ListenerTest.cpp
   LogTest.cpp
   NameMatchesTest.cpp
   PredicateTest.cpp
Index: unittests/Utility/BroadcasterTest.cpp
===
--- unittests/Utility/BroadcasterTest.cpp
+++ unittests/Utility/BroadcasterTest.cpp
@@ -9,9 +9,9 @@
 
 #include "gtest/gtest.h"
 
-#include "lldb/Core/Broadcaster.h"
-#include "lldb/Core/Event.h"
-#include "lldb/Core/Listener.h"
+#include "lldb/Utility/Broadcaster.h"
+#include "lldb/Utility/Event.h"
+#include "lldb/Utility/Listener.h"
 #include "lldb/Utility/Predicate.h"
 
 #include 
Index: unittests/Core/CMakeLists.txt
===
--- unittests/Core/CMakeLists.txt
+++ unittests/Core/CMakeLists.txt
@@ -1,7 +1,4 @@
 add_lldb_unittest(LLDBCoreTests
-  BroadcasterTest.cpp
-  EventTest.cpp
-  ListenerTest.cpp
   MangledTest.cpp
   RangeTest.cpp
   RichManglingContextTest.cpp
Index: source/Utility/Listener.cpp
===
--- source/Utility/Listener.cpp
+++ source/Utility/Listener.cpp
@@ -7,11 +7,11 @@
 //
 //===--===//
 
-#include "lldb/Core/Listener.h"
+#include "lldb/Utility/Listener.h"
 
-#include "lldb/Core/Broadcaster.h"
-#include "lldb/Core/Event.h"
+#include "lldb/Utility/Broadcaster.h"
 #include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Event.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/Logging.h"
 
Index: source/Utility/Event.cpp
==

[Lldb-commits] [PATCH] D55013: [CMake] Streamline code signing for debugserver #2

2018-12-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 176949.
sgraenitz added a comment.

Avoid conflicts: updating diff for recent changes on master


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

https://reviews.llvm.org/D55013

Files:
  cmake/modules/AddLLDB.cmake
  cmake/modules/LLDBConfig.cmake
  test/CMakeLists.txt
  tools/debugserver/CMakeLists.txt
  tools/debugserver/source/CMakeLists.txt
  unittests/tools/CMakeLists.txt

Index: unittests/tools/CMakeLists.txt
===
--- unittests/tools/CMakeLists.txt
+++ unittests/tools/CMakeLists.txt
@@ -1,5 +1,5 @@
 if(CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|Linux|NetBSD")
-  if ((CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_DEBUGSERVER) OR (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND SKIP_LLDB_SERVER_BUILD))
+  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
 # don't provide any value if run against a server copied from somewhere.
   else()
Index: tools/debugserver/source/CMakeLists.txt
===
--- tools/debugserver/source/CMakeLists.txt
+++ tools/debugserver/source/CMakeLists.txt
@@ -94,32 +94,102 @@
 
 add_library(lldbDebugserverCommon ${lldbDebugserverCommonSources})
 
+option(LLDB_NO_DEBUGSERVER "Disable the debugserver target" OFF)
+option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver instead of building it from source (Darwin only)." OFF)
 
-set(LLDB_CODESIGN_IDENTITY "lldb_codesign"
-  CACHE STRING "Identity used for code signing. Set to empty string to skip the signing step.")
+# Incompatible options
+if(LLDB_NO_DEBUGSERVER AND LLDB_USE_SYSTEM_DEBUGSERVER)
+  message(FATAL_ERROR "Inconsistent options: LLDB_NO_DEBUGSERVER and LLDB_USE_SYSTEM_DEBUGSERVER")
+endif()
 
-if(NOT LLDB_CODESIGN_IDENTITY STREQUAL "")
-  set(DEBUGSERVER_PATH ${LLVM_RUNTIME_OUTPUT_INTDIR}/debugserver${CMAKE_EXECUTABLE_SUFFIX} CACHE PATH "Path to debugserver.")
-  set(SKIP_DEBUGSERVER OFF CACHE BOOL "Skip building the in-tree debug server")
-else()
+# Try to locate the system debugserver.
+# Subsequent feasibility checks depend on it.
+if(APPLE AND CMAKE_HOST_APPLE)
   execute_process(
 COMMAND xcode-select -p
-OUTPUT_VARIABLE XCODE_DEV_DIR)
-  string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR)
-  if(EXISTS "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/")
-set(DEBUGSERVER_PATH
-  "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver" CACHE PATH "Path to debugserver.")
-  elseif(EXISTS "${XCODE_DEV_DIR}/Library/PrivateFrameworks/LLDB.framework/")
-set(DEBUGSERVER_PATH
-  "${XCODE_DEV_DIR}/Library/PrivateFrameworks/LLDB.framework/Resources/debugserver" CACHE PATH "Path to debugserver.")
+OUTPUT_VARIABLE xcode_dev_dir)
+  string(STRIP ${xcode_dev_dir} xcode_dev_dir)
+
+  set(debugserver_rel_path "LLDB.framework/Resources/debugserver")
+  set(debugserver_shared "${xcode_dev_dir}/../SharedFrameworks/${debugserver_rel_path}")
+  set(debugserver_private "${xcode_dev_dir}/Library/PrivateFrameworks/${debugserver_rel_path}")
+
+  if(EXISTS ${debugserver_shared})
+set(system_debugserver ${debugserver_shared})
+  elseif(EXISTS ${debugserver_private})
+set(system_debugserver ${debugserver_private})
+  endif()
+endif()
+
+# Handle unavailability
+if(LLDB_USE_SYSTEM_DEBUGSERVER)
+  if(system_debugserver)
+set(use_system_debugserver ON)
+  elseif(APPLE AND CMAKE_HOST_APPLE)
+# Binary not found on system. Keep cached variable, to try again on reconfigure.
+message(SEND_ERROR
+  "LLDB_USE_SYSTEM_DEBUGSERVER option set, but no debugserver found in:\
+${debugserver_shared}\
+${debugserver_private}")
   else()
-message(SEND_ERROR "Cannot find debugserver on system.")
+# Non-Apple target platform or non-Darwin host. Reset invalid cached variable.
+message(WARNING "Reverting invalid option LLDB_USE_SYSTEM_DEBUGSERVER (Darwin only)")
+set(LLDB_USE_SYSTEM_DEBUGSERVER OFF CACHE BOOL "" FORCE)
   endif()
-  set(SKIP_DEBUGSERVER ON CACHE BOOL "Skip building the in-tree debug server")
+elseif(NOT LLDB_NO_DEBUGSERVER)
+  # Default case: on Darwin we need the right code signing ID.
+  # See lldb/docs/code-signing.txt for details.
+  if(CMAKE_HOST_APPLE AND NOT LLVM_CODESIGNING_IDENTITY STREQUAL "lldb_codesign")
+set(msg "Cannot code sign debugserver with identity '${LLVM_CODESIGNING_IDENTITY}'.")
+if(system_debugserver)
+  message(WARNING "${msg} Will fall back to system's debugserver.")
+  set(use_system_debugserver ON)
+else()
+  message(WARNING "${msg} debugserver will not be available.")
+endif()
+  else()
+set(build_and_sign_debugserver ON)
+  endif()
+endif()
+
+# TODO: We don't use the $ generator expression here,
+# because the value of DEBUGSERVER_PATH is used t

[Lldb-commits] [PATCH] D55320: [CMake] Move debugserver options to separate debugserverConfig.cmake

2018-12-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 176950.
sgraenitz added a comment.

Avoid conflicts: updating diff for recent changes on master


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

https://reviews.llvm.org/D55320

Files:
  cmake/modules/debugserverConfig.cmake
  tools/debugserver/CMakeLists.txt


Index: tools/debugserver/CMakeLists.txt
===
--- tools/debugserver/CMakeLists.txt
+++ tools/debugserver/CMakeLists.txt
@@ -10,19 +10,12 @@
 )
 
   include(LLDBStandalone)
+  include(debugserverConfig)
   include(AddLLDB)
 
   set(LLDB_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../")
   include_directories(${LLDB_SOURCE_DIR}/include)
 
-  option(LLDB_USE_ENTITLEMENTS "When code signing, use entitlements if 
available" ON)
-  set(LLDB_CODESIGN_IDENTITY lldb_codesign CACHE STRING
-  "Identity for code signing debugserver (Darwin only)")
-
-  if(LLDB_CODESIGN_IDENTITY)
-set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY} CACHE STRING "" 
FORCE)
-  endif()
-
   # lldb-suite is a dummy target that encompasses all the necessary tools and
   # libraries for building a fully-functioning liblldb.
   add_custom_target(lldb-suite)
Index: cmake/modules/debugserverConfig.cmake
===
--- /dev/null
+++ cmake/modules/debugserverConfig.cmake
@@ -0,0 +1,25 @@
+# Duplicate options from LLDBConfig that are relevant for debugserver 
Standalone builds.
+
+option(LLDB_USE_ENTITLEMENTS "When code signing, use entitlements if 
available" ON)
+set(LLDB_CODESIGN_IDENTITY lldb_codesign CACHE STRING
+"Identity for code signing debugserver (Darwin only)")
+
+if(LLDB_CODESIGN_IDENTITY)
+  set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY} CACHE STRING "" 
FORCE)
+endif()
+
+# If LLDB_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
+if(NOT DEFINED LLDB_VERSION_MAJOR)
+  set(LLDB_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
+endif()
+if(NOT DEFINED LLDB_VERSION_MINOR)
+  set(LLDB_VERSION_MINOR ${LLVM_VERSION_MINOR})
+endif()
+if(NOT DEFINED LLDB_VERSION_PATCH)
+  set(LLDB_VERSION_PATCH ${LLVM_VERSION_PATCH})
+endif()
+if(NOT DEFINED LLDB_VERSION_SUFFIX)
+  set(LLDB_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
+endif()
+set(LLDB_VERSION 
"${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}")
+message(STATUS "LLDB version: ${LLDB_VERSION}")


Index: tools/debugserver/CMakeLists.txt
===
--- tools/debugserver/CMakeLists.txt
+++ tools/debugserver/CMakeLists.txt
@@ -10,19 +10,12 @@
 )
 
   include(LLDBStandalone)
+  include(debugserverConfig)
   include(AddLLDB)
 
   set(LLDB_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../")
   include_directories(${LLDB_SOURCE_DIR}/include)
 
-  option(LLDB_USE_ENTITLEMENTS "When code signing, use entitlements if available" ON)
-  set(LLDB_CODESIGN_IDENTITY lldb_codesign CACHE STRING
-  "Identity for code signing debugserver (Darwin only)")
-
-  if(LLDB_CODESIGN_IDENTITY)
-set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY} CACHE STRING "" FORCE)
-  endif()
-
   # lldb-suite is a dummy target that encompasses all the necessary tools and
   # libraries for building a fully-functioning liblldb.
   add_custom_target(lldb-suite)
Index: cmake/modules/debugserverConfig.cmake
===
--- /dev/null
+++ cmake/modules/debugserverConfig.cmake
@@ -0,0 +1,25 @@
+# Duplicate options from LLDBConfig that are relevant for debugserver Standalone builds.
+
+option(LLDB_USE_ENTITLEMENTS "When code signing, use entitlements if available" ON)
+set(LLDB_CODESIGN_IDENTITY lldb_codesign CACHE STRING
+"Identity for code signing debugserver (Darwin only)")
+
+if(LLDB_CODESIGN_IDENTITY)
+  set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY} CACHE STRING "" FORCE)
+endif()
+
+# If LLDB_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
+if(NOT DEFINED LLDB_VERSION_MAJOR)
+  set(LLDB_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
+endif()
+if(NOT DEFINED LLDB_VERSION_MINOR)
+  set(LLDB_VERSION_MINOR ${LLVM_VERSION_MINOR})
+endif()
+if(NOT DEFINED LLDB_VERSION_PATCH)
+  set(LLDB_VERSION_PATCH ${LLVM_VERSION_PATCH})
+endif()
+if(NOT DEFINED LLDB_VERSION_SUFFIX)
+  set(LLDB_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
+endif()
+set(LLDB_VERSION "${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}")
+message(STATUS "LLDB version: ${LLDB_VERSION}")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55328: [CMake] Revised LLDB.framework builds

2018-12-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 176954.
sgraenitz added a comment.

Avoid conflicts: updating diff for recent changes on master


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

https://reviews.llvm.org/D55328

Files:
  CMakeLists.txt
  cmake/modules/AddLLDB.cmake
  cmake/modules/LLDBConfig.cmake
  cmake/modules/LLDBFramework.cmake
  resources/LLDB-Info.plist.in
  source/API/CMakeLists.txt
  test/CMakeLists.txt
  tools/argdumper/CMakeLists.txt
  tools/darwin-debug/CMakeLists.txt
  tools/debugserver/CMakeLists.txt
  tools/debugserver/source/CMakeLists.txt
  tools/driver/CMakeLists.txt
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -42,7 +42,7 @@
   list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF)
 endif()
 
-add_lldb_tool(lldb-server INCLUDE_IN_SUITE
+add_lldb_tool(lldb-server
 Acceptor.cpp
 lldb-gdbserver.cpp
 lldb-platform.cpp
Index: tools/driver/CMakeLists.txt
===
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -19,7 +19,6 @@
 endif()
 
 add_dependencies(lldb
-  ${LLDB_SUITE_TARGET}
   LLDBOptionsTableGen
   ${tablegen_deps}
 )
Index: tools/debugserver/source/CMakeLists.txt
===
--- tools/debugserver/source/CMakeLists.txt
+++ tools/debugserver/source/CMakeLists.txt
@@ -240,7 +240,7 @@
  COMPILE_DEFINITIONS HAVE_LIBCOMPRESSION)
   endif()
   set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources})
-  add_lldb_tool(debugserver INCLUDE_IN_SUITE
+  add_lldb_tool(debugserver
 debugserver.cpp
 
 LINK_LIBS
Index: tools/debugserver/CMakeLists.txt
===
--- tools/debugserver/CMakeLists.txt
+++ tools/debugserver/CMakeLists.txt
@@ -15,11 +15,6 @@
 
   set(LLDB_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../")
   include_directories(${LLDB_SOURCE_DIR}/include)
-
-  # lldb-suite is a dummy target that encompasses all the necessary tools and
-  # libraries for building a fully-functioning liblldb.
-  add_custom_target(lldb-suite)
-  set(LLDB_SUITE_TARGET lldb-suite)
 endif()
 
 add_subdirectory(source)
Index: tools/darwin-debug/CMakeLists.txt
===
--- tools/darwin-debug/CMakeLists.txt
+++ tools/darwin-debug/CMakeLists.txt
@@ -1,3 +1,3 @@
-add_lldb_tool(darwin-debug INCLUDE_IN_SUITE
+add_lldb_tool(darwin-debug
   darwin-debug.cpp
   )
Index: tools/argdumper/CMakeLists.txt
===
--- tools/argdumper/CMakeLists.txt
+++ tools/argdumper/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_tool(lldb-argdumper INCLUDE_IN_SUITE
+add_lldb_tool(lldb-argdumper
   argdumper.cpp
 
   LINK_LIBS
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -79,7 +79,13 @@
 endif()
 
 if(LLDB_BUILD_FRAMEWORK)
-  list(APPEND LLDB_TEST_COMMON_ARGS --framework ${LLDB_FRAMEWORK_DIR}/LLDB.framework)
+  # The $ generator expression
+  # provides this value, but LLDB_DOTEST_ARGS needs it at configuration-time.
+  get_filename_component(
+framework_target_dir ${LLDB_FRAMEWORK_BUILD_DIR} ABSOLUTE
+BASE_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}
+  )
+  list(APPEND LLDB_TEST_COMMON_ARGS --framework ${framework_target_dir}/LLDB.framework)
 endif()
 
 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
Index: source/API/CMakeLists.txt
===
--- source/API/CMakeLists.txt
+++ source/API/CMakeLists.txt
@@ -92,24 +92,25 @@
 Support
   )
 
-add_dependencies(lldb-suite liblldb)
+if(LLDB_WRAP_PYTHON)
+  add_dependencies(liblldb swig_wrapper)
 
-if (MSVC)
-  set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
-else()
-  set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
-endif()
+  if (MSVC)
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
+  else()
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
+  endif()
 
-set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
-if (CLANG_CL)
-  set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
-PROPERTY COMPILE_FLAGS " -Wno-unused-function")
+  if (CLANG_CL)
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
+  PROPERTY COMPILE_FLAGS " -Wno-unused-function")
+  endif()
+  if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
+  NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
+  PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
+  endif ()
 endif()
-if (LLVM_COMPILER_IS_GCC_CO

[Lldb-commits] [PATCH] D55330: [CMake] Revised RPATH handling

2018-12-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 176956.
sgraenitz added a comment.

Avoid conflicts: updating diff for recent changes on master


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

https://reviews.llvm.org/D55330

Files:
  cmake/modules/AddLLDB.cmake
  cmake/modules/LLDBConfig.cmake
  tools/driver/CMakeLists.txt
  tools/lldb-mi/CMakeLists.txt
  tools/lldb-vscode/CMakeLists.txt

Index: tools/lldb-vscode/CMakeLists.txt
===
--- tools/lldb-vscode/CMakeLists.txt
+++ tools/lldb-vscode/CMakeLists.txt
@@ -28,3 +28,7 @@
   LINK_COMPONENTS
 Support
   )
+
+if(LLDB_BUILD_FRAMEWORK)
+  lldb_setup_rpaths_framework(lldb-vscode)
+endif()
Index: tools/lldb-mi/CMakeLists.txt
===
--- tools/lldb-mi/CMakeLists.txt
+++ tools/lldb-mi/CMakeLists.txt
@@ -93,3 +93,7 @@
   LINK_COMPONENTS
 Support
   )
+
+if(LLDB_BUILD_FRAMEWORK)
+  lldb_setup_rpaths_framework(lldb-mi)
+endif()
Index: tools/driver/CMakeLists.txt
===
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -22,3 +22,7 @@
   LLDBOptionsTableGen
   ${tablegen_deps}
 )
+
+if(LLDB_BUILD_FRAMEWORK)
+  lldb_setup_rpaths_framework(lldb)
+endif()
Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -47,6 +47,7 @@
 option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to locate Python." OFF)
 option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install a copy of it" OFF)
 option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
+option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in binaries" OFF)
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON)
 
 set(LLDB_CODESIGN_IDENTITY lldb_codesign CACHE STRING
Index: cmake/modules/AddLLDB.cmake
===
--- cmake/modules/AddLLDB.cmake
+++ cmake/modules/AddLLDB.cmake
@@ -44,9 +44,15 @@
   if (PARAM_OBJECT)
 add_library(${name} ${libkind} ${srcs})
   else()
-llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
-${PARAM_LINK_LIBS}
-DEPENDS ${PARAM_DEPENDS})
+if(LLDB_NO_INSTALL_DEFAULT_RPATH)
+  set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
+endif()
+
+llvm_add_library(${name} ${libkind} ${srcs}
+  LINK_LIBS ${PARAM_LINK_LIBS}
+  DEPENDS ${PARAM_DEPENDS}
+  ${pass_NO_INSTALL_RPATH}
+)
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "liblldb")
   if (PARAM_SHARED)
@@ -98,8 +104,15 @@
 ${ARGN}
 )
 
+  if(LLDB_NO_INSTALL_DEFAULT_RPATH)
+set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
+  endif()
+
   list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
-  add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS} ENTITLEMENTS ${ARG_ENTITLEMENTS})
+  add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS}
+ENTITLEMENTS ${ARG_ENTITLEMENTS}
+${pass_NO_INSTALL_RPATH}
+  )
 
   target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
   set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
@@ -135,3 +148,29 @@
   # Now set them onto the target.
   set_target_properties(${target_name} PROPERTIES LINK_FLAGS ${new_link_flags})
 endfunction()
+
+# Account for different directory structures of build-tree and install-tree with
+# LLDB_BUILD_FRAMEWORK, replacing default RPATH settings (see llvm_setup_rpath),
+# so that we emit correct load commands for tools that dynamically link to the
+# framework bundle.
+function(lldb_setup_rpaths_framework name)
+  # In the build-tree, we know the exact path to the binary in the framework.
+  set(rpath_build_tree "$")
+
+  # The installed framework is relocatable and can be in different locations.
+  set(rpaths_install_tree "@loader_path/../../../SharedFrameworks")
+  list(APPEND rpaths_install_tree "@loader_path/../../System/Library/PrivateFrameworks")
+  list(APPEND rpaths_install_tree "@loader_path/../../Library/PrivateFrameworks")
+
+  if(LLDB_FRAMEWORK_INSTALL_DIR)
+set(rpaths_install_tree "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}")
+  endif()
+
+  set_target_properties(${name} PROPERTIES
+BUILD_WITH_INSTALL_RPATH OFF
+BUILD_RPATH "${rpath_build_tree}"
+INSTALL_RPATH "${rpaths_install_tree}"
+  )
+
+  add_dependencies(${name} lldb-framework)
+endfunction()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55332: [CMake] Python bindings generation polishing

2018-12-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 176957.
sgraenitz added a comment.

Avoid conflicts: updating diff for recent changes on master


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

https://reviews.llvm.org/D55332

Files:
  CMakeLists.txt
  scripts/CMakeLists.txt
  source/API/CMakeLists.txt

Index: source/API/CMakeLists.txt
===
--- source/API/CMakeLists.txt
+++ source/API/CMakeLists.txt
@@ -4,6 +4,15 @@
 
 get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
 
+if(NOT LLDB_DISABLE_PYTHON)
+  # We could get this path from $
+  # but set_source_files_properties() doesn't accept generator expressions.
+  get_property(lldb_python_dir GLOBAL PROPERTY LLDB_PYTHON_BINARY_DIR)
+
+  set(lldb_python_wrapper ${lldb_python_dir}/LLDBWrapPython.cpp)
+  set_source_files_properties(${lldb_python_wrapper} PROPERTIES GENERATED ON)
+endif()
+
 add_lldb_library(liblldb SHARED
   SBAddress.cpp
   SBAttachInfo.cpp
@@ -73,7 +82,7 @@
   SBWatchpoint.cpp
   SBUnixSignals.cpp
   SystemInitializerFull.cpp
-  ${LLDB_WRAP_PYTHON}
+  ${lldb_python_wrapper}
 
   LINK_LIBS
 lldbBase
@@ -92,22 +101,22 @@
 Support
   )
 
-if(LLDB_WRAP_PYTHON)
+if(lldb_python_wrapper)
   add_dependencies(liblldb swig_wrapper)
 
   if (MSVC)
-set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
+set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
   else()
-set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
+set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
   endif()
 
   if (CLANG_CL)
-set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
+set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
   PROPERTY COMPILE_FLAGS " -Wno-unused-function")
   endif()
   if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
   NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
-set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
+set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
   PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
   endif ()
 endif()
Index: scripts/CMakeLists.txt
===
--- scripts/CMakeLists.txt
+++ scripts/CMakeLists.txt
@@ -11,31 +11,14 @@
 
 include(FindPythonInterp)
 
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-  set(SWIG_PYTHON_DIR
-${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-else()
-  set(SWIG_PYTHON_DIR ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/site-packages)
-endif()
-
-set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
-
-# Generating the LLDB framework correctly is a bit complicated because the
-# framework depends on the swig output.
 if(LLDB_BUILD_FRAMEWORK)
   set(framework_arg --framework --target-platform Darwin)
-  set(SWIG_PYTHON_DIR
-${LLDB_PYTHON_TARGET_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR}/Python)
-  set(SWIG_INSTALL_DIR
-${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
 endif()
 
-get_filename_component(CFGBLDDIR ${LLDB_WRAP_PYTHON} DIRECTORY)
-
 find_package(SWIG REQUIRED)
 add_custom_command(
-  OUTPUT ${LLDB_WRAP_PYTHON}
-  OUTPUT ${LLDB_PYTHON_TARGET_DIR}/lldb.py
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
   DEPENDS ${SWIG_SOURCES}
   DEPENDS ${SWIG_INTERFACES}
   DEPENDS ${SWIG_HEADERS}
@@ -44,19 +27,36 @@
   COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/prepare_bindings.py
   ${framework_arg}
   --srcRoot=${LLDB_SOURCE_DIR}
-  --targetDir=${LLDB_PYTHON_TARGET_DIR}
-  --cfgBldDir=${CFGBLDDIR}
+  --targetDir=${CMAKE_CURRENT_BINARY_DIR}
+  --cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}
   --prefix=${CMAKE_BINARY_DIR}
   --swigExecutable=${SWIG_EXECUTABLE}
   VERBATIM
   COMMENT "Python script building LLDB Python wrapper")
-add_custom_target(swig_wrapper ALL DEPENDS ${LLDB_WRAP_PYTHON})
 
-set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldb.py PROPERTIES GENERATED 1)
+add_custom_target(swig_wrapper ALL DEPENDS
+  ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
+  ${CMAKE_CURRENT_BINARY_DIR}/lldb.py
+)
+
+# For the liblldb target we need to mark LLDBWrapPython.cpp generated. Doing it
+# here has no effect as set_source_files_properties are visible only to targets
+# added in the same directory.
+set_property(GLOBAL PROPERTY LLDB_PYTHON_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
 
+if(NOT LLDB_BUILD_FRAMEWORK)
+  if(CMAKE_SYSTEM_NAME MATCHES "Windows")
+set(swig_python_subdir site-packages)
+  else()
+set(swig_python_subdir python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
+  endif()
 
-# Install the LLDB python module
-install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
+  set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
+  set(SWIG_INSTALL_DIR lib${LLVM_

Re: [Lldb-commits] [PATCH] D55361: Move Broadcaster+Listener+Event combo from Core into Utility

2018-12-06 Thread Zachary Turner via lldb-commits
Lgtm. Btw I noticed StreamBuffer, which might be another easy one
On Thu, Dec 6, 2018 at 3:27 AM Pavel Labath via Phabricator <
revi...@reviews.llvm.org> wrote:

> labath updated this revision to Diff 176948.
> labath added a comment.
>
> That's a good point, thanks for reminding me.
>
> Re-clang-formatting the changed lines.
>
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D55361/new/
>
> https://reviews.llvm.org/D55361
>
> Files:
>   include/lldb/Breakpoint/Breakpoint.h
>   include/lldb/Breakpoint/BreakpointName.h
>   include/lldb/Core/Broadcaster.h
>   include/lldb/Core/Communication.h
>   include/lldb/Core/Debugger.h
>   include/lldb/Core/Event.h
>   include/lldb/Core/Listener.h
>   include/lldb/Core/StructuredDataImpl.h
>   include/lldb/Interpreter/CommandInterpreter.h
>   include/lldb/Interpreter/ScriptInterpreter.h
>   include/lldb/Target/Process.h
>   include/lldb/Target/Target.h
>   include/lldb/Target/TargetList.h
>   include/lldb/Target/Thread.h
>   include/lldb/Utility/Broadcaster.h
>   include/lldb/Utility/Event.h
>   include/lldb/Utility/Listener.h
>   source/API/SBBroadcaster.cpp
>   source/API/SBCommandInterpreter.cpp
>   source/API/SBEvent.cpp
>   source/API/SBListener.cpp
>   source/API/SBStructuredData.cpp
>   source/Core/Broadcaster.cpp
>   source/Core/CMakeLists.txt
>   source/Core/Communication.cpp
>   source/Core/Debugger.cpp
>   source/Core/Event.cpp
>   source/Core/Listener.cpp
>   source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
>   source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h
>   source/Plugins/Process/Utility/HistoryThread.h
>   source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
>   source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp
>   source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h
>   source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
>   source/Target/Process.cpp
>   source/Target/Target.cpp
>   source/Target/TargetList.cpp
>   source/Utility/Broadcaster.cpp
>   source/Utility/CMakeLists.txt
>   source/Utility/Event.cpp
>   source/Utility/Listener.cpp
>   unittests/Core/BroadcasterTest.cpp
>   unittests/Core/CMakeLists.txt
>   unittests/Core/EventTest.cpp
>   unittests/Core/ListenerTest.cpp
>   unittests/Utility/BroadcasterTest.cpp
>   unittests/Utility/CMakeLists.txt
>   unittests/Utility/EventTest.cpp
>   unittests/Utility/ListenerTest.cpp
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D54942: [PDB] Make PDB lit tests use the new builder

2018-12-06 Thread Zachary Turner via lldb-commits
Yea that sounds reasonable
On Thu, Dec 6, 2018 at 1:07 AM Pavel Labath  wrote:

> On 06/12/2018 09:25, Aleksandr Urakov via lldb-commits wrote:
> >
> > I thought about what Stella have said, and it seems that I have found a
> > good solution for this. We can use something like `tempfile`
> > (https://docs.python.org/3.7/library/tempfile.html) for every
> internally
> > generated file of the script. It will guarantee us the uniqueness of the
> > file. But for the uniqueness of files named by script parameters the
> > script user will remain responsible.
> >
> > What do you think about the such approach?
>
> Sounds good to me. That's pretty much what the real compiler driver does
> when you ask it to run in the "compile-and-link" mode.
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55318: [Expressions] Add support of expressions evaluation in some object's context

2018-12-06 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov updated this revision to Diff 176980.
aleksandr.urakov added a comment.

Thanks for the interest to the feature! I've updated the patch due to the 
comments.

The only problem is that I'm not familiar with Objective C and have no Mac OS 
to test it, so I haven't written the test for Objective C case. I've added the 
"support" of Objective C blindly, so I even not sure that it works correctly. I 
can remove it from the patch (or, may be some person more familiar with the 
theme can check if it is ok?). I'm not sure, is it better to leave a 
preparation of the feature implementation for Objective C or to completely 
remove it?


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

https://reviews.llvm.org/D55318

Files:
  include/lldb/API/SBValue.h
  include/lldb/Expression/ExpressionSourceCode.h
  include/lldb/Expression/UserExpression.h
  include/lldb/Symbol/ClangASTContext.h
  include/lldb/Symbol/TypeSystem.h
  include/lldb/Target/Target.h
  packages/Python/lldbsuite/test/expression_command/context-object/Makefile
  
packages/Python/lldbsuite/test/expression_command/context-object/TestContextObject.py
  packages/Python/lldbsuite/test/expression_command/context-object/main.cpp
  scripts/interface/SBValue.i
  source/API/SBValue.cpp
  source/Breakpoint/BreakpointLocation.cpp
  source/Breakpoint/Watchpoint.cpp
  source/Commands/CommandObjectExpression.cpp
  source/Expression/ExpressionSourceCode.cpp
  source/Expression/UserExpression.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
  source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  source/Symbol/ClangASTContext.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2198,7 +2198,8 @@
 UserExpression *Target::GetUserExpressionForLanguage(
 llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language,
 Expression::ResultType desired_type,
-const EvaluateExpressionOptions &options, Status &error) {
+const EvaluateExpressionOptions &options,
+const lldb::ValueObjectSP &ctx_obj, Status &error) {
   Status type_system_error;
 
   TypeSystem *type_system =
@@ -2214,7 +2215,7 @@
   }
 
   user_expr = type_system->GetUserExpression(expr, prefix, language,
- desired_type, options);
+ desired_type, options, ctx_obj);
   if (!user_expr)
 error.SetErrorStringWithFormat(
 "Could not create an expression for language %s",
@@ -2355,7 +2356,8 @@
 ExpressionResults Target::EvaluateExpression(
 llvm::StringRef expr, ExecutionContextScope *exe_scope,
 lldb::ValueObjectSP &result_valobj_sp,
-const EvaluateExpressionOptions &options, std::string *fixed_expression) {
+const EvaluateExpressionOptions &options, std::string *fixed_expression,
+const lldb::ValueObjectSP &ctx_obj) {
   result_valobj_sp.reset();
 
   ExpressionResults execution_results = eExpressionSetupError;
@@ -2396,7 +2398,9 @@
 execution_results = UserExpression::Evaluate(exe_ctx, options, expr, prefix,
  result_valobj_sp, error,
  0, // Line Number
- fixed_expression);
+ fixed_expression,
+ nullptr, // Module
+ ctx_obj);
   }
 
   m_suppress_stop_hooks = old_suppress_value;
Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -10294,13 +10294,14 @@
 UserExpression *ClangASTContextForExpressions::GetUserExpression(
 llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language,
 Expression::ResultType desired_type,
-const EvaluateExpressionOptions &options) {
+const EvaluateExpressionOptions &options,
+const lldb::ValueObjectSP &ctx_obj) {
   TargetSP target_sp = m_target_wp.lock();
   if (!target_sp)
 return nullptr;
 
   return new ClangUserExpression(*target_sp.get(), expr, prefix, language,
- desired_type, options);
+ desired_type, options, ctx_obj);
 }
 
 FunctionCaller *ClangASTContextForExpressions::GetFunctionCaller(
Index: source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ source/Plugins/ExpressionParse

[Lldb-commits] [lldb] r348499 - Support skewed stream arrays.

2018-12-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Dec  6 08:55:00 2018
New Revision: 348499

URL: http://llvm.org/viewvc/llvm-project?rev=348499&view=rev
Log:
Support skewed stream arrays.

VarStreamArray was built on the assumption that it is backed by a
StreamRef, and offset 0 of that StreamRef is the first byte of the first
record in the array.

This is a logical and intuitive assumption, but unfortunately we have
use cases where it doesn't hold. Specifically, a PDB module's symbol
stream is prefixed by 4 bytes containing a magic value, and the first
byte of record data in the array is actually at offset 4 of this byte
sequence.

Previously, we would just truncate the first 4 bytes and then construct
the VarStreamArray with the resulting StreamRef, so that offset 0 of the
underlying stream did correspond to the first byte of the first record,
but this is problematic, because symbol records reference other symbol
records by the absolute offset including that initial magic 4 bytes. So
if another record wants to refer to the first record in the array, it
would say "the record at offset 4".

This led to extremely confusing hacks and semantics in loading code, and
after spending 30 minutes trying to get some math right and failing, I
decided to fix this in the underlying implementation of VarStreamArray.
Now, we can say that a stream is skewed by a particular amount. This
way, when we access a record by absolute offset, we can use the same
values that the records themselves contain, instead of having to do
fixups.

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

Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp?rev=348499&r1=348498&r2=348499&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp Thu Dec  6 
08:55:00 2018
@@ -131,10 +131,7 @@ void PdbIndex::BuildAddrToSymbolMap(Comp
 SegmentOffset so = GetSegmentAndOffset(*iter);
 lldb::addr_t va = MakeVirtualAddress(so);
 
-// We need to add 4 here to adjust for the codeview debug magic
-// at the beginning of the debug info stream.
-uint32_t sym_offset = iter.offset() + 4;
-PdbCompilandSymId cu_sym_id(modi, sym_offset);
+PdbCompilandSymId cu_sym_id(modi, iter.offset());
 
 // If the debug info is incorrect, we could have multiple symbols with the
 // same address.  So use try_emplace instead of insert, and the first one
@@ -201,7 +198,7 @@ CVSymbol PdbIndex::ReadSymbolRecord(PdbC
   // We need to subtract 4 here to adjust for the codeview debug magic
   // at the beginning of the debug info stream.
   const CompilandIndexItem *cci = compilands().GetCompiland(cu_sym.modi);
-  auto iter = cci->m_debug_stream.getSymbolArray().at(cu_sym.offset - 4);
+  auto iter = cci->m_debug_stream.getSymbolArray().at(cu_sym.offset);
   lldbassert(iter != cci->m_debug_stream.getSymbolArray().end());
   return *iter;
 }


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


[Lldb-commits] [PATCH] D55376: Generate LLDB website/documentation from rst with Sphinx

2018-12-06 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: LLDB.
Herald added subscribers: teemperor, arphaman, mgorny.

The current LLDB website is written in HTML which is hard to maintain. We have 
quite a bit of HTML code checked in which can make it hard to differentiate 
between documentation written by us and documentation generated by a tool. 
Furthermore I think text/RST files provide a lower barrier for new or casual 
contributors to fix or update.

In line with the other LLVM projects I propose generating the documentation 
with Sphix. This patch adds a new target `docs-lldb-html` when 
`-DLLVM_ENABLE_SPHINX:BOOL` is set enabled. I've ported over some pages to give 
an idea of what this would look like in-tree. Before continuing with this 
rather tedious work I'd like to get feedback form the community.

Initially I started with the theme used by Clang because it's a default theme 
and doesn't require configuration. If we want to keep the sidebar we could use 
the one used by LLD.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D55376

Files:
  docs/CMakeLists.txt
  docs/conf.py
  docs/index.rst
  docs/resources/test.rst
  docs/status/about.rst
  docs/status/features.rst
  docs/status/goals.rst
  docs/status/projects.rst
  docs/status/status.rst
  docs/use/tutorial.rst

Index: docs/use/tutorial.rst
===
--- /dev/null
+++ docs/use/tutorial.rst
@@ -0,0 +1,673 @@
+Tutorial
+
+
+Here's a short precis of how to run lldb if you are familiar with the gdb
+command set. We will start with some details on lldb command structure and
+syntax to help orient you.
+
+.. contents::
+   :local:
+
+Command Structure
+-
+
+Unlike gdb's command set, which is rather free-form, we tried to make the lldb command syntax fairly structured. The commands are all of the form:
+
+::
+
+ [-options [option-value]] [argument [argument...]]
+
+The command line parsing is done before command execution, so it is uniform
+across all the commands. The command syntax for basic commands is very simple,
+arguments, options and option values are all white-space separated, and
+double-quotes are used to protect white-spaces in an argument. If you need to
+put a backslash or double-quote character in an argument you back-slash it in
+the argument. That makes the command syntax more regular, but it also means you
+may have to quote some arguments in lldb that you wouldn't in gdb.
+
+
+Options can be placed anywhere on the command line, but if the arguments begin
+with a "-" then you have to tell lldb that you're done with options for the
+current command by adding an option termination: "--" So for instance if you
+want to launch a process and give the "process launch" command the
+"--stop-at-entry" option, yet you want the process you are about to launch to
+be launched with the arguments "-program_arg value", you would type:
+
+::
+
+   (lldb) process launch --stop-at-entry -- -program_arg value
+
+We also tried to reduce the number of special purpose argument parsers, which
+sometimes forces the user to be a little more explicit about stating their
+intentions. The first instance you'll note of this is the breakpoint command.
+In gdb, to set a breakpoint, you might enter
+
+::
+
+   (gdb) break foo.c:12
+
+to break at line 12 of foo.c, and:
+
+::
+
+   (gdb) break foo
+
+to break at the function foo. As time went on, the parser that tells foo.c:12
+from foo from foo.c::foo (which means the function foo in the file foo.c) got
+more and more complex and bizarre, and especially in C++ there are times where
+there's really no way to specify the function you want to break on. The lldb
+commands are more verbose but also more precise and allow for intelligent auto
+completion.
+
+To set the same file and line breakpoint in LLDB you can enter either of:
+
+::
+
+   (lldb) breakpoint set --file foo.c --line 12
+   (lldb) breakpoint set -f foo.c -l 12
+
+To set a breakpoint on a function named foo in LLDB you can enter either of:
+
+::
+
+   (lldb) breakpoint set --name foo
+   (lldb) breakpoint set -n foo
+
+You can use the --name option multiple times to make a breakpoint on a set of
+functions as well. This is convenient since it allows you to set common
+conditions or commands without having to specify them multiple times:
+
+::
+
+   (lldb) breakpoint set --name foo --name bar
+
+Setting breakpoints by name is even more specialized in LLDB as you can specify
+that you want to set a breakpoint at a function by method name. To set a
+breakpoint on all C++ methods named foo you can enter either of:
+
+::
+
+   (lldb) breakpoint set --method foo
+   (lldb) breakpoint set -M foo
+
+
+To set a breakpoint Objective-C selectors named alignLeftEdges: you can enter either of:
+
+::
+
+   (lldb) breakpoint set --selector alignLeftEdges:
+   (lldb) breakpoint set -S alignLeftEdges:
+
+You can limit any breakpoints to a specific executable image by u

[Lldb-commits] [PATCH] D55376: Generate LLDB website/documentation from rst with Sphinx

2018-12-06 Thread Bruce Mitchener via Phabricator via lldb-commits
brucem added a comment.

This sounds great to me.

Perhaps it'd be nice if we could use Sphinx instead of epydoc in the future?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55376



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


[Lldb-commits] [lldb] r348502 - Add another ArchSpec unit test.

2018-12-06 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Dec  6 09:11:45 2018
New Revision: 348502

URL: http://llvm.org/viewvc/llvm-project?rev=348502&view=rev
Log:
Add another ArchSpec unit test.

Modified:
lldb/trunk/unittests/Utility/ArchSpecTest.cpp

Modified: lldb/trunk/unittests/Utility/ArchSpecTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ArchSpecTest.cpp?rev=348502&r1=348501&r2=348502&view=diff
==
--- lldb/trunk/unittests/Utility/ArchSpecTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ArchSpecTest.cpp Thu Dec  6 09:11:45 2018
@@ -210,7 +210,7 @@ TEST(ArchSpecTest, Compatibility) {
 ArchSpec B("arm64-apple-ios");
 ASSERT_FALSE(A.IsExactMatch(B));
 // FIXME: This looks unintuitive and we should investigate whether
-// thi is the desired behavior.
+// this is the desired behavior.
 ASSERT_FALSE(A.IsCompatibleMatch(B));
   }
   {
@@ -220,4 +220,11 @@ TEST(ArchSpecTest, Compatibility) {
 // FIXME: See above, though the extra environment complicates things.
 ASSERT_FALSE(A.IsCompatibleMatch(B));
   }
+  {
+ArchSpec A("x86_64");
+ArchSpec B("x86_64-apple-macosx10.14");
+// FIXME: The exact match also looks unintuitive.
+ASSERT_TRUE(A.IsExactMatch(B));
+ASSERT_TRUE(A.IsCompatibleMatch(B));
+  }
 }


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


Re: [Lldb-commits] [PATCH] D54942: [PDB] Make PDB lit tests use the new builder

2018-12-06 Thread Stella Stamenova via lldb-commits
I am in favor of unique filenames because it will guarantee we avoid any 
problems like this in the future, but in most cases, as long as the names are 
unique *in the test suite*, that should be sufficient. So I don’t have any 
objections to Zachary’s approach of making the filenames unique enough.

Thanks,
-Stella

From: Aleksandr Urakov 
Sent: Thursday, December 6, 2018 12:25 AM
To: Zachary Turner 
Cc: reviews+d54942+public+2603ca548f36d...@reviews.llvm.org; Stella Stamenova 
; llvm-comm...@lists.llvm.org; Hafiz Abid Qadeer 
; Raphael Isemann ; 
lldb-commits@lists.llvm.org; sani...@subpath.org; chi...@raincode.com; Brian 
Gianforcaro 
Subject: Re: [PATCH] D54942: [PDB] Make PDB lit tests use the new builder

Yes, this solution would solve the current problem. But theoretically the 
uniqueness may be defined by the directory, where the file is located, not by 
the name. It looks very unlikely, but who knows...

I thought about what Stella have said, and it seems that I have found a good 
solution for this. We can use something like `tempfile` 
(https://docs.python.org/3.7/library/tempfile.html)
 for every internally generated file of the script. It will guarantee us the 
uniqueness of the file. But for the uniqueness of files named by script 
parameters the script user will remain responsible.

What do you think about the such approach?

On Wed, Dec 5, 2018 at 11:55 PM Zachary Turner 
mailto:ztur...@google.com>> wrote:
I was thinking that we could just automatically compute the output file names 
as:

os.path.join(out_dir, basename(output_file) + '.' + basename(input_file) + 
'.obj')

Currently it's just

os.path.join(out_dir, basename(input_file) + '.obj')

which is why I think the problem occurs.

On Wed, Dec 5, 2018 at 12:47 PM Aleksandr Urakov 
mailto:aleksandr.ura...@jetbrains.com>> wrote:
With such solution there would be even no need to change the current commit. 
But I'm not sure that it's trivial to do - the output file name may contain 
path with directories. May be we can replace slashes with underscores in the 
output file path and concatenate it with the object file name? Or even replace 
slashes in the source file path and concatenate it with the output file path - 
so object files will be located in the same place as the output file.
Am Mi., 5. Dez. 2018, 23:30 hat Zachary Turner 
mailto:ztur...@google.com>> geschrieben:
It is not possible to specify object file name in compile and link mode. But 
perhaps we can just change the default object file name to include something 
from the output file as well
On Wed, Dec 5, 2018 at 12:26 PM Aleksandr Urakov via Phabricator 
mailto:revi...@reviews.llvm.org>> wrote:
aleksandr.urakov added a subscriber: zturner.
aleksandr.urakov added a comment.

The similar problem with `typedefs.test` is here: 
http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1940/steps/test/logs/stdio

I have an assumption about the cause of the problem. Are the tests running in 
parallel? In this case `typedefs.test` and `enums-layout.test` are writing to 
the same object file together, because they both are compiled from the same 
source.

@zturner Is it possible to specify object file's name in `compile-and-link` 
mode? Then we can specify different names in different tests for both object 
files and executables. But I think that splitting the source or combining the 
tests would be a better idea.

I will fix it only tomorrow, because I'm already at home today. Feel free to 
revert it if needed.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54942




--
Aleksandr Urakov
Software Developer
JetBrains
http://www.jetbrains.com

[Lldb-commits] [PATCH] D55332: [CMake] Python bindings generation polishing

2018-12-06 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added inline comments.



Comment at: CMakeLists.txt:134
--srcRoot=${LLDB_SOURCE_DIR}
-   --targetDir=${LLDB_PYTHON_TARGET_DIR}
-   --cfgBldDir=${LLDB_PYTHON_TARGET_DIR}
+   --targetDir=$
+   --cfgBldDir=$

I have a vague recollection that using TARGET_PROPERTY didn't work for some 
changes I was working on a few months ago, but I don't remember the details. It 
would be good to make sure that this works on mac, linux and windows all before 
you commit.


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

https://reviews.llvm.org/D55332



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


[Lldb-commits] [PATCH] D55328: [CMake] Revised LLDB.framework builds

2018-12-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 176998.
sgraenitz added a comment.

Copy Clang headers to LLDB.framework without an intermediate staging directory. 
This approach seems much simpler and it avoids errors from an ordering issue at 
configuration time (preventing Clang headers from being copied to the staging 
directory).


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

https://reviews.llvm.org/D55328

Files:
  CMakeLists.txt
  cmake/modules/AddLLDB.cmake
  cmake/modules/LLDBConfig.cmake
  cmake/modules/LLDBFramework.cmake
  resources/LLDB-Info.plist.in
  source/API/CMakeLists.txt
  test/CMakeLists.txt
  tools/argdumper/CMakeLists.txt
  tools/darwin-debug/CMakeLists.txt
  tools/debugserver/CMakeLists.txt
  tools/debugserver/source/CMakeLists.txt
  tools/driver/CMakeLists.txt
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -42,7 +42,7 @@
   list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF)
 endif()
 
-add_lldb_tool(lldb-server INCLUDE_IN_SUITE
+add_lldb_tool(lldb-server
 Acceptor.cpp
 lldb-gdbserver.cpp
 lldb-platform.cpp
Index: tools/driver/CMakeLists.txt
===
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -19,7 +19,6 @@
 endif()
 
 add_dependencies(lldb
-  ${LLDB_SUITE_TARGET}
   LLDBOptionsTableGen
   ${tablegen_deps}
 )
Index: tools/debugserver/source/CMakeLists.txt
===
--- tools/debugserver/source/CMakeLists.txt
+++ tools/debugserver/source/CMakeLists.txt
@@ -240,7 +240,7 @@
  COMPILE_DEFINITIONS HAVE_LIBCOMPRESSION)
   endif()
   set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources})
-  add_lldb_tool(debugserver INCLUDE_IN_SUITE
+  add_lldb_tool(debugserver
 debugserver.cpp
 
 LINK_LIBS
Index: tools/debugserver/CMakeLists.txt
===
--- tools/debugserver/CMakeLists.txt
+++ tools/debugserver/CMakeLists.txt
@@ -15,11 +15,6 @@
 
   set(LLDB_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../")
   include_directories(${LLDB_SOURCE_DIR}/include)
-
-  # lldb-suite is a dummy target that encompasses all the necessary tools and
-  # libraries for building a fully-functioning liblldb.
-  add_custom_target(lldb-suite)
-  set(LLDB_SUITE_TARGET lldb-suite)
 endif()
 
 add_subdirectory(source)
Index: tools/darwin-debug/CMakeLists.txt
===
--- tools/darwin-debug/CMakeLists.txt
+++ tools/darwin-debug/CMakeLists.txt
@@ -1,3 +1,3 @@
-add_lldb_tool(darwin-debug INCLUDE_IN_SUITE
+add_lldb_tool(darwin-debug
   darwin-debug.cpp
   )
Index: tools/argdumper/CMakeLists.txt
===
--- tools/argdumper/CMakeLists.txt
+++ tools/argdumper/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_tool(lldb-argdumper INCLUDE_IN_SUITE
+add_lldb_tool(lldb-argdumper
   argdumper.cpp
 
   LINK_LIBS
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -79,7 +79,13 @@
 endif()
 
 if(LLDB_BUILD_FRAMEWORK)
-  list(APPEND LLDB_TEST_COMMON_ARGS --framework ${LLDB_FRAMEWORK_DIR}/LLDB.framework)
+  # The $ generator expression
+  # provides this value, but LLDB_DOTEST_ARGS needs it at configuration-time.
+  get_filename_component(
+framework_target_dir ${LLDB_FRAMEWORK_BUILD_DIR} ABSOLUTE
+BASE_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}
+  )
+  list(APPEND LLDB_TEST_COMMON_ARGS --framework ${framework_target_dir}/LLDB.framework)
 endif()
 
 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
Index: source/API/CMakeLists.txt
===
--- source/API/CMakeLists.txt
+++ source/API/CMakeLists.txt
@@ -92,24 +92,25 @@
 Support
   )
 
-add_dependencies(lldb-suite liblldb)
+if(LLDB_WRAP_PYTHON)
+  add_dependencies(liblldb swig_wrapper)
 
-if (MSVC)
-  set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
-else()
-  set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
-endif()
+  if (MSVC)
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
+  else()
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
+  endif()
 
-set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
-if (CLANG_CL)
-  set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
-PROPERTY COMPILE_FLAGS " -Wno-unused-function")
+  if (CLANG_CL)
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
+  PROPERTY COMPILE_FLAGS " -Wno-unused-function")
+  endif()
+  if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
+  NOT "${CMAKE_SYSTEM_NAME}" MA

[Lldb-commits] [lldb] r348505 - [PDB] Move some code around. NFC.

2018-12-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Dec  6 09:49:15 2018
New Revision: 348505

URL: http://llvm.org/viewvc/llvm-project?rev=348505&view=rev
Log:
[PDB] Move some code around.  NFC.

Added:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.h
Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt?rev=348505&r1=348504&r2=348505&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/CMakeLists.txt Thu Dec  6 
09:49:15 2018
@@ -1,5 +1,6 @@
 add_lldb_library(lldbPluginSymbolFileNativePDB PLUGIN
   CompileUnitIndex.cpp
+  DWARFLocationExpression.cpp
   PdbIndex.cpp
   PdbSymUid.cpp
   PdbUtil.cpp

Added: 
lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp?rev=348505&view=auto
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp 
(added)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp 
Thu Dec  6 09:49:15 2018
@@ -0,0 +1,170 @@
+//===-- DWARFLocationExpression.cpp -*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "DWARFLocationExpression.h"
+
+#include "lldb/Core/Module.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Core/StreamBuffer.h"
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
+#include "llvm/DebugInfo/PDB/Native/TpiStream.h"
+#include "llvm/Support/Endian.h"
+
+#include "PdbUtil.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::npdb;
+using namespace llvm::codeview;
+using namespace llvm::pdb;
+
+static bool IsSimpleTypeSignedInteger(SimpleTypeKind kind) {
+  switch (kind) {
+  case SimpleTypeKind::Int128:
+  case SimpleTypeKind::Int64:
+  case SimpleTypeKind::Int64Quad:
+  case SimpleTypeKind::Int32:
+  case SimpleTypeKind::Int32Long:
+  case SimpleTypeKind::Int16:
+  case SimpleTypeKind::Int16Short:
+  case SimpleTypeKind::Float128:
+  case SimpleTypeKind::Float80:
+  case SimpleTypeKind::Float64:
+  case SimpleTypeKind::Float32:
+  case SimpleTypeKind::Float16:
+  case SimpleTypeKind::NarrowCharacter:
+  case SimpleTypeKind::SignedCharacter:
+  case SimpleTypeKind::SByte:
+return true;
+  default:
+return false;
+  }
+}
+
+static std::pair GetIntegralTypeInfo(TypeIndex ti,
+   TpiStream &tpi) {
+  if (ti.isSimple()) {
+SimpleTypeKind stk = ti.getSimpleKind();
+return {GetTypeSizeForSimpleKind(stk), IsSimpleTypeSignedInteger(stk)};
+  }
+
+  CVType cvt = tpi.getType(ti);
+  switch (cvt.kind()) {
+  case LF_MODIFIER: {
+ModifierRecord mfr;
+llvm::cantFail(TypeDeserializer::deserializeAs(cvt, mfr));
+return GetIntegralTypeInfo(mfr.ModifiedType, tpi);
+  }
+  case LF_POINTER: {
+PointerRecord pr;
+llvm::cantFail(TypeDeserializer::deserializeAs(cvt, pr));
+return GetIntegralTypeInfo(pr.ReferentType, tpi);
+  }
+  case LF_ENUM: {
+EnumRecord er;
+llvm::cantFail(TypeDeserializer::deserializeAs(cvt, er));
+return GetIntegralTypeInfo(er.UnderlyingType, tpi);
+  }
+  default:
+assert(false && "Type is not integral!");
+return {0, false};
+  }
+}
+
+template 
+static DWARFExpression MakeLocationExpressionInternal(lldb::ModuleSP module,
+  StreamWriter &&writer) {
+  const ArchSpec &architecture = module->GetArchitecture();
+  ByteOrder byte_order = architecture.GetByteOrder();
+  uint32_t address_size = architecture.GetAddressByteSize();
+  uint32_t byte_size = architecture.GetDataByteSize();
+  if (byte_order == eByteOrderInvalid || address_size == 0)
+return DWARFExpression(nullptr);
+
+  RegisterKind register_kind = eRegisterKindDWARF;
+  StreamBuffer<32> stream(Stream::eBinary, address_size, byte_order);
+
+  if 

[Lldb-commits] [PATCH] D55361: Move Broadcaster+Listener+Event combo from Core into Utility

2018-12-06 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

LGTM modulo the unrelated clang-format changes. Feel free to commit them 
separately (even though the `m_event_names` fix looks a bit strange).




Comment at: include/lldb/Utility/Broadcaster.h:551
 
-Broadcaster &m_broadcaster;///< The broadcaster that this implements
-event_names_map m_event_names; ///< Optionally define event names for

What was changed here? I assume clang-format fallout, so can we drop this?



Comment at: source/Utility/Broadcaster.cpp:229
-if (unique &&
-hijacking_listener_sp->PeekAtNextEventForBroadcasterWithType(
-&m_broadcaster, event_type))

Also unrelated.



Comment at: source/Utility/Broadcaster.cpp:239
-  pair.first->PeekAtNextEventForBroadcasterWithType(&m_broadcaster,
-event_type))
 continue;

Also unrelated.



Comment at: source/Utility/Event.cpp:139
   else
-s->Format("{0:$[ ]@[x-2]}", llvm::make_range(
- reinterpret_cast(m_bytes.data()),

Also unrelated it seems.


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

https://reviews.llvm.org/D55361



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


[Lldb-commits] [PATCH] D55328: [CMake] Revised LLDB.framework builds

2018-12-06 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 177003.
sgraenitz marked an inline comment as not done.
sgraenitz added a comment.

LLDB.framework requires an in-tree build


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

https://reviews.llvm.org/D55328

Files:
  CMakeLists.txt
  cmake/modules/AddLLDB.cmake
  cmake/modules/LLDBConfig.cmake
  cmake/modules/LLDBFramework.cmake
  resources/LLDB-Info.plist.in
  source/API/CMakeLists.txt
  test/CMakeLists.txt
  tools/argdumper/CMakeLists.txt
  tools/darwin-debug/CMakeLists.txt
  tools/debugserver/CMakeLists.txt
  tools/debugserver/source/CMakeLists.txt
  tools/driver/CMakeLists.txt
  tools/lldb-server/CMakeLists.txt

Index: tools/lldb-server/CMakeLists.txt
===
--- tools/lldb-server/CMakeLists.txt
+++ tools/lldb-server/CMakeLists.txt
@@ -42,7 +42,7 @@
   list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF)
 endif()
 
-add_lldb_tool(lldb-server INCLUDE_IN_SUITE
+add_lldb_tool(lldb-server
 Acceptor.cpp
 lldb-gdbserver.cpp
 lldb-platform.cpp
Index: tools/driver/CMakeLists.txt
===
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -19,7 +19,6 @@
 endif()
 
 add_dependencies(lldb
-  ${LLDB_SUITE_TARGET}
   LLDBOptionsTableGen
   ${tablegen_deps}
 )
Index: tools/debugserver/source/CMakeLists.txt
===
--- tools/debugserver/source/CMakeLists.txt
+++ tools/debugserver/source/CMakeLists.txt
@@ -240,7 +240,7 @@
  COMPILE_DEFINITIONS HAVE_LIBCOMPRESSION)
   endif()
   set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources})
-  add_lldb_tool(debugserver INCLUDE_IN_SUITE
+  add_lldb_tool(debugserver
 debugserver.cpp
 
 LINK_LIBS
Index: tools/debugserver/CMakeLists.txt
===
--- tools/debugserver/CMakeLists.txt
+++ tools/debugserver/CMakeLists.txt
@@ -15,11 +15,6 @@
 
   set(LLDB_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../")
   include_directories(${LLDB_SOURCE_DIR}/include)
-
-  # lldb-suite is a dummy target that encompasses all the necessary tools and
-  # libraries for building a fully-functioning liblldb.
-  add_custom_target(lldb-suite)
-  set(LLDB_SUITE_TARGET lldb-suite)
 endif()
 
 add_subdirectory(source)
Index: tools/darwin-debug/CMakeLists.txt
===
--- tools/darwin-debug/CMakeLists.txt
+++ tools/darwin-debug/CMakeLists.txt
@@ -1,3 +1,3 @@
-add_lldb_tool(darwin-debug INCLUDE_IN_SUITE
+add_lldb_tool(darwin-debug
   darwin-debug.cpp
   )
Index: tools/argdumper/CMakeLists.txt
===
--- tools/argdumper/CMakeLists.txt
+++ tools/argdumper/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_tool(lldb-argdumper INCLUDE_IN_SUITE
+add_lldb_tool(lldb-argdumper
   argdumper.cpp
 
   LINK_LIBS
Index: test/CMakeLists.txt
===
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -79,7 +79,13 @@
 endif()
 
 if(LLDB_BUILD_FRAMEWORK)
-  list(APPEND LLDB_TEST_COMMON_ARGS --framework ${LLDB_FRAMEWORK_DIR}/LLDB.framework)
+  # The $ generator expression
+  # provides this value, but LLDB_DOTEST_ARGS needs it at configuration-time.
+  get_filename_component(
+framework_target_dir ${LLDB_FRAMEWORK_BUILD_DIR} ABSOLUTE
+BASE_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}
+  )
+  list(APPEND LLDB_TEST_COMMON_ARGS --framework ${framework_target_dir}/LLDB.framework)
 endif()
 
 if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
Index: source/API/CMakeLists.txt
===
--- source/API/CMakeLists.txt
+++ source/API/CMakeLists.txt
@@ -92,24 +92,25 @@
 Support
   )
 
-add_dependencies(lldb-suite liblldb)
+if(LLDB_WRAP_PYTHON)
+  add_dependencies(liblldb swig_wrapper)
 
-if (MSVC)
-  set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
-else()
-  set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
-endif()
+  if (MSVC)
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
+  else()
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
+  endif()
 
-set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
-if (CLANG_CL)
-  set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
-PROPERTY COMPILE_FLAGS " -Wno-unused-function")
+  if (CLANG_CL)
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
+  PROPERTY COMPILE_FLAGS " -Wno-unused-function")
+  endif()
+  if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
+  NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
+set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
+  PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
+  endif ()
 endif()

[Lldb-commits] [lldb] r348511 - [build.py] Embed the output file name in generated object file names.

2018-12-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Dec  6 10:39:58 2018
New Revision: 348511

URL: http://llvm.org/viewvc/llvm-project?rev=348511&view=rev
Log:
[build.py] Embed the output file name in generated object file names.

In compile-and-link mode, the user doesn't specify the name of the
object files to generate, because there could be multiple inputs
on a single command line and this would be hard to specify.  So the
script just tries to be smart and figure out the best object file
names.  However, if two build scripts are running in parallel and
using the same source files as input, they would previously race
to write the same object files, since the computed name only considered
the source file names when computing the object file names.

With this patch, we also consider the final executable name.  In a
way, this "namespaces" the generated object files so that as long
as the final executable file names don't clash, the intermediate
object file names won't clash either.

Modified:
lldb/trunk/lit/BuildScript/modes.test
lldb/trunk/lit/BuildScript/toolchain-clang-cl.test
lldb/trunk/lit/BuildScript/toolchain-msvc.test
lldb/trunk/lit/helper/build.py

Modified: lldb/trunk/lit/BuildScript/modes.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/BuildScript/modes.test?rev=348511&r1=348510&r2=348511&view=diff
==
--- lldb/trunk/lit/BuildScript/modes.test (original)
+++ lldb/trunk/lit/BuildScript/modes.test Thu Dec  6 10:39:58 2018
@@ -29,9 +29,9 @@ LINK: linking foobar.obj -> foo.exe
 
 LINK-MULTI: linking foo.obj+bar.obj -> foobar.exe
 
-BOTH: compiling foobar.c -> foobar.obj
-BOTH: linking foobar.obj -> foobar.exe
+BOTH: compiling foobar.c -> foobar.exe-foobar.obj
+BOTH: linking foobar.exe-foobar.obj -> foobar.exe
 
-BOTH-MULTI: compiling foo.c -> foo.obj
-BOTH-MULTI: compiling bar.c -> bar.obj
-BOTH-MULTI: linking foo.obj+bar.obj -> foobar.exe
+BOTH-MULTI: compiling foo.c -> foobar.exe-foo.obj
+BOTH-MULTI: compiling bar.c -> foobar.exe-bar.obj
+BOTH-MULTI: linking foobar.exe-foo.obj+foobar.exe-bar.obj -> foobar.exe

Modified: lldb/trunk/lit/BuildScript/toolchain-clang-cl.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/BuildScript/toolchain-clang-cl.test?rev=348511&r1=348510&r2=348511&view=diff
==
--- lldb/trunk/lit/BuildScript/toolchain-clang-cl.test (original)
+++ lldb/trunk/lit/BuildScript/toolchain-clang-cl.test Thu Dec  6 10:39:58 2018
@@ -19,12 +19,12 @@ CHECK-32:   Verbose: True
 CHECK-32:   Dryrun: True
 CHECK-32:   Inputs: foobar.c
 CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.ilk
-CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.obj
+CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
 CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
 CHECK-32: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
-CHECK-32: compiling foobar.c -> foobar.obj
+CHECK-32: compiling foobar.c -> foo.exe-foobar.obj
 CHECK-32: {{.*}}clang-cl{{(.exe)?}} -m32
-CHECK-32: linking foobar.obj -> foo.exe
+CHECK-32: linking foo.exe-foobar.obj -> foo.exe
 CHECK-32: {{.*}}lld-link
 
 CHECK-64: Script Arguments:
@@ -40,10 +40,10 @@ CHECK-64:   Verbose: True
 CHECK-64:   Dryrun: True
 CHECK-64:   Inputs: foobar.c
 CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.ilk
-CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foobar.obj
+CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe-foobar.obj
 CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.pdb
 CHECK-64: Cleaning {{.*}}toolchain-clang-cl.test.tmp{{.}}foo.exe
-CHECK-64: compiling foobar.c -> foobar.obj
+CHECK-64: compiling foobar.c -> foo.exe-foobar.obj
 CHECK-64: {{.*}}clang-cl{{(.exe)?}} -m64
-CHECK-64: linking foobar.obj -> foo.exe
+CHECK-64: linking foo.exe-foobar.obj -> foo.exe
 CHECK-64: {{.*}}lld-link{{(.exe)?}}

Modified: lldb/trunk/lit/BuildScript/toolchain-msvc.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/BuildScript/toolchain-msvc.test?rev=348511&r1=348510&r2=348511&view=diff
==
--- lldb/trunk/lit/BuildScript/toolchain-msvc.test (original)
+++ lldb/trunk/lit/BuildScript/toolchain-msvc.test Thu Dec  6 10:39:58 2018
@@ -19,12 +19,12 @@ X86:   Verbose: True
 X86:   Dryrun: True
 X86:   Inputs: foobar.c
 X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foobar.ilk
-X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foobar.obj
+X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe-foobar.obj
 X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.pdb
 X86: Cleaning {{.*}}toolchain-msvc.test.tmp\foo.exe
-X86: compiling foobar.c -> foobar.obj
+X86: compiling foobar.c -> foo.exe-foobar.obj
 X86:   Command Line: {{.*}}\{{[Hh]ost[Xx]64}}\x86\cl.exe
-X86: linking foobar.obj -> foo.exe
+X86: linking foo.exe-foobar.obj -> foo.ex

Re: [Lldb-commits] [PATCH] D54942: [PDB] Make PDB lit tests use the new builder

2018-12-06 Thread Zachary Turner via lldb-commits
Hopefully fixed in r348511.  I went with the approach of concatenating the
executable file name, for two reasons.  First, it's easier, since dealing
with the tmpfile module and mkstemp and sorts has its own set of
complexities and issues.  Secondly, because it means the build artifacts
will still be in a normal place (instead of in temporary directory) and
with an intuitive name.  So this means if a test failed it might be easier
for a developer to inspect the build artifacts to try to determine what
went wrong.

On Thu, Dec 6, 2018 at 9:22 AM Stella Stamenova 
wrote:

> I am in favor of unique filenames because it will guarantee we avoid any
> problems like this in the future, but in most cases, as long as the names
> are unique **in the test suite**, that should be sufficient. So I don’t
> have any objections to Zachary’s approach of making the filenames unique
> enough.
>
>
>
> Thanks,
>
> -Stella
>
>
>
> *From:* Aleksandr Urakov 
> *Sent:* Thursday, December 6, 2018 12:25 AM
> *To:* Zachary Turner 
> *Cc:* reviews+d54942+public+2603ca548f36d...@reviews.llvm.org; Stella
> Stamenova ; llvm-comm...@lists.llvm.org; Hafiz Abid
> Qadeer ; Raphael Isemann ;
> lldb-commits@lists.llvm.org; sani...@subpath.org; chi...@raincode.com;
> Brian Gianforcaro 
>
>
> *Subject:* Re: [PATCH] D54942: [PDB] Make PDB lit tests use the new
> builder
>
>
>
> Yes, this solution would solve the current problem. But theoretically the
> uniqueness may be defined by the directory, where the file is located, not
> by the name. It looks very unlikely, but who knows...
>
>
>
> I thought about what Stella have said, and it seems that I have found a
> good solution for this. We can use something like `tempfile` (
> https://docs.python.org/3.7/library/tempfile.html
> )
> for every internally generated file of the script. It will guarantee us the
> uniqueness of the file. But for the uniqueness of files named by script
> parameters the script user will remain responsible.
>
>
>
> What do you think about the such approach?
>
>
>
> On Wed, Dec 5, 2018 at 11:55 PM Zachary Turner  wrote:
>
> I was thinking that we could just automatically compute the output file
> names as:
>
>
>
> os.path.join(out_dir, basename(output_file) + '.' + basename(input_file) +
> '.obj')
>
>
>
> Currently it's just
>
>
>
> os.path.join(out_dir, basename(input_file) + '.obj')
>
>
>
> which is why I think the problem occurs.
>
>
>
> On Wed, Dec 5, 2018 at 12:47 PM Aleksandr Urakov <
> aleksandr.ura...@jetbrains.com> wrote:
>
> With such solution there would be even no need to change the current
> commit. But I'm not sure that it's trivial to do - the output file name may
> contain path with directories. May be we can replace slashes with
> underscores in the output file path and concatenate it with the object file
> name? Or even replace slashes in the source file path and concatenate it
> with the output file path - so object files will be located in the same
> place as the output file.
>
> Am Mi., 5. Dez. 2018, 23:30 hat Zachary Turner 
> geschrieben:
>
> It is not possible to specify object file name in compile and link mode.
> But perhaps we can just change the default object file name to include
> something from the output file as well
>
> On Wed, Dec 5, 2018 at 12:26 PM Aleksandr Urakov via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
> aleksandr.urakov added a subscriber: zturner.
> aleksandr.urakov added a comment.
>
> The similar problem with `typedefs.test` is here:
> http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1940/steps/test/logs/stdio
> 
>
> I have an assumption about the cause of the problem. Are the tests running
> in parallel? In this case `typedefs.test` and `enums-layout.test` are
> writing to the same object file together, because they both are compiled
> from the same source.
>
> @zturner Is it possible to specify object file's name in
> `compile-and-link` mode? Then we can specify different names in different
> tests for both object files and executables. But I think that splitting the
> source or combining the tests would be a better idea.
>
> I will fix it only tomorrow, because I'm already at home today. Feel free
> to revert it if needed.
>
>
> Repository:
>   rL LLVM
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D54942/new/
> 

[Lldb-commits] [lldb] r348514 - Fix line endings in build.py

2018-12-06 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Dec  6 10:45:07 2018
New Revision: 348514

URL: http://llvm.org/viewvc/llvm-project?rev=348514&view=rev
Log:
Fix line endings in build.py

Modified:
lldb/trunk/lit/helper/build.py

Modified: lldb/trunk/lit/helper/build.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/helper/build.py?rev=348514&r1=348513&r2=348514&view=diff
==
--- lldb/trunk/lit/helper/build.py (original)
+++ lldb/trunk/lit/helper/build.py Thu Dec  6 10:45:07 2018
@@ -506,7 +506,7 @@ class MsvcBuilder(Builder):
 return self.inputs
 
 if self.mode == 'compile-and-link':
-# Object file names should factor in both the input file (source)
+# Object file names should factor in both the input file (source)
 # name and output file (executable) name, to ensure that two tests
 # which share a common source file don't race to write the same
 # object file.


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


[Lldb-commits] [PATCH] D55356: Add a method to get the "base" file address of an object file

2018-12-06 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth accepted this revision.
amccarth added a comment.
This revision is now accepted and ready to land.

LGTM.




Comment at: lit/Modules/MachO/basic-info.yaml:10
+# CHECK: Strata: user
+# CHECK: Base VM address: 0x1
+

Just so I understand, this 0x1000 is supposed to correspond to the vmaddr 
of the TEXT section, right?  There are a few other vmaddrs and addrs in the 
YAML that correspond to other addresses.


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

https://reviews.llvm.org/D55356



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


[Lldb-commits] [lldb] r348519 - Fix the Xcode project build for the addition of NativePDB/DWARFLocationExpression.{h, cpp}

2018-12-06 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Dec  6 11:23:21 2018
New Revision: 348519

URL: http://llvm.org/viewvc/llvm-project?rev=348519&view=rev
Log:
Fix the Xcode project build for the addition of 
NativePDB/DWARFLocationExpression.{h,cpp}

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

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=348519&r1=348518&r2=348519&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Dec  6 11:23:21 2018
@@ -248,6 +248,7 @@
2689006613353E0E00698AC0 /* DWARFExpression.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26BC7ED810F1B86700F91463 /* DWARFExpression.cpp 
*/; };
268900C613353E5F00698AC0 /* DWARFFormValue.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 260C89D310F57C5600BB2B04 /* DWARFFormValue.cpp 
*/; };
4CD44CFB20B37C440003557C /* DWARFIndex.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 4CD44CF820B37C440003557C /* DWARFIndex.cpp */; };
+   4C38996421B9AECD002BAEF4 /* DWARFLocationExpression.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 4C38996221B9AECC002BAEF4 /* 
DWARFLocationExpression.cpp */; };
AFE228832060699D0042D0C8 /* DWARFUnit.cpp in Sources */ = {isa 
= PBXBuildFile; fileRef = 7F2AAA5920601BE000A422D8 /* DWARFUnit.cpp */; };
26FFC19B14FC072100087D58 /* DYLDRendezvous.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 26FFC19514FC072100087D58 /* DYLDRendezvous.cpp 
*/; };
49CA96FC1E6AACC900C03FEE /* DataBufferHeap.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 49CA96E61E6AAC6600C03FEE /* DataBufferHeap.cpp 
*/; };
@@ -1734,6 +1735,8 @@
260C89D410F57C5600BB2B04 /* DWARFFormValue.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
DWARFFormValue.h; sourceTree = ""; };
4CD44CF820B37C440003557C /* DWARFIndex.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DWARFIndex.cpp; sourceTree = ""; };
4CD44CFE20B37C570003557C /* DWARFIndex.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DWARFIndex.h; 
sourceTree = ""; };
+   4C38996221B9AECC002BAEF4 /* DWARFLocationExpression.cpp */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.cpp.cpp; name = DWARFLocationExpression.cpp; path = 
source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp; sourceTree = 
SOURCE_ROOT; };
+   4C38996321B9AECC002BAEF4 /* DWARFLocationExpression.h */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name 
= DWARFLocationExpression.h; path = 
source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.h; sourceTree = 
SOURCE_ROOT; };
7F2AAA5920601BE000A422D8 /* DWARFUnit.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DWARFUnit.cpp; sourceTree = ""; };
7F2AAA5820601BDF00A422D8 /* DWARFUnit.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
DWARFUnit.h; sourceTree = ""; };
26FFC19514FC072100087D58 /* DYLDRendezvous.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DYLDRendezvous.cpp; sourceTree = ""; };
@@ -6778,6 +6781,8 @@
children = (
AFD966B4217140B5006714AC /* 
CompileUnitIndex.cpp */,
AFD966BD217140C8006714AC /* CompileUnitIndex.h 
*/,
+   4C38996221B9AECC002BAEF4 /* 
DWARFLocationExpression.cpp */,
+   4C38996321B9AECC002BAEF4 /* 
DWARFLocationExpression.h */,
AFD966B6217140B6006714AC /* PdbIndex.cpp */,
AFD966BF217140C8006714AC /* PdbIndex.h */,
AF0F459D219FA1C800C1E612 /* PdbSymUid.cpp */,
@@ -8253,6 +8258,7 @@
2642FBB213D003B400ED6808 /* ProcessKDPLog.cpp 
in Sources */,
263641191B34AEE200145B2F /* ABISysV_mips64.cpp 
in Sources */,
26957D9813D381C900670048 /* 
RegisterContextDarwin_arm.cpp in Sources */,
+   4C38996421B9AECD002BAEF4 /* 
DWARFLocationExpression.cpp in Sources */,
26957D9A13D381C900670048 /* 
RegisterContextDarwin_i386.cpp in Sources */,
26957D9C13D381C900670048 /* 
RegisterContextDarwin_x86_64.cpp in Sources */,
94CD7D0919A3FBA300908B7C /* 
AppleObjCClassDescriptorV2.cpp in Sources */,



[Lldb-commits] [PATCH] D55356: Add a method to get the "base" file address of an object file

2018-12-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

This is already available with:

  virtual lldb_private::Address ObjectFile::GetHeaderAddress(); 

It return a lldb_private::Address which is section offset, but nothing stopping 
us from returning a lldb_private::Address with no section and just the file 
address. For mach-o the mach header is in the __TEXT segment, but not true for 
other file formats. I am ok if we need to rename "GetHeaderAddress()" to 
something else.


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

https://reviews.llvm.org/D55356



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


[Lldb-commits] [PATCH] D55356: Add a method to get the "base" file address of an object file

2018-12-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Marked as requesting changes in case "GetBaseFileAddress() == 
GetHeaderAddress().GetFileAddress()" in all cases. If the base file address 
differs from where the object file header is located, then this change would 
work. Else we should use GetHeaderAddress() and possibly rename it if we want to


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

https://reviews.llvm.org/D55356



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


[Lldb-commits] [PATCH] D55384: [NativePDB] Reconstruct FunctionDecl AST nodes from PDB debug info

2018-12-06 Thread Zachary Turner via Phabricator via lldb-commits
zturner created this revision.
zturner added reviewers: aleksandr.urakov, amccarth, labath, lemo.
Herald added subscribers: hiraditya, aprantl.

Previously we would create an `lldb::Function` object for each function parsed, 
but we would not add these to the clang AST.  This is a first step towards 
getting local variable support working, as we first need an AST decl so that 
when we create local variable entries, they have the proper `DeclContext`.


https://reviews.llvm.org/D55384

Files:
  lldb/lit/SymbolFile/NativePDB/Inputs/ast-functions.lldbinit
  lldb/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit
  lldb/lit/SymbolFile/NativePDB/Inputs/ast-types.lldbinit
  lldb/lit/SymbolFile/NativePDB/ast-functions.cpp
  lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
  lldb/lit/SymbolFile/NativePDB/ast-types.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  llvm/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
  llvm/include/llvm/Support/BinaryStreamArray.h
  llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp

Index: llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
===
--- llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
+++ llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
@@ -50,4 +50,15 @@
 assert(false && "Unknown record type");
 return 0;
   }
-}
\ No newline at end of file
+}
+
+CVSymbolArray
+llvm::codeview::limitSymbolArrayToScope(const CVSymbolArray &Symbols,
+uint32_t ScopeBegin) {
+  CVSymbol Opener = *Symbols.at(ScopeBegin);
+  assert(symbolOpensScope(Opener.kind()));
+  uint32_t EndOffset = getScopeEndOffset(Opener);
+  CVSymbol Closer = *Symbols.at(EndOffset);
+  EndOffset += Closer.RecordData.size();
+  return Symbols.substream(ScopeBegin, EndOffset);
+}
Index: llvm/include/llvm/Support/BinaryStreamArray.h
===
--- llvm/include/llvm/Support/BinaryStreamArray.h
+++ llvm/include/llvm/Support/BinaryStreamArray.h
@@ -113,6 +113,15 @@
 
   bool empty() const { return Stream.getLength() == 0; }
 
+  VarStreamArray substream(uint32_t Begin,
+ uint32_t End) const {
+assert(Begin >= Skew);
+// We should never cut off the beginning of the stream since it might be
+// skewed, meaning the initial bytes are important.
+BinaryStreamRef NewStream = Stream.slice(0, End);
+return {NewStream, E, Begin};
+  }
+
   /// given an offset into the array's underlying stream, return an
   /// iterator to the record at that offset.  This is considered unsafe
   /// since the behavior is undefined if \p Offset does not refer to the
Index: llvm/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
===
--- llvm/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
+++ llvm/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
@@ -50,7 +50,11 @@
 
 /// Given a symbol P for which symbolOpensScope(P) == true, return the
 /// corresponding end offset.
-uint32_t getScopeEndOffset(const CVSymbol &symbol);
+uint32_t getScopeEndOffset(const CVSymbol &Symbol);
+
+CVSymbolArray limitSymbolArrayToScope(const CVSymbolArray &Symbols,
+  uint32_t ScopeBegin);
+
 } // namespace codeview
 } // namespace llvm
 
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -37,6 +37,7 @@
 #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
 #include "llvm/DebugInfo/CodeView/RecordName.h"
 #include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecordHelpers.h"
 #include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
 #include "llvm/DebugInfo/PDB/Native/DbiStream.h"
 #include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
@@ -538,16 +539,97 @@
   if (!func_range.GetBaseAddress().IsValid())
 return nullptr;
 
-  Type *func_type = nullptr;
+  ProcSym proc(static_cast(sym_record.kind()));
+  cantFail(SymbolDeserializer::deserializeAs(sym_record, proc));
+  TypeSP func_type = GetOrCreateType(proc.FunctionType);
 
-  // FIXME: Resolve types and mangled names.
-  PdbTypeSymId sig_id(TypeIndex::None(), false);
-  Mangled mangled(getSymbolName(sym_record));
+  PdbTypeSymId sig_id(proc.FunctionType, false);
+  Mangled mangled(proc.Name);
   FunctionSP func_sp = std::make_shared(
   sc.comp_unit, toOpaqueUid(func_id), toOpaqueUid(sig_id), mangled,
-  func_type, func_range);
+  func_type.get(), func_range);
 
   sc.comp_unit->AddFunction(func_sp);
+
+  clang::StorageClass storage = clang::SC_None;
+  if (sym_record.kind() == S_LPROC32)
+storage = clang::SC_Static;
+
+  clang::DeclContext

[Lldb-commits] [PATCH] D55383: Implement basic DidAttach for DynamicLoaderWindowsDYLD for use with ds2

2018-12-06 Thread Nathan Lanza 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 rLLDB348526: Implement WindowsDYLD::DidAttach for use with 
gdb-server attach (authored by lanza, committed by ).
Herald added subscribers: lldb-commits, abidh.

Changed prior to commit:
  https://reviews.llvm.org/D55383?vs=177028&id=177033#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55383

Files:
  source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp


Index: source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
===
--- source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -10,12 +10,14 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
+#include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadPlanStepInstruction.h"
+#include "lldb/Utility/Log.h"
 
 #include "llvm/ADT/Triple.h"
 
@@ -60,7 +62,39 @@
   return nullptr;
 }
 
-void DynamicLoaderWindowsDYLD::DidAttach() {}
+void DynamicLoaderWindowsDYLD::DidAttach() {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+  if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+  ModuleSP executable = GetTargetExecutable();
+
+  if (!executable.get())
+return;
+
+  // Try to fetch the load address of the file from the process, since there
+  // could be randomization of the load address.
+
+  // It might happen that the remote has a different dir for the file, so we
+  // only send the basename of the executable in the query. I think this is 
safe
+  // because I doubt that two executables with the same basenames are loaded in
+  // memory...
+  FileSpec file_spec(
+  executable->GetPlatformFileSpec().GetFilename().GetCString());
+  bool is_loaded;
+  addr_t base_addr = 0;
+  lldb::addr_t load_addr;
+  Status error = m_process->GetFileLoadAddress(file_spec, is_loaded, 
load_addr);
+  if (error.Success() && is_loaded) {
+base_addr = load_addr;
+UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, base_addr, false);
+  }
+
+  ModuleList module_list;
+  module_list.Append(executable);
+  m_process->GetTarget().ModulesDidLoad(module_list);
+  m_process->LoadModules();
+}
 
 void DynamicLoaderWindowsDYLD::DidLaunch() {}
 


Index: source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
===
--- source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
+++ source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp
@@ -10,12 +10,14 @@
 
 #include "DynamicLoaderWindowsDYLD.h"
 
+#include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadPlanStepInstruction.h"
+#include "lldb/Utility/Log.h"
 
 #include "llvm/ADT/Triple.h"
 
@@ -60,7 +62,39 @@
   return nullptr;
 }
 
-void DynamicLoaderWindowsDYLD::DidAttach() {}
+void DynamicLoaderWindowsDYLD::DidAttach() {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
+  if (log)
+log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__);
+
+  ModuleSP executable = GetTargetExecutable();
+
+  if (!executable.get())
+return;
+
+  // Try to fetch the load address of the file from the process, since there
+  // could be randomization of the load address.
+
+  // It might happen that the remote has a different dir for the file, so we
+  // only send the basename of the executable in the query. I think this is safe
+  // because I doubt that two executables with the same basenames are loaded in
+  // memory...
+  FileSpec file_spec(
+  executable->GetPlatformFileSpec().GetFilename().GetCString());
+  bool is_loaded;
+  addr_t base_addr = 0;
+  lldb::addr_t load_addr;
+  Status error = m_process->GetFileLoadAddress(file_spec, is_loaded, load_addr);
+  if (error.Success() && is_loaded) {
+base_addr = load_addr;
+UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, base_addr, false);
+  }
+
+  ModuleList module_list;
+  module_list.Append(executable);
+  m_process->GetTarget().ModulesDidLoad(module_list);
+  m_process->LoadModules();
+}
 
 void DynamicLoaderWindowsDYLD::DidLaunch() {}
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D55383: Implement basic DidAttach for DynamicLoaderWindowsDYLD for use with ds2

2018-12-06 Thread Davide Italiano via Phabricator via lldb-commits
davide added subscribers: zturner, labath, davide.
davide added a comment.

You would recommend getting a post-commit review from @labath or @zturner


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55383



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


[Lldb-commits] [PATCH] D53094: [pecoff] Implement ObjectFilePECOFF::GetDependedModules()

2018-12-06 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 177036.

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

https://reviews.llvm.org/D53094

Files:
  lit/Modules/PECOFF/dep-modules.yaml
  lit/Modules/PECOFF/export-dllfunc.yaml
  lit/Modules/PECOFF/lit.local.cfg
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  tools/lldb-test/lldb-test.cpp

Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -90,6 +90,9 @@
 cl::opt SectionContents("contents",
   cl::desc("Dump each section's contents"),
   cl::sub(ObjectFileSubcommand));
+cl::opt SectionDependentModules("dep-modules",
+  cl::desc("Dump each dependent module"),
+  cl::sub(ObjectFileSubcommand));
 cl::list InputFilenames(cl::Positional, cl::desc(""),
  cl::OneOrMore,
  cl::sub(ObjectFileSubcommand));
@@ -612,8 +615,7 @@
 
   if (DumpAST) {
 if (Find != FindType::None)
-  return make_string_error(
-  "Cannot both search and dump AST.");
+  return make_string_error("Cannot both search and dump AST.");
 if (Regex || !Context.empty() || !Name.empty() || !File.empty() ||
 Line != 0)
   return make_string_error(
@@ -758,6 +760,20 @@
   }
   Printer.NewLine();
 }
+
+if (opts::object::SectionDependentModules) {
+  // A non-empty section list ensures a valid object file.
+  auto Obj = ModulePtr->GetObjectFile();
+  FileSpecList Files;
+  auto Count = Obj->GetDependentModules(Files);
+  Printer.formatLine("Showing {0} dependent module(s)", Count);
+  for (size_t I = 0; I < Files.GetSize(); ++I) {
+AutoIndent Indent(Printer, 2);
+Printer.formatLine("Name: {0}",
+   Files.GetFileSpecAtIndex(I).GetCString());
+  }
+  Printer.NewLine();
+}
   }
   return HadErrors;
 }
@@ -832,8 +848,8 @@
 ++Probe;
   }
 
-  // Insert the new allocation into the interval map. Use unique allocation IDs
-  // to inhibit interval coalescing.
+  // Insert the new allocation into the interval map. Use unique allocation
+  // IDs to inhibit interval coalescing.
   static unsigned AllocationID = 0;
   if (Size)
 State.Allocations.insert(Addr, EndOfRegion, AllocationID++);
Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
===
--- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -13,6 +13,7 @@
 #include 
 
 #include "lldb/Symbol/ObjectFile.h"
+#include "llvm/Object/Binary.h"
 
 class ObjectFilePECOFF : public lldb_private::ObjectFile {
 public:
@@ -257,6 +258,8 @@
   bool ParseCOFFOptionalHeader(lldb::offset_t *offset_ptr);
   bool ParseSectionHeaders(uint32_t offset);
 
+  uint32_t ParseDependentModules();
+
   static void DumpDOSHeader(lldb_private::Stream *s,
 const dos_header_t &header);
   static void DumpCOFFHeader(lldb_private::Stream *s,
@@ -265,6 +268,8 @@
 const coff_opt_header_t &header);
   void DumpSectionHeaders(lldb_private::Stream *s);
   void DumpSectionHeader(lldb_private::Stream *s, const section_header_t &sh);
+  void DumpDependentModules(lldb_private::Stream *s);
+
   bool GetSectionName(std::string §_name, const section_header_t §);
 
   typedef std::vector SectionHeaderColl;
@@ -272,12 +277,18 @@
   typedef SectionHeaderColl::const_iterator SectionHeaderCollConstIter;
 
 private:
+  bool CreateBinary();
+
+private:
   dos_header_t m_dos_header;
   coff_header_t m_coff_header;
   coff_opt_header_t m_coff_header_opt;
   SectionHeaderColl m_sect_headers;
   lldb::addr_t m_image_base;
   lldb_private::Address m_entry_point_address;
+  mutable std::unique_ptr m_filespec_ap;
+  typedef llvm::object::OwningBinary OWNBINType;
+  mutable std::unique_ptr m_owningbin_up;
 };
 
 #endif // liblldb_ObjectFilePECOFF_h_
Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -23,11 +23,14 @@
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Log.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/Timer.h"
 #include "lldb/Utility/UUID.h"
 #include "llvm/BinaryFormat/COFF.h"
 
+#include "llvm/Object/COFFImportFile.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBuffer.h"
 
 #define IMAGE_DOS_SIGNATURE 0x5A4D// MZ
@@ -86,6 +89,10 @@
   if (!objfile_ap || !objfile_ap->ParseHeade

Re: [Lldb-commits] [PATCH] D55383: Implement basic DidAttach for DynamicLoaderWindowsDYLD for use with ds2

2018-12-06 Thread Davide Italiano via lldb-commits
On Thu, Dec 6, 2018 at 1:32 PM Davide Italiano via Phabricator
 wrote:
>
> davide added subscribers: zturner, labath, davide.
> davide added a comment.
>
> You would recommend getting a post-commit review from @labath or @zturner
>

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


[Lldb-commits] [PATCH] D53094: [pecoff] Implement ObjectFilePECOFF::GetDependedModules()

2018-12-06 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 177038.

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

https://reviews.llvm.org/D53094

Files:
  lit/Modules/PECOFF/dep-modules.yaml
  lit/Modules/PECOFF/export-dllfunc.yaml
  lit/Modules/PECOFF/lit.local.cfg
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
  tools/lldb-test/lldb-test.cpp

Index: tools/lldb-test/lldb-test.cpp
===
--- tools/lldb-test/lldb-test.cpp
+++ tools/lldb-test/lldb-test.cpp
@@ -90,6 +90,9 @@
 cl::opt SectionContents("contents",
   cl::desc("Dump each section's contents"),
   cl::sub(ObjectFileSubcommand));
+cl::opt SectionDependentModules("dep-modules",
+  cl::desc("Dump each dependent module"),
+  cl::sub(ObjectFileSubcommand));
 cl::list InputFilenames(cl::Positional, cl::desc(""),
  cl::OneOrMore,
  cl::sub(ObjectFileSubcommand));
@@ -612,8 +615,7 @@
 
   if (DumpAST) {
 if (Find != FindType::None)
-  return make_string_error(
-  "Cannot both search and dump AST.");
+  return make_string_error("Cannot both search and dump AST.");
 if (Regex || !Context.empty() || !Name.empty() || !File.empty() ||
 Line != 0)
   return make_string_error(
@@ -758,6 +760,20 @@
   }
   Printer.NewLine();
 }
+
+if (opts::object::SectionDependentModules) {
+  // A non-empty section list ensures a valid object file.
+  auto Obj = ModulePtr->GetObjectFile();
+  FileSpecList Files;
+  auto Count = Obj->GetDependentModules(Files);
+  Printer.formatLine("Showing {0} dependent module(s)", Count);
+  for (size_t I = 0; I < Files.GetSize(); ++I) {
+AutoIndent Indent(Printer, 2);
+Printer.formatLine("Name: {0}",
+   Files.GetFileSpecAtIndex(I).GetCString());
+  }
+  Printer.NewLine();
+}
   }
   return HadErrors;
 }
@@ -832,8 +848,8 @@
 ++Probe;
   }
 
-  // Insert the new allocation into the interval map. Use unique allocation IDs
-  // to inhibit interval coalescing.
+  // Insert the new allocation into the interval map. Use unique allocation
+  // IDs to inhibit interval coalescing.
   static unsigned AllocationID = 0;
   if (Size)
 State.Allocations.insert(Addr, EndOfRegion, AllocationID++);
Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
===
--- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -13,6 +13,7 @@
 #include 
 
 #include "lldb/Symbol/ObjectFile.h"
+#include "llvm/Object/Binary.h"
 
 class ObjectFilePECOFF : public lldb_private::ObjectFile {
 public:
@@ -257,6 +258,8 @@
   bool ParseCOFFOptionalHeader(lldb::offset_t *offset_ptr);
   bool ParseSectionHeaders(uint32_t offset);
 
+  uint32_t ParseDependentModules();
+
   static void DumpDOSHeader(lldb_private::Stream *s,
 const dos_header_t &header);
   static void DumpCOFFHeader(lldb_private::Stream *s,
@@ -265,6 +268,8 @@
 const coff_opt_header_t &header);
   void DumpSectionHeaders(lldb_private::Stream *s);
   void DumpSectionHeader(lldb_private::Stream *s, const section_header_t &sh);
+  void DumpDependentModules(lldb_private::Stream *s);
+
   bool GetSectionName(std::string §_name, const section_header_t §);
 
   typedef std::vector SectionHeaderColl;
@@ -272,12 +277,18 @@
   typedef SectionHeaderColl::const_iterator SectionHeaderCollConstIter;
 
 private:
+  bool CreateBinary();
+
+private:
   dos_header_t m_dos_header;
   coff_header_t m_coff_header;
   coff_opt_header_t m_coff_header_opt;
   SectionHeaderColl m_sect_headers;
   lldb::addr_t m_image_base;
   lldb_private::Address m_entry_point_address;
+  llvm::Optional m_deps_filespec;
+  typedef llvm::object::OwningBinary OWNBINType;
+  llvm::Optional m_owningbin;
 };
 
 #endif // liblldb_ObjectFilePECOFF_h_
Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -23,11 +23,14 @@
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/DataBufferHeap.h"
 #include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Log.h"
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/Timer.h"
 #include "lldb/Utility/UUID.h"
 #include "llvm/BinaryFormat/COFF.h"
 
+#include "llvm/Object/COFFImportFile.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBuffer.h"
 
 #define IMAGE_DOS_SIGNATURE 0x5A4D// MZ
@@ -86,6 +89,10 @@
   if (!objfile_ap || !objfile_ap->ParseHeader())
 return nu

[Lldb-commits] [PATCH] D55384: [NativePDB] Reconstruct FunctionDecl AST nodes from PDB debug info

2018-12-06 Thread Zachary Turner via Phabricator via lldb-commits
zturner updated this revision to Diff 177039.
zturner added a comment.

Clang-cl emits `S_LOCAL` symbols while MSVC emits `S_REGREL32` and `S_REGISTER` 
symbols.  So, to get more test coverage, I added an MSVC test as well.  Also a 
little NFC cleanup in the main source file (basically just making sure these 
decls get added to the decl map).


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

https://reviews.llvm.org/D55384

Files:
  lldb/lit/SymbolFile/NativePDB/Inputs/ast-functions.lldbinit
  lldb/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit
  lldb/lit/SymbolFile/NativePDB/Inputs/ast-types.lldbinit
  lldb/lit/SymbolFile/NativePDB/ast-functions-msvc.cpp
  lldb/lit/SymbolFile/NativePDB/ast-functions.cpp
  lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
  lldb/lit/SymbolFile/NativePDB/ast-types.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
  llvm/include/llvm/Support/BinaryStreamArray.h
  llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp

Index: llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
===
--- llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
+++ llvm/lib/DebugInfo/CodeView/SymbolRecordHelpers.cpp
@@ -50,4 +50,15 @@
 assert(false && "Unknown record type");
 return 0;
   }
-}
\ No newline at end of file
+}
+
+CVSymbolArray
+llvm::codeview::limitSymbolArrayToScope(const CVSymbolArray &Symbols,
+uint32_t ScopeBegin) {
+  CVSymbol Opener = *Symbols.at(ScopeBegin);
+  assert(symbolOpensScope(Opener.kind()));
+  uint32_t EndOffset = getScopeEndOffset(Opener);
+  CVSymbol Closer = *Symbols.at(EndOffset);
+  EndOffset += Closer.RecordData.size();
+  return Symbols.substream(ScopeBegin, EndOffset);
+}
Index: llvm/include/llvm/Support/BinaryStreamArray.h
===
--- llvm/include/llvm/Support/BinaryStreamArray.h
+++ llvm/include/llvm/Support/BinaryStreamArray.h
@@ -113,6 +113,15 @@
 
   bool empty() const { return Stream.getLength() == 0; }
 
+  VarStreamArray substream(uint32_t Begin,
+ uint32_t End) const {
+assert(Begin >= Skew);
+// We should never cut off the beginning of the stream since it might be
+// skewed, meaning the initial bytes are important.
+BinaryStreamRef NewStream = Stream.slice(0, End);
+return {NewStream, E, Begin};
+  }
+
   /// given an offset into the array's underlying stream, return an
   /// iterator to the record at that offset.  This is considered unsafe
   /// since the behavior is undefined if \p Offset does not refer to the
Index: llvm/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
===
--- llvm/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
+++ llvm/include/llvm/DebugInfo/CodeView/SymbolRecordHelpers.h
@@ -50,7 +50,11 @@
 
 /// Given a symbol P for which symbolOpensScope(P) == true, return the
 /// corresponding end offset.
-uint32_t getScopeEndOffset(const CVSymbol &symbol);
+uint32_t getScopeEndOffset(const CVSymbol &Symbol);
+
+CVSymbolArray limitSymbolArrayToScope(const CVSymbolArray &Symbols,
+  uint32_t ScopeBegin);
+
 } // namespace codeview
 } // namespace llvm
 
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -217,7 +217,7 @@
 
   llvm::DenseMap m_decl_to_status;
 
-  llvm::DenseMap m_uid_to_decl;
+  llvm::DenseMap m_uid_to_decl;
   llvm::DenseMap
   m_parent_types;
 
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -37,6 +37,7 @@
 #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
 #include "llvm/DebugInfo/CodeView/RecordName.h"
 #include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
+#include "llvm/DebugInfo/CodeView/SymbolRecordHelpers.h"
 #include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
 #include "llvm/DebugInfo/PDB/Native/DbiStream.h"
 #include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
@@ -538,16 +539,110 @@
   if (!func_range.GetBaseAddress().IsValid())
 return nullptr;
 
-  Type *func_type = nullptr;
+  ProcSym proc(static_cast(sym_record.kind()));
+  cantFail(SymbolDeserializer::deserializeAs(sym_record, proc));
+  TypeSP func_type = GetOrCreateType(proc.FunctionType);
 
-  // FIXME: Resolve types and mangled names.
-  PdbTypeSymId sig_id(TypeInd

[Lldb-commits] [lldb] r348527 - [pecoff] Implement ObjectFilePECOFF::GetDependedModules()

2018-12-06 Thread Aaron Smith via lldb-commits
Author: asmith
Date: Thu Dec  6 13:36:39 2018
New Revision: 348527

URL: http://llvm.org/viewvc/llvm-project?rev=348527&view=rev
Log:
[pecoff] Implement ObjectFilePECOFF::GetDependedModules()

Summary:
This parses entries in pecoff import tables for imported DLLs and
is intended as the first step to allow LLDB to load a PE's shared
modules when creating a target on the LLDB console. 


Reviewers: rnk, zturner, aleksandr.urakov, lldb-commits, labath, asmith

Reviewed By: labath, asmith

Subscribers: labath, lemo, clayborg, Hui, mgorny, mgrang, teemperor

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

Added:
lldb/trunk/lit/Modules/PECOFF/
lldb/trunk/lit/Modules/PECOFF/dep-modules.yaml
lldb/trunk/lit/Modules/PECOFF/export-dllfunc.yaml
lldb/trunk/lit/Modules/PECOFF/lit.local.cfg
Modified:
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
lldb/trunk/tools/lldb-test/lldb-test.cpp

Added: lldb/trunk/lit/Modules/PECOFF/dep-modules.yaml
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/PECOFF/dep-modules.yaml?rev=348527&view=auto
==
--- lldb/trunk/lit/Modules/PECOFF/dep-modules.yaml (added)
+++ lldb/trunk/lit/Modules/PECOFF/dep-modules.yaml Thu Dec  6 13:36:39 2018
@@ -0,0 +1,170 @@
+# REQUIRES: system-windows
+# RUN: yaml2obj < %p/export-dllfunc.yaml > %t.export-dllfunc.obj
+# RUN: yaml2obj < %s > %t.obj
+#
+# RUN: lld-link /machine:x64 /out:%t.export-dllfunc.dll /noentry /nodefaultlib 
/dll %t.export-dllfunc.obj /export:DllFunc
+# RUN: lld-link /out:%t.exe %t.obj %t.export-dllfunc.lib /nodefaultlib 
/entry:main /include:DllFunc
+#
+# RUN: lldb-test object-file -dep-modules %t.exe | FileCheck 
-check-prefix=DEPS %s
+
+
+# DEPS: Showing 1 dependent module(s)
+
+# Ignore checking the directory and any tentative string in the path.
+# DEPS:   Name: {{.*}}dep-modules.yaml.{{.*}}export-dllfunc.dll
+
+
+--- !COFF
+header:  
+  Machine: IMAGE_FILE_MACHINE_AMD64
+  Characteristics: [  ]
+sections:
+  - Name:.text
+Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, 
IMAGE_SCN_MEM_READ ]
+Alignment:   16
+SectionData: 
4883EC48C74424444889542438894C2434B90400E889442430B90800E88944242C8B4424300344242C4883C448C3
+Relocations: 
+  - VirtualAddress:  27
+SymbolName:  'DllFunc'
+Type:IMAGE_REL_AMD64_REL32
+  - VirtualAddress:  41
+SymbolName:  'DllFunc'
+Type:IMAGE_REL_AMD64_REL32
+  - Name:.data
+Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, 
IMAGE_SCN_MEM_WRITE ]
+Alignment:   4
+SectionData: ''
+  - Name:.bss
+Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, 
IMAGE_SCN_MEM_WRITE ]
+Alignment:   4
+SectionData: ''
+  - Name:.xdata
+Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+Alignment:   4
+SectionData: '010401000482'
+  - Name:.drectve
+Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
+Alignment:   1
+SectionData: 
202F44454641554C544C49423A6C6962636D742E6C6962202F44454641554C544C49423A6F6C646E616D65732E6C6962
+  - Name:.pdata
+Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
+Alignment:   4
+SectionData: '3E00'
+Relocations: 
+  - VirtualAddress:  0
+SymbolName:  main
+Type:IMAGE_REL_AMD64_ADDR32NB
+  - VirtualAddress:  4
+SymbolName:  main
+Type:IMAGE_REL_AMD64_ADDR32NB
+  - VirtualAddress:  8
+SymbolName:  .xdata
+Type:IMAGE_REL_AMD64_ADDR32NB
+  - Name:.llvm_addrsig
+Characteristics: [ IMAGE_SCN_LNK_REMOVE ]
+Alignment:   1
+SectionData: '10'
+symbols: 
+  - Name:.text
+Value:   0
+SectionNumber:   1
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+SectionDefinition: 
+  Length:  62
+  NumberOfRelocations: 2
+  NumberOfLinenumbers: 0
+  CheckSum:373303044
+  Number:  1
+  - Name:.data
+Value:   0
+SectionNumber:   2
+SimpleType:  IMAGE_SYM_TYPE_NULL
+ComplexType: IMAGE_SYM_DTYPE_NULL
+StorageClass:IMAGE_SYM_CLASS_STATIC
+SectionDefinition: 
+  Length:  0
+  NumberOfRelocations: 0
+  NumberOfLinenumbers: 0
+  CheckSum:0
+  Number:  2
+  - Name:.bss
+Value:   0
+SectionNumber:   3
+SimpleType:  IMAGE_SYM_TYPE_NUL

[Lldb-commits] [PATCH] D55356: Add a method to get the "base" file address of an object file

2018-12-06 Thread Leonard Mosescu via Phabricator via lldb-commits
lemo added inline comments.



Comment at: include/lldb/Symbol/ObjectFile.h:569
 
+  /// Returns the base file address of an object file (also known as the
+  /// preferred load address or image base address). This is typically the file

"file address" can mean an offset within a container file.

to avoid any confusion I'd use "base address" (or "image base address")


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

https://reviews.llvm.org/D55356



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


[Lldb-commits] [PATCH] D55356: Add a method to get the "base" file address of an object file

2018-12-06 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: include/lldb/Symbol/ObjectFile.h:569
 
+  /// Returns the base file address of an object file (also known as the
+  /// preferred load address or image base address). This is typically the file

lemo wrote:
> "file address" can mean an offset within a container file.
> 
> to avoid any confusion I'd use "base address" (or "image base address")
"file address" is the correct LLDB term so I would leave this as is. File 
addresses in LLDB are addresses as they are represented within the object file 
itself. Load addresses at unique and map to a single address in a live process 
where shared libraries are slid around. So "file address" is the correct LLDB 
term.


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

https://reviews.llvm.org/D55356



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


Re: [Lldb-commits] [lldb] r348527 - [pecoff] Implement ObjectFilePECOFF::GetDependedModules()

2018-12-06 Thread Jason Molenda via lldb-commits
Hi Aaron, this is failing to build on macOS systems --

> On Dec 6, 2018, at 1:36 PM, Aaron Smith via lldb-commits 
>  wrote:
> 
> +// At this moment we only have the base name of the DLL. The full path 
> can
> +// only be seen after the dynamic loading.  Our best guess is Try to get 
> it
> +// with the help of the object file's directory.
> +llvm::SmallString dll_fullpath;
> +FileSpec dll_specs(dll_name);
> +dll_specs.GetDirectory().SetString(m_file.GetDirectory().GetCString());
> +



We don't have a MAX_PATH on Darwin systems, but we do have a PATH_MAX which is 
used in other parts of lldb.  Does PATH_MAX work on windows?
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r348542 - [pecoff] Use PATH_MAX instead of MAX_PATH

2018-12-06 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Thu Dec  6 15:22:46 2018
New Revision: 348542

URL: http://llvm.org/viewvc/llvm-project?rev=348542&view=rev
Log:
[pecoff] Use PATH_MAX instead of MAX_PATH

PATH_MAX is defined on all platforms while MAX_PATH is Windows-specific

Modified:
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=348542&r1=348541&r2=348542&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Thu Dec  6 
15:22:46 2018
@@ -889,7 +889,7 @@ uint32_t ObjectFilePECOFF::ParseDependen
 // At this moment we only have the base name of the DLL. The full path can
 // only be seen after the dynamic loading.  Our best guess is Try to get it
 // with the help of the object file's directory.
-llvm::SmallString dll_fullpath;
+llvm::SmallString dll_fullpath;
 FileSpec dll_specs(dll_name);
 dll_specs.GetDirectory().SetString(m_file.GetDirectory().GetCString());
 


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


[Lldb-commits] [lldb] r348544 - [lit] Use the build.py script in the case-insensitive test

2018-12-06 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Thu Dec  6 15:25:37 2018
New Revision: 348544

URL: http://llvm.org/viewvc/llvm-project?rev=348544&view=rev
Log:
[lit] Use the build.py script in the case-insensitive test

This makes the test build correctly regardless of whether we use VS or ninja to 
run the tests

Modified:
lldb/trunk/lit/Breakpoint/case-insensitive.test

Modified: lldb/trunk/lit/Breakpoint/case-insensitive.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/case-insensitive.test?rev=348544&r1=348543&r2=348544&view=diff
==
--- lldb/trunk/lit/Breakpoint/case-insensitive.test (original)
+++ lldb/trunk/lit/Breakpoint/case-insensitive.test Thu Dec  6 15:25:37 2018
@@ -1,6 +1,7 @@
 # REQUIRES: system-windows
-# XFAIL: system-windows
-# -> llvm.org/pr24528
+
+# RUN: %build --mode=compile-and-link --compiler=any 
%p/Inputs/case-sensitive.c --nodefaultlib -o %t
+# RUN: lldb-test breakpoints %t %s | FileCheck %s
 #
 # RUN: %clang %p/Inputs/case-sensitive.c -g -o %t
 # RUN: lldb-test breakpoints %t %s | FileCheck %s


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


Re: [Lldb-commits] [lldb] r348544 - [lit] Use the build.py script in the case-insensitive test

2018-12-06 Thread Zachary Turner via lldb-commits
Fwiw, I think mode=compile-and-link and compiler=any are both defaults, so
those 2 options could be omitted to make this shorter. Not a big deal
though
On Thu, Dec 6, 2018 at 3:28 PM Stella Stamenova via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: stella.stamenova
> Date: Thu Dec  6 15:25:37 2018
> New Revision: 348544
>
> URL: http://llvm.org/viewvc/llvm-project?rev=348544&view=rev
> Log:
> [lit] Use the build.py script in the case-insensitive test
>
> This makes the test build correctly regardless of whether we use VS or
> ninja to run the tests
>
> Modified:
> lldb/trunk/lit/Breakpoint/case-insensitive.test
>
> Modified: lldb/trunk/lit/Breakpoint/case-insensitive.test
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Breakpoint/case-insensitive.test?rev=348544&r1=348543&r2=348544&view=diff
>
> ==
> --- lldb/trunk/lit/Breakpoint/case-insensitive.test (original)
> +++ lldb/trunk/lit/Breakpoint/case-insensitive.test Thu Dec  6 15:25:37
> 2018
> @@ -1,6 +1,7 @@
>  # REQUIRES: system-windows
> -# XFAIL: system-windows
> -# -> llvm.org/pr24528
> +
> +# RUN: %build --mode=compile-and-link --compiler=any
> %p/Inputs/case-sensitive.c --nodefaultlib -o %t
> +# RUN: lldb-test breakpoints %t %s | FileCheck %s
>  #
>  # RUN: %clang %p/Inputs/case-sensitive.c -g -o %t
>  # RUN: lldb-test breakpoints %t %s | FileCheck %s
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D53094: [pecoff] Implement ObjectFilePECOFF::GetDependedModules()

2018-12-06 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added subscribers: stella.stamenova, shafik.
shafik added a comment.

Hello,

This PR broke the green dragon bots, see the following log file:

http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/13655/consoleFull#-15796076f80f5c9c-2aaa-47fb-b15d-be39b7128d72

I was about to revert it but it looks @stella.stamenova landed a fix that looks 
good:

http://llvm.org/viewvc/llvm-project?view=revision&revision=348542

Please watch the bots after you land a change.


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

https://reviews.llvm.org/D53094



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


[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham created this revision.
jingham added reviewers: jasonmolenda, aprantl.
Herald added subscribers: lldb-commits, abidh.

The test "TestExec.py" has been on and off flakey on the GreenDragon MacOS bots 
for a while now.  I'm trying to fix that.  It adds a lot of noise to the bots.

For background:

The job of detecting an exec used to be handled by the DynamicLoaderMacOSX 
plugin.  But when dyld switched over to a remote API approach rather than data 
structures lldb inspects, that job became hard.  About the only clue remaining 
for the new dyld API loader (DynamicLoaderMacOS) is whether the program is back 
at dyld_start when it gets a SIGTRAP.  But if dyld has moved in the course of 
the exec then the new dyld_start address is not the one we knew it as before 
the exec, so this detection will fail.  To make this work on the lldb side, 
we'd have to refresh the shared library state every time we got a SIGTRAP.  But 
that's expensive.

Fortunately, newer debugservers figure this out on their end and annotate the 
stop packet with "reason:exec".  So there's no need to do it on the lldb side.  
But because we didn't want to deal with code signing on the bots, they 
sometimes run older debugservers.  And indeed, when Adrian and I were 
investigating the failures by looking at the packet log we only saw failures 
when the stop reason didn't include reason:exec.

Also fortunately, in order to support other tools that haven't updated to the 
new dyld API's, for now dyld is still maintaining the data structures lldb used 
to look at.

So this patch adds back the check for the dyld info data structure moving that 
the DynamicLoaderMacOSX used.  For debugservers that send reason:exec, this 
code won't ever get run since ProcessGDBRemote will immediately turn the 
SIGTRAP into an exec.  And it will work correctly with older debugservers until 
dyld actually removes this structure.  At that point, the info address will be 
LLDB_INVALID_ADDRESS, and this code won't help anymore.  But presumably by then 
we won't have any debugservers we care about that don't send "reason:exec".


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D55399

Files:
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h


Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
@@ -104,6 +104,7 @@
   // loaded/unloaded images
   lldb::user_id_t m_break_id;
   mutable std::recursive_mutex m_mutex;
+  lldb::addr_t m_maybe_image_infos_address;
 
 private:
   DISALLOW_COPY_AND_ASSIGN(DynamicLoaderMacOS);
Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
@@ -79,7 +79,8 @@
 //--
 DynamicLoaderMacOS::DynamicLoaderMacOS(Process *process)
 : DynamicLoaderDarwin(process), m_image_infos_stop_id(UINT32_MAX),
-  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex() {}
+  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex()
+  , m_maybe_image_infos_address(LLDB_INVALID_ADDRESS) {}
 
 //--
 // Destructor
@@ -95,16 +96,26 @@
   if (m_process) {
 // If we are stopped after an exec, we will have only one thread...
 if (m_process->GetThreadList().GetSize() == 1) {
-  // See if we are stopped at '_dyld_start'
-  ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
-  if (thread_sp) {
-lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
-if (frame_sp) {
-  const Symbol *symbol =
-  frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
-  if (symbol) {
-if (symbol->GetName() == ConstString("_dyld_start"))
-  did_exec = true;
+  // Maybe we still have an image infos address around?  If so see
+  // if that has changed, and if so we have exec'ed:
+  if (m_maybe_image_infos_address != LLDB_INVALID_ADDRESS) {
+lldb::addr_t  image_infos_address = m_process->GetImageInfoAddress();
+if (image_infos_address != m_maybe_image_infos_address)
+  did_exec = true;
+  }
+
+  if (!did_exec) {
+// See if we are stopped at '_dyld_start'
+ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
+if (thread_sp) {
+  lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
+  if (frame_sp) {
+const Symbol *symbol =
+frame_sp->GetSymbolContext(eSymbolContextSymbol).

[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp:83
+  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex()
+  , m_maybe_image_infos_address(LLDB_INVALID_ADDRESS) {}
 

Why not just write C++11-style `= LLDB_INVALID_ADDRESS` in the declaration?



Comment at: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp:102
+  if (m_maybe_image_infos_address != LLDB_INVALID_ADDRESS) {
+lldb::addr_t  image_infos_address = m_process->GetImageInfoAddress();
+if (image_infos_address != m_maybe_image_infos_address)

clang-format :-)



Comment at: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h:107
   mutable std::recursive_mutex m_mutex;
+  lldb::addr_t m_maybe_image_infos_address;
 

Perhaps add a `///` comment explaining what is being stored here?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55399



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


[Lldb-commits] [lldb] r348556 - Host: remove Yield on Windows

2018-12-06 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Thu Dec  6 16:31:34 2018
New Revision: 348556

URL: http://llvm.org/viewvc/llvm-project?rev=348556&view=rev
Log:
Host: remove Yield on Windows

Windows provides a Yield function-like macro that allows a thread to
yield the CPU.  However, this conflicts with `Yield` in swift.  Undefine
`Yield` to allow building lldb with swift support.

Modified:
lldb/trunk/include/lldb/Host/windows/windows.h

Modified: lldb/trunk/include/lldb/Host/windows/windows.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/windows/windows.h?rev=348556&r1=348555&r2=348556&view=diff
==
--- lldb/trunk/include/lldb/Host/windows/windows.h (original)
+++ lldb/trunk/include/lldb/Host/windows/windows.h Thu Dec  6 16:31:34 2018
@@ -21,6 +21,7 @@
 #undef GetUserName
 #undef LoadImage
 #undef CreateProcess
+#undef Yield
 #undef far
 #undef near
 #undef FAR


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


[Lldb-commits] [PATCH] D55318: [Expressions] Add support of expressions evaluation in some object's context

2018-12-06 Thread Zachary Turner via Phabricator via lldb-commits
zturner added inline comments.



Comment at: include/lldb/API/SBValue.h:310-312
+  lldb::SBValue EvaluateExpression(const char *expr) const;
+  lldb::SBValue EvaluateExpression(const char *expr,
+   const SBExpressionOptions &options) const;

Can you use `StringRef` instead of `const char *` here?



Comment at: include/lldb/Expression/UserExpression.h:296
+   lldb::ModuleSP *jit_module_sp_ptr = nullptr,
+   const lldb::ValueObjectSP &ctx_obj = lldb::ValueObjectSP());
 

A reference to a `shared_ptr` seems odd.  Why don't we just say `const 
ValueObject* ctx_obj = nullptr`?



Comment at: include/lldb/Symbol/ClangASTContext.h:1057
+const EvaluateExpressionOptions &options,
+const lldb::ValueObjectSP &ctx_obj) override;
 

Same thing here.



Comment at: source/API/SBValue.cpp:1325-1327
+if (log)
+  log->Printf(
+  "SBValue::EvaluateExpression called with an empty expression");

Instead of the lines like `if (log) log->Printf(...)` you can instead write:

```
LLDB_LOG(log, "SBValue::EvaluateExpression called with an empty expression");
```



Comment at: source/API/SBValue.cpp:1367-1371
+  if (log)
+log->Printf("SBValue(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) "
+"(execution result=%d)",
+static_cast(value_sp.get()), expr,
+static_cast(res_val_sp.get()), expr_res);

If you decide to make that change, note that the macros call `Format`, not 
`Printf`, so in this case you would have to change your format string to 
something like:

```
LLDB_LOG(log, "SBValue({0}::EvaluateExpression (expr=\"{1}\") => SBValue({2}) 
(execution result = {3})",
value_sp.get(), expr, res_val_sp.get(), expr_res);
```

BTW, I would discourage logging pointer values, as it makes log output 
non-deterministic and doesn't often help when reading log files.  That said, it 
wouldn't be the first time we logged pointer values.


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

https://reviews.llvm.org/D55318



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


[Lldb-commits] [lldb] r348557 - Change the amount of data that Platform::PutFile will try to transfer

2018-12-06 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Thu Dec  6 16:35:26 2018
New Revision: 348557

URL: http://llvm.org/viewvc/llvm-project?rev=348557&view=rev
Log:
Change the amount of data that Platform::PutFile will try to transfer
in one packet from 1k bytes to 16k bytes.  Sending a large file to an
iOS device directly connected by USB cable, to lldb-server running in
platform mode, this speeds up the file xfer by 77%.  Sending the file
in 32k blocks speeds up the file xfer by 80% versus 1k blocks, starting
with 16k to make sure we don't have any problems with android testing.

We may not have the same perf characteristics over ethernet, but with
USB it's faster to send fewer larger packets than many small packets.

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

Modified: lldb/trunk/source/Target/Platform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=348557&r1=348556&r2=348557&view=diff
==
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Thu Dec  6 16:35:26 2018
@@ -1296,7 +1296,7 @@ Status Platform::PutFile(const FileSpec
 return error;
   if (dest_file == UINT64_MAX)
 return Status("unable to open target file");
-  lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024, 0));
+  lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024 * 16, 0));
   uint64_t offset = 0;
   for (;;) {
 size_t bytes_read = buffer_sp->GetByteSize();


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


[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham updated this revision to Diff 177085.
jingham marked an inline comment as done.
jingham added a comment.

Added a comment and removed an errant space.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55399

Files:
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h


Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
@@ -104,6 +104,12 @@
   // loaded/unloaded images
   lldb::user_id_t m_break_id;
   mutable std::recursive_mutex m_mutex;
+  lldb::addr_t m_maybe_image_infos_address; // If dyld is still maintaining the
+// all_image_infos address, store 
it
+// here so we can use it to detect
+// exec's when talking to
+// debugservers that don't support
+// the "reason:exec" annotation.
 
 private:
   DISALLOW_COPY_AND_ASSIGN(DynamicLoaderMacOS);
Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
@@ -79,7 +79,8 @@
 //--
 DynamicLoaderMacOS::DynamicLoaderMacOS(Process *process)
 : DynamicLoaderDarwin(process), m_image_infos_stop_id(UINT32_MAX),
-  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex() {}
+  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex(),
+  m_maybe_image_infos_address(LLDB_INVALID_ADDRESS) {}
 
 //--
 // Destructor
@@ -95,16 +96,26 @@
   if (m_process) {
 // If we are stopped after an exec, we will have only one thread...
 if (m_process->GetThreadList().GetSize() == 1) {
-  // See if we are stopped at '_dyld_start'
-  ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
-  if (thread_sp) {
-lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
-if (frame_sp) {
-  const Symbol *symbol =
-  frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
-  if (symbol) {
-if (symbol->GetName() == ConstString("_dyld_start"))
-  did_exec = true;
+  // Maybe we still have an image infos address around?  If so see
+  // if that has changed, and if so we have exec'ed:
+  if (m_maybe_image_infos_address != LLDB_INVALID_ADDRESS) {
+lldb::addr_t image_infos_address = m_process->GetImageInfoAddress();
+if (image_infos_address != m_maybe_image_infos_address)
+  did_exec = true;
+  }
+
+  if (!did_exec) {
+// See if we are stopped at '_dyld_start'
+ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
+if (thread_sp) {
+  lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
+  if (frame_sp) {
+const Symbol *symbol =
+frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
+if (symbol) {
+  if (symbol->GetName() == ConstString("_dyld_start"))
+did_exec = true;
+}
   }
 }
   }
@@ -180,6 +191,7 @@
   }
 
   m_dyld_image_infos_stop_id = m_process->GetStopID();
+  m_maybe_image_infos_address = m_process->GetImageInfoAddress();
 }
 
 bool DynamicLoaderMacOS::NeedToDoInitialImageFetch() { return true; }


Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
@@ -104,6 +104,12 @@
   // loaded/unloaded images
   lldb::user_id_t m_break_id;
   mutable std::recursive_mutex m_mutex;
+  lldb::addr_t m_maybe_image_infos_address; // If dyld is still maintaining the
+// all_image_infos address, store it
+// here so we can use it to detect
+// exec's when talking to
+// debugservers that don't support
+// the "reason:exec" annotation.
 
 private:
   DISALLOW_COPY_AND_ASSIGN(DynamicLoaderMacOS);
Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
=

[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham marked 2 inline comments as done.
jingham added inline comments.



Comment at: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp:83
+  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex()
+  , m_maybe_image_infos_address(LLDB_INVALID_ADDRESS) {}
 

aprantl wrote:
> Why not just write C++11-style `= LLDB_INVALID_ADDRESS` in the declaration?
I think it's confusing to have some declaration initialization and some 
constructor initialization, and I didn't want to change this class over to all 
initialization as it would add noise to the patch.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55399



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


[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Let's try it.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55399



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


[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

If this patch works, then this bot should turn green: 
http://green.lab.llvm.org/green/view/LLDB/job/lldb-sanitized/


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55399



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


[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.

LGTM.




Comment at: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp:104
+if (image_infos_address != m_maybe_image_infos_address)
+  did_exec = true;
+  }

Do you want to copy the image_infos_address value into 
m_maybe_image_infos_address so we can detect the next exec?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55399



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


[Lldb-commits] [PATCH] D55318: [Expressions] Add support of expressions evaluation in some object's context

2018-12-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added inline comments.



Comment at: include/lldb/API/SBValue.h:310-312
+  lldb::SBValue EvaluateExpression(const char *expr) const;
+  lldb::SBValue EvaluateExpression(const char *expr,
+   const SBExpressionOptions &options) const;

zturner wrote:
> Can you use `StringRef` instead of `const char *` here?
This is an SB API.  We don't use StringRef's or any other llvm data types in 
the SB API's.


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

https://reviews.llvm.org/D55318



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


[Lldb-commits] [PATCH] D55318: [Expressions] Add support of expressions evaluation in some object's context

2018-12-06 Thread Zachary Turner via Phabricator via lldb-commits
zturner added inline comments.



Comment at: include/lldb/API/SBValue.h:310-312
+  lldb::SBValue EvaluateExpression(const char *expr) const;
+  lldb::SBValue EvaluateExpression(const char *expr,
+   const SBExpressionOptions &options) const;

jingham wrote:
> zturner wrote:
> > Can you use `StringRef` instead of `const char *` here?
> This is an SB API.  We don't use StringRef's or any other llvm data types in 
> the SB API's.
Ahh, you are right of course.  My bad.


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

https://reviews.llvm.org/D55318



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


[Lldb-commits] [PATCH] D55318: [Expressions] Add support of expressions evaluation in some object's context

2018-12-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham added inline comments.



Comment at: source/API/SBValue.cpp:1367-1371
+  if (log)
+log->Printf("SBValue(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) "
+"(execution result=%d)",
+static_cast(value_sp.get()), expr,
+static_cast(res_val_sp.get()), expr_res);

zturner wrote:
> If you decide to make that change, note that the macros call `Format`, not 
> `Printf`, so in this case you would have to change your format string to 
> something like:
> 
> ```
> LLDB_LOG(log, "SBValue({0}::EvaluateExpression (expr=\"{1}\") => SBValue({2}) 
> (execution result = {3})",
> value_sp.get(), expr, res_val_sp.get(), expr_res);
> ```
> 
> BTW, I would discourage logging pointer values, as it makes log output 
> non-deterministic and doesn't often help when reading log files.  That said, 
> it wouldn't be the first time we logged pointer values.
Logging the pointer value of something long-lived can often be really helpful 
when you are actually debugging lldb, since you can notice some oddity by 
looking at the log and then get directly to the object that was logged.  
Logging the values of short-lived pointers is not so useful.  I think this is 
more of the latter case, and maybe logging the incoming value_sp's name and 
whether the result was successful might be more useful.


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

https://reviews.llvm.org/D55318



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


[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham marked an inline comment as done.
jingham added inline comments.



Comment at: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp:104
+if (image_infos_address != m_maybe_image_infos_address)
+  did_exec = true;
+  }

jasonmolenda wrote:
> Do you want to copy the image_infos_address value into 
> m_maybe_image_infos_address so we can detect the next exec?
You don't need to. If we've exec'ed we have to call DoInitialImageFetch again - 
since the world has changed - which resets the value.  I don't want to do it 
twice, but I can put in a comment explaining why if that would help.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55399



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


[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

I don't feel strongly about it, your choice.  But if I misunderstood it this 
time, I'll likely misunderstand it again in the future. :)


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55399



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


[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Jim Ingham via Phabricator via lldb-commits
jingham marked an inline comment as done.
jingham added inline comments.



Comment at: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp:104
+if (image_infos_address != m_maybe_image_infos_address)
+  did_exec = true;
+  }

jingham wrote:
> jasonmolenda wrote:
> > Do you want to copy the image_infos_address value into 
> > m_maybe_image_infos_address so we can detect the next exec?
> You don't need to. If we've exec'ed we have to call DoInitialImageFetch again 
> - since the world has changed - which resets the value.  I don't want to do 
> it twice, but I can put in a comment explaining why if that would help.
Eh, that's dumb, it's just a single assign, so why not.  I added that in the 
committed version.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55399



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


[Lldb-commits] [lldb] r348559 - Handle detecting exec for DynamicLoaderMacOS with older debugservers

2018-12-06 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Dec  6 17:18:40 2018
New Revision: 348559

URL: http://llvm.org/viewvc/llvm-project?rev=348559&view=rev
Log:
Handle detecting exec for DynamicLoaderMacOS with older debugservers
that don't send reason:exec.



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

Modified:
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp?rev=348559&r1=348558&r2=348559&view=diff
==
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp 
(original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp 
Thu Dec  6 17:18:40 2018
@@ -79,7 +79,8 @@ DynamicLoader *DynamicLoaderMacOS::Creat
 //--
 DynamicLoaderMacOS::DynamicLoaderMacOS(Process *process)
 : DynamicLoaderDarwin(process), m_image_infos_stop_id(UINT32_MAX),
-  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex() {}
+  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex(),
+  m_maybe_image_infos_address(LLDB_INVALID_ADDRESS) {}
 
 //--
 // Destructor
@@ -95,16 +96,31 @@ bool DynamicLoaderMacOS::ProcessDidExec(
   if (m_process) {
 // If we are stopped after an exec, we will have only one thread...
 if (m_process->GetThreadList().GetSize() == 1) {
-  // See if we are stopped at '_dyld_start'
-  ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
-  if (thread_sp) {
-lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
-if (frame_sp) {
-  const Symbol *symbol =
-  frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
-  if (symbol) {
-if (symbol->GetName() == ConstString("_dyld_start"))
-  did_exec = true;
+  // Maybe we still have an image infos address around?  If so see
+  // if that has changed, and if so we have exec'ed.
+  if (m_maybe_image_infos_address != LLDB_INVALID_ADDRESS) {
+lldb::addr_t image_infos_address = m_process->GetImageInfoAddress();
+if (image_infos_address != m_maybe_image_infos_address) {
+  // We don't really have to reset this here, since we are going to
+  // call DoInitialImageFetch right away to handle the exec.  But in
+  // case anybody looks at it in the meantime, it can't hurt.
+  m_maybe_image_infos_address = image_infos_address;
+  did_exec = true;
+}
+  }
+
+  if (!did_exec) {
+// See if we are stopped at '_dyld_start'
+ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
+if (thread_sp) {
+  lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
+  if (frame_sp) {
+const Symbol *symbol =
+frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
+if (symbol) {
+  if (symbol->GetName() == ConstString("_dyld_start"))
+did_exec = true;
+}
   }
 }
   }
@@ -180,6 +196,7 @@ void DynamicLoaderMacOS::DoInitialImageF
   }
 
   m_dyld_image_infos_stop_id = m_process->GetStopID();
+  m_maybe_image_infos_address = m_process->GetImageInfoAddress();
 }
 
 bool DynamicLoaderMacOS::NeedToDoInitialImageFetch() { return true; }

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h?rev=348559&r1=348558&r2=348559&view=diff
==
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h 
(original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h 
Thu Dec  6 17:18:40 2018
@@ -104,6 +104,12 @@ protected:
   // loaded/unloaded images
   lldb::user_id_t m_break_id;
   mutable std::recursive_mutex m_mutex;
+  lldb::addr_t m_maybe_image_infos_address; // If dyld is still maintaining the
+// all_image_infos address, store 
it
+// here so we can use it to detect
+// exec's when talking to
+// debugservers that don't support
+// the "reason:exec" annotation.
 
 private:
   DISALLOW_COPY_AND_ASSIGN(DynamicLoaderMacOS);


___
lldb-commits mailing list
lldb-commits@l

[Lldb-commits] [PATCH] D55399: If we still have all_image_infos use it in DynamicLoaderMacOSDYLD to detect exec's

2018-12-06 Thread Jim Ingham via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB348559: Handle detecting exec for DynamicLoaderMacOS with 
older debugservers (authored by jingham, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55399?vs=177085&id=177087#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55399

Files:
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
  source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h


Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
@@ -104,6 +104,12 @@
   // loaded/unloaded images
   lldb::user_id_t m_break_id;
   mutable std::recursive_mutex m_mutex;
+  lldb::addr_t m_maybe_image_infos_address; // If dyld is still maintaining the
+// all_image_infos address, store 
it
+// here so we can use it to detect
+// exec's when talking to
+// debugservers that don't support
+// the "reason:exec" annotation.
 
 private:
   DISALLOW_COPY_AND_ASSIGN(DynamicLoaderMacOS);
Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
@@ -79,7 +79,8 @@
 //--
 DynamicLoaderMacOS::DynamicLoaderMacOS(Process *process)
 : DynamicLoaderDarwin(process), m_image_infos_stop_id(UINT32_MAX),
-  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex() {}
+  m_break_id(LLDB_INVALID_BREAK_ID), m_mutex(),
+  m_maybe_image_infos_address(LLDB_INVALID_ADDRESS) {}
 
 //--
 // Destructor
@@ -95,16 +96,31 @@
   if (m_process) {
 // If we are stopped after an exec, we will have only one thread...
 if (m_process->GetThreadList().GetSize() == 1) {
-  // See if we are stopped at '_dyld_start'
-  ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
-  if (thread_sp) {
-lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
-if (frame_sp) {
-  const Symbol *symbol =
-  frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
-  if (symbol) {
-if (symbol->GetName() == ConstString("_dyld_start"))
-  did_exec = true;
+  // Maybe we still have an image infos address around?  If so see
+  // if that has changed, and if so we have exec'ed.
+  if (m_maybe_image_infos_address != LLDB_INVALID_ADDRESS) {
+lldb::addr_t image_infos_address = m_process->GetImageInfoAddress();
+if (image_infos_address != m_maybe_image_infos_address) {
+  // We don't really have to reset this here, since we are going to
+  // call DoInitialImageFetch right away to handle the exec.  But in
+  // case anybody looks at it in the meantime, it can't hurt.
+  m_maybe_image_infos_address = image_infos_address;
+  did_exec = true;
+}
+  }
+
+  if (!did_exec) {
+// See if we are stopped at '_dyld_start'
+ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0));
+if (thread_sp) {
+  lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0));
+  if (frame_sp) {
+const Symbol *symbol =
+frame_sp->GetSymbolContext(eSymbolContextSymbol).symbol;
+if (symbol) {
+  if (symbol->GetName() == ConstString("_dyld_start"))
+did_exec = true;
+}
   }
 }
   }
@@ -180,6 +196,7 @@
   }
 
   m_dyld_image_infos_stop_id = m_process->GetStopID();
+  m_maybe_image_infos_address = m_process->GetImageInfoAddress();
 }
 
 bool DynamicLoaderMacOS::NeedToDoInitialImageFetch() { return true; }


Index: source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
===
--- source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
+++ source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.h
@@ -104,6 +104,12 @@
   // loaded/unloaded images
   lldb::user_id_t m_break_id;
   mutable std::recursive_mutex m_mutex;
+  lldb::addr_t m_maybe_image_infos_address; // If dyld is still maintaining the
+// all_image_infos address, store it
+

[Lldb-commits] [lldb] r348561 - Add SBInitializerOptions.h to the Xcode project.

2018-12-06 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Thu Dec  6 18:28:04 2018
New Revision: 348561

URL: http://llvm.org/viewvc/llvm-project?rev=348561&view=rev
Log:
Add SBInitializerOptions.h to the Xcode project.

And mark it as a public header so it will get copied
into the LLDB.framework.  A handful of "api" tests were
failing because they couldn't find this file.

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

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=348561&r1=348560&r2=348561&view=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Dec  6 18:28:04 2018
@@ -756,6 +756,7 @@
9A3576AA116E9AC700E8ED2F /* SBHostOS.cpp in Sources */ = {isa = 
PBXBuildFile; fileRef = 9A3576A9116E9AC700E8ED2F /* SBHostOS.cpp */; };
9A3576A8116E9AB700E8ED2F /* SBHostOS.h in Headers */ = {isa = 
PBXBuildFile; fileRef = 9A3576A7116E9AB700E8ED2F /* SBHostOS.h */; settings = 
{ATTRIBUTES = (Public, ); }; };
AFB2F2F621B71AF30078DEF1 /* SBInitializerOptions.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = AFB2F2F421B71AE90078DEF1 /* 
SBInitializerOptions.cpp */; };
+   4C38996D21BA11CA002BAEF4 /* SBInitializerOptions.h in Headers 
*/ = {isa = PBXBuildFile; fileRef = 4C38996C21BA11CA002BAEF4 /* 
SBInitializerOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
9AC703AF117675410086C050 /* SBInstruction.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 9AC703AE117675410086C050 /* SBInstruction.cpp 
*/; };
9AC7038E117674FB0086C050 /* SBInstruction.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 9AC7038D117674EB0086C050 /* SBInstruction.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
9AC703B1117675490086C050 /* SBInstructionList.cpp in Sources */ 
= {isa = PBXBuildFile; fileRef = 9AC703B0117675490086C050 /* 
SBInstructionList.cpp */; };
@@ -2731,6 +2732,7 @@
9A3576A7116E9AB700E8ED2F /* SBHostOS.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBHostOS.h; path = include/lldb/API/SBHostOS.h; sourceTree = ""; };
2611FF00142D83060017FEA3 /* SBHostOS.i */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = 
SBHostOS.i; sourceTree = ""; };
AFB2F2F421B71AE90078DEF1 /* SBInitializerOptions.cpp */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBInitializerOptions.cpp; path = source/API/SBInitializerOptions.cpp; 
sourceTree = ""; };
+   4C38996C21BA11CA002BAEF4 /* SBInitializerOptions.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBInitializerOptions.h; path = include/lldb/API/SBInitializerOptions.h; 
sourceTree = ""; };
9AC703AE117675410086C050 /* SBInstruction.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = SBInstruction.cpp; path = source/API/SBInstruction.cpp; sourceTree = 
""; };
9AC7038D117674EB0086C050 /* SBInstruction.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
SBInstruction.h; path = include/lldb/API/SBInstruction.h; sourceTree = 
""; };
2611FF02142D83060017FEA3 /* SBInstruction.i */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = 
SBInstruction.i; sourceTree = ""; };
@@ -4263,6 +4265,7 @@
9A3576A7116E9AB700E8ED2F /* SBHostOS.h */,
9A3576A9116E9AC700E8ED2F /* SBHostOS.cpp */,
AFB2F2F421B71AE90078DEF1 /* 
SBInitializerOptions.cpp */,
+   4C38996C21BA11CA002BAEF4 /* 
SBInitializerOptions.h */,
9AC7038D117674EB0086C050 /* SBInstruction.h */,
9AC703AE117675410086C050 /* SBInstruction.cpp 
*/,
9AC7038F117675270086C050 /* SBInstructionList.h 
*/,
@@ -6936,6 +6939,7 @@
4C56543519D2297A002E9C44 /* SBThreadPlan.h in 
Headers */,
263C493A178B50CF0070F12D /* SBModuleSpec.h in 
Headers */,
2617447A11685869005ADD65 /* SBType.h in Headers 
*/,
+   4C38996D21BA11CA002BAEF4 /* 
SBInitializerOptions.h in Headers */,
9475C18914E5EA08001BFC6D /* SBTypeCategory.h in 
Headers */,
941BCC7F14E48C4000BB969C /* SBTypeFilter.h in 
Headers */,
941BCC8014E48C4000BB969C /* SBTypeFormat.h in 
Headers */,


___
lldb-commits mailing list
lldb-commit

Re: [Lldb-commits] [PATCH] D54942: [PDB] Make PDB lit tests use the new builder

2018-12-06 Thread Aleksandr Urakov via lldb-commits
Thank you! It seems that your commit have fixed the bug - it haven't been
reproduced on `lldb-x64-windows-ninja` since your commit.

On Thu, Dec 6, 2018 at 9:45 PM Zachary Turner  wrote:

> Hopefully fixed in r348511.  I went with the approach of concatenating the
> executable file name, for two reasons.  First, it's easier, since dealing
> with the tmpfile module and mkstemp and sorts has its own set of
> complexities and issues.  Secondly, because it means the build artifacts
> will still be in a normal place (instead of in temporary directory) and
> with an intuitive name.  So this means if a test failed it might be easier
> for a developer to inspect the build artifacts to try to determine what
> went wrong.
>
> On Thu, Dec 6, 2018 at 9:22 AM Stella Stamenova 
> wrote:
>
>> I am in favor of unique filenames because it will guarantee we avoid any
>> problems like this in the future, but in most cases, as long as the names
>> are unique **in the test suite**, that should be sufficient. So I don’t
>> have any objections to Zachary’s approach of making the filenames unique
>> enough.
>>
>>
>>
>> Thanks,
>>
>> -Stella
>>
>>
>>
>> *From:* Aleksandr Urakov 
>> *Sent:* Thursday, December 6, 2018 12:25 AM
>> *To:* Zachary Turner 
>> *Cc:* reviews+d54942+public+2603ca548f36d...@reviews.llvm.org; Stella
>> Stamenova ; llvm-comm...@lists.llvm.org; Hafiz
>> Abid Qadeer ; Raphael Isemann ;
>> lldb-commits@lists.llvm.org; sani...@subpath.org; chi...@raincode.com;
>> Brian Gianforcaro 
>>
>>
>> *Subject:* Re: [PATCH] D54942: [PDB] Make PDB lit tests use the new
>> builder
>>
>>
>>
>> Yes, this solution would solve the current problem. But theoretically the
>> uniqueness may be defined by the directory, where the file is located, not
>> by the name. It looks very unlikely, but who knows...
>>
>>
>>
>> I thought about what Stella have said, and it seems that I have found a
>> good solution for this. We can use something like `tempfile` (
>> https://docs.python.org/3.7/library/tempfile.html
>> )
>> for every internally generated file of the script. It will guarantee us the
>> uniqueness of the file. But for the uniqueness of files named by script
>> parameters the script user will remain responsible.
>>
>>
>>
>> What do you think about the such approach?
>>
>>
>>
>> On Wed, Dec 5, 2018 at 11:55 PM Zachary Turner 
>> wrote:
>>
>> I was thinking that we could just automatically compute the output file
>> names as:
>>
>>
>>
>> os.path.join(out_dir, basename(output_file) + '.' +
>> basename(input_file) + '.obj')
>>
>>
>>
>> Currently it's just
>>
>>
>>
>> os.path.join(out_dir, basename(input_file) + '.obj')
>>
>>
>>
>> which is why I think the problem occurs.
>>
>>
>>
>> On Wed, Dec 5, 2018 at 12:47 PM Aleksandr Urakov <
>> aleksandr.ura...@jetbrains.com> wrote:
>>
>> With such solution there would be even no need to change the current
>> commit. But I'm not sure that it's trivial to do - the output file name may
>> contain path with directories. May be we can replace slashes with
>> underscores in the output file path and concatenate it with the object file
>> name? Or even replace slashes in the source file path and concatenate it
>> with the output file path - so object files will be located in the same
>> place as the output file.
>>
>> Am Mi., 5. Dez. 2018, 23:30 hat Zachary Turner 
>> geschrieben:
>>
>> It is not possible to specify object file name in compile and link mode.
>> But perhaps we can just change the default object file name to include
>> something from the output file as well
>>
>> On Wed, Dec 5, 2018 at 12:26 PM Aleksandr Urakov via Phabricator <
>> revi...@reviews.llvm.org> wrote:
>>
>> aleksandr.urakov added a subscriber: zturner.
>> aleksandr.urakov added a comment.
>>
>> The similar problem with `typedefs.test` is here:
>> http://lab.llvm.org:8014/builders/lldb-x64-windows-ninja/builds/1940/steps/test/logs/stdio
>> 
>>
>> I have an assumption about the cause of the problem. Are the tests
>> running in parallel? In this case `typedefs.test` and `enums-layout.test`
>> are writing to the same object file together, because they both are
>> compiled from the same source.
>>
>> @zturner Is it possible to specify object file's name in
>> `compile-and-link` mode? Then we can specify different names in different
>> tests for both object f

[Lldb-commits] [PATCH] D55384: [NativePDB] Reconstruct FunctionDecl AST nodes from PDB debug info

2018-12-06 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov accepted this revision.
aleksandr.urakov added a comment.
This revision is now accepted and ready to land.

LGTM!




Comment at: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:577
+
+  clang::DeclContext *decl_context = m_clang->GetTranslationUnitDecl();
+  clang::FunctionDecl *function_decl = m_clang->CreateFunctionDeclaration(

May be it would be worth to leave a TODO here (about searching a correct 
declaration context in the future)?


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

https://reviews.llvm.org/D55384



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