Re: [Lldb-commits] [PATCH] Use std::call_once for initialization

2015-04-02 Thread Davide Italiano
In http://reviews.llvm.org/D8760#150578, @zturner wrote:

> Maybe a comment indicating why it's a ManagedStatic would also be helpful so 
> people are aware of the history.


Ugh, I'm sorry. For some reason I didn't receive your comments via mail and 
noticed them only after commit.
I'll change them tomorrow morning and submit a new review.

Thanks,


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8760

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r233999 - [Plugin/Process] Use std::call_once() to initialize.

2015-04-02 Thread Davide Italiano
Author: davide
Date: Thu Apr  2 23:24:32 2015
New Revision: 233999

URL: http://llvm.org/viewvc/llvm-project?rev=233999&view=rev
Log:
[Plugin/Process] Use std::call_once() to initialize.

This replaces the home-grown initialization mechanism used before.

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

Modified:
lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=233999&r1=233998&r2=233999&view=diff
==
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Thu Apr  2 
23:24:32 2015
@@ -56,16 +56,14 @@ ProcessFreeBSD::CreateInstance(Target& t
 void
 ProcessFreeBSD::Initialize()
 {
-static bool g_initialized = false;
+static std::once_flag g_once_flag;
 
-if (!g_initialized)
-{
+std::call_once(g_once_flag, []() {
 PluginManager::RegisterPlugin(GetPluginNameStatic(),
   GetPluginDescriptionStatic(),
   CreateInstance);
 ProcessPOSIXLog::Initialize(GetPluginNameStatic());
-g_initialized = true;
-}
+});
 }
 
 lldb_private::ConstString

Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp?rev=233999&r1=233998&r2=233999&view=diff
==
--- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Thu Apr  2 
23:24:32 2015
@@ -53,16 +53,14 @@ ProcessLinux::CreateInstance(Target &tar
 void
 ProcessLinux::Initialize()
 {
-static bool g_initialized = false;
+static std::once_flag g_once_flag;
 
-if (!g_initialized)
-{
-g_initialized = true;
+std::call_once(g_once_flag, []() {
 PluginManager::RegisterPlugin(GetPluginNameStatic(),
   GetPluginDescriptionStatic(),
   CreateInstance);
 ProcessPOSIXLog::Initialize(GetPluginNameStatic());
-}
+});
 }
 
 
//--

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=233999&r1=233998&r2=233999&view=diff
==
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Thu Apr  2 
23:24:32 2015
@@ -835,24 +835,23 @@ ProcessKDP::DoSignal (int signo)
 void
 ProcessKDP::Initialize()
 {
-static bool g_initialized = false;
-
-if (g_initialized == false)
+static std::once_flag g_once_flag;
+
+std::call_once(g_once_flag, []()
 {
-g_initialized = true;
 PluginManager::RegisterPlugin (GetPluginNameStatic(),
GetPluginDescriptionStatic(),
CreateInstance,
-   DebuggerInitialize);
-
+   DebuggerInitialize);a
+
 Log::Callbacks log_callbacks = {
 ProcessKDPLog::DisableLog,
 ProcessKDPLog::EnableLog,
 ProcessKDPLog::ListLogCategories
 };
-
+
 Log::RegisterLogChannel (ProcessKDP::GetPluginNameStatic(), 
log_callbacks);
-}
+});
 }
 
 void

Modified: lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp?rev=233999&r1=233998&r2=233999&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp Thu Apr  2 
23:24:32 2015
@@ -87,11 +87,10 @@ ProcessWindows::CreateInstance(Target &t
 void
 ProcessWindows::Initialize()
 {
-static bool g_initialized = false;
+static std::once_flag g_once_flag;
 
-if (!g_initialized)
+std::call_once(g_once_flag, []

Re: [Lldb-commits] [PATCH] Use std::call_once for initialization

2015-04-02 Thread Davide Italiano
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8760

Files:
  lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
  lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp
  lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
  lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2958,16 +2958,15 @@
 void
 ProcessGDBRemote::Initialize()
 {
-static bool g_initialized = false;
+static std::once_flag g_once_flag;
 
-if (g_initialized == false)
+std::call_once(g_once_flag, []()
 {
-g_initialized = true;
 PluginManager::RegisterPlugin (GetPluginNameStatic(),
GetPluginDescriptionStatic(),
CreateInstance,
DebuggerInitialize);
-}
+});
 }
 
 void
Index: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
===
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -835,24 +835,23 @@
 void
 ProcessKDP::Initialize()
 {
-static bool g_initialized = false;
-
-if (g_initialized == false)
+static std::once_flag g_once_flag;
+
+std::call_once(g_once_flag, []()
 {
-g_initialized = true;
 PluginManager::RegisterPlugin (GetPluginNameStatic(),
GetPluginDescriptionStatic(),
CreateInstance,
-   DebuggerInitialize);
-
+   DebuggerInitialize);a
+
 Log::Callbacks log_callbacks = {
 ProcessKDPLog::DisableLog,
 ProcessKDPLog::EnableLog,
 ProcessKDPLog::ListLogCategories
 };
-
+
 Log::RegisterLogChannel (ProcessKDP::GetPluginNameStatic(), log_callbacks);
-}
+});
 }
 
 void
Index: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
===
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -56,16 +56,14 @@
 void
 ProcessFreeBSD::Initialize()
 {
-static bool g_initialized = false;
+static std::once_flag g_once_flag;
 
-if (!g_initialized)
-{
+std::call_once(g_once_flag, []() {
 PluginManager::RegisterPlugin(GetPluginNameStatic(),
   GetPluginDescriptionStatic(),
   CreateInstance);
 ProcessPOSIXLog::Initialize(GetPluginNameStatic());
-g_initialized = true;
-}
+});
 }
 
 lldb_private::ConstString
Index: lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
===
--- lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
+++ lldb/trunk/source/Plugins/Process/Windows/ProcessWindows.cpp
@@ -87,11 +87,10 @@
 void
 ProcessWindows::Initialize()
 {
-static bool g_initialized = false;
+static std::once_flag g_once_flag;
 
-if (!g_initialized)
+std::call_once(g_once_flag, []()
 {
-g_initialized = true;
 PluginManager::RegisterPlugin(GetPluginNameStatic(),
   GetPluginDescriptionStatic(),
   CreateInstance);
Index: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
===
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -374,13 +374,13 @@
 void
 ProcessElfCore::Initialize()
 {
-static bool g_initialized = false;
+static std::once_flag g_once_flag;
 
-if (g_initialized == false)
+std::call_once(g_once_flag, []()
 {
-g_initialized = true;
-PluginManager::RegisterPlugin (GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance);
-}
+PluginManager::RegisterPlugin (GetPluginNameStatic(),
+  GetPluginDescriptionStatic(), CreateInstance);
+});
 }
 
 lldb::addr_t
Index: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
===
--- lldb/trunk/sour

Re: [Lldb-commits] [PATCH] TestRecursiveInferior fixed on Linux

2015-04-02 Thread Ed Maste
REPOSITORY
  rL LLVM


Comment at: lldb/trunk/test/lldbtest.py:1399
@@ +1398,3 @@
+def platformIsLinux(self):
+"""Returns true if the OS triple for the selected platform is any 
valid apple OS"""
+platform_name = self.getPlatform()

comment needs update

http://reviews.llvm.org/D8678

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Exception registers aren't supported outside of Darwin

2015-04-02 Thread Vince Harron
sys.platform in ['darwin'] with self.platformIsDarwin()


http://reviews.llvm.org/D8812

Files:
  test/python_api/lldbutil/iter/TestRegistersIterator.py

Index: test/python_api/lldbutil/iter/TestRegistersIterator.py
===
--- test/python_api/lldbutil/iter/TestRegistersIterator.py
+++ test/python_api/lldbutil/iter/TestRegistersIterator.py
@@ -19,7 +19,6 @@
 self.line1 = line_number('main.cpp', '// Set break point at this 
line.')
 
 @expectedFailureFreeBSD # llvm.org/pr14600 - Exception state registers not 
supported on FreeBSD
-@expectedFailureLinux # llvm.org/pr14600 - Exception state registers not 
supported on Linux
 @python_api_test
 def test_iter_registers(self):
 """Test iterator works correctly for lldbutil.iter_registers()."""
@@ -68,21 +67,29 @@
 print "%s => %s" % (reg.GetName(), reg.GetValue())
 
 REGs = lldbutil.get_ESRs(frame)
-num = len(REGs)
-if self.TraceOn():
-print "\nNumber of exception state registers: %d" % num
-for reg in REGs:
-self.assertTrue(reg)
+if self.platformIsDarwin():
+num = len(REGs)
 if self.TraceOn():
-print "%s => %s" % (reg.GetName(), reg.GetValue())
+print "\nNumber of exception state registers: %d" 
% num
+for reg in REGs:
+self.assertTrue(reg)
+if self.TraceOn():
+print "%s => %s" % (reg.GetName(), 
reg.GetValue())
+else:
+self.assertIsNone(REGs)
 
 # And these should also work.
 for kind in ["General Purpose Registers",
- "Floating Point Registers",
- "Exception State Registers"]:
+ "Floating Point Registers"]:
 REGs = lldbutil.get_registers(frame, kind)
 self.assertTrue(REGs)
 
+REGs = lldbutil.get_registers(frame, "Exception State 
Registers")
+if self.platformIsDarwin():
+self.assertIsNotNone(REGs)
+else:
+self.assertIsNone(REGs)
+
 # We've finished dumping the registers for frame #0.
 break

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: test/python_api/lldbutil/iter/TestRegistersIterator.py
===
--- test/python_api/lldbutil/iter/TestRegistersIterator.py
+++ test/python_api/lldbutil/iter/TestRegistersIterator.py
@@ -19,7 +19,6 @@
 self.line1 = line_number('main.cpp', '// Set break point at this line.')
 
 @expectedFailureFreeBSD # llvm.org/pr14600 - Exception state registers not supported on FreeBSD
-@expectedFailureLinux # llvm.org/pr14600 - Exception state registers not supported on Linux
 @python_api_test
 def test_iter_registers(self):
 """Test iterator works correctly for lldbutil.iter_registers()."""
@@ -68,21 +67,29 @@
 print "%s => %s" % (reg.GetName(), reg.GetValue())
 
 REGs = lldbutil.get_ESRs(frame)
-num = len(REGs)
-if self.TraceOn():
-print "\nNumber of exception state registers: %d" % num
-for reg in REGs:
-self.assertTrue(reg)
+if self.platformIsDarwin():
+num = len(REGs)
 if self.TraceOn():
-print "%s => %s" % (reg.GetName(), reg.GetValue())
+print "\nNumber of exception state registers: %d" % num
+for reg in REGs:
+self.assertTrue(reg)
+if self.TraceOn():
+print "%s => %s" % (reg.GetName(), reg.GetValue())
+else:
+self.assertIsNone(REGs)
 
 # And these should also work.
 for kind in ["General Purpose Registers",
- "Floating Point Registers",
- "Exception State Registers"]:
+ "Floating Point Registers"]:
 REGs = lldbutil.get_registers(frame, kind)
 self.assertTrue(REGs)
 
+REGs = lldbutil.get_registers(frame, "Exception State Registers")
+if self.platformIsDarwin():
+self.assertIsNotNone(REGs)
+ 

Re: [Lldb-commits] [PATCH] Fix resolution of certain recursive types.

2015-04-02 Thread Stephane Sezer
Use a scoped class to do removals.


http://reviews.llvm.org/D8561

Files:
  include/lldb/Expression/ClangASTSource.h
  source/Expression/ClangASTSource.cpp
  source/Symbol/ClangASTImporter.cpp
  test/types/TestRecursiveTypes.py
  test/types/recursive_type_1.cpp
  test/types/recursive_type_2.cpp
  test/types/recursive_type_main.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/lldb/Expression/ClangASTSource.h
===
--- include/lldb/Expression/ClangASTSource.h
+++ include/lldb/Expression/ClangASTSource.h
@@ -51,6 +51,7 @@
 m_lookups_enabled (false),
 m_target (target),
 m_ast_context (NULL),
+m_active_lexical_decls (),
 m_active_lookups ()
 {
 m_ast_importer = m_target->GetClangASTImporter();
@@ -404,6 +405,7 @@
 const lldb::TargetSPm_target;   ///< The target to use in finding variables and types.
 clang::ASTContext  *m_ast_context;  ///< The AST context requests are coming in for.
 ClangASTImporter   *m_ast_importer; ///< The target's AST importer.
+std::set   m_active_lexical_decls;
 std::set  m_active_lookups;
 };
 
Index: source/Expression/ClangASTSource.cpp
===
--- source/Expression/ClangASTSource.cpp
+++ source/Expression/ClangASTSource.cpp
@@ -30,6 +30,31 @@
 using namespace clang;
 using namespace lldb_private;
 
+//--
+// Scoped class that will remove an active lexical decl from the set
+// when it goes out of scope.
+//--
+namespace {
+class ScopedLexicalDeclEraser
+{
+public:
+ScopedLexicalDeclEraser(std::set &decls,
+const clang::Decl *decl)
+: m_active_lexical_decls(decls), m_decl(decl)
+{
+}
+
+~ScopedLexicalDeclEraser()
+{
+m_active_lexical_decls.erase(m_decl);
+}
+
+private:
+std::set &m_active_lexical_decls;
+const clang::Decl *m_decl;
+};
+}
+
 ClangASTSource::~ClangASTSource()
 {
 m_ast_importer->ForgetDestination(m_ast_context);
@@ -191,6 +216,12 @@
 dumper.ToLog(log, "  [CTD] ");
 }
 
+auto iter = m_active_lexical_decls.find(tag_decl);
+if (iter != m_active_lexical_decls.end())
+return;
+m_active_lexical_decls.insert(tag_decl);
+ScopedLexicalDeclEraser eraser(m_active_lexical_decls, tag_decl);
+
 if (!m_ast_importer->CompleteTagDecl (tag_decl))
 {
 // We couldn't complete the type.  Maybe there's a definition
@@ -402,6 +433,12 @@
 if (!context_decl)
 return ELR_Failure;
 
+auto iter = m_active_lexical_decls.find(context_decl);
+if (iter != m_active_lexical_decls.end())
+return ELR_Failure;
+m_active_lexical_decls.insert(context_decl);
+ScopedLexicalDeclEraser eraser(m_active_lexical_decls, context_decl);
+
 static unsigned int invocation_id = 0;
 unsigned int current_id = invocation_id++;
 
Index: source/Symbol/ClangASTImporter.cpp
===
--- source/Symbol/ClangASTImporter.cpp
+++ source/Symbol/ClangASTImporter.cpp
@@ -286,7 +286,12 @@
 
 if (const TagType *tag_type = type->getAs())
 {
-return CompleteTagDecl(tag_type->getDecl());
+TagDecl *tag_decl = tag_type->getDecl();
+
+if (tag_decl->getDefinition() || tag_decl->isBeingDefined())
+return true;
+
+return CompleteTagDecl(tag_decl);
 }
 if (const ObjCObjectType *objc_object_type = type->getAs())
 {
Index: test/types/TestRecursiveTypes.py
===
--- /dev/null
+++ test/types/TestRecursiveTypes.py
@@ -0,0 +1,68 @@
+"""
+Test that recursive types are handled correctly.
+"""
+
+import lldb
+import lldbutil
+import sys
+import unittest2
+from lldbtest import *
+
+class RecursiveTypesTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# disable "There is a running process, kill it and restart?" prompt
+self.runCmd("settings set auto-confirm true")
+self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+# Find the line number to break for main.c.
+self.line = line_number('recursive_type_main.cpp',
+'// Test at this line.')
+
+self.d1 = {'CXX_SOURCES': 'recursive_type_main.cpp recursive_type_1.cpp'}
+self.d2 = {'CXX_SOURCES': 'recursive_type_main.cpp recursive_type_2.cpp'}
+
+@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+@dsym_

Re: [Lldb-commits] [PATCH] implement gdb-set output-radix

2015-04-02 Thread Chuck Ries
added test


http://reviews.llvm.org/D8430

Files:
  test/tools/lldb-mi/variable/TestMiVar.py
  tools/lldb-mi/MICmdCmdGdbSet.cpp
  tools/lldb-mi/MICmdCmdGdbSet.h
  tools/lldb-mi/MICmnLLDBDebugSessionInfoVarObj.cpp
  tools/lldb-mi/MICmnLLDBDebugSessionInfoVarObj.h

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: test/tools/lldb-mi/variable/TestMiVar.py
===
--- test/tools/lldb-mi/variable/TestMiVar.py
+++ test/tools/lldb-mi/variable/TestMiVar.py
@@ -185,5 +185,52 @@
 self.runCmd("-var-update --all-values var_complx_array")
 self.expect("\^done,changelist=\[\{name=\"var_complx_array\",value=\"\{\.\.\.\}\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
 
+@lldbmi_test
+@expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
+@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+@skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+def test_lldbmi_gdb_set_ouptut_radix(self):
+"""Test that 'lldb-mi --interpreter' works for -gdb-set output-radix."""
+
+self.spawnLldbMi(args = None)
+
+# Load executable
+self.runCmd("-file-exec-and-symbols %s" % self.myexe)
+self.expect("\^done")
+
+# Run to BP_return
+line = line_number('main.cpp', '// BP_return')
+self.runCmd("-break-insert main.cpp:%d" % line)
+self.expect("\^done,bkpt={number=\"1\"")
+self.runCmd("-exec-run")
+self.expect("\^running");
+self.expect("\*stopped,reason=\"breakpoint-hit\"")
+
+# Setup variable
+self.runCmd("-var-create var_a * a");
+self.expect("\^done,name=\"var_a\",numchild=\"0\",value=\"10\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+
+# Test default output
+self.runCmd("-var-evaluate-expression var_a");
+self.expect("\^done,value=\"10\"");
+
+# Test hex output
+self.runCmd("-gdb-set output-radix 16");
+self.expect("\^done");
+self.runCmd("-var-evaluate-expression var_a");
+self.expect("\^done,value=\"0xa\"");
+
+# Test octal output
+self.runCmd("-gdb-set output-radix 8");
+self.expect("\^done");
+self.runCmd("-var-evaluate-expression var_a");
+self.expect("\^done,value=\"012\"");
+
+# Test decimal output
+self.runCmd("-gdb-set output-radix 10");
+self.expect("\^done");
+self.runCmd("-var-evaluate-expression var_a");
+self.expect("\^done,value=\"10\"");
+
 if __name__ == '__main__':
 unittest2.main()
Index: tools/lldb-mi/MICmdCmdGdbSet.cpp
===
--- tools/lldb-mi/MICmdCmdGdbSet.cpp
+++ tools/lldb-mi/MICmdCmdGdbSet.cpp
@@ -22,6 +22,7 @@
 const CMICmdCmdGdbSet::MapGdbOptionNameToFnGdbOptionPtr_t CMICmdCmdGdbSet::ms_mapGdbOptionNameToFnGdbOptionPtr = {
 {"target-async", &CMICmdCmdGdbSet::OptionFnTargetAsync},
 // { "auto-solib-add", &CMICmdCmdGdbSet::OptionFnAutoSolibAdd },// Example code if need to implement GDB set other options
+{"output-radix", &CMICmdCmdGdbSet::OptionFnOutputRadix},
 {"solib-search-path", &CMICmdCmdGdbSet::OptionFnSolibSearchPath},
 {"fallback", &CMICmdCmdGdbSet::OptionFnFallback}};
 
@@ -288,6 +289,58 @@
 }
 
 //++ 
+// Details: Carry out work to complete the GDB set option 'output-radix' to prepare
+//  and send back information asked for.
+// Type:Method.
+// Args:vrWords - (R) List of additional parameters used by this option.
+// Return:  MIstatus::success - Functional succeeded.
+//  MIstatus::failure - Functional failed.
+// Throws:  None.
+//--
+bool
+CMICmdCmdGdbSet::OptionFnOutputRadix(const CMIUtilString::VecString_t &vrWords)
+{
+// Check we have at least one argument
+if (vrWords.size() < 1)
+{
+m_bGbbOptionFnHasError = true;
+m_strGdbOptionFnError = MIRSRC(IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH);
+return MIstatus::failure;
+}
+const CMIUtilString &rStrValOutputRadix(vrWords[0]);
+
+CMICmnLLDBDebugSessionInfoVarObj::varFormat_e  format = CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Invalid;
+MIint64 radix;
+if (rStrValOutputRadix.ExtractNumber(radix))
+{
+switch (radix)
+{
+case 8:
+format = CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Octal;
+break;
+case 10:
+format = CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Natural;
+break;
+case 16:
+format = CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Hex;
+break;
+default:
+format = CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Invalid;
+break;
+}
+}
+if (format == CMIC

Re: [Lldb-commits] [PATCH] implement gdb-set output-radix

2015-04-02 Thread Chuck Ries
All lld-mi tests passing.


http://reviews.llvm.org/D8430

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] Exception registers aren't supported outside of Darwin

2015-04-02 Thread Vince Harron
Hi clayborg,

Updated test for that

http://reviews.llvm.org/D8812

Files:
  test/python_api/lldbutil/iter/TestRegistersIterator.py

Index: test/python_api/lldbutil/iter/TestRegistersIterator.py
===
--- test/python_api/lldbutil/iter/TestRegistersIterator.py
+++ test/python_api/lldbutil/iter/TestRegistersIterator.py
@@ -19,7 +19,6 @@
 self.line1 = line_number('main.cpp', '// Set break point at this 
line.')
 
 @expectedFailureFreeBSD # llvm.org/pr14600 - Exception state registers not 
supported on FreeBSD
-@expectedFailureLinux # llvm.org/pr14600 - Exception state registers not 
supported on Linux
 @python_api_test
 def test_iter_registers(self):
 """Test iterator works correctly for lldbutil.iter_registers()."""
@@ -68,21 +67,29 @@
 print "%s => %s" % (reg.GetName(), reg.GetValue())
 
 REGs = lldbutil.get_ESRs(frame)
-num = len(REGs)
-if self.TraceOn():
-print "\nNumber of exception state registers: %d" % num
-for reg in REGs:
-self.assertTrue(reg)
+if "darwin" in sys.platform:
+num = len(REGs)
 if self.TraceOn():
-print "%s => %s" % (reg.GetName(), reg.GetValue())
+print "\nNumber of exception state registers: %d" 
% num
+for reg in REGs:
+self.assertTrue(reg)
+if self.TraceOn():
+print "%s => %s" % (reg.GetName(), 
reg.GetValue())
+else:
+self.assertIsNone(REGs)
 
 # And these should also work.
 for kind in ["General Purpose Registers",
- "Floating Point Registers",
- "Exception State Registers"]:
+ "Floating Point Registers"]:
 REGs = lldbutil.get_registers(frame, kind)
 self.assertTrue(REGs)
 
+REGs = lldbutil.get_registers(frame, "Exception State 
Registers")
+if "darwin" in sys.platform:
+self.assertIsNotNone(REGs)
+else:
+self.assertIsNone(REGs)
+
 # We've finished dumping the registers for frame #0.
 break

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: test/python_api/lldbutil/iter/TestRegistersIterator.py
===
--- test/python_api/lldbutil/iter/TestRegistersIterator.py
+++ test/python_api/lldbutil/iter/TestRegistersIterator.py
@@ -19,7 +19,6 @@
 self.line1 = line_number('main.cpp', '// Set break point at this line.')
 
 @expectedFailureFreeBSD # llvm.org/pr14600 - Exception state registers not supported on FreeBSD
-@expectedFailureLinux # llvm.org/pr14600 - Exception state registers not supported on Linux
 @python_api_test
 def test_iter_registers(self):
 """Test iterator works correctly for lldbutil.iter_registers()."""
@@ -68,21 +67,29 @@
 print "%s => %s" % (reg.GetName(), reg.GetValue())
 
 REGs = lldbutil.get_ESRs(frame)
-num = len(REGs)
-if self.TraceOn():
-print "\nNumber of exception state registers: %d" % num
-for reg in REGs:
-self.assertTrue(reg)
+if "darwin" in sys.platform:
+num = len(REGs)
 if self.TraceOn():
-print "%s => %s" % (reg.GetName(), reg.GetValue())
+print "\nNumber of exception state registers: %d" % num
+for reg in REGs:
+self.assertTrue(reg)
+if self.TraceOn():
+print "%s => %s" % (reg.GetName(), reg.GetValue())
+else:
+self.assertIsNone(REGs)
 
 # And these should also work.
 for kind in ["General Purpose Registers",
- "Floating Point Registers",
- "Exception State Registers"]:
+ "Floating Point Registers"]:
 REGs = lldbutil.get_registers(frame, kind)
 self.assertTrue(REGs)
 
+REGs = lldbutil.get_registers(frame, "Exception State Registers")
+if "darwin" in sys.platform:
+self.assertIsNotNone(REGs)
+el

[Lldb-commits] [lldb] r233990 - Fix the Linux build.

2015-04-02 Thread David Blaikie
Author: dblaikie
Date: Thu Apr  2 20:12:52 2015
New Revision: 233990

URL: http://llvm.org/viewvc/llvm-project?rev=233990&view=rev
Log:
Fix the Linux build.

Modified:
lldb/trunk/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp

Modified: 
lldb/trunk/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp?rev=233990&r1=233989&r2=233990&view=diff
==
--- lldb/trunk/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp 
(original)
+++ lldb/trunk/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp 
Thu Apr  2 20:12:52 2015
@@ -5,6 +5,7 @@
 #include "Plugins/Process/Linux/ThreadStateCoordinator.h"
 
 using namespace lldb_private;
+using namespace process_linux;
 
 namespace
 {


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r233976 - Add checks to the modules test case to ensure

2015-04-02 Thread Sean Callanan
Author: spyffe
Date: Thu Apr  2 16:35:04 2015
New Revision: 233976

URL: http://llvm.org/viewvc/llvm-project?rev=233976&view=rev
Log:
Add checks to the modules test case to ensure
that module types and runtime types play well
together.

Modified:
lldb/trunk/test/lang/objc/modules/TestObjCModules.py

Modified: lldb/trunk/test/lang/objc/modules/TestObjCModules.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/modules/TestObjCModules.py?rev=233976&r1=233975&r2=233976&view=diff
==
--- lldb/trunk/test/lang/objc/modules/TestObjCModules.py (original)
+++ lldb/trunk/test/lang/objc/modules/TestObjCModules.py Thu Apr  2 16:35:04 
2015
@@ -73,6 +73,12 @@ class ObjCModulesTestCase(TestBase):
 
 self.expect("expr array.count", VARIABLES_DISPLAYED_CORRECTLY,
 substrs = ["NSUInteger", "3"])
+
+self.expect("p *[NSURL URLWithString:@\"http://lldb.llvm.org\"]";, 
VARIABLES_DISPLAYED_CORRECTLY,
+substrs = ["NSURL", "isa", "_urlString"])
+
+self.expect("p [NSURL 
URLWithString:@\"http://lldb.llvm.org\"].scheme";, VARIABLES_DISPLAYED_CORRECTLY,
+substrs = ["http"])
 
 if __name__ == '__main__':
 import atexit


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] TestRecursiveInferior fixed on Linux

2015-04-02 Thread Vince Harron
Hi Greg, Friendly ping


http://reviews.llvm.org/D8678

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r233940 - Don't return a reference to a temp variable.

2015-04-02 Thread Greg Clayton
Author: gclayton
Date: Thu Apr  2 15:17:08 2015
New Revision: 233940

URL: http://llvm.org/viewvc/llvm-project?rev=233940&view=rev
Log:
Don't return a reference to a temp variable.


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

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=233940&r1=233939&r2=233940&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Apr  2 15:17:08 2015
@@ -2041,9 +2041,6 @@ Process::UnloadImage (uint32_t image_tok
 const lldb::ABISP &
 Process::GetABI()
 {
-if (m_finalizing)
-return lldb::ABISP();
-
 if (!m_abi_sp)
 m_abi_sp = ABI::FindPlugin(m_target.GetArchitecture());
 return m_abi_sp;


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] RenderScript Language Type

2015-04-02 Thread Greg Clayton
I don't have permissions to view this anymore. Looks good though.

> On Apr 2, 2015, at 12:00 PM, Colin Riley  wrote:
> 
> Lowercase name.
> 
> 
> REPOSITORY
>  rL LLVM
> 
> http://reviews.llvm.org/D8803
> 
> Files:
>  include/lldb/lldb-enumerations.h
>  source/Target/LanguageRuntime.cpp
> 
> Index: include/lldb/lldb-enumerations.h
> ===
> --- include/lldb/lldb-enumerations.h
> +++ include/lldb/lldb-enumerations.h
> @@ -397,6 +397,8 @@
> eLanguageTypeC_plus_plus_14  = 0x0021,   ///< ISO C++:2014.
> eLanguageTypeFortran03   = 0x0022,   ///< ISO Fortran 2003.
> eLanguageTypeFortran08   = 0x0023,   ///< ISO Fortran 2008.
> +// Vendor Extensions
> +eLanguageTypeExtRenderScript = 0x8e57,   ///< RenderScript
> eNumLanguageTypes
> } LanguageType;
> 
> Index: source/Target/LanguageRuntime.cpp
> ===
> --- source/Target/LanguageRuntime.cpp
> +++ source/Target/LanguageRuntime.cpp
> @@ -340,6 +340,8 @@
> {   "c++14",eLanguageTypeC_plus_plus_14 },
> {   "fortran03",eLanguageTypeFortran03  },
> {   "fortran08",eLanguageTypeFortran08  },
> +// Vendor Extensions
> +{   "renderscript", eLanguageTypeExtRenderScript},
> // Now synonyms, in arbitrary order
> {   "objc", eLanguageTypeObjC   },
> {   "objc++",   eLanguageTypeObjC_plus_plus }
> 
> EMAIL PREFERENCES
>  http://reviews.llvm.org/settings/panel/emailpreferences/
> 

___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] RenderScript Language Type

2015-04-02 Thread Colin Riley
Lowercase name.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8803

Files:
  include/lldb/lldb-enumerations.h
  source/Target/LanguageRuntime.cpp

Index: include/lldb/lldb-enumerations.h
===
--- include/lldb/lldb-enumerations.h
+++ include/lldb/lldb-enumerations.h
@@ -397,6 +397,8 @@
 eLanguageTypeC_plus_plus_14  = 0x0021,   ///< ISO C++:2014.
 eLanguageTypeFortran03   = 0x0022,   ///< ISO Fortran 2003.
 eLanguageTypeFortran08   = 0x0023,   ///< ISO Fortran 2008.
+// Vendor Extensions
+eLanguageTypeExtRenderScript = 0x8e57,   ///< RenderScript
 eNumLanguageTypes
 } LanguageType;
 
Index: source/Target/LanguageRuntime.cpp
===
--- source/Target/LanguageRuntime.cpp
+++ source/Target/LanguageRuntime.cpp
@@ -340,6 +340,8 @@
 {   "c++14",eLanguageTypeC_plus_plus_14 },
 {   "fortran03",eLanguageTypeFortran03  },
 {   "fortran08",eLanguageTypeFortran08  },
+// Vendor Extensions
+{   "renderscript", eLanguageTypeExtRenderScript},
 // Now synonyms, in arbitrary order
 {   "objc", eLanguageTypeObjC   },
 {   "objc++",   eLanguageTypeObjC_plus_plus }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/lldb/lldb-enumerations.h
===
--- include/lldb/lldb-enumerations.h
+++ include/lldb/lldb-enumerations.h
@@ -397,6 +397,8 @@
 eLanguageTypeC_plus_plus_14  = 0x0021,   ///< ISO C++:2014.
 eLanguageTypeFortran03   = 0x0022,   ///< ISO Fortran 2003.
 eLanguageTypeFortran08   = 0x0023,   ///< ISO Fortran 2008.
+// Vendor Extensions
+eLanguageTypeExtRenderScript = 0x8e57,   ///< RenderScript
 eNumLanguageTypes
 } LanguageType;
 
Index: source/Target/LanguageRuntime.cpp
===
--- source/Target/LanguageRuntime.cpp
+++ source/Target/LanguageRuntime.cpp
@@ -340,6 +340,8 @@
 {   "c++14",eLanguageTypeC_plus_plus_14 },
 {   "fortran03",eLanguageTypeFortran03  },
 {   "fortran08",eLanguageTypeFortran08  },
+// Vendor Extensions
+{   "renderscript", eLanguageTypeExtRenderScript},
 // Now synonyms, in arbitrary order
 {   "objc", eLanguageTypeObjC   },
 {   "objc++",   eLanguageTypeObjC_plus_plus }
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r233935 - Fix a crasher that could happen when you run LLDB and evaluate an expression where the objective C runtime registers a helper function, and also have an Objective C or

2015-04-02 Thread Greg Clayton
Author: gclayton
Date: Thu Apr  2 13:44:58 2015
New Revision: 233935

URL: http://llvm.org/viewvc/llvm-project?rev=233935&view=rev
Log:
Fix a crasher that could happen when you run LLDB and evaluate an expression 
where the objective C runtime registers a helper function, and also have an 
Objective C or C++ exception breakpoint. When shutting down the process in 
Process::Finalize() we clear a STL collection class and that causes objects to 
be destroyed that could re-enter Process and cause it to try to iterate over 
that same collection class that is being destroyed.

Guard against this by setting a new "m_finalizing" flag that lets us know we 
are in the process of finalizing.




Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=233935&r1=233934&r2=233935&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Thu Apr  2 13:44:58 2015
@@ -3171,7 +3171,8 @@ protected:
 ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback;
 boolm_currently_handling_do_on_removals;
 boolm_resume_requested; // If 
m_currently_handling_event or m_currently_handling_do_on_removals are true, 
Resume will only request a resume, using this flag to check.
-boolm_finalize_called;
+boolm_finalizing; // This is set at the beginning 
of Process::Finalize() to stop functions from looking up or creating things 
during a finalize call
+boolm_finalize_called; // This is set at the end 
of Process::Finalize()
 boolm_clear_thread_plans_on_stop;
 boolm_force_next_event_delivery;
 lldb::StateType m_last_broadcast_state;   /// This helps with 
the Public event coalescing in ShouldBroadcastEvent.

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=233935&r1=233934&r2=233935&view=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Apr  2 13:44:58 2015
@@ -749,9 +749,10 @@ Process::Process(Target &target, Listene
 m_private_run_lock (),
 m_currently_handling_event(false),
 m_stop_info_override_callback (NULL),
-m_finalize_called(false),
+m_finalizing (false),
+m_finalize_called (false),
 m_clear_thread_plans_on_stop (false),
-m_force_next_event_delivery(false),
+m_force_next_event_delivery (false),
 m_last_broadcast_state (eStateInvalid),
 m_destroy_in_process (false),
 m_can_jit(eCanJITDontKnow)
@@ -822,6 +823,8 @@ Process::GetGlobalProperties()
 void
 Process::Finalize()
 {
+m_finalizing = true;
+
 // Destroy this process if needed
 switch (GetPrivateState())
 {
@@ -1832,6 +1835,12 @@ Process::GetImageInfoAddress()
 uint32_t
 Process::LoadImage (const FileSpec &image_spec, Error &error)
 {
+if (m_finalizing)
+{
+error.SetErrorString("process is tearing itself down");
+return LLDB_INVALID_IMAGE_TOKEN;
+}
+
 char path[PATH_MAX];
 image_spec.GetPath(path, sizeof(path));
 
@@ -1951,6 +1960,13 @@ Error
 Process::UnloadImage (uint32_t image_token)
 {
 Error error;
+
+if (m_finalizing)
+{
+error.SetErrorString("process is tearing itself down");
+return error;
+}
+
 if (image_token < m_image_tokens.size())
 {
 const addr_t image_addr = m_image_tokens[image_token];
@@ -2025,6 +2041,9 @@ Process::UnloadImage (uint32_t image_tok
 const lldb::ABISP &
 Process::GetABI()
 {
+if (m_finalizing)
+return lldb::ABISP();
+
 if (!m_abi_sp)
 m_abi_sp = ABI::FindPlugin(m_target.GetArchitecture());
 return m_abi_sp;
@@ -2033,6 +2052,9 @@ Process::GetABI()
 LanguageRuntime *
 Process::GetLanguageRuntime(lldb::LanguageType language, bool retry_if_null)
 {
+if (m_finalizing)
+return nullptr;
+
 LanguageRuntimeCollection::iterator pos;
 pos = m_language_runtimes.find (language);
 if (pos == m_language_runtimes.end() || (retry_if_null && !(*pos).second))
@@ -2067,6 +2089,9 @@ Process::GetObjCLanguageRuntime (bool re
 bool
 Process::IsPossibleDynamicValue (ValueObject& in_value)
 {
+if (m_finalizing)
+return false;
+
 if (in_value.IsDynamic())
 return false;
 LanguageType known_type = in_value.GetObjectRuntimeLanguage();


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] Fix debug register offset on FreeBSD

2015-04-02 Thread Chaoren Lin
Hi emaste,

As per emaste's comment here: http://reviews.llvm.org/D8685.

http://reviews.llvm.org/D8806

Files:
  source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
  source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
  source/Plugins/Process/Utility/RegisterInfos_x86_64.h

Index: source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
===
--- source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
+++ source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
@@ -47,21 +47,24 @@
 } GPR;
 
 struct DBG {
-uint64_t  dr[16];  /* debug registers */
-   /* Index 0-3: debug address registers */
-   /* Index 4-5: reserved */
-   /* Index 6: debug status */
-   /* Index 7: debug control */
-   /* Index 8-15: reserved */
+uint64_t dr[16];  /* debug registers */
+  /* Index 0-3: debug address registers */
+  /* Index 4-5: reserved */
+  /* Index 6: debug status */
+  /* Index 7: debug control */
+  /* Index 8-15: reserved */
 };
 
 struct UserArea
 {
 GPR gpr;
 FPR fpr;
-DBG dbg;
 };
 
+// Debug register implementation on FreeBSD is different from Linux.
+#define DR_OFFSET(reg_index) \
+(LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
+
 //---
 // Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64 
structure.
 //---
Index: source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
===
--- source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
+++ source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
@@ -73,6 +73,10 @@
 uint64_t fault_address; // Control register CR3.
 };
 
+#define DR_OFFSET(reg_index) \
+(LLVM_EXTENSION offsetof(UserArea, dbg) + \
+ LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
+
 //---
 // Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64 
structure.
 //---
Index: source/Plugins/Process/Utility/RegisterInfos_x86_64.h
===
--- source/Plugins/Process/Utility/RegisterInfos_x86_64.h
+++ source/Plugins/Process/Utility/RegisterInfos_x86_64.h
@@ -27,10 +27,6 @@
  LLVM_EXTENSION offsetof(XSAVE, ymmh[reg_index]) + \
  (32 * reg_index))
 
-#define DR_OFFSET(reg_index) \
-(LLVM_EXTENSION offsetof(UserArea, dbg) + \
- LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
-
 #ifdef DECLARE_REGISTER_INFOS_X86_64_STRUCT
 
 // Number of bytes needed to represent a FPR.

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
===
--- source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
+++ source/Plugins/Process/Utility/RegisterContextFreeBSD_x86_64.cpp
@@ -47,21 +47,24 @@
 } GPR;
 
 struct DBG {
-uint64_t  dr[16];  /* debug registers */
-   /* Index 0-3: debug address registers */
-   /* Index 4-5: reserved */
-   /* Index 6: debug status */
-   /* Index 7: debug control */
-   /* Index 8-15: reserved */
+uint64_t dr[16];  /* debug registers */
+  /* Index 0-3: debug address registers */
+  /* Index 4-5: reserved */
+  /* Index 6: debug status */
+  /* Index 7: debug control */
+  /* Index 8-15: reserved */
 };
 
 struct UserArea
 {
 GPR gpr;
 FPR fpr;
-DBG dbg;
 };
 
+// Debug register implementation on FreeBSD is different from Linux.
+#define DR_OFFSET(reg_index) \
+(LLVM_EXTENSION offsetof(DBG, dr[reg_index]))
+
 //---
 // Include RegisterInfos_x86_64 to declare our g_register_infos_x86_64 structure.
 //---
Index: source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
===
--- source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
+++ source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
@@ -73,6 +73,10 @@
 uint64_t fault_address; // Control register CR3.
 };
 
+#define DR_OFFSET(reg_index) \
+(LLVM_EXTENSION offsetof(UserArea, dbg) + \
+ LLVM_EXTENSION offsetof(DBG, dr[reg_in

[Lldb-commits] [lldb] r233933 - Many many test failures after some recent changes. The problem is lldbtest.getPlatform() returns the "OS" of the selected platform's triple. This is "macosx" for deskto

2015-04-02 Thread Greg Clayton
Author: gclayton
Date: Thu Apr  2 13:24:03 2015
New Revision: 233933

URL: http://llvm.org/viewvc/llvm-project?rev=233933&view=rev
Log:
Many many test failures after some recent changes. The problem is 
lldbtest.getPlatform() returns the "OS" of the selected platform's triple. This 
is "macosx" for desktop macosx and "ios" for iOS. It used to be "darwin". 

There was a lot of code that was checking "if self.getPlatform() == 'darwin'" 
which is not correct. I fixed this by adding a:

lldbtest.platformIsDarwin()

which returns true if the current platform's OS is "macosx", "ios" or "darwin". 
These three valid darwin are now returned by a static function:

lldbtest.getDarwinOSTriples()

Fixed up all places that has 'if self.getPlatform() == "darwin":' with "if 
self.platformIsDarwin()" and all instances of 'if self.getPlatform() != 
"darwin":' with "if not self.platformIsDarwin()". I also fixed some darwin 
decorator functions to do the right thing as well.



Modified:
lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py
lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py
lldb/trunk/test/functionalities/inferior-crashing/TestInferiorCrashing.py

lldb/trunk/test/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferior.py
lldb/trunk/test/functionalities/inline-stepping/TestInlineStepping.py
lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py
lldb/trunk/test/functionalities/register/TestRegisters.py
lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
lldb/trunk/test/lang/c/function_types/TestFunctionTypes.py
lldb/trunk/test/lang/cpp/class_static/TestStaticVariables.py
lldb/trunk/test/lang/cpp/namespace/TestNamespace.py
lldb/trunk/test/lldbtest.py
lldb/trunk/test/python_api/event/TestEvents.py
lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py

Modified: lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py?rev=233933&r1=233932&r2=233933&view=diff
==
--- lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py 
(original)
+++ lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py Thu 
Apr  2 13:24:03 2015
@@ -24,8 +24,8 @@ class SBDirCheckerCase(TestBase):
 def test_sb_api_directory(self):
 """Test the SB API directory and make sure there's no unwanted 
stuff."""
 
-# Only proceed if this is "darwin", "x86_64", and local platform.
-if not (self.getPlatform() == "darwin" and self.getArchitecture() == 
"x86_64" and not lldb.test_remote):
+# Only proceed if this is an Apple OS, "x86_64", and local platform.
+if not (self.platformIsDarwin() and self.getArchitecture() == "x86_64" 
and not lldb.test_remote):
 self.skipTest("This test is only for LLDB.framework built 64-bit 
and !lldb.test_remote")
 if self.getArchitecture() == "i386":
 self.skipTest("LLDB is 64-bit and cannot be linked to 32-bit test 
program.")
@@ -47,7 +47,7 @@ class SBDirCheckerCase(TestBase):
 # for all the SB API headers.
 public_headers = os.listdir(public_api_dir)
 # For different platforms, the include statement can vary.
-if self.getPlatform() == "darwin":
+if self.platformIsDarwin():
 include_stmt = "'#include <%s>' % os.path.join('LLDB', header)"
 if self.getPlatform() == "freebsd" or self.getPlatform() == "linux" or 
os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
 include_stmt = "'#include <%s>' % os.path.join(public_api_dir, 
header)"

Modified: lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py?rev=233933&r1=233932&r2=233933&view=diff
==
--- lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py (original)
+++ lldb/trunk/test/functionalities/abbreviation/TestAbbreviations.py Thu Apr  
2 13:24:03 2015
@@ -174,7 +174,7 @@ class AbbreviationsTestCase(TestBase):
 self.expect("i d symt",
 patterns = ["Dumping symbol table for [0-9]+ modules."])
 
-if self.getPlatform() == "darwin":
+if self.platformIsDarwin():
 self.expect("i li",
 substrs = [ 'a.out',
 '/usr/lib/dyld',

Modified: 
lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/inferior-changed/TestInferiorChanged.py?rev=233933&r1=233932&r2=233933&view=diff

Re: [Lldb-commits] [PATCH] Ignore mapping symbols on aarch64

2015-04-02 Thread Greg Clayton
You are correct. I always use lower_bound. Code looks good then.


http://reviews.llvm.org/D8776

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Ignore mapping symbols on aarch64

2015-04-02 Thread Greg Clayton
Very nice. Just fix the bad std::map code as mentioned in the inline comment 
and we are good to go.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:899-907
@@ -910,6 +898,11 @@
+auto ub = m_address_class_map.upper_bound(file_addr);
+if (ub == m_address_class_map.begin())
+{
+// No entry in the address class map before the address. Return
+// default address class for an address in a code section.
+return eAddressClassCode;
+}
 
-// Thumb symbols have the lower bit set in the flags field so we just check
-// for that.
-if (symbol->GetFlags() & ARM_ELF_SYM_IS_THUMB)
-res = eAddressClassCodeAlternateISA;
+// Move iterator to the address class entry preceding address
+--ub;
 

You need to check if "file_addr" is equal to pos->first before you decrement. 
This code should be:


```
if (ub->first == file_addr)
return ub->second;

if (ub == m_address_class_map.begin())
{
// No entry in the address class map before the address. Return
// default address class for an address in a code section.
return eAddressClassCode;
}
--ub;
```

http://reviews.llvm.org/D8776

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] RenderScript Language Type

2015-04-02 Thread Colin Riley
Hi abidh, clayborg,

Adding the RenderScript language type. It's value is a DWARF vendor extension 
and so Ext is in the name to specify this.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8803

Files:
  include/lldb/lldb-enumerations.h
  source/Target/LanguageRuntime.cpp

Index: include/lldb/lldb-enumerations.h
===
--- include/lldb/lldb-enumerations.h
+++ include/lldb/lldb-enumerations.h
@@ -397,6 +397,8 @@
 eLanguageTypeC_plus_plus_14  = 0x0021,   ///< ISO C++:2014.
 eLanguageTypeFortran03   = 0x0022,   ///< ISO Fortran 2003.
 eLanguageTypeFortran08   = 0x0023,   ///< ISO Fortran 2008.
+// Vendor Extensions
+eLanguageTypeExtRenderScript = 0x8e57,   ///< RenderScript
 eNumLanguageTypes
 } LanguageType;
 
Index: source/Target/LanguageRuntime.cpp
===
--- source/Target/LanguageRuntime.cpp
+++ source/Target/LanguageRuntime.cpp
@@ -340,6 +340,8 @@
 {   "c++14",eLanguageTypeC_plus_plus_14 },
 {   "fortran03",eLanguageTypeFortran03  },
 {   "fortran08",eLanguageTypeFortran08  },
+// Vendor Extensions
+{   "RenderScript", eLanguageTypeExtRenderScript},
 // Now synonyms, in arbitrary order
 {   "objc", eLanguageTypeObjC   },
 {   "objc++",   eLanguageTypeObjC_plus_plus }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/lldb/lldb-enumerations.h
===
--- include/lldb/lldb-enumerations.h
+++ include/lldb/lldb-enumerations.h
@@ -397,6 +397,8 @@
 eLanguageTypeC_plus_plus_14  = 0x0021,   ///< ISO C++:2014.
 eLanguageTypeFortran03   = 0x0022,   ///< ISO Fortran 2003.
 eLanguageTypeFortran08   = 0x0023,   ///< ISO Fortran 2008.
+// Vendor Extensions
+eLanguageTypeExtRenderScript = 0x8e57,   ///< RenderScript
 eNumLanguageTypes
 } LanguageType;
 
Index: source/Target/LanguageRuntime.cpp
===
--- source/Target/LanguageRuntime.cpp
+++ source/Target/LanguageRuntime.cpp
@@ -340,6 +340,8 @@
 {   "c++14",eLanguageTypeC_plus_plus_14 },
 {   "fortran03",eLanguageTypeFortran03  },
 {   "fortran08",eLanguageTypeFortran08  },
+// Vendor Extensions
+{   "RenderScript", eLanguageTypeExtRenderScript},
 // Now synonyms, in arbitrary order
 {   "objc", eLanguageTypeObjC   },
 {   "objc++",   eLanguageTypeObjC_plus_plus }
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Fix issue where GPR and FPR registers have overlapping byte offsets.

2015-04-02 Thread Ed Maste
This causes >20 tests to segfault on FreeBSD.

The debug register implementation on FreeBSD is a bit different, see 
http://reviews.llvm.org/rL201706. I can work around it for now by moving 
`DR_OFFSET`'s definition back into RegisterContextFreeBSD_x86_64.cpp and 
RegisterContextLinux_x86_64.cpp.


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8685

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] Use objcopy provided next to the compiler on android

2015-04-02 Thread Tamas Berghammer
REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8765

Files:
  lldb/trunk/test/make/Makefile.rules

Index: lldb/trunk/test/make/Makefile.rules
===
--- lldb/trunk/test/make/Makefile.rules
+++ lldb/trunk/test/make/Makefile.rules
@@ -184,6 +184,8 @@
 $(subst cc,c++,$(1))
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_linker_notdir,$(notdir $(1,$(call cxx_linker_notdir,$(1)))
 
+OBJCOPY = objcopy
+
 #--
 # Windows specific options
 #--
@@ -202,7 +204,15 @@
 # Android specific options
 #--
 ifeq "$(OS)" "Android"
-   LDFLAGS += -pie
+objcopy_notdir = $(if $(findstring clang,$(1)), \
+  $(subst clang,objcopy,$(1)), \
+   $(if $(findstring gcc,$(1)), \
+$(subst gcc,objcopy,$(1)), \
+$(subst cc,objcopy,$(1))
+objcopy = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
objcopy_notdir,$(notdir $(1,$(call objcopy_notdir,$(1)))
+
+LDFLAGS += -pie
+OBJCOPY = $(call objcopy $(CC))
 endif
 
 #--
@@ -342,8 +352,8 @@
 endif
 else
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
-   objcopy --only-keep-debug "$(EXE)" "$(DSYM)"
-   objcopy --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
+   $(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
+   $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
 endif
 endif
 endif
@@ -392,8 +402,8 @@
 else
$(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -shared -o "$(DYLIB_FILENAME)"
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
-   objcopy --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug"
-   objcopy --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" 
"$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
+   $(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" 
"$(DYLIB_FILENAME).debug"
+   $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" 
"$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
 endif
 endif

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lldb/trunk/test/make/Makefile.rules
===
--- lldb/trunk/test/make/Makefile.rules
+++ lldb/trunk/test/make/Makefile.rules
@@ -184,6 +184,8 @@
 $(subst cc,c++,$(1))
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call cxx_linker_notdir,$(notdir $(1,$(call cxx_linker_notdir,$(1)))
 
+OBJCOPY = objcopy
+
 #--
 # Windows specific options
 #--
@@ -202,7 +204,15 @@
 # Android specific options
 #--
 ifeq "$(OS)" "Android"
-	LDFLAGS += -pie
+objcopy_notdir = $(if $(findstring clang,$(1)), \
+  $(subst clang,objcopy,$(1)), \
+   $(if $(findstring gcc,$(1)), \
+$(subst gcc,objcopy,$(1)), \
+$(subst cc,objcopy,$(1))
+objcopy = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call objcopy_notdir,$(notdir $(1,$(call objcopy_notdir,$(1)))
+
+LDFLAGS += -pie
+OBJCOPY = $(call objcopy $(CC))
 endif
 
 #--
@@ -342,8 +352,8 @@
 endif
 else
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
-	objcopy --only-keep-debug "$(EXE)" "$(DSYM)"
-	objcopy --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
+	$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
+	$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
 endif
 endif
 endif
@@ -392,8 +402,8 @@
 else
 	$(LD) $(LDFLAGS) $(DYLIB_OBJECTS) -shared -o "$(DYLIB_FILENAME)"
 ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
-	objcopy --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug"
-	objcopy --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
+	$(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug"
+	$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
 endif
 endif
 
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits