[Lldb-commits] [PATCH] D70387: [LLDB] [Windows] Allow making subprocesses use the debugger's console with LLDB_INHERIT_CONSOLE=true

2019-11-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D70387#1750578 , @mstorsjo wrote:

> Thanks for the excellent explanations of the situation so far. I'll have a 
> look at how it behaves with input and other aspects of console sharing. You 
> might be right that it can cause some issues, as I did run into cases where 
> the main lldb console UI hung if the lldb-server subprocess crashed (due to 
> unchecked Error), but I didn't realize and correlate this to the 
> inherited/shared console at that time.


You'll probably want to look at the IOHandler classes at some point. The way 
input forwarding works on unixes is that we create a separate IOHandler object 
when the process is running. This object reads the lldb input and forwards it 
to the inferior pty (instead of the "normal" IOHandler, which interprets the 
input as commands to execute). If you'll have the inferior read from the 
console directly, then we don't want to have the forwarding IOHandler there. 
However, we also don't want the "normal" IOHandler to be active, as that will 
race with the inferior in reading the input (I am not sure what windows does in 
these cases). So you may need to create some "fake" IOHandler, which will not 
read anything, but just prevent the regular IOHandler from kicking in.

It's good that you mentioned lldb-server, because it's presence complicates 
this behavior even further. If we wanted the console sharing approach to work, 
then we'd have to have both lldb-server and the inferior launched in the 
console-sharing mode, I presume? This would be quite different from the unix 
scenario where we can just send the pty device name to the lldb-server, and 
have it connect the inferior to that. I'm not entirely sure what that means 
though...

> When passing flags like `--tty` or `--disable-stdio` to `process launch`, is 
> it possible to set a persistent preference for that somehow via e.g. the 
> `.lldbinit` file?

There's a `target.disable-stdio` setting. You could set that in your .lldbinit, 
if you wanted to. I doesn't look like there is a `--tty` equivalent of that, 
but I don't see a problem with adding one.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70387



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


[Lldb-commits] [PATCH] D70417: Accept g packet responses that don't supply all registers

2019-11-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp:215
+struct RegisterInfo *reginfo = 
m_reg_info.GetRegisterInfoAtIndex(i);
+if (reginfo->byte_offset < buffer_sp->GetByteSize()) {
+  m_reg_valid[i] = true;

Should this be something like `reginfo->byte_offset+reg_info->byte_size < ...` ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70417



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


[Lldb-commits] [PATCH] D70381: Mark PR44037 tests as XFAIL on AArch64 Linux dwo

2019-11-19 Thread Diana Picus via Phabricator via lldb-commits
rovka added a subscriber: labath.
rovka added a comment.

In D70381#1749616 , @labath wrote:

> Looks fine to me, but I am not running aarch64 tests. You might want to check 
> of @omjavaid is running them and whether he's ok with that. Otherwise, you 
> can just manage the decorators yourself without any special reviews.


Actually, we have a buildbot on the silent master running them:
http://lab.llvm.org:8014/builders/lldb-aarch64-ubuntu

I'm currently just triaging those failures so we can move the bot to the proper 
master at some point.


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

https://reviews.llvm.org/D70381



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


[Lldb-commits] [PATCH] D70381: Mark PR44037 tests as XFAIL on AArch64 Linux dwo

2019-11-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D70381#1751116 , @rovka wrote:

> In D70381#1749616 , @labath wrote:
>
> > Looks fine to me, but I am not running aarch64 tests. You might want to 
> > check of @omjavaid is running them and whether he's ok with that. 
> > Otherwise, you can just manage the decorators yourself without any special 
> > reviews.
>
>
> Actually, we have a buildbot on the silent master running them:
>  http://lab.llvm.org:8014/builders/lldb-aarch64-ubuntu
>
> I'm currently just triaging those failures so we can move the bot to the 
> proper master at some point.


I know that. AFAIK @omjavaid, is running that, which is why I suggested to 
synchronize with him. It would be awesome if we would have an arm bot stable 
enough to run on master.


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

https://reviews.llvm.org/D70381



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


[Lldb-commits] [PATCH] D70387: [LLDB] [Windows] Allow making subprocesses use the debugger's console with LLDB_INHERIT_CONSOLE=true

2019-11-19 Thread Martin Storsjö via Phabricator via lldb-commits
mstorsjo added a comment.

In D70387#1751090 , @labath wrote:

> It's good that you mentioned lldb-server, because it's presence complicates 
> this behavior even further. If we wanted the console sharing approach to 
> work, then we'd have to have both lldb-server and the inferior launched in 
> the console-sharing mode, I presume? This would be quite different from the 
> unix scenario where we can just send the pty device name to the lldb-server, 
> and have it connect the inferior to that. I'm not entirely sure what that 
> means though...


Yeah, I hadn't really thought much about that initially, and when using the 
environment variable, it was propagated implicitly to lldb-server as well, so 
this aspect worked just as I would have hoped.

>> When passing flags like `--tty` or `--disable-stdio` to `process launch`, is 
>> it possible to set a persistent preference for that somehow via e.g. the 
>> `.lldbinit` file?
> 
> There's a `target.disable-stdio` setting. You could set that in your 
> .lldbinit, if you wanted to. I doesn't look like there is a `--tty` 
> equivalent of that, but I don't see a problem with adding one.

Ok, thanks for the pointers!

So it turns out this is a harder (and messier) thing than I first expected 
(even though my naive fix worked fine for the simplest cases at least). I'm not 
sure if I have time to actually complete this right now, so it might end up on 
the pile of unfinished things for now.

FWIW, I did test with a command line executable that does a loop of 
fgets+printf, to read lines of input and echo them back. This seems very prone 
to hanging; on arm64 I manage to read one line and print it back, before the 
debuggee becomes hung, stuck in some IO write call, and later on (after 
interrupting and resuming it) the debugger itself also seems to easily get 
hung, waiting for some event from the debuggee. On x86_64, the same setup even 
seems to hang even earlier, before managing to type the first line to the 
separate console.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70387



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


[Lldb-commits] [lldb] bb7c8e9 - Mark PR44037 tests as XFAIL on AArch64 Linux dwo

2019-11-19 Thread Diana Picus via lldb-commits

Author: Diana Picus
Date: 2019-11-19T10:49:00+01:00
New Revision: bb7c8e984f87e1de7c80abd33d00025ac366efa6

URL: 
https://github.com/llvm/llvm-project/commit/bb7c8e984f87e1de7c80abd33d00025ac366efa6
DIFF: 
https://github.com/llvm/llvm-project/commit/bb7c8e984f87e1de7c80abd33d00025ac366efa6.diff

LOG: Mark PR44037 tests as XFAIL on AArch64 Linux dwo

These tests are failing with various assertion failures, but they all
throw the following error message first:

error: a.out 0x002d: adding range [0x14-0x24) which has a base that
is less than the function's low PC 0x40060c.

See llvm.org/pr44037.

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

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py

lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py

lldb/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py

lldb/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
index 052b125143f2..1dc12e94eaf6 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -16,17 +16,26 @@ class BreakpointLocationsTestCase(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
+@expectedFailureAll(archs=["aarch64"], oslist=["linux"],
+debug_info=["dwo"],
+bugnumber="llvm.org/pr44037")
 def test_enable(self):
 """Test breakpoint enable/disable for a breakpoint ID with multiple 
locations."""
 self.build()
 self.breakpoint_locations_test()
 
+@expectedFailureAll(archs=["aarch64"], oslist=["linux"],
+debug_info=["dwo"],
+bugnumber="llvm.org/pr44037")
 def test_shadowed_cond_options(self):
 """Test that options set on the breakpoint and location behave 
correctly."""
 self.build()
 self.shadowed_bkpt_cond_test()
 
 
+@expectedFailureAll(archs=["aarch64"], oslist=["linux"],
+debug_info=["dwo"],
+bugnumber="llvm.org/pr44037")
 def test_shadowed_command_options(self):
 """Test that options set on the breakpoint and location behave 
correctly."""
 self.build()

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
 
b/lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
index 311c5ec8e120..1e829901cf11 100644
--- 
a/lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
@@ -6,4 +6,8 @@
   [decorators.expectedFailureAll(compiler="clang",
  compiler_version=["<",

"3.5"],
- 
bugnumber="llvm.org/pr27845")])
+ 
bugnumber="llvm.org/pr27845"),
+   decorators.expectedFailureAll(archs="aarch64",
+ oslist="linux",
+ debug_info="dwo",
+ 
bugnumber="llvm.org/pr44037")])

diff  --git 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
index c07acf9c540d..ac964a35fecb 100644
--- 
a/lldb/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
+++ 
b/lldb/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
@@ -1,4 +1,5 @@
 import lldb
+from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 import lldbsuite.test.lldbutil as lldbutil
 
@@ -7,6 +8,9 @@ class TestMembersAndLocalsWithSameName(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
+@expectedFailureAll(archs=["aarch64"], oslist=["linux"],
+debug_info=["dwo"

[Lldb-commits] [PATCH] D70381: Mark PR44037 tests as XFAIL on AArch64 Linux dwo

2019-11-19 Thread Diana Picus via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb7c8e984f87: Mark PR44037 tests as XFAIL on AArch64 Linux 
dwo (authored by rovka).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70381

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
  
lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
  
lldb/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
  
lldb/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py


Index: 
lldb/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py
===
--- 
lldb/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py
+++ 
lldb/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py
@@ -26,6 +26,9 @@
 self.source, '// This should correspond to the second break stop.')
 
 @add_test_categories(['pyapi'])
+@expectedFailureAll(archs=["aarch64"], oslist=["linux"],
+debug_info=["dwo"],
+bugnumber="llvm.org/pr44037")
 def test_stop_at_outer_inline(self):
 """Exercise SBFrame.IsInlined() and SBFrame.GetFunctionName()."""
 self.build()
Index: 
lldb/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
===
--- 
lldb/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
+++ 
lldb/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
@@ -1,4 +1,5 @@
 import lldb
+from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
 import lldbsuite.test.lldbutil as lldbutil
 
@@ -7,6 +8,9 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
+@expectedFailureAll(archs=["aarch64"], oslist=["linux"],
+debug_info=["dwo"],
+bugnumber="llvm.org/pr44037")
 def test_when_stopped_in_method(self):
 self._load_exe()
 
@@ -109,6 +113,9 @@
 self.assertTrue(val.IsValid())
 self.assertEqual(val.GetValueAsUnsigned(), 778899)
 
+@expectedFailureAll(archs=["aarch64"], oslist=["linux"],
+debug_info=["dwo"],
+bugnumber="llvm.org/pr44037")
 def test_when_stopped_in_function(self):
 self._load_exe()
 
Index: 
lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
===
--- 
lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
+++ 
lldb/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
@@ -6,4 +6,8 @@
   [decorators.expectedFailureAll(compiler="clang",
  compiler_version=["<",

"3.5"],
- 
bugnumber="llvm.org/pr27845")])
+ 
bugnumber="llvm.org/pr27845"),
+   decorators.expectedFailureAll(archs="aarch64",
+ oslist="linux",
+ debug_info="dwo",
+ 
bugnumber="llvm.org/pr44037")])
Index: 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
===
--- 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ 
lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -16,17 +16,26 @@
 mydir = TestBase.compute_mydir(__file__)
 
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24528")
+@expectedFailureAll(archs=["aarch64"], oslist=["linux"],
+debug_info=["dwo"],
+bugnumber="llvm.org/pr44037")
 def test_enable(self):
 """Test breakpoint enable/disable for a breakpoint ID with multiple 
locations."""
 self.build()
 self.breakpoint_locations_test()
 
+@expectedFailureAll(archs=["aarch64"], oslist=["linux"],
+debug_info=["dwo"],
+bugnumber="llvm.org/pr44037")
 def test_shadowed_cond_options(self):
 """Test tha

[Lldb-commits] [PATCH] D63540: Fix lookup of symbols at the same address with no size vs. size

2019-11-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added a comment.

@omjavaid I guess it depends on some system library - what OS vendor/release do 
you have the regression reproducible on?
Still not reproducible for me.  Trying 
`bfbbf0aba81a84da8b53d4d159d080e77ad8ee70` with applied D70155 
 and applied/unapplied this D63540 
 on Fedora 30 armv7l and it has no difference 
in testsuite (except for the added/removed testcase of this D63540 
).
In both cases I get these:

  Unexpected Passing Tests (5):
  lldb-api :: functionalities/archives/TestBSDArchives.py
  lldb-api :: functionalities/inferior-assert/TestInferiorAssert.py
  lldb-api :: 
functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneSignal.py
  lldb-api :: linux/builtin_trap/TestBuiltinTrap.py
  lldb-api :: 
linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
  Failing Tests (103):
  lldb-api :: 
commands/expression/argument_passing_restrictions/TestArgumentPassingRestrictions.py
  lldb-api :: commands/expression/call-function/TestCallStdStringFunction.py
  lldb-api :: commands/expression/call-function/TestCallStopAndContinue.py
  lldb-api :: 
commands/expression/call-function/TestCallUserDefinedFunction.py
  lldb-api :: 
commands/expression/call-overridden-method/TestCallOverriddenMethod.py
  lldb-api :: commands/expression/call-restarts/TestCallThatRestarts.py
  lldb-api :: commands/expression/char/TestExprsChar.py
  lldb-api :: 
commands/expression/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py
  lldb-api :: commands/expression/context-object/TestContextObject.py
  lldb-api :: commands/expression/dont_allow_jit/TestAllowJIT.py
  lldb-api :: commands/expression/entry-bp/TestExprEntryBP.py
  lldb-api :: commands/expression/expr-in-syscall/TestExpressionInSyscall.py
  lldb-api :: commands/expression/formatters/TestFormatters.py
  lldb-api :: commands/expression/inline-namespace/TestInlineNamespace.py
  lldb-api :: commands/expression/no-deadlock/TestExprDoesntBlock.py
  lldb-api :: 
commands/expression/persistent_types/TestNestedPersistentTypes.py
  lldb-api :: commands/expression/persistent_types/TestPersistentTypes.py
  lldb-api :: commands/expression/pr35310/TestExprsBug35310.py
  lldb-api :: commands/expression/radar_9531204/TestPrintfAfterUp.py
  lldb-api :: commands/expression/radar_9673664/TestExprHelpExamples.py
  lldb-api :: commands/expression/rdar44436068/Test128BitsInteger.py
  lldb-api :: 
commands/expression/static-initializers/TestStaticInitializers.py
  lldb-api :: commands/expression/test/TestExprs.py
  lldb-api :: commands/expression/timeout/TestCallWithTimeout.py
  lldb-api :: commands/expression/unwind_expression/TestUnwindExpression.py
  lldb-api :: commands/expression/xvalue/TestXValuePrinting.py
  lldb-api :: commands/register/register/register_command/TestRegisters.py
  lldb-api :: commands/watchpoints/hello_watchlocation/TestWatchLocation.py
  lldb-api :: 
commands/watchpoints/multi_watchpoint_slots/TestWatchpointMultipleSlots.py
  lldb-api :: commands/watchpoints/watchpoint_size/TestWatchpointSizes.py
  lldb-api :: 
functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
  lldb-api :: 
functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
  lldb-api :: 
functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
  lldb-api :: functionalities/load_unload/TestLoadUnload.py
  lldb-api :: functionalities/load_using_paths/TestLoadUsingPaths.py
  lldb-api :: functionalities/memory/find/TestMemoryFind.py
  lldb-api :: functionalities/process_group/TestChangeProcessGroup.py
  lldb-api :: functionalities/return-value/TestReturnValue.py
  lldb-api :: functionalities/show_location/TestShowLocationDwarf5.py
  lldb-api :: functionalities/thread/num_threads/TestNumThreads.py
  lldb-api :: lang/c/bitfields/TestBitfields.py
  lldb-api :: lang/c/function_types/TestFunctionTypes.py
  lldb-api :: lang/c/shared_lib/TestSharedLib.py
  lldb-api :: lang/c/strings/TestCStrings.py
  lldb-api :: lang/c/struct_types/TestStructTypes.py
  lldb-api :: lang/cpp/auto/TestCPPAuto.py
  lldb-api :: lang/cpp/call-function/TestCallCPPFunction.py
  lldb-api :: lang/cpp/chained-calls/TestCppChainedCalls.py
  lldb-api :: 
lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
  lldb-api :: lang/cpp/extern_c/TestExternCSymbols.py
  lldb-api :: lang/cpp/global_operators/TestCppGlobalOperators.py
  lldb-api :: lang/cpp/lambdas/TestLambdas.py
  lldb-api :: lang/cpp/llvm-style/TestLLVMStyle.py
  lldb-api :: lang/cpp/namespace/TestNamespace.py
  lldb-api :: lang/cpp/namespace/TestNamespaceLookup

[Lldb-commits] [lldb] 96d814a - [lldb] Remove ClangExpressionDeclMap::ResolveUnknownTypes

2019-11-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-19T12:44:27+01:00
New Revision: 96d814a5fe0a333bc53f52e8f290d1ac009c85fe

URL: 
https://github.com/llvm/llvm-project/commit/96d814a5fe0a333bc53f52e8f290d1ac009c85fe
DIFF: 
https://github.com/llvm/llvm-project/commit/96d814a5fe0a333bc53f52e8f290d1ac009c85fe.diff

LOG: [lldb] Remove ClangExpressionDeclMap::ResolveUnknownTypes

Summary:
This is some really shady code. It's supposed to kick in after an expression 
already failed and then try to look
up "unknown types" that for some undocumented reason can't be resolved 
during/before parsing. Beside the
fact that we never mark any type as `EVUnknownType` in either swift-lldb or 
lldb (which means this code is unreachable),
this code doesn't even make the expression evaluation succeed if if would ever 
be executed but instead seems
to try to load more debug info that maybe any following expression evaluations 
might succeed.

This patch removes ClangExpressionDeclMap::ResolveUnknownTypes and the related 
data structures/checks/calls.

Reviewers: davide

Reviewed By: davide

Subscribers: aprantl, abidh, JDevlieghere, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/include/lldb/Expression/ExpressionVariable.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Removed: 




diff  --git a/lldb/include/lldb/Expression/ExpressionVariable.h 
b/lldb/include/lldb/Expression/ExpressionVariable.h
index 08c987270bfe..c20c2301bb54 100644
--- a/lldb/include/lldb/Expression/ExpressionVariable.h
+++ b/lldb/include/lldb/Expression/ExpressionVariable.h
@@ -98,9 +98,7 @@ class ExpressionVariable
 EVTypeIsReference = 1 << 6, ///< The original type of this variable is a
 ///reference, so materialize the value rather
 ///than the location
-EVUnknownType = 1 << 7, ///< This is a symbol of unknown type, and the type
-///must be resolved after parsing is complete
-EVBareRegister = 1 << 8 ///< This variable is a direct reference to $pc or
+EVBareRegister = 1 << 7 ///< This variable is a direct reference to $pc or
 ///some other entity.
   };
 

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index f4457fc1b740..35a50c8fed16 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1769,80 +1769,6 @@ void 
ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context,
   }
 }
 
-bool ClangExpressionDeclMap::ResolveUnknownTypes() {
-  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
-  Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
-
-  ClangASTContextForExpressions *scratch_ast_context =
-  static_cast(
-  target->GetScratchClangASTContext());
-
-  for (size_t index = 0, num_entities = m_found_entities.GetSize();
-   index < num_entities; ++index) {
-ExpressionVariableSP entity = m_found_entities.GetVariableAtIndex(index);
-
-ClangExpressionVariable::ParserVars *parser_vars =
-llvm::cast(entity.get())
-->GetParserVars(GetParserID());
-
-if (entity->m_flags & ClangExpressionVariable::EVUnknownType) {
-  const NamedDecl *named_decl = parser_vars->m_named_decl;
-  const VarDecl *var_decl = dyn_cast(named_decl);
-
-  if (!var_decl) {
-LLDB_LOGF(log, "Entity of unknown type does not have a VarDecl");
-return false;
-  }
-
-  if (log) {
-ASTDumper ast_dumper(const_cast(var_decl));
-LLDB_LOGF(log, "Variable of unknown type now has Decl %s",
-  ast_dumper.GetCString());
-  }
-
-  QualType var_type = var_decl->getType();
-  TypeFromParser parser_type(
-  var_type.getAsOpaquePtr(),
-  ClangASTContext::GetASTContext(&var_decl->getASTContext()));
-
-  lldb::opaque_compiler_type_t copied_type = nullptr;
-  if (m_ast_importer_sp) {
-copied_type = m_ast_importer_sp->CopyType(
-scratch_ast_context->getASTContext(), &var_decl->getASTContext(),
-var_type.getAsOpaquePtr());
-  } else if (HasMerger()) {
-copied_type = CopyTypeWithMerger(
-  var_decl->getASTContext(),
-  scratch_ast_context->GetMergerUnchecked(), var_type)
-  .getAsOpaquePtr();
-  } else {
-lldbassert(0 && "No mechanism to copy a resolved unknown type!");
-return false;
-  }
-
-  if (!copied_type) {
- 

[Lldb-commits] [PATCH] D70388: [lldb] Remove ClangExpressionDeclMap::ResolveUnknownTypes

2019-11-19 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG96d814a5fe0a: [lldb] Remove 
ClangExpressionDeclMap::ResolveUnknownTypes (authored by teemperor).

Changed prior to commit:
  https://reviews.llvm.org/D70388?vs=229800&id=230029#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70388

Files:
  lldb/include/lldb/Expression/ExpressionVariable.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -1034,15 +1034,6 @@
   }
 
   if (!num_errors) {
-if (type_system_helper->DeclMap() &&
-!type_system_helper->DeclMap()->ResolveUnknownTypes()) {
-  diagnostic_manager.Printf(eDiagnosticSeverityError,
-"Couldn't infer the type of a variable");
-  num_errors++;
-}
-  }
-
-  if (!num_errors) {
 type_system_helper->CommitPersistentDecls();
   }
 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -98,13 +98,6 @@
 
   void InstallCodeGenerator(clang::ASTConsumer *code_gen);
 
-  /// [Used by ClangExpressionParser] For each variable that had an unknown
-  /// type at the beginning of parsing, determine its final type now.
-  ///
-  /// \return
-  /// True on success; false otherwise.
-  bool ResolveUnknownTypes();
-
   /// Disable the state needed for parsing and IR transformation.
   void DidParse();
 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1769,80 +1769,6 @@
   }
 }
 
-bool ClangExpressionDeclMap::ResolveUnknownTypes() {
-  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
-  Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
-
-  ClangASTContextForExpressions *scratch_ast_context =
-  static_cast(
-  target->GetScratchClangASTContext());
-
-  for (size_t index = 0, num_entities = m_found_entities.GetSize();
-   index < num_entities; ++index) {
-ExpressionVariableSP entity = m_found_entities.GetVariableAtIndex(index);
-
-ClangExpressionVariable::ParserVars *parser_vars =
-llvm::cast(entity.get())
-->GetParserVars(GetParserID());
-
-if (entity->m_flags & ClangExpressionVariable::EVUnknownType) {
-  const NamedDecl *named_decl = parser_vars->m_named_decl;
-  const VarDecl *var_decl = dyn_cast(named_decl);
-
-  if (!var_decl) {
-LLDB_LOGF(log, "Entity of unknown type does not have a VarDecl");
-return false;
-  }
-
-  if (log) {
-ASTDumper ast_dumper(const_cast(var_decl));
-LLDB_LOGF(log, "Variable of unknown type now has Decl %s",
-  ast_dumper.GetCString());
-  }
-
-  QualType var_type = var_decl->getType();
-  TypeFromParser parser_type(
-  var_type.getAsOpaquePtr(),
-  ClangASTContext::GetASTContext(&var_decl->getASTContext()));
-
-  lldb::opaque_compiler_type_t copied_type = nullptr;
-  if (m_ast_importer_sp) {
-copied_type = m_ast_importer_sp->CopyType(
-scratch_ast_context->getASTContext(), &var_decl->getASTContext(),
-var_type.getAsOpaquePtr());
-  } else if (HasMerger()) {
-copied_type = CopyTypeWithMerger(
-  var_decl->getASTContext(),
-  scratch_ast_context->GetMergerUnchecked(), var_type)
-  .getAsOpaquePtr();
-  } else {
-lldbassert(0 && "No mechanism to copy a resolved unknown type!");
-return false;
-  }
-
-  if (!copied_type) {
-LLDB_LOGF(log, "ClangExpressionDeclMap::ResolveUnknownType - Couldn't "
-   "import the type for a variable");
-
-return (bool)lldb::ExpressionVariableSP();
-  }
-
-  TypeFromUser user_type(copied_type, scratch_ast_context);
-
-  //parser_vars->m_lldb_value.SetContext(Value::eContextTypeClangType,
-  //user_type.GetOpaqueQualType());
-  parser_vars->m_lldb_value.SetCompilerType(user_type);
-  parser_vars->m_parser_type = parser_type;
-
-  entity->Set

[Lldb-commits] [PATCH] D70433: [lldb] Improve error message when running static initialisers in expression fails

2019-11-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: jingham.
Herald added subscribers: lldb-commits, JDevlieghere.
Herald added a project: LLDB.

The current error message is current `error: couldn't run static initializers: 
couldn't run static initializer: ` which
just doesn't make a lot of sense.

This patch removes the duplicate error message and tries to improve the error 
message (at least for this test
case).


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D70433

Files:
  
lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Target/Process.cpp


Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -5304,13 +5304,14 @@
   }
 } while (false);
 
+std::string error = s.GetString();
 if (event_explanation)
-  LLDB_LOGF(log,
-"Process::RunThreadPlan(): execution interrupted: %s %s",
-s.GetData(), event_explanation);
-else
-  LLDB_LOGF(log, "Process::RunThreadPlan(): execution interrupted: %s",
-s.GetData());
+  error += " " + std::string(event_explanation);
+
+diagnostic_manager.PutString(eDiagnosticSeverityError,
+ "Execution interrupted: " + error);
+LLDB_LOGF(log, "Process::RunThreadPlan(): execution interrupted: %s",
+  error.c_str());
   }
 
   if (should_unwind) {
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -658,7 +658,7 @@
   const char *error_cstr = static_init_error.AsCString();
   if (error_cstr && error_cstr[0])
 diagnostic_manager.Printf(eDiagnosticSeverityError,
-  "couldn't run static initializers: %s\n",
+  "couldn't run static initializers:\n%s\n",
   error_cstr);
   else
 diagnostic_manager.PutString(eDiagnosticSeverityError,
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -1378,8 +1378,10 @@
 exe_ctx, call_static_initializer, options, execution_errors);
 
 if (results != lldb::eExpressionCompleted) {
-  err.SetErrorStringWithFormat("couldn't run static initializer: %s",
-   execution_errors.GetString().c_str());
+  if (execution_errors.Diagnostics().empty())
+err.SetErrorStringWithFormatv("ExpressionResults: {0}", results);
+  else
+err.SetErrorStringWithFormatv("{0}", execution_errors.GetString());
   return err;
 }
   }
Index: 
lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
===
--- 
lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
+++ 
lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
@@ -26,6 +26,5 @@
 lldbutil.run_to_source_breakpoint(self, '// break here',
 lldb.SBFileSpec("main.cpp", False))
 
-# FIXME: This error message is not even remotely helpful.
 self.expect("expr -p -- struct Foo2 { Foo2() { do_abort(); } }; Foo2 
f;", error=True,
-substrs=["error: couldn't run static initializers: 
couldn't run static initializer:"])
+substrs=["error: couldn't run static initializers:\nerror: 
Execution interrupted: "])


Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -5304,13 +5304,14 @@
   }
 } while (false);
 
+std::string error = s.GetString();
 if (event_explanation)
-  LLDB_LOGF(log,
-"Process::RunThreadPlan(): execution interrupted: %s %s",
-s.GetData(), event_explanation);
-else
-  LLDB_LOGF(log, "Process::RunThreadPlan(): execution interrupted: %s",
-s.GetData());
+  error += " " + std::string(event_explanation);
+
+diagnostic_manager.PutString(eDiagnosticSeverityError,
+ "

[Lldb-commits] [lldb] f6ffe6f - [lldb] Also test Get[De]mangledName of SBType in TestSBTypeClassMembers.py

2019-11-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-19T14:04:02+01:00
New Revision: f6ffe6fc9d9b8b0e197500b5b61f3e8d55599d7a

URL: 
https://github.com/llvm/llvm-project/commit/f6ffe6fc9d9b8b0e197500b5b61f3e8d55599d7a
DIFF: 
https://github.com/llvm/llvm-project/commit/f6ffe6fc9d9b8b0e197500b5b61f3e8d55599d7a.diff

LOG: [lldb] Also test Get[De]mangledName of SBType in TestSBTypeClassMembers.py

I just used the mangled names as this test is anyway a Darwin-only ObjC++ test.
We probably should also test this on other platforms but that will be
another commit as we need to untangle the ObjC and C++ parts first.

Added: 


Modified: 

lldb/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py
 
b/lldb/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py
index 960df3f184db..3517abb1ebb9 100644
--- 
a/lldb/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py
+++ 
b/lldb/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py
@@ -102,3 +102,17 @@ def test(self):
 self.assertEquals("int",
 Thingy.GetMemberFunctionAtIndex(1).GetArgumentTypeAtIndex(
 0).GetName(), "Thingy::foo takes an int")
+
+self.assertEquals("Derived::dImpl()", 
Derived.GetMemberFunctionAtIndex(0).GetDemangledName())
+self.assertEquals("Derived::baz(float)", 
Derived.GetMemberFunctionAtIndex(1).GetDemangledName())
+self.assertEquals("Base::foo(int, int)", 
Base.GetMemberFunctionAtIndex(0).GetDemangledName())
+self.assertEquals("Base::bar(int, char)", 
Base.GetMemberFunctionAtIndex(1).GetDemangledName())
+self.assertEquals("Base::dat()", 
Base.GetMemberFunctionAtIndex(2).GetDemangledName())
+self.assertEquals("Base::sfunc(char, int, float)", 
Base.GetMemberFunctionAtIndex(3).GetDemangledName())
+
+self.assertEquals("_ZN7Derived5dImplEv", 
Derived.GetMemberFunctionAtIndex(0).GetMangledName())
+self.assertEquals("_ZN7Derived3bazEf", 
Derived.GetMemberFunctionAtIndex(1).GetMangledName())
+self.assertEquals("_ZN4Base3fooEii", 
Base.GetMemberFunctionAtIndex(0).GetMangledName())
+self.assertEquals("_ZN4Base3barEic", 
Base.GetMemberFunctionAtIndex(1).GetMangledName())
+self.assertEquals("_ZN4Base3datEv", 
Base.GetMemberFunctionAtIndex(2).GetMangledName())
+self.assertEquals("_ZN4Base5sfuncEcif", 
Base.GetMemberFunctionAtIndex(3).GetMangledName())



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


[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-19 Thread Martin Svensson via Phabricator via lldb-commits
poya updated this revision to Diff 230045.

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

https://reviews.llvm.org/D70393

Files:
  lldb/source/Plugins/Language/ObjC/Cocoa.cpp


Index: lldb/source/Plugins/Language/ObjC/Cocoa.cpp
===
--- lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -659,6 +659,32 @@
   return true;
 }
 
+static void NSURL_ConcatSummary(StreamString &first, const StreamString 
&second,
+std::string prefix, std::string suffix) {
+  if (second.Empty())
+return;
+
+  // Remove suffix and quotation char from first
+  std::string first_str_copy = first.GetString();
+  llvm::StringRef first_str = first_str_copy;
+  if (!suffix.empty())
+first_str.consume_back(suffix);
+  if (!first_str.empty())
+first_str = first_str.drop_back();
+
+  // Remove prefix and quotation char from second
+  llvm::StringRef second_str = second.GetString();
+  if (!prefix.empty())
+second_str.consume_front(prefix);
+  if (!second_str.empty())
+second_str = second_str.drop_front();
+
+  if (!first_str.empty() && !second_str.empty()) {
+first.Clear();
+first.Printf("%s -- %s", first_str.str().c_str(), 
second_str.str().c_str());
+  }
+}
+
 bool lldb_private::formatters::NSURLSummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
   ProcessSP process_sp = valobj.GetProcessSP();
@@ -702,21 +728,20 @@
   if (!NSStringSummaryProvider(*text, summary, options))
 return false;
   if (base && base->GetValueAsUnsigned(0)) {
-std::string summary_str = summary.GetString();
-
-if (!summary_str.empty())
-  summary_str.pop_back();
-summary_str += " -- ";
 StreamString base_summary;
 if (NSURLSummaryProvider(*base, base_summary, options) &&
 !base_summary.Empty()) {
-  llvm::StringRef base_str = base_summary.GetString();
-  if (base_str.size() > 2)
-base_str = base_str.drop_front(2);
-  summary_str += base_str;
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(options.GetLanguage())) {
+if (!language->GetFormatterPrefixSuffix(*text, ConstString("NSString"),
+prefix, suffix)) {
+  prefix.clear();
+  suffix.clear();
+}
+  }
+
+  NSURL_ConcatSummary(summary, base_summary, prefix, suffix);
 }
-summary.Clear();
-summary.PutCString(summary_str);
   }
   if (!summary.Empty()) {
 stream.PutCString(summary.GetString());


Index: lldb/source/Plugins/Language/ObjC/Cocoa.cpp
===
--- lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -659,6 +659,32 @@
   return true;
 }
 
+static void NSURL_ConcatSummary(StreamString &first, const StreamString &second,
+std::string prefix, std::string suffix) {
+  if (second.Empty())
+return;
+
+  // Remove suffix and quotation char from first
+  std::string first_str_copy = first.GetString();
+  llvm::StringRef first_str = first_str_copy;
+  if (!suffix.empty())
+first_str.consume_back(suffix);
+  if (!first_str.empty())
+first_str = first_str.drop_back();
+
+  // Remove prefix and quotation char from second
+  llvm::StringRef second_str = second.GetString();
+  if (!prefix.empty())
+second_str.consume_front(prefix);
+  if (!second_str.empty())
+second_str = second_str.drop_front();
+
+  if (!first_str.empty() && !second_str.empty()) {
+first.Clear();
+first.Printf("%s -- %s", first_str.str().c_str(), second_str.str().c_str());
+  }
+}
+
 bool lldb_private::formatters::NSURLSummaryProvider(
 ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
   ProcessSP process_sp = valobj.GetProcessSP();
@@ -702,21 +728,20 @@
   if (!NSStringSummaryProvider(*text, summary, options))
 return false;
   if (base && base->GetValueAsUnsigned(0)) {
-std::string summary_str = summary.GetString();
-
-if (!summary_str.empty())
-  summary_str.pop_back();
-summary_str += " -- ";
 StreamString base_summary;
 if (NSURLSummaryProvider(*base, base_summary, options) &&
 !base_summary.Empty()) {
-  llvm::StringRef base_str = base_summary.GetString();
-  if (base_str.size() > 2)
-base_str = base_str.drop_front(2);
-  summary_str += base_str;
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(options.GetLanguage())) {
+if (!language->GetFormatterPrefixSuffix(*text, ConstString("NSString"),
+prefix, suffix)) {
+  prefix.clear();
+  suffix.clear();
+}
+  }
+
+  NSURL_ConcatSummary(summary, base_summary, prefix, suffix);
 }
-summary.Clear();
-summary.PutCString(summary_str);
   }
   if (!summary.Empty()

[Lldb-commits] [PATCH] D70433: [lldb] Improve error message when running static initialisers in expression fails

2019-11-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 230046.

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

https://reviews.llvm.org/D70433

Files:
  
lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Target/Process.cpp

Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -5228,90 +5228,88 @@
 // Now do some processing on the results of the run:
 if (return_value == eExpressionInterrupted ||
 return_value == eExpressionHitBreakpoint) {
-  if (log) {
-StreamString s;
-if (event_sp)
-  event_sp->Dump(&s);
-else {
-  log->PutCString("Process::RunThreadPlan(): Stop event that "
-  "interrupted us is NULL.");
-}
+  StreamString s;
+  if (event_sp)
+event_sp->Dump(&s);
+  else {
+log->PutCString("Process::RunThreadPlan(): Stop event that "
+"interrupted us is NULL.");
+  }
 
-StreamString ts;
+  StreamString ts;
 
-const char *event_explanation = nullptr;
+  const char *event_explanation = nullptr;
 
-do {
-  if (!event_sp) {
-event_explanation = "";
-break;
-  } else if (event_sp->GetType() == eBroadcastBitInterrupt) {
-event_explanation = "";
+  do {
+if (!event_sp) {
+  event_explanation = "";
+  break;
+} else if (event_sp->GetType() == eBroadcastBitInterrupt) {
+  event_explanation = "";
+  break;
+} else {
+  const Process::ProcessEventData *event_data =
+  Process::ProcessEventData::GetEventDataFromEvent(event_sp.get());
+
+  if (!event_data) {
+event_explanation = "";
 break;
-  } else {
-const Process::ProcessEventData *event_data =
-Process::ProcessEventData::GetEventDataFromEvent(
-event_sp.get());
+  }
 
-if (!event_data) {
-  event_explanation = "";
-  break;
-}
+  Process *process = event_data->GetProcessSP().get();
 
-Process *process = event_data->GetProcessSP().get();
+  if (!process) {
+event_explanation = "";
+break;
+  }
 
-if (!process) {
-  event_explanation = "";
-  break;
-}
+  ThreadList &thread_list = process->GetThreadList();
 
-ThreadList &thread_list = process->GetThreadList();
+  uint32_t num_threads = thread_list.GetSize();
+  uint32_t thread_index;
 
-uint32_t num_threads = thread_list.GetSize();
-uint32_t thread_index;
+  ts.Printf("<%u threads> ", num_threads);
 
-ts.Printf("<%u threads> ", num_threads);
+  for (thread_index = 0; thread_index < num_threads; ++thread_index) {
+Thread *thread = thread_list.GetThreadAtIndex(thread_index).get();
 
-for (thread_index = 0; thread_index < num_threads; ++thread_index) {
-  Thread *thread = thread_list.GetThreadAtIndex(thread_index).get();
+if (!thread) {
+  ts.Printf(" ");
+  continue;
+}
 
-  if (!thread) {
-ts.Printf(" ");
-continue;
-  }
+ts.Printf("<0x%4.4" PRIx64 " ", thread->GetID());
+RegisterContext *register_context =
+thread->GetRegisterContext().get();
 
-  ts.Printf("<0x%4.4" PRIx64 " ", thread->GetID());
-  RegisterContext *register_context =
-  thread->GetRegisterContext().get();
-
-  if (register_context)
-ts.Printf("[ip 0x%" PRIx64 "] ", register_context->GetPC());
-  else
-ts.Printf("[ip unknown] ");
-
-  // Show the private stop info here, the public stop info will be
-  // from the last natural stop.
-  lldb::StopInfoSP stop_info_sp = thread->GetPrivateStopInfo();
-  if (stop_info_sp) {
-const char *stop_desc = stop_info_sp->GetDescription();
-if (stop_desc)
-  ts.PutCString(stop_desc);
-  }
-  ts.Printf(">");
+if (register_context)
+  ts.Printf("[ip 0x%" PRIx64 "] ", register_context->GetPC());
+else
+  ts.Printf("[ip unknown] ");
+
+// Show the private stop info here, the public stop info will be
+// from the last natural stop.
+lldb::StopInfoSP stop_info_sp = thread->GetP

[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-19 Thread Martin Svensson via Phabricator via lldb-commits
poya added a comment.

@davide Thanks for the review, and while I haven't been able to reproduce the 
test failure locally with my configuration, I reviewed the code and corrected a 
potential memory issue that might have been the cause for the failure. If not, 
do you mind sharing more info on the failure?

I have also added a test to lldb swift fork, which I can create a PR for once 
this change lands there, or what's the normal workflow?
https://github.com/poya/llvm-project/commit/e884bf7b0cc2700b50cf36b1d3d6401046eec1bc


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

https://reviews.llvm.org/D70393



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


[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

You could make a PR with both this commit and the test against the swift fork. 
If that is accepted and merged, then the fix can be upstreamed. But having a 
test for this upstream is what should ideally happen instead of just testing 
this downstream.




Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:662
 
+static void NSURL_ConcatSummary(StreamString &first, const StreamString 
&second,
+std::string prefix, std::string suffix) {

I am not a big fan of the "Class_method" way of extending classes. Maybe 
`ConcatSummaryForNSURL`?


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

https://reviews.llvm.org/D70393



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


[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor requested changes to this revision.
teemperor added inline comments.
This revision now requires changes to proceed.



Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:662
 
+static void NSURL_ConcatSummary(StreamString &first, const StreamString 
&second,
+std::string prefix, std::string suffix) {

teemperor wrote:
> I am not a big fan of the "Class_method" way of extending classes. Maybe 
> `ConcatSummaryForNSURL`?
first and second also not very descriptive variables names. What about the 
`summary` and `base_summary` names from where we call the method?



Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:662
 
+static void NSURL_ConcatSummary(StreamString &first, const StreamString 
&second,
+std::string prefix, std::string suffix) {

teemperor wrote:
> teemperor wrote:
> > I am not a big fan of the "Class_method" way of extending classes. Maybe 
> > `ConcatSummaryForNSURL`?
> first and second also not very descriptive variables names. What about the 
> `summary` and `base_summary` names from where we call the method?
Having `first` as both a in and out parameter makes the control flow not very 
trivial to understand. You could just compute a result and return that result 
(and then assign this to the `summary` variable in the calling context)? Also 
all parameters to this function can just be `llvm::StringRef` from what I can 
see.



Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:673
+  if (!first_str.empty())
+first_str = first_str.drop_back();
+

This can all be just:

```
first_str.consume_back(suffix);
first_str.consume_back("\"");
```

And the same thing below.



Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:684
+first.Clear();
+first.Printf("%s -- %s", first_str.str().c_str(), 
second_str.str().c_str());
+  }

This could just be `return first_str + " -- " + second_str;` if you return 
instead of having an in/out parameter.


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

https://reviews.llvm.org/D70393



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


[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-19 Thread Martin Svensson via Phabricator via lldb-commits
poya marked an inline comment as done.
poya added a comment.






Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:662
 
+static void NSURL_ConcatSummary(StreamString &first, const StreamString 
&second,
+std::string prefix, std::string suffix) {

teemperor wrote:
> teemperor wrote:
> > teemperor wrote:
> > > I am not a big fan of the "Class_method" way of extending classes. Maybe 
> > > `ConcatSummaryForNSURL`?
> > first and second also not very descriptive variables names. What about the 
> > `summary` and `base_summary` names from where we call the method?
> Having `first` as both a in and out parameter makes the control flow not very 
> trivial to understand. You could just compute a result and return that result 
> (and then assign this to the `summary` variable in the calling context)? Also 
> all parameters to this function can just be `llvm::StringRef` from what I can 
> see.
Was trying to follow the coding style used elsewhere in the same file for the 
helper function name



Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:662
 
+static void NSURL_ConcatSummary(StreamString &first, const StreamString 
&second,
+std::string prefix, std::string suffix) {

poya wrote:
> teemperor wrote:
> > teemperor wrote:
> > > teemperor wrote:
> > > > I am not a big fan of the "Class_method" way of extending classes. 
> > > > Maybe `ConcatSummaryForNSURL`?
> > > first and second also not very descriptive variables names. What about 
> > > the `summary` and `base_summary` names from where we call the method?
> > Having `first` as both a in and out parameter makes the control flow not 
> > very trivial to understand. You could just compute a result and return that 
> > result (and then assign this to the `summary` variable in the calling 
> > context)? Also all parameters to this function can just be 
> > `llvm::StringRef` from what I can see.
> Was trying to follow the coding style used elsewhere in the same file for the 
> helper function name
Didn't think summary and base_summary made it very simple to reason about, 
perhaps destination and source, or front and back, would make more sense for a 
concatenation function?



Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:673
+  if (!first_str.empty())
+first_str = first_str.drop_back();
+

teemperor wrote:
> This can all be just:
> 
> ```
> first_str.consume_back(suffix);
> first_str.consume_back("\"");
> ```
> 
> And the same thing below.
Didn't want to make an assumption of the quote character used if it ever changed


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

https://reviews.llvm.org/D70393



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


[Lldb-commits] [lldb] c54d21c - [lldb][NFC] Early exit in IRExecutionUnit::GetStaticInitializers

2019-11-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-19T15:06:30+01:00
New Revision: c54d21c848d350e85cd8f95a725fc12f6fa3ab19

URL: 
https://github.com/llvm/llvm-project/commit/c54d21c848d350e85cd8f95a725fc12f6fa3ab19
DIFF: 
https://github.com/llvm/llvm-project/commit/c54d21c848d350e85cd8f95a725fc12f6fa3ab19.diff

LOG: [lldb][NFC] Early exit in IRExecutionUnit::GetStaticInitializers

Added: 


Modified: 
lldb/source/Expression/IRExecutionUnit.cpp

Removed: 




diff  --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index b10628e10cc5..105f875fa1d2 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -977,30 +977,34 @@ IRExecutionUnit::FindSymbol(lldb_private::ConstString 
name, bool &missing_weak)
 
 void IRExecutionUnit::GetStaticInitializers(
 std::vector &static_initializers) {
-  if (llvm::GlobalVariable *global_ctors =
-  m_module->getNamedGlobal("llvm.global_ctors")) {
-if (llvm::ConstantArray *ctor_array = llvm::dyn_cast(
-global_ctors->getInitializer())) {
-  for (llvm::Use &ctor_use : ctor_array->operands()) {
-if (llvm::ConstantStruct *ctor_struct =
-llvm::dyn_cast(ctor_use)) {
-  lldbassert(ctor_struct->getNumOperands() ==
- 3); // this is standardized
-  if (llvm::Function *ctor_function =
-  llvm::dyn_cast(ctor_struct->getOperand(1))) {
-ConstString ctor_function_name_cs(ctor_function->getName().str());
-
-for (JittedFunction &jitted_function : m_jitted_functions) {
-  if (ctor_function_name_cs == jitted_function.m_name) {
-if (jitted_function.m_remote_addr != LLDB_INVALID_ADDRESS) {
-  static_initializers.push_back(jitted_function.m_remote_addr);
-}
-break;
-  }
-}
-  }
-}
-  }
+  llvm::GlobalVariable *global_ctors =
+  m_module->getNamedGlobal("llvm.global_ctors");
+  if (!global_ctors)
+return;
+  auto *ctor_array =
+  llvm::dyn_cast(global_ctors->getInitializer());
+  if (!ctor_array)
+return;
+
+  for (llvm::Use &ctor_use : ctor_array->operands()) {
+auto *ctor_struct = llvm::dyn_cast(ctor_use);
+if (!ctor_struct)
+  continue;
+// this is standardized
+lldbassert(ctor_struct->getNumOperands() == 3);
+auto *ctor_function =
+llvm::dyn_cast(ctor_struct->getOperand(1));
+if (!ctor_function)
+  continue;
+ConstString ctor_function_name_cs(ctor_function->getName().str());
+
+for (JittedFunction &jitted_function : m_jitted_functions) {
+  if (ctor_function_name_cs != jitted_function.m_name)
+continue;
+  if (jitted_function.m_remote_addr == LLDB_INVALID_ADDRESS)
+continue;
+  static_initializers.push_back(jitted_function.m_remote_addr);
+  break;
 }
   }
 }



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


[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-19 Thread Martin Svensson via Phabricator via lldb-commits
poya added a comment.

In D70393#1751514 , @teemperor wrote:

> But having a test for this upstream is what should ideally happen instead of 
> just testing this downstream.


There is already a test for the NSURL data formatter upstream for the ObjC 
context, but the same summary provider is also used with Swift and it was only 
there it was being incorrectly truncated, because assumption of prefix length. 
So if I understood @davide correctly he wanted a test added in the Swift fork 
for the Swift case.


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

https://reviews.llvm.org/D70393



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


[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

In D70393#1751614 , @poya wrote:

> In D70393#1751514 , @teemperor wrote:
>
> > But having a test for this upstream is what should ideally happen instead 
> > of just testing this downstream.
>
>
> There is already a test for the NSURL data formatter upstream for the ObjC 
> context, but the same summary provider is also used with Swift and it was 
> only there it was being incorrectly truncated, because assumption of prefix 
> length. So if I understood @davide correctly he wanted a test added in the 
> Swift fork for the Swift case.


Usually code should not just be tested downstream but also here (which is of 
course tricky with Swift-specific stuff as Swift is only downstream). So if you 
see a way to test this without just testing it in swift-lldb that would be 
great, but on the other hand this is just touching ObjC formatters which are 
anyway Apple-specific code, so it's not the end of the world if not...




Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:662
 
+static void NSURL_ConcatSummary(StreamString &first, const StreamString 
&second,
+std::string prefix, std::string suffix) {

poya wrote:
> poya wrote:
> > teemperor wrote:
> > > teemperor wrote:
> > > > teemperor wrote:
> > > > > I am not a big fan of the "Class_method" way of extending classes. 
> > > > > Maybe `ConcatSummaryForNSURL`?
> > > > first and second also not very descriptive variables names. What about 
> > > > the `summary` and `base_summary` names from where we call the method?
> > > Having `first` as both a in and out parameter makes the control flow not 
> > > very trivial to understand. You could just compute a result and return 
> > > that result (and then assign this to the `summary` variable in the 
> > > calling context)? Also all parameters to this function can just be 
> > > `llvm::StringRef` from what I can see.
> > Was trying to follow the coding style used elsewhere in the same file for 
> > the helper function name
> Didn't think summary and base_summary made it very simple to reason about, 
> perhaps destination and source, or front and back, would make more sense for 
> a concatenation function?
> Was trying to follow the coding style used elsewhere in the same file for the 
> helper function name

Fair point.

> Didn't think summary and base_summary made it very simple to reason about, 
> perhaps destination and source, or front and back, would make more sense for 
> a concatenation function?

I mean it's not just concatenating first and second, but removes string 
prefix/suffix, one arbitrary character that is the a quotation character we 
don't want in summaries and then returns them with in the format for that we 
expect for summaries (`A -- B`), so it seems quite specific to expect a summary 
and summary_base.



Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:673
+  if (!first_str.empty())
+first_str = first_str.drop_back();
+

poya wrote:
> teemperor wrote:
> > This can all be just:
> > 
> > ```
> > first_str.consume_back(suffix);
> > first_str.consume_back("\"");
> > ```
> > 
> > And the same thing below.
> Didn't want to make an assumption of the quote character used if it ever 
> changed
If this changes we probably want to know (and we maybe should even assert that 
this happens).


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

https://reviews.llvm.org/D70393



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


[Lldb-commits] [lldb] 4a6d03a - [lldb] Add logging to IRExecutionUnit::GetStaticInitializers

2019-11-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-19T15:52:01+01:00
New Revision: 4a6d03ad0e00c75c18d5740438d49918f99cb4f2

URL: 
https://github.com/llvm/llvm-project/commit/4a6d03ad0e00c75c18d5740438d49918f99cb4f2
DIFF: 
https://github.com/llvm/llvm-project/commit/4a6d03ad0e00c75c18d5740438d49918f99cb4f2.diff

LOG: [lldb] Add logging to IRExecutionUnit::GetStaticInitializers

Added: 


Modified: 
lldb/source/Expression/IRExecutionUnit.cpp

Removed: 




diff  --git a/lldb/source/Expression/IRExecutionUnit.cpp 
b/lldb/source/Expression/IRExecutionUnit.cpp
index 105f875fa1d2..33d48842f869 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -977,14 +977,20 @@ IRExecutionUnit::FindSymbol(lldb_private::ConstString 
name, bool &missing_weak)
 
 void IRExecutionUnit::GetStaticInitializers(
 std::vector &static_initializers) {
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
+
   llvm::GlobalVariable *global_ctors =
   m_module->getNamedGlobal("llvm.global_ctors");
-  if (!global_ctors)
+  if (!global_ctors) {
+LLDB_LOG(log, "Couldn't find llvm.global_ctors.");
 return;
+  }
   auto *ctor_array =
   llvm::dyn_cast(global_ctors->getInitializer());
-  if (!ctor_array)
+  if (!ctor_array) {
+LLDB_LOG(log, "llvm.global_ctors not a ConstantArray.");
 return;
+  }
 
   for (llvm::Use &ctor_use : ctor_array->operands()) {
 auto *ctor_struct = llvm::dyn_cast(ctor_use);
@@ -994,16 +1000,25 @@ void IRExecutionUnit::GetStaticInitializers(
 lldbassert(ctor_struct->getNumOperands() == 3);
 auto *ctor_function =
 llvm::dyn_cast(ctor_struct->getOperand(1));
-if (!ctor_function)
+if (!ctor_function) {
+  LLDB_LOG(log, "global_ctor doesn't contain an llvm::Function");
   continue;
-ConstString ctor_function_name_cs(ctor_function->getName().str());
+}
+
+ConstString ctor_function_name(ctor_function->getName().str());
+LLDB_LOG(log, "Looking for callable jitted function with name {0}.",
+ ctor_function_name);
 
 for (JittedFunction &jitted_function : m_jitted_functions) {
-  if (ctor_function_name_cs != jitted_function.m_name)
+  if (ctor_function_name != jitted_function.m_name)
 continue;
-  if (jitted_function.m_remote_addr == LLDB_INVALID_ADDRESS)
+  if (jitted_function.m_remote_addr == LLDB_INVALID_ADDRESS) {
+LLDB_LOG(log, "Found jitted function with invalid address.");
 continue;
+  }
   static_initializers.push_back(jitted_function.m_remote_addr);
+  LLDB_LOG(log, "Calling function at address {0:x}.",
+   jitted_function.m_remote_addr);
   break;
 }
   }



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


[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-19 Thread Martin Svensson via Phabricator via lldb-commits
poya marked 2 inline comments as done.
poya added inline comments.



Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:662
 
+static void NSURL_ConcatSummary(StreamString &first, const StreamString 
&second,
+std::string prefix, std::string suffix) {

teemperor wrote:
> poya wrote:
> > poya wrote:
> > > teemperor wrote:
> > > > teemperor wrote:
> > > > > teemperor wrote:
> > > > > > I am not a big fan of the "Class_method" way of extending classes. 
> > > > > > Maybe `ConcatSummaryForNSURL`?
> > > > > first and second also not very descriptive variables names. What 
> > > > > about the `summary` and `base_summary` names from where we call the 
> > > > > method?
> > > > Having `first` as both a in and out parameter makes the control flow 
> > > > not very trivial to understand. You could just compute a result and 
> > > > return that result (and then assign this to the `summary` variable in 
> > > > the calling context)? Also all parameters to this function can just be 
> > > > `llvm::StringRef` from what I can see.
> > > Was trying to follow the coding style used elsewhere in the same file for 
> > > the helper function name
> > Didn't think summary and base_summary made it very simple to reason about, 
> > perhaps destination and source, or front and back, would make more sense 
> > for a concatenation function?
> > Was trying to follow the coding style used elsewhere in the same file for 
> > the helper function name
> 
> Fair point.
> 
> > Didn't think summary and base_summary made it very simple to reason about, 
> > perhaps destination and source, or front and back, would make more sense 
> > for a concatenation function?
> 
> I mean it's not just concatenating first and second, but removes string 
> prefix/suffix, one arbitrary character that is the a quotation character we 
> don't want in summaries and then returns them with in the format for that we 
> expect for summaries (`A -- B`), so it seems quite specific to expect a 
> summary and summary_base.
Agree that it's not a pure concatenation function, but just to avoid any 
misunderstandings I want to clarify that it retains the enclosing prefix/suffix 
and quote marks in its output.

It concatenates
@"test.html" and @"http://lldb.llvm.org";
to
@"test.html -- http://lldb.llvm.org";
which is the actual summary output
  
I can try switching the arg names though. 





Comment at: lldb/source/Plugins/Language/ObjC/Cocoa.cpp:673
+  if (!first_str.empty())
+first_str = first_str.drop_back();
+

teemperor wrote:
> poya wrote:
> > teemperor wrote:
> > > This can all be just:
> > > 
> > > ```
> > > first_str.consume_back(suffix);
> > > first_str.consume_back("\"");
> > > ```
> > > 
> > > And the same thing below.
> > Didn't want to make an assumption of the quote character used if it ever 
> > changed
> If this changes we probably want to know (and we maybe should even assert 
> that this happens).
Got it. As I saw that in some contexts the quote character was ' instead of " 
(not here though), I was just wary about potentially introducing a similar 
failure point as I was fixing, '@' string prefix in obj-c vs no prefix in 
Swift, which had gone unnoticed.


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

https://reviews.llvm.org/D70393



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


[Lldb-commits] [PATCH] D69309: Support template instantiation in the expression evaluator

2019-11-19 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin updated this revision to Diff 230069.
jarin added a comment.

This update introduces a callback from clang for template specialization. The 
callback allows lldb to construct instantiations on demand, rather than having 
to create the instantiation eagerly.

Perhaps it would still beneficial to prune the instantiations (we only need one 
"sample" instantiation per template) when querying the generic type from the 
symbol file so that we do not have to parse all the instantiations eagerly.


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

https://reviews.llvm.org/D69309

Files:
  clang/include/clang/AST/ExternalASTSource.h
  clang/lib/AST/ExternalASTSource.cpp
  clang/lib/Sema/SemaTemplate.cpp
  
lldb/packages/Python/lldbsuite/test/lang/cpp/class-template-instantiation/Makefile
  
lldb/packages/Python/lldbsuite/test/lang/cpp/class-template-instantiation/TestClassTemplateInstantiation.py
  
lldb/packages/Python/lldbsuite/test/lang/cpp/class-template-instantiation/main.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Symbol/TypeMap.cpp

Index: lldb/source/Symbol/TypeMap.cpp
===
--- lldb/source/Symbol/TypeMap.cpp
+++ lldb/source/Symbol/TypeMap.cpp
@@ -141,6 +141,27 @@
exact_match);
 }
 
+namespace {
+
+bool TypeBasenamesMatch(const std::string &type_basename,
+llvm::StringRef match_type_basename,
+bool is_instantiation) {
+  if (match_type_basename == type_basename)
+return true;
+  // If the basenames do not match, let us see if {match_type_basename} could
+  // be an instantiation of {type_basename}.
+  if (is_instantiation)
+return false;
+  size_t basename_size = type_basename.size();
+  if (match_type_basename.size() <= basename_size)
+return false;
+  if (match_type_basename[basename_size] != '<')
+return false;
+  return match_type_basename.take_front(basename_size) == type_basename;
+}
+
+} // namespace
+
 void TypeMap::RemoveMismatchedTypes(const std::string &type_scope,
 const std::string &type_basename,
 TypeClass type_class, bool exact_match) {
@@ -152,6 +173,8 @@
 
   iterator pos, end = m_types.end();
 
+  bool is_instantiation = type_basename.find('<') != std::string::npos;
+
   for (pos = m_types.begin(); pos != end; ++pos) {
 Type *the_type = pos->second.get();
 bool keep_match = false;
@@ -171,7 +194,8 @@
   if (Type::GetTypeScopeAndBasename(match_type_name, match_type_scope,
 match_type_basename,
 match_type_class)) {
-if (match_type_basename == type_basename) {
+if (TypeBasenamesMatch(type_basename, match_type_basename,
+   is_instantiation)) {
   const size_t type_scope_size = type_scope.size();
   const size_t match_type_scope_size = match_type_scope.size();
   if (exact_match || (type_scope_size == match_type_scope_size)) {
@@ -203,7 +227,9 @@
   } else {
 // The type we are currently looking at doesn't exists in a namespace
 // or class, so it only matches if there is no type scope...
-keep_match = type_scope.empty() && type_basename == match_type_name;
+keep_match = type_scope.empty() &&
+ TypeBasenamesMatch(type_basename, match_type_name,
+is_instantiation);
   }
 }
 
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2499,6 +2499,24 @@
 }
   }
 
+  die_offsets.clear();
+  m_index->GetGenericTypes(name, die_offsets);
+  for (size_t i = 0; i < die_offsets.size(); ++i) {
+const DIERef &die_ref = die_offsets[i];
+DWARFDIE die = GetDIE(die_ref);
+if (die) {
+  if (!DIEInDeclContext(parent_decl_ctx, die))
+continue; // The containing decl contexts don't match
+  if (Type *matching_type = ResolveType(die, true, true)) {
+types.InsertUnique(matching_type->shared_from_this());
+if (types.GetSize() >= max_matches)
+  break;
+  }
+} else {
+  m_index->ReportIn

[Lldb-commits] [PATCH] D70393: [lldb] Fix NSURL data formatter truncation issue in Swift

2019-11-19 Thread Martin Svensson via Phabricator via lldb-commits
poya marked 3 inline comments as not done.
poya added a comment.

Sorry for marking comments as done, not used to the tool.


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

https://reviews.llvm.org/D70393



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


[Lldb-commits] [PATCH] D70442: [LLDB] Force message formatting to English

2019-11-19 Thread Alexandre Ganea via Phabricator via lldb-commits
aganea created this revision.
aganea added reviewers: asmith, aleksandr.urakov.
aganea added a project: LLDB.
Herald added a subscriber: lldb-commits.

This is a follow-up on D53092 , and fixes the 
test below on non-English locales (below, on a French locale):

  [ RUN  ] StatusTest.ErrorWin32
  F:\llvm-project\lldb\unittests\Utility\StatusTest.cpp(67): error:   
Expected: "Access is denied. "
  To be equal to: s.AsCString()
Which is: "Acc\xE8s refus\xE9. "
  F:\llvm-project\lldb\unittests\Utility\StatusTest.cpp(70): error:   
Expected: "Negotiation timed out "
  To be equal to: s.AsCString()
Which is: "Le d\xE9lai d\x92" "attente a expir\xE9 pour la 
n\xE9gociation "
  [  FAILED  ] StatusTest.ErrorWin32 (2 ms)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70442

Files:
  lldb/source/Utility/Status.cpp


Index: lldb/source/Utility/Status.cpp
===
--- lldb/source/Utility/Status.cpp
+++ lldb/source/Utility/Status.cpp
@@ -100,14 +100,23 @@
   char *buffer = nullptr;
   std::string message;
   // Retrieve win32 system error.
+  // First, attempt to load a en-US message
   if (::FormatMessageA(
   FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
   FORMAT_MESSAGE_MAX_WIDTH_MASK,
-  NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+  NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
   (LPSTR)&buffer, 0, NULL)) {
 message.assign(buffer);
 ::LocalFree(buffer);
   }
+  // If the previous didn't work, use the default OS language
+  else if (::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+FORMAT_MESSAGE_FROM_SYSTEM |
+FORMAT_MESSAGE_MAX_WIDTH_MASK,
+NULL, error_code, 0, (LPSTR)&buffer, 0, NULL)) {
+message.assign(buffer);
+::LocalFree(buffer);
+  }
   return message;
 }
 #endif


Index: lldb/source/Utility/Status.cpp
===
--- lldb/source/Utility/Status.cpp
+++ lldb/source/Utility/Status.cpp
@@ -100,14 +100,23 @@
   char *buffer = nullptr;
   std::string message;
   // Retrieve win32 system error.
+  // First, attempt to load a en-US message
   if (::FormatMessageA(
   FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
   FORMAT_MESSAGE_MAX_WIDTH_MASK,
-  NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+  NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
   (LPSTR)&buffer, 0, NULL)) {
 message.assign(buffer);
 ::LocalFree(buffer);
   }
+  // If the previous didn't work, use the default OS language
+  else if (::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+FORMAT_MESSAGE_FROM_SYSTEM |
+FORMAT_MESSAGE_MAX_WIDTH_MASK,
+NULL, error_code, 0, (LPSTR)&buffer, 0, NULL)) {
+message.assign(buffer);
+::LocalFree(buffer);
+  }
   return message;
 }
 #endif
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70449: Add a "Using LLDB" section to the welcome page of the website

2019-11-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: jingham, JDevlieghere, jasonmolenda, labath, clayborg, 
friss.
Herald added a subscriber: arphaman.

This is an attempt to feature the user-facing resources more prominently on the 
LLDB website by calling out the tutorial and the GDB command map wight on the 
start page.

I also moved the "Why a new debugger" section to the "Goals" subpage. Given 
that LLDB's first release is almost a decade in the past now, the title is a 
bit of an anachronism.

Lastly, I moved the Architecture sub-page from "use" to "resources", since 
end-users do not care about the source code layout.


https://reviews.llvm.org/D70449

Files:
  lldb/docs/index.rst
  lldb/docs/resources/architecture.rst
  lldb/docs/status/goals.rst
  lldb/docs/use/architecture.rst


Index: lldb/docs/status/goals.rst
===
--- lldb/docs/status/goals.rst
+++ lldb/docs/status/goals.rst
@@ -31,3 +31,14 @@
 * Great support for C, Objective-C and C++
 * Retargetable to support multiple platforms
 * Provide a base for debugger research and other innovation
+
+Why a New Debugger?
+---
+
+In order to achieve our goals we decided to start with a fresh architecture
+that would support modern multi-threaded programs, handle debugging symbols in
+an efficient manner, use compiler based code knowledge and have plug-in support
+for functionality and extensions. Additionally we want the debugger
+capabilities to be available to other analysis tools, be they scripts or
+compiled programs, without requiring them to be GPL.
+
Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -17,20 +17,22 @@
 
 .. _"Apache 2.0 License with LLVM exceptions": 
https://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework
 
-Why a New Debugger?

+Using LLDB
+--
 
-In order to achieve our goals we decided to start with a fresh architecture
-that would support modern multi-threaded programs, handle debugging symbols in
-an efficient manner, use compiler based code knowledge and have plug-in support
-for functionality and extensions. Additionally we want the debugger
-capabilities to be available to other analysis tools, be they scripts or
-compiled programs, without requiring them to be GPL.
+For an introduction into the LLDB command language, head over to the
+:ref:`LLDB Tutorial `. For users already familiar with
+other debuggers there is also a cheat sheet listing common tasks and
+their LLDB equivalent in the :ref:`GDB to LLDB command map `.
+
+There are also multiple resources on how to script LLDB using Pythonl
+:ref:`Python Reference ` is a great staring
+point for that.
 
 Compiler Integration Benefits
 -
 
-LLDB currently converts debug information into clang types so that it can
+LLDB converts debug information into Clang types so that it can
 leverage the clang compiler infrastructure. This allows LLDB to support the
 latest C, C++, Objective-C and Objective-C++ language features and runtimes in
 expressions without having to reimplement any of this functionality. It also
@@ -132,13 +134,13 @@
use/python-reference
use/remote
use/troubleshooting
-   use/architecture
 
 .. toctree::
:hidden:
:maxdepth: 1
:caption: Development
 
+   resources/architecture
resources/contributing
resources/build
resources/test


Index: lldb/docs/status/goals.rst
===
--- lldb/docs/status/goals.rst
+++ lldb/docs/status/goals.rst
@@ -31,3 +31,14 @@
 * Great support for C, Objective-C and C++
 * Retargetable to support multiple platforms
 * Provide a base for debugger research and other innovation
+
+Why a New Debugger?
+---
+
+In order to achieve our goals we decided to start with a fresh architecture
+that would support modern multi-threaded programs, handle debugging symbols in
+an efficient manner, use compiler based code knowledge and have plug-in support
+for functionality and extensions. Additionally we want the debugger
+capabilities to be available to other analysis tools, be they scripts or
+compiled programs, without requiring them to be GPL.
+
Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -17,20 +17,22 @@
 
 .. _"Apache 2.0 License with LLVM exceptions": https://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework
 
-Why a New Debugger?

+Using LLDB
+--
 
-In order to achieve our goals we decided to start with a fresh architecture
-that would support modern multi-threaded programs, handle debugging symbols in
-an efficient manner, use compiler based code knowledge and have plug-in support
-for functionality and extensions. Additionally we wan

[Lldb-commits] [PATCH] D70448: [LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope

2019-11-19 Thread Alexandre Ganea via Phabricator via lldb-commits
aganea created this revision.
aganea added a reviewer: jingham.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This fixes a warning on MSVC:

  F:\llvm-project\lldb\source\Commands\CommandObjectThread.cpp(529): warning 
C4305: 'argument': truncation from 'char' to 'bool'

Previously, `'C'` was passed into the wrong parameter, as `is_class` was 
introduced in D68671 :

  OptionGroupPythonClassWithDict(const char *class_use,
 bool is_class = true,
 int class_option = 'C',


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70448

Files:
  lldb/source/Commands/CommandObjectThread.cpp


Index: lldb/source/Commands/CommandObjectThread.cpp
===
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -526,7 +526,7 @@
 eCommandProcessMustBeLaunched |
 eCommandProcessMustBePaused),
 m_step_type(step_type), m_step_scope(step_scope), m_options(),
-m_class_options("scripted step", 'C') {
+m_class_options("scripted step", true, 'C') {
 CommandArgumentEntry arg;
 CommandArgumentData thread_id_arg;
 


Index: lldb/source/Commands/CommandObjectThread.cpp
===
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -526,7 +526,7 @@
 eCommandProcessMustBeLaunched |
 eCommandProcessMustBePaused),
 m_step_type(step_type), m_step_scope(step_scope), m_options(),
-m_class_options("scripted step", 'C') {
+m_class_options("scripted step", true, 'C') {
 CommandArgumentEntry arg;
 CommandArgumentData thread_id_arg;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70449: Add a "Using LLDB" section to the welcome page of the website

2019-11-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere requested changes to this revision.
JDevlieghere added a comment.
This revision now requires changes to proceed.

Please add a redirect in the `.htaccess` file for the architecture page.


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

https://reviews.llvm.org/D70449



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


[Lldb-commits] [PATCH] D70449: Add a "Using LLDB" section to the welcome page of the website

2019-11-19 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: lldb/docs/index.rst:25
+:ref:`LLDB Tutorial `. For users already familiar with
+other debuggers there is also a cheat sheet listing common tasks and
+their LLDB equivalent in the :ref:`GDB to LLDB command map `.

`other debuggers` -> `GDB`?



Comment at: lldb/docs/index.rst:28
+
+There are also multiple resources on how to script LLDB using Pythonl
+:ref:`Python Reference ` is a great staring

`Pythonl` -> `Python`



Comment at: lldb/docs/index.rst:29
+There are also multiple resources on how to script LLDB using Pythonl
+:ref:`Python Reference ` is a great staring
+point for that.

`staring` -> `starting`


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

https://reviews.llvm.org/D70449



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


[Lldb-commits] [PATCH] D70449: Add a "Using LLDB" section to the welcome page of the website

2019-11-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Sounds like a good idea.


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

https://reviews.llvm.org/D70449



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


[Lldb-commits] [PATCH] D70449: Add a "Using LLDB" section to the welcome page of the website

2019-11-19 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: lldb/docs/status/goals.rst:38
+
+In order to achieve our goals we decided to start with a fresh architecture
+that would support modern multi-threaded programs, handle debugging symbols in

Is it worth adding anything about expression parsing here as well?


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

https://reviews.llvm.org/D70449



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


[Lldb-commits] [PATCH] D70448: [LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope

2019-11-19 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: lldb/source/Commands/CommandObjectThread.cpp:529
 m_step_type(step_type), m_step_scope(step_scope), m_options(),
-m_class_options("scripted step", 'C') {
+m_class_options("scripted step", true, 'C') {
 CommandArgumentEntry arg;

We could also leave out both `true` and  `C` since both are already defaulted 
to these values. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70448



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


[Lldb-commits] [PATCH] D70448: [LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope

2019-11-19 Thread Alexandre Ganea via Phabricator via lldb-commits
aganea updated this revision to Diff 230097.
aganea marked an inline comment as done.
aganea added a comment.

Omit default arguments.


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

https://reviews.llvm.org/D70448

Files:
  lldb/source/Commands/CommandObjectThread.cpp


Index: lldb/source/Commands/CommandObjectThread.cpp
===
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -526,7 +526,7 @@
 eCommandProcessMustBeLaunched |
 eCommandProcessMustBePaused),
 m_step_type(step_type), m_step_scope(step_scope), m_options(),
-m_class_options("scripted step", 'C') {
+m_class_options("scripted step") {
 CommandArgumentEntry arg;
 CommandArgumentData thread_id_arg;
 


Index: lldb/source/Commands/CommandObjectThread.cpp
===
--- lldb/source/Commands/CommandObjectThread.cpp
+++ lldb/source/Commands/CommandObjectThread.cpp
@@ -526,7 +526,7 @@
 eCommandProcessMustBeLaunched |
 eCommandProcessMustBePaused),
 m_step_type(step_type), m_step_scope(step_scope), m_options(),
-m_class_options("scripted step", 'C') {
+m_class_options("scripted step") {
 CommandArgumentEntry arg;
 CommandArgumentData thread_id_arg;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] b117ec8 - [LLDB] Fix formatting in the driver (NFC)

2019-11-19 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-19T10:23:56-08:00
New Revision: b117ec8be0f350f6a644de28a9871cf0183a1c54

URL: 
https://github.com/llvm/llvm-project/commit/b117ec8be0f350f6a644de28a9871cf0183a1c54
DIFF: 
https://github.com/llvm/llvm-project/commit/b117ec8be0f350f6a644de28a9871cf0183a1c54.diff

LOG: [LLDB] Fix formatting in the driver (NFC)

Added: 


Modified: 
lldb/tools/driver/Driver.cpp

Removed: 




diff  --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp
index b77350190be8..3a22d7aabc15 100644
--- a/lldb/tools/driver/Driver.cpp
+++ b/lldb/tools/driver/Driver.cpp
@@ -806,8 +806,7 @@ llvm::Optional InitializeReproducer(opt::InputArgList 
&input_args) {
   return llvm::None;
 }
 
-int main(int argc, char const *argv[])
-{
+int main(int argc, char const *argv[]) {
   // Setup LLVM signal handlers and make sure we call llvm_shutdown() on
   // destruction.
   llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);



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


[Lldb-commits] [PATCH] D70449: Add a "Using LLDB" section to the welcome page of the website

2019-11-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl marked 4 inline comments as done.
aprantl added inline comments.



Comment at: lldb/docs/status/goals.rst:38
+
+In order to achieve our goals we decided to start with a fresh architecture
+that would support modern multi-threaded programs, handle debugging symbols in

shafik wrote:
> Is it worth adding anything about expression parsing here as well?
Perhaps :-)
I'll consider that out of scope for this patch though.


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

https://reviews.llvm.org/D70449



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


[Lldb-commits] [PATCH] D70449: Add a "Using LLDB" section to the welcome page of the website

2019-11-19 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 230103.
aprantl added a comment.

Cool, I didn't know about the redirects!


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

https://reviews.llvm.org/D70449

Files:
  lldb/docs/.htaccess
  lldb/docs/index.rst
  lldb/docs/resources/architecture.rst
  lldb/docs/status/goals.rst
  lldb/docs/use/architecture.rst

Index: lldb/docs/status/goals.rst
===
--- lldb/docs/status/goals.rst
+++ lldb/docs/status/goals.rst
@@ -31,3 +31,14 @@
 * Great support for C, Objective-C and C++
 * Retargetable to support multiple platforms
 * Provide a base for debugger research and other innovation
+
+Why a New Debugger?
+---
+
+In order to achieve our goals we decided to start with a fresh architecture
+that would support modern multi-threaded programs, handle debugging symbols in
+an efficient manner, use compiler based code knowledge and have plug-in support
+for functionality and extensions. Additionally we want the debugger
+capabilities to be available to other analysis tools, be they scripts or
+compiled programs, without requiring them to be GPL.
+
Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -17,21 +17,23 @@
 
 .. _"Apache 2.0 License with LLVM exceptions": https://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework
 
-Why a New Debugger?

+Using LLDB
+--
 
-In order to achieve our goals we decided to start with a fresh architecture
-that would support modern multi-threaded programs, handle debugging symbols in
-an efficient manner, use compiler based code knowledge and have plug-in support
-for functionality and extensions. Additionally we want the debugger
-capabilities to be available to other analysis tools, be they scripts or
-compiled programs, without requiring them to be GPL.
+For an introduction into the LLDB command language, head over to the
+:ref:`LLDB Tutorial `. For users already familiar with
+GDB there is a cheat sheet listing common tasks and their LLDB
+equivalent in the :ref:`GDB to LLDB command map `.
+
+There are also multiple resources on how to script LLDB using Python
+:ref:`Python Reference ` is a great starting
+point for that.
 
 Compiler Integration Benefits
 -
 
-LLDB currently converts debug information into clang types so that it can
-leverage the clang compiler infrastructure. This allows LLDB to support the
+LLDB converts debug information into Clang types so that it can
+leverage the Clang compiler infrastructure. This allows LLDB to support the
 latest C, C++, Objective-C and Objective-C++ language features and runtimes in
 expressions without having to reimplement any of this functionality. It also
 leverages the compiler to take care of all ABI details when making functions
@@ -51,7 +53,7 @@
 The LLDB debugger APIs are exposed as a C++ object oriented interface in a
 shared library. The lldb command line tool links to, and uses this public API.
 On macOS the shared library is exposed as a framework named LLDB.framework,
-and unix systems expose it as lldb.so. The entire API is also then exposed
+and Unix systems expose it as lldb.so. The entire API is also then exposed
 through Python script bindings which allow the API to be used within the LLDB
 embedded script interpreter, and also in any python script that loads the
 lldb.py module in standard python script files. See the Python Reference page
@@ -68,8 +70,8 @@
 are welcome:
 
 * macOS desktop user space debugging for i386 and x86_64
-* iOS simulator debugging on i386 and x86_64
-* iOS device debugging on ARM and AArch64
+* iOS, tvOS, and watchOS simulator debugging on i386 and x86_64
+* iOS, tvOS, and watchOS device debugging on ARM and AArch64
 * Linux local user-space debugging for i386, x86_64 and PPC64le
 * FreeBSD local user-space debugging for i386 and x86_64
 * Windows local user-space debugging for i386 (*)
@@ -91,8 +93,8 @@
 Additionally it builds:
 
 * on macOS with a :ref:`generated Xcode project `
-* on Linux and FreeBSD with clang and libstdc++/libc++
-* on NetBSD with GCC/clang and libstdc++/libc++
+* on Linux and FreeBSD with Clang and libstdc++/libc++
+* on NetBSD with GCC/Clang and libstdc++/libc++
 * on Windows with a generated project for VS 2017 or higher
 
 See the :doc:`LLDB Build Page ` for build instructions.
@@ -132,13 +134,13 @@
use/python-reference
use/remote
use/troubleshooting
-   use/architecture
 
 .. toctree::
:hidden:
:maxdepth: 1
:caption: Development
 
+   resources/architecture
resources/contributing
resources/build
resources/test
Index: lldb/docs/.htaccess
===
--- lldb/docs/.htaccess
+++ lldb/docs/.htaccess
@@ -1,5 +1,6 @@
-Redirect 301 /architecture/index.html https://lldb.llvm.org/use/arch

[Lldb-commits] [PATCH] D70449: Add a "Using LLDB" section to the welcome page of the website

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

LGTM with the comment.




Comment at: lldb/docs/.htaccess:3
 Redirect 301 /cpp_reference/html/index.html 
https://lldb.llvm.org/cpp_reference/index.html
+Redirect 301 /use/architecture.html 
https://lldb.llvm.org/resources/architecture.html
 Redirect 301 /features.html https://lldb.llvm.org/status/features.html

Can you move this line down under `Sphinx redirects`? I'm trying to keep old 
redirects (from the html website) separate from reorgs in the sphix docs. 


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

https://reviews.llvm.org/D70449



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


[Lldb-commits] [lldb] 77f8a33 - Add a "Using LLDB" section to the welcome page of the website

2019-11-19 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2019-11-19T10:55:50-08:00
New Revision: 77f8a3324b741bc78c93d1076a31b77f331a0bc5

URL: 
https://github.com/llvm/llvm-project/commit/77f8a3324b741bc78c93d1076a31b77f331a0bc5
DIFF: 
https://github.com/llvm/llvm-project/commit/77f8a3324b741bc78c93d1076a31b77f331a0bc5.diff

LOG: Add a "Using LLDB" section to the welcome page of the website

This is an attempt to feature the user-facing resources more
prominently on the LLDB website by calling out the tutorial and the
GDB command map wight on the start page.

I also moved the "Why a new debugger" section to the "Goals"
subpage. Given that LLDB's first release is almost a decade in the
past now, the title is a bit of an anachronism.

Lastly, I moved the Architecture sub-page from "use" to "resources",
since end-users do not care about the source code layout.

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

Added: 
lldb/docs/resources/architecture.rst

Modified: 
lldb/docs/.htaccess
lldb/docs/index.rst
lldb/docs/status/goals.rst

Removed: 
lldb/docs/use/architecture.rst



diff  --git a/lldb/docs/.htaccess b/lldb/docs/.htaccess
index d605f68afcf4..596f4481ab49 100644
--- a/lldb/docs/.htaccess
+++ b/lldb/docs/.htaccess
@@ -1,4 +1,4 @@
-Redirect 301 /architecture/index.html 
https://lldb.llvm.org/use/architecture.html
+Redirect 301 /architecture/index.html 
https://lldb.llvm.org/resources/architecture.html
 Redirect 301 /cpp_reference/html/index.html 
https://lldb.llvm.org/cpp_reference/index.html
 Redirect 301 /features.html https://lldb.llvm.org/status/features.html
 Redirect 301 /formats.html https://lldb.llvm.org/use/formatting.html
@@ -13,3 +13,4 @@ Redirect 301 /varformats.html 
https://lldb.llvm.org/use/variable.html
 # Sphinx redirects
 Redirect 301 /resources/source.html 
https://lldb.llvm.org/resources/contributing.html
 Redirect 301 /resources/download.html 
https://lldb.llvm.org/status/releases.html
+Redirect 301 /use/architecture.html 
https://lldb.llvm.org/resources/architecture.html

diff  --git a/lldb/docs/index.rst b/lldb/docs/index.rst
index 475c793e4d27..c765a650adfe 100644
--- a/lldb/docs/index.rst
+++ b/lldb/docs/index.rst
@@ -17,21 +17,23 @@ All of the code in the LLDB project is available under the
 
 .. _"Apache 2.0 License with LLVM exceptions": 
https://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework
 
-Why a New Debugger?

+Using LLDB
+--
 
-In order to achieve our goals we decided to start with a fresh architecture
-that would support modern multi-threaded programs, handle debugging symbols in
-an efficient manner, use compiler based code knowledge and have plug-in support
-for functionality and extensions. Additionally we want the debugger
-capabilities to be available to other analysis tools, be they scripts or
-compiled programs, without requiring them to be GPL.
+For an introduction into the LLDB command language, head over to the
+:ref:`LLDB Tutorial `. For users already familiar with
+GDB there is a cheat sheet listing common tasks and their LLDB
+equivalent in the :ref:`GDB to LLDB command map `.
+
+There are also multiple resources on how to script LLDB using Python
+:ref:`Python Reference ` is a great starting
+point for that.
 
 Compiler Integration Benefits
 -
 
-LLDB currently converts debug information into clang types so that it can
-leverage the clang compiler infrastructure. This allows LLDB to support the
+LLDB converts debug information into Clang types so that it can
+leverage the Clang compiler infrastructure. This allows LLDB to support the
 latest C, C++, Objective-C and Objective-C++ language features and runtimes in
 expressions without having to reimplement any of this functionality. It also
 leverages the compiler to take care of all ABI details when making functions
@@ -51,7 +53,7 @@ Reusability
 The LLDB debugger APIs are exposed as a C++ object oriented interface in a
 shared library. The lldb command line tool links to, and uses this public API.
 On macOS the shared library is exposed as a framework named LLDB.framework,
-and unix systems expose it as lldb.so. The entire API is also then exposed
+and Unix systems expose it as lldb.so. The entire API is also then exposed
 through Python script bindings which allow the API to be used within the LLDB
 embedded script interpreter, and also in any python script that loads the
 lldb.py module in standard python script files. See the Python Reference page
@@ -68,8 +70,8 @@ LLDB is known to work on the following platforms, but ports 
to new platforms
 are welcome:
 
 * macOS desktop user space debugging for i386 and x86_64
-* iOS simulator debugging on i386 and x86_64
-* iOS device debugging on ARM and AArch64
+* iOS, tvOS, and watchOS simulator debugging on i386 and x86_64
+* iOS, tvOS, and watchOS device debugging on ARM and AArch64
 * Linux local user-

[Lldb-commits] [PATCH] D70449: Add a "Using LLDB" section to the welcome page of the website

2019-11-19 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG77f8a3324b74: Add a "Using LLDB" section to the 
welcome page of the website (authored by aprantl).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D70449?vs=230103&id=230108#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70449

Files:
  lldb/docs/.htaccess
  lldb/docs/index.rst
  lldb/docs/resources/architecture.rst
  lldb/docs/status/goals.rst
  lldb/docs/use/architecture.rst

Index: lldb/docs/status/goals.rst
===
--- lldb/docs/status/goals.rst
+++ lldb/docs/status/goals.rst
@@ -31,3 +31,14 @@
 * Great support for C, Objective-C and C++
 * Retargetable to support multiple platforms
 * Provide a base for debugger research and other innovation
+
+Why a New Debugger?
+---
+
+In order to achieve our goals we decided to start with a fresh architecture
+that would support modern multi-threaded programs, handle debugging symbols in
+an efficient manner, use compiler based code knowledge and have plug-in support
+for functionality and extensions. Additionally we want the debugger
+capabilities to be available to other analysis tools, be they scripts or
+compiled programs, without requiring them to be GPL.
+
Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -17,21 +17,23 @@
 
 .. _"Apache 2.0 License with LLVM exceptions": https://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework
 
-Why a New Debugger?

+Using LLDB
+--
 
-In order to achieve our goals we decided to start with a fresh architecture
-that would support modern multi-threaded programs, handle debugging symbols in
-an efficient manner, use compiler based code knowledge and have plug-in support
-for functionality and extensions. Additionally we want the debugger
-capabilities to be available to other analysis tools, be they scripts or
-compiled programs, without requiring them to be GPL.
+For an introduction into the LLDB command language, head over to the
+:ref:`LLDB Tutorial `. For users already familiar with
+GDB there is a cheat sheet listing common tasks and their LLDB
+equivalent in the :ref:`GDB to LLDB command map `.
+
+There are also multiple resources on how to script LLDB using Python
+:ref:`Python Reference ` is a great starting
+point for that.
 
 Compiler Integration Benefits
 -
 
-LLDB currently converts debug information into clang types so that it can
-leverage the clang compiler infrastructure. This allows LLDB to support the
+LLDB converts debug information into Clang types so that it can
+leverage the Clang compiler infrastructure. This allows LLDB to support the
 latest C, C++, Objective-C and Objective-C++ language features and runtimes in
 expressions without having to reimplement any of this functionality. It also
 leverages the compiler to take care of all ABI details when making functions
@@ -51,7 +53,7 @@
 The LLDB debugger APIs are exposed as a C++ object oriented interface in a
 shared library. The lldb command line tool links to, and uses this public API.
 On macOS the shared library is exposed as a framework named LLDB.framework,
-and unix systems expose it as lldb.so. The entire API is also then exposed
+and Unix systems expose it as lldb.so. The entire API is also then exposed
 through Python script bindings which allow the API to be used within the LLDB
 embedded script interpreter, and also in any python script that loads the
 lldb.py module in standard python script files. See the Python Reference page
@@ -68,8 +70,8 @@
 are welcome:
 
 * macOS desktop user space debugging for i386 and x86_64
-* iOS simulator debugging on i386 and x86_64
-* iOS device debugging on ARM and AArch64
+* iOS, tvOS, and watchOS simulator debugging on i386 and x86_64
+* iOS, tvOS, and watchOS device debugging on ARM and AArch64
 * Linux local user-space debugging for i386, x86_64 and PPC64le
 * FreeBSD local user-space debugging for i386 and x86_64
 * Windows local user-space debugging for i386 (*)
@@ -91,8 +93,8 @@
 Additionally it builds:
 
 * on macOS with a :ref:`generated Xcode project `
-* on Linux and FreeBSD with clang and libstdc++/libc++
-* on NetBSD with GCC/clang and libstdc++/libc++
+* on Linux and FreeBSD with Clang and libstdc++/libc++
+* on NetBSD with GCC/Clang and libstdc++/libc++
 * on Windows with a generated project for VS 2017 or higher
 
 See the :doc:`LLDB Build Page ` for build instructions.
@@ -132,13 +134,13 @@
use/python-reference
use/remote
use/troubleshooting
-   use/architecture
 
 .. toctree::
:hidden:
:maxdepth: 1
:caption: Development
 
+   resources/architecture
resources/contributing
resources/build
resources/t

[Lldb-commits] [PATCH] D70259: [Error] Add source location to cantFail

2019-11-19 Thread Don Hinton via Phabricator via lldb-commits
hintonda updated this revision to Diff 230125.
hintonda added a comment.
Herald added subscribers: lldb-commits, cfe-commits, usaxena95, kadircet, 
arphaman, jkorous.
Herald added projects: clang, LLDB.

- Replace macro magic with matching 3-parameter template functions.
- Refactor cantFail move into detail namespace.  Change macro name to


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70259

Files:
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/refactor/tweaks/ExpandMacro.cpp
  clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
  clang-tools-extra/clangd/unittests/FormatTests.cpp
  clang-tools-extra/clangd/unittests/HeaderSourceSwitchTests.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
  clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
  clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp
  clang/lib/AST/ExternalASTMerger.cpp
  clang/lib/Tooling/Core/Replacement.cpp
  clang/lib/Tooling/Tooling.cpp
  clang/tools/clang-refactor/ClangRefactor.cpp
  clang/unittests/Basic/DiagnosticTest.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
  lldb/unittests/Target/ExecutionContextTest.cpp
  llvm/include/llvm/Support/Error.h
  llvm/unittests/Support/ErrorTest.cpp

Index: llvm/unittests/Support/ErrorTest.cpp
===
--- llvm/unittests/Support/ErrorTest.cpp
+++ llvm/unittests/Support/ErrorTest.cpp
@@ -390,8 +390,8 @@
   };
 
   EXPECT_DEATH(FailToHandle(),
-   "Failure value returned from cantFail wrapped call\n"
-   "CustomError \\{7\\}")
+   "CustomError \\{7\\}\n"
+   "Failure value returned from cantFail wrapped call")
   << "Unhandled Error in handleAllErrors call did not cause an "
  "abort()";
 }
@@ -410,8 +410,8 @@
   };
 
   EXPECT_DEATH(ReturnErrorFromHandler(),
-   "Failure value returned from cantFail wrapped call\n"
-   "CustomError \\{7\\}")
+   "CustomError \\{7\\}\n"
+   "Failure value returned from cantFail wrapped call")
   << " Error returned from handler in handleAllErrors call did not "
  "cause abort()";
 }
@@ -515,8 +515,8 @@
   EXPECT_DEATH(cantFail(make_error("Original error message",
 inconvertibleErrorCode()),
 "Cantfail call failed"),
-   "Cantfail call failed\n"
-   "Original error message")
+   "Original error message\n"
+   "Cantfail call failed")
   << "cantFail(Error) did not cause an abort for failure value";
 
   EXPECT_DEATH(
@@ -530,6 +530,24 @@
 }
 #endif
 
+TEST(Error, CantFailSourceLocation) {
+  std::string ErrStr;
+  raw_string_ostream OS(ErrStr);
+  OS << "\nFailure value returned from cantFail wrapped call";
+
+#if defined(NDEBUG)
+  // __FILE__ and __LINE_ not added
+  OS << "\n";
+  EXPECT_DEATH(cantFail(make_error(1)), OS.str())
+  << "cantFail(Error) did not cause an abort for failure value";
+#else
+  // __FILE__ and __LINE__ added
+  int Line = __LINE__;
+  OS << " at " << __FILE__ << ":" << (Line + 2) << "\n";
+  EXPECT_DEATH(cantFail(make_error(1)), OS.str())
+  << "cantFail(Error) did not cause an abort for failure value";
+#endif
+}
 
 // Test Checked Expected in success mode.
 TEST(Error, CheckedExpectedInSuccessMode) {
Index: llvm/include/llvm/Support/Error.h
===
--- llvm/include/llvm/Support/Error.h
+++ llvm/include/llvm/Support/Error.h
@@ -687,6 +687,23 @@
 LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err,
 bool gen_crash_diag = true);
 
+namespace detail {
+
+inline LLVM_ATTRIBUTE_NORETURN void
+handleError(Error Err, const char *Msg, const char *file, unsigned line) {
+  if (!Msg)
+Msg = "Failure value returned from cantFail wrapped call";
+#ifndef NDEBUG
+  std::string Str;
+  raw_string_ostream OS(Str);
+  OS << Err << "\n" << Msg;
+  if (file)
+OS << " at " << file << ":" << line;
+  Msg = OS.str().c_str();
+#endif
+  llvm_unreachable(Msg);
+}
+
 /// Report a fatal error if Err is a failure value.
 ///
 /// This function can be used to wrap calls to fallible functions ONLY when it
@@ -700,18 +717,10 @@
 ///
 

[Lldb-commits] [PATCH] D70259: [Error] Add source location to cantFail

2019-11-19 Thread Don Hinton via Phabricator via lldb-commits
hintonda updated this revision to Diff 230131.
hintonda added a comment.

- Add back original llvm::cantFail signatures so they'll still be


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70259

Files:
  clang-tools-extra/clangd/index/Serialization.cpp
  clang-tools-extra/clangd/refactor/tweaks/ExpandMacro.cpp
  clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
  clang-tools-extra/clangd/unittests/FormatTests.cpp
  clang-tools-extra/clangd/unittests/HeaderSourceSwitchTests.cpp
  clang-tools-extra/clangd/unittests/RenameTests.cpp
  clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
  clang-tools-extra/clangd/unittests/SemanticSelectionTests.cpp
  clang-tools-extra/clangd/unittests/SourceCodeTests.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.cpp
  clang-tools-extra/clangd/unittests/XRefsTests.cpp
  clang/lib/AST/ExternalASTMerger.cpp
  clang/lib/Tooling/Core/Replacement.cpp
  clang/lib/Tooling/Tooling.cpp
  clang/tools/clang-refactor/ClangRefactor.cpp
  clang/unittests/Basic/DiagnosticTest.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
  lldb/unittests/Target/ExecutionContextTest.cpp
  llvm/include/llvm/Support/Error.h
  llvm/unittests/Support/ErrorTest.cpp

Index: llvm/unittests/Support/ErrorTest.cpp
===
--- llvm/unittests/Support/ErrorTest.cpp
+++ llvm/unittests/Support/ErrorTest.cpp
@@ -390,8 +390,8 @@
   };
 
   EXPECT_DEATH(FailToHandle(),
-   "Failure value returned from cantFail wrapped call\n"
-   "CustomError \\{7\\}")
+   "CustomError \\{7\\}\n"
+   "Failure value returned from cantFail wrapped call")
   << "Unhandled Error in handleAllErrors call did not cause an "
  "abort()";
 }
@@ -410,8 +410,8 @@
   };
 
   EXPECT_DEATH(ReturnErrorFromHandler(),
-   "Failure value returned from cantFail wrapped call\n"
-   "CustomError \\{7\\}")
+   "CustomError \\{7\\}\n"
+   "Failure value returned from cantFail wrapped call")
   << " Error returned from handler in handleAllErrors call did not "
  "cause abort()";
 }
@@ -515,8 +515,8 @@
   EXPECT_DEATH(cantFail(make_error("Original error message",
 inconvertibleErrorCode()),
 "Cantfail call failed"),
-   "Cantfail call failed\n"
-   "Original error message")
+   "Original error message\n"
+   "Cantfail call failed")
   << "cantFail(Error) did not cause an abort for failure value";
 
   EXPECT_DEATH(
@@ -530,6 +530,24 @@
 }
 #endif
 
+TEST(Error, CantFailSourceLocation) {
+  std::string ErrStr;
+  raw_string_ostream OS(ErrStr);
+  OS << "\nFailure value returned from cantFail wrapped call";
+
+#if defined(NDEBUG)
+  // __FILE__ and __LINE_ not added
+  OS << "\n";
+  EXPECT_DEATH(cantFail(make_error(1)), OS.str())
+  << "cantFail(Error) did not cause an abort for failure value";
+#else
+  // __FILE__ and __LINE__ added
+  int Line = __LINE__;
+  OS << " at " << __FILE__ << ":" << (Line + 2) << "\n";
+  EXPECT_DEATH(cantFail(make_error(1)), OS.str())
+  << "cantFail(Error) did not cause an abort for failure value";
+#endif
+}
 
 // Test Checked Expected in success mode.
 TEST(Error, CheckedExpectedInSuccessMode) {
Index: llvm/include/llvm/Support/Error.h
===
--- llvm/include/llvm/Support/Error.h
+++ llvm/include/llvm/Support/Error.h
@@ -687,6 +687,48 @@
 LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err,
 bool gen_crash_diag = true);
 
+namespace detail {
+
+inline LLVM_ATTRIBUTE_NORETURN void handleError(Error Err, const char *Msg,
+const char *file = nullptr,
+unsigned line = 0) {
+  if (!Msg)
+Msg = "Failure value returned from cantFail wrapped call";
+#ifndef NDEBUG
+  std::string Str;
+  raw_string_ostream OS(Str);
+  OS << Err << "\n" << Msg;
+  if (file)
+OS << " at " << file << ":" << line;
+  Msg = OS.str().c_str();
+#endif
+  llvm_unreachable(Msg);
+}
+
+inline void cantFail(const char *file, unsigned line, Error Err,
+ const char *Msg = nullptr) {
+  if (Err)
+handleError(std::move(Err), Msg, file, line);
+}
+
+template 
+T cantFail(const char *file, unsigned line, Expected ValOrEr

[Lldb-commits] [PATCH] D70417: Accept g packet responses that don't supply all registers

2019-11-19 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda updated this revision to Diff 230129.
jasonmolenda added a reviewer: labath.
jasonmolenda added a comment.

Updated GDBRemoteRegisterContext::ReadRegisterBytes to only mark registers as 
valid if the full contents for the register are included in the g packet.  
Updated gdbclientutils.py to strip off the thread specifier from the G packet, 
if it's present.  Change the test file to check that the G packet either 
includes the full register context or just the general purpose registers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70417

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
  
lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Index: lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
===
--- lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
+++ lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
@@ -0,0 +1,196 @@
+from __future__ import print_function
+import lldb
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
+from gdbclientutils import *
+
+class TestJLink6Armv7RegisterDefinition(GDBRemoteTestBase):
+
+@skipIfXmlSupportMissing
+@skipIfRemote
+def test(self):
+"""
+Test lldb's parsing of SEGGER J-Link v6.54 register
+definition for a Cortex M-4 dev board, and the fact
+that the J-Link only supports g/G for reading/writing
+register AND the J-Link v6.54 doesn't provide anything
+but the general purpose registers."""
+class MyResponder(MockGDBServerResponder):
+
+def qXferRead(self, obj, annex, offset, length):
+if annex == "target.xml":
+return """
+
+
+
+
+  arm
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+
+
+
+
+
+
+  
+  
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+""", False
+else:
+return None, False
+
+def readRegister(self, regnum):
+return "E01"
+
+# Initial r1 bytes, in little-endian order
+r1_bytes = "0100"
+
+## readRegisters only provides reg values up through xpsr (0x6100)
+## it doesn't send up any of the exception registers or floating point
+## registers that the above register xml describes.
+def readRegisters(self):
+return "" + self.r1_bytes + "0100010001008c080020a8720120a07901208065012041ad0008a0720120692a00089e2600080061"
+
+## the J-Link accepts a register write packet with just the GPRs
+## defined.
+def writeRegisters(self, registers_hex):
+# Check that lldb returns the full 704 hex-byte register context, 
+# or the 136 hex-byte general purpose register reg ctx.
+if len(registers_hex) != 704 and len(register_hex) != 136:
+return "E06"
+if registers_hex.startswith("443322110100010001008c080020a8720120a07901208065012041ad0008a0720120692a00089e2600080061"):
+self.r1_bytes = "44332211"
+return "OK"
+else:
+return "E07"
+
+def haltReason(self):
+return "S05"
+
+def qfThreadInfo(self):
+return "mdead"
+
+def qC(self):
+return ""
+
+def qSupported(self, client_supported):
+return "PacketSize=4000;qXfer:memory-map:read-;QStartNoAckMode+;hwbreak+;qXfer:features:read+"
+
+def QThreadSuffixSupported(self):
+return "OK"
+
+def QListThreadsInStopReply(self):
+return "OK"
+
+self.server.responder = MyResponder()
+if self.TraceOn():
+self.runCmd("log enable gdb-remote packets")
+self.addTearDownHook(
+lambda: self.runCmd("log disable gdb-remote packets"))
+
+self.dbg.SetDefaultArchitecture("armv7em")
+target = self.dbg.CreateTargetWithFileAndArch(None, None)
+
+process = self.connect(target)
+
+

[Lldb-commits] [PATCH] D70458: [NFC] Refactor and improve comments in CommandObjectTarget

2019-11-19 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth created this revision.
amccarth added a reviewer: labath.

Made small improvements while debugging through 
CommandObjectTarget::AddModuleSymbols.

1. Refactored error case for an early out, reducing the indentation of the rest 
of this long function.
2. Clarified some comments by correcting spelling and punctuation.
3. Reduced duplicate code at the end of the function.

Tested with `ninja check-lldb`


https://reviews.llvm.org/D70458

Files:
  lldb/source/Commands/CommandObjectTarget.cpp


Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -4044,14 +4044,21 @@
   bool AddModuleSymbols(Target *target, ModuleSpec &module_spec, bool &flush,
 CommandReturnObject &result) {
 const FileSpec &symbol_fspec = module_spec.GetSymbolFileSpec();
-if (symbol_fspec) {
+if (!symbol_fspec) {
+  result.AppendError(
+  "one or more executable image paths must be specified");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
 char symfile_path[PATH_MAX];
 symbol_fspec.GetPath(symfile_path, sizeof(symfile_path));
 
 if (!module_spec.GetUUID().IsValid()) {
   if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec())
-  module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename();
+module_spec.GetFileSpec() = symbol_fspec;
 }
+
 // We now have a module that represents a symbol file that can be used
 // for a module that might exist in the current target, so we need to
 // find that module in the target
@@ -4112,18 +4119,16 @@
 while (num_matches == 0) {
   ConstString filename_no_extension(
   module_spec.GetFileSpec().GetFileNameStrippingExtension());
-// Empty string returned, lets bail
+  // Empty string returned, let's bail
   if (!filename_no_extension)
 break;
 
-// Check if there was no extension to strip and the basename is the
-// same
+  // Check if there was no extension to strip and the basename is the same
   if (filename_no_extension == module_spec.GetFileSpec().GetFilename())
 break;
 
-// Replace basename with one less extension
+  // Replace basename with one fewer extension
   module_spec.GetFileSpec().GetFilename() = filename_no_extension;
-
   target->GetImages().FindModules(module_spec, matching_module_list);
   num_matches = matching_module_list.GetSize();
 }
@@ -4186,27 +4191,18 @@
 }
 
 namespace fs = llvm::sys::fs;
-  if (module_spec.GetUUID().IsValid()) {
 StreamString ss_symfile_uuid;
+if (module_spec.GetUUID().IsValid()) {
+  ss_symfile_uuid << " (";
   module_spec.GetUUID().Dump(&ss_symfile_uuid);
+  ss_symfile_uuid << ')';
+}
 result.AppendErrorWithFormat(
-"symbol file '%s' (%s) does not match any existing module%s\n",
+"symbol file '%s'%s does not match any existing module%s\n",
 symfile_path, ss_symfile_uuid.GetData(),
 !fs::is_regular_file(symbol_fspec.GetPath())
 ? "\n   please specify the full path to the symbol file"
 : "");
-  } else {
-result.AppendErrorWithFormat(
-"symbol file '%s' does not match any existing module%s\n",
-symfile_path,
-!fs::is_regular_file(symbol_fspec.GetPath())
-? "\n   please specify the full path to the symbol file"
-: "");
-  }
-} else {
-  result.AppendError(
-  "one or more executable image paths must be specified");
-}
 result.SetStatus(eReturnStatusFailed);
 return false;
   }


Index: lldb/source/Commands/CommandObjectTarget.cpp
===
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -4044,14 +4044,21 @@
   bool AddModuleSymbols(Target *target, ModuleSpec &module_spec, bool &flush,
 CommandReturnObject &result) {
 const FileSpec &symbol_fspec = module_spec.GetSymbolFileSpec();
-if (symbol_fspec) {
+if (!symbol_fspec) {
+  result.AppendError(
+  "one or more executable image paths must be specified");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
+}
+
 char symfile_path[PATH_MAX];
 symbol_fspec.GetPath(symfile_path, sizeof(symfile_path));
 
 if (!module_spec.GetUUID().IsValid()) {
   if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec())
-  module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename();
+module_spec.GetFileSpec() = symbol_fspec;
 }
+
 // We now have a module that represents a symbol file that can be used
 // for a module that might exist in the current target, so we ne

[Lldb-commits] [lldb] 327a18c - [lldb][test] Prevent \n in calls to lldb's expect() test helper.

2019-11-19 Thread Jordan Rupprecht via lldb-commits

Author: Jordan Rupprecht
Date: 2019-11-19T15:17:35-08:00
New Revision: 327a18ca0a000e4f99d02d0042ca2106db635a68

URL: 
https://github.com/llvm/llvm-project/commit/327a18ca0a000e4f99d02d0042ca2106db635a68
DIFF: 
https://github.com/llvm/llvm-project/commit/327a18ca0a000e4f99d02d0042ca2106db635a68.diff

LOG: [lldb][test] Prevent \n in calls to lldb's expect() test helper.

Summary:
expect() forwards its command to sendline(). This can be problematic if the 
command already contains a newline: sendline() unconditionally adds a newline 
to the command, which causes the command to run twice (hitting enter in lldb 
runs the previous command). The expect() helper looks for the prompt and finds 
the first one, but because the command has run a second time, the buffer will 
contain the contents of the second time the command ran, causing potential 
erroneous matching.

Simplify the editline test, which was using different commands to workaround 
this misunderstanding.

Reviewers: labath

Reviewed By: labath

Subscribers: merge_guards_bot, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbpexpect.py
lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py 
b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
index 402148a9534f..ef60eadba319 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py
@@ -50,6 +50,7 @@ def launch(self, executable=None, extra_args=None, 
timeout=30, dimensions=None):
 self.expect_prompt()
 
 def expect(self, cmd, substrs=None):
+self.assertNotIn('\n', cmd)
 self.child.sendline(cmd)
 if substrs is not None:
 for s in substrs:

diff  --git a/lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py 
b/lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
index 49a46f2de539..df622820028b 100644
--- a/lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
+++ b/lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
@@ -24,26 +24,23 @@ def test_left_right_arrow(self):
 "help command" while exercising word-navigation, so type it as below,
 where [] indicates cursor position.
 
-1. Send "el ommand" -> "el ommand[]"
-2. Ctrl+left once   -> "el []ommand"
-3. Send "c" -> "el c[]ommand"
-4. Ctrl+left twice  -> "[]el command"
-5. Send "h" -> "h[]el command"
-6. Ctrl+right   -> "hel[] command"
-7. Send "p" -> "help command"
+1. Send "el rint"  -> "el rint[]"
+2. Ctrl+left once  -> "el []rint"
+3. Send "p"-> "el p[]rint"
+4. Ctrl+left twice -> "[]el print"
+5. Send "h"-> "h[]el print"
+6. Ctrl+right  -> "hel[] print"
+7. Send "p"-> "help print"
 """
 self.launch()
 
-# Run help for 
diff erent commands for escape variants to make sure each
-# one matches uniquely (the buffer isn't cleared in between matches).
-cases = [
-("print", "\x1b[1;5D", "\x1b[1;5C"),
-("step", "\x1b[5D", "\x1b[5C"),
-("exit", "\x1b\x1b[D", "\x1b\x1b[C"),
+escape_pairs = [
+("\x1b[1;5D", "\x1b[1;5C"),
+("\x1b[5D", "\x1b[5C"),
+("\x1b\x1b[D", "\x1b\x1b[C"),
 ]
-for (cmd, l_escape, r_escape) in cases:
-self.expect("el {cmd_tail}{L}{cmd_head}{L}{L}h{R}p".format(
-cmd_head=cmd[0], cmd_tail=cmd[1:], L=l_escape, R=r_escape),
-substrs=["Syntax: %s" % cmd])
+for (l_escape, r_escape) in escape_pairs:
+self.expect("el rint{L}p{L}{L}h{R}p".format(
+L=l_escape, R=r_escape), substrs=["Syntax: print"])
 
 self.quit()



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


[Lldb-commits] [PATCH] D70324: [lldb][test] Prevent \n in calls to lldb's expect() test helper.

2019-11-19 Thread Jordan Rupprecht via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG327a18ca0a00: [lldb][test] Prevent \n in calls to 
lldb's expect() test helper. (authored by rupprecht).

Changed prior to commit:
  https://reviews.llvm.org/D70324?vs=229593&id=230157#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70324

Files:
  lldb/packages/Python/lldbsuite/test/lldbpexpect.py
  lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py


Index: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
===
--- lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
+++ lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
@@ -24,26 +24,23 @@
 "help command" while exercising word-navigation, so type it as below,
 where [] indicates cursor position.
 
-1. Send "el ommand" -> "el ommand[]"
-2. Ctrl+left once   -> "el []ommand"
-3. Send "c" -> "el c[]ommand"
-4. Ctrl+left twice  -> "[]el command"
-5. Send "h" -> "h[]el command"
-6. Ctrl+right   -> "hel[] command"
-7. Send "p" -> "help command"
+1. Send "el rint"  -> "el rint[]"
+2. Ctrl+left once  -> "el []rint"
+3. Send "p"-> "el p[]rint"
+4. Ctrl+left twice -> "[]el print"
+5. Send "h"-> "h[]el print"
+6. Ctrl+right  -> "hel[] print"
+7. Send "p"-> "help print"
 """
 self.launch()
 
-# Run help for different commands for escape variants to make sure each
-# one matches uniquely (the buffer isn't cleared in between matches).
-cases = [
-("print", "\x1b[1;5D", "\x1b[1;5C"),
-("step", "\x1b[5D", "\x1b[5C"),
-("exit", "\x1b\x1b[D", "\x1b\x1b[C"),
+escape_pairs = [
+("\x1b[1;5D", "\x1b[1;5C"),
+("\x1b[5D", "\x1b[5C"),
+("\x1b\x1b[D", "\x1b\x1b[C"),
 ]
-for (cmd, l_escape, r_escape) in cases:
-self.expect("el {cmd_tail}{L}{cmd_head}{L}{L}h{R}p".format(
-cmd_head=cmd[0], cmd_tail=cmd[1:], L=l_escape, R=r_escape),
-substrs=["Syntax: %s" % cmd])
+for (l_escape, r_escape) in escape_pairs:
+self.expect("el rint{L}p{L}{L}h{R}p".format(
+L=l_escape, R=r_escape), substrs=["Syntax: print"])
 
 self.quit()
Index: lldb/packages/Python/lldbsuite/test/lldbpexpect.py
===
--- lldb/packages/Python/lldbsuite/test/lldbpexpect.py
+++ lldb/packages/Python/lldbsuite/test/lldbpexpect.py
@@ -50,6 +50,7 @@
 self.expect_prompt()
 
 def expect(self, cmd, substrs=None):
+self.assertNotIn('\n', cmd)
 self.child.sendline(cmd)
 if substrs is not None:
 for s in substrs:


Index: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
===
--- lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
+++ lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
@@ -24,26 +24,23 @@
 "help command" while exercising word-navigation, so type it as below,
 where [] indicates cursor position.
 
-1. Send "el ommand" -> "el ommand[]"
-2. Ctrl+left once   -> "el []ommand"
-3. Send "c" -> "el c[]ommand"
-4. Ctrl+left twice  -> "[]el command"
-5. Send "h" -> "h[]el command"
-6. Ctrl+right   -> "hel[] command"
-7. Send "p" -> "help command"
+1. Send "el rint"  -> "el rint[]"
+2. Ctrl+left once  -> "el []rint"
+3. Send "p"-> "el p[]rint"
+4. Ctrl+left twice -> "[]el print"
+5. Send "h"-> "h[]el print"
+6. Ctrl+right  -> "hel[] print"
+7. Send "p"-> "help print"
 """
 self.launch()
 
-# Run help for different commands for escape variants to make sure each
-# one matches uniquely (the buffer isn't cleared in between matches).
-cases = [
-("print", "\x1b[1;5D", "\x1b[1;5C"),
-("step", "\x1b[5D", "\x1b[5C"),
-("exit", "\x1b\x1b[D", "\x1b\x1b[C"),
+escape_pairs = [
+("\x1b[1;5D", "\x1b[1;5C"),
+("\x1b[5D", "\x1b[5C"),
+("\x1b\x1b[D", "\x1b\x1b[C"),
 ]
-for (cmd, l_escape, r_escape) in cases:
-self.expect("el {cmd_tail}{L}{cmd_head}{L}{L}h{R}p".format(
-cmd_head=cmd[0], cmd_tail=cmd[1:], L=l_escape, R=r_escape),
-substrs=["Syntax: %s" % cmd])
+for (l_escape, r_escape) in escape_pairs:
+self.expect("el rint{L}p{L}{L}h{R}p".format(
+L

[Lldb-commits] [lldb] 36eea5c - [Reproducer] Namespace the reproducer dump options.

2019-11-19 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-19T16:19:43-08:00
New Revision: 36eea5c31f13c086c951239ff876564c90546efa

URL: 
https://github.com/llvm/llvm-project/commit/36eea5c31f13c086c951239ff876564c90546efa
DIFF: 
https://github.com/llvm/llvm-project/commit/36eea5c31f13c086c951239ff876564c90546efa.diff

LOG: [Reproducer] Namespace the reproducer dump options.

Make it clear that the current reproducer options are for dumping.

Added: 


Modified: 
lldb/source/Commands/CommandObjectReproducer.cpp
lldb/source/Commands/Options.td

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectReproducer.cpp 
b/lldb/source/Commands/CommandObjectReproducer.cpp
index 560df25b97c6..a22c704ebd0f 100644
--- a/lldb/source/Commands/CommandObjectReproducer.cpp
+++ b/lldb/source/Commands/CommandObjectReproducer.cpp
@@ -68,7 +68,7 @@ static constexpr OptionEnumValues ReproducerProviderType() {
   return OptionEnumValues(g_reproducer_provider_type);
 }
 
-#define LLDB_OPTIONS_reproducer
+#define LLDB_OPTIONS_reproducer_dump
 #include "CommandOptions.inc"
 
 class CommandObjectReproducerGenerate : public CommandObjectParsed {
@@ -208,7 +208,7 @@ class CommandObjectReproducerDump : public 
CommandObjectParsed {
 }
 
 ArrayRef GetDefinitions() override {
-  return makeArrayRef(g_reproducer_options);
+  return makeArrayRef(g_reproducer_dump_options);
 }
 
 FileSpec file;

diff  --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index fc7f45888bd9..501f81470a2e 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -429,7 +429,7 @@ let Command = "log" in {
 Desc<"Prepend the names of files and function that generate the logs.">;
 }
 
-let Command = "reproducer" in {
+let Command = "reproducer dump" in {
   def reproducer_provider : Option<"provider", "p">, Group<1>,
 EnumArg<"None", "ReproducerProviderType()">,
 Required, Desc<"The reproducer provider to dump.">;



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


[Lldb-commits] [PATCH] D69309: Support template instantiation in the expression evaluator

2019-11-19 Thread Frederic Riss via Phabricator via lldb-commits
friss added a comment.

Sorry that I haven't reviewed the patch, but there's something I'd like to 
point out before anyone invests a lot of time into plugin holes in our current 
template support code.

It would be great to fix the way templates are represented, because currently 
the debug info doesn't allow us to answer Clang's requests correctly. There is 
the beginning of a discussion here: 
http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html

Basically, today the debug info will describe an entity named "Foo". The 
accelerator tables all reference this name. So when Clang asks us if we know 
"Foo" (which is what happens when instantiating), we fail to find the right 
instantiations. The consensus of the above discussion was that we should change 
the debug info to have "Foo" as the name of any instantiation, with a child DIE 
describing the template arguments. Just doing this in the compiler causes test 
failures in LLDB, so there's some work to do in LLDB to support this.


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

https://reviews.llvm.org/D69309



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


[Lldb-commits] [PATCH] D70474: [Reproducer] Generate LLDB reproducer on crash

2019-11-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, vsk, jingham, friss.
Herald added a reviewer: jfb.
Herald added a project: LLDB.
JDevlieghere edited the summary of this revision.
Herald added a subscriber: dexonsmith.

This patch hooks the reproducer infrastructure with the signal handlers.
When lldb crashes with reproducers capture enabled, it will now generate
the reproducer and print a short message the standard out. This doesn't
affect the pretty stack traces, which are still printed before.

This patch also introduces a new reproducer sub-command that
intentionally raises a given signal to test the reproducer signal
handling.

Currently the signal handler is doing too much work. Instead of copying
over files into the reproducers in the signal handler, we should
re-invoke ourselves with a special command line flag that looks at the
VFS mapping and performs the copy.

This is a NO-OP when reproducers are disabled.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D70474

Files:
  lldb/include/lldb/API/SBReproducer.h
  lldb/source/API/SBReproducer.cpp
  lldb/source/Commands/CommandObjectReproducer.cpp
  lldb/source/Commands/Options.td
  lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
  lldb/test/Shell/Reproducer/TestCrash.test
  lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
  lldb/tools/driver/Driver.cpp

Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -732,6 +732,20 @@
   signal(signo, sigcont_handler);
 }
 
+void reproducer_handler(void *) {
+  if (SBReproducer::Generate()) {
+llvm::outs() << "\n";
+llvm::outs() << "Crash reproducer for ";
+llvm::outs() << lldb::SBDebugger::GetVersionString() << '\n';
+llvm::outs() << "Reproducer written to '" << SBReproducer::GetPath()
+ << "'\n";
+llvm::outs()
+<< "Please have a look at the directory to assess if you're willing to "
+   "share the contained information.\n";
+llvm::outs() << "\n";
+  }
+}
+
 static void printHelp(LLDBOptTable &table, llvm::StringRef tool_name) {
   std::string usage_str = tool_name.str() + "options";
   table.PrintHelp(llvm::outs(), usage_str.c_str(), "LLDB", false);
@@ -832,6 +846,9 @@
 return *exit_code;
   }
 
+  // Register the reproducer signal handler.
+  llvm::sys::AddSignalHandler(reproducer_handler, nullptr);
+
   SBError error = SBDebugger::InitializeWithErrorHandling();
   if (error.Fail()) {
 WithColor::error() << "initialization failed: " << error.GetCString()
Index: lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
===
--- lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
+++ lldb/test/Shell/Reproducer/TestGDBRemoteRepro.test
@@ -6,11 +6,18 @@
 # process. To ensure we're not actually running the original binary we check
 # that the string "testing" is not printed.
 
-# RUN: rm -rf %t.repro
 # RUN: %clang_host %S/Inputs/simple.c -g -o %t.out
+
+# Test reproducer generate.
+# RUN: rm -rf %t.repro
 # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
 # RUN: env FOO=BAR %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
 
+# Test an actual crash.
+# RUN: rm -rf %t.repro
+# RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCrashCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
+# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
+
 # CHECK: Breakpoint 1
 # CHECK: Process {{.*}} stopped
 # CHECK: Process {{.*}} launched
Index: lldb/test/Shell/Reproducer/TestCrash.test
===
--- /dev/null
+++ lldb/test/Shell/Reproducer/TestCrash.test
@@ -0,0 +1,14 @@
+# UNSUPPORTED: system-windows
+# This tests that a reproducer is generated when LLDB crashes.
+
+# Start clean.
+# RUN: rm -rf %t.repro
+
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s sigsegv' | FileCheck %s
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s sigbus' | FileCheck %s
+# RUN: %lldb -b --capture --capture-path %t.repro -o 'reproducer xcrash -s sigill' | FileCheck %s
+
+# CHECK: 
+# CHECK: Crash reproducer for
+# CHECK: Reproducer written to
+# CHECK: 
Index: lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
===
--- /dev/null
+++ lldb/test/Shell/Reproducer/Inputs/GDBRemoteCrashCapture.in
@@ -0,0 +1,6 @@
+breakpoint set -f simple.c -l 12
+run
+bt
+cont
+reproducer status
+reproducer xcrash -s sigsegv
Index: lldb/source/Commands/Options.td