[Lldb-commits] [PATCH] D54843: [Expr] Check the language before ignoring Objective C keywords

2018-11-26 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:401-404
-// FIXME: the following language option is a temporary workaround,
-// to "ask for C++, get ObjC++".  Apple hopes to remove this requirement on
-// non-Apple platforms, but for now it is needed.
-m_compiler->getLangOpts().ObjC = true;

aleksandr.urakov wrote:
> Is it still necessary? We can do here something like `#ifdef __APPLE__`, but 
> then the test will fail on Apple platforms. Can we somehow specify a platform 
> requirement in the test?
Instead of `ifdef` it would be better to do a 
`target->GetArchitecture().getTriple().getVendor() == llvm::Triple::Apple` and 
then `@skipIfDarwin` in the test. But it would be certainly better to remove 
this altogether :)


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54843



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


[Lldb-commits] [PATCH] D54863: [ASTImporter] Set MustBuildLookupTable on PrimaryContext

2018-11-26 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a reviewer: clayborg.
labath added a comment.

The change looks pretty safe to me. Adding Greg in case he has any concerns.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54863



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


[Lldb-commits] [PATCH] D54751: [LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for building the executable.

2018-11-26 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil accepted this revision.
jankratochvil added a comment.
This revision is now accepted and ready to land.

I do not think my approval is sufficient but I agree with the patch.


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

https://reviews.llvm.org/D54751



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


[Lldb-commits] [PATCH] D54751: [LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for building the executable.

2018-11-26 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:351
+  if (!addr_base)
+addr_base =
+   cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_GNU_addr_base, 
0);

Here I would find good also a comment:
``` // pre-DWARF v5 attributes DW_AT_GNU_* applied only to the DWO unit while 
DWARF v5 attributes DW_AT_* apply also to the main unit
```
Based on a [[ https://gcc.gnu.org/wiki/DebugFission | DebugFission ]] comment:
```Note the following difference between the current GCC implementation and the 
DWARF v5 specification: In the current GCC implementation (based on DWARF v4), 
if DW_AT_ranges is present, the offset into the ranges table is not relative to 
the value given by DW_AT_ranges_base (i.e., DW_AT_ranges_base is used only for 
references to the range table from the dwo sections). In DWARF v5, the 
DW_AT_ranges_base attribute is used for all references to the range table -- 
both from dwo sections and from skeleton compile units.
```

I was also thinking to fetch the attributes just once by some `(m_version >= 5 
? DW_AT_addr_base : DW_AT_GNU_addr_base)` but clang-7.0 does produce DWARF-5 
still using `DW_AT_GNU_addr_base`.



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

https://reviews.llvm.org/D54751



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


[Lldb-commits] [PATCH] D54751: [LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for building the executable.

2018-11-26 Thread George Rimar via Phabricator via lldb-commits
grimar updated this revision to Diff 175222.
grimar marked an inline comment as done.
grimar added a comment.

Thanks for looking at this, Jan!

- Rewrote the comment.


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

https://reviews.llvm.org/D54751

Files:
  lit/Breakpoint/Inputs/split-dwarf-5-addrbase.dwo.yaml
  lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml
  lit/Breakpoint/split-dwarf-5-addrbase.test
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -307,8 +307,10 @@
 
 // m_die_array_mutex must be already held as read/write.
 void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) {
-  SetAddrBase(
-  cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_addr_base, 0));
+  dw_addr_t addr_base =
+  cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_addr_base, 0);
+  SetAddrBase(addr_base);
+
   SetRangesBase(cu_die.GetAttributeValueAsUnsigned(m_dwarf, this,
DW_AT_rnglists_base, 0));
 
@@ -342,8 +344,15 @@
 
   m_dwo_symbol_file = std::move(dwo_symbol_file);
 
-  dw_addr_t addr_base =
-  cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_GNU_addr_base, 0);
+  // Here for DWO CU we want to use the address base set in the skeleton unit
+  // (DW_AT_addr_base) if it is available and use the DW_AT_GNU_addr_base
+  // otherwise. We do that because pre-DWARF v5 could use the DW_AT_GNU_*
+  // attributes which were applicable to the DWO units. The corresponding
+  // DW_AT_* attributes standardized in DWARF v5 are also applicable to the main
+  // unit in contrast.
+  if (!addr_base)
+addr_base = cu_die.GetAttributeValueAsUnsigned(m_dwarf, this,
+   DW_AT_GNU_addr_base, 0);
   dwo_cu->SetAddrBase(addr_base);
 
   dw_addr_t ranges_base = cu_die.GetAttributeValueAsUnsigned(
Index: lit/Breakpoint/split-dwarf-5-addrbase.test
===
--- lit/Breakpoint/split-dwarf-5-addrbase.test
+++ lit/Breakpoint/split-dwarf-5-addrbase.test
@@ -0,0 +1,30 @@
+# RUN: rm -rf %t.dir
+# RUN: mkdir %t.dir
+# RUN: cd %t.dir
+# RUN: yaml2obj %p/Inputs/split-dwarf-5-addrbase.dwo.yaml > %t.dir/test.dwo
+# RUN: yaml2obj %p/Inputs/split-dwarf-5-addrbase.yaml > %t.dir/test
+# RUN: lldb-test breakpoints %t.dir/test %s | FileCheck %s
+
+# This test checks that source code location is shown correctly
+# when -gsplit-dwarf and DWARF 5 are used.
+#
+# split-dwarf-5-addrbase.dwo.yaml and split-dwarf-5-addrbase.yamlare
+# reduced yaml files produces from the dwo file and the corresponding executable.
+#
+# The following code was used initially:
+# void baz() {
+# }
+# 
+# int main() {
+#   baz();
+#   return 0;
+# }
+#
+# Invocation used to produce outputs was:
+# clang test.cc -g -fno-rtti -c -gdwarf-5 -gsplit-dwarf
+# clang test.o -g -fno-rtti -gdwarf-5 -o test -gsplit-dwarf
+# clang version 8.0.0 (trunk 347299)
+
+b baz
+# CHECK-LABEL: b baz
+# CHECK: Address: {{.*}}baz() + 4 at test.cc:2:1
Index: lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml
===
--- lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml
+++ lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml
@@ -0,0 +1,61 @@
+--- !ELF
+FileHeader:  
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_X86_64
+  Entry:   0x00400440
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+Address: 0x00400440
+AddressAlign:0x0010
+Content: 31ED4989D15E4889E24883E4F0505449C7C0C005400048C7C15005400048C7C730054000E8B7FFF4660F1F4455B820204000483D202040004889E57417B84885C0740D5DBF20204000FFE00F1F445DC3660F1F44BE20204000554881EE202040004889E548C1FE034889F048C1E83F4801C648D1FE7415B84885C0740B5DBF20204000FFE00F1F005DC3660F1F44803D391B007517554889E5E87EFFC605271B015DC30F1F44F3C30F1F4000662E0F1F8400554889E55DEB89660F1F8400554889E55DC3662E0F1F8400554889E54883EC10C745FCE8DCFF31C04883C4105DC30F1F4000415741564189FF415541544C8D25A61855488D2DA618534989F64989D54C29E54883EC0848C1FD03E86FFE4885ED742031DB0F1F84004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F8400F3C3
+  - Name:.debug_str_offsets
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: 0C0005000900
+  - Name:.debug_str
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x00

[Lldb-commits] [PATCH] D54751: [LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for building the executable.

2018-11-26 Thread George Rimar via Phabricator via lldb-commits
grimar added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:351
+  if (!addr_base)
+addr_base =
+   cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_GNU_addr_base, 
0);

jankratochvil wrote:
> Here I would find good also a comment:
> ``` // pre-DWARF v5 attributes DW_AT_GNU_* applied only to the DWO unit while 
> DWARF v5 attributes DW_AT_* apply also to the main unit
> ```
> Based on a [[ https://gcc.gnu.org/wiki/DebugFission | DebugFission ]] comment:
> ```Note the following difference between the current GCC implementation and 
> the DWARF v5 specification: In the current GCC implementation (based on DWARF 
> v4), if DW_AT_ranges is present, the offset into the ranges table is not 
> relative to the value given by DW_AT_ranges_base (i.e., DW_AT_ranges_base is 
> used only for references to the range table from the dwo sections). In DWARF 
> v5, the DW_AT_ranges_base attribute is used for all references to the range 
> table -- both from dwo sections and from skeleton compile units.
> ```
> 
> I was also thinking to fetch the attributes just once by some `(m_version >= 
> 5 ? DW_AT_addr_base : DW_AT_GNU_addr_base)` but clang-7.0 does produce 
> DWARF-5 still using `DW_AT_GNU_addr_base`.
> 
I rewrote the comment.

> I was also thinking to fetch the attributes just once by some (m_version >= 5 
> ? DW_AT_addr_base : DW_AT_GNU_addr_base) but clang-7.0 does produce DWARF-5 
> still using DW_AT_GNU_addr_base.

Yeah, it would not be safe to do such check I think. But it should not be an 
issue, in practice, I believe it should be fine to check both the attributes in 
order.


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

https://reviews.llvm.org/D54751



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


[Lldb-commits] [PATCH] D54843: [Expr] Check the language before ignoring Objective C keywords

2018-11-26 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov added a reviewer: labath.
aleksandr.urakov marked an inline comment as done.
aleksandr.urakov added inline comments.



Comment at: 
source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:401-404
-// FIXME: the following language option is a temporary workaround,
-// to "ask for C++, get ObjC++".  Apple hopes to remove this requirement on
-// non-Apple platforms, but for now it is needed.
-m_compiler->getLangOpts().ObjC = true;

labath wrote:
> aleksandr.urakov wrote:
> > Is it still necessary? We can do here something like `#ifdef __APPLE__`, 
> > but then the test will fail on Apple platforms. Can we somehow specify a 
> > platform requirement in the test?
> Instead of `ifdef` it would be better to do a 
> `target->GetArchitecture().getTriple().getVendor() == llvm::Triple::Apple` 
> and then `@skipIfDarwin` in the test. But it would be certainly better to 
> remove this altogether :)
Yes, your variant is better! I'll do it in the way you have described if there 
will be objections against removing it at all.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54843



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


[Lldb-commits] [PATCH] D54863: [ASTImporter] Set MustBuildLookupTable on PrimaryContext

2018-11-26 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

In D54863#1306947 , @martong wrote:

> We have a change in Clang/ASTImporter which causes an LLDB assertion, unless 
> this patch is applied.
>  The related change is https://reviews.llvm.org/D53655
>
> In that patch we change the importer to properly import the redecl chains of 
> `RecordDecl`s. Consequently the `to_tag_decl` here in LLDB may not always be 
> the PrimaryContext anymore, thus we have to explicitly use the primary 
> context.


Can you write an lldb test for this?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54863



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


[Lldb-commits] [PATCH] D54863: [ASTImporter] Set MustBuildLookupTable on PrimaryContext

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

Looks good to me as long as test suite is happy.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54863



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


[Lldb-commits] [PATCH] D54843: [Expr] Check the language before ignoring Objective C keywords

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.



Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:404
-// non-Apple platforms, but for now it is needed.
-m_compiler->getLangOpts().ObjC = true;
 break;

A better way would be to try and grab the Objective C runtime from the process. 
There are some variants of objective C that might run under non-apple targets:

```
ProcessSP process_sp = target->GetProcess();
if (process_sp) 
  m_compiler->getLangOpts().ObjC = 
process_sp->GetLanguageRuntime(eLanguageTypeObjC) != nullptr;
```

Then C and C++ programs on Mac will be able to use "id" and other reserved 
words in their expressions again.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54843



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


[Lldb-commits] [PATCH] D54751: [LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for building the executable.

2018-11-26 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.

See inlined comments.




Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:353
+  // unit in contrast.
+  if (!addr_base)
+addr_base = cu_die.GetAttributeValueAsUnsigned(m_dwarf, this,

```
if (addr_base == LLDB_INVALID_ADDRESS)
```


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

https://reviews.llvm.org/D54751



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


[Lldb-commits] [PATCH] D54751: [LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for building the executable.

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:354-355
+  if (!addr_base)
+addr_base = cu_die.GetAttributeValueAsUnsigned(m_dwarf, this,
+   DW_AT_GNU_addr_base, 0);
   dwo_cu->SetAddrBase(addr_base);

```
addr_base = cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, 
DW_AT_GNU_addr_base, LLDB_INVALID_ADDRESS);
```


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

https://reviews.llvm.org/D54751



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


[Lldb-commits] [PATCH] D54751: [LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for building the executable.

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Missed an inline comment on last comment




Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:311
+  dw_addr_t addr_base =
+  cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_addr_base, 
0);
+  SetAddrBase(addr_base);

Use LLDB_INVALID_ADDRESS instead of zero as zero could be a valid base address.
```
dw_addr_t addr_base = cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, 
DW_AT_addr_base, LLDB_INVALID_ADDRESS);
```


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

https://reviews.llvm.org/D54751



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


[Lldb-commits] [PATCH] D28305: [Host] Handle short reads and writes, take 3

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Any reason we are removing File::SeekFromCurrent and File::SeekFromEnd?


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

https://reviews.llvm.org/D28305



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


[Lldb-commits] [PATCH] D28305: [Host] Handle short reads and writes, take 3

2018-11-26 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

This is a stale patch which I am abandoning. I am just cleaning up my queue.


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

https://reviews.llvm.org/D28305



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Would be great to see old and new output like Zach suggested. Is there a reason 
we need to use TableGen? Other command line tools just use llvm:🆑:opt stuff. 
Seems a bit obtuse to use TableGen?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54692



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


Re: [Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Zachary Turner via lldb-commits
There’s actually been a slow push away from cl::opt. It’s less flexible and
doesn’t support some things that the TableGen approach does. Recently
there’s been a few efforts to port existing tools onto TableGen options
from cl::opt.

I don’t think cl::opt is going away anytime soon so if it works I don’t
have a strong opinion, but it’s kinda nice to standardize on “the one true
method” if that’s the direction things are heading anyway
On Mon, Nov 26, 2018 at 7:51 AM Greg Clayton via Phabricator <
revi...@reviews.llvm.org> wrote:

> clayborg added a comment.
>
> Would be great to see old and new output like Zach suggested. Is there a
> reason we need to use TableGen? Other command line tools just use
> llvm:🆑:opt stuff. Seems a bit obtuse to use TableGen?
>
>
> Repository:
>   rLLDB LLDB
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D54692/new/
>
> https://reviews.llvm.org/D54692
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Current output: https://reviews.llvm.org/P8117
Tablegen output: https://reviews.llvm.org/P8118


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

I actually don't find this too bad, and like Pavel mentioned earlier, it's 
something that we can fix in LLVM and improve everyone's output.  Which is one 
of the nice things about sharing code like this.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54863: [ASTImporter] Set MustBuildLookupTable on PrimaryContext

2018-11-26 Thread Gabor Marton via Phabricator via lldb-commits
martong added a comment.

> Can you write an lldb test for this?

There is already an existing test for that:

  2: test_expr_dwarf (TestSharedLib.SharedLibTestCase)
 Test that types work when defined in a shared library and forward-declared 
in the main executable ... python: 
../../git/llvm/tools/clang/include/clang/AST/DeclBase.h:2298: void 
clang::DeclContext::setMustBuildLookupTable(): Assertion `this == 
getPrimaryContext() && "should only be called on primary context"' failed.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54863



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

In D54692#1308071 , @clayborg wrote:

> Would be great to see old and new output like Zach suggested. Is there a 
> reason we need to use TableGen? Other command line tools just use llvm:🆑:opt 
> stuff. Seems a bit obtuse to use TableGen?


I'm afraid this is not true.  lld uses TableGen and that was a big success. See 
https://github.com/llvm-mirror/lld/blob/master/ELF/Options.td (considering that 
linkers have to handle all the annoying cmdline compatibility with gcc, e.g. 
options which take single or double underscores).

FWIW, I'm in favour of this change.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

> There’s actually been a slow push away from cl::opt. It’s less flexible
>  and doesn’t support some things that the TableGen approach does.
>  Recently there’s been a few efforts to port existing tools onto TableGen
>  options from cl::opt.
> 
> I don’t think cl::opt is going away anytime soon so if it works I don’t
>  have a strong opinion, but it’s kinda nice to standardize on “the one
>  true method” if that’s the direction things are heading anyway

Another reason for using libOption is that it is also usable as a parser for 
the lldb command line, whereas cl::opt is definitely not (it uses global 
variables). And there's value in consistency between the lldb driver and the 
built-in command line.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54863: [ASTImporter] Set MustBuildLookupTable on PrimaryContext

2018-11-26 Thread Davide Italiano via Phabricator via lldb-commits
davide added a comment.

In D54863#1308176 , @martong wrote:

> > Can you write an lldb test for this?
>
> There is already an existing test for that:
>
>   2: test_expr_dwarf (TestSharedLib.SharedLibTestCase)
>  Test that types work when defined in a shared library and 
> forward-declared in the main executable ... python: 
> ../../git/llvm/tools/clang/include/clang/AST/DeclBase.h:2298: void 
> clang::DeclContext::setMustBuildLookupTable(): Assertion `this == 
> getPrimaryContext() && "should only be called on primary context"' failed.
>   


Cool, thanks. Is this failing only on linux? Do you happen to have a buildbot 
link that shows the failure?

Thanks!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54863



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


[Lldb-commits] [PATCH] D54682: [Driver] Extract option parsing and option processing.

2018-11-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere abandoned this revision.
JDevlieghere added a comment.

Thanks everyone! Looks like the general consensus is in favor of using 
libOption, so I'm abandoning this in favor of D54692 
. Please continue the discussion there.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54682



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

In D54692#1308190 , @labath wrote:

> > There’s actually been a slow push away from cl::opt. It’s less flexible
> >  and doesn’t support some things that the TableGen approach does.
> >  Recently there’s been a few efforts to port existing tools onto TableGen
> >  options from cl::opt.
> > 
> > I don’t think cl::opt is going away anytime soon so if it works I don’t
> >  have a strong opinion, but it’s kinda nice to standardize on “the one
> >  true method” if that’s the direction things are heading anyway
>
> Another reason for using libOption is that it is also usable as a parser for 
> the lldb command line, whereas cl::opt is definitely not (it uses global 
> variables). And there's value in consistency between the lldb driver and the 
> built-in command line.


This is true too.  Although I believe libOption doesn't support subcommands, 
which would be required in order to use it for the interactive lldb command 
line, but again, there would be value in adding that to libOption outside of 
llvm (cl::opt supports it, so it's required in order to port some remaining 
llvm tools to libOption)


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54863: [ASTImporter] Set MustBuildLookupTable on PrimaryContext

2018-11-26 Thread Gabor Marton via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL347575: [ASTImporter] Set MustBuildLookupTable on 
PrimaryContext (authored by martong, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D54863

Files:
  lldb/trunk/source/Symbol/ClangASTImporter.cpp


Index: lldb/trunk/source/Symbol/ClangASTImporter.cpp
===
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp
@@ -1050,7 +1050,7 @@
 TagDecl *to_tag_decl = dyn_cast(to);
 
 to_tag_decl->setHasExternalLexicalStorage();
-to_tag_decl->setMustBuildLookupTable();
+to_tag_decl->getPrimaryContext()->setMustBuildLookupTable();
 
 if (log)
   log->Printf(


Index: lldb/trunk/source/Symbol/ClangASTImporter.cpp
===
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp
@@ -1050,7 +1050,7 @@
 TagDecl *to_tag_decl = dyn_cast(to);
 
 to_tag_decl->setHasExternalLexicalStorage();
-to_tag_decl->setMustBuildLookupTable();
+to_tag_decl->getPrimaryContext()->setMustBuildLookupTable();
 
 if (log)
   log->Printf(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54863: [ASTImporter] Set MustBuildLookupTable on PrimaryContext

2018-11-26 Thread Gabor Marton via Phabricator via lldb-commits
martong added a comment.

Thank you all for the review! :)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54863



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


[Lldb-commits] [PATCH] D54886: Add support for the Dylan language to ClangASTContext

2018-11-26 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: source/Symbol/ClangASTContext.cpp:123
+ language == eLanguageTypeD ||
+ language == eLanguageTypeDylan;
 }

Please add a comment explaining that "The Debug info generated by the Open 
Dylan compiler's
LLVM back-end was designed to be compatible with C debug info."


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

https://reviews.llvm.org/D54886



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


[Lldb-commits] [PATCH] D54863: [ASTImporter] Set MustBuildLookupTable on PrimaryContext

2018-11-26 Thread Gabor Marton via Phabricator via lldb-commits
martong added a comment.

>   Is this failing only on linux? Do you happen to have a buildbot link that 
> shows the failure?

This LLDB patch is to prevent the buildbot failure when we commit this 
Clang/ASTImporter patch : https://reviews.llvm.org/D53655


Repository:
  rL LLVM

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

https://reviews.llvm.org/D54863



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D54692#1308207 , @zturner wrote:

> In D54692#1308190 , @labath wrote:
>
> > Another reason for using libOption is that it is also usable as a parser 
> > for the lldb command line, whereas cl::opt is definitely not (it uses 
> > global variables). And there's value in consistency between the lldb driver 
> > and the built-in command line.
>
>
> This is true too.  Although I believe libOption doesn't support subcommands, 
> which would be required in order to use it for the interactive lldb command 
> line, but again, there would be value in adding that to libOption outside of 
> llvm (cl::opt supports it, so it's required in order to port some remaining 
> llvm tools to libOption)


Adding subcommands is one way. Another would be to simply keep the existing 
subcommand-parsing code (which we  already have, as getopt doesn't support that 
either), and just replace the getopt part with libOption.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [lldb] r347578 - [Cmake] Add missing dependency to `count`.

2018-11-26 Thread Davide Italiano via lldb-commits
Author: davide
Date: Mon Nov 26 09:30:28 2018
New Revision: 347578

URL: http://llvm.org/viewvc/llvm-project?rev=347578&view=rev
Log:
[Cmake] Add missing dependency to `count`.

Modified:
lldb/trunk/lit/CMakeLists.txt

Modified: lldb/trunk/lit/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=347578&r1=347577&r2=347578&view=diff
==
--- lldb/trunk/lit/CMakeLists.txt (original)
+++ lldb/trunk/lit/CMakeLists.txt Mon Nov 26 09:30:28 2018
@@ -22,6 +22,7 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLV
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS 
"${LLDB_DOTEST_ARGS}")
 
 list(APPEND LLDB_TEST_DEPS
+  count
   LLDBUnitTests
   dsymutil
   llc


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


[Lldb-commits] [lldb] r347579 - [lit] Fully qualify lit_config to avoid runtime crashes.

2018-11-26 Thread Davide Italiano via lldb-commits
Author: davide
Date: Mon Nov 26 09:39:20 2018
New Revision: 347579

URL: http://llvm.org/viewvc/llvm-project?rev=347579&view=rev
Log:
[lit] Fully qualify lit_config to avoid runtime crashes.

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

Modified: lldb/trunk/lit/helper/toolchain.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/helper/toolchain.py?rev=347579&r1=347578&r2=347579&view=diff
==
--- lldb/trunk/lit/helper/toolchain.py (original)
+++ lldb/trunk/lit/helper/toolchain.py Mon Nov 26 09:39:20 2018
@@ -76,7 +76,7 @@ def use_support_substitutions(config):
 res = -1
 if res == 0 and out:
 sdk_path = lit.util.to_string(out)
-lit_config.note('using SDKROOT: %r' % sdk_path)
+llvm_config.lit_config.note('using SDKROOT: %r' % sdk_path)
 flags = ['-isysroot', sdk_path]
 elif platform.system() in ['OpenBSD', 'Linux']:
 flags = ['-pthread']


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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

the old usage:

  Usage:
  
lldb -h
lldb -v [[--]  [ ...]]
lldb -a  -f  [-c ] [-s ] [-o ] 
[-S ] [-O ] [-k ] [-K ] [-Q] [-b] [-e] [-x] 
[-X] [-l ] [-d] [-z ] [[--]  
[ ...]]
lldb -n  -w [-s ] [-o ] [-S ] [-O 
] [-k ] [-K ] [-Q] [-b] [-e] [-x] [-X] [-l 
] [-d] [-z ]
lldb -p  [-s ] [-o ] [-S ] [-O ] [-k 
] [-K ] [-Q] [-b] [-e] [-x] [-X] [-l ] [-d] 
[-z ]
lldb -P
lldb -r [] -R 

Showed how all the options can be used together. It would be nice to group the 
options into the following groups:

- general options

--arch, --version, --help, --file, --editor)

- LLDB command options (--batch, --one-line*, --source*
- attach options (--attach-name, --attach-pid, --wait-for


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54616: [Reproducers] Improve reproducer API and add unit tests.

2018-11-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 175293.
JDevlieghere marked 6 inline comments as done.
JDevlieghere added a comment.

Thanks Pavel, really useful feedback, I learned a few new things :-)


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

https://reviews.llvm.org/D54616

Files:
  include/lldb/API/SBDebugger.h
  include/lldb/Core/Debugger.h
  include/lldb/Utility/Reproducer.h
  scripts/interface/SBDebugger.i
  source/API/SBDebugger.cpp
  source/Commands/CommandObjectReproducer.cpp
  source/Core/Debugger.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Utility/Reproducer.cpp
  tools/driver/Driver.cpp
  unittests/Utility/CMakeLists.txt
  unittests/Utility/ReproducerTest.cpp

Index: unittests/Utility/ReproducerTest.cpp
===
--- /dev/null
+++ unittests/Utility/ReproducerTest.cpp
@@ -0,0 +1,126 @@
+//===-- ReproducerTest.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "llvm/Support/Error.h"
+#include "llvm/Testing/Support/Error.h"
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Reproducer.h"
+
+using namespace llvm;
+using namespace lldb_private;
+using namespace lldb_private::repro;
+
+class DummyProvider : public repro::Provider {
+public:
+  static constexpr const char *NAME = "dummy";
+
+  DummyProvider(const FileSpec &directory) : Provider(directory) {
+m_info.name = "dummy";
+m_info.files.push_back("dummy.yaml");
+  }
+
+  static char ID;
+};
+
+char DummyProvider::ID = 0;
+
+TEST(ReproducerTest, SetCapture) {
+  Reproducer reproducer;
+
+  // Initially both generator and loader are unset.
+  EXPECT_EQ(nullptr, reproducer.GetGenerator());
+  EXPECT_EQ(nullptr, reproducer.GetLoader());
+
+  // Enable capture and check that means we have a generator.
+  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
+Succeeded());
+  EXPECT_NE(nullptr, reproducer.GetGenerator());
+  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetGenerator()->GetRoot());
+  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetReproducerPath());
+
+  // Ensure that we cannot enable replay.
+  EXPECT_THAT_ERROR(reproducer.SetReplay(FileSpec("/bogus/path")), Failed());
+  EXPECT_EQ(nullptr, reproducer.GetLoader());
+
+  // Ensure we can disable the generator again.
+  EXPECT_THAT_ERROR(reproducer.SetCapture(llvm::None), Succeeded());
+  EXPECT_EQ(nullptr, reproducer.GetGenerator());
+  EXPECT_EQ(nullptr, reproducer.GetLoader());
+}
+
+TEST(ReproducerTest, SetReplay) {
+  Reproducer reproducer;
+
+  // Initially both generator and loader are unset.
+  EXPECT_EQ(nullptr, reproducer.GetGenerator());
+  EXPECT_EQ(nullptr, reproducer.GetLoader());
+
+  // Expected to fail because we can't load the index.
+  EXPECT_THAT_ERROR(reproducer.SetReplay(FileSpec("/bogus/path")), Failed());
+  // However the loader should still be set, which we check here.
+  EXPECT_NE(nullptr, reproducer.GetLoader());
+
+  // Make sure the bogus path is correctly set.
+  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetLoader()->GetRoot());
+  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetReproducerPath());
+
+  // Ensure that we cannot enable replay.
+  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")), Failed());
+  EXPECT_EQ(nullptr, reproducer.GetGenerator());
+}
+
+TEST(GeneratorTest, Create) {
+  Reproducer reproducer;
+
+  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
+Succeeded());
+  auto &generator = *reproducer.GetGenerator();
+
+  auto *provider = generator.Create();
+  EXPECT_NE(nullptr, provider);
+  EXPECT_EQ(FileSpec("/bogus/path"), provider->GetRoot());
+  EXPECT_EQ(std::string("dummy"), provider->GetInfo().name);
+  EXPECT_EQ((size_t)1, provider->GetInfo().files.size());
+  EXPECT_EQ(std::string("dummy.yaml"), provider->GetInfo().files.front());
+}
+
+TEST(GeneratorTest, Get) {
+  Reproducer reproducer;
+
+  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
+Succeeded());
+  auto &generator = *reproducer.GetGenerator();
+
+  auto *provider = generator.Create();
+  EXPECT_NE(nullptr, provider);
+
+  auto *provider_alt = generator.Get();
+  EXPECT_EQ(provider, provider_alt);
+}
+
+TEST(GeneratorTest, GetOrCreate) {
+  Reproducer reproducer;
+
+  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
+Succeeded());
+  auto &generator = *reproducer.GetGenerator();
+
+  auto &provider = generator.GetOrCreate();
+  EXPECT_EQ(FileSpec("/bogus/path"), provider.GetRoot());
+  EXPECT_EQ(std::string("dummy"), provider.GetInfo().name);
+  EXPE

[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 175300.
JDevlieghere added a comment.

Add old usage.


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

https://reviews.llvm.org/D54692

Files:
  tools/driver/CMakeLists.txt
  tools/driver/Driver.cpp
  tools/driver/Driver.h
  tools/driver/Options.td

Index: tools/driver/Options.td
===
--- /dev/null
+++ tools/driver/Options.td
@@ -0,0 +1,106 @@
+include "llvm/Option/OptParser.td"
+
+class F: Flag<["--", "-"], name>;
+class S: Separate<["--", "-"], name>;
+
+def version: F<"version">,
+  HelpText<"Prints out the current version number of the LLDB debugger.">;
+def: Flag<["-"], "v">, Alias, HelpText<"Alias for --version">;
+
+def help: F<"help">,
+  HelpText<"Prints out the usage information for the LLDB debugger.">;
+def: Flag<["-"], "h">, Alias, HelpText<"Alias for --help">;
+
+def python_path: F<"python-path">,
+  HelpText<"Prints out the path to the lldb.py file for this version of lldb.">;
+def: Flag<["-"], "P">, Alias, HelpText<"Alias for --python-path">;
+
+def batch: F<"batch">,
+  HelpText<"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.">;
+def: Flag<["-"], "b">, Alias, HelpText<"Alias for --batch">;
+
+def core: F<"core">,
+  HelpText<"Tells the debugger to use the full path to  as the core file.">;
+def: Flag<["-"], "c">, Alias, HelpText<"Alias for --core">;
+
+def editor: F<"editor">,
+  HelpText<"Tells the debugger to open source files using the host's \"external editor\" mechanism.">;
+def: Flag<["-"], "e">, Alias, HelpText<"Alias for --editor">;
+
+def no_lldbinit: F<"no-lldbinit">,
+  HelpText<"Do not automatically parse any '.lldbinit' files.">;
+def: Flag<["-"], "x">, Alias, HelpText<"Alias for --no-lldbinit">;
+
+def no_use_colors: F<"no-use-colors">,
+  HelpText<"Do not use colors.">;
+def: Flag<["-"], "X">, Alias, HelpText<"Alias for --no-use-color">;
+
+def file: Separate<["--", "-"], "file">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the file  as the program to be debugged.">;
+def: Separate<["-"], "f">, Alias, HelpText<"Alias for --file">;
+
+def arch: Separate<["--", "-"], "arch">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the specified architecture when starting and running the program.">;
+def: Separate<["-"], "a">, Alias, HelpText<"Alias for --arch">;
+
+def script_language: Separate<["--", "-"], "script-language">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the specified scripting language for user-defined scripts.">;
+def: Separate<["-"], "l">, Alias, HelpText<"Alias for --script-language">;
+
+def debug: F<"debug">,
+  HelpText<"Tells the debugger to print out extra information for debugging itself.">;
+def: Flag<["-"], "d">, Alias, HelpText<"Alias for --debug">;
+
+def reproducer: Separate<["--", "-"], "reproducer">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the fullpath to  as a reproducer.">;
+def: Separate<["-"], "z">, Alias, HelpText<"Alias for --reproducer">;
+
+def source_quietly: F<"source-quietly">,
+  HelpText<"Tells the debugger to execute this one-line lldb command before any file has been loaded.">;
+def: Flag<["-"], "Q">, Alias, HelpText<"Alias for --source-quietly">;
+
+def attach_name: Separate<["--", "-"], "attach-name">, MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given name.">;
+def: Separate<["-"], "n">, Alias, HelpText<"Alias for --attach-name">;
+
+def wait_for: F<"wait-for">,
+  HelpText<"Tells the debugger to wait for a process with the given pid or name to launch before attaching.">;
+def: Flag<["-"], "w">, Alias, HelpText<"Alias for --wait-for">;
+
+def attach_pid: Separate<["--", "-"], "attach-pid">, MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given pid.">;
+def: Separate<["-"], "p">, Alias, HelpText<"Alias for --attach-pid">;
+
+def repl: Separate<["--", "-"], "repl">,
+  HelpText<"Runs lldb in REPL mode with a stub process.">;
+def: Separate<["-"], "r">, Alias, HelpText<"Alias for --repl">;
+
+def repl_language: Separate<["--", "-"], "repl-language">, MetaVarName<"">,
+  HelpText<"Chooses the language for the REPL.">;
+def: Separate<["-"], "R">, Alias, HelpText<"Alias for --repl-language">;
+
+def source_on_crash: Separate<["--", "-"], "source-on-crash">, MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">;
+def: Separate<["-"], "K">, Alias, HelpText<"Alias for --source-on-crash">;
+
+def one_line_on_crash: Separate<["--", "-"], "one-line-on-crash">, MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">;
+def: Separate<["-"], "k">, Alias, HelpText<"Alias for --one-line-on-crash">;
+
+def source: Separate<["--", "-"], "source">, MetaVarName<"">,
+  HelpText<"Tells the debugger to read in and execute the lldb commands in 

[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Can we still group the options as mentioned in my previous comment?




Comment at: tools/driver/Driver.cpp:943
+usage << '\n';
+usage << argv[0] << " -h" << '\n';
+usage << argv[0] << " -v [[--]  [ ...]]\n";

Get file base name of this so we don't show a full path to the tool if the user 
used the full path?


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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I know cl::opt had ways to group options and the table gen is more powerful so 
it must have this feature?


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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

I didn't read the patch in detail yet, these are just meta-comments:

It looks like the libOption approach (or this implementation of it) is missing 
the notion of option groups.  That's what you see in the first section of the 
lldb --help printout in the current version.  That's not that big a deal for 
the lldb driver command, as it doesn't have all that many disparate groups of 
options.  But Davide mentioned using this for the lldb command line as well, 
where we do use this to help auto-validate complex commands in a fair number of 
commands.

One thing that is missing from the SB API's was some way of defining the 
arguments and options for a command.  Because of this, Python based commands 
can't take part in the completions features and auto-help generation that 
"real" commands had.  If we had such a thing, then the driver could use the 
same mechanism to define itself as a command, and then just run itself at 
startup.  That would centralize all the argument parsing that we do regardless 
of how it is backed.


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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 175319.
JDevlieghere added a comment.

- Add grouping
- Use basename for help


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

https://reviews.llvm.org/D54692

Files:
  tools/driver/CMakeLists.txt
  tools/driver/Driver.cpp
  tools/driver/Driver.h
  tools/driver/Options.td

Index: tools/driver/Options.td
===
--- /dev/null
+++ tools/driver/Options.td
@@ -0,0 +1,217 @@
+include "llvm/Option/OptParser.td"
+
+class F: Flag<["--", "-"], name>;
+class S: Separate<["--", "-"], name>;
+
+
+// Attaching options.
+def grp_attach : OptionGroup<"attaching">, HelpText<"ATTACHING">;
+
+def attach_name: Separate<["--", "-"], "attach-name">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given name.">,
+  Group;
+def: Separate<["-"], "n">,
+  Alias,
+  HelpText<"Alias for --attach-name">,
+  Group;
+
+def wait_for: F<"wait-for">,
+  HelpText<"Tells the debugger to wait for a process with the given pid or name to launch before attaching.">,
+  Group;
+def: Flag<["-"], "w">,
+  Alias,
+  HelpText<"Alias for --wait-for">,
+  Group;
+
+def attach_pid: Separate<["--", "-"], "attach-pid">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given pid.">,
+  Group;
+def: Separate<["-"], "p">,
+  Alias,
+  HelpText<"Alias for --attach-pid">,
+  Group;
+
+
+// Scripting options.
+def grp_scripting : OptionGroup<"scripting">, HelpText<"SCRIPTING">;
+
+def python_path: F<"python-path">,
+  HelpText<"Prints out the path to the lldb.py file for this version of lldb.">,
+  Group;
+def: Flag<["-"], "P">,
+  Alias,
+  HelpText<"Alias for --python-path">,
+  Group;
+
+def script_language: Separate<["--", "-"], "script-language">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the specified scripting language for user-defined scripts.">,
+  Group;
+def: Separate<["-"], "l">,
+  Alias,
+  HelpText<"Alias for --script-language">,
+  Group;
+
+// Repl options.
+def grp_repl : OptionGroup<"repl">, HelpText<"REPL">;
+
+def repl: Separate<["--", "-"], "repl">,
+  HelpText<"Runs lldb in REPL mode with a stub process.">,
+  Group;
+def: Separate<["-"], "r">,
+  Alias,
+  HelpText<"Alias for --repl">,
+  Group;
+
+def repl_language: Separate<["--", "-"], "repl-language">,
+  MetaVarName<"">,
+  HelpText<"Chooses the language for the REPL.">,
+  Group;
+def: Separate<["-"], "R">,
+  Alias,
+  HelpText<"Alias for --repl-language">,
+  Group;
+
+
+// Command options.
+def grp_command : OptionGroup<"command">, HelpText<"COMMANDS">;
+
+def no_lldbinit: F<"no-lldbinit">,
+  HelpText<"Do not automatically parse any '.lldbinit' files.">,
+  Group;
+def: Flag<["-"], "x">,
+  Alias,
+  HelpText<"Alias for --no-lldbinit">,
+  Group;
+
+def batch: F<"batch">,
+  HelpText<"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.">,
+  Group;
+def: Flag<["-"], "b">,
+  Alias,
+  HelpText<"Alias for --batch">,
+  Group;
+
+def source_quietly: F<"source-quietly">,
+  HelpText<"Tells the debugger to execute this one-line lldb command before any file has been loaded.">,
+  Group;
+def: Flag<["-"], "Q">,
+  Alias,
+  HelpText<"Alias for --source-quietly">,
+  Group;
+
+def one_line_on_crash: Separate<["--", "-"], "one-line-on-crash">,
+  MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
+  Group;
+def: Separate<["-"], "k">,
+  Alias,
+  HelpText<"Alias for --one-line-on-crash">,
+  Group;
+
+def source_on_crash: Separate<["--", "-"], "source-on-crash">,
+  MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
+  Group;
+def: Separate<["-"], "K">,
+  Alias,
+  HelpText<"Alias for --source-on-crash">,
+  Group;
+
+def source: Separate<["--", "-"], "source">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.">,
+  Group;
+def: Separate<["-"], "s">,
+  Alias,
+  HelpText<"Alias for --source">,
+  Group;
+
+def source_before_file: Separate<["--", "-"], "source-before-file">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.">,
+  Group;
+def: Separate<["-"], "S">,
+  Alias,
+  HelpText<"Alias for --source-before-file">,
+  Group;
+
+def one_line: Separate<["--", "-"], "one-line">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.">,
+  Group;
+def: Separate<["-"], "o">,
+  Alias,
+  HelpText<"Alias for --one-line">,
+  Group;
+
+def one_line_before_file: Separate<["--", "-"], "one-line-before-file">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to execute this one-line lldb command before any file provided

[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Can you attach new output with the grouping and extra usage?


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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D54692#1308604 , @clayborg wrote:

> Can you attach new output with the grouping and extra usage?


I updated the original snippet, see https://reviews.llvm.org/P8118


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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I would wait to get another OK from anyone else just to be sure.


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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D54692#1308640 , @clayborg wrote:

> I would wait to get another OK from anyone else just to be sure.


Sounds good. Thanks Greg!


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

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

2018-11-26 Thread Zachary Turner via Phabricator via lldb-commits
zturner created this revision.
zturner added reviewers: rnk, davide, stella.stamenova, labath, vsk, aprantl.

This is an alternative approach to D54731 .  
Instead of allow the user to invoke arbitrary python code directly from inside 
of a test, this patch adds a python script called `build.py` which we can use 
the existing substitution system for.  For example, we could write something 
like:

  RUN: %build --arch=32 --source=%p/Inputs/foo.cpp --output=%t.exe 
--mode=compile-and-link

Currently, the build script requires you to pass an explicit compiler, so you 
would need to pass something like `--compiler=path/to/clang++`, and it will 
fail without this.  So this isn't quite ready for immediate use.  We need to 
figure out how to get that compiler from CMake into this script.  Maybe it 
means bringing back `LLDB_TEST_COMPILER` (sigh).  Maybe it means auto-detecting 
the most appropriate compiler by looking in the tools dir, perhaps with 
something like an additional command line `--find-toolchain=msvc` or 
`--find-toolchain=clang`.

We have some tests right now that require MSVC, so while we can always just 
keep using a cl.exe command line, it would be nice to be able to port these 
over and say something like

  RUN: %build --find-toolchain=msvc --arch=32 --source=%p/Inputs/foo.cpp 
--output=%t.exe --find-toolchain=msvc --mode=compile-and-link

For now though, I've tested this on the command line with an explicit 
`--compiler` option, and it works with clang-cl + lld-link as well as cl.exe + 
link.exe, using both Python 2 and Python 3.

I have not implemented the GCC/clang builder yet, although I plan to do that in 
followups.

Note that at least for Windows, this new builder is significantly better than 
our existing method of using run lines, because it has advanced toolchain 
detection logic.  Our existing scripts fail when being run from inside of 
Visual Studio and they also don't allow building an explicit architecture for 
technical reasons, but with this method we can support both.


https://reviews.llvm.org/D54914

Files:
  lldb/lit/helper/build.py
  lldb/lit/helper/toolchain.py

Index: lldb/lit/helper/toolchain.py
===
--- lldb/lit/helper/toolchain.py
+++ lldb/lit/helper/toolchain.py
@@ -1,4 +1,5 @@
 import os
+import itertools
 import platform
 import subprocess
 import sys
@@ -19,6 +20,8 @@
command=FindTool('lldb-mi'),
extra_args=['--synchronous'],
unresolved='ignore')
+build_script = os.path.dirname(__file__)
+build_script = os.path.join(compile_script, 'build.py')
 primary_tools = [
 ToolSubst('%lldb',
   command=FindTool('lldb'),
@@ -30,7 +33,10 @@
   command=FindTool(dsname),
   extra_args=dsargs,
   unresolved='ignore'),
-'lldb-test'
+'lldb-test',
+ToolSubst('%build',
+  command=sys.executable,
+  extra_args=[build_script])
 ]
 
 llvm_config.add_tool_substitutions(primary_tools,
Index: lldb/lit/helper/build.py
===
--- /dev/null
+++ lldb/lit/helper/build.py
@@ -0,0 +1,595 @@
+from __future__ import print_function
+
+import argparse
+import os
+import signal
+import subprocess
+import sys
+import textwrap
+
+if sys.platform == 'win32':
+# This module was renamed in Python 3.  Make sure to import it using a
+# consistent name regardless of python version.
+try:
+import winreg
+except:
+import _winreg as winreg
+
+if __name__ != "__main__":
+raise RuntimeError("Do not import this script, run it instead")
+
+
+parser = argparse.ArgumentParser(description='LLDB compilation wrapper')
+parser.add_argument('--arch',
+metavar='arch',
+dest='arch',
+required=True,
+help='Specify the architecture to target.  Valid values=[32,64]')
+
+parser.add_argument('--compiler',
+metavar='compiler',
+dest='compiler',
+required=True,
+help='Path to compiler executable')
+
+if sys.platform == 'darwin':
+parser.add_argument('--apple-sdk',
+metavar='apple_sdk',
+dest='apple_sdk',
+default="macosx",
+help='Specify the name of the Apple SDK (macosx, macosx.internal, iphoneos, iphoneos.internal, or path to SDK) and use the appropriate tools from that SDK\'s toolchain.')
+
+parser.add_argument('--env',
+dest='environment',
+metavar='variable',
+action='append',
+help='Specify an environment variable to set to the given value before invoking the toolchain: --env CXXFLAG

[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

2018-11-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

I personally prefer this approach, if only for the fact that the substitutions 
are more familiar and that this change would be local to lldb.


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

https://reviews.llvm.org/D54914



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


[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

2018-11-26 Thread Zachary Turner via Phabricator via lldb-commits
zturner updated this revision to Diff 175344.
zturner added a comment.
Herald added a subscriber: delcypher.

It turned out to not be super complicated, so I went ahead and made it support 
toolchain auto-detection.  This allows the substitution to bake in a command 
line parameter of `--compiler=any`, so the user doesn't have to specify 
anything when writing the test.  But since subsequent arguments take 
precedence, they can pass `--compiler=clang` or something later and it will 
override the default value.  I also made the arch default to 64 bit.  Finally, 
I updated a test to actually use this to prove that it works.


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

https://reviews.llvm.org/D54914

Files:
  lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
  lldb/lit/helper/build.py
  lldb/lit/helper/toolchain.py
  llvm/utils/lit/lit/llvm/config.py

Index: llvm/utils/lit/lit/llvm/config.py
===
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -33,6 +33,8 @@
 ['cmp.exe', 'grep.exe', 'sed.exe'])
 if path is not None:
 self.with_environment('PATH', path, append_path=True)
+# Many tools behave strangely if these environment variables aren't set.
+self.with_system_environment(['SystemDrive', 'SystemRoot', 'TEMP', 'TMP'])
 self.use_lit_shell = True
 
 # Choose between lit's internal shell pipeline runner and a real shell.  If
Index: lldb/lit/helper/toolchain.py
===
--- lldb/lit/helper/toolchain.py
+++ lldb/lit/helper/toolchain.py
@@ -1,4 +1,5 @@
 import os
+import itertools
 import platform
 import subprocess
 import sys
@@ -19,6 +20,15 @@
command=FindTool('lldb-mi'),
extra_args=['--synchronous'],
unresolved='ignore')
+build_script = os.path.dirname(__file__)
+build_script = os.path.join(build_script, 'build.py')
+build_script_args = [build_script, 
+'--compiler=any', # Default to best compiler
+'--arch=64'] # Default to 64-bit, user can override
+if config.lldb_lit_tools_dir:
+build_script_args.append('--tools-dir={0}'.format(config.lldb_lit_tools_dir))
+if config.lldb_tools_dir:
+build_script_args.append('--tools-dir={0}'.format(config.lldb_tools_dir))
 primary_tools = [
 ToolSubst('%lldb',
   command=FindTool('lldb'),
@@ -30,7 +40,10 @@
   command=FindTool(dsname),
   extra_args=dsargs,
   unresolved='ignore'),
-'lldb-test'
+'lldb-test',
+ToolSubst('%build',
+  command=sys.executable,
+  extra_args=build_script_args)
 ]
 
 llvm_config.add_tool_substitutions(primary_tools,
Index: lldb/lit/helper/build.py
===
--- /dev/null
+++ lldb/lit/helper/build.py
@@ -0,0 +1,638 @@
+from __future__ import print_function
+
+import argparse
+import os
+import signal
+import subprocess
+import sys
+import textwrap
+
+if sys.platform == 'win32':
+# This module was renamed in Python 3.  Make sure to import it using a
+# consistent name regardless of python version.
+try:
+import winreg
+except:
+import _winreg as winreg
+
+if __name__ != "__main__":
+raise RuntimeError("Do not import this script, run it instead")
+
+
+parser = argparse.ArgumentParser(description='LLDB compilation wrapper')
+parser.add_argument('--arch',
+metavar='arch',
+dest='arch',
+required=True,
+help='Specify the architecture to target.  Valid values=[32,64]')
+
+parser.add_argument('--compiler',
+metavar='compiler',
+dest='compiler',
+required=True,
+help='Path to a compiler executable, or one of the values [any, msvc, clang-cl, gcc, clang]')
+
+parser.add_argument('--tools-dir',
+metavar='directory',
+dest='tools_dir',
+required=False,
+action='append',
+help='If specified, a path to search in addition to PATH when --compiler is not an exact path')
+
+if sys.platform == 'darwin':
+parser.add_argument('--apple-sdk',
+metavar='apple_sdk',
+dest='apple_sdk',
+default="macosx",
+help='Specify the name of the Apple SDK (macosx, macosx.internal, iphoneos, iphoneos.internal, or path to SDK) and use the appropriate tools from that SDK\'s toolchain.')
+
+parser.add_argument('--env',
+dest='environment'

Re: [Lldb-commits] [lldb] r347305 - [CMake] Streamline code signing for debugserver and pass entitlements to extended llvm_codesign

2018-11-26 Thread Davide Italiano via lldb-commits
On Tue, Nov 20, 2018 at 6:13 AM Stefan Granitz via lldb-commits
 wrote:
>
> Author: stefan.graenitz
> Date: Tue Nov 20 06:10:33 2018
> New Revision: 347305
>
> URL: http://llvm.org/viewvc/llvm-project?rev=347305&view=rev
> Log:
> [CMake] Streamline code signing for debugserver and pass entitlements to 
> extended llvm_codesign
>

This broke the lldb-server tests, at least on MacOS.

Example:

ERROR: test_written_M_content_reads_back_correctly_debugserver
(TestLldbGdbServer.LldbGdbServerTestCase)

--

Traceback (most recent call last):
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
line 143, in wrapper
func(*args, **kwargs)
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py",
line 1389, in test_written_M_content_reads_back_correctly_debugserver
self.written_M_content_reads_back_correctly()
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py",
line 1333, in written_M_content_reads_back_correctly
"print-message:"])
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py",
line 568, in prep_debug_monitor_and_inferior
server = self.connect_to_debug_monitor(attach_pid=attach_pid)
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py",
line 403, in connect_to_debug_monitor
server = self.launch_debug_monitor(attach_pid=attach_pid)
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py",
line 389, in launch_debug_monitor
install_remote=False)
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
line 890, in spawnSubprocess
proc.launch(executable, args)
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
line 323, in launch
stdin=PIPE)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
line 710, in __init__
errread, errwrite)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Config=x86_64-/Users/davide/work/llvm-project-20170507/build-rel/bin/clang-8
--

Ran 65 tests in 29.425s


I'm going to revert this for now. In order to reproduce, just run
`ninja check-lldb`.
I believe you didn't hit this because there were other three issues
piling up, but don't hesitate to ping me in case you can't repro this
locally.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r347615 - [FileSystem] Ignore nanoseconds when comparing oso_mod_time

2018-11-26 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Mon Nov 26 15:40:52 2018
New Revision: 347615

URL: http://llvm.org/viewvc/llvm-project?rev=347615&view=rev
Log:
[FileSystem] Ignore nanoseconds when comparing oso_mod_time

After a recent change in LLVM the TimePoint encoding become more
precise, exceeding the precision of the TimePoint obtained from the
DebugMap. This patch adds a flag to the GetModificationTime helper in
the FileSystem to return the modification time with less precision.

Thanks to Davide for bisecting this failure on the LLDB bots.

Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/source/Host/common/FileSystem.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=347615&r1=347614&r2=347615&view=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Mon Nov 26 15:40:52 2018
@@ -56,8 +56,12 @@ public:
 
   /// Returns the modification time of the given file.
   /// @{
-  llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const;
-  llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine &path) const;
+  llvm::sys::TimePoint<>
+  GetModificationTime(const FileSpec &file_spec,
+  bool nanosecond_precision = true) const;
+  llvm::sys::TimePoint<>
+  GetModificationTime(const llvm::Twine &path,
+  bool nanosecond_precision = true) const;
   /// @}
 
   /// Returns the on-disk size of the given file in bytes.

Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=347615&r1=347614&r2=347615&view=diff
==
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Mon Nov 26 15:40:52 2018
@@ -64,15 +64,22 @@ Optional &FileSystem::Instan
 }
 
 sys::TimePoint<>
