[llvm-branch-commits] [lldb] r186540 - Merge top of tree.
Greg Clayton
gclayton at apple.com
Wed Jul 17 15:19:23 PDT 2013
Modified: lldb/branches/lldb-platform-work/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/Type.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/Type.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/Type.cpp Wed Jul 17 17:17:41 2013
@@ -83,7 +83,7 @@ Type::Type
user_id_t encoding_uid,
EncodingDataType encoding_uid_type,
const Declaration& decl,
- clang_type_t clang_type,
+ const ClangASTType &clang_type,
ResolveState clang_type_resolve_state
) :
std::enable_shared_from_this<Type> (),
@@ -113,7 +113,7 @@ Type::Type () :
m_encoding_uid_type (eEncodingInvalid),
m_byte_size (0),
m_decl (),
- m_clang_type (NULL)
+ m_clang_type ()
{
m_flags.clang_type_resolve_state = eResolveStateUnresolved;
m_flags.is_complete_objc_class = false;
@@ -172,10 +172,10 @@ Type::GetDescription (Stream *s, lldb::D
bool show_fullpaths = (level == lldb::eDescriptionLevelVerbose);
m_decl.Dump(s, show_fullpaths);
- if (m_clang_type)
+ if (m_clang_type.IsValid())
{
*s << ", clang_type = \"";
- ClangASTType::DumpTypeDescription (GetClangAST(), m_clang_type, s);
+ GetClangForwardType().DumpTypeDescription(s);
*s << '"';
}
else if (m_encoding_uid != LLDB_INVALID_UID)
@@ -220,11 +220,10 @@ Type::Dump (Stream *s, bool show_context
bool show_fullpaths = false;
m_decl.Dump (s,show_fullpaths);
- if (m_clang_type)
+ if (m_clang_type.IsValid())
{
- *s << ", clang_type = " << m_clang_type << ' ';
-
- ClangASTType::DumpTypeDescription (GetClangAST(), m_clang_type, s);
+ *s << ", clang_type = " << m_clang_type.GetOpaqueQualType() << ' ';
+ GetClangForwardType().DumpTypeDescription (s);
}
else if (m_encoding_uid != LLDB_INVALID_UID)
{
@@ -254,10 +253,7 @@ const ConstString &
Type::GetName()
{
if (!m_name)
- {
- if (ResolveClangType(eResolveStateForward))
- m_name = ClangASTType::GetConstTypeName (GetClangASTContext ().getASTContext(), m_clang_type);
- }
+ m_name = GetClangForwardType().GetConstTypeName();
return m_name;
}
@@ -292,20 +288,18 @@ Type::DumpValue
s->PutCString(") ");
}
- ClangASTType::DumpValue (GetClangAST (),
- m_clang_type,
- exe_ctx,
- s,
- format == lldb::eFormatDefault ? GetFormat() : format,
- data,
- data_byte_offset,
- GetByteSize(),
- 0, // Bitfield bit size
- 0, // Bitfield bit offset
- show_types,
- show_summary,
- verbose,
- 0);
+ GetClangForwardType().DumpValue (exe_ctx,
+ s,
+ format == lldb::eFormatDefault ? GetFormat() : format,
+ data,
+ data_byte_offset,
+ GetByteSize(),
+ 0, // Bitfield bit size
+ 0, // Bitfield bit offset
+ show_types,
+ show_summary,
+ verbose,
+ 0);
}
}
@@ -339,10 +333,7 @@ Type::GetByteSize()
if (encoding_type)
m_byte_size = encoding_type->GetByteSize();
if (m_byte_size == 0)
- {
- uint32_t bit_width = ClangASTType::GetClangTypeBitWidth (GetClangAST(), GetClangLayoutType());
- m_byte_size = (bit_width + 7 ) / 8;
- }
+ m_byte_size = GetClangLayoutType().GetByteSize();
}
break;
@@ -350,7 +341,7 @@ Type::GetByteSize()
case eEncodingIsPointerUID:
case eEncodingIsLValueReferenceUID:
case eEncodingIsRValueReferenceUID:
- m_byte_size = m_symbol_file->GetClangASTContext().GetPointerBitSize() / 8;
+ m_byte_size = m_symbol_file->GetClangASTContext().GetPointerByteSize();
break;
}
}
@@ -361,21 +352,13 @@ Type::GetByteSize()
uint32_t
Type::GetNumChildren (bool omit_empty_base_classes)
{
- if (ResolveClangType(eResolveStateForward))
- {
- return ClangASTContext::GetNumChildren (m_symbol_file->GetClangASTContext().getASTContext(),
- m_clang_type,
- omit_empty_base_classes);
- }
- return 0;
+ return GetClangForwardType().GetNumChildren(omit_empty_base_classes);
}
bool
Type::IsAggregateType ()
{
- if (ResolveClangType(eResolveStateForward))
- return ClangASTContext::IsAggregateType (m_clang_type);
- return false;
+ return GetClangForwardType().IsAggregateType();
}
lldb::TypeSP
@@ -396,10 +379,7 @@ Type::GetTypedefType()
lldb::Format
Type::GetFormat ()
{
- // Make sure we resolve our type if it already hasn't been.
- if (!ResolveClangType(eResolveStateForward))
- return lldb::eFormatInvalid;
- return ClangASTType::GetFormat (m_clang_type);
+ return GetClangForwardType().GetFormat();
}
@@ -408,14 +388,9 @@ lldb::Encoding
Type::GetEncoding (uint64_t &count)
{
// Make sure we resolve our type if it already hasn't been.
- if (!ResolveClangType(eResolveStateForward))
- return lldb::eEncodingInvalid;
-
- return ClangASTType::GetEncoding (m_clang_type, count);
+ return GetClangForwardType().GetEncoding(count);
}
-
-
bool
Type::DumpValueInMemory
(
@@ -514,7 +489,7 @@ bool
Type::ResolveClangType (ResolveState clang_type_resolve_state)
{
Type *encoding_type = NULL;
- if (m_clang_type == NULL)
+ if (!m_clang_type.IsValid())
{
encoding_type = GetEncodingType();
if (encoding_type)
@@ -522,42 +497,44 @@ Type::ResolveClangType (ResolveState cla
switch (m_encoding_uid_type)
{
case eEncodingIsUID:
- if (encoding_type->ResolveClangType(clang_type_resolve_state))
{
- m_clang_type = encoding_type->m_clang_type;
- m_flags.clang_type_resolve_state = encoding_type->m_flags.clang_type_resolve_state;
+ ClangASTType encoding_clang_type = encoding_type->GetClangForwardType();
+ if (encoding_clang_type.IsValid())
+ {
+ m_clang_type = encoding_clang_type;
+ m_flags.clang_type_resolve_state = encoding_type->m_flags.clang_type_resolve_state;
+ }
}
break;
case eEncodingIsConstUID:
- m_clang_type = ClangASTContext::AddConstModifier (encoding_type->GetClangForwardType());
+ m_clang_type = encoding_type->GetClangForwardType().AddConstModifier();
break;
case eEncodingIsRestrictUID:
- m_clang_type = ClangASTContext::AddRestrictModifier (encoding_type->GetClangForwardType());
+ m_clang_type = encoding_type->GetClangForwardType().AddRestrictModifier();
break;
case eEncodingIsVolatileUID:
- m_clang_type = ClangASTContext::AddVolatileModifier (encoding_type->GetClangForwardType());
+ m_clang_type = encoding_type->GetClangForwardType().AddVolatileModifier();
break;
case eEncodingIsTypedefUID:
- m_clang_type = CreateClangTypedefType (this, encoding_type);
- // Clear the name so it can get fully qualified in case the
- // typedef is in a namespace.
+ m_clang_type = encoding_type->GetClangForwardType().CreateTypedefType (GetName().AsCString(),
+ GetSymbolFile()->GetClangDeclContextContainingTypeUID(GetID()));
m_name.Clear();
break;
case eEncodingIsPointerUID:
- m_clang_type = CreateClangPointerType (encoding_type);
+ m_clang_type = encoding_type->GetClangForwardType().GetPointerType();
break;
case eEncodingIsLValueReferenceUID:
- m_clang_type = CreateClangLValueReferenceType (encoding_type);
+ m_clang_type = encoding_type->GetClangForwardType().GetLValueReferenceType();
break;
case eEncodingIsRValueReferenceUID:
- m_clang_type = CreateClangRValueReferenceType (encoding_type);
+ m_clang_type = encoding_type->GetClangForwardType().GetRValueReferenceType();
break;
default:
@@ -568,7 +545,7 @@ Type::ResolveClangType (ResolveState cla
else
{
// We have no encoding type, return void?
- clang_type_t void_clang_type = GetClangASTContext().GetBuiltInType_void();
+ ClangASTType void_clang_type (ClangASTContext::GetBasicType(GetClangASTContext().getASTContext(), eBasicTypeVoid));
switch (m_encoding_uid_type)
{
case eEncodingIsUID:
@@ -576,31 +553,32 @@ Type::ResolveClangType (ResolveState cla
break;
case eEncodingIsConstUID:
- m_clang_type = ClangASTContext::AddConstModifier (void_clang_type);
+ m_clang_type = void_clang_type.AddConstModifier ();
break;
case eEncodingIsRestrictUID:
- m_clang_type = ClangASTContext::AddRestrictModifier (void_clang_type);
+ m_clang_type = void_clang_type.AddRestrictModifier ();
break;
case eEncodingIsVolatileUID:
- m_clang_type = ClangASTContext::AddVolatileModifier (void_clang_type);
+ m_clang_type = void_clang_type.AddVolatileModifier ();
break;
case eEncodingIsTypedefUID:
- m_clang_type = GetClangASTContext().CreateTypedefType (m_name.AsCString(), void_clang_type, NULL);
+ m_clang_type = void_clang_type.CreateTypedefType (GetName().AsCString(),
+ GetSymbolFile()->GetClangDeclContextContainingTypeUID(GetID()));
break;
case eEncodingIsPointerUID:
- m_clang_type = GetClangASTContext().CreatePointerType (void_clang_type);
+ m_clang_type = void_clang_type.GetPointerType ();
break;
case eEncodingIsLValueReferenceUID:
- m_clang_type = GetClangASTContext().CreateLValueReferenceType (void_clang_type);
+ m_clang_type = void_clang_type.GetLValueReferenceType ();
break;
case eEncodingIsRValueReferenceUID:
- m_clang_type = GetClangASTContext().CreateRValueReferenceType (void_clang_type);
+ m_clang_type = void_clang_type.GetRValueReferenceType ();
break;
default:
@@ -611,13 +589,12 @@ Type::ResolveClangType (ResolveState cla
}
// Check if we have a forward reference to a class/struct/union/enum?
- if (m_clang_type && m_flags.clang_type_resolve_state < clang_type_resolve_state)
+ if (m_clang_type.IsValid() && m_flags.clang_type_resolve_state < clang_type_resolve_state)
{
m_flags.clang_type_resolve_state = eResolveStateFull;
- if (!ClangASTType::IsDefined (m_clang_type))
+ if (!m_clang_type.IsDefined ())
{
- // We have a forward declaration, we need to resolve it to a complete
- // definition.
+ // We have a forward declaration, we need to resolve it to a complete definition.
m_symbol_file->ResolveClangOpaqueTypeDefinition (m_clang_type);
}
}
@@ -648,7 +625,7 @@ Type::ResolveClangType (ResolveState cla
encoding_type->ResolveClangType (encoding_clang_type_resolve_state);
}
}
- return m_clang_type != NULL;
+ return m_clang_type.IsValid();
}
uint32_t
Type::GetEncodingMask ()
@@ -661,33 +638,27 @@ Type::GetEncodingMask ()
return encoding_mask;
}
-clang_type_t
+ClangASTType
Type::GetClangFullType ()
{
ResolveClangType(eResolveStateFull);
return m_clang_type;
}
-clang_type_t
+ClangASTType
Type::GetClangLayoutType ()
{
ResolveClangType(eResolveStateLayout);
return m_clang_type;
}
-clang_type_t
+ClangASTType
Type::GetClangForwardType ()
{
ResolveClangType (eResolveStateForward);
return m_clang_type;
}
-clang::ASTContext *
-Type::GetClangAST ()
-{
- return GetClangASTContext().getASTContext();
-}
-
ClangASTContext &
Type::GetClangASTContext ()
{
@@ -710,6 +681,8 @@ Type::Compare(const Type &a, const Type
}
+#if 0 // START REMOVE
+// Move this into ClangASTType
void *
Type::CreateClangPointerType (Type *type)
{
@@ -739,6 +712,7 @@ Type::CreateClangRValueReferenceType (Ty
assert(type);
return GetClangASTContext().CreateRValueReferenceType (type->GetClangForwardType());
}
+#endif // END REMOVE
bool
Type::IsRealObjCClass()
@@ -747,7 +721,7 @@ Type::IsRealObjCClass()
// those don't have any information. We could extend this to only return true for "full
// definitions" if we can figure that out.
- if (ClangASTContext::IsObjCClassType(m_clang_type) && GetByteSize() != 0)
+ if (m_clang_type.IsObjCObjectOrInterfaceType() && GetByteSize() != 0)
return true;
else
return false;
@@ -756,8 +730,7 @@ Type::IsRealObjCClass()
ConstString
Type::GetQualifiedName ()
{
- ConstString qualified_name (ClangASTType::GetTypeNameForOpaqueQualType (GetClangASTContext ().getASTContext(), GetClangForwardType()).c_str());
- return qualified_name;
+ return GetClangForwardType().GetConstTypeName();
}
@@ -938,12 +911,13 @@ TypeAndOrName::HasTypeSP ()
}
TypeImpl::TypeImpl(const lldb_private::ClangASTType& clang_ast_type) :
- m_clang_ast_type(clang_ast_type.GetASTContext(), clang_ast_type.GetOpaqueQualType()),
+ m_clang_ast_type(clang_ast_type),
m_type_sp()
-{}
+{
+}
TypeImpl::TypeImpl(const lldb::TypeSP& type) :
- m_clang_ast_type(type->GetClangAST(), type->GetClangFullType()),
+ m_clang_ast_type(type->GetClangForwardType()),
m_type_sp(type)
{
}
@@ -953,7 +927,7 @@ TypeImpl::SetType (const lldb::TypeSP &t
{
if (type_sp)
{
- m_clang_ast_type.SetClangType (type_sp->GetClangAST(), type_sp->GetClangFullType());
+ m_clang_ast_type = type_sp->GetClangForwardType();
m_type_sp = type_sp;
}
else
@@ -998,9 +972,7 @@ TypeImpl::GetDescription (lldb_private::
{
if (m_clang_ast_type.IsValid())
{
- ClangASTType::DumpTypeDescription (m_clang_ast_type.GetASTContext(),
- m_clang_ast_type.GetOpaqueQualType(),
- &strm);
+ m_clang_ast_type.DumpTypeDescription (&strm);
}
else
{
@@ -1013,6 +985,6 @@ ConstString
TypeImpl::GetName ()
{
if (m_clang_ast_type.IsValid())
- return m_clang_ast_type.GetConstQualifiedTypeName();
+ return m_clang_ast_type.GetConstTypeName();
return ConstString();
}
Removed: lldb/branches/lldb-platform-work/source/Symbol/TypeHierarchyNavigator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/TypeHierarchyNavigator.cpp?rev=186539&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/TypeHierarchyNavigator.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/TypeHierarchyNavigator.cpp (removed)
@@ -1,122 +0,0 @@
-//===-- TypeHierarchyNavigator.cpp -----------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/AST/ASTContext.h"
-#include "lldb/Core/Error.h"
-#include "lldb/Core/ValueObject.h"
-#include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Symbol/TypeHierarchyNavigator.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-bool
-TypeHierarchyNavigator::LoopThrough(TypeHierarchyNavigatorCallback callback,
- void* callback_baton)
-{
- return LoopThrough(m_root_type,
- callback,
- eRootType,
- (callback_baton ? callback_baton : m_default_callback_baton));
-}
-
-bool
-TypeHierarchyNavigator::LoopThrough(const clang::QualType& qual_type,
- TypeHierarchyNavigatorCallback callback,
- RelationshipToCurrentType reason_why_here,
- void* callback_baton)
-{
- if (qual_type.isNull())
- return true;
- clang::QualType type = qual_type.getUnqualifiedType();
- type.removeLocalConst(); type.removeLocalVolatile(); type.removeLocalRestrict();
- const clang::Type* typePtr = type.getTypePtrOrNull();
- if (!typePtr)
- return true;
- if (!callback(type, reason_why_here, callback_baton))
- return false;
- // look for a "base type", whatever that means
- if (typePtr->isReferenceType())
- {
- if (LoopThrough(type.getNonReferenceType(), callback, eStrippedReference, callback_baton) == false)
- return false;
- }
- if (typePtr->isPointerType())
- {
- if (LoopThrough(typePtr->getPointeeType(), callback, eStrippedPointer, callback_baton) == false)
- return false;
- }
- if (typePtr->isObjCObjectPointerType())
- {
- /*
- for some reason, C++ can quite easily obtain the type hierarchy for a ValueObject
- even if the VO represent a pointer-to-class, as long as the typePtr is right
- Objective-C on the other hand cannot really complete an @interface when
- the VO refers to a pointer-to- at interface
- */
- Error error;
- ValueObject* target = m_value_object.Dereference(error).get();
- if (error.Fail() || !target)
- return true;
- if (LoopThrough(typePtr->getPointeeType(), callback, eStrippedPointer, callback_baton) == false)
- return false;
- }
- const clang::ObjCObjectType *objc_class_type = typePtr->getAs<clang::ObjCObjectType>();
- if (objc_class_type)
- {
- clang::ASTContext *ast = m_value_object.GetClangAST();
- if (ClangASTContext::GetCompleteType(ast, m_value_object.GetClangType()) && !objc_class_type->isObjCId())
- {
- clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
- if (class_interface_decl)
- {
- clang::ObjCInterfaceDecl *superclass_interface_decl = class_interface_decl->getSuperClass();
- if (superclass_interface_decl)
- {
- clang::QualType ivar_qual_type(ast->getObjCInterfaceType(superclass_interface_decl));
- return LoopThrough(ivar_qual_type, callback, eObjCBaseClass, callback_baton);
- }
- }
- }
- }
- // for C++ classes, navigate up the hierarchy
- if (typePtr->isRecordType())
- {
- clang::CXXRecordDecl* record = typePtr->getAsCXXRecordDecl();
- if (record)
- {
- if (!record->hasDefinition())
- ClangASTContext::GetCompleteType(m_value_object.GetClangAST(), m_value_object.GetClangType());
- if (record->hasDefinition())
- {
- clang::CXXRecordDecl::base_class_iterator pos,end;
- if ( record->getNumBases() > 0)
- {
- end = record->bases_end();
- for (pos = record->bases_begin(); pos != end; pos++)
- if (LoopThrough(pos->getType(), callback, eCXXBaseClass, callback_baton) == false)
- return false;
- }
- if (record->getNumVBases() > 0)
- {
- end = record->vbases_end();
- for (pos = record->vbases_begin(); pos != end; pos++)
- if (LoopThrough(pos->getType(), callback, eCXXVBaseClass, callback_baton) == false)
- return false;
- }
- }
- }
- }
- // try to strip typedef chains
- const clang::TypedefType* type_tdef = type->getAs<clang::TypedefType>();
- if (type_tdef)
- return LoopThrough(type_tdef->getDecl()->getUnderlyingType(), callback, eStrippedTypedef, callback_baton);
- else
- return true;
-}
Modified: lldb/branches/lldb-platform-work/source/Symbol/TypeList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/TypeList.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/TypeList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/TypeList.cpp Wed Jul 17 17:17:41 2013
@@ -259,8 +259,7 @@ TypeList::RemoveMismatchedTypes (const s
if (type_class != eTypeClassAny)
{
- match_type_class = ClangASTType::GetTypeClass (the_type->GetClangAST(),
- the_type->GetClangForwardType());
+ match_type_class = the_type->GetClangForwardType().GetTypeClass ();
if ((match_type_class & type_class) == 0)
continue;
}
@@ -349,43 +348,9 @@ TypeList::RemoveMismatchedTypes (TypeCla
for (pos = m_types.begin(); pos != end; ++pos)
{
Type* the_type = pos->second.get();
- TypeClass match_type_class = ClangASTType::GetTypeClass (the_type->GetClangAST(),
- the_type->GetClangForwardType());
+ TypeClass match_type_class = the_type->GetClangForwardType().GetTypeClass ();
if (match_type_class & type_class)
matching_types.insert (*pos);
}
m_types.swap(matching_types);
}
-
-//void *
-//TypeList::CreateClangPointerType (Type *type)
-//{
-// assert(type);
-// return m_ast.CreatePointerType(type->GetClangForwardType());
-//}
-//
-//void *
-//TypeList::CreateClangTypedefType (Type *typedef_type, Type *base_type)
-//{
-// assert(typedef_type && base_type);
-// return m_ast.CreateTypedefType (typedef_type->GetName().AsCString(),
-// base_type->GetClangForwardType(),
-// typedef_type->GetSymbolFile()->GetClangDeclContextForTypeUID(typedef_type->GetID()));
-//}
-//
-//void *
-//TypeList::CreateClangLValueReferenceType (Type *type)
-//{
-// assert(type);
-// return m_ast.CreateLValueReferenceType(type->GetClangForwardType());
-//}
-//
-//void *
-//TypeList::CreateClangRValueReferenceType (Type *type)
-//{
-// assert(type);
-// return m_ast.CreateRValueReferenceType (type->GetClangForwardType());
-//}
-//
-
-
Modified: lldb/branches/lldb-platform-work/source/Symbol/Variable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Symbol/Variable.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Symbol/Variable.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Symbol/Variable.cpp Wed Jul 17 17:17:41 2013
@@ -547,18 +547,13 @@ PrivateAutoCompleteMembers (StackFrame *
{
// We are in a type parsing child members
- const uint32_t num_bases = ClangASTContext::GetNumDirectBaseClasses(clang_type.GetASTContext(),
- clang_type.GetOpaqueQualType());
+ const uint32_t num_bases = clang_type.GetNumDirectBaseClasses();
if (num_bases > 0)
{
for (uint32_t i = 0; i < num_bases; ++i)
{
- ClangASTType base_class_type (clang_type.GetASTContext(),
- ClangASTContext::GetDirectBaseClassAtIndex (clang_type.GetASTContext(),
- clang_type.GetOpaqueQualType(),
- i,
- NULL));
+ ClangASTType base_class_type (clang_type.GetDirectBaseClassAtIndex (i, NULL));
PrivateAutoCompleteMembers (frame,
partial_member_name,
@@ -570,18 +565,13 @@ PrivateAutoCompleteMembers (StackFrame *
}
}
- const uint32_t num_vbases = ClangASTContext::GetNumVirtualBaseClasses(clang_type.GetASTContext(),
- clang_type.GetOpaqueQualType());
+ const uint32_t num_vbases = clang_type.GetNumVirtualBaseClasses();
if (num_vbases > 0)
{
for (uint32_t i = 0; i < num_vbases; ++i)
{
- ClangASTType vbase_class_type (clang_type.GetASTContext(),
- ClangASTContext::GetVirtualBaseClassAtIndex(clang_type.GetASTContext(),
- clang_type.GetOpaqueQualType(),
- i,
- NULL));
+ ClangASTType vbase_class_type (clang_type.GetVirtualBaseClassAtIndex(i,NULL));
PrivateAutoCompleteMembers (frame,
partial_member_name,
@@ -594,8 +584,7 @@ PrivateAutoCompleteMembers (StackFrame *
}
// We are in a type parsing child members
- const uint32_t num_fields = ClangASTContext::GetNumFields(clang_type.GetASTContext(),
- clang_type.GetOpaqueQualType());
+ const uint32_t num_fields = clang_type.GetNumFields();
if (num_fields > 0)
{
@@ -603,20 +592,13 @@ PrivateAutoCompleteMembers (StackFrame *
{
std::string member_name;
- lldb::clang_type_t member_type = ClangASTContext::GetFieldAtIndex (clang_type.GetASTContext(),
- clang_type.GetOpaqueQualType(),
- i,
- member_name,
- NULL,
- NULL,
- NULL);
+ ClangASTType member_clang_type = clang_type.GetFieldAtIndex (i, member_name, NULL, NULL, NULL);
if (partial_member_name.empty() ||
member_name.find(partial_member_name) == 0)
{
if (member_name == partial_member_name)
{
- ClangASTType member_clang_type (clang_type.GetASTContext(), member_type);
PrivateAutoComplete (frame,
partial_path,
prefix_path + member_name, // Anything that has been resolved already will be in here
@@ -683,7 +665,7 @@ PrivateAutoComplete (StackFrame *frame,
case eTypeClassPointer:
{
bool omit_empty_base_classes = true;
- if (ClangASTContext::GetNumChildren (clang_type.GetASTContext(), clang_type.GetPointeeType(), omit_empty_base_classes) > 0)
+ if (clang_type.GetNumChildren (omit_empty_base_classes) > 0)
matches.AppendString (prefix_path + "->");
else
{
@@ -747,7 +729,7 @@ PrivateAutoComplete (StackFrame *frame,
{
case lldb::eTypeClassPointer:
{
- ClangASTType pointee_type(clang_type.GetASTContext(), clang_type.GetPointeeType());
+ ClangASTType pointee_type(clang_type.GetPointeeType());
if (partial_path[2])
{
// If there is more after the "->", then search deeper
@@ -859,7 +841,7 @@ PrivateAutoComplete (StackFrame *frame,
Type *variable_type = variable->GetType();
if (variable_type)
{
- ClangASTType variable_clang_type (variable_type->GetClangAST(), variable_type->GetClangForwardType());
+ ClangASTType variable_clang_type (variable_type->GetClangForwardType());
PrivateAutoComplete (frame,
remaining_partial_path,
prefix_path + token, // Anything that has been resolved already will be in here
Modified: lldb/branches/lldb-platform-work/source/Target/ObjCLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ObjCLanguageRuntime.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ObjCLanguageRuntime.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ObjCLanguageRuntime.cpp Wed Jul 17 17:17:41 2013
@@ -131,7 +131,7 @@ ObjCLanguageRuntime::LookupInCompleteCla
{
TypeSP type_sp (types.GetTypeAtIndex(i));
- if (ClangASTContext::IsObjCClassType(type_sp->GetClangForwardType()))
+ if (type_sp->GetClangForwardType().IsObjCObjectOrInterfaceType())
{
if (type_sp->IsCompleteObjCClass())
{
@@ -532,7 +532,7 @@ ObjCLanguageRuntime::GetClassDescriptor
// if we get an invalid VO (which might still happen when playing around
// with pointers returned by the expression parser, don't consider this
// a valid ObjC object)
- if (valobj.GetValue().GetContextType() != Value::eContextTypeInvalid)
+ if (valobj.GetClangType().IsValid())
{
addr_t isa_pointer = valobj.GetPointerValue();
if (isa_pointer != LLDB_INVALID_ADDRESS)
Modified: lldb/branches/lldb-platform-work/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/StackFrame.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/StackFrame.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/StackFrame.cpp Wed Jul 17 17:17:41 2013
@@ -645,9 +645,9 @@ StackFrame::GetValueForVariableExpressio
{
// Make sure we aren't trying to deref an objective
// C ivar if this is not allowed
- const uint32_t pointer_type_flags = ClangASTContext::GetTypeInfo (valobj_sp->GetClangType(), NULL, NULL);
- if ((pointer_type_flags & ClangASTContext::eTypeIsObjC) &&
- (pointer_type_flags & ClangASTContext::eTypeIsPointer))
+ const uint32_t pointer_type_flags = valobj_sp->GetClangType().GetTypeInfo (NULL);
+ if ((pointer_type_flags & ClangASTType::eTypeIsObjC) &&
+ (pointer_type_flags & ClangASTType::eTypeIsPointer))
{
// This was an objective C object pointer and
// it was requested we skip any fragile ivars
@@ -759,7 +759,7 @@ StackFrame::GetValueForVariableExpressio
if (end && *end == ']'
&& *(end-1) != '[') // this code forces an error in the case of arr[]. as bitfield[] is not a good syntax we're good to go
{
- if (ClangASTContext::IsPointerToScalarType(valobj_sp->GetClangType()) && deref)
+ if (valobj_sp->GetClangType().IsPointerToScalarType() && deref)
{
// what we have is *ptr[low]. the most similar C++ syntax is to deref ptr
// and extract bit low out of it. reading array item low
@@ -777,7 +777,7 @@ StackFrame::GetValueForVariableExpressio
valobj_sp = temp;
deref = false;
}
- else if (ClangASTContext::IsArrayOfScalarType(valobj_sp->GetClangType()) && deref)
+ else if (valobj_sp->GetClangType().IsArrayOfScalarType() && deref)
{
// what we have is *arr[low]. the most similar C++ syntax is to get arr[0]
// (an operation that is equivalent to deref-ing arr)
@@ -802,9 +802,9 @@ StackFrame::GetValueForVariableExpressio
{
bool is_objc_pointer = true;
- if (ClangASTType::GetMinimumLanguage(valobj_sp->GetClangAST(), valobj_sp->GetClangType()) != eLanguageTypeObjC)
+ if (valobj_sp->GetClangType().GetMinimumLanguage() != eLanguageTypeObjC)
is_objc_pointer = false;
- else if (!ClangASTContext::IsPointerType(valobj_sp->GetClangType()))
+ else if (!valobj_sp->GetClangType().IsPointerType())
is_objc_pointer = false;
if (no_synth_child && is_objc_pointer)
@@ -861,7 +861,7 @@ StackFrame::GetValueForVariableExpressio
}
}
}
- else if (ClangASTContext::IsArrayType (valobj_sp->GetClangType(), NULL, NULL, &is_incomplete_array))
+ else if (valobj_sp->GetClangType().IsArrayType (NULL, NULL, &is_incomplete_array))
{
// Pass false to dynamic_value here so we can tell the difference between
// no dynamic value and no member of this type...
@@ -878,7 +878,7 @@ StackFrame::GetValueForVariableExpressio
var_expr_path_strm.GetString().c_str());
}
}
- else if (ClangASTContext::IsScalarType(valobj_sp->GetClangType()))
+ else if (valobj_sp->GetClangType().IsScalarType())
{
// this is a bitfield asking to display just one bit
child_valobj_sp = valobj_sp->GetSyntheticBitFieldChild(child_index, child_index, true);
@@ -961,7 +961,7 @@ StackFrame::GetValueForVariableExpressio
final_index = temp;
}
- if (ClangASTContext::IsPointerToScalarType(valobj_sp->GetClangType()) && deref)
+ if (valobj_sp->GetClangType().IsPointerToScalarType() && deref)
{
// what we have is *ptr[low-high]. the most similar C++ syntax is to deref ptr
// and extract bits low thru high out of it. reading array items low thru high
@@ -979,7 +979,7 @@ StackFrame::GetValueForVariableExpressio
valobj_sp = temp;
deref = false;
}
- else if (ClangASTContext::IsArrayOfScalarType(valobj_sp->GetClangType()) && deref)
+ else if (valobj_sp->GetClangType().IsArrayOfScalarType() && deref)
{
// what we have is *arr[low-high]. the most similar C++ syntax is to get arr[0]
// (an operation that is equivalent to deref-ing arr)
@@ -1122,7 +1122,7 @@ StackFrame::GetFrameBaseValue (Scalar &f
if (m_sc.function->GetFrameBaseExpression().IsLocationList())
loclist_base_addr = m_sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (exe_ctx.GetTargetPtr());
- if (m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx, NULL, NULL, NULL, NULL, loclist_base_addr, NULL, expr_value, &m_frame_base_error) == false)
+ if (m_sc.function->GetFrameBaseExpression().Evaluate(&exe_ctx, NULL, NULL, NULL, loclist_base_addr, NULL, expr_value, &m_frame_base_error) == false)
{
// We should really have an error if evaluate returns, but in case
// we don't, lets set the error to something at least.
@@ -1131,7 +1131,7 @@ StackFrame::GetFrameBaseValue (Scalar &f
}
else
{
- m_frame_base = expr_value.ResolveValue(&exe_ctx, NULL);
+ m_frame_base = expr_value.ResolveValue(&exe_ctx);
}
}
else
Modified: lldb/branches/lldb-platform-work/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/TargetList.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/TargetList.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/TargetList.cpp Wed Jul 17 17:17:41 2013
@@ -92,7 +92,8 @@ TargetList::CreateTarget (Debugger &debu
ModuleSpec module_spec;
module_spec.GetFileSpec().SetFile(user_exe_path, true);
lldb::offset_t file_offset = 0;
- const size_t num_specs = ObjectFile::GetModuleSpecifications (module_spec.GetFileSpec(), file_offset, module_specs);
+ lldb::offset_t file_size = 0;
+ const size_t num_specs = ObjectFile::GetModuleSpecifications (module_spec.GetFileSpec(), file_offset, file_size, module_specs);
if (num_specs > 0)
{
ModuleSpec matching_module_spec;
Modified: lldb/branches/lldb-platform-work/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/Thread.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/Thread.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/Thread.cpp Wed Jul 17 17:17:41 2013
@@ -1677,13 +1677,12 @@ Thread::ReturnFromFrame (lldb::StackFram
Type *function_type = sc.function->GetType();
if (function_type)
{
- clang_type_t return_type = sc.function->GetReturnClangType();
+ ClangASTType return_type = sc.function->GetClangType().GetFunctionReturnType();
if (return_type)
{
- ClangASTType ast_type (function_type->GetClangAST(), return_type);
StreamString s;
- ast_type.DumpTypeDescription(&s);
- ValueObjectSP cast_value_sp = return_value_sp->Cast(ast_type);
+ return_type.DumpTypeDescription(&s);
+ ValueObjectSP cast_value_sp = return_value_sp->Cast(return_type);
if (cast_value_sp)
{
cast_value_sp->SetFormat(eFormatHex);
Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOut.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOut.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOut.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanStepOut.cpp Wed Jul 17 17:17:41 2013
@@ -464,17 +464,12 @@ ThreadPlanStepOut::CalculateReturnValue
if (m_immediate_step_from_function != NULL)
{
- Type *return_type = m_immediate_step_from_function->GetType();
- lldb::clang_type_t return_clang_type = m_immediate_step_from_function->GetReturnClangType();
- if (return_type && return_clang_type)
+ ClangASTType return_clang_type = m_immediate_step_from_function->GetClangType().GetFunctionReturnType();
+ if (return_clang_type)
{
- ClangASTType ast_type (return_type->GetClangAST(), return_clang_type);
-
lldb::ABISP abi_sp = m_thread.GetProcess()->GetABI();
if (abi_sp)
- {
- m_return_valobj_sp = abi_sp->GetReturnValueObject(m_thread, ast_type);
- }
+ m_return_valobj_sp = abi_sp->GetReturnValueObject(m_thread, return_clang_type);
}
}
}
Modified: lldb/branches/lldb-platform-work/source/Target/ThreadPlanTracer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Target/ThreadPlanTracer.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Target/ThreadPlanTracer.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Target/ThreadPlanTracer.cpp Wed Jul 17 17:17:41 2013
@@ -136,8 +136,7 @@ ThreadPlanAssemblyTracer::GetIntPointerT
if (exe_module)
{
- m_intptr_type = TypeFromUser(exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, target_sp->GetArchitecture().GetAddressByteSize() * 8),
- exe_module->GetClangASTContext().getASTContext());
+ m_intptr_type = TypeFromUser(exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, target_sp->GetArchitecture().GetAddressByteSize() * 8));
}
}
}
@@ -243,7 +242,8 @@ ThreadPlanAssemblyTracer::Log ()
{
Value value;
value.SetValueType (Value::eValueTypeScalar);
- value.SetContext (Value::eContextTypeClangType, intptr_type.GetOpaqueQualType());
+// value.SetContext (Value::eContextTypeClangType, intptr_type.GetOpaqueQualType());
+ value.SetClangType (intptr_type);
value_list.PushValue (value);
}
Modified: lldb/branches/lldb-platform-work/source/lldb.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/lldb.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/lldb.cpp (original)
+++ lldb/branches/lldb-platform-work/source/lldb.cpp Wed Jul 17 17:17:41 2013
@@ -63,6 +63,10 @@
#include "Plugins/Process/mach-core/ProcessMachCore.h"
+#if defined(__linux__) or defined(__FreeBSD__)
+#include "Plugins/Process/elf-core/ProcessElfCore.h"
+#endif
+
#if defined (__linux__)
#include "Plugins/Process/Linux/ProcessLinux.h"
#endif
@@ -143,6 +147,10 @@ lldb_private::Initialize ()
#if defined (__FreeBSD__)
ProcessFreeBSD::Initialize();
#endif
+
+#if defined(__linux__) or defined(__FreeBSD__)
+ ProcessElfCore::Initialize();
+#endif
//----------------------------------------------------------------------
// Platform agnostic plugins
//----------------------------------------------------------------------
@@ -221,7 +229,10 @@ lldb_private::Terminate ()
#if defined (__FreeBSD__)
ProcessFreeBSD::Terminate();
#endif
-
+
+#if defined(__linux__) or defined(__FreeBSD__)
+ ProcessElfCore::Terminate();
+#endif
ProcessGDBRemote::Terminate();
DynamicLoaderStatic::Terminate();
Modified: lldb/branches/lldb-platform-work/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/dotest.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/dotest.py (original)
+++ lldb/branches/lldb-platform-work/test/dotest.py Wed Jul 17 17:17:41 2013
@@ -35,6 +35,22 @@ if sys.version_info >= (2, 7):
else:
argparse = __import__('argparse_compat')
+def parse_args(parser):
+ """ Returns an argument object. LLDB_TEST_ARGUMENTS environment variable can
+ be used to pass additional arguments if a compatible (>=2.7) argparse
+ library is available.
+ """
+ if sys.version_info >= (2, 7):
+ args = ArgParseNamespace()
+
+ if ('LLDB_TEST_ARGUMENTS' in os.environ):
+ print "Arguments passed through environment: '%s'" % os.environ['LLDB_TEST_ARGUMENTS']
+ args = parser.parse_args([sys.argv[0]].__add__(os.environ['LLDB_TEST_ARGUMENTS'].split()),namespace=args)
+
+ return parser.parse_args(namespace=args)
+ else:
+ return parser.parse_args()
+
def is_exe(fpath):
"""Returns true if fpath is an executable."""
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
@@ -447,14 +463,7 @@ def parseOptionsAndInitTestdirs():
group = parser.add_argument_group('Test directories')
group.add_argument('args', metavar='test-dir', nargs='*', help='Specify a list of directory names to search for test modules named after Test*.py (test discovery). If empty, search from the current working directory instead.')
- args = ArgParseNamespace()
-
- if ('LLDB_TEST_ARGUMENTS' in os.environ):
- print "Arguments passed through environment: '%s'" % os.environ['LLDB_TEST_ARGUMENTS']
- args = parser.parse_args([sys.argv[0]].__add__(os.environ['LLDB_TEST_ARGUMENTS'].split()),namespace=args)
-
- args = parser.parse_args(namespace=args)
-
+ args = parse_args(parser)
platform_system = platform.system()
platform_machine = platform.machine()
Modified: lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/Makefile?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/Makefile (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/breakpoint/breakpoint_conditions/Makefile Wed Jul 17 17:17:41 2013
@@ -1,5 +1,6 @@
LEVEL = ../../../make
C_SOURCES := main.c
+CFLAGS_EXTRAS := -std=c99
include $(LEVEL)/Makefile.rules
Modified: lldb/branches/lldb-platform-work/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py Wed Jul 17 17:17:41 2013
@@ -34,6 +34,9 @@ class Radar9974002DataFormatterTestCase(
def data_formatter_commands(self):
"""Test that that file and class static variables display correctly."""
+ if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
+ self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
+
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
Modified: lldb/branches/lldb-platform-work/test/functionalities/inline-stepping/TestInlineStepping.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/inline-stepping/TestInlineStepping.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/inline-stepping/TestInlineStepping.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/inline-stepping/TestInlineStepping.py Wed Jul 17 17:17:41 2013
@@ -18,9 +18,6 @@ class TestInlineStepping(TestBase):
self.buildDsym()
self.inline_stepping()
- @expectedFailureGcc # Some versions of GCC emit DWARF that considers functions to start at the line with the '{' whereas this test
- # expects the first line of a function to be the first line of source (i.e. what clang does). As such, this test
- # fails with some versions of GCC.
@python_api_test
@dwarf_test
def test_with_dwarf_and_python_api(self):
@@ -36,9 +33,6 @@ class TestInlineStepping(TestBase):
self.buildDsym()
self.inline_stepping_step_over()
- @expectedFailureGcc # Some versions of GCC emit DWARF that considers functions to start at the line with the '{' whereas this test
- # expects the first line of a function to be the first line of source (i.e. what clang does). As such, this test
- # fails with some versions of GCC.
@python_api_test
@dwarf_test
def test_step_over_with_dwarf_and_python_api(self):
Modified: lldb/branches/lldb-platform-work/test/functionalities/register/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/register/TestRegisters.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/register/TestRegisters.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/register/TestRegisters.py Wed Jul 17 17:17:41 2013
@@ -45,7 +45,6 @@ class RegisterCommandsTestCase(TestBase)
self.buildDefault()
self.convenience_registers()
- @skipIfLinux # llvm.org/pr16301 LLDB occasionally exits with SIGABRT
def test_convenience_registers_with_process_attach(self):
"""Test convenience registers after a 'process attach'."""
if not self.getArchitecture() in ['x86_64']:
@@ -236,14 +235,14 @@ class RegisterCommandsTestCase(TestBase)
def convenience_registers_with_process_attach(self, test_16bit_regs):
"""Test convenience registers after a 'process attach'."""
- exe = self.lldbHere
+ exe = os.path.join(os.getcwd(), "a.out")
# Spawn a new process
pid = 0
if sys.platform.startswith('linux'):
- pid = self.forkSubprocess(exe, [self.lldbOption])
+ pid = self.forkSubprocess(exe, ['wait_for_attach'])
else:
- proc = self.spawnSubprocess(exe, [self.lldbOption])
+ proc = self.spawnSubprocess(exe, ['wait_for_attach'])
pid = proc.pid
self.addTearDownHook(self.cleanupSubprocesses)
Modified: lldb/branches/lldb-platform-work/test/functionalities/register/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/register/main.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/register/main.cpp (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/register/main.cpp Wed Jul 17 17:17:41 2013
@@ -7,11 +7,21 @@
//
//===----------------------------------------------------------------------===//
#include <stdio.h>
+#include <unistd.h>
int main (int argc, char const *argv[])
{
char my_string[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 0};
double my_double = 1234.5678;
+
+ // For simplicity assume that any cmdline argument means wait for attach.
+ if (argc > 1)
+ {
+ volatile int wait_for_attach=1;
+ while (wait_for_attach)
+ usleep(1);
+ }
+
printf("my_string=%s\n", my_string);
printf("my_double=%g\n", my_double);
return 0;
Modified: lldb/branches/lldb-platform-work/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/thread/break_after_join/TestBreakAfterJoin.py Wed Jul 17 17:17:41 2013
@@ -21,7 +21,6 @@ class BreakpointAfterJoinTestCase(TestBa
self.breakpoint_after_join_test()
@expectedFailureDarwin("llvm.org/pr15824") # thread states not properly maintained
- @skipIfLinux # Causes hangs (llvm.org/pr16170) when run using "make check"
@dwarf_test
def test_with_dwarf(self):
"""Test breakpoint handling after a thread join."""
Modified: lldb/branches/lldb-platform-work/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py (original)
+++ lldb/branches/lldb-platform-work/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py Wed Jul 17 17:17:41 2013
@@ -52,7 +52,6 @@ class WatchpointForMultipleThreadsTestCa
self.source = 'main.cpp'
# Find the line number to break inside main().
self.first_stop = line_number(self.source, '// Set break point at this line')
- self.thread_function = line_number(self.source, '// Break here in order to allow the thread')
# Build dictionary to have unique executable names for each test method.
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
@@ -65,9 +64,6 @@ class WatchpointForMultipleThreadsTestCa
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
lldbutil.run_break_set_by_file_and_line (self, None, self.first_stop, num_expected_locations=1)
- # Set this breakpoint to allow newly created thread to inherit the global watchpoint state.
- lldbutil.run_break_set_by_file_and_line (self, None, self.thread_function, num_expected_locations=1)
-
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -89,18 +85,11 @@ class WatchpointForMultipleThreadsTestCa
self.expect("watchpoint list -v",
substrs = ['hit_count = 0'])
- breakpoint_stops = 0
while True:
self.runCmd("process continue")
self.runCmd("thread list")
- if "stop reason = breakpoint" in self.res.GetOutput():
- breakpoint_stops += 1
- # Since there are only three worker threads that could hit the breakpoint.
- if breakpoint_stops > 3:
- self.fail("Do not expect to break more than 3 times")
- continue
- elif "stop reason = watchpoint" in self.res.GetOutput():
+ if "stop reason = watchpoint" in self.res.GetOutput():
# Good, we verified that the watchpoint works!
self.runCmd("thread backtrace all")
break
@@ -120,9 +109,6 @@ class WatchpointForMultipleThreadsTestCa
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
lldbutil.run_break_set_by_file_and_line (self, None, self.first_stop, num_expected_locations=1)
- # Set this breakpoint to allow newly created thread to inherit the global watchpoint state.
- lldbutil.run_break_set_by_file_and_line (self, None, self.thread_function, num_expected_locations=1)
-
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -144,7 +130,6 @@ class WatchpointForMultipleThreadsTestCa
self.expect("watchpoint list -v",
substrs = ['hit_count = 0'])
- breakpoint_stops = 0
watchpoint_stops = 0
while True:
self.runCmd("process continue")
@@ -154,16 +139,7 @@ class WatchpointForMultipleThreadsTestCa
break
self.runCmd("thread list")
- if "stop reason = breakpoint" in self.res.GetOutput():
- self.runCmd("thread backtrace all")
- breakpoint_stops += 1
- if self.TraceOn():
- print "breakpoint_stops=%d...." % breakpoint_stops
- # Since there are only three worker threads that could hit the breakpoint.
- if breakpoint_stops > 3:
- self.fail("Do not expect to break more than 3 times")
- continue
- elif "stop reason = watchpoint" in self.res.GetOutput():
+ if "stop reason = watchpoint" in self.res.GetOutput():
self.runCmd("thread backtrace all")
watchpoint_stops += 1
if watchpoint_stops > 1:
Modified: lldb/branches/lldb-platform-work/test/lang/objc/blocks/TestObjCIvarsInBlocks.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lang/objc/blocks/TestObjCIvarsInBlocks.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lang/objc/blocks/TestObjCIvarsInBlocks.py (original)
+++ lldb/branches/lldb-platform-work/test/lang/objc/blocks/TestObjCIvarsInBlocks.py Wed Jul 17 17:17:41 2013
@@ -111,7 +111,9 @@ class TestObjCIvarsInBlocks(TestBase):
expr = frame.EvaluateExpression("(ret)")
self.assertTrue (expr, "Successfully got a local variable in a block in a class method.")
- self.assertTrue (expr.GetValueAsSigned (error) == 5, "The local variable in the block was what we expected.")
+ ret_value_signed = expr.GetValueAsSigned (error)
+ print 'ret_value_signed = %i' % (ret_value_signed)
+ self.assertTrue (ret_value_signed == 5, "The local variable in the block was what we expected.")
if __name__ == '__main__':
import atexit
Modified: lldb/branches/lldb-platform-work/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lldbtest.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldbtest.py (original)
+++ lldb/branches/lldb-platform-work/test/lldbtest.py Wed Jul 17 17:17:41 2013
@@ -635,6 +635,22 @@ def skipIfLinux(func):
func(*args, **kwargs)
return wrapper
+def skipIfDarwin(func):
+ """Decorate the item to skip tests that should be skipped on Darwin."""
+ if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+ raise Exception("@skipIfDarwin can only be used to decorate a test method")
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ from unittest2 import case
+ self = args[0]
+ platform = sys.platform
+ if "darwin" in platform:
+ self.skipTest("skip on darwin")
+ else:
+ func(*args, **kwargs)
+ return wrapper
+
+
def skipIfLinuxClang(func):
"""Decorate the item to skip tests that should be skipped if building on
Linux with clang.
Modified: lldb/branches/lldb-platform-work/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lldbutil.py?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldbutil.py (original)
+++ lldb/branches/lldb-platform-work/test/lldbutil.py Wed Jul 17 17:17:41 2013
@@ -181,6 +181,8 @@ def stop_reason_to_str(enum):
return "exception"
elif enum == lldb.eStopReasonPlanComplete:
return "plancomplete"
+ elif enum == lldb.eStopReasonThreadExiting:
+ return "threadexiting"
else:
raise Exception("Unknown StopReason enum")
@@ -258,6 +260,41 @@ def value_type_to_str(enum):
# ==================================================
+# Get stopped threads due to each stop reason.
+# ==================================================
+
+def sort_stopped_threads(process,
+ breakpoint_threads = None,
+ crashed_threads = None,
+ watchpoint_threads = None,
+ signal_threads = None,
+ exiting_threads = None,
+ other_threads = None):
+ """ Fills array *_threads with threads stopped for the corresponding stop
+ reason.
+ """
+ for lst in [breakpoint_threads,
+ watchpoint_threads,
+ signal_threads,
+ exiting_threads,
+ other_threads]:
+ if lst is not None:
+ lst[:] = []
+
+ for thread in process:
+ dispatched = False
+ for (reason, list) in [(lldb.eStopReasonBreakpoint, breakpoint_threads),
+ (lldb.eStopReasonException, crashed_threads),
+ (lldb.eStopReasonWatchpoint, watchpoint_threads),
+ (lldb.eStopReasonSignal, signal_threads),
+ (lldb.eStopReasonThreadExiting, exiting_threads),
+ (None, other_threads)]:
+ if not dispatched and list is not None:
+ if thread.GetStopReason() == reason or reason is None:
+ list.append(thread)
+ dispatched = True
+
+# ==================================================
# Utility functions for setting breakpoints
# ==================================================
Modified: lldb/branches/lldb-platform-work/tools/darwin-threads/examine-threads.c
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/darwin-threads/examine-threads.c?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/darwin-threads/examine-threads.c (original)
+++ lldb/branches/lldb-platform-work/tools/darwin-threads/examine-threads.c Wed Jul 17 17:17:41 2013
@@ -293,7 +293,7 @@ main (int argc, char **argv)
if (strcmp (argv[i], "-v") == 0)
verbose = 1;
if (strcmp (argv[i], "-r") == 0)
- resume_when_done = 1;
+ resume_when_done++;
i++;
}
}
@@ -470,12 +470,16 @@ main (int argc, char **argv)
nanosleep (rqtp, NULL);
} while (do_loop);
- kern_return_t err = task_resume (task);
- if (err != KERN_SUCCESS)
- printf ("Error resuming task: %d.", err);
+ while (resume_when_done > 0)
+ {
+ kern_return_t err = task_resume (task);
+ if (err != KERN_SUCCESS)
+ printf ("Error resuming task: %d.", err);
+ resume_when_done--;
+ }
- vm_deallocate (mytask, (vm_address_t) task, sizeof (task_t));
- free ((void *) process_name);
+ vm_deallocate (mytask, (vm_address_t) task, sizeof (task_t));
+ free ((void *) process_name);
return 0;
}
Modified: lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/debugserver.xcodeproj/project.pbxproj Wed Jul 17 17:17:41 2013
@@ -473,7 +473,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 300.99.0;
+ CURRENT_PROJECT_VERSION = 310.99.0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -501,7 +501,7 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CURRENT_PROJECT_VERSION = 300.99.0;
+ CURRENT_PROJECT_VERSION = 310.99.0;
DEAD_CODE_STRIPPING = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -534,7 +534,7 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CURRENT_PROJECT_VERSION = 300.99.0;
+ CURRENT_PROJECT_VERSION = 310.99.0;
DEAD_CODE_STRIPPING = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -555,7 +555,7 @@
CLANG_CXX_LIBRARY = "libc++";
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 300.99.0;
+ CURRENT_PROJECT_VERSION = 310.99.0;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -606,9 +606,9 @@
CLANG_CXX_LIBRARY = "libc++";
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
- "CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
+ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "";
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 300.99.0;
+ CURRENT_PROJECT_VERSION = 310.99.0;
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
"$(SDKROOT)/System/Library/PrivateFrameworks",
@@ -660,7 +660,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 300.99.0;
+ CURRENT_PROJECT_VERSION = 310.99.0;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -722,7 +722,7 @@
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 300.99.0;
+ CURRENT_PROJECT_VERSION = 310.99.0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -744,7 +744,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = lldb_codesign;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 300.99.0;
+ CURRENT_PROJECT_VERSION = 310.99.0;
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
"$(SDKROOT)/System/Library/PrivateFrameworks",
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/DNBArch.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/DNBArch.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/DNBArch.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/DNBArch.h Wed Jul 17 17:17:41 2013
@@ -76,10 +76,9 @@ public:
virtual uint32_t NumSupportedHardwareBreakpoints() { return 0; }
virtual uint32_t NumSupportedHardwareWatchpoints() { return 0; }
virtual uint32_t EnableHardwareBreakpoint (nub_addr_t addr, nub_size_t size) { return INVALID_NUB_HW_INDEX; }
- virtual uint32_t EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write) { return INVALID_NUB_HW_INDEX; }
- virtual void HardwareWatchpointStateChanged () { ; }
+ virtual uint32_t EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write, bool also_set_on_task) { return INVALID_NUB_HW_INDEX; }
virtual bool DisableHardwareBreakpoint (uint32_t hw_index) { return false; }
- virtual bool DisableHardwareWatchpoint (uint32_t hw_index) { return false; }
+ virtual bool DisableHardwareWatchpoint (uint32_t hw_index, bool also_set_on_task) { return false; }
virtual uint32_t GetHardwareWatchpointHit() { return INVALID_NUB_HW_INDEX; }
virtual bool StepNotComplete () { return false; }
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.cpp Wed Jul 17 17:17:41 2013
@@ -625,20 +625,13 @@ MachThread::EnableHardwareBreakpoint (co
}
uint32_t
-MachThread::EnableHardwareWatchpoint (const DNBBreakpoint *wp)
+MachThread::EnableHardwareWatchpoint (const DNBBreakpoint *wp, bool also_set_on_task)
{
if (wp != NULL && wp->IsWatchpoint())
- return m_arch_ap->EnableHardwareWatchpoint(wp->Address(), wp->ByteSize(), wp->WatchpointRead(), wp->WatchpointWrite());
+ return m_arch_ap->EnableHardwareWatchpoint(wp->Address(), wp->ByteSize(), wp->WatchpointRead(), wp->WatchpointWrite(), also_set_on_task);
return INVALID_NUB_HW_INDEX;
}
-// Provide a chance to update the global view of the hardware watchpoint state.
-void
-MachThread::HardwareWatchpointStateChanged ()
-{
- m_arch_ap->HardwareWatchpointStateChanged();
-}
-
bool
MachThread::RollbackTransForHWP()
{
@@ -660,10 +653,10 @@ MachThread::DisableHardwareBreakpoint (c
}
bool
-MachThread::DisableHardwareWatchpoint (const DNBBreakpoint *wp)
+MachThread::DisableHardwareWatchpoint (const DNBBreakpoint *wp, bool also_set_on_task)
{
if (wp != NULL && wp->IsHardware())
- return m_arch_ap->DisableHardwareWatchpoint(wp->GetHardwareIndex());
+ return m_arch_ap->DisableHardwareWatchpoint(wp->GetHardwareIndex(), also_set_on_task);
return false;
}
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThread.h Wed Jul 17 17:17:41 2013
@@ -64,9 +64,9 @@ public:
DNBBreakpoint * CurrentBreakpoint();
uint32_t EnableHardwareBreakpoint (const DNBBreakpoint *breakpoint);
- uint32_t EnableHardwareWatchpoint (const DNBBreakpoint *watchpoint);
+ uint32_t EnableHardwareWatchpoint (const DNBBreakpoint *watchpoint, bool also_set_on_task);
bool DisableHardwareBreakpoint (const DNBBreakpoint *breakpoint);
- bool DisableHardwareWatchpoint (const DNBBreakpoint *watchpoint);
+ bool DisableHardwareWatchpoint (const DNBBreakpoint *watchpoint, bool also_set_on_task);
uint32_t NumSupportedHardwareWatchpoints () const;
bool RollbackTransForHWP();
bool FinishTransForHWP();
@@ -138,7 +138,6 @@ protected:
private:
friend class MachThreadList;
- void HardwareWatchpointStateChanged(); // Provide a chance to update the global view of the hardware watchpoint state
};
typedef std::shared_ptr<MachThread> MachThreadSP;
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/MachThreadList.cpp Wed Jul 17 17:17:41 2013
@@ -528,23 +528,24 @@ MachThreadList::EnableHardwareWatchpoint
{
PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
const uint32_t num_threads = m_threads.size();
+ // On Mac OS X we have to prime the control registers for new threads. We do this
+ // using the control register data for the first thread, for lack of a better way of choosing.
+ bool also_set_on_task = true;
for (uint32_t idx = 0; idx < num_threads; ++idx)
- {
- if ((hw_index = m_threads[idx]->EnableHardwareWatchpoint(wp)) == INVALID_NUB_HW_INDEX)
+ {
+ if ((hw_index = m_threads[idx]->EnableHardwareWatchpoint(wp, also_set_on_task)) == INVALID_NUB_HW_INDEX)
{
// We know that idx failed for some reason. Let's rollback the transaction for [0, idx).
for (uint32_t i = 0; i < idx; ++i)
m_threads[i]->RollbackTransForHWP();
return INVALID_NUB_HW_INDEX;
}
+ also_set_on_task = false;
}
// Notify each thread to commit the pending transaction.
for (uint32_t idx = 0; idx < num_threads; ++idx)
m_threads[idx]->FinishTransForHWP();
- // Use an arbitrary thread to signal the completion of our transaction.
- if (num_threads)
- m_threads[0]->HardwareWatchpointStateChanged();
}
return hw_index;
}
@@ -556,23 +557,25 @@ MachThreadList::DisableHardwareWatchpoin
{
PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
const uint32_t num_threads = m_threads.size();
+
+ // On Mac OS X we have to prime the control registers for new threads. We do this
+ // using the control register data for the first thread, for lack of a better way of choosing.
+ bool also_set_on_task = true;
for (uint32_t idx = 0; idx < num_threads; ++idx)
{
- if (!m_threads[idx]->DisableHardwareWatchpoint(wp))
+ if (!m_threads[idx]->DisableHardwareWatchpoint(wp, also_set_on_task))
{
// We know that idx failed for some reason. Let's rollback the transaction for [0, idx).
for (uint32_t i = 0; i < idx; ++i)
m_threads[i]->RollbackTransForHWP();
return false;
}
+ also_set_on_task = false;
}
// Notify each thread to commit the pending transaction.
for (uint32_t idx = 0; idx < num_threads; ++idx)
m_threads[idx]->FinishTransForHWP();
- // Use an arbitrary thread to signal the completion of our transaction.
- if (num_threads)
- m_threads[0]->HardwareWatchpointStateChanged();
return true;
}
return false;
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Wed Jul 17 17:17:41 2013
@@ -118,15 +118,6 @@ DNBArchProtocol *
DNBArchMachARM::Create (MachThread *thread)
{
DNBArchMachARM *obj = new DNBArchMachARM (thread);
-
- // When new thread comes along, it tries to inherit from the global debug state, if it is valid.
- if (Valid_Global_Debug_State)
- {
- obj->m_state.dbg = Global_Debug_State;
- kern_return_t kret = obj->SetDBGState();
- DNBLogThreadedIf(LOG_WATCHPOINTS,
- "DNBArchMachARM::Create() Inherit and SetDBGState() => 0x%8.8x.", kret);
- }
return obj;
}
@@ -323,10 +314,16 @@ DNBArchMachARM::SetEXCState()
}
kern_return_t
-DNBArchMachARM::SetDBGState()
+DNBArchMachARM::SetDBGState(bool also_set_on_task)
{
int set = e_regSetDBG;
kern_return_t kret = ::thread_set_state (m_thread->MachPortNumber(), ARM_DEBUG_STATE, (thread_state_t)&m_state.dbg, ARM_DEBUG_STATE_COUNT);
+ if (also_set_on_task)
+ {
+ kern_return_t task_kret = ::task_set_state (m_thread->Process()->Task().TaskPort(), ARM_DEBUG_STATE, (thread_state_t)&m_state.dbg, ARM_DEBUG_STATE_COUNT);
+ if (task_kret != KERN_SUCCESS)
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::SetDBGState failed to set debug control register state: 0x%8.8x.", kret);
+ }
m_state.SetError(set, Write, kret); // Set the current write error for this register set
m_state.InvalidateRegisterSetState(set); // Invalidate the current register state in case registers are read back differently
return kret; // Return the error code
@@ -579,7 +576,7 @@ DNBArchMachARM::EnableHardwareSingleStep
m_state.dbg = m_dbg_save;
}
- return SetDBGState();
+ return SetDBGState(false);
}
// return 1 if bit "BIT" is set in "value"
@@ -832,7 +829,7 @@ DNBArchMachARM::EnableHardwareBreakpoint
m_state.dbg.__bcr[i]);
}
- kret = SetDBGState();
+ kret = SetDBGState(false);
DNBLogThreadedIf(LOG_BREAKPOINTS, "DNBArchMachARM::EnableHardwareBreakpoint() SetDBGState() => 0x%8.8x.", kret);
if (kret == KERN_SUCCESS)
@@ -865,7 +862,7 @@ DNBArchMachARM::DisableHardwareBreakpoin
hw_index,
m_state.dbg.__bcr[hw_index]);
- kret = SetDBGState();
+ kret = SetDBGState(false);
if (kret == KERN_SUCCESS)
return true;
@@ -879,7 +876,7 @@ DNBArchMachARM::DisableHardwareBreakpoin
static uint32_t LoHi[16] = { 0 };
uint32_t
-DNBArchMachARM::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
+DNBArchMachARM::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write, bool also_set_on_task)
{
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::EnableHardwareWatchpoint(addr = 0x%8.8llx, size = %llu, read = %u, write = %u)", (uint64_t)addr, (uint64_t)size, read, write);
@@ -942,7 +939,7 @@ DNBArchMachARM::EnableHardwareWatchpoint
return INVALID_NUB_HW_INDEX;
// Read the debug state
- kern_return_t kret = GetDBGState(false);
+ kern_return_t kret = GetDBGState(true);
if (kret == KERN_SUCCESS)
{
@@ -972,7 +969,7 @@ DNBArchMachARM::EnableHardwareWatchpoint
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::EnableHardwareWatchpoint() adding watchpoint on address 0x%llx with control register value 0x%x", (uint64_t) m_state.dbg.__wvr[i], (uint32_t) m_state.dbg.__wcr[i]);
- kret = SetDBGState();
+ kret = SetDBGState(also_set_on_task);
//DumpDBGState(m_state.dbg);
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::EnableHardwareWatchpoint() SetDBGState() => 0x%8.8x.", kret);
@@ -1013,7 +1010,7 @@ DNBArchMachARM::EnableHardwareWatchpoint
hw_index,
m_state.dbg.__wcr[hw_index]);
- kret = SetDBGState();
+ kret = SetDBGState(false);
return (kret == KERN_SUCCESS);
}
@@ -1053,20 +1050,6 @@ DNBArchMachARM::DisableHardwareWatchpoin
return (kret == KERN_SUCCESS);
}
-// {0} -> __bvr[16], {0} -> __bcr[16], {0} --> __wvr[16], {0} -> __wcr{16}
-DNBArchMachARM::DBG DNBArchMachARM::Global_Debug_State = {{0},{0},{0},{0}};
-bool DNBArchMachARM::Valid_Global_Debug_State = false;
-
-// Use this callback from MachThread, which in turn was called from MachThreadList, to update
-// the global view of the hardware watchpoint state, so that when new thread comes along, they
-// get to inherit the existing hardware watchpoint state.
-void
-DNBArchMachARM::HardwareWatchpointStateChanged ()
-{
- Global_Debug_State = m_state.dbg;
- Valid_Global_Debug_State = true;
-}
-
// Returns -1 if the trailing bit patterns are not one of:
// { 0b???1, 0b??10, 0b?100, 0b1000 }.
static inline
@@ -1753,11 +1736,11 @@ DNBArchMachARM::SetRegisterState(int set
case e_regSetALL: return SetGPRState() |
SetVFPState() |
SetEXCState() |
- SetDBGState();
+ SetDBGState(false);
case e_regSetGPR: return SetGPRState();
case e_regSetVFP: return SetVFPState();
case e_regSetEXC: return SetEXCState();
- case e_regSetDBG: return SetDBGState();
+ case e_regSetDBG: return SetDBGState(false);
default: break;
}
return KERN_INVALID_ARGUMENT;
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h Wed Jul 17 17:17:41 2013
@@ -71,13 +71,12 @@ public:
virtual uint32_t NumSupportedHardwareBreakpoints();
virtual uint32_t NumSupportedHardwareWatchpoints();
virtual uint32_t EnableHardwareBreakpoint (nub_addr_t addr, nub_size_t size);
- virtual uint32_t EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write);
+ virtual uint32_t EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write, bool also_set_on_task);
virtual bool DisableHardwareBreakpoint (uint32_t hw_break_index);
- virtual bool DisableHardwareWatchpoint (uint32_t hw_break_index);
+ virtual bool DisableHardwareWatchpoint (uint32_t hw_break_index, bool also_set_on_task);
virtual bool EnableHardwareWatchpoint0 (uint32_t hw_break_index, bool Delegate);
virtual bool DisableHardwareWatchpoint0 (uint32_t hw_break_index, bool Delegate);
virtual bool StepNotComplete ();
- virtual void HardwareWatchpointStateChanged ();
virtual uint32_t GetHardwareWatchpointHit(nub_addr_t &addr);
typedef arm_debug_state_t DBG;
@@ -135,10 +134,6 @@ protected:
EXC exc;
};
- // See also HardwareWatchpointStateChanged() which updates this class-wide variable.
- static DBG Global_Debug_State;
- static bool Valid_Global_Debug_State;
-
struct State
{
Context context;
@@ -230,7 +225,7 @@ protected:
kern_return_t SetGPRState ();
kern_return_t SetVFPState ();
kern_return_t SetEXCState ();
- kern_return_t SetDBGState ();
+ kern_return_t SetDBGState (bool also_set_on_task);
// Helper functions for watchpoint implementaions.
static void ClearWatchpointOccurred();
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Wed Jul 17 17:17:41 2013
@@ -556,9 +556,16 @@ DNBArchImplI386::GetDBGState(bool force)
}
kern_return_t
-DNBArchImplI386::SetDBGState()
+DNBArchImplI386::SetDBGState(bool also_set_on_task)
{
m_state.SetError(e_regSetDBG, Write, ::thread_set_state(m_thread->MachPortNumber(), __i386_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, e_regSetWordSizeDBG));
+ if (also_set_on_task)
+ {
+ kern_return_t kret = ::task_set_state(m_thread->Process()->Task().TaskPort(), __i386_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, e_regSetWordSizeDBG);
+ if (kret != KERN_SUCCESS)
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::SetDBGState failed to set debug control register state: 0x%8.8x.", kret);
+
+ }
return m_state.GetError(e_regSetDBG, Write);
}
@@ -588,7 +595,7 @@ DNBArchImplI386::ThreadWillResume()
if (need_reset)
{
ClearWatchpointHits(debug_state);
- kret = SetDBGState();
+ kret = SetDBGState(false);
DNBLogThreadedIf(LOG_WATCHPOINTS,"DNBArchImplI386::ThreadWillResume() SetDBGState() => 0x%8.8x.", kret);
}
}
@@ -854,7 +861,7 @@ DNBArchImplI386::RollbackTransForHWP()
if (m_2pc_trans_state != Trans_Pending)
DNBLogError ("%s inconsistent state detected, expected %d, got: %d", __FUNCTION__, Trans_Pending, m_2pc_trans_state);
m_2pc_trans_state = Trans_Rolled_Back;
- kern_return_t kret = SetDBGState();
+ kern_return_t kret = SetDBGState(false);
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::RollbackTransForHWP() SetDBGState() => 0x%8.8x.", kret);
if (kret == KERN_SUCCESS)
@@ -875,7 +882,7 @@ DNBArchImplI386::GetDBGCheckpoint()
}
uint32_t
-DNBArchImplI386::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
+DNBArchImplI386::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write, bool also_set_on_task)
{
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::EnableHardwareWatchpoint(addr = 0x%llx, size = %llu, read = %u, write = %u)", (uint64_t)addr, (uint64_t)size, read, write);
@@ -912,7 +919,7 @@ DNBArchImplI386::EnableHardwareWatchpoin
// Modify our local copy of the debug state, first.
SetWatchpoint(debug_state, i, addr, size, read, write);
// Now set the watch point in the inferior.
- kret = SetDBGState();
+ kret = SetDBGState(also_set_on_task);
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::EnableHardwareWatchpoint() SetDBGState() => 0x%8.8x.", kret);
if (kret == KERN_SUCCESS)
@@ -929,7 +936,7 @@ DNBArchImplI386::EnableHardwareWatchpoin
}
bool
-DNBArchImplI386::DisableHardwareWatchpoint (uint32_t hw_index)
+DNBArchImplI386::DisableHardwareWatchpoint (uint32_t hw_index, bool also_set_on_task)
{
kern_return_t kret = GetDBGState(false);
@@ -944,7 +951,7 @@ DNBArchImplI386::DisableHardwareWatchpoi
// Modify our local copy of the debug state, first.
ClearWatchpoint(debug_state, hw_index);
// Now disable the watch point in the inferior.
- kret = SetDBGState();
+ kret = SetDBGState(also_set_on_task);
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplI386::DisableHardwareWatchpoint( %u )",
hw_index);
@@ -957,19 +964,6 @@ DNBArchImplI386::DisableHardwareWatchpoi
return false;
}
-DNBArchImplI386::DBG DNBArchImplI386::Global_Debug_State = {0,0,0,0,0,0,0,0};
-bool DNBArchImplI386::Valid_Global_Debug_State = false;
-
-// Use this callback from MachThread, which in turn was called from MachThreadList, to update
-// the global view of the hardware watchpoint state, so that when new thread comes along, they
-// get to inherit the existing hardware watchpoint state.
-void
-DNBArchImplI386::HardwareWatchpointStateChanged ()
-{
- Global_Debug_State = m_state.context.dbg;
- Valid_Global_Debug_State = true;
-}
-
// Iterate through the debug status register; return the index of the first hit.
uint32_t
DNBArchImplI386::GetHardwareWatchpointHit(nub_addr_t &addr)
@@ -1228,15 +1222,6 @@ DNBArchProtocol *
DNBArchImplI386::Create (MachThread *thread)
{
DNBArchImplI386 *obj = new DNBArchImplI386 (thread);
-
- // When new thread comes along, it tries to inherit from the global debug state, if it is valid.
- if (Valid_Global_Debug_State)
- {
- obj->m_state.context.dbg = Global_Debug_State;
- kern_return_t kret = obj->SetDBGState();
- DNBLogThreadedIf(LOG_WATCHPOINTS,
- "DNBArchImplX86_64::Create() Inherit and SetDBGState() => 0x%8.8x.", kret);
- }
return obj;
}
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h Wed Jul 17 17:17:41 2013
@@ -54,9 +54,8 @@ public:
virtual bool NotifyException(MachException::Data& exc);
virtual uint32_t NumSupportedHardwareWatchpoints();
- virtual uint32_t EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write);
- virtual bool DisableHardwareWatchpoint (uint32_t hw_break_index);
- virtual void HardwareWatchpointStateChanged ();
+ virtual uint32_t EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write, bool also_set_on_task);
+ virtual bool DisableHardwareWatchpoint (uint32_t hw_break_index, bool also_set_on_task);
virtual uint32_t GetHardwareWatchpointHit(nub_addr_t &addr);
protected:
@@ -119,10 +118,6 @@ protected:
DBG dbg;
};
- // See also HardwareWatchpointStateChanged() which updates this class-wide variable.
- static DBG Global_Debug_State;
- static bool Valid_Global_Debug_State;
-
struct State
{
Context context;
@@ -214,7 +209,7 @@ protected:
kern_return_t SetGPRState ();
kern_return_t SetFPUState ();
kern_return_t SetEXCState ();
- kern_return_t SetDBGState ();
+ kern_return_t SetDBGState (bool also_set_on_task);
static DNBArchProtocol *
Create (MachThread *thread);
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Wed Jul 17 17:17:41 2013
@@ -511,9 +511,15 @@ DNBArchImplX86_64::GetDBGState(bool forc
}
kern_return_t
-DNBArchImplX86_64::SetDBGState()
+DNBArchImplX86_64::SetDBGState(bool also_set_on_task)
{
m_state.SetError(e_regSetDBG, Write, ::thread_set_state(m_thread->MachPortNumber(), __x86_64_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, e_regSetWordSizeDBG));
+ if (also_set_on_task)
+ {
+ kern_return_t kret = ::task_set_state(m_thread->Process()->Task().TaskPort(), __x86_64_DEBUG_STATE, (thread_state_t)&m_state.context.dbg, e_regSetWordSizeDBG);
+ if (kret != KERN_SUCCESS)
+ DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::SetDBGState failed to set debug control register state: 0x%8.8x.", kret);
+ }
return m_state.GetError(e_regSetDBG, Write);
}
@@ -543,7 +549,7 @@ DNBArchImplX86_64::ThreadWillResume()
if (need_reset)
{
ClearWatchpointHits(debug_state);
- kret = SetDBGState();
+ kret = SetDBGState(false);
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::ThreadWillResume() SetDBGState() => 0x%8.8x.", kret);
}
}
@@ -808,7 +814,7 @@ DNBArchImplX86_64::RollbackTransForHWP()
if (m_2pc_trans_state != Trans_Pending)
DNBLogError ("%s inconsistent state detected, expected %d, got: %d", __FUNCTION__, Trans_Pending, m_2pc_trans_state);
m_2pc_trans_state = Trans_Rolled_Back;
- kern_return_t kret = SetDBGState();
+ kern_return_t kret = SetDBGState(false);
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::RollbackTransForHWP() SetDBGState() => 0x%8.8x.", kret);
if (kret == KERN_SUCCESS)
@@ -829,7 +835,7 @@ DNBArchImplX86_64::GetDBGCheckpoint()
}
uint32_t
-DNBArchImplX86_64::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write)
+DNBArchImplX86_64::EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write, bool also_set_on_task)
{
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::EnableHardwareWatchpoint(addr = 0x%llx, size = %llu, read = %u, write = %u)", (uint64_t)addr, (uint64_t)size, read, write);
@@ -866,7 +872,7 @@ DNBArchImplX86_64::EnableHardwareWatchpo
// Modify our local copy of the debug state, first.
SetWatchpoint(debug_state, i, addr, size, read, write);
// Now set the watch point in the inferior.
- kret = SetDBGState();
+ kret = SetDBGState(also_set_on_task);
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::EnableHardwareWatchpoint() SetDBGState() => 0x%8.8x.", kret);
if (kret == KERN_SUCCESS)
@@ -883,7 +889,7 @@ DNBArchImplX86_64::EnableHardwareWatchpo
}
bool
-DNBArchImplX86_64::DisableHardwareWatchpoint (uint32_t hw_index)
+DNBArchImplX86_64::DisableHardwareWatchpoint (uint32_t hw_index, bool also_set_on_task)
{
kern_return_t kret = GetDBGState(false);
@@ -898,7 +904,7 @@ DNBArchImplX86_64::DisableHardwareWatchp
// Modify our local copy of the debug state, first.
ClearWatchpoint(debug_state, hw_index);
// Now disable the watch point in the inferior.
- kret = SetDBGState();
+ kret = SetDBGState(also_set_on_task);
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchImplX86_64::DisableHardwareWatchpoint( %u )",
hw_index);
@@ -911,19 +917,6 @@ DNBArchImplX86_64::DisableHardwareWatchp
return false;
}
-DNBArchImplX86_64::DBG DNBArchImplX86_64::Global_Debug_State = {0,0,0,0,0,0,0,0};
-bool DNBArchImplX86_64::Valid_Global_Debug_State = false;
-
-// Use this callback from MachThread, which in turn was called from MachThreadList, to update
-// the global view of the hardware watchpoint state, so that when new thread comes along, they
-// get to inherit the existing hardware watchpoint state.
-void
-DNBArchImplX86_64::HardwareWatchpointStateChanged ()
-{
- Global_Debug_State = m_state.context.dbg;
- Valid_Global_Debug_State = true;
-}
-
// Iterate through the debug status register; return the index of the first hit.
uint32_t
DNBArchImplX86_64::GetHardwareWatchpointHit(nub_addr_t &addr)
@@ -1556,15 +1549,6 @@ DNBArchProtocol *
DNBArchImplX86_64::Create (MachThread *thread)
{
DNBArchImplX86_64 *obj = new DNBArchImplX86_64 (thread);
-
- // When new thread comes along, it tries to inherit from the global debug state, if it is valid.
- if (Valid_Global_Debug_State)
- {
- obj->m_state.context.dbg = Global_Debug_State;
- kern_return_t kret = obj->SetDBGState();
- DNBLogThreadedIf(LOG_WATCHPOINTS,
- "DNBArchImplX86_64::Create() Inherit and SetDBGState() => 0x%8.8x.", kret);
- }
return obj;
}
Modified: lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h (original)
+++ lldb/branches/lldb-platform-work/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h Wed Jul 17 17:17:41 2013
@@ -53,9 +53,8 @@ public:
virtual bool NotifyException(MachException::Data& exc);
virtual uint32_t NumSupportedHardwareWatchpoints();
- virtual uint32_t EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write);
- virtual bool DisableHardwareWatchpoint (uint32_t hw_break_index);
- virtual void HardwareWatchpointStateChanged ();
+ virtual uint32_t EnableHardwareWatchpoint (nub_addr_t addr, nub_size_t size, bool read, bool write, bool also_set_on_task);
+ virtual bool DisableHardwareWatchpoint (uint32_t hw_break_index, bool also_set_on_task);
virtual uint32_t GetHardwareWatchpointHit(nub_addr_t &addr);
protected:
@@ -118,10 +117,6 @@ protected:
DBG dbg;
};
- // See also HardwareWatchpointStateChanged() which updates this class-wide variable.
- static DBG Global_Debug_State;
- static bool Valid_Global_Debug_State;
-
struct State
{
Context context;
@@ -221,7 +216,7 @@ protected:
kern_return_t SetGPRState ();
kern_return_t SetFPUState ();
kern_return_t SetEXCState ();
- kern_return_t SetDBGState ();
+ kern_return_t SetDBGState (bool also_set_on_task);
static DNBArchProtocol *
Create (MachThread *thread);
Modified: lldb/branches/lldb-platform-work/www/formats.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/www/formats.html?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/www/formats.html (original)
+++ lldb/branches/lldb-platform-work/www/formats.html Wed Jul 17 17:17:41 2013
@@ -19,7 +19,7 @@
<div class="post">
<h1 class ="postheader">Stack Frame and Thread Format</h1>
<div class="postcontent">
- <p>LLDB was recently modified to allow users to define the
+ <p>LLDB has a facility to allow users to define the
format of the information that generates the descriptions
for threads and stack frames. Typically when your program stops
at a breakpoint you will get a line that describes why
@@ -100,6 +100,10 @@
<tr valign=top><td><b>thread.stop-reason</b></td><td>A textual reason each thread stopped</td></tr>
<tr valign=top><td><b>thread.return-value</b></td><td>The return value of the latest step operation (currently only for step-out.)</td></tr>
<tr valign=top><td><b>target.arch</b></td><td>The architecture of the current target</td></tr>
+ <tr valign=top><td><b>target.script:<i>python_func</i></b></td><td>Use a Python function to generate a piece of textual output</td></tr>
+ <tr valign=top><td><b>process.script:<i>python_func</i></b></td><td>Use a Python function to generate a piece of textual output</td></tr>
+ <tr valign=top><td><b>thread.script:<i>python_func</i></b></td><td>Use a Python function to generate a piece of textual output</td></tr>
+ <tr valign=top><td><b>frame.script:<i>python_func</i></b></td><td>Use a Python function to generate a piece of textual output</td></tr>
</table>
</div>
@@ -247,6 +251,23 @@
that when the thread information is displayed in a context where
we only want to show thread information, we can do so.
+ <p>For both thread and frame formats, you can use ${target.script:<i>python_func</i>}, ${process.script:<i>python_func</i>} and ${thread.script:<i>python_func</i>}
+ (and of course ${frame.script:<i>python_func</i>} for frame formats)<br/>
+ In all cases, the signature of <i>python_func</i> is expected to be:<br/>
+ <p><code>
+ def <i>python_func</i>(<i>object</i>,unused):<br/>
+ ...<br/>
+ return <i>string</i><br/></code>
+ <p>Where <i>object</i> is an instance of the SB class associated to the keyword you are using.
+
+ <p>e.g. Assuming your function looks like<br/><code><p>
+ def thread_printer_func (thread,unused):<br/>
+ return "Thread %s has %d frames\n" % (thread.name, thread.num_frames)<br/></code><p>
+
+ And you set it up with <code><br/><b>(lldb)</b> settings set thread-format "${thread.script:thread_printer_func}"<br/></code>
+ you would see output like:
+ </p>
+ <code>* Thread main has 21 frames</code>
</div>
<div class="postfooter"></div>
</div>
Modified: lldb/branches/lldb-platform-work/www/python-reference.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/www/python-reference.html?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/www/python-reference.html (original)
+++ lldb/branches/lldb-platform-work/www/python-reference.html Wed Jul 17 17:17:41 2013
@@ -437,7 +437,7 @@ import optparse
import shlex
def ls(debugger, command, result, internal_dict):
- result.PutCString(commands.getoutput('/bin/ls %s' % command))
+ print >>result, (commands.getoutput('/bin/ls %s' % command))
<font color=green># And the initialization code to add your commands </font>
def __lldb_init_module(debugger, internal_dict):
Modified: lldb/branches/lldb-platform-work/www/troubleshooting.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/www/troubleshooting.html?rev=186540&r1=186539&r2=186540&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/www/troubleshooting.html (original)
+++ lldb/branches/lldb-platform-work/www/troubleshooting.html Wed Jul 17 17:17:41 2013
@@ -45,11 +45,11 @@
the header files paths.
</p>
<p> If you set a file and line breakpoint using a full path to the source file, like Xcode does when setting a
- breakpoint in its GUI on MacOSX when you click in the gutter of the source view, this path must match
+ breakpoint in its GUI on Mac OS X when you click in the gutter of the source view, this path must match
the full paths in the debug information. If the paths mismatch, possibly due to
passing in a resolved source file path that doesn't match an unresolved path in the debug
information, this can cause breakpoints to not be resolved. Try setting breakpoints using the file
- basaname only.
+ basename only.
<p> If you are using an IDE and you move your project in your file system and build again, sometimes doing a
clean then build will solve the issue.This will fix the issue if some .o files didn't get rebuilt
after the move as the .o files in the build folder might still contain stale debug information with
@@ -86,4 +86,4 @@
</div>
</div>
</body>
-</html>
\ No newline at end of file
+</html>
More information about the llvm-branch-commits
mailing list