[Lldb-commits] [PATCH] D55854: Show the memory region name if there is one in the output of the "memory region" command

2018-12-19 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

This looks fine to me. I have one inline suggestion you can consider. Also, 
I've been wondering whether there is any existing minidump that you could have 
used for the test purposes. It doesn't sound like there is anything too special 
about this minidump, and it would reduce the number of binary blobs we carry 
around.




Comment at: 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py:95-119
+result = lldb.SBCommandReturnObject()
+addr_region_name_pairs = [
+("0x400d9000", "/system/bin/app_process"),
+("0x400db000", "/system/bin/app_process"),
+("0x400dd000", "/system/bin/linker"),
+("0x400ed000", "/system/bin/linker"),
+("0x400ee000", "/system/bin/linker"),

wouldn't `self.expect` be able to handle this? I would expect this can just be 
a series of `self.expect("memory region XXX", substrs = 
["/system/lib/whatever.so"])` commands.


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

https://reviews.llvm.org/D55854



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


[Lldb-commits] [PATCH] D55858: noexternal 1/2: refactor testsuite spawnLldbMi args->exe+args

2018-12-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py:53
+if exe:
+self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
 

Shouldn't you also expect the `^done` response here or something similar?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55858



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


[Lldb-commits] [PATCH] D55858: noexternal 1/2: refactor testsuite spawnLldbMi args->exe+args

2018-12-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil marked 3 inline comments as done.
jankratochvil added a comment.

Thanks for the review!




Comment at: packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py:53
+if exe:
+self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
 

labath wrote:
> Shouldn't you also expect the `^done` response here or something similar?
This would break compatibility with previous behavior of this function, see my 
`test_lldbmi_specialchars` comment below.



Comment at: 
packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py:63
 self.expect("\^done")
 
 # Check that it was loaded correctly

Here you can see just by passing `complicated_myexe` as `spawnLldbMi` parameter 
the code still expects to be able to match the `-file-exec-and-symbols` command.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55858



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


[Lldb-commits] [PATCH] D55858: noexternal 1/2: refactor testsuite spawnLldbMi args->exe+args

2018-12-19 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Ok, if that's how things worked previously, then this lgtm.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55858



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


[Lldb-commits] [PATCH] D55858: noexternal 1/2: refactor testsuite spawnLldbMi args->exe+args

2018-12-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 178842.
jankratochvil marked an inline comment as done.
jankratochvil added a comment.

I have put there a comment:

   self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
  +# Testcases expect to be able to match output of this command,
  +# see test_lldbmi_specialchars.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55858

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
  
packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
  packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
  source/Host/common/Symbols.cpp

Index: source/Host/common/Symbols.cpp
===
--- source/Host/common/Symbols.cpp
+++ source/Host/common/Symbols.cpp
@@ -199,7 +199,7 @@
   return false;
 }
 
-FileSpec LocateExecutableSymbolFileDsym(const ModuleSpec &module_spec) {
+static FileSpec LocateExecutableSymbolFileDsym(const ModuleSpec &module_spec) {
   const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
   const ArchSpec *arch = module_spec.GetArchitecturePtr();
   const UUID *uuid = module_spec.GetUUIDPtr();
Index: packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
@@ -53,7 +53,7 @@
 os.symlink(self.myexe, complicated_myexe)
 self.addTearDownHook(lambda: os.unlink(complicated_myexe))
 
-self.spawnLldbMi(args="\"%s\"" % complicated_myexe)
+self.spawnLldbMi(exe=complicated_myexe)
 
 # Test that the executable was loaded
 self.expect(
Index: packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
@@ -22,7 +22,7 @@
 def test_lldbmi_executable_option_file(self):
 """Test that 'lldb-mi --interpreter %s' loads executable file."""
 
-self.spawnLldbMi(args="%s" % self.myexe)
+self.spawnLldbMi(exe=self.myexe)
 
 # Test that the executable is loaded when file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
@@ -52,7 +52,7 @@
 # Prepare path to executable
 path = "unknown_file"
 
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable isn't loaded when unknown file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % path)
@@ -71,7 +71,7 @@
 """Test that 'lldb-mi --interpreter %s' loads executable which is specified via absolute path."""
 
 # Prepare path to executable
-self.spawnLldbMi(args="%s" % self.myexe)
+self.spawnLldbMi(exe=self.myexe)
 
 # Test that the executable is loaded when file was specified using
 # absolute path
@@ -95,7 +95,7 @@
 
 # Prepare path to executable
 path = os.path.relpath(self.myexe, self.getBuildDir())
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable is loaded when file was specified using
 # relative path
@@ -119,7 +119,7 @@
 # Prepare path to executable
 path = "unknown_dir" + self.myexe
 
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable isn't loaded when file was specified using
 # unknown path
@@ -259,7 +259,7 @@
 """Test that 'lldb-mi --log' creates a log file in the current directory."""
 
 logDirectory = self.getBuildDir()
-self.spawnLldbMi(args="%s --log" % self.myexe)
+self.spawnLldbMi(exe=self.myexe, args="--log")
 
 # Test that the executable is loaded when file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
@@ -296,9 +296,8 @@
 import tempfile
 logDirectory = tempfile.gettempdir()
 
-self.spawnLldbMi(
-args="%s --log --log-dir=%s" %
-(self.myexe, logDirectory))
+self.spawnLldbMi(exe=self.myexe,
+args="--log --log-dir=%s" % logDirectory)
 
 # Test that the executable is loaded when file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
Index: packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
@@ -40

[Lldb-commits] [PATCH] D55859: noexternal 2/2: symbols.enable-external-lookup=false on all hosts (not just OSX)

2018-12-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added reviewers: aprantl, clayborg.
labath added a comment.

I think this fits well in the spirit in which the `enable-external-lookup` 
setting was introduced (i.e., to reduce test environment dependencies on mac), 
but the letter is somewhat questionable. The setting is currently described as 
"Control the use of external tools or libraries to locate symbol files.", which 
doesn't sound quite like what is happening here. I think this description 
rephrased to something more generic so that it covers this use case too. I'm 
not sure exactly how though. Maybe some blurb about not using "external 
resources" for symbols and then explaining that we consider /usr/lib/debug to 
be an external resource? Or maybe just outright confess that this does whatever 
it takes to make the lldb symbol lookup more predictable/hermetic?

+Adrian and Greg to see what they think about this.




Comment at: source/Host/common/Symbols.cpp:365
 
+  if (!external_lookup) {
+Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);

This doesn't sound right to me. It looks like this will prevent 
`LocateDSYMInVincinityOfExecutable`, which (I would expect) is necessary to 
find dsym bundles for all of our dsym tests.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55859



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


[Lldb-commits] [PATCH] D55859: noexternal 2/2: symbols.enable-external-lookup=false on all hosts (not just OSX)

2018-12-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil added inline comments.



Comment at: source/Host/common/Symbols.cpp:365
 
+  if (!external_lookup) {
+Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);

labath wrote:
> This doesn't sound right to me. It looks like this will prevent 
> `LocateDSYMInVincinityOfExecutable`, which (I would expect) is necessary to 
> find dsym bundles for all of our dsym tests.
I have regression tested it only on Fedora 29 x86_64. I see now it may regress 
OSX but I have no idea what really dsym is. I do not have OSX available, is it 
accessible somewhere remotely for LLVM development (such as is [[ 
https://cfarm.tetaneutral.net/ | GCC Compile Farm ]])?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55859



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


[Lldb-commits] [lldb] r349607 - refactor testsuite spawnLldbMi args->exe+args

2018-12-19 Thread Jan Kratochvil via lldb-commits
Author: jankratochvil
Date: Wed Dec 19 00:57:10 2018
New Revision: 349607

URL: http://llvm.org/viewvc/llvm-project?rev=349607&view=rev
Log:
refactor testsuite spawnLldbMi args->exe+args

Currently spawnLldbMi accepts both lldb-mi options and executable to debug as
a single parameter. Split them.

As in D55859 we will need to execute one lldb-mi command before loading the
exe. Therefore we can no longer use the exe as lldb-mi command-line parameter
as then there is no way to execute a command before loading exe specified as
lldb-mi command-line parameter.

LocateExecutableSymbolFileDsym should be static, that is also a little
refactorization.

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

Modified:
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
lldb/trunk/source/Host/common/Symbols.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py?rev=349607&r1=349606&r2=349607&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py 
Wed Dec 19 00:57:10 2018
@@ -40,7 +40,7 @@ class MiTestCaseBase(Base):
 pass
 Base.tearDown(self)
 
-def spawnLldbMi(self, args=None):
+def spawnLldbMi(self, exe=None, args=None):
 import pexpect
 self.child = pexpect.spawn("%s --interpreter %s" % (
 self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
@@ -49,6 +49,10 @@ class MiTestCaseBase(Base):
 self.child.logfile_read = open(self.mylog, "w")
 # wait until lldb-mi has started up and is ready to go
 self.expect(self.child_prompt, exactly=True)
+if exe:
+self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
+# Testcases expect to be able to match output of this command,
+# see test_lldbmi_specialchars.
 
 def runCmd(self, cmd):
 self.child.sendline(cmd)

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=349607&r1=349606&r2=349607&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
 Wed Dec 19 00:57:10 2018
@@ -22,7 +22,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 def test_lldbmi_executable_option_file(self):
 """Test that 'lldb-mi --interpreter %s' loads executable file."""
 
-self.spawnLldbMi(args="%s" % self.myexe)
+self.spawnLldbMi(exe=self.myexe)
 
 # Test that the executable is loaded when file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
@@ -52,7 +52,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 # Prepare path to executable
 path = "unknown_file"
 
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable isn't loaded when unknown file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % path)
@@ -71,7 +71,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 """Test that 'lldb-mi --interpreter %s' loads executable which is 
specified via absolute path."""
 
 # Prepare path to executable
-self.spawnLldbMi(args="%s" % self.myexe)
+self.spawnLldbMi(exe=self.myexe)
 
 # Test that the executable is loaded when file was specified using
 # absolute path
@@ -95,7 +95,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 
 # Prepare path to executable
 path = os.path.relpath(self.myexe, self.getBuildDir())
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable is loaded when file was specified using
 # relative path
@@ -119,7 +119,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 # Prepare path to executable
 path = "unknown_dir" + self.myexe
 
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable isn't loaded when file was specified using
 # unknown path
@@ -259,7 +259,7 @@ class MiStartupOptionsTestCase(lldbmi_te
 """Test that 'lldb-mi --log' creates a log file in the current 
directory."""
 

[Lldb-commits] [PATCH] D55858: noexternal 1/2: refactor testsuite spawnLldbMi args->exe+args

2018-12-19 Thread Jan Kratochvil via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349607: refactor testsuite spawnLldbMi args->exe+args 
(authored by jankratochvil, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D55858?vs=178842&id=178844#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D55858

Files:
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
  lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
  lldb/trunk/source/Host/common/Symbols.cpp

Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
@@ -53,7 +53,7 @@
 os.symlink(self.myexe, complicated_myexe)
 self.addTearDownHook(lambda: os.unlink(complicated_myexe))
 
-self.spawnLldbMi(args="\"%s\"" % complicated_myexe)
+self.spawnLldbMi(exe=complicated_myexe)
 
 # Test that the executable was loaded
 self.expect(
Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
@@ -40,7 +40,7 @@
 pass
 Base.tearDown(self)
 
-def spawnLldbMi(self, args=None):
+def spawnLldbMi(self, exe=None, args=None):
 import pexpect
 self.child = pexpect.spawn("%s --interpreter %s" % (
 self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
@@ -49,6 +49,10 @@
 self.child.logfile_read = open(self.mylog, "w")
 # wait until lldb-mi has started up and is ready to go
 self.expect(self.child_prompt, exactly=True)
+if exe:
+self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
+# Testcases expect to be able to match output of this command,
+# see test_lldbmi_specialchars.
 
 def runCmd(self, cmd):
 self.child.sendline(cmd)
Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
@@ -22,7 +22,7 @@
 def test_lldbmi_executable_option_file(self):
 """Test that 'lldb-mi --interpreter %s' loads executable file."""
 
-self.spawnLldbMi(args="%s" % self.myexe)
+self.spawnLldbMi(exe=self.myexe)
 
 # Test that the executable is loaded when file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
@@ -52,7 +52,7 @@
 # Prepare path to executable
 path = "unknown_file"
 
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable isn't loaded when unknown file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % path)
@@ -71,7 +71,7 @@
 """Test that 'lldb-mi --interpreter %s' loads executable which is specified via absolute path."""
 
 # Prepare path to executable
-self.spawnLldbMi(args="%s" % self.myexe)
+self.spawnLldbMi(exe=self.myexe)
 
 # Test that the executable is loaded when file was specified using
 # absolute path
@@ -95,7 +95,7 @@
 
 # Prepare path to executable
 path = os.path.relpath(self.myexe, self.getBuildDir())
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable is loaded when file was specified using
 # relative path
@@ -119,7 +119,7 @@
 # Prepare path to executable
 path = "unknown_dir" + self.myexe
 
-self.spawnLldbMi(args="%s" % path)
+self.spawnLldbMi(exe=path)
 
 # Test that the executable isn't loaded when file was specified using
 # unknown path
@@ -259,7 +259,7 @@
 """Test that 'lldb-mi --log' creates a log file in the current directory."""
 
 logDirectory = self.getBuildDir()
-self.spawnLldbMi(args="%s --log" % self.myexe)
+self.spawnLldbMi(exe=self.myexe, args="--log")
 
 # Test that the executable is loaded when file was specified
 self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
@@ -296,9 +296,8 @@
 import tempfile
 logDirectory = tempfile.gettempdir()
 
-se

[Lldb-commits] [PATCH] D55827: Update current working directory to avoid test crashes

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

In D55827#1335207 , @JDevlieghere 
wrote:

> In D55827#1334671 , @labath wrote:
>
> > Hm... this seems like an important issue in the `RealFileSystem` (or our 
> > usage of it), and I'm not sure it should be papered over like that. I mean, 
> > lldb is a library, and requiring every call to `chdir` in the whole process 
> > go through "our" implementation is not very friendly towards everyone else 
> > we happen to be sharing a process with.
>
>
> On the other hand (playing the devil's advocate) it could be considered nice 
> that lldb as a library isn't affected by that if we explicitly set the cwd?


Yes, I can see how that could be nice, particularly if we could make the CWD 
local to each debugger instance so that they are truly independent. However, I 
think that should be a conscious decision for us to make (and discuss), and I 
don't think we were aware of this quirk (I certainly wasn't) of the VFS switch. 
If we go down this road, we should prepare a coherent story we will tell our 
users, as this can have some surprising side-effects. e.g., if the user uses 
relative paths in a python script (pretty printer, breakpoint stop-hook, etc.), 
those paths can end up having a different meaning once they make it into lldb 
C++ code because their notions of CWD may differ.

> 
> 
>> It sounds like we want a VFS that is slightly more "real" than the 
>> RealFileSystem, and which shares the notion of the CWD with the OS.
> 
> Did you have a look at the comment in `VirtualFileSystem.cpp` that explains 
> why they went this route?
> 
>   // FIXME: chdir is thread hostile; on the other hand, creating the same
>   // behavior as chdir is complex: chdir resolves the path once, thus
>   // guaranteeing that all subsequent relative path operations work
>   // on the same path the original chdir resulted in. This makes a
>   // difference for example on network filesystems, where symlinks might be
>   // switched during runtime of the tool. Fixing this depends on having a
>   // file system abstraction that allows openat() style interactions.
>
> 
> Wouldn't we encounter the same problem?

I don't think this comment matters for us. The way I read this, is that it is 
written from the POV of someone who wanted to make the CWD completely local to 
a `RealFileSystem` instance, and then complained that this is hard due to 
reasons outlined above (which it certainly is).

This is exactly the opposite of what I am proposing to do. :) That is, to make 
the RealFileSystem use the "real" CWD, whatever it happens to be at the moment 
of the call (the same behavior as the real os syscalls). It sounds like this 
behavior could be achieved by just deleting the CWDCache variable and having 
`getCurrentWorkingDirectory` always return the actual CWD. This may run 
contrary to what the original design goals of VFS were, but I would argue that 
this at least makes the RealFileSystem class self-consistent. Right now it has 
this weird behavior that all relative paths are still treated as relative to 
the "real" CWD, but then when someone asks to retrieve the CWD, it just returns 
some random cached value (which means that we don't even get the CWD isolation 
that we were speaking about in the first paragraph).


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55827



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


[Lldb-commits] [PATCH] D55859: noexternal 2/2: symbols.enable-external-lookup=false on all hosts (not just OSX)

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

> I have regression tested it only on Fedora 29 x86_64. I see now it may 
> regress OSX but I have no idea what really dsym is.

dsym is a apple-specific format for external storage of debug info. I think the 
closest standard equivalent would be a DWP bundle, but there some differences 
too (and dsym is much older).

> I do not have OSX available, is it accessible somewhere remotely for LLVM 
> development (such as is GCC Compile Farm)?

Unfortunately, I don't think llvm has anything like that, though I think it 
would be extremely useful (/me looks at apple folks). If you try hard enough, 
you should be able to get clang to produce a dsym bundle for you even on linux. 
This did the trick for me:

  $ cat /tmp/a.c 
  void start() asm("start");
  void dyld_stub_binder() asm("dyld_stub_binder");
  
  void start() {}
  void dyld_stub_binder() {}
  $ bin/clang --target=x86_64-apple-darwin --debug /tmp/a.c -o /tmp/a.out 
-fuse-ld=lld -nostdlib
  ld64.lld: warning: -sdk_version is required when emitting min version load 
command.  Setting sdk version to match provided min version
  $ ls -l /tmp/a.out.dSYM/Contents/Resources/DWARF
  total 12
  -rw-rw 1 pavel pavel 8852 Dec 19 10:24 a.out


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55859



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


[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2018-12-19 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha marked an inline comment as not done.
tatyana-krasnukha added a comment.

`ARCflags` are used by ABISysV_arc (related patch D55724 
). I would be glad to move it to architecture 
plugin, but I ought to add SetFlags/GetFlags to Architecture interface in this 
case. Then we'll have the same members in ArchSpec and in Architecture, that 
may look confusing.




Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4704-4707
+if (!arc::ConfigureArchitecture(*this, m_register_info, arch_to_use))
+  return false;
+
+arc::AdjustRegisterInfo(m_register_info, arch_to_use);

clayborg wrote:
> This logic still seems possibly incorrect as we will skip the finalize call 
> below? Shouldn't this just be:
> 
> ```
> if (arc::ConfigureArchitecture(*this, m_register_info, arch_to_use))
>   arc::AdjustRegisterInfo(m_register_info, arch_to_use);
> ```
> And fall through to below?
If we cannot configure the architecture it is a failure and the register info 
is incorrect, so just return false. Maybe should clear `m_register_info`  in 
this case...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718



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


[Lldb-commits] [PATCH] D55472: Speadup memory regions handling and cleanup related code

2018-12-19 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 178883.
tatyana-krasnukha added a comment.

Minor change: replace `using` with `typedef` since old swig versions don't 
understand c++11's aliases.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55472

Files:
  include/lldb/API/SBMemoryRegionInfo.h
  include/lldb/API/SBMemoryRegionInfoList.h
  include/lldb/Target/Process.h
  include/lldb/lldb-forward.h
  source/API/SBMemoryRegionInfoList.cpp
  source/API/SBProcess.cpp
  source/Target/Process.cpp

Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -6030,7 +6030,7 @@
 }
 
 Status
-Process::GetMemoryRegions(std::vector ®ion_list) {
+Process::GetMemoryRegions(lldb_private::MemoryRegionInfos ®ion_list) {
 
   Status error;
 
@@ -6038,17 +6038,17 @@
 
   region_list.clear();
   do {
-lldb::MemoryRegionInfoSP region_info(new lldb_private::MemoryRegionInfo());
-error = GetMemoryRegionInfo(range_end, *region_info);
+lldb_private::MemoryRegionInfo region_info;
+error = GetMemoryRegionInfo(range_end, region_info);
 // GetMemoryRegionInfo should only return an error if it is unimplemented.
 if (error.Fail()) {
   region_list.clear();
   break;
 }
 
-range_end = region_info->GetRange().GetRangeEnd();
-if (region_info->GetMapped() == MemoryRegionInfo::eYes) {
-  region_list.push_back(region_info);
+range_end = region_info.GetRange().GetRangeEnd();
+if (region_info.GetMapped() == MemoryRegionInfo::eYes) {
+  region_list.push_back(std::move(region_info));
 }
   } while (range_end != LLDB_INVALID_ADDRESS);
 
Index: source/API/SBProcess.cpp
===
--- source/API/SBProcess.cpp
+++ source/API/SBProcess.cpp
@@ -1358,18 +1358,14 @@
SBMemoryRegionInfo &sb_region_info) {
   lldb::SBError sb_error;
   ProcessSP process_sp(GetSP());
-  MemoryRegionInfoSP region_info_sp =
-  std::make_shared();
   if (process_sp) {
 Process::StopLocker stop_locker;
 if (stop_locker.TryLock(&process_sp->GetRunLock())) {
   std::lock_guard guard(
   process_sp->GetTarget().GetAPIMutex());
+
   sb_error.ref() =
-  process_sp->GetMemoryRegionInfo(load_addr, *region_info_sp);
-  if (sb_error.Success()) {
-sb_region_info.ref() = *region_info_sp;
-  }
+  process_sp->GetMemoryRegionInfo(load_addr, sb_region_info.ref());
 } else {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
   if (log)
@@ -1385,35 +1381,23 @@
 }
 
 lldb::SBMemoryRegionInfoList SBProcess::GetMemoryRegions() {
-  lldb::SBError sb_error;
   lldb::SBMemoryRegionInfoList sb_region_list;
+
   ProcessSP process_sp(GetSP());
-  if (process_sp) {
-Process::StopLocker stop_locker;
-if (stop_locker.TryLock(&process_sp->GetRunLock())) {
-  std::lock_guard guard(
-  process_sp->GetTarget().GetAPIMutex());
-  std::vector region_list;
-  sb_error.ref() = process_sp->GetMemoryRegions(region_list);
-  if (sb_error.Success()) {
-std::vector::iterator end = region_list.end();
-for (std::vector::iterator it = region_list.begin();
- it != end; it++) {
-  SBMemoryRegionInfo sb_region_info(it->get());
-  sb_region_list.Append(sb_region_info);
-}
-  }
-} else {
-  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-  if (log)
-log->Printf(
-"SBProcess(%p)::GetMemoryRegionInfo() => error: process is running",
-static_cast(process_sp.get()));
-  sb_error.SetErrorString("process is running");
-}
+  Process::StopLocker stop_locker;
+  if (process_sp && stop_locker.TryLock(&process_sp->GetRunLock())) {
+std::lock_guard guard(
+process_sp->GetTarget().GetAPIMutex());
+
+process_sp->GetMemoryRegions(sb_region_list.ref());
   } else {
-sb_error.SetErrorString("SBProcess is invalid");
+Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+if (log)
+  log->Printf(
+  "SBProcess(%p)::GetMemoryRegionInfo() => error: process is running",
+  static_cast(process_sp.get()));
   }
+
   return sb_region_list;
 }
 
Index: source/API/SBMemoryRegionInfoList.cpp
===
--- source/API/SBMemoryRegionInfoList.cpp
+++ source/API/SBMemoryRegionInfoList.cpp
@@ -32,31 +32,47 @@
 return *this;
   }
 
-  uint32_t GetSize() { return m_regions.size(); }
+  size_t GetSize() const { return m_regions.size(); }
 
-  void Append(const lldb::SBMemoryRegionInfo &sb_region) {
+  void Reserve(size_t capacity) { return m_regions.reserve(capacity); }
+
+  void Append(const MemoryRegionInfo &sb_region) {
 m_regions.push_back(sb_region);
   }
 
   v

[Lldb-commits] [PATCH] D55859: noexternal 2/2: symbols.enable-external-lookup=false on all hosts (not just OSX)

2018-12-19 Thread Frederic Riss via Phabricator via lldb-commits
friss added a comment.

> Unfortunately, I don't think llvm has anything like that, though I think it 
> would be extremely useful (/me looks at apple folks). If you try hard enough, 
> you should be able to get clang to produce a dsym bundle for you even on 
> linux. This did the trick for me:
> 
>   $ cat /tmp/a.c 
>   void start() asm("start");
>   void dyld_stub_binder() asm("dyld_stub_binder");
>   
>   void start() {}
>   void dyld_stub_binder() {}
>   $ bin/clang --target=x86_64-apple-darwin --debug /tmp/a.c -o /tmp/a.out 
> -fuse-ld=lld -nostdlib
>   ld64.lld: warning: -sdk_version is required when emitting min version load 
> command.  Setting sdk version to match provided min version
>   $ ls -l /tmp/a.out.dSYM/Contents/Resources/DWARF
>   total 12
>   -rw-rw 1 pavel pavel 8852 Dec 19 10:24 a.out
>   

Pretty sure this won't work. It might generate a dSYM, but an empty one. 
dsymutil relies on the linker leaving breadcrumbs in the executable to be able 
to link the DWARF and AFAIK lld doesn't do this.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55859



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


[Lldb-commits] [PATCH] D55859: noexternal 2/2: symbols.enable-external-lookup=false on all hosts (not just OSX)

2018-12-19 Thread Frederic Riss via Phabricator via lldb-commits
friss added inline comments.



Comment at: source/Host/common/Symbols.cpp:365
 
+  if (!external_lookup) {
+Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);

jankratochvil wrote:
> labath wrote:
> > This doesn't sound right to me. It looks like this will prevent 
> > `LocateDSYMInVincinityOfExecutable`, which (I would expect) is necessary to 
> > find dsym bundles for all of our dsym tests.
> I have regression tested it only on Fedora 29 x86_64. I see now it may 
> regress OSX but I have no idea what really dsym is. I do not have OSX 
> available, is it accessible somewhere remotely for LLVM development (such as 
> is [[ https://cfarm.tetaneutral.net/ | GCC Compile Farm ]])?
I would just remove that early exit. The rest of the code shouldn't impact the 
systems you care about.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55859



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


[Lldb-commits] [lldb] r349642 - [lit] Make TestConvenienceVariables a cpp file

2018-12-19 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Wed Dec 19 09:10:21 2018
New Revision: 349642

URL: http://llvm.org/viewvc/llvm-project?rev=349642&view=rev
Log:
[lit] Make TestConvenienceVariables a cpp file

The build.py script always runs the compiler in C++ mode, regardless of
the file extension. This results in mangled names presented to the
linker which in turn cannot find the printf symbol.

While we figure out how to solve this issue I've turned the source file
into a cpp file and added extern c. This should unbreak the bots.

Added:
lldb/trunk/lit/Driver/Inputs/hello.cpp
Removed:
lldb/trunk/lit/Driver/Inputs/hello.c
Modified:
lldb/trunk/lit/Driver/Inputs/convenience.in
lldb/trunk/lit/Driver/TestConvenienceVariables.test

Modified: lldb/trunk/lit/Driver/Inputs/convenience.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/convenience.in?rev=349642&r1=349641&r2=349642&view=diff
==
--- lldb/trunk/lit/Driver/Inputs/convenience.in (original)
+++ lldb/trunk/lit/Driver/Inputs/convenience.in Wed Dec 19 09:10:21 2018
@@ -1,4 +1,4 @@
-breakpoint set -f hello.c -p Hello
+breakpoint set -f hello.cpp -p Hello
 run
 script print(lldb.debugger)
 script print(lldb.target)

Removed: lldb/trunk/lit/Driver/Inputs/hello.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/hello.c?rev=349641&view=auto
==
--- lldb/trunk/lit/Driver/Inputs/hello.c (original)
+++ lldb/trunk/lit/Driver/Inputs/hello.c (removed)
@@ -1,6 +0,0 @@
-int printf(const char *format, ...);
-
-int main(int argc, char **argv) {
-  printf("Hello World\n");
-  return 0;
-}

Added: lldb/trunk/lit/Driver/Inputs/hello.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/hello.cpp?rev=349642&view=auto
==
--- lldb/trunk/lit/Driver/Inputs/hello.cpp (added)
+++ lldb/trunk/lit/Driver/Inputs/hello.cpp Wed Dec 19 09:10:21 2018
@@ -0,0 +1,11 @@
+// The build.py script always runs the compiler in C++ mode, regardless of the
+// file extension. This results in mangled names presented to the linker which
+// in turn cannot find the printf symbol.
+extern "C" {
+int printf(const char *format, ...);
+
+int main(int argc, char **argv) {
+  printf("Hello World\n");
+  return 0;
+}
+}

Modified: lldb/trunk/lit/Driver/TestConvenienceVariables.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestConvenienceVariables.test?rev=349642&r1=349641&r2=349642&view=diff
==
--- lldb/trunk/lit/Driver/TestConvenienceVariables.test (original)
+++ lldb/trunk/lit/Driver/TestConvenienceVariables.test Wed Dec 19 09:10:21 2018
@@ -1,4 +1,4 @@
-RUN: %build %p/Inputs/hello.c -o %t
+RUN: %build %p/Inputs/hello.cpp -o %t
 RUN: %lldb %t -s %p/Inputs/convenience.in -o quit | FileCheck %s
 
 script print(lldb.debugger)
@@ -15,7 +15,7 @@ CHECK-SAME:   executable = TestConve
 CHECK: script print(lldb.thread.GetStopDescription(100))
 CHECK: breakpoint 1.1
 CHECK: script lldb.frame.GetLineEntry().GetLine()
-CHECK: 4
+CHECK: 8
 CHECK: script lldb.frame.GetLineEntry().GetFileSpec().GetFilename()
 CHECK: hello.c
 CHECK: script lldb.frame.GetFunctionName()


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


[Lldb-commits] [PATCH] D55472: Speadup memory regions handling and cleanup related code

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

One quick change required to avoid STL in public headers.




Comment at: include/lldb/lldb-forward.h:16
 #include "lldb/Utility/SharingPtr.h"
+#include 
 

Remove due to this header being part of the public API.



Comment at: include/lldb/lldb-forward.h:136
+class MemoryRegionInfo;
+typedef std::vector MemoryRegionInfos;
 class Module;

After thinking about this a bit, we shouldn't put any STL stuff in headers that 
are part of the public API as we never want to expose any STL through our API. 
Can probably move this into MemoryRegionInfo.h, or just use 
"std::vector" everywhere as long as it is in 
lldb_private or the global namespace (we only export "lldb::*").


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55472



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


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

2018-12-19 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

I tracked this down - the failures are not due to this change (or any LLDB 
change). It's this change to the common CMake files in LLVM: 
https://reviews.llvm.org/D55056


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55384



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


[Lldb-commits] [PATCH] D55859: noexternal 2/2: symbols.enable-external-lookup=false on all hosts (not just OSX)

2018-12-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil marked 4 inline comments as done.
jankratochvil added a comment.

In D55859#1336351 , @friss wrote:

> Pretty sure this won't work. It might generate a dSYM, but an empty one.


I agree LLDB did not parse such DSYM symbols on Linux.

Is the patch OK for check-in now? Thanks.




Comment at: source/Host/common/Symbols.cpp:365
 
+  if (!external_lookup) {
+Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);

friss wrote:
> jankratochvil wrote:
> > labath wrote:
> > > This doesn't sound right to me. It looks like this will prevent 
> > > `LocateDSYMInVincinityOfExecutable`, which (I would expect) is necessary 
> > > to find dsym bundles for all of our dsym tests.
> > I have regression tested it only on Fedora 29 x86_64. I see now it may 
> > regress OSX but I have no idea what really dsym is. I do not have OSX 
> > available, is it accessible somewhere remotely for LLVM development (such 
> > as is [[ https://cfarm.tetaneutral.net/ | GCC Compile Farm ]])?
> I would just remove that early exit. The rest of the code shouldn't impact 
> the systems you care about.
OK, yes, I have removed it.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55859



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


[Lldb-commits] [PATCH] D55859: noexternal 2/2: symbols.enable-external-lookup=false on all hosts (not just OSX)

2018-12-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 178910.
jankratochvil marked an inline comment as done.

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55859

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
  
packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
  
packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
  source/Host/common/Symbols.cpp

Index: source/Host/common/Symbols.cpp
===
--- source/Host/common/Symbols.cpp
+++ source/Host/common/Symbols.cpp
@@ -253,6 +253,9 @@
   FileSystem::Instance().Exists(symbol_file_spec))
 return symbol_file_spec;
 
+  bool external_lookup =
+  ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup();
+
   const char *symbol_filename = symbol_file_spec.GetFilename().AsCString();
   if (symbol_filename && symbol_filename[0]) {
 FileSpecList debug_file_search_paths(
@@ -270,30 +273,32 @@
   debug_file_search_paths.AppendIfUnique(file_spec);
 }
 
-// Add current working directory.
-{
-  FileSpec file_spec(".");
-  FileSystem::Instance().Resolve(file_spec);
-  debug_file_search_paths.AppendIfUnique(file_spec);
-}
+if (external_lookup) {
+  // Add current working directory.
+  {
+FileSpec file_spec(".");
+FileSystem::Instance().Resolve(file_spec);
+debug_file_search_paths.AppendIfUnique(file_spec);
+  }
 
 #ifndef _WIN32
 #if defined(__NetBSD__)
-// Add /usr/libdata/debug directory.
-{
-  FileSpec file_spec("/usr/libdata/debug");
-  FileSystem::Instance().Resolve(file_spec);
-  debug_file_search_paths.AppendIfUnique(file_spec);
-}
+  // Add /usr/libdata/debug directory.
+  {
+FileSpec file_spec("/usr/libdata/debug");
+FileSystem::Instance().Resolve(file_spec);
+debug_file_search_paths.AppendIfUnique(file_spec);
+  }
 #else
-// Add /usr/lib/debug directory.
-{
-  FileSpec file_spec("/usr/lib/debug");
-  FileSystem::Instance().Resolve(file_spec);
-  debug_file_search_paths.AppendIfUnique(file_spec);
-}
+  // Add /usr/lib/debug directory.
+  {
+FileSpec file_spec("/usr/lib/debug");
+FileSystem::Instance().Resolve(file_spec);
+debug_file_search_paths.AppendIfUnique(file_spec);
+  }
 #endif
 #endif // _WIN32
+}
 
 std::string uuid_str;
 const UUID &module_uuid = module_spec.GetUUID();
Index: packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
+++ packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
@@ -1,2 +1,3 @@
+settings set symbols.enable-external-lookup false
 -file-exec-and-symbols a.out
 -break-ins -f main
Index: packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
@@ -237,7 +237,11 @@
 
 # Prepared source file
 sourceFile = self.copyScript("start_script_error")
-self.spawnLldbMi(args="--source %s" % sourceFile)
+self.spawnLldbMi(args="--source %s" % sourceFile, preconfig=False)
+
+# After 'settings set symbols.enable-external-lookup false'
+self.expect("settings set symbols.enable-external-lookup false")
+self.expect("\^done")
 
 # After '-file-exec-and-symbols a.out'
 self.expect("-file-exec-and-symbols %s" % self.myexe)
Index: packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
@@ -40,7 +40,7 @@
 pass
 Base.tearDown(self)
 
-def spawnLldbMi(self, exe=None, args=None):
+def spawnLldbMi(self, exe=None, args=None, preconfig=True):
 import pexpect
 self.child = pexpect.spawn("%s --interpreter %s" % (
 self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
@@ -49,6 +49,10 @@
 self.child.logfile_read = open(self.mylog, "w")
 # wait until lldb-mi has started up and is ready to go
 self.expect(self.child_prompt, exactly=True)
+if preconfig:
+self.runCmd("settings set symbols.enable-external-lookup false")
+self.expect("\^done")
+self.expect(self.child_prompt, exactly=True)
 if exe:
 self.runCmd("-file-exec-and-symbols \"

[Lldb-commits] [PATCH] D55859: noexternal 2/2: symbols.enable-external-lookup=false on all hosts (not just OSX)

2018-12-19 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 178911.

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55859

Files:
  packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
  
packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
  
packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
  source/Host/common/Symbols.cpp

Index: source/Host/common/Symbols.cpp
===
--- source/Host/common/Symbols.cpp
+++ source/Host/common/Symbols.cpp
@@ -270,30 +270,33 @@
   debug_file_search_paths.AppendIfUnique(file_spec);
 }
 
-// Add current working directory.
-{
-  FileSpec file_spec(".");
-  FileSystem::Instance().Resolve(file_spec);
-  debug_file_search_paths.AppendIfUnique(file_spec);
-}
+if (ModuleList::GetGlobalModuleListProperties().GetEnableExternalLookup()) {
+
+  // Add current working directory.
+  {
+FileSpec file_spec(".");
+FileSystem::Instance().Resolve(file_spec);
+debug_file_search_paths.AppendIfUnique(file_spec);
+  }
 
 #ifndef _WIN32
 #if defined(__NetBSD__)
-// Add /usr/libdata/debug directory.
-{
-  FileSpec file_spec("/usr/libdata/debug");
-  FileSystem::Instance().Resolve(file_spec);
-  debug_file_search_paths.AppendIfUnique(file_spec);
-}
+  // Add /usr/libdata/debug directory.
+  {
+FileSpec file_spec("/usr/libdata/debug");
+FileSystem::Instance().Resolve(file_spec);
+debug_file_search_paths.AppendIfUnique(file_spec);
+  }
 #else
-// Add /usr/lib/debug directory.
-{
-  FileSpec file_spec("/usr/lib/debug");
-  FileSystem::Instance().Resolve(file_spec);
-  debug_file_search_paths.AppendIfUnique(file_spec);
-}
+  // Add /usr/lib/debug directory.
+  {
+FileSpec file_spec("/usr/lib/debug");
+FileSystem::Instance().Resolve(file_spec);
+debug_file_search_paths.AppendIfUnique(file_spec);
+  }
 #endif
 #endif // _WIN32
+}
 
 std::string uuid_str;
 const UUID &module_uuid = module_spec.GetUUID();
Index: packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
+++ packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/start_script_error
@@ -1,2 +1,3 @@
+settings set symbols.enable-external-lookup false
 -file-exec-and-symbols a.out
 -break-ins -f main
Index: packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
@@ -237,7 +237,11 @@
 
 # Prepared source file
 sourceFile = self.copyScript("start_script_error")
-self.spawnLldbMi(args="--source %s" % sourceFile)
+self.spawnLldbMi(args="--source %s" % sourceFile, preconfig=False)
+
+# After 'settings set symbols.enable-external-lookup false'
+self.expect("settings set symbols.enable-external-lookup false")
+self.expect("\^done")
 
 # After '-file-exec-and-symbols a.out'
 self.expect("-file-exec-and-symbols %s" % self.myexe)
Index: packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
===
--- packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
+++ packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
@@ -40,7 +40,7 @@
 pass
 Base.tearDown(self)
 
-def spawnLldbMi(self, exe=None, args=None):
+def spawnLldbMi(self, exe=None, args=None, preconfig=True):
 import pexpect
 self.child = pexpect.spawn("%s --interpreter %s" % (
 self.lldbMiExec, args if args else ""), cwd=self.getBuildDir())
@@ -49,6 +49,10 @@
 self.child.logfile_read = open(self.mylog, "w")
 # wait until lldb-mi has started up and is ready to go
 self.expect(self.child_prompt, exactly=True)
+if preconfig:
+self.runCmd("settings set symbols.enable-external-lookup false")
+self.expect("\^done")
+self.expect(self.child_prompt, exactly=True)
 if exe:
 self.runCmd("-file-exec-and-symbols \"%s\"" % exe)
 # Testcases expect to be able to match output of this command,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r349658 - Show the memory region name if there is one in the output of the "memory region" command

2018-12-19 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Wed Dec 19 10:16:52 2018
New Revision: 349658

URL: http://llvm.org/viewvc/llvm-project?rev=349658&view=rev
Log:
Show the memory region name if there is one in the output of the "memory 
region" command

Prior to this change we would show the name of the section that a memory region 
belonged to but not its actual region name. Now we show this,. Added a test 
that reuses the regions-linux-map.dmp minidump file to test this and verify the 
correct region names for various memory regions.

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


Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.dmp
   (with props)
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
lldb/trunk/source/Commands/CommandObjectMemory.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=349658&r1=349657&r2=349658&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
 Wed Dec 19 10:16:52 2018
@@ -88,6 +88,36 @@ class MiniDumpNewTestCase(TestBase):
 self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid)
 self.check_state()
 
+def test_memory_region_name(self):
+self.dbg.CreateTarget(None)
+self.target = self.dbg.GetSelectedTarget()
+self.process = self.target.LoadCore("regions-linux-map.dmp")
+result = lldb.SBCommandReturnObject()
+addr_region_name_pairs = [
+("0x400d9000", "/system/bin/app_process"),
+("0x400db000", "/system/bin/app_process"),
+("0x400dd000", "/system/bin/linker"),
+("0x400ed000", "/system/bin/linker"),
+("0x400ee000", "/system/bin/linker"),
+("0x400fb000", "/system/lib/liblog.so"),
+("0x400fc000", "/system/lib/liblog.so"),
+("0x400fd000", "/system/lib/liblog.so"),
+("0x400ff000", "/system/lib/liblog.so"),
+("0x4010", "/system/lib/liblog.so"),
+("0x40101000", "/system/lib/libc.so"),
+("0x40122000", "/system/lib/libc.so"),
+("0x40123000", "/system/lib/libc.so"),
+("0x40167000", "/system/lib/libc.so"),
+("0x40169000", "/system/lib/libc.so"),
+]
+ci = self.dbg.GetCommandInterpreter()
+for (addr, region_name) in addr_region_name_pairs:
+command = 'memory region ' + addr
+ci.HandleCommand(command, result, False)
+message = 'Ensure memory "%s" shows up in output for "%s"' % (
+region_name, command)
+self.assertTrue(region_name in result.GetOutput(), message)
+
 def test_modules_in_mini_dump(self):
 """Test that lldb can read the list of modules from the minidump."""
 # target create -c linux-x86_64.dmp

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.dmp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.dmp?rev=349658&view=auto
==
Binary file - no diff available.

Propchange: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.dmp
--
svn:mime-type = application/octet-stream

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=349658&r1=349657&r2=349658&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Wed Dec 19 10:16:52 2018
@@ -1723,6 +1723,7 @@ protected:
 error = process_sp->GetMemoryRegionInfo(load_addr, range_info);
 if (error.Success()) {
   lldb_private::Address addr;
+  ConstString name = range_info.GetName();
   ConstString section_name;
   if (process_sp->GetTarget().ResolveLoadAddress(load_addr, addr)) {
 SectionSP section_sp(addr.GetSection());
@@ -1734,13 +1735,14 @@ protected:
 }
   }
   result.AppendMessageWithFormat(
-  "[0x%16.16" PRIx64 "-0x%16.16" PRIx64 ") %c%c%c%s%s\n",
+  "[0x%16.16" PRIx64 "-0x%16.16" PRIx6

[Lldb-commits] [PATCH] D55854: Show the memory region name if there is one in the output of the "memory region" command

2018-12-19 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB349658: Show the memory region name if there is one in 
the output of the "memory… (authored by gclayton, committed by ).
Herald added a subscriber: abidh.

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55854

Files:
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.dmp
  source/Commands/CommandObjectMemory.cpp


Index: 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===
--- 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -88,6 +88,36 @@
 self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid)
 self.check_state()
 
+def test_memory_region_name(self):
+self.dbg.CreateTarget(None)
+self.target = self.dbg.GetSelectedTarget()
+self.process = self.target.LoadCore("regions-linux-map.dmp")
+result = lldb.SBCommandReturnObject()
+addr_region_name_pairs = [
+("0x400d9000", "/system/bin/app_process"),
+("0x400db000", "/system/bin/app_process"),
+("0x400dd000", "/system/bin/linker"),
+("0x400ed000", "/system/bin/linker"),
+("0x400ee000", "/system/bin/linker"),
+("0x400fb000", "/system/lib/liblog.so"),
+("0x400fc000", "/system/lib/liblog.so"),
+("0x400fd000", "/system/lib/liblog.so"),
+("0x400ff000", "/system/lib/liblog.so"),
+("0x4010", "/system/lib/liblog.so"),
+("0x40101000", "/system/lib/libc.so"),
+("0x40122000", "/system/lib/libc.so"),
+("0x40123000", "/system/lib/libc.so"),
+("0x40167000", "/system/lib/libc.so"),
+("0x40169000", "/system/lib/libc.so"),
+]
+ci = self.dbg.GetCommandInterpreter()
+for (addr, region_name) in addr_region_name_pairs:
+command = 'memory region ' + addr
+ci.HandleCommand(command, result, False)
+message = 'Ensure memory "%s" shows up in output for "%s"' % (
+region_name, command)
+self.assertTrue(region_name in result.GetOutput(), message)
+
 def test_modules_in_mini_dump(self):
 """Test that lldb can read the list of modules from the minidump."""
 # target create -c linux-x86_64.dmp
Index: source/Commands/CommandObjectMemory.cpp
===
--- source/Commands/CommandObjectMemory.cpp
+++ source/Commands/CommandObjectMemory.cpp
@@ -1723,6 +1723,7 @@
 error = process_sp->GetMemoryRegionInfo(load_addr, range_info);
 if (error.Success()) {
   lldb_private::Address addr;
+  ConstString name = range_info.GetName();
   ConstString section_name;
   if (process_sp->GetTarget().ResolveLoadAddress(load_addr, addr)) {
 SectionSP section_sp(addr.GetSection());
@@ -1734,13 +1735,14 @@
 }
   }
   result.AppendMessageWithFormat(
-  "[0x%16.16" PRIx64 "-0x%16.16" PRIx64 ") %c%c%c%s%s\n",
+  "[0x%16.16" PRIx64 "-0x%16.16" PRIx64 ") %c%c%c%s%s%s%s\n",
   range_info.GetRange().GetRangeBase(),
   range_info.GetRange().GetRangeEnd(),
   range_info.GetReadable() ? 'r' : '-',
   range_info.GetWritable() ? 'w' : '-',
-  range_info.GetExecutable() ? 'x' : '-', section_name ? " " : "",
-  section_name ? section_name.AsCString() : "");
+  range_info.GetExecutable() ? 'x' : '-',
+  name ? " " : "", name.AsCString(""),
+  section_name ? " " : "", section_name.AsCString(""));
   m_prev_end_addr = range_info.GetRange().GetRangeEnd();
   result.SetStatus(eReturnStatusSuccessFinishResult);
 } else {


Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===
--- packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -88,6 +88,36 @@
 self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid)
 self.check_state()
 
+def test_memory_region_name(self):
+self.dbg.CreateTarget(None)
+self.target = self.dbg.GetSelectedTarget()
+self.process = self.target.LoadCore("regions-linux-map.dmp")
+result = lldb.SBCommandReturnObject()
+a

[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

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

In D55718#1336045 , @tatyana-krasnukha 
wrote:

> `ARCflags` are used by ABISysV_arc (related patch D55724 
> ). I would be glad to move it to 
> architecture plugin, but I ought to add SetFlags/GetFlags to Architecture 
> interface in this case. Then we'll have the same members in ArchSpec and in 
> Architecture, that may look confusing.


If the flags are used in other code, then leave them where they are. We can 
clean this up when a patch moves all flags out into Architecture headers 
eventually.




Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4707
+
+arc::AdjustRegisterInfo(m_register_info, arch_to_use);
   }

ok, makes sense. Clearing the register info would be a good idea. One extra 
question: why do we need to fix up this information? Does it come over 
incorrectly and in the XML data and then need to be fixed up? I would prefer to 
fix the data if possible so this doesn't have to be done. Another way to make 
things work when registers are incorrect is to specify a target definition file 
for GDB remote with:
```
(lldb) settings set plugin.process.gdb-remote.target-definition-file 
/path/to/regs.py
```


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718



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


[Lldb-commits] [PATCH] D55841: GetMemoryRegions for the ProcessMinidump

2018-12-19 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 178916.
tatyana-krasnukha added a comment.

Add a test


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55841

Files:
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.dmp
  scripts/interface/SBMemoryRegionInfo.i
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/Process/minidump/MinidumpParser.h
  source/Plugins/Process/minidump/MinidumpTypes.cpp
  source/Plugins/Process/minidump/ProcessMinidump.cpp
  source/Plugins/Process/minidump/ProcessMinidump.h

Index: source/Plugins/Process/minidump/ProcessMinidump.h
===
--- source/Plugins/Process/minidump/ProcessMinidump.h
+++ source/Plugins/Process/minidump/ProcessMinidump.h
@@ -78,6 +78,9 @@
   Status GetMemoryRegionInfo(lldb::addr_t load_addr,
  MemoryRegionInfo &range_info) override;
 
+  Status GetMemoryRegions(
+  lldb_private::MemoryRegionInfos ®ion_list) override;
+
   bool GetProcessInfo(ProcessInstanceInfo &info) override;
 
   Status WillResume() override {
Index: source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -288,6 +288,12 @@
   return Status();
 }
 
+Status ProcessMinidump::GetMemoryRegions(
+lldb_private::MemoryRegionInfos ®ion_list) {
+  region_list = m_minidump_parser.GetMemoryRegions();
+  return Status();
+}
+
 void ProcessMinidump::Clear() { Process::m_thread_list.Clear(); }
 
 bool ProcessMinidump::UpdateThreadList(ThreadList &old_thread_list,
Index: source/Plugins/Process/minidump/MinidumpTypes.cpp
===
--- source/Plugins/Process/minidump/MinidumpTypes.cpp
+++ source/Plugins/Process/minidump/MinidumpTypes.cpp
@@ -242,6 +242,8 @@
 return {};
 
   std::vector result;
+  result.reserve(header->num_of_entries);
+
   for (uint64_t i = 0; i < header->num_of_entries; ++i) {
 result.push_back(reinterpret_cast(
 data.data() + i * header->size_of_entry));
Index: source/Plugins/Process/minidump/MinidumpParser.h
===
--- source/Plugins/Process/minidump/MinidumpParser.h
+++ source/Plugins/Process/minidump/MinidumpParser.h
@@ -87,6 +87,8 @@
 
   MemoryRegionInfo GetMemoryRegionInfo(lldb::addr_t load_addr);
 
+  const MemoryRegionInfos &GetMemoryRegions();
+
   // Perform consistency checks and initialize internal data structures
   Status Initialize();
 
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -537,6 +537,12 @@
 
 MemoryRegionInfo
 MinidumpParser::GetMemoryRegionInfo(lldb::addr_t load_addr) {
+  if (!m_parsed_regions)
+GetMemoryRegions();
+  return FindMemoryRegion(load_addr);
+}
+
+const MemoryRegionInfos &MinidumpParser::GetMemoryRegions() {
   if (!m_parsed_regions) {
 m_parsed_regions = true;
 // We haven't cached our memory regions yet we will create the region cache
@@ -552,7 +558,7 @@
   CreateRegionsCacheFromMemory64List(*this, m_regions);
 std::sort(m_regions.begin(), m_regions.end());
   }
-  return FindMemoryRegion(load_addr);
+  return m_regions;
 }
 
 Status MinidumpParser::Initialize() {
Index: scripts/interface/SBMemoryRegionInfo.i
===
--- scripts/interface/SBMemoryRegionInfo.i
+++ scripts/interface/SBMemoryRegionInfo.i
@@ -43,6 +43,9 @@
 
 bool
 IsMapped ();
+
+const char *
+GetName ();
 
 bool
 operator == (const lldb::SBMemoryRegionInfo &rhs) const;
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===
--- packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -418,3 +418,65 @@
 frame = thread.GetFrameAtIndex(1)
 value = frame.EvaluateExpression('x')
 self.assertEqual(value.GetValueAsSigned(), 3)
+
+def test_memory_regions_in_minidump(self):
+"""Test memory regions from a Minidump"""
+# target create -c regions-linux-map.dmp
+self.dbg.CreateTarget(None)
+self.target = self.dbg.GetSelectedTarget()
+self.process = self.target.LoadCore("regions-linux-map.dmp")
+self.check_state()
+
+regions_count = 19
+region_info_

[Lldb-commits] [PATCH] D55841: GetMemoryRegions for the ProcessMinidump

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

In D55841#1336515 , @tatyana-krasnukha 
wrote:

> Add a test


There was one added. See code


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55841



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


[Lldb-commits] [PATCH] D55841: GetMemoryRegions for the ProcessMinidump

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

In D55841#1336519 , @clayborg wrote:

> In D55841#1336515 , 
> @tatyana-krasnukha wrote:
>
> > Add a test
>
>
> There was one added. See code


Never mind, I thought this was my patch! Ignore me...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55841



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


[Lldb-commits] [PATCH] D55841: GetMemoryRegions for the ProcessMinidump

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

Just remove the "regions-linux-map.dmp" as I already checked one in with 
rLLDB349658  and this is good to go




Comment at: 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py:427
+self.target = self.dbg.GetSelectedTarget()
+self.process = self.target.LoadCore("regions-linux-map.dmp")
+self.check_state()

BTW: I added this file already with my last patch, so you can remove the 
"regions-linux-map.dmp" from the SVN commit. Just update your sources and make 
sure it matches and works.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55841



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


[Lldb-commits] [lldb] r349665 - [lldbsuite] Un-xfail tests on Windows that are now passing

2018-12-19 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Wed Dec 19 11:04:01 2018
New Revision: 349665

URL: http://llvm.org/viewvc/llvm-project?rev=349665&view=rev
Log:
[lldbsuite] Un-xfail tests on Windows that are now passing

This is a set of tests that were all marked as failing becuse of pr24489. The 
bug is not fixed (as in more of the tests that were marked this way are 
failing), but this set is passing. It is possible that some of them are false 
positives, but there's a large number of unexpectedly passing tests on Windows, 
so I am doing a bulk un-xfail to get the buildbot to green.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/TestCallUserAnonTypedef.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallUserDefinedFunction.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion/TestExprCompletion.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs2.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/call-function/TestCallCPPFunction.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/rvalue-references/TestRvalueReferences.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/unicode-literals/TestUnicodeLiterals.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/TestCallUserAnonTypedef.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/TestCallUserAnonTypedef.py?rev=349665&r1=349664&r2=349665&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/TestCallUserAnonTypedef.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/anonymous-struct/TestCallUserAnonTypedef.py
 Wed Dec 19 11:04:01 2018
@@ -23,7 +23,6 @@ class TestExprLookupAnonStructTypedef(Te
 # Find the breakpoint
 self.line = line_number('main.cpp', '// lldb testsuite break')
 
-@expectedFailureAll(oslist=["windows"])
 @expectedFailureAll(
 oslist=['linux'],
 archs=['arm'],

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py?rev=349665&r1=349664&r2=349665&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallStopAndContinue.py
 Wed Dec 19 11:04:01 2018
@@ -25,9 +25,6 @@ class ExprCommandCallStopContinueTestCas
 self.func_line = line_number('main.cpp', '{5, "five"}')
 
 @expectedFlakeyDarwin("llvm.org/pr20274")
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr24489: Name lookup not working correctly on 
Windows")
 def test(self):
 """Test gathering result from interrupted function call."""
 self.build()

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallUserDefinedFunction.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallUserDefinedFunction.py?rev=349665&r1=349664&r2=349665&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallUserDefinedFunction.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/call-function/TestCallUserDefinedFunction.py
 Wed Dec 19 11:04:01 2018
@@ -28,9 +28,6 @@ class ExprCommandCallUserDefinedFunction
 'main.cpp',
 '// Please test these expressions while stopped at this line:')
 
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr24489: Name lookup not working correctly on 
Windows")
 def test(self):
 """Test return values of user defined function calls."""
 self.build()

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion/TestExprCompletion.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/completion/TestExprCompletion.py?rev=349665&r1=349664&r2=349665&view=diff
==
--- 
lldb/trunk/pac

[Lldb-commits] [lldb] r349668 - [lldbsuite] Un-xfail tests on Windows that are now passing (pt.2)

2018-12-19 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Wed Dec 19 11:10:25 2018
New Revision: 349668

URL: http://llvm.org/viewvc/llvm-project?rev=349668&view=rev
Log:
[lldbsuite] Un-xfail tests on Windows that are now passing (pt.2)

This is a set of tests that were all marked as failing becuse of pr21765. The 
bug is not fixed (as in more of the tests that were marked this way are 
failing), but this set is passing. It is possible that some of them are false 
positives, but there's a large number of unexpectedly passing tests on Windows, 
so I am doing a bulk un-xfail to get the buildbot to green.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestAllowJIT.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/persistent_types/TestNestedPersistentTypes.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/persistent_types/TestPersistentTypes.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/pr35310/TestExprsBug35310.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_9531204/TestPrintfAfterUp.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_9673664/TestExprHelpExamples.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/test/TestExprs.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/static_methods/TestCPPStaticMethods.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py?rev=349668&r1=349667&r2=349668&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/char/TestExprsChar.py
 Wed Dec 19 11:10:25 2018
@@ -41,7 +41,6 @@ class ExprCharTestCase(TestBase):
 self.assertTrue(value.GetError().Success())
 self.assertEqual(value.GetValueAsSigned(0), 3)
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
 def test_default_char(self):
 self.do_test()
 
@@ -52,7 +51,6 @@ class ExprCharTestCase(TestBase):
 "powerpc64le",
 "s390x"],
 bugnumber="llvm.org/pr23069")
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
 def test_signed_char(self):
 self.do_test(dictionary={'CFLAGS_EXTRAS': '-fsigned-char'})
 
@@ -64,7 +62,6 @@ class ExprCharTestCase(TestBase):
 'armv7',
 'armv7k'],
 bugnumber="llvm.org/pr23069, ")
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
 @expectedFailureAll(triple='mips*', bugnumber="llvm.org/pr23069")
 def test_unsigned_char(self):
 self.do_test(dictionary={'CFLAGS_EXTRAS': '-funsigned-char'})

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestAllowJIT.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestAllowJIT.py?rev=349668&r1=349667&r2=349668&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestAllowJIT.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/dont_allow_jit/TestAllowJIT.py
 Wed Dec 19 11:10:25 2018
@@ -22,22 +22,18 @@ class TestAllowJIT(TestBase):
 # each debug info format.
 NO_DEBUG_INFO_TESTCASE = True
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
 def test_allow_jit_expr_command(self):
 """Test the --allow-jit command line flag"""
 self.build()
 self.main_source_file = lldb.SBFileSpec("main.c")
 self.expr_cmd_test()
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
 def test_allow_jit_options(self):
 """Test the SetAllowJIT SBExpressionOption setting"""
 self.build()
 self.main_source_file = lldb.SBFileSpec("main.c")
 self.expr_options_test()
 
-
-
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)
@@ -62,7 +58,7 @@ class TestAllowJIT(TestBase):
"Set a breakpoint here", 
self.main_source_file)
 
 frame = thread.GetFrameAtIndex(0)
-
+
 # First make sure we can call the function with the default option 
set. 
 options = lldb.SBExpres

[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2018-12-19 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added inline comments.



Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4707
+
+arc::AdjustRegisterInfo(m_register_info, arch_to_use);
   }

clayborg wrote:
> ok, makes sense. Clearing the register info would be a good idea. One extra 
> question: why do we need to fix up this information? Does it come over 
> incorrectly and in the XML data and then need to be fixed up? I would prefer 
> to fix the data if possible so this doesn't have to be done. Another way to 
> make things work when registers are incorrect is to specify a target 
> definition file for GDB remote with:
> ```
> (lldb) settings set plugin.process.gdb-remote.target-definition-file 
> /path/to/regs.py
> ```
"dwarf" field doesn't exist in standard target register description given by a 
gdb-server (it looks like an LLDB's extension), that's why the adjustment is 
required.

Since the ARC is a configurable architecture, we have to create a huge count of 
regs.py files. This is not only ARC_rf16/ARC_rf32, some modules like floating 
point unit may be disabled in current configuration and related registers are 
absent.

As an alternative way we could have a super-target-definition-file with full 
set of possible registers and remove absent registers during this step. But I 
don't think it is much better than current adjustment.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718



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


[Lldb-commits] [lldb] r349673 - [NativePDB] Fix a use after free and enable corresponding native test.

2018-12-19 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Dec 19 11:45:30 2018
New Revision: 349673

URL: http://llvm.org/viewvc/llvm-project?rev=349673&view=rev
Log:
[NativePDB] Fix a use after free and enable corresponding native test.

We had a use after free where we were assigning the result of a function
that returned a string to a StringRef.  After fixing this use after
free, one of the DIA PDB tests now passes with the native PDB reader,
so we enable the test under native mode as well.  The goal is to
eventually make all the tests pass under both, at which point we can
disable them all under DIA mode.

Modified:
lldb/trunk/lit/SymbolFile/PDB/compilands.test
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/lit/SymbolFile/PDB/compilands.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/compilands.test?rev=349673&r1=349672&r2=349673&view=diff
==
--- lldb/trunk/lit/SymbolFile/PDB/compilands.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/compilands.test Wed Dec 19 11:45:30 2018
@@ -1,7 +1,8 @@
 REQUIRES: system-windows, msvc
 RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib 
--output=%T/CompilandsTest.cpp.obj %S/Inputs/CompilandsTest.cpp
 RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib 
--output=%T/CompilandsTest.cpp.exe %T/CompilandsTest.cpp.obj
-RUN: lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols 
%T/CompilandsTest.cpp.exe | FileCheck %s
+RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols 
%T/CompilandsTest.cpp.exe | FileCheck %s
 
 ; Link default libraries
 

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=349673&r1=349672&r2=349673&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Wed 
Dec 19 11:45:30 2018
@@ -419,7 +419,7 @@ SymbolFileNativePDB::CreateCompileUnit(c
   if (cci.m_compile_opts && cci.m_compile_opts->hasOptimizations())
 optimized = eLazyBoolYes;
 
-  llvm::StringRef source_file_name =
+  llvm::SmallString<64> source_file_name =
   m_index->compilands().GetMainSourceFile(cci);
   FileSpec fs(source_file_name);
 


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


[Lldb-commits] [PATCH] D55841: GetMemoryRegions for the ProcessMinidump

2018-12-19 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 178931.
tatyana-krasnukha added a comment.

Removed dump file from the patch


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55841

Files:
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
  scripts/interface/SBMemoryRegionInfo.i
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/Process/minidump/MinidumpParser.h
  source/Plugins/Process/minidump/MinidumpTypes.cpp
  source/Plugins/Process/minidump/ProcessMinidump.cpp
  source/Plugins/Process/minidump/ProcessMinidump.h

Index: source/Plugins/Process/minidump/ProcessMinidump.h
===
--- source/Plugins/Process/minidump/ProcessMinidump.h
+++ source/Plugins/Process/minidump/ProcessMinidump.h
@@ -78,6 +78,9 @@
   Status GetMemoryRegionInfo(lldb::addr_t load_addr,
  MemoryRegionInfo &range_info) override;
 
+  Status GetMemoryRegions(
+  lldb_private::MemoryRegionInfos ®ion_list) override;
+
   bool GetProcessInfo(ProcessInstanceInfo &info) override;
 
   Status WillResume() override {
Index: source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -288,6 +288,12 @@
   return Status();
 }
 
+Status ProcessMinidump::GetMemoryRegions(
+lldb_private::MemoryRegionInfos ®ion_list) {
+  region_list = m_minidump_parser.GetMemoryRegions();
+  return Status();
+}
+
 void ProcessMinidump::Clear() { Process::m_thread_list.Clear(); }
 
 bool ProcessMinidump::UpdateThreadList(ThreadList &old_thread_list,
Index: source/Plugins/Process/minidump/MinidumpTypes.cpp
===
--- source/Plugins/Process/minidump/MinidumpTypes.cpp
+++ source/Plugins/Process/minidump/MinidumpTypes.cpp
@@ -242,6 +242,8 @@
 return {};
 
   std::vector result;
+  result.reserve(header->num_of_entries);
+
   for (uint64_t i = 0; i < header->num_of_entries; ++i) {
 result.push_back(reinterpret_cast(
 data.data() + i * header->size_of_entry));
Index: source/Plugins/Process/minidump/MinidumpParser.h
===
--- source/Plugins/Process/minidump/MinidumpParser.h
+++ source/Plugins/Process/minidump/MinidumpParser.h
@@ -87,6 +87,8 @@
 
   MemoryRegionInfo GetMemoryRegionInfo(lldb::addr_t load_addr);
 
+  const MemoryRegionInfos &GetMemoryRegions();
+
   // Perform consistency checks and initialize internal data structures
   Status Initialize();
 
Index: source/Plugins/Process/minidump/MinidumpParser.cpp
===
--- source/Plugins/Process/minidump/MinidumpParser.cpp
+++ source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -537,6 +537,12 @@
 
 MemoryRegionInfo
 MinidumpParser::GetMemoryRegionInfo(lldb::addr_t load_addr) {
+  if (!m_parsed_regions)
+GetMemoryRegions();
+  return FindMemoryRegion(load_addr);
+}
+
+const MemoryRegionInfos &MinidumpParser::GetMemoryRegions() {
   if (!m_parsed_regions) {
 m_parsed_regions = true;
 // We haven't cached our memory regions yet we will create the region cache
@@ -552,7 +558,7 @@
   CreateRegionsCacheFromMemory64List(*this, m_regions);
 std::sort(m_regions.begin(), m_regions.end());
   }
-  return FindMemoryRegion(load_addr);
+  return m_regions;
 }
 
 Status MinidumpParser::Initialize() {
Index: scripts/interface/SBMemoryRegionInfo.i
===
--- scripts/interface/SBMemoryRegionInfo.i
+++ scripts/interface/SBMemoryRegionInfo.i
@@ -43,6 +43,9 @@
 
 bool
 IsMapped ();
+
+const char *
+GetName ();
 
 bool
 operator == (const lldb::SBMemoryRegionInfo &rhs) const;
Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===
--- packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -418,3 +418,65 @@
 frame = thread.GetFrameAtIndex(1)
 value = frame.EvaluateExpression('x')
 self.assertEqual(value.GetValueAsSigned(), 3)
+
+def test_memory_regions_in_minidump(self):
+"""Test memory regions from a Minidump"""
+# target create -c regions-linux-map.dmp
+self.dbg.CreateTarget(None)
+self.target = self.dbg.GetSelectedTarget()
+self.process = self.target.LoadCore("regions-linux-map.dmp")
+self.check_state()
+
+regions_count = 19
+region_info_list = self.process.GetMemoryRegions()
+self.assertEqual(region_in

[Lldb-commits] [PATCH] D55718: [ARC] Basic support in gdb-remote process plugin

2018-12-19 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 178933.
tatyana-krasnukha added a comment.

Clear `m_register_info` if it is incorrect.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55718

Files:
  include/lldb/Utility/ArchSpec.h
  source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
  source/Plugins/Process/Utility/DynamicRegisterInfo.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Target/Platform.cpp
  source/Target/Target.cpp
  source/Target/Thread.cpp
  source/Utility/ArchSpec.cpp

Index: source/Utility/ArchSpec.cpp
===
--- source/Utility/ArchSpec.cpp
+++ source/Utility/ArchSpec.cpp
@@ -221,7 +221,8 @@
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba4,
  "kalimba4"},
 {eByteOrderLittle, 4, 1, 1, llvm::Triple::kalimba, ArchSpec::eCore_kalimba5,
- "kalimba5"}};
+ "kalimba5"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arc, ArchSpec::eCore_arc, "arc"}};
 
 // Ensure that we have an entry in the g_core_definitions for each core. If you
 // comment out an entry above, you will need to comment out the corresponding
@@ -458,7 +459,9 @@
 {ArchSpec::eCore_kalimba4, llvm::ELF::EM_CSR_KALIMBA,
  llvm::Triple::KalimbaSubArch_v4, 0xu, 0xu}, // KALIMBA
 {ArchSpec::eCore_kalimba5, llvm::ELF::EM_CSR_KALIMBA,
- llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu} // KALIMBA
+ llvm::Triple::KalimbaSubArch_v5, 0xu, 0xu}, // KALIMBA
+{ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
+ 0xu, 0xu } // ARC
 };
 
 static const ArchDefinition g_elf_arch_def = {
Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2058,6 +2058,7 @@
 switch (machine) {
 case llvm::Triple::x86_64:
 case llvm::Triple::x86:
+case llvm::Triple::arc:
 case llvm::Triple::arm:
 case llvm::Triple::aarch64:
 case llvm::Triple::thumb:
Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -1527,7 +1527,7 @@
   os_changed, os_ver_changed, env_changed);
 
 if (!arch_changed && !vendor_changed && !os_changed && !env_changed)
-  replace_local_arch = false;
+  replace_local_arch = arch_spec.GetFlags() != m_arch.GetSpec().GetFlags();
   }
 }
   }
Index: source/Target/Platform.cpp
===
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -1869,6 +1869,12 @@
   size_t trap_opcode_size = 0;
 
   switch (arch.GetMachine()) {
+  case llvm::Triple::arc: {
+static const uint8_t g_hex_opcode[] = { 0xff, 0x7f };
+trap_opcode = g_hex_opcode;
+trap_opcode_size = sizeof(g_hex_opcode);
+  } break;
+
   case llvm::Triple::aarch64: {
 static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x20, 0xd4};
 trap_opcode = g_aarch64_opcode;
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4525,6 +4525,58 @@
 
 } // namespace
 
+namespace arc {
+// Adjust architecture according to ARC build configuration registers.
+bool ConfigureArchitecture(ProcessGDBRemote &process,
+   const GDBRemoteDynamicRegisterInfo &dyn_reg_info,
+   ArchSpec& arch_to_use) {
+  // Obtain register file size from the RF_BUILD register.
+  static ConstString reg_name("rf_build");
+  const bool case_sensitive = false;
+  auto rf_build_info = dyn_reg_info.GetRegisterInfo(reg_name, case_sensitive);
+  if(nullptr == rf_build_info)
+return false;
+
+  const auto tid = LLDB_INVALID_THREAD_ID; // BCRs are not context-dependent.
+  // Cannot use GDBRemoteRegisterContext here, it is not created yet.
+  DataBufferSP buffer_sp = process.GetGDBRemote().ReadRegister(tid,
+  rf_build_info->kinds[eRegisterKindProcessPlugin]);
+  if (!buffer_sp || buffer_sp->GetByteSize() < rf_build_info->byte_size)
+return false;
+
+  if (0 != (buffer_sp->GetData()[1] & ArchSpec::eARC_rf16)) {
+// The target is configured to use reduced register file.
+arch_to_use.SetFlags(ArchSpec::eARC_rf16);
+// ABI uses this information to determine how many registers it may
+// use to pass arguments in a function.
+process.GetTarget().SetArchitecture(arch_to_use);
+  }
+  return true;
+}
+
+void AdjustRegisterInfo(DynamicRegisterInfo ®_info, const ArchSpec &arch) {
+  auto reg_count = reg_info.GetNumReg

[Lldb-commits] [lldb] r349675 - [NativePDB] Enable function-level-linking.test in native mode.

2018-12-19 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Dec 19 12:00:25 2018
New Revision: 349675

URL: http://llvm.org/viewvc/llvm-project?rev=349675&view=rev
Log:
[NativePDB] Enable function-level-linking.test in native mode.

This test passes with the native reader, so run it in both modes.

Modified:
lldb/trunk/lit/SymbolFile/PDB/function-level-linking.test

Modified: lldb/trunk/lit/SymbolFile/PDB/function-level-linking.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/function-level-linking.test?rev=349675&r1=349674&r2=349675&view=diff
==
--- lldb/trunk/lit/SymbolFile/PDB/function-level-linking.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/function-level-linking.test Wed Dec 19 
12:00:25 2018
@@ -1,4 +1,5 @@
 REQUIRES: system-windows, lld
 RUN: %clang_cl /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj
 RUN: lld-link /debug:full /nodefaultlib /entry:main 
/order:@%S/Inputs/FunctionLevelLinkingTest.ord %t.obj /out:%t.exe
-RUN: lldb-test symbols -verify %t.exe
+RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols -verify %t.exe
+RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols -verify %t.exe


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


[Lldb-commits] [PATCH] D55841: GetMemoryRegions for the ProcessMinidump

2018-12-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55841



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


[Lldb-commits] [PATCH] D55472: Speadup memory regions handling and cleanup related code

2018-12-19 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 178941.
tatyana-krasnukha added a comment.

Rid off of including std::vector at the cost of adding a wrapper class that can 
be forward declared.
Without this, it is not possible to do 
https://reviews.llvm.org/D55472#inline-491159


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D55472

Files:
  include/lldb/API/SBMemoryRegionInfo.h
  include/lldb/API/SBMemoryRegionInfoList.h
  include/lldb/Target/MemoryRegionInfo.h
  include/lldb/Target/Process.h
  include/lldb/lldb-forward.h
  source/API/SBMemoryRegionInfoList.cpp
  source/API/SBProcess.cpp
  source/Target/Process.cpp

Index: source/Target/Process.cpp
===
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -6030,7 +6030,7 @@
 }
 
 Status
-Process::GetMemoryRegions(std::vector ®ion_list) {
+Process::GetMemoryRegions(lldb_private::MemoryRegionInfos ®ion_list) {
 
   Status error;
 
@@ -6038,17 +6038,17 @@
 
   region_list.clear();
   do {
-lldb::MemoryRegionInfoSP region_info(new lldb_private::MemoryRegionInfo());
-error = GetMemoryRegionInfo(range_end, *region_info);
+lldb_private::MemoryRegionInfo region_info;
+error = GetMemoryRegionInfo(range_end, region_info);
 // GetMemoryRegionInfo should only return an error if it is unimplemented.
 if (error.Fail()) {
   region_list.clear();
   break;
 }
 
-range_end = region_info->GetRange().GetRangeEnd();
-if (region_info->GetMapped() == MemoryRegionInfo::eYes) {
-  region_list.push_back(region_info);
+range_end = region_info.GetRange().GetRangeEnd();
+if (region_info.GetMapped() == MemoryRegionInfo::eYes) {
+  region_list.push_back(std::move(region_info));
 }
   } while (range_end != LLDB_INVALID_ADDRESS);
 
Index: source/API/SBProcess.cpp
===
--- source/API/SBProcess.cpp
+++ source/API/SBProcess.cpp
@@ -1358,18 +1358,14 @@
SBMemoryRegionInfo &sb_region_info) {
   lldb::SBError sb_error;
   ProcessSP process_sp(GetSP());
-  MemoryRegionInfoSP region_info_sp =
-  std::make_shared();
   if (process_sp) {
 Process::StopLocker stop_locker;
 if (stop_locker.TryLock(&process_sp->GetRunLock())) {
   std::lock_guard guard(
   process_sp->GetTarget().GetAPIMutex());
+
   sb_error.ref() =
-  process_sp->GetMemoryRegionInfo(load_addr, *region_info_sp);
-  if (sb_error.Success()) {
-sb_region_info.ref() = *region_info_sp;
-  }
+  process_sp->GetMemoryRegionInfo(load_addr, sb_region_info.ref());
 } else {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
   if (log)
@@ -1385,35 +1381,23 @@
 }
 
 lldb::SBMemoryRegionInfoList SBProcess::GetMemoryRegions() {
-  lldb::SBError sb_error;
   lldb::SBMemoryRegionInfoList sb_region_list;
+
   ProcessSP process_sp(GetSP());
-  if (process_sp) {
-Process::StopLocker stop_locker;
-if (stop_locker.TryLock(&process_sp->GetRunLock())) {
-  std::lock_guard guard(
-  process_sp->GetTarget().GetAPIMutex());
-  std::vector region_list;
-  sb_error.ref() = process_sp->GetMemoryRegions(region_list);
-  if (sb_error.Success()) {
-std::vector::iterator end = region_list.end();
-for (std::vector::iterator it = region_list.begin();
- it != end; it++) {
-  SBMemoryRegionInfo sb_region_info(it->get());
-  sb_region_list.Append(sb_region_info);
-}
-  }
-} else {
-  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
-  if (log)
-log->Printf(
-"SBProcess(%p)::GetMemoryRegionInfo() => error: process is running",
-static_cast(process_sp.get()));
-  sb_error.SetErrorString("process is running");
-}
+  Process::StopLocker stop_locker;
+  if (process_sp && stop_locker.TryLock(&process_sp->GetRunLock())) {
+std::lock_guard guard(
+process_sp->GetTarget().GetAPIMutex());
+
+process_sp->GetMemoryRegions(sb_region_list.ref());
   } else {
-sb_error.SetErrorString("SBProcess is invalid");
+Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+if (log)
+  log->Printf(
+  "SBProcess(%p)::GetMemoryRegionInfo() => error: process is running",
+  static_cast(process_sp.get()));
   }
+
   return sb_region_list;
 }
 
Index: source/API/SBMemoryRegionInfoList.cpp
===
--- source/API/SBMemoryRegionInfoList.cpp
+++ source/API/SBMemoryRegionInfoList.cpp
@@ -32,31 +32,47 @@
 return *this;
   }
 
-  uint32_t GetSize() { return m_regions.size(); }
+  size_t GetSize() const { return m_regions.size(); }
 
-  void Append(const lldb::SBMemoryRegionInfo &sb_region) {
+  void Reserve(size_t capacity) { return m_region

[Lldb-commits] [PATCH] D44072: [lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI

2018-12-19 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek updated this revision to Diff 178954.
kubamracek added a comment.

Addressing comment 1 (checking that GetCurrentException and 
GetCurrentExceptionBacktrace returns nothing when there's no exception in 
flights). Will address comment 2 in a bit.


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

https://reviews.llvm.org/D44072

Files:
  include/lldb/API/SBThread.h
  include/lldb/Target/LanguageRuntime.h
  include/lldb/Target/Thread.h
  packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
  packages/Python/lldbsuite/test/lang/objc/exceptions/main.m
  scripts/interface/SBThread.i
  source/API/SBThread.cpp
  source/Commands/CommandObjectThread.cpp
  
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
  source/Target/Thread.cpp

Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/StackFrameRecognizer.h"
@@ -2202,16 +2203,30 @@
 }
 
 ValueObjectSP Thread::GetCurrentException() {
-  StackFrameSP frame_sp(GetStackFrameAtIndex(0));
-  if (!frame_sp) return ValueObjectSP();
+  if (auto frame_sp = GetStackFrameAtIndex(0))
+if (auto recognized_frame = frame_sp->GetRecognizedFrame())
+  if (auto e = recognized_frame->GetExceptionObject())
+return e;
+
+  // FIXME: For now, only ObjC exceptions are supported. This should really
+  // iterate over all language runtimes and ask them all to give us the current
+  // exception.
+  if (auto runtime = GetProcess()->GetObjCLanguageRuntime())
+if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
+  return e;
 
-  RecognizedStackFrameSP recognized_frame(frame_sp->GetRecognizedFrame());
-  if (!recognized_frame) return ValueObjectSP();
-
-  return recognized_frame->GetExceptionObject();
+  return ValueObjectSP();
 }
 
-/* TODO(kubamracek)
 ThreadSP Thread::GetCurrentExceptionBacktrace() {
-  return ThreadSP();
-}*/
+  ValueObjectSP exception = GetCurrentException();
+  if (!exception) return ThreadSP();
+
+  // FIXME: For now, only ObjC exceptions are supported. This should really
+  // iterate over all language runtimes and ask them all to give us the current
+  // exception.
+  auto runtime = GetProcess()->GetObjCLanguageRuntime();
+  if (!runtime) return ThreadSP();
+
+  return runtime->GetBacktraceThreadFromException(exception);
+}
Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
===
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
@@ -89,6 +89,12 @@
   
   static std::tuple GetExceptionThrowLocation();
 
+  lldb::ValueObjectSP GetExceptionObjectForThread(
+  lldb::ThreadSP thread_sp) override;
+
+  lldb::ThreadSP GetBacktraceThreadFromException(
+  lldb::ValueObjectSP thread_sp) override;
+
   uint32_t GetFoundationVersion();
 
   virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,
Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
===
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -19,10 +19,13 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
 #include "lldb/Expression/DiagnosticManager.h"
 #include "lldb/Expression/FunctionCaller.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
@@ -35,6 +38,9 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StreamString.h"
 
+#include "Plugins/Process/Utility/HistoryThread.h"
+#include "Plugins/Language/ObjC/NSString.h"
+
 #include 
 
 using namespace lldb;
@@ -459,6 +465,102 @@
   }
 }
 
+ValueObjectSP AppleObjCRuntime::GetExceptionObjectForThread(
+ThreadSP thread_sp) {
+  auto cpp_runtime = m_process->GetCPPLanguageRuntime();
+  if (!cpp_runtime) return ValueObjectSP();
+  auto cpp_exception = cpp_runtime->GetExceptionObjectForThrea

[Lldb-commits] [lldb] r349692 - Fix line endings.

2018-12-19 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Wed Dec 19 14:50:22 2018
New Revision: 349692

URL: http://llvm.org/viewvc/llvm-project?rev=349692&view=rev
Log:
Fix line endings.

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp?rev=349692&r1=349691&r2=349692&view=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/nested-types.cpp Wed Dec 19 14:50:22 
2018
@@ -131,8 +131,8 @@ int main(int argc, char **argv) {
 // CHECK: | |-CXXRecordDecl {{.*}} struct NestedStruct definition
 // CHECK: | | |-FieldDecl {{.*}} A 'int'
 // CHECK: | | `-FieldDecl {{.*}} B 'int'
-// CHECK: | `-EnumDecl {{.*}} NestedEnum
-// CHECK: |   |-EnumConstantDecl {{.*}} EnumValue1 'S::NestedEnum'
+// CHECK: | `-EnumDecl {{.*}} NestedEnum
+// CHECK: |   |-EnumConstantDecl {{.*}} EnumValue1 'S::NestedEnum'
 // CHECK: |   `-EnumConstantDecl {{.*}} EnumValue2 'S::NestedEnum'
 // CHECK: |-CXXRecordDecl {{.*}} struct T definition
 // CHECK: | |-FieldDecl {{.*}} NT 'int'


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


[Lldb-commits] [lldb] r349700 - Simplify code for readability. (NFC)

2018-12-19 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Wed Dec 19 15:48:40 2018
New Revision: 349700

URL: http://llvm.org/viewvc/llvm-project?rev=349700&view=rev
Log:
Simplify code for readability. (NFC)

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

Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=349700&r1=349699&r2=349700&view=diff
==
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Wed Dec 19 15:48:40 2018
@@ -202,12 +202,9 @@ bool ValueObjectChild::UpdateValue() {
 ExecutionContext exe_ctx(
 GetExecutionContextRef().Lock(thread_and_frame_only_if_stopped));
 if (GetCompilerType().GetTypeInfo() & lldb::eTypeHasValue) {
-  if (!is_instance_ptr_base)
-m_error =
-m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
-  else
-m_error = m_parent->GetValue().GetValueAsData(&exe_ctx, m_data, 0,
-  GetModule().get());
+  Value &value = is_instance_ptr_base ? m_parent->GetValue() : m_value;
+  m_error =
+  value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
 } else {
   m_error.Clear(); // No value so nothing to read...
 }


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


[Lldb-commits] [PATCH] D44072: [lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI

2018-12-19 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek updated this revision to Diff 178991.
kubamracek added a comment.

Addressed comment 2. Changed the test to use an Obj-C++ source file, and added 
a case that throws a plain C++ exception.


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

https://reviews.llvm.org/D44072

Files:
  include/lldb/API/SBThread.h
  include/lldb/Target/LanguageRuntime.h
  include/lldb/Target/Thread.h
  packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile
  packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
  packages/Python/lldbsuite/test/lang/objc/exceptions/main.m
  packages/Python/lldbsuite/test/lang/objc/exceptions/main.mm
  scripts/interface/SBThread.i
  source/API/SBThread.cpp
  source/Commands/CommandObjectThread.cpp
  
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
  source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
  source/Target/Thread.cpp

Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/DynamicLoader.h"
 #include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
 #include "lldb/Target/StackFrameRecognizer.h"
@@ -2202,16 +2203,30 @@
 }
 
 ValueObjectSP Thread::GetCurrentException() {
-  StackFrameSP frame_sp(GetStackFrameAtIndex(0));
-  if (!frame_sp) return ValueObjectSP();
+  if (auto frame_sp = GetStackFrameAtIndex(0))
+if (auto recognized_frame = frame_sp->GetRecognizedFrame())
+  if (auto e = recognized_frame->GetExceptionObject())
+return e;
+
+  // FIXME: For now, only ObjC exceptions are supported. This should really
+  // iterate over all language runtimes and ask them all to give us the current
+  // exception.
+  if (auto runtime = GetProcess()->GetObjCLanguageRuntime())
+if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
+  return e;
 
-  RecognizedStackFrameSP recognized_frame(frame_sp->GetRecognizedFrame());
-  if (!recognized_frame) return ValueObjectSP();
-
-  return recognized_frame->GetExceptionObject();
+  return ValueObjectSP();
 }
 
-/* TODO(kubamracek)
 ThreadSP Thread::GetCurrentExceptionBacktrace() {
-  return ThreadSP();
-}*/
+  ValueObjectSP exception = GetCurrentException();
+  if (!exception) return ThreadSP();
+
+  // FIXME: For now, only ObjC exceptions are supported. This should really
+  // iterate over all language runtimes and ask them all to give us the current
+  // exception.
+  auto runtime = GetProcess()->GetObjCLanguageRuntime();
+  if (!runtime) return ThreadSP();
+
+  return runtime->GetBacktraceThreadFromException(exception);
+}
Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
===
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
@@ -89,6 +89,12 @@
   
   static std::tuple GetExceptionThrowLocation();
 
+  lldb::ValueObjectSP GetExceptionObjectForThread(
+  lldb::ThreadSP thread_sp) override;
+
+  lldb::ThreadSP GetBacktraceThreadFromException(
+  lldb::ValueObjectSP thread_sp) override;
+
   uint32_t GetFoundationVersion();
 
   virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,
Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
===
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -19,10 +19,13 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Section.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
 #include "lldb/Expression/DiagnosticManager.h"
 #include "lldb/Expression/FunctionCaller.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/CPPLanguageRuntime.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
@@ -35,6 +38,9 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StreamString.h"
 
+#include "Plugins/Process/Utility/HistoryThread.h"
+#include "Plugins/Language/ObjC/NSString.h"
+
 #include 
 
 using namespace lldb;
@@ -459,6 +465,102 @@
   }
 }
 
+ValueObjectSP AppleObjCRuntime::GetExceptionObjectForThread(
+ThreadSP thread_sp) {
+  auto cpp_runtime = m_process->GetCPPLanguageRuntime();
+  if (!cpp_runtime) return ValueObjectS

[Lldb-commits] [lldb] r349711 - [lldbsuite] Un-xfail tests on Windows that are now passing (pt.3)

2018-12-19 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Wed Dec 19 16:58:48 2018
New Revision: 349711

URL: http://llvm.org/viewvc/llvm-project?rev=349711&view=rev
Log:
[lldbsuite] Un-xfail tests on Windows that are now passing (pt.3)

This is a set of tests that were all marked as failing becuse of several 
different bugs. A couple of the bugs are now resolved as fixed since all the 
tests that were failing associated with the bug are now passing. It is possible 
that some of them are false positives, but there's a large number of 
unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the 
buildbot to green.

Modified:
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py

lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py

lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py?rev=349711&r1=349710&r2=349711&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py 
Wed Dec 19 16:58:48 2018
@@ -1,7 +1,4 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(
-__file__, globals(), [
-lldbinline.expectedFailureAll(
-oslist=["windows"])])
+lldbinline.MakeInlineTest(__file__, globals())

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py?rev=349711&r1=349710&r2=349711&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
 Wed Dec 19 16:58:48 2018
@@ -42,7 +42,7 @@ class NamespaceLookupTestCase(TestBase):
  'stop reason = breakpoint'])
 
 @expectedFailureAll(
-oslist=["windows", "freebsd"],
+oslist=["freebsd"],
 bugnumber="llvm.org/pr25819")
 def test_scope_lookup_with_run_command(self):
 """Test scope lookup of functions in lldb."""
@@ -201,7 +201,6 @@ class NamespaceLookupTestCase(TestBase):
 # finds the global ::func().
 self.expect("expr -- func()", startstr="(int) $0 = 2")
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr25819")
 def test_scope_lookup_before_using_with_run_command(self):
 """Test scope lookup before using in lldb."""
 self.build()
@@ -227,7 +226,7 @@ class NamespaceLookupTestCase(TestBase):
 oslist=["linux"],
 debug_info=["dwo"])  # Skip to avoid crash
 @expectedFailureAll(
-oslist=["windows", "freebsd"],
+oslist=["freebsd"],
 bugnumber="llvm.org/pr25819")
 def test_scope_after_using_directive_lookup_with_run_command(self):
 """Test scope lookup after using directive in lldb."""
@@ -291,7 +290,7 @@ class NamespaceLookupTestCase(TestBase):
 self.expect("expr -- func()", startstr="error")
 
 @expectedFailureAll(
-oslist=["windows", "freebsd"],
+oslist=["freebsd"],
 bugnumber="llvm.org/pr25819")
 def test_scope_lookup_shadowed_by_using_with_run_command(self):
 """Test scope lookup shadowed by using in lldb."""

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py?rev=349711&r1=349710&r2=349711&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py 
Wed Dec 19 16:58:48 2018
@@ -20,7 +20,6 @@ class FrameAPITestCase(TestBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @add_test_categories(['pyapi'])
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
 def test_get_arg_vals_for_call_stack(self):
 """Exercise SBFrame.GetVariables() API to get argument vals."""
 self.build()

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/py

[Lldb-commits] [lldb] r349713 - [lldbsuite] Un-xfail tests on Windows that are now passing (pt.4)

2018-12-19 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Wed Dec 19 17:25:35 2018
New Revision: 349713

URL: http://llvm.org/viewvc/llvm-project?rev=349713&view=rev
Log:
[lldbsuite] Un-xfail tests on Windows that are now passing (pt.4)

This is a set of tests that were all marked as failing becuse of several 
different bugs. A couple of the bugs are now resolved as fixed since all the 
tests that were failing associated with the bug are now passing. It is possible 
that some of them are false positives, but there's a large number of 
unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the 
buildbot to green.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/disassembly/TestDisassembleBreakpoint.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py

lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
lldb/trunk/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py?rev=349713&r1=349712&r2=349713&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/rdar44436068/Test128BitsInteger.py
 Wed Dec 19 17:25:35 2018
@@ -1,7 +1,4 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(
-__file__, globals(), [
-decorators.expectedFailureAll(
-oslist=["windows"], bugnumber="llvm.org/pr37656")])
+lldbinline.MakeInlineTest(__file__, globals())

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py?rev=349713&r1=349712&r2=349713&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py
 Wed Dec 19 17:25:35 2018
@@ -55,7 +55,6 @@ class UnwindFromExpressionTest(TestBase)
 
 
 @add_test_categories(['pyapi'])
-@expectedFailureAll(oslist=["windows"])
 def test_unwind_expression(self):
 """Test unwinding from an expression."""
 self.build_and_run_to_bkpt()

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py?rev=349713&r1=349712&r2=349713&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py
 Wed Dec 19 17:25:35 2018
@@ -34,9 +34,6 @@ class ConditionalBreakTestCase(TestBase)
 self.build()
 self.simulate_conditional_break_by_user()
 
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr26265: args in frames other than #0 are not 
evaluated correctly")
 def do_conditional_break(self):
 """Exercise some thread and frame APIs to break if c() is called by 
a()."""
 exe = self.getBuildArtifact("a.out")

Modified:

[Lldb-commits] [PATCH] D44072: [lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI

2018-12-19 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

That's great.  There are a couple places where you use self.assertEqual(..., 
False) where you can use self.assertFalse if you want.  A very minor point...




Comment at: 
packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py:47
+# No exception being currently thrown/caught at this point
+self.assertEqual(thread.GetCurrentException().IsValid(), False)
+self.assertEqual(thread.GetCurrentExceptionBacktrace().IsValid(), 
False)

You can also say self.assertFalse here if you want.  Not very important.



Comment at: 
packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py:193
+# C++ exceptions are not exposed in the API (yet).
+self.assertEqual(thread.GetCurrentException().IsValid(), False)
+self.assertEqual(thread.GetCurrentExceptionBacktrace().IsValid(), 
False)

Since you use assertTrue above, it would be more symmetrical to use 
self.assertFalse here?


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

https://reviews.llvm.org/D44072



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


[Lldb-commits] [lldb] r349718 - [lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI

2018-12-19 Thread Kuba Mracek via lldb-commits
Author: kuba.brecka
Date: Wed Dec 19 18:01:59 2018
New Revision: 349718

URL: http://llvm.org/viewvc/llvm-project?rev=349718&view=rev
Log:
[lldb] Retrieve currently handled Obj-C exception via 
__cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI

This builds on https://reviews.llvm.org/D43884 and 
https://reviews.llvm.org/D43886 and extends LLDB support of Obj-C exceptions to 
also look for a "current exception" for a thread in the C++ exception handling 
runtime metadata (via call to __cxa_current_exception_type). We also construct 
an actual historical SBThread/ThreadSP that contains frames from the backtrace 
in the Obj-C exception object.

The high level goal this achieves is that when we're already crashed (because 
an unhandled exception occurred), we can still access the exception object and 
retrieve the backtrace from the throw point. In Obj-C, this is particularly 
useful because a catch+rethrow is very common and in those cases you currently 
don't have any access to the throw point backtrace.

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


Added:
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.mm
  - copied, changed from r349717, 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.m
Removed:
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.m
Modified:
lldb/trunk/include/lldb/API/SBThread.h
lldb/trunk/include/lldb/Target/LanguageRuntime.h
lldb/trunk/include/lldb/Target/Thread.h
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
lldb/trunk/scripts/interface/SBThread.i
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/include/lldb/API/SBThread.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=349718&r1=349717&r2=349718&view=diff
==
--- lldb/trunk/include/lldb/API/SBThread.h (original)
+++ lldb/trunk/include/lldb/API/SBThread.h Wed Dec 19 18:01:59 2018
@@ -200,8 +200,7 @@ public:
 
   SBValue GetCurrentException();
 
-  // TODO(kubamracek): Extract backtrace from SBValue into SBThread
-  // SBThread GetCurrentExceptionBacktrace();
+  SBThread GetCurrentExceptionBacktrace();
 
   bool SafeToCallFunctions();
 

Modified: lldb/trunk/include/lldb/Target/LanguageRuntime.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/LanguageRuntime.h?rev=349718&r1=349717&r2=349718&view=diff
==
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h (original)
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h Wed Dec 19 18:01:59 2018
@@ -119,6 +119,17 @@ public:
   static Breakpoint::BreakpointPreconditionSP
   CreateExceptionPrecondition(lldb::LanguageType language, bool catch_bp,
   bool throw_bp);
+
+  virtual lldb::ValueObjectSP GetExceptionObjectForThread(
+  lldb::ThreadSP thread_sp) {
+return lldb::ValueObjectSP();
+  }
+
+  virtual lldb::ThreadSP GetBacktraceThreadFromException(
+  lldb::ValueObjectSP thread_sp) {
+return lldb::ThreadSP();
+  }
+
   Process *GetProcess() { return m_process; }
 
   Target &GetTargetRef() { return m_process->GetTarget(); }

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=349718&r1=349717&r2=349718&view=diff
==
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Wed Dec 19 18:01:59 2018
@@ -1255,8 +1255,7 @@ public:
 
   lldb::ValueObjectSP GetCurrentException();
 
-  // TODO(kubamracek): Extract backtrace from ValueObjectSP into ThreadSP
-  // lldb::ThreadSP GetCurrentExceptionBacktrace();
+  lldb::ThreadSP GetCurrentExceptionBacktrace();
 
 protected:
   friend class ThreadPlan;

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile?rev=349718&r1=349717&r2=349718&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile 
(original)
+++ lldb/trunk/packages/Python/lldbsuite/test/l

[Lldb-commits] [PATCH] D44072: [lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI

2018-12-19 Thread Kuba (Brecka) Mracek via Phabricator via lldb-commits
kubamracek added a comment.

Thanks for the review! Switched to self.assertFalse and self.assertTrue and 
landed in r349718.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D44072



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


[Lldb-commits] [PATCH] D44072: [lldb] Retrieve currently handled Obj-C exception via __cxa_current_exception_type and add GetCurrentExceptionBacktrace SB ABI

2018-12-19 Thread Phabricator via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349718: [lldb] Retrieve currently handled Obj-C exception 
via… (authored by kuba.brecka, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D44072?vs=178991&id=178999#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D44072

Files:
  lldb/trunk/include/lldb/API/SBThread.h
  lldb/trunk/include/lldb/Target/LanguageRuntime.h
  lldb/trunk/include/lldb/Target/Thread.h
  lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
  lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.m
  lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.mm
  lldb/trunk/scripts/interface/SBThread.i
  lldb/trunk/source/API/SBThread.cpp
  lldb/trunk/source/Commands/CommandObjectThread.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
  lldb/trunk/source/Target/Thread.cpp

Index: lldb/trunk/scripts/interface/SBThread.i
===
--- lldb/trunk/scripts/interface/SBThread.i
+++ lldb/trunk/scripts/interface/SBThread.i
@@ -397,6 +397,24 @@
 ") GetExtendedBacktraceOriginatingIndexID;
 uint32_t
 GetExtendedBacktraceOriginatingIndexID();
+
+%feature("autodoc","
+Returns an SBValue object represeting the current exception for the thread,
+if there is any. Currently, this works for Obj-C code and returns an SBValue
+representing the NSException object at the throw site or that's currently
+being processes.
+") GetCurrentException;
+lldb::SBValue
+GetCurrentException();
+
+%feature("autodoc","
+Returns a historical (fake) SBThread representing the stack trace of an
+exception, if there is one for the thread. Currently, this works for Obj-C
+code, and can retrieve the throw-site backtrace of an NSException object
+even when the program is no longer at the throw site.
+") GetCurrentExceptionBacktrace;
+lldb::SBThread
+GetCurrentExceptionBacktrace();
 
 %feature("autodoc","
 Takes no arguments, returns a bool.
Index: lldb/trunk/include/lldb/Target/Thread.h
===
--- lldb/trunk/include/lldb/Target/Thread.h
+++ lldb/trunk/include/lldb/Target/Thread.h
@@ -1255,8 +1255,7 @@
 
   lldb::ValueObjectSP GetCurrentException();
 
-  // TODO(kubamracek): Extract backtrace from ValueObjectSP into ThreadSP
-  // lldb::ThreadSP GetCurrentExceptionBacktrace();
+  lldb::ThreadSP GetCurrentExceptionBacktrace();
 
 protected:
   friend class ThreadPlan;
Index: lldb/trunk/include/lldb/Target/LanguageRuntime.h
===
--- lldb/trunk/include/lldb/Target/LanguageRuntime.h
+++ lldb/trunk/include/lldb/Target/LanguageRuntime.h
@@ -119,6 +119,17 @@
   static Breakpoint::BreakpointPreconditionSP
   CreateExceptionPrecondition(lldb::LanguageType language, bool catch_bp,
   bool throw_bp);
+
+  virtual lldb::ValueObjectSP GetExceptionObjectForThread(
+  lldb::ThreadSP thread_sp) {
+return lldb::ValueObjectSP();
+  }
+
+  virtual lldb::ThreadSP GetBacktraceThreadFromException(
+  lldb::ValueObjectSP thread_sp) {
+return lldb::ThreadSP();
+  }
+
   Process *GetProcess() { return m_process; }
 
   Target &GetTargetRef() { return m_process->GetTarget(); }
Index: lldb/trunk/include/lldb/API/SBThread.h
===
--- lldb/trunk/include/lldb/API/SBThread.h
+++ lldb/trunk/include/lldb/API/SBThread.h
@@ -200,8 +200,7 @@
 
   SBValue GetCurrentException();
 
-  // TODO(kubamracek): Extract backtrace from SBValue into SBThread
-  // SBThread GetCurrentExceptionBacktrace();
+  SBThread GetCurrentExceptionBacktrace();
 
   bool SafeToCallFunctions();
 
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile
@@ -1,6 +1,6 @@
 LEVEL = ../../../make
 
-OBJC_SOURCES := main.m
+OBJCXX_SOURCES := main.mm
 
 CFLAGS_EXTRAS += -w
 
Index: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.mm
===
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/excepti

[Lldb-commits] [lldb] r349719 - [lldbsuite] Un-xfail tests on Windows that are now passing (pt.5)

2018-12-19 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Wed Dec 19 18:04:01 2018
New Revision: 349719

URL: http://llvm.org/viewvc/llvm-project?rev=349719&view=rev
Log:
[lldbsuite] Un-xfail tests on Windows that are now passing (pt.5)

This is a set of tests that were all marked as failing becuse of pr24764. The 
bug is not fixed (as in more of the tests that were marked this way are 
failing), but this set is passing. It is possible that some of them are false 
positives, but there's a large number of unexpectedly passing tests on Windows, 
so I am doing a bulk un-xfail to get the buildbot to green.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/llvm-style/TestLLVMStyle.py

lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/namespace_conflicts/TestNamespaceConflicts.py
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py?rev=349719&r1=349718&r2=349719&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py
 Wed Dec 19 18:04:01 2018
@@ -1,7 +1,4 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(
-__file__, globals(), [
-decorators.expectedFailureAll(
-oslist=["windows"], bugnumber="llvm.org/pr24764")])
+lldbinline.MakeInlineTest(__file__, globals())

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py?rev=349719&r1=349718&r2=349719&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py
 Wed Dec 19 18:04:01 2018
@@ -4,6 +4,4 @@ from lldbsuite.test import decorators
 lldbinline.MakeInlineTest(
 __file__, globals(), [
 decorators.expectedFailureAll(
-oslist=["windows"], bugnumber="llvm.org/pr24764"),
-decorators.expectedFailureAll(
 compiler="gcc")])

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py?rev=349719&r1=349718&r2=349719&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py
 Wed Dec 19 18:04:01 2018
@@ -23,7 +23,6 @@ class StaticVariableTestCase(TestBase):
 # Find the line number to break at.
 self.line = line_number('main.cpp', '// Set break point at this line.')
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
 def test_with_run_command(self):
 """Test that file and class static variables display correctly."""
 self.build()
@@ -63,7 +62,6 @@ class StaticVariableTestCase(TestBase):
 compiler=["clang"],
 compiler_version=["<", "3.9"],
 bugnumber='llvm.org/pr20550')
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
 def test_with_run_command_complete(self):
 """
 Test that file and class static variables display correctly with
@@ -108,8 +106,8 @@ class StaticVariableTestCase(TestBase):
 compiler=["clang"],
 compiler_version=["<", "3.9"],
 bugnumber='llvm.org/pr20550')
-@add_test_categories(['pyapi'])
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
+@add_test_categories(['pyapi'])
 def test_with_python_api(self):
 """Test Python APIs on file and class static variables."""
 self.build()

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/llvm-style/TestLLVMStyle.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/llvm-style/TestLLVMStyle.py?rev=349719&r1=349718&r2=3497

[Lldb-commits] [lldb] r349721 - [lldbsuite] Un-xfail TestDataFormatterSynthVal on Windows

2018-12-19 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Wed Dec 19 18:22:09 2018
New Revision: 349721

URL: http://llvm.org/viewvc/llvm-project?rev=349721&view=rev
Log:
[lldbsuite] Un-xfail TestDataFormatterSynthVal on Windows

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py?rev=349721&r1=349720&r2=349721&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
 Wed Dec 19 18:22:09 2018
@@ -24,9 +24,6 @@ class DataFormatterSynthValueTestCase(Te
 self.line = line_number('main.cpp', 'break here')
 
 @skipIfFreeBSD  # llvm.org/pr20545 bogus output confuses buildbot parser
-@expectedFailureAll(
-oslist=["windows"],
-bugnumber="llvm.org/pr24462, Data formatters have problems on Windows")
 def test_with_run_command(self):
 """Test using Python synthetic children provider to provide a value."""
 self.build()


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


[Lldb-commits] [lldb] r349722 - [lldbsuite] Un-xfail TestRedefinitionsInInlines on Windows

2018-12-19 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Wed Dec 19 19:04:14 2018
New Revision: 349722

URL: http://llvm.org/viewvc/llvm-project?rev=349722&view=rev
Log:
[lldbsuite] Un-xfail TestRedefinitionsInInlines on Windows

Modified:

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

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py?rev=349722&r1=349721&r2=349722&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
 Wed Dec 19 19:04:14 2018
@@ -3,9 +3,7 @@ from lldbsuite.test import decorators
 
 lldbinline.MakeInlineTest(__file__,
   globals(),
-  [decorators.expectedFailureAll(oslist=["windows"],
- 
bugnumber="llvm.org/pr27845"),
-  decorators.expectedFailureAll(compiler="clang",
-
compiler_version=["<",
-  
"3.5"],
-
bugnumber="llvm.org/pr27845")])
+  [decorators.expectedFailureAll(compiler="clang",
+ compiler_version=["<",
+   
"3.5"],
+ 
bugnumber="llvm.org/pr27845")])


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