-FileSystem::GetModificationTime(const FileSpec &file_spec) const {
-  return GetModificationTime(file_spec.GetPath());
+FileSystem::GetModificationTime(const FileSpec &file_spec,
+bool nanosecond_precision) const {
+  return GetModificationTime(file_spec.GetPath(), nanosecond_precision);
 }
 
-sys::TimePoint<> FileSystem::GetModificationTime(const Twine &path) const {
+sys::TimePoint<>
+FileSystem::GetModificationTime(const Twine &path,
+bool nanosecond_precision) const {
   ErrorOr status = m_fs->status(path);
   if (!status)
 return sys::TimePoint<>();
-  return status->getLastModificationTime();
+  if (nanosecond_precision)
+return status->getLastModificationTime();
+  else
+return std::chrono::time_point_cast(
+status->getLastModificationTime());
 }
 
 uint64_t FileSystem::GetByteSize(const FileSpec &file_spec) const {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=347615&r1=347614&r2=347615&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Mon 
Nov 26 15:40:52 2018
@@ -420,7 +420,8 @@ Module *SymbolFileDWARFDebugMap::GetModu
   FileSpec oso_file(oso_path);
   ConstString oso_object;
   if (FileSystem::Instance().Exists(oso_file)) {
-auto oso_mod_time = 
FileSystem::Instance().GetModificationTime(oso_file);
+auto oso_mod_time = FileSystem::Instance().GetModificationTime(
+oso_file, /*nanosecond_precision=*/false);
 if (oso_mod_time != comp_unit_info->oso_mod_time) {
   obj_file->GetModule()->ReportError(
   "debug map object file '%s' has changed (actual time is "


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


[Lldb-commits] [lldb] r347619 - Revert "[CMake] Streamline code signing for debugserver and pass entitlements to extended llvm_codesign"

2018-11-26 Thread Davide Italiano via lldb-commits
Author: davide
Date: Mon Nov 26 16:25:49 2018
New Revision: 347619

URL: http://llvm.org/viewvc/llvm-project?rev=347619&view=rev
Log:
Revert "[CMake] Streamline code signing for debugserver and pass entitlements 
to extended llvm_codesign"

It breaks the lldb cmake bots.

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

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=347619&r1=347618&r2=347619&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Mon Nov 26 16:25:49 2018
@@ -11,12 +11,6 @@ include(LLDBStandalone)
 include(LLDBConfig)
 include(AddLLDB)
 
-option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)
-if(LLDB_CODESIGN_IDENTITY)
-  # In the future we may use LLVM_CODESIGNING_IDENTITY directly.
-  set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY})
-endif()
-
 # Define the LLDB_CONFIGURATION_xxx matching the build type
 if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
   add_definitions( -DLLDB_CONFIGURATION_DEBUG )

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=347619&r1=347618&r2=347619&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Mon Nov 26 16:25:49 2018
@@ -100,13 +100,13 @@ endfunction(add_lldb_library)
 function(add_lldb_executable name)
   cmake_parse_arguments(ARG
 "INCLUDE_IN_SUITE;GENERATE_INSTALL"
-"ENTITLEMENTS"
+""
 "LINK_LIBS;LINK_COMPONENTS"
 ${ARGN}
 )
 
   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})
 
   target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
   set_target_properties(${name} PROPERTIES

Modified: lldb/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=347619&r1=347618&r2=347619&view=diff
==
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Mon Nov 26 16:25:49 2018
@@ -93,11 +93,11 @@ if (NOT "${LLDB_LIT_TOOLS_DIR}" STREQUAL
   endif()
 endif()
 
-if(CMAKE_HOST_APPLE AND DEBUGSERVER_PATH)
+if(CMAKE_HOST_APPLE)
   list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH})
 endif()
 
-if(SKIP_TEST_DEBUGSERVER)
+if(SKIP_DEBUGSERVER)
   list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
 endif()
 

Modified: lldb/trunk/tools/debugserver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/CMakeLists.txt?rev=347619&r1=347618&r2=347619&view=diff
==
--- lldb/trunk/tools/debugserver/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/CMakeLists.txt Mon Nov 26 16:25:49 2018
@@ -8,18 +8,12 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
 "${CMAKE_SOURCE_DIR}/../../cmake"
 "${CMAKE_SOURCE_DIR}/../../cmake/modules"
 )
