Re: [Lldb-commits] [PATCH] D17724: Replace getopt with llvm::cl in lldb driver

2016-03-03 Thread Pavel Labath via lldb-commits
labath abandoned this revision.
labath added a comment.

Ok, fair enough. I'll see if I can do something like that in the future, but 
I'm going to abandon this for the moment.


http://reviews.llvm.org/D17724



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


Re: [Lldb-commits] [PATCH] D17798: Fetch remote log files from LLGS tests

2016-03-03 Thread Pavel Labath via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL262597: Fetch remote log files from LLGS tests (authored by 
labath).

Changed prior to commit:
  http://reviews.llvm.org/D17798?vs=49593&id=49720#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17798

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py

Index: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -47,6 +47,7 @@
 
 _verbose_log_handler = None
 _log_formatter = logging.Formatter(fmt='%(asctime)-15s %(levelname)-8s 
%(message)s')
+_remote_server_log_file = None
 
 def setUpBaseLogging(self):
 self.logger = logging.getLogger(__name__)
@@ -104,10 +105,35 @@
 self.stub_hostname = "localhost"
 
 def tearDown(self):
+if self._remote_server_log_file is not None:
+
lldb.remote_platform.Get(lldb.SBFileSpec(self._remote_server_log_file),
+lldb.SBFileSpec(self.getLocalServerLogFile()))
+lldb.remote_platform.Run(lldb.SBPlatformShellCommand("rm " + 
self._remote_server_log_file))
+self._remote_server_log_file = None
+
 self.logger.removeHandler(self._verbose_log_handler)
 self._verbose_log_handler = None
 TestBase.tearDown(self)
 
+def getLocalServerLogFile(self):
+return self.log_basename + "-server.log"
+
+def setUpServerLogging(self, is_llgs):
+if len(lldbtest_config.channels) == 0:
+return # No logging requested
+
+if lldb.remote_platform:
+log_file = 
lldbutil.join_remote_paths(lldb.remote_platform.GetWorkingDirectory(), 
"server.log")
+self._remote_server_log_file = log_file
+else:
+log_file = self.getLocalServerLogFile()
+
+if is_llgs:
+self.debug_monitor_extra_args.append("--log-file=" + log_file)
+
self.debug_monitor_extra_args.append("--log-channels={}".format(":".join(lldbtest_config.channels)))
+else:
+self.debug_monitor_extra_args = ["--log-file=" + self.log_file, 
"--log-flags=0x80"]
+
 def get_next_port(self):
 return 12000 + random.randint(0,3999)
 
@@ -214,19 +240,16 @@
 self.skipTest("lldb-server exe not found")
 
 self.debug_monitor_extra_args = ["gdbserver"]
-
-if len(lldbtest_config.channels) > 0:
-
self.debug_monitor_extra_args.append("--log-file={}-server.log".format(self.log_basename))
-
self.debug_monitor_extra_args.append("--log-channels={}".format(":".join(lldbtest_config.channels)))
+self.setUpServerLogging(is_llgs=True)
 
 if use_named_pipe:
 (self.named_pipe_path, self.named_pipe, self.named_pipe_fd) = 
self.create_named_pipe()
 
 def init_debugserver_test(self, use_named_pipe=True):
 self.debug_monitor_exe = get_debugserver_exe()
 if not self.debug_monitor_exe:
 self.skipTest("debugserver exe not found")
-self.debug_monitor_extra_args = 
["--log-file={}-server.log".format(self.log_basename), "--log-flags=0x80"]
+self.setUpServerLogging(is_llgs=False)
 if use_named_pipe:
 (self.named_pipe_path, self.named_pipe, self.named_pipe_fd) = 
self.create_named_pipe()
 # The debugserver stub has a race on handling the 'k' command, so it 
sends an X09 right away, then sends the real X notification


Index: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -47,6 +47,7 @@
 
 _verbose_log_handler = None
 _log_formatter = logging.Formatter(fmt='%(asctime)-15s %(levelname)-8s %(message)s')
+_remote_server_log_file = None
 
 def setUpBaseLogging(self):
 self.logger = logging.getLogger(__name__)
@@ -104,10 +105,35 @@
 self.stub_hostname = "localhost"
 
 def tearDown(self):
+if self._remote_server_log_file is not None:
+lldb.remote_platform.Get(lldb.SBFileSpec(self._remote_server_log_file),
+lldb.SBFileSpec(self.getLocalServerLogFile()))
+lldb.remote_platform.Run(lldb.SBPlatformShellCommand("rm " + self._remote_server_log_file))
+self._remote_server_log_file = None
+
 self.logger.removeHandler(self._verbose_log_handler)
 self._verbose_log_handler = None
 TestBase.tearDown(self)
 
+def getLocalServerLogFile(self):
+return self.log_basename + "

[Lldb-commits] [lldb] r262597 - Fetch remote log files from LLGS tests

2016-03-03 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Mar  3 03:02:52 2016
New Revision: 262597

URL: http://llvm.org/viewvc/llvm-project?rev=262597&view=rev
Log:
Fetch remote log files from LLGS tests

Summary:
this enables download of remote log files for llgs and debugserver tests 
(previously we were just
passing the host file name which obviously did not work). Note this also 
changes the debugserver
logging to work only when logging has been requested on the command line, 
whereas previously it
would log unconditionally. I can change it back if anyone is relying on this, 
but I thought I'd
make this consistent.

Reviewers: tfiala

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D17798

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py?rev=262597&r1=262596&r2=262597&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
 Thu Mar  3 03:02:52 2016
@@ -47,6 +47,7 @@ class GdbRemoteTestCaseBase(TestBase):
 
 _verbose_log_handler = None
 _log_formatter = logging.Formatter(fmt='%(asctime)-15s %(levelname)-8s 
%(message)s')
+_remote_server_log_file = None
 
 def setUpBaseLogging(self):
 self.logger = logging.getLogger(__name__)
@@ -104,10 +105,35 @@ class GdbRemoteTestCaseBase(TestBase):
 self.stub_hostname = "localhost"
 
 def tearDown(self):
+if self._remote_server_log_file is not None:
+
lldb.remote_platform.Get(lldb.SBFileSpec(self._remote_server_log_file),
+lldb.SBFileSpec(self.getLocalServerLogFile()))
+lldb.remote_platform.Run(lldb.SBPlatformShellCommand("rm " + 
self._remote_server_log_file))
+self._remote_server_log_file = None
+
 self.logger.removeHandler(self._verbose_log_handler)
 self._verbose_log_handler = None
 TestBase.tearDown(self)
 
+def getLocalServerLogFile(self):
+return self.log_basename + "-server.log"
+
+def setUpServerLogging(self, is_llgs):
+if len(lldbtest_config.channels) == 0:
+return # No logging requested
+
+if lldb.remote_platform:
+log_file = 
lldbutil.join_remote_paths(lldb.remote_platform.GetWorkingDirectory(), 
"server.log")
+self._remote_server_log_file = log_file
+else:
+log_file = self.getLocalServerLogFile()
+
+if is_llgs:
+self.debug_monitor_extra_args.append("--log-file=" + log_file)
+
self.debug_monitor_extra_args.append("--log-channels={}".format(":".join(lldbtest_config.channels)))
+else:
+self.debug_monitor_extra_args = ["--log-file=" + self.log_file, 
"--log-flags=0x80"]
+
 def get_next_port(self):
 return 12000 + random.randint(0,3999)
 
@@ -214,10 +240,7 @@ class GdbRemoteTestCaseBase(TestBase):
 self.skipTest("lldb-server exe not found")
 
 self.debug_monitor_extra_args = ["gdbserver"]
-
-if len(lldbtest_config.channels) > 0:
-
self.debug_monitor_extra_args.append("--log-file={}-server.log".format(self.log_basename))
-
self.debug_monitor_extra_args.append("--log-channels={}".format(":".join(lldbtest_config.channels)))
+self.setUpServerLogging(is_llgs=True)
 
 if use_named_pipe:
 (self.named_pipe_path, self.named_pipe, self.named_pipe_fd) = 
self.create_named_pipe()
@@ -226,7 +249,7 @@ class GdbRemoteTestCaseBase(TestBase):
 self.debug_monitor_exe = get_debugserver_exe()
 if not self.debug_monitor_exe:
 self.skipTest("debugserver exe not found")
-self.debug_monitor_extra_args = 
["--log-file={}-server.log".format(self.log_basename), "--log-flags=0x80"]
+self.setUpServerLogging(is_llgs=False)
 if use_named_pipe:
 (self.named_pipe_path, self.named_pipe, self.named_pipe_fd) = 
self.create_named_pipe()
 # The debugserver stub has a race on handling the 'k' command, so it 
sends an X09 right away, then sends the real X notification


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


Re: [Lldb-commits] [PATCH] D17845: [ASTImporter] Import "implicit" attribute of FunctionDecls

2016-03-03 Thread Pavel Labath via lldb-commits
labath added a subscriber: lldb-commits.
labath added a comment.

I noticed this while debugging an importing issue in LLDB.

I am not sure if I have selected the right reviewer, and also how/if to test 
this...


http://reviews.llvm.org/D17845



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


[Lldb-commits] [lldb] r262602 - Fix OSX breakage caused by r262597

2016-03-03 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Mar  3 04:39:24 2016
New Revision: 262602

URL: http://llvm.org/viewvc/llvm-project?rev=262602&view=rev
Log:
Fix OSX breakage caused by r262597

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py?rev=262602&r1=262601&r2=262602&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
 Thu Mar  3 04:39:24 2016
@@ -48,6 +48,7 @@ class GdbRemoteTestCaseBase(TestBase):
 _verbose_log_handler = None
 _log_formatter = logging.Formatter(fmt='%(asctime)-15s %(levelname)-8s 
%(message)s')
 _remote_server_log_file = None
+debug_monitor_extra_args = []
 
 def setUpBaseLogging(self):
 self.logger = logging.getLogger(__name__)


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


[Lldb-commits] [PATCH] D17847: [SemaExprCXX] Avoid calling isInSystemHeader for invalid source locations

2016-03-03 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: nlewycky.
labath added subscribers: cfe-commits, lldb-commits.

While diagnosing a CXXNewExpr warning, we were calling isInSystemHeader(), 
which expect to be
called with a valid source location. This causes an assertion failure if the 
location is unknown.
A quick grep shows it's not without precedent to guard calls to the function 
with a
"Loc.isValid()".

This fixes a test failure in LLDB, which always creates object with invalid 
source locations as it
does not (always) have access to the source.

http://reviews.llvm.org/D17847

Files:
  lib/Sema/SemaExprCXX.cpp

Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -1551,7 +1551,8 @@
   // new.
   if (PlacementArgs.empty() && OperatorNew &&
   (OperatorNew->isImplicit() ||
-   getSourceManager().isInSystemHeader(OperatorNew->getLocStart( {
+   (OperatorNew->getLocStart().isValid() &&
+getSourceManager().isInSystemHeader(OperatorNew->getLocStart() {
 if (unsigned Align = 
Context.getPreferredTypeAlign(AllocType.getTypePtr())){
   unsigned SuitableAlign = Context.getTargetInfo().getSuitableAlign();
   if (Align > SuitableAlign)


Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -1551,7 +1551,8 @@
   // new.
   if (PlacementArgs.empty() && OperatorNew &&
   (OperatorNew->isImplicit() ||
-   getSourceManager().isInSystemHeader(OperatorNew->getLocStart( {
+   (OperatorNew->getLocStart().isValid() &&
+getSourceManager().isInSystemHeader(OperatorNew->getLocStart() {
 if (unsigned Align = Context.getPreferredTypeAlign(AllocType.getTypePtr())){
   unsigned SuitableAlign = Context.getTargetInfo().getSuitableAlign();
   if (Align > SuitableAlign)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D17848: Add reverse file remapping for breakpoint set

2016-03-03 Thread Tamas Berghammer via lldb-commits
tberghammer created this revision.
tberghammer added reviewers: labath, clayborg.
tberghammer added a subscriber: lldb-commits.

Add reverse file remapping for breakpoint set

LLDB can remap a source file to a new directory based on the
"target.sorce-map" to handle the usecase when the source code moved
between the compilation and the debugging. Previously the remapping
was only used to display the content of the file. This CL fixes the
scenario when a breakpoint is set based on the new an absolute path
with adding an inverse remapping step before looking up the breakpoint
location.

http://reviews.llvm.org/D17848

Files:
  include/lldb/Target/PathMappingList.h
  packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
  source/Target/PathMappingList.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -348,6 +348,13 @@
   bool hardware,
   LazyBool move_to_nearest_code)
 {
+FileSpec remapped_file;
+ConstString remapped_path;
+if (GetSourcePathMap().ReverseRemapPath(ConstString(file.GetPath().c_str()), remapped_path))
+remapped_file.SetFile(remapped_path.AsCString(), true);
+else
+remapped_file = file;
+
 if (check_inlines == eLazyBoolCalculate)
 {
 const InlineStrategy inline_strategy = GetInlineStrategy();
@@ -358,7 +365,7 @@
 break;
 
 case eInlineBreakpointsHeaders:
-if (file.IsSourceImplementationFile())
+if (remapped_file.IsSourceImplementationFile())
 check_inlines = eLazyBoolNo;
 else
 check_inlines = eLazyBoolYes;
@@ -374,7 +381,7 @@
 {
 // Not checking for inlines, we are looking only for matching compile units
 FileSpecList compile_unit_list;
-compile_unit_list.Append (file);
+compile_unit_list.Append (remapped_file);
 filter_sp = GetSearchFilterForModuleAndCUList (containingModules, &compile_unit_list);
 }
 else
@@ -387,7 +394,7 @@
 move_to_nearest_code = GetMoveToNearestCode() ? eLazyBoolYes : eLazyBoolNo;
 
 BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine(nullptr,
-file,
+remapped_file,
 line_no,
 check_inlines,
 skip_prologue,
Index: source/Target/PathMappingList.cpp
===
--- source/Target/PathMappingList.cpp
+++ source/Target/PathMappingList.cpp
@@ -215,6 +215,27 @@
 }
 
 bool
+PathMappingList::ReverseRemapPath (const ConstString &path, ConstString &new_path) const
+{
+const char *path_cstr = path.GetCString();
+if (!path_cstr)
+return false;
+
+for (const auto& it : m_pairs)
+{
+const size_t prefixLen = it.second.GetLength();
+if (::strncmp (it.second.GetCString(), path_cstr, prefixLen) == 0)
+{
+std::string new_path_str (it.first.GetCString());
+new_path_str.append(path.GetCString() + prefixLen);
+new_path.SetCString(new_path_str.c_str());
+return true;
+}
+}
+return false;
+}
+
+bool
 PathMappingList::FindFile (const FileSpec &orig_spec, FileSpec &new_spec) const
 {
 if (!m_pairs.empty())
Index: packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
===
--- packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
+++ packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
@@ -170,3 +170,21 @@
 # Display the source code again.  We should see the updated line.
 self.expect("source list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
 substrs = ['Hello lldb'])
+
+def test_set_breakpoint_with_absloute_path(self):
+self.build()
+self.runCmd("settings set target.source-map %s %s" % (os.getcwd(), os.path.join(os.getcwd(), "hidden")))
+
+exe = os.path.join(os.getcwd(), "a.out")
+main = os.path.join(os.getcwd(), "hidden", "main.c")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_file_and_line (self, main, self.line, num_expected_locations=1, loc_exact=False)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs = ['stopped',
+   'main.c:%d' % self.line,
+   

[Lldb-commits] [lldb] r262622 - Revert "Fetch remote log files from LLGS tests"

2016-03-03 Thread Pavel Labath via lldb-commits
Author: labath
Date: Thu Mar  3 09:19:14 2016
New Revision: 262622

URL: http://llvm.org/viewvc/llvm-project?rev=262622&view=rev
Log:
Revert "Fetch remote log files from LLGS tests"

Even after the last fixup, there still seems to be one failure left. Revert 
until I figure out
what is going on.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py?rev=262622&r1=262621&r2=262622&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
 Thu Mar  3 09:19:14 2016
@@ -47,8 +47,6 @@ class GdbRemoteTestCaseBase(TestBase):
 
 _verbose_log_handler = None
 _log_formatter = logging.Formatter(fmt='%(asctime)-15s %(levelname)-8s 
%(message)s')
-_remote_server_log_file = None
-debug_monitor_extra_args = []
 
 def setUpBaseLogging(self):
 self.logger = logging.getLogger(__name__)
@@ -106,35 +104,10 @@ class GdbRemoteTestCaseBase(TestBase):
 self.stub_hostname = "localhost"
 
 def tearDown(self):
-if self._remote_server_log_file is not None:
-
lldb.remote_platform.Get(lldb.SBFileSpec(self._remote_server_log_file),
-lldb.SBFileSpec(self.getLocalServerLogFile()))
-lldb.remote_platform.Run(lldb.SBPlatformShellCommand("rm " + 
self._remote_server_log_file))
-self._remote_server_log_file = None
-
 self.logger.removeHandler(self._verbose_log_handler)
 self._verbose_log_handler = None
 TestBase.tearDown(self)
 
-def getLocalServerLogFile(self):
-return self.log_basename + "-server.log"
-
-def setUpServerLogging(self, is_llgs):
-if len(lldbtest_config.channels) == 0:
-return # No logging requested
-
-if lldb.remote_platform:
-log_file = 
lldbutil.join_remote_paths(lldb.remote_platform.GetWorkingDirectory(), 
"server.log")
-self._remote_server_log_file = log_file
-else:
-log_file = self.getLocalServerLogFile()
-
-if is_llgs:
-self.debug_monitor_extra_args.append("--log-file=" + log_file)
-
self.debug_monitor_extra_args.append("--log-channels={}".format(":".join(lldbtest_config.channels)))
-else:
-self.debug_monitor_extra_args = ["--log-file=" + self.log_file, 
"--log-flags=0x80"]
-
 def get_next_port(self):
 return 12000 + random.randint(0,3999)
 
@@ -241,7 +214,10 @@ class GdbRemoteTestCaseBase(TestBase):
 self.skipTest("lldb-server exe not found")
 
 self.debug_monitor_extra_args = ["gdbserver"]
-self.setUpServerLogging(is_llgs=True)
+
+if len(lldbtest_config.channels) > 0:
+
self.debug_monitor_extra_args.append("--log-file={}-server.log".format(self.log_basename))
+
self.debug_monitor_extra_args.append("--log-channels={}".format(":".join(lldbtest_config.channels)))
 
 if use_named_pipe:
 (self.named_pipe_path, self.named_pipe, self.named_pipe_fd) = 
self.create_named_pipe()
@@ -250,7 +226,7 @@ class GdbRemoteTestCaseBase(TestBase):
 self.debug_monitor_exe = get_debugserver_exe()
 if not self.debug_monitor_exe:
 self.skipTest("debugserver exe not found")
-self.setUpServerLogging(is_llgs=False)
+self.debug_monitor_extra_args = 
["--log-file={}-server.log".format(self.log_basename), "--log-flags=0x80"]
 if use_named_pipe:
 (self.named_pipe_path, self.named_pipe, self.named_pipe_fd) = 
self.create_named_pipe()
 # The debugserver stub has a race on handling the 'k' command, so it 
sends an X09 right away, then sends the real X notification


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


[Lldb-commits] [PATCH] D17856: Fix expression evaluation with operator new

2016-03-03 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added a reviewer: spyffe.
labath added subscribers: lldb-commits, paulherman, sivachandra.

referencing a user-defined operator new was triggering an assert in clang 
because we were
registering the function name as string "operator new", instead of using the 
special operator
enum, which clang has for this purpose. Method operators already had code to 
handle this, and now
I extend this to cover free standing operator functions as well. Test included.

http://reviews.llvm.org/D17856

Files:
  include/lldb/Symbol/ClangASTContext.h
  
packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py
  packages/Python/lldbsuite/test/lang/cpp/global_operators/main.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  source/Symbol/ClangASTContext.cpp

Index: source/Symbol/ClangASTContext.cpp
===
--- source/Symbol/ClangASTContext.cpp
+++ source/Symbol/ClangASTContext.cpp
@@ -123,6 +123,241 @@
 return *g_map_ptr;
 }
 
+static bool
+IsOperator(const char *name, clang::OverloadedOperatorKind &op_kind)
+{
+if (name == nullptr || name[0] == '\0')
+return false;
+
+#define OPERATOR_PREFIX "operator"
+#define OPERATOR_PREFIX_LENGTH (sizeof(OPERATOR_PREFIX) - 1)
+
+const char *post_op_name = nullptr;
+
+bool no_space = true;
+
+if (::strncmp(name, OPERATOR_PREFIX, OPERATOR_PREFIX_LENGTH))
+return false;
+
+post_op_name = name + OPERATOR_PREFIX_LENGTH;
+
+if (post_op_name[0] == ' ')
+{
+post_op_name++;
+no_space = false;
+}
+
+#undef OPERATOR_PREFIX
+#undef OPERATOR_PREFIX_LENGTH
+
+// This is an operator, set the overloaded operator kind to invalid
+// in case this is a conversion operator...
+op_kind = clang::NUM_OVERLOADED_OPERATORS;
+
+switch (post_op_name[0])
+{
+default:
+if (no_space)
+return false;
+break;
+case 'n':
+if (no_space)
+return false;
+if (strcmp(post_op_name, "new") == 0)
+op_kind = clang::OO_New;
+else if (strcmp(post_op_name, "new[]") == 0)
+op_kind = clang::OO_Array_New;
+break;
+
+case 'd':
+if (no_space)
+return false;
+if (strcmp(post_op_name, "delete") == 0)
+op_kind = clang::OO_Delete;
+else if (strcmp(post_op_name, "delete[]") == 0)
+op_kind = clang::OO_Array_Delete;
+break;
+
+case '+':
+if (post_op_name[1] == '\0')
+op_kind = clang::OO_Plus;
+else if (post_op_name[2] == '\0')
+{
+if (post_op_name[1] == '=')
+op_kind = clang::OO_PlusEqual;
+else if (post_op_name[1] == '+')
+op_kind = clang::OO_PlusPlus;
+}
+break;
+
+case '-':
+if (post_op_name[1] == '\0')
+op_kind = clang::OO_Minus;
+else if (post_op_name[2] == '\0')
+{
+switch (post_op_name[1])
+{
+case '=':
+op_kind = clang::OO_MinusEqual;
+break;
+case '-':
+op_kind = clang::OO_MinusMinus;
+break;
+case '>':
+op_kind = clang::OO_Arrow;
+break;
+}
+}
+else if (post_op_name[3] == '\0')
+{
+if (post_op_name[2] == '*')
+op_kind = clang::OO_ArrowStar;
+break;
+}
+break;
+
+case '*':
+if (post_op_name[1] == '\0')
+op_kind = clang::OO_Star;
+else if (post_op_name[1] == '=' && post_op_name[2] == '\0')
+op_kind = clang::OO_StarEqual;
+break;
+
+case '/':
+if (post_op_name[1] == '\0')
+op_kind = clang::OO_Slash;
+else if (post_op_name[1] == '=' && post_op_name[2] == '\0')
+op_kind = clang::OO_SlashEqual;
+break;
+
+case '%':
+if (post_op_name[1] == '\0')
+op_kind = clang::OO_Percent;
+else if (post_op_name[1] == '=' && post_op_name[2] == '\0')
+op_kind = clang::OO_PercentEqual;
+break;
+
+case '^':
+if (post_op_name[1] == '\0')
+op_kind = clang::OO_Caret;
+else if (post_op_name[1] == '=' && post_op_name[2] == '\0')
+op_kind = clang::OO_CaretEqual;
+break;
+
+case '&':
+if (post_op_name[1] == '\0')
+op_kind = clang::OO_Amp;
+else if (post_op_name[2] == '\0')
+

[Lldb-commits] [PATCH] D17860: Fix "ninja check-lldb" crash in IRExecutionUnit.cpp

2016-03-03 Thread Ted Woodward via lldb-commits
ted created this revision.
ted added reviewers: spyffe, zturner, amccarth.
ted added a subscriber: lldb-commits.

From Adrian McCarthy:

"Running ninja check-lldb now has one crash in a Python process, due to 
deferencing a null pointer in IRExecutionUnit.cpp:  candidate_sc.symbol is 
null, which leads to a call with a null this pointer."

http://reviews.llvm.org/D17860

Files:
  source/Expression/IRExecutionUnit.cpp

Index: source/Expression/IRExecutionUnit.cpp
===
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -796,27 +796,28 @@
 
 sc_list.GetContextAtIndex(si, candidate_sc);
 
-const bool is_external = (candidate_sc.function) ||
- (candidate_sc.symbol && 
candidate_sc.symbol->IsExternal());
+if (candidate_sc.symbol)
+{
 
-load_address = 
candidate_sc.symbol->ResolveCallableAddress(*target);
+load_address = 
candidate_sc.symbol->ResolveCallableAddress(*target);
 
-if (load_address == LLDB_INVALID_ADDRESS)
-if (target->GetProcessSP())
-load_address = 
candidate_sc.symbol->GetAddress().GetLoadAddress(target);
-else
-load_address = 
candidate_sc.symbol->GetAddress().GetFileAddress();
+if (load_address == LLDB_INVALID_ADDRESS)
+if (target->GetProcessSP())
+load_address = 
candidate_sc.symbol->GetAddress().GetLoadAddress(target);
+else
+load_address = 
candidate_sc.symbol->GetAddress().GetFileAddress();
 
-if (load_address != LLDB_INVALID_ADDRESS)
-{
-if (is_external)
-{
-return true;
-}
-else if (best_internal_load_address == 
LLDB_INVALID_ADDRESS)
+if (load_address != LLDB_INVALID_ADDRESS)
 {
-best_internal_load_address = load_address;
-load_address = LLDB_INVALID_ADDRESS;
+if (candidate_sc.function || 
candidate_sc.symbol->IsExternal())
+{
+return true;
+}
+else if (best_internal_load_address == 
LLDB_INVALID_ADDRESS)
+{
+best_internal_load_address = load_address;
+load_address = LLDB_INVALID_ADDRESS;
+}
 }
 }
 }


Index: source/Expression/IRExecutionUnit.cpp
===
--- source/Expression/IRExecutionUnit.cpp
+++ source/Expression/IRExecutionUnit.cpp
@@ -796,27 +796,28 @@
 
 sc_list.GetContextAtIndex(si, candidate_sc);
 
-const bool is_external = (candidate_sc.function) ||
- (candidate_sc.symbol && candidate_sc.symbol->IsExternal());
+if (candidate_sc.symbol)
+{
 
-load_address = candidate_sc.symbol->ResolveCallableAddress(*target);
+load_address = candidate_sc.symbol->ResolveCallableAddress(*target);
 
-if (load_address == LLDB_INVALID_ADDRESS)
-if (target->GetProcessSP())
-load_address = candidate_sc.symbol->GetAddress().GetLoadAddress(target);
-else
-load_address = candidate_sc.symbol->GetAddress().GetFileAddress();
+if (load_address == LLDB_INVALID_ADDRESS)
+if (target->GetProcessSP())
+load_address = candidate_sc.symbol->GetAddress().GetLoadAddress(target);
+else
+load_address = candidate_sc.symbol->GetAddress().GetFileAddress();
 
-if (load_address != LLDB_INVALID_ADDRESS)
-{
-if (is_external)
-{
-return true;
-}
-else if (best_internal_load_address == LLDB_INVALID_ADDRESS)
+if (load_address != LLDB_INVALID_ADDRESS)
 {
-best_internal_load_address = load_address;
-load_address = LLDB_INVALID_ADDRESS;
+if (candidate_sc.function || candidate_sc.symbol->IsExternal())
+{
+return true;
+}
+else if (best_internal_load_address == LLDB_INVALID_ADDRESS)
+{
+

Re: [Lldb-commits] [PATCH] D17724: Replace getopt with llvm::cl in lldb driver

2016-03-03 Thread Greg Clayton via lldb-commits
clayborg added a comment.

Feel free to check this in a branch if you want to keep it around for when you 
later work on this so you don't lose the changes?


http://reviews.llvm.org/D17724



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


Re: [Lldb-commits] [PATCH] D17848: Add reverse file remapping for breakpoint set

2016-03-03 Thread Jim Ingham via lldb-commits
jingham added a subscriber: jingham.
jingham added a comment.

This looks fine to me.


http://reviews.llvm.org/D17848



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


Re: [Lldb-commits] [PATCH] D17848: Add reverse file remapping for breakpoint set

2016-03-03 Thread Jim Ingham via lldb-commits
jingham added a comment.

At some point we should deal with the loss of information when we resolve 
re-mapped paths.  For instance, here I set a breakpoint by the moved source 
location's full path, and that gets remapped to the build location.  That's 
lovely since it makes the breakpoint take, but then if I do "break list" I'll 
see something I didn't enter, which is a little surprising.  That happens in a 
few other places, so I don't think you need to deal with it here (and I don't 
think we want to burden FileSpec with the responsibility of keeping both paths) 
but just something to keep in the back of our minds...


http://reviews.llvm.org/D17848



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


Re: [Lldb-commits] [PATCH] D17724: Replace getopt with llvm::cl in lldb driver

2016-03-03 Thread Jim Ingham via lldb-commits

> On Mar 2, 2016, at 10:18 AM, Greg Clayton  wrote:
> 
> So this is nice that you cleaned up this one place where we can use LLVM's 
> option parsing stuff, but it now makes the driver inconsistent with the rest 
> of LLDB. It also makes it so you have to link some LLVM .a files into the 
> lldb command line driver which we didn't have before. If we are going to make 
> a change away from getopt_long(), I would rather change everything over. 
> Otherwise we have our command line that behaves one way, and all of our 
> command interpreter commands behaving another. And if we use option parsing 
> from the driver, I would rather have the one consistent way that we handle 
> options be exported through the lldb::SB API with something like:
> 
> lldb::SBOptionParser
> lldb::SBOption

There's another reason why we want to expose defining command options & 
argument at the SB API layer.  Right now all the Python based commands have to 
do their own argument & help parsing, and so those commands are distinctly 
"second-class citizens."  They don't show up right in help & apropos, and they 
don't do argument completion.  So if anybody has some spare time to take a 
whack at this, that would be really great.

Jim

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


Re: [Lldb-commits] [PATCH] D17724: Replace getopt with llvm::cl in lldb driver

2016-03-03 Thread Greg Clayton via lldb-commits


> On Mar 3, 2016, at 12:33 PM, Jim Ingham  wrote:
> 
> 
>> On Mar 2, 2016, at 10:18 AM, Greg Clayton  wrote:
>> 
>> So this is nice that you cleaned up this one place where we can use LLVM's 
>> option parsing stuff, but it now makes the driver inconsistent with the rest 
>> of LLDB. It also makes it so you have to link some LLVM .a files into the 
>> lldb command line driver which we didn't have before. If we are going to 
>> make a change away from getopt_long(), I would rather change everything 
>> over. Otherwise we have our command line that behaves one way, and all of 
>> our command interpreter commands behaving another. And if we use option 
>> parsing from the driver, I would rather have the one consistent way that we 
>> handle options be exported through the lldb::SB API with something like:
>> 
>> lldb::SBOptionParser
>> lldb::SBOption
> 
> There's another reason why we want to expose defining command options & 
> argument at the SB API layer.  Right now all the Python based commands have 
> to do their own argument & help parsing, and so those commands are distinctly 
> "second-class citizens."  They don't show up right in help & apropos, and 
> they don't do argument completion.  So if anybody has some spare time to take 
> a whack at this, that would be really great.
> 

Agreed!



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