-
+  
   include(LLDBStandalone)
   include(AddLLDB)
 
   set(LLDB_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../")
   include_directories(${LLDB_SOURCE_DIR}/include)
-
-  option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if 
available" ON)
-  if(LLDB_CODESIGN_IDENTITY)
-# In the future we may use LLVM_CODESIGNING_IDENTITY directly.
-set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY})
-  endif()
 endif()
 
 add_subdirectory(source)

Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=347619&r1=347618&r2=347619&view=diff
==
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Mon Nov 26 16:25:49 2018
@@ -94,102 +94,32 @@ set(lldbDebugserverCommonSources
 
 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)
 
-# 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()
+set(LLDB_CODESIGN_IDENTITY "lldb_codesign"
+  CACHE STRING "Identity used for code signing. 

Re: [Lldb-commits] [lldb] r347305 - [CMake] Streamline code signing for debugserver and pass entitlements to extended llvm_codesign

2018-11-26 Thread Davide Italiano via lldb-commits
Reverted in r347619.

--
Davide
On Mon, Nov 26, 2018 at 3:34 PM Davide Italiano  wrote:
>
> On Tue, Nov 20, 2018 at 6:13 AM Stefan Granitz via lldb-commits
>  wrote:
> >
> > Author: stefan.graenitz
> > Date: Tue Nov 20 06:10:33 2018
> > New Revision: 347305
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=347305&view=rev
> > Log:
> > [CMake] Streamline code signing for debugserver and pass entitlements to 
> > extended llvm_codesign
> >
>
> This broke the lldb-server tests, at least on MacOS.
>
> Example:
>
> ERROR: test_written_M_content_reads_back_correctly_debugserver
> (TestLldbGdbServer.LldbGdbServerTestCase)
>
> --
>
> Traceback (most recent call last):
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
> line 143, in wrapper
> func(*args, **kwargs)
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py",
> line 1389, in test_written_M_content_reads_back_correctly_debugserver
> self.written_M_content_reads_back_correctly()
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py",
> line 1333, in written_M_content_reads_back_correctly
> "print-message:"])
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py",
> line 568, in prep_debug_monitor_and_inferior
> server = self.connect_to_debug_monitor(attach_pid=attach_pid)
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py",
> line 403, in connect_to_debug_monitor
> server = self.launch_debug_monitor(attach_pid=attach_pid)
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py",
> line 389, in launch_debug_monitor
> install_remote=False)
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
> line 890, in spawnSubprocess
> proc.launch(executable, args)
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
> line 323, in launch
> stdin=PIPE)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
> line 710, in __init__
> errread, errwrite)
>   File 
> "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",
> line 1335, in _execute_child
> raise child_exception
> OSError: [Errno 2] No such file or directory
> Config=x86_64-/Users/davide/work/llvm-project-20170507/build-rel/bin/clang-8
> --
>
> Ran 65 tests in 29.425s
>
>
> I'm going to revert this for now. In order to reproduce, just run
> `ninja check-lldb`.
> I believe you didn't hit this because there were other three issues
> piling up, but don't hesitate to ping me in case you can't repro this
> locally.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

2018-11-26 Thread Zachary Turner via Phabricator via lldb-commits
zturner updated this revision to Diff 175366.
zturner added a comment.

I went ahead and fixed up the rest of the native pdb tests.  This exposed a 
couple of minor issues with the build script which I also fixed in the process.

@stella.stamenova would you mind giving this a try?  I think it will fix all 
your problems of running tests from inside of Visual Studio.

@aleksandr.urakov Would you also mind giving this a try?  I think it will mean 
that you can re-write the SymbolFile/PDB tests to not be dependent on running 
from a VS command prompt.  You should be able to pass --arch=32 or --arch=64 no 
matter which command prompt you are running from, and it should still work.


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

https://reviews.llvm.org/D54914

Files:
  lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
  lldb/lit/SymbolFile/NativePDB/bitfields.cpp
  lldb/lit/SymbolFile/NativePDB/disassembly.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp
  lldb/lit/SymbolFile/NativePDB/global-classes.cpp
  lldb/lit/SymbolFile/NativePDB/globals-bss.cpp
  lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp
  lldb/lit/SymbolFile/NativePDB/nested-types.cpp
  lldb/lit/SymbolFile/NativePDB/s_constant.cpp
  lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
  lldb/lit/SymbolFile/NativePDB/source-list.cpp
  lldb/lit/SymbolFile/NativePDB/tag-types.cpp
  lldb/lit/helper/build.py
  lldb/lit/helper/toolchain.py
  llvm/utils/lit/lit/llvm/config.py

Index: llvm/utils/lit/lit/llvm/config.py
===
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -33,6 +33,8 @@
 ['cmp.exe', 'grep.exe', 'sed.exe'])
 if path is not None:
 self.with_environment('PATH', path, append_path=True)
+# Many tools behave strangely if these environment variables aren't set.
+self.with_system_environment(['SystemDrive', 'SystemRoot', 'TEMP', 'TMP'])
 self.use_lit_shell = True
 
 # Choose between lit's internal shell pipeline runner and a real shell.  If
Index: lldb/lit/helper/toolchain.py
===
--- lldb/lit/helper/toolchain.py
+++ lldb/lit/helper/toolchain.py
@@ -1,4 +1,5 @@
 import os
+import itertools
 import platform
 import subprocess
 import sys
@@ -19,6 +20,15 @@
command=FindTool('lldb-mi'),
extra_args=['--synchronous'],
unresolved='ignore')
+build_script = os.path.dirname(__file__)
+build_script = os.path.join(build_script, 'build.py')
+build_script_args = [build_script, 
+'--compiler=any', # Default to best compiler
+'--arch=64'] # Default to 64-bit, user can override
+if config.lldb_lit_tools_dir:
+build_script_args.append('--tools-dir={0}'.format(config.lldb_lit_tools_dir))
+if config.lldb_tools_dir:
+build_script_args.append('--tools-dir={0}'.format(config.lldb_tools_dir))
 primary_tools = [
 ToolSubst('%lldb',
   command=FindTool('lldb'),
@@ -30,7 +40,10 @@
   command=FindTool(dsname),
   extra_args=dsargs,
   unresolved='ignore'),
-'lldb-test'
+'lldb-test',
+ToolSubst('%build',
+  command=sys.executable,
+  extra_args=build_script_args)
 ]
 
 llvm_config.add_tool_substitutions(primary_tools,
Index: lldb/lit/helper/build.py
===
--- /dev/null
+++ lldb/lit/helper/build.py
@@ -0,0 +1,648 @@
+from __future__ import print_function
+
+import argparse
+import os
+import signal
+import subprocess
+import sys
+
+if sys.platform == 'win32':
+# This module was renamed in Python 3.  Make sure to import it using a
+# consistent name regardless of python version.
+try:
+import winreg
+except:
+import _winreg as winreg
+
+if __name__ != "__main__":
+raise RuntimeError("Do not import this script, run it instead")
+
+
+parser = argparse.ArgumentParser(description='LLDB compilation wrapper')
+parser.add_argument('--arch',
+metavar='arch',
+dest='arch',
+required=True,
+help='Specify the architecture to target.  Valid values=[32,64]')
+
+parser.add_argument('--compiler',
+metavar='compiler',
+dest='compiler',
+required=True,
+help='Path to a compiler executable, or one of the values [any, msvc, clang-cl, gcc, clang]')
+
+parser.add_argument('--tools-dir',
+metavar

[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 175377.
JDevlieghere added a comment.

Will land this tomorrow once we've figured out how to integrate tablegen with 
the Xcode project.

In the meantime I found some issues due to ordering of command options. Their 
relative order matters and we had tests relying on this. For example consider 
what happens when you say

  lldb -o 'do one thing' -s 'source/some/file'

You'd expect that the one-line is executed before sourcing the file. This 
wasn't the case with the previous version of this patch and is now fixed.


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

https://reviews.llvm.org/D54692

Files:
  tools/driver/CMakeLists.txt
  tools/driver/Driver.cpp
  tools/driver/Driver.h
  tools/driver/Options.td

Index: tools/driver/Options.td
===
--- /dev/null
+++ tools/driver/Options.td
@@ -0,0 +1,218 @@
+include "llvm/Option/OptParser.td"
+
+class F: Flag<["--", "-"], name>;
+class S: Separate<["--", "-"], name>;
+class R prefixes, string name>
+  : Option;
+
+// Attaching options.
+def grp_attach : OptionGroup<"attaching">, HelpText<"ATTACHING">;
+
+def attach_name: Separate<["--", "-"], "attach-name">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given name.">,
+  Group;
+def: Separate<["-"], "n">,
+  Alias,
+  HelpText<"Alias for --attach-name">,
+  Group;
+
+def wait_for: F<"wait-for">,
+  HelpText<"Tells the debugger to wait for a process with the given pid or name to launch before attaching.">,
+  Group;
+def: Flag<["-"], "w">,
+  Alias,
+  HelpText<"Alias for --wait-for">,
+  Group;
+
+def attach_pid: Separate<["--", "-"], "attach-pid">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given pid.">,
+  Group;
+def: Separate<["-"], "p">,
+  Alias,
+  HelpText<"Alias for --attach-pid">,
+  Group;
+
+
+// Scripting options.
+def grp_scripting : OptionGroup<"scripting">, HelpText<"SCRIPTING">;
+
+def python_path: F<"python-path">,
+  HelpText<"Prints out the path to the lldb.py file for this version of lldb.">,
+  Group;
+def: Flag<["-"], "P">,
+  Alias,
+  HelpText<"Alias for --python-path">,
+  Group;
+
+def script_language: Separate<["--", "-"], "script-language">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the specified scripting language for user-defined scripts.">,
+  Group;
+def: Separate<["-"], "l">,
+  Alias,
+  HelpText<"Alias for --script-language">,
+  Group;
+
+// Repl options.
+def grp_repl : OptionGroup<"repl">, HelpText<"REPL">;
+
+def repl: Separate<["--", "-"], "repl">,
+  HelpText<"Runs lldb in REPL mode with a stub process.">,
+  Group;
+def: Separate<["-"], "r">,
+  Alias,
+  HelpText<"Alias for --repl">,
+  Group;
+
+def repl_language: Separate<["--", "-"], "repl-language">,
+  MetaVarName<"">,
+  HelpText<"Chooses the language for the REPL.">,
+  Group;
+def: Separate<["-"], "R">,
+  Alias,
+  HelpText<"Alias for --repl-language">,
+  Group;
+
+
+// Command options.
+def grp_command : OptionGroup<"command">, HelpText<"COMMANDS">;
+
+def no_lldbinit: F<"no-lldbinit">,
+  HelpText<"Do not automatically parse any '.lldbinit' files.">,
+  Group;
+def: Flag<["-"], "x">,
+  Alias,
+  HelpText<"Alias for --no-lldbinit">,
+  Group;
+
+def batch: F<"batch">,
+  HelpText<"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.">,
+  Group;
+def: Flag<["-"], "b">,
+  Alias,
+  HelpText<"Alias for --batch">,
+  Group;
+
+def source_quietly: F<"source-quietly">,
+  HelpText<"Tells the debugger to execute this one-line lldb command before any file has been loaded.">,
+  Group;
+def: Flag<["-"], "Q">,
+  Alias,
+  HelpText<"Alias for --source-quietly">,
+  Group;
+
+def one_line_on_crash: Separate<["--", "-"], "one-line-on-crash">,
+  MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
+  Group;
+def: Separate<["-"], "k">,
+  Alias,
+  HelpText<"Alias for --one-line-on-crash">,
+  Group;
+
+def source_on_crash: Separate<["--", "-"], "source-on-crash">,
+  MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
+  Group;
+def: Separate<["-"], "K">,
+  Alias,
+  HelpText<"Alias for --source-on-crash">,
+  Group;
+
+def source: Separate<["--", "-"], "source">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.">,
+  Group;
+def: Separate<["-"], "s">,
+  Alias,
+  HelpText<"Alias for --source">,
+  Group;
+
+def source_before_file: Separate<["--", "-"], "source-before-file">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.">,
+  Group;
+def: Separate<["-"], "S">,
+  Alias,
+  HelpText<"Alias for --source-before-file">,
+  Group;
+
+def

[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

You have to gather all the -O's and -S's and -Q's and add them to the list of 
code that gets sourced before the file is loaded in the order in which you find 
them.  There can be more than one of each of these and they can be interspersed 
anywhere among the other command options.  Ditto for the -o's, -s's and -q's 
(except they get run after the file).  I don't know how complicated a set of 
tests I wrote when I originally added these, so you might want to check that 
all these cases are covered.


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

https://reviews.llvm.org/D54692



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


Re: [Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-26 Thread Zachary Turner via lldb-commits
One potentially nice way to test this would be to have all the -O, -o, -S,
-s, -Q, and -q just run "script print(N)" where N is some number that
changes at each line, then FileCheck the output

On Mon, Nov 26, 2018 at 6:38 PM Jim Ingham via Phabricator <
revi...@reviews.llvm.org> wrote:

> jingham added a comment.
>
> You have to gather all the -O's and -S's and -Q's and add them to the list
> of code that gets sourced before the file is loaded in the order in which
> you find them.  There can be more than one of each of these and they can be
> interspersed anywhere among the other command options.  Ditto for the -o's,
> -s's and -q's (except they get run after the file).  I don't know how
> complicated a set of tests I wrote when I originally added these, so you
> might want to check that all these cases are covered.
>
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D54692/new/
>
> https://reviews.llvm.org/D54692
>
>
>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54886: Add support for the Dylan language to ClangASTContext

2018-11-26 Thread Peter S. Housel via Phabricator via lldb-commits
housel updated this revision to Diff 175385.
housel added a comment.

Adds an inline comment about Open Dylan debug info


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

https://reviews.llvm.org/D54886

Files:
  source/Symbol/ClangASTContext.cpp


Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -119,7 +119,9 @@
  language == eLanguageTypeRust ||
  language == eLanguageTypeExtRenderScript ||
  // Use Clang for D until there is a proper language plugin for it
- language == eLanguageTypeD;
+ language == eLanguageTypeD ||
+ // Open Dylan compiler debug info is designed to be Clang-compatible
+ language == eLanguageTypeDylan;
 }
 
 // Checks whether m1 is an overload of m2 (as opposed to an override). This is


Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -119,7 +119,9 @@
  language == eLanguageTypeRust ||
  language == eLanguageTypeExtRenderScript ||
  // Use Clang for D until there is a proper language plugin for it
- language == eLanguageTypeD;
+ language == eLanguageTypeD ||
+ // Open Dylan compiler debug info is designed to be Clang-compatible
+ language == eLanguageTypeDylan;
 }
 
 // Checks whether m1 is an overload of m2 (as opposed to an override). This is
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54886: Add support for the Dylan language to ClangASTContext

2018-11-26 Thread Peter S. Housel via Phabricator via lldb-commits
housel added a comment.

I don't have commit access; could someone land this please? Thanks.


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

https://reviews.llvm.org/D54886



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


[Lldb-commits] [PATCH] D54886: Add support for the Dylan language to ClangASTContext

2018-11-26 Thread Bruce Mitchener via Phabricator via lldb-commits
brucem added a comment.

I can land this today.


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

https://reviews.llvm.org/D54886



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


[Lldb-commits] [PATCH] D54886: Add support for the Dylan language to ClangASTContext

2018-11-26 Thread Peter S. Housel via Phabricator via lldb-commits
housel updated this revision to Diff 175391.
housel added a comment.

Updated against r347619


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

https://reviews.llvm.org/D54886

Files:
  source/Symbol/ClangASTContext.cpp


Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -119,7 +119,9 @@
  language == eLanguageTypeRust ||
  language == eLanguageTypeExtRenderScript ||
  // Use Clang for D until there is a proper language plugin for it
- language == eLanguageTypeD;
+ language == eLanguageTypeD ||
+ // Open Dylan compiler debug info is designed to be Clang-compatible
+ language == eLanguageTypeDylan;
 }
 
 // Checks whether m1 is an overload of m2 (as opposed to an override). This is


Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -119,7 +119,9 @@
  language == eLanguageTypeRust ||
  language == eLanguageTypeExtRenderScript ||
  // Use Clang for D until there is a proper language plugin for it
- language == eLanguageTypeD;
+ language == eLanguageTypeD ||
+ // Open Dylan compiler debug info is designed to be Clang-compatible
+ language == eLanguageTypeDylan;
 }
 
 // Checks whether m1 is an overload of m2 (as opposed to an override). This is
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r347637 - Add support for the Dylan language to ClangASTContext

2018-11-26 Thread Bruce Mitchener via lldb-commits
Author: brucem
Date: Mon Nov 26 21:37:27 2018
New Revision: 347637

URL: http://llvm.org/viewvc/llvm-project?rev=347637&view=rev
Log:
Add support for the Dylan language to ClangASTContext

Summary:
This change adds eLanguageTypeDylan to the set of languages supported
by ClangASTContext. Debug info generated by the Open Dylan compiler's
LLVM back-end was designed to be compatible with C debug info.

Patch by Peter Housel.

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: brucem, lldb-commits, aprantl

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

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=347637&r1=347636&r2=347637&view=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Nov 26 21:37:27 2018
@@ -119,7 +119,9 @@ ClangASTContextSupportsLanguage(lldb::La
  language == eLanguageTypeRust ||
  language == eLanguageTypeExtRenderScript ||
  // Use Clang for D until there is a proper language plugin for it
- language == eLanguageTypeD;
+ language == eLanguageTypeD ||
+ // Open Dylan compiler debug info is designed to be Clang-compatible
+ language == eLanguageTypeDylan;
 }
 
 // Checks whether m1 is an overload of m2 (as opposed to an override). This is


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


[Lldb-commits] [PATCH] D54886: Add support for the Dylan language to ClangASTContext

2018-11-26 Thread Bruce Mitchener via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL347637: Add support for the Dylan language to 
ClangASTContext (authored by brucem, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

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

https://reviews.llvm.org/D54886

Files:
  lldb/trunk/source/Symbol/ClangASTContext.cpp


Index: lldb/trunk/source/Symbol/ClangASTContext.cpp
===
--- lldb/trunk/source/Symbol/ClangASTContext.cpp
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp
@@ -119,7 +119,9 @@
  language == eLanguageTypeRust ||
  language == eLanguageTypeExtRenderScript ||
  // Use Clang for D until there is a proper language plugin for it
- language == eLanguageTypeD;
+ language == eLanguageTypeD ||
+ // Open Dylan compiler debug info is designed to be Clang-compatible
+ language == eLanguageTypeDylan;
 }
 
 // Checks whether m1 is an overload of m2 (as opposed to an override). This is


Index: lldb/trunk/source/Symbol/ClangASTContext.cpp
===
--- lldb/trunk/source/Symbol/ClangASTContext.cpp
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp
@@ -119,7 +119,9 @@
  language == eLanguageTypeRust ||
  language == eLanguageTypeExtRenderScript ||
  // Use Clang for D until there is a proper language plugin for it
- language == eLanguageTypeD;
+ language == eLanguageTypeD ||
+ // Open Dylan compiler debug info is designed to be Clang-compatible
+ language == eLanguageTypeDylan;
 }
 
 // Checks whether m1 is an overload of m2 (as opposed to an override). This is
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits