From gclayton at apple.com Mon Dec 5 00:07:35 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 05 Dec 2011 06:07:35 -0000
Subject: [Lldb-commits] [lldb] r145799 - in
/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime:
AppleObjCRuntimeV2.cpp AppleObjCRuntimeV2.h
Message-ID: <20111205060735.7E2431BE003@llvm.org>
Author: gclayton
Date: Mon Dec 5 00:07:35 2011
New Revision: 145799
URL: http://llvm.org/viewvc/llvm-project?rev=145799&view=rev
Log:
Fixed the remaining test suite failures after the recent objective C cleanup
and fixes we did. Now that objective C classes are represented by symbols with
their own type, there were a few more places in the objective C code that needed
to be fixed when searching for dynamic types.
Cleaned up the objective C runtime plug-in a bit to not keep having to create
constant strings and make one less memory access when we find an "isa" in the
objective C cache.
Modified:
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=145799&r1=145798&r2=145799&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Mon Dec 5 00:07:35 2011
@@ -88,9 +88,6 @@
} \n\
";
-const char *AppleObjCRuntimeV2::g_objc_class_symbol_prefix = "OBJC_CLASS_$_";
-const char *AppleObjCRuntimeV2::g_objc_class_data_section_name = "__objc_data";
-
AppleObjCRuntimeV2::AppleObjCRuntimeV2 (Process *process,
const ModuleSP &objc_module_sp) :
AppleObjCRuntime (process),
@@ -99,11 +96,12 @@
m_isa_to_name_cache(),
m_isa_to_parent_cache()
{
- m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(ConstString("gdb_object_getClass"), eSymbolTypeCode) != NULL);
+ static const ConstString g_gdb_object_getClass("gdb_object_getClass");
+ m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_object_getClass, eSymbolTypeCode) != NULL);
}
bool
-AppleObjCRuntimeV2::RunFunctionToFindClassName(lldb::addr_t object_addr, Thread *thread, char *name_dst, size_t max_name_len)
+AppleObjCRuntimeV2::RunFunctionToFindClassName(addr_t object_addr, Thread *thread, char *name_dst, size_t max_name_len)
{
// Since we are going to run code we have to make sure only one thread at a time gets to try this.
Mutex::Locker (m_get_class_name_args_mutex);
@@ -123,7 +121,7 @@
Value void_ptr_value;
ClangASTContext *clang_ast_context = m_process->GetTarget().GetScratchClangASTContext();
- lldb::clang_type_t clang_void_ptr_type = clang_ast_context->GetVoidPtrType(false);
+ clang_type_t clang_void_ptr_type = clang_ast_context->GetVoidPtrType(false);
void_ptr_value.SetValueType (Value::eValueTypeScalar);
void_ptr_value.SetContext (Value::eContextTypeClangType, clang_void_ptr_type);
void_ptr_value.GetScalar() = object_addr;
@@ -131,7 +129,7 @@
dispatch_values.PushValue (void_ptr_value);
Value int_value;
- lldb::clang_type_t clang_int_type = clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(lldb::eEncodingSint, 32);
+ clang_type_t clang_int_type = clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 32);
int_value.SetValueType (Value::eValueTypeScalar);
int_value.SetContext (Value::eContextTypeClangType, clang_int_type);
int_value.GetScalar() = debug;
@@ -221,7 +219,7 @@
return false;
}
- lldb::addr_t result_ptr = void_ptr_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+ addr_t result_ptr = void_ptr_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
size_t chars_read = m_process->ReadCStringFromMemory (result_ptr, name_dst, max_name_len);
// If we exhausted our buffer before finding a NULL we're probably off in the weeds somewhere...
@@ -234,7 +232,7 @@
bool
AppleObjCRuntimeV2::GetDynamicTypeAndAddress (ValueObject &in_value,
- lldb::DynamicValueType use_dynamic,
+ DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name,
Address &address)
{
@@ -245,53 +243,18 @@
if (CouldHaveDynamicValue (in_value))
{
// First job, pull out the address at 0 offset from the object That will be the ISA pointer.
- AddressType address_type;
- lldb::addr_t original_ptr = in_value.GetPointerValue(&address_type);
-
- // ObjC only has single inheritance, so the objects all start at the same pointer value.
- address.SetSection (NULL);
- address.SetOffset (original_ptr);
+ Error error;
+ const addr_t object_ptr = in_value.GetPointerValue();
+ const addr_t isa_addr = m_process->ReadPointerFromMemory (object_ptr, error);
- if (original_ptr == LLDB_INVALID_ADDRESS)
+ if (error.Fail())
return false;
-
- Target *target = m_process->CalculateTarget();
- char memory_buffer[16];
- DataExtractor data (memory_buffer,
- sizeof(memory_buffer),
- m_process->GetByteOrder(),
- m_process->GetAddressByteSize());
+ address.SetSection (NULL);
+ address.SetOffset(object_ptr);
- size_t address_byte_size = m_process->GetAddressByteSize();
- Error error;
- size_t bytes_read = m_process->ReadMemory (original_ptr,
- memory_buffer,
- address_byte_size,
- error);
- if (!error.Success() || (bytes_read != address_byte_size))
- {
- return false;
- }
-
- uint32_t offset = 0;
- lldb::addr_t isa_addr = data.GetAddress (&offset);
-
- if (offset == 0)
- return false;
-
- // Make sure the class address is readable, otherwise this is not a good object:
- bytes_read = m_process->ReadMemory (isa_addr,
- memory_buffer,
- address_byte_size,
- error);
- if (bytes_read != address_byte_size)
- return false;
-
// First check the cache...
-
SymbolContext sc;
-
class_type_or_name = LookupInClassNameCache (isa_addr);
if (!class_type_or_name.IsEmpty())
@@ -302,9 +265,17 @@
return false;
}
+ // We don't have the object cached, so make sure the class
+ // address is readable, otherwise this is not a good object:
+ m_process->ReadPointerFromMemory (isa_addr, error);
+
+ if (error.Fail())
+ return false;
+
const char *class_name = NULL;
Address isa_address;
- target->GetSectionLoadList().ResolveLoadAddress (isa_addr, isa_address);
+ Target &target = m_process->GetTarget();
+ target.GetSectionLoadList().ResolveLoadAddress (isa_addr, isa_address);
if (isa_address.IsValid())
{
@@ -319,14 +290,14 @@
// some static class or nothing. See if it is in the right section
// and if its name is the right form.
ConstString section_name = section->GetName();
- if (section_name == ConstString(g_objc_class_data_section_name))
+ static ConstString g_objc_class_section_name ("__objc_data");
+ if (section_name == g_objc_class_section_name)
{
isa_address.CalculateSymbolContext(&sc);
if (sc.symbol)
{
- class_name = sc.symbol->GetName().AsCString();
- if (strstr (class_name, g_objc_class_symbol_prefix) == class_name)
- class_name += strlen (g_objc_class_symbol_prefix);
+ if (sc.symbol->GetType() == eSymbolTypeObjCClass)
+ class_name = sc.symbol->GetName().GetCString();
else
return false;
}
@@ -335,7 +306,7 @@
}
char class_buffer[1024];
- if (class_name == NULL && use_dynamic != lldb::eDynamicDontRunTarget)
+ if (class_name == NULL && use_dynamic != eDynamicDontRunTarget)
{
// If the class address didn't point into the binary, or
// it points into the right section but there wasn't a symbol
@@ -351,23 +322,23 @@
if (thread_to_use == NULL)
return false;
- if (!RunFunctionToFindClassName (original_ptr, thread_to_use, class_buffer, 1024))
+ if (!RunFunctionToFindClassName (object_ptr, thread_to_use, class_buffer, 1024))
return false;
class_name = class_buffer;
}
- if (class_name != NULL && *class_name != '\0')
+ if (class_name && class_name[0])
{
class_type_or_name.SetName (class_name);
TypeList class_types;
- uint32_t num_matches = target->GetImages().FindTypes (sc,
- class_type_or_name.GetName(),
- true,
- UINT32_MAX,
- class_types);
+ uint32_t num_matches = target.GetImages().FindTypes (sc,
+ class_type_or_name.GetName(),
+ true,
+ UINT32_MAX,
+ class_types);
if (num_matches == 1)
{
class_type_or_name.SetTypeSP (class_types.GetTypeAtIndex(0));
@@ -377,7 +348,7 @@
{
for (size_t i = 0; i < num_matches; i++)
{
- lldb::TypeSP this_type(class_types.GetTypeAtIndex(i));
+ TypeSP this_type(class_types.GetTypeAtIndex(i));
if (this_type)
{
if (ClangASTContext::IsObjCClassType(this_type->GetClangFullType()))
@@ -419,7 +390,7 @@
// Static Functions
//------------------------------------------------------------------
LanguageRuntime *
-AppleObjCRuntimeV2::CreateInstance (Process *process, lldb::LanguageType language)
+AppleObjCRuntimeV2::CreateInstance (Process *process, LanguageType language)
{
// FIXME: This should be a MacOS or iOS process, and we need to look for the OBJC section to make
// sure we aren't using the V1 runtime.
@@ -565,9 +536,9 @@
ConstString ivar_const_str (buffer.c_str());
SymbolContextList sc_list;
- Target *target = &(m_process->GetTarget());
+ Target &target = m_process->GetTarget();
- target->GetImages().FindSymbolsWithNameAndType(ivar_const_str, eSymbolTypeRuntime, sc_list);
+ target.GetImages().FindSymbolsWithNameAndType(ivar_const_str, eSymbolTypeRuntime, sc_list);
SymbolContext ivar_offset_symbol;
if (sc_list.GetSize() != 1
@@ -575,7 +546,7 @@
|| ivar_offset_symbol.symbol == NULL)
return LLDB_INVALID_IVAR_OFFSET;
- lldb::addr_t ivar_offset_address = ivar_offset_symbol.symbol->GetValue().GetLoadAddress(target);
+ addr_t ivar_offset_address = ivar_offset_symbol.symbol->GetValue().GetLoadAddress (&target);
Error error;
@@ -592,7 +563,7 @@
// is not accurate (it might become better by incorporating further
// knowledge about the internals of tagged pointers)
bool
-AppleObjCRuntimeV2::IsTaggedPointer(lldb::addr_t ptr)
+AppleObjCRuntimeV2::IsTaggedPointer(addr_t ptr)
{
return (ptr & 0x01);
}
@@ -604,7 +575,7 @@
ObjCLanguageRuntime::ObjCISA
AppleObjCRuntimeV2::GetISA(ValueObject& valobj)
{
- if (ClangASTType::GetMinimumLanguage(valobj.GetClangAST(),valobj.GetClangType()) != lldb::eLanguageTypeObjC)
+ if (ClangASTType::GetMinimumLanguage(valobj.GetClangAST(),valobj.GetClangType()) != eLanguageTypeObjC)
return 0;
// if we get an invalid VO (which might still happen when playing around
@@ -613,7 +584,7 @@
if (valobj.GetValue().GetContextType() == Value::eContextTypeInvalid)
return 0;
- lldb::addr_t isa_pointer = valobj.GetPointerValue();
+ addr_t isa_pointer = valobj.GetPointerValue();
// tagged pointer
if (IsTaggedPointer(isa_pointer))
@@ -635,11 +606,16 @@
ConstString
AppleObjCRuntimeV2::GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa)
{
+ static const ConstString g_unknown ("unknown");
+
if (!IsValidISA(isa))
- return ConstString(NULL);
+ return ConstString();
if (isa == g_objc_Tagged_ISA)
- return ConstString("_lldb_Tagged_ObjC_ISA");
+ {
+ static const ConstString g_objc_tagged_isa_name ("_lldb_Tagged_ObjC_ISA");
+ return g_objc_tagged_isa_name;
+ }
ISAToNameIterator found = m_isa_to_name_cache.find(isa);
ISAToNameIterator end = m_isa_to_name_cache.end();
@@ -658,14 +634,17 @@
--> class_rw_t data;
*/
- lldb::addr_t rw_pointer = isa + (4 * pointer_size);
+ addr_t rw_pointer = isa + (4 * pointer_size);
//printf("rw_pointer: %llx\n", rw_pointer);
uint64_t data_pointer = m_process->ReadUnsignedIntegerFromMemory(rw_pointer,
pointer_size,
0,
error);
if (error.Fail())
- return ConstString("unknown");
+ {
+ return g_unknown;
+
+ }
/*
uint32_t flags;
@@ -680,7 +659,7 @@
0,
error);
if (error.Fail())
- return ConstString("unknown");
+ return g_unknown;
/*
uint32_t flags;
@@ -704,7 +683,7 @@
0,
error);
if (error.Fail())
- return ConstString("unknown");
+ return g_unknown;
//printf("name_pointer: %llx\n", name_pointer);
char* cstr = new char[512];
@@ -730,7 +709,7 @@
}
}
else
- return ConstString("unknown");
+ return g_unknown;
}
ObjCLanguageRuntime::ObjCISA
@@ -754,7 +733,7 @@
struct class_t *isa;
--> struct class_t *superclass;
*/
- lldb::addr_t parent_pointer = isa + pointer_size;
+ addr_t parent_pointer = isa + pointer_size;
//printf("rw_pointer: %llx\n", rw_pointer);
uint64_t parent_isa = m_process->ReadUnsignedIntegerFromMemory(parent_pointer,
Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=145799&r1=145798&r2=145799&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Mon Dec 5 00:07:35 2011
@@ -130,8 +130,6 @@
static const char *g_find_class_name_function_name;
static const char *g_find_class_name_function_body;
- static const char *g_objc_class_symbol_prefix;
- static const char *g_objc_class_data_section_name;
};
} // namespace lldb_private
From gclayton at apple.com Mon Dec 5 11:41:21 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 05 Dec 2011 17:41:21 -0000
Subject: [Lldb-commits] [lldb] r145814 - in /lldb/trunk:
lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist
Message-ID: <20111205174121.1EF192A6C12C@llvm.org>
Author: gclayton
Date: Mon Dec 5 11:41:20 2011
New Revision: 145814
URL: http://llvm.org/viewvc/llvm-project?rev=145814&view=rev
Log:
Bumped Xcode project version for lldb-92.
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/resources/LLDB-Info.plist
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=145814&r1=145813&r2=145814&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Dec 5 11:41:20 2011
@@ -3736,9 +3736,9 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 91;
+ CURRENT_PROJECT_VERSION = 92;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 91;
+ DYLIB_CURRENT_VERSION = 92;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3797,10 +3797,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 91;
+ CURRENT_PROJECT_VERSION = 92;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 91;
+ DYLIB_CURRENT_VERSION = 92;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3857,8 +3857,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 91;
- DYLIB_CURRENT_VERSION = 91;
+ CURRENT_PROJECT_VERSION = 92;
+ DYLIB_CURRENT_VERSION = 92;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3887,8 +3887,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 91;
- DYLIB_CURRENT_VERSION = 91;
+ CURRENT_PROJECT_VERSION = 92;
+ DYLIB_CURRENT_VERSION = 92;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3917,8 +3917,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 91;
- DYLIB_CURRENT_VERSION = 91;
+ CURRENT_PROJECT_VERSION = 92;
+ DYLIB_CURRENT_VERSION = 92;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3995,7 +3995,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 91;
+ CURRENT_PROJECT_VERSION = 92;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4025,10 +4025,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 91;
+ CURRENT_PROJECT_VERSION = 92;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 91;
+ DYLIB_CURRENT_VERSION = 92;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4272,7 +4272,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 91;
+ CURRENT_PROJECT_VERSION = 92;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4303,7 +4303,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 91;
+ CURRENT_PROJECT_VERSION = 92;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
Modified: lldb/trunk/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=145814&r1=145813&r2=145814&view=diff
==============================================================================
--- lldb/trunk/resources/LLDB-Info.plist (original)
+++ lldb/trunk/resources/LLDB-Info.plist Mon Dec 5 11:41:20 2011
@@ -17,7 +17,7 @@
CFBundleSignature
????
CFBundleVersion
- 91
+ 92
CFBundleName
${EXECUTABLE_NAME}
From gclayton at apple.com Mon Dec 5 11:41:38 2011
From: gclayton at apple.com (Greg Clayton)
Date: Mon, 05 Dec 2011 17:41:38 -0000
Subject: [Lldb-commits] [lldb] r145815 - /lldb/tags/lldb-92/
Message-ID: <20111205174138.2ED102A6C12C@llvm.org>
Author: gclayton
Date: Mon Dec 5 11:41:37 2011
New Revision: 145815
URL: http://llvm.org/viewvc/llvm-project?rev=145815&view=rev
Log:
lldb-92
Added:
lldb/tags/lldb-92/
- copied from r145814, lldb/trunk/
From scallanan at apple.com Mon Dec 5 12:49:06 2011
From: scallanan at apple.com (Sean Callanan)
Date: Mon, 05 Dec 2011 18:49:06 -0000
Subject: [Lldb-commits] [lldb] r145825 -
/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
Message-ID: <20111205184906.63C022A6C12C@llvm.org>
Author: spyffe
Date: Mon Dec 5 12:49:06 2011
New Revision: 145825
URL: http://llvm.org/viewvc/llvm-project?rev=145825&view=rev
Log:
Because we now call StartTagDeclarationDefinition()
and CompleteTagDeclarationDefinition() on Objective-C
interfaces populated by SymbolFileSymtab::FindTypes(),
we should mark the interface as forward-declared when
we create it.
Modified:
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=145825&r1=145824&r2=145825&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Mon Dec 5 12:49:06 2011
@@ -399,7 +399,7 @@
if (match == NULL)
return 0;
- const bool isForwardDecl = false;
+ const bool isForwardDecl = true;
const bool isInternal = true;
ClangASTContext &ast = GetClangASTContext();
From jingham at apple.com Mon Dec 5 13:24:15 2011
From: jingham at apple.com (Jim Ingham)
Date: Mon, 05 Dec 2011 19:24:15 -0000
Subject: [Lldb-commits] [lldb] r145840 -
/lldb/trunk/source/API/SBCommandInterpreter.cpp
Message-ID: <20111205192415.A81A02A6C12C@llvm.org>
Author: jingham
Date: Mon Dec 5 13:24:15 2011
New Revision: 145840
URL: http://llvm.org/viewvc/llvm-project?rev=145840&view=rev
Log:
Sanity check the inputs to SBCommandInterpreter::HandleCompletion
Modified:
lldb/trunk/source/API/SBCommandInterpreter.cpp
Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=145840&r1=145839&r2=145840&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Mon Dec 5 13:24:15 2011
@@ -124,6 +124,19 @@
SBStringList &matches)
{
int num_completions = 0;
+
+ // Sanity check the arguments that are passed in:
+ // cursor & last_char have to be within the current_line.
+ if (current_line == NULL || cursor == NULL || last_char == NULL)
+ return 0;
+
+ if (cursor < current_line || last_char < current_line)
+ return 0;
+
+ size_t current_line_size = strlen (current_line);
+ if (cursor - current_line > current_line_size || last_char - current_line > current_line_size)
+ return 0;
+
if (m_opaque_ptr)
{
lldb_private::StringList lldb_matches;
From jingham at apple.com Mon Dec 5 19:07:22 2011
From: jingham at apple.com (Jim Ingham)
Date: Tue, 06 Dec 2011 01:07:22 -0000
Subject: [Lldb-commits] [lldb] r145884 - in /lldb/trunk:
include/lldb/Symbol/SymbolVendor.h
source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
source/Symbol/SymbolVendor.cpp
Message-ID: <20111206010722.A68C32A6C12C@llvm.org>
Author: jingham
Date: Mon Dec 5 19:07:22 2011
New Revision: 145884
URL: http://llvm.org/viewvc/llvm-project?rev=145884&view=rev
Log:
Correct typo in method name (AddSymbolFileRepresendation...)
Modified:
lldb/trunk/include/lldb/Symbol/SymbolVendor.h
lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
lldb/trunk/source/Symbol/SymbolVendor.cpp
Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=145884&r1=145883&r2=145884&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Mon Dec 5 19:07:22 2011
@@ -58,7 +58,7 @@
~SymbolVendor();
void
- AddSymbolFileRepresendation(const lldb::ObjectFileSP &objfile_sp);
+ AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp);
virtual void
Dump(Stream *s);
Modified: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp?rev=145884&r1=145883&r2=145884&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp Mon Dec 5 19:07:22 2011
@@ -152,7 +152,7 @@
if (UUIDsMatch(module, dsym_objfile_sp.get()))
{
ReplaceDSYMSectionsWithExecutableSections (obj_file, dsym_objfile_sp.get());
- symbol_vendor->AddSymbolFileRepresendation(dsym_objfile_sp);
+ symbol_vendor->AddSymbolFileRepresentation(dsym_objfile_sp);
return symbol_vendor;
}
}
@@ -161,7 +161,7 @@
// Just create our symbol vendor using the current objfile as this is either
// an executable with no dSYM (that we could locate), an executable with
// a dSYM that has a UUID that doesn't match.
- symbol_vendor->AddSymbolFileRepresendation(obj_file->GetSP());
+ symbol_vendor->AddSymbolFileRepresentation(obj_file->GetSP());
}
}
return symbol_vendor;
Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=145884&r1=145883&r2=145884&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolVendor.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolVendor.cpp Mon Dec 5 19:07:22 2011
@@ -58,7 +58,7 @@
{
ObjectFile *objfile = module->GetObjectFile();
if (objfile)
- instance_ap->AddSymbolFileRepresendation(objfile->GetSP());
+ instance_ap->AddSymbolFileRepresentation(objfile->GetSP());
}
return instance_ap.release();
}
@@ -86,7 +86,7 @@
// Add a represantion given an object file.
//----------------------------------------------------------------------
void
-SymbolVendor::AddSymbolFileRepresendation(const ObjectFileSP &objfile_sp)
+SymbolVendor::AddSymbolFileRepresentation(const ObjectFileSP &objfile_sp)
{
Mutex::Locker locker(m_mutex);
if (objfile_sp)
From scallanan at apple.com Mon Dec 5 19:44:41 2011
From: scallanan at apple.com (Sean Callanan)
Date: Tue, 06 Dec 2011 01:44:41 -0000
Subject: [Lldb-commits] [lldb] r145892 -
/lldb/trunk/source/Symbol/ClangASTType.cpp
Message-ID: <20111206014441.7384A2A6C12C@llvm.org>
Author: spyffe
Date: Mon Dec 5 19:44:41 2011
New Revision: 145892
URL: http://llvm.org/viewvc/llvm-project?rev=145892&view=rev
Log:
Set a flag on the AST type dump to see Objective-C
methods. The Clang dump is now much more verbose,
but when somebody types "target modules lookup -t"
that is typically what they're looking for.
Modified:
lldb/trunk/source/Symbol/ClangASTType.cpp
Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=145892&r1=145891&r2=145892&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Mon Dec 5 19:44:41 2011
@@ -1285,7 +1285,11 @@
{
clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
if (class_interface_decl)
- class_interface_decl->print(llvm_ostrm, ast_context->getPrintingPolicy(), s->GetIndentLevel());
+ {
+ clang::PrintingPolicy policy = ast_context->getPrintingPolicy();
+ policy.Dump = 1;
+ class_interface_decl->print(llvm_ostrm, policy, s->GetIndentLevel());
+ }
}
}
break;
From scallanan at apple.com Mon Dec 5 21:41:14 2011
From: scallanan at apple.com (Sean Callanan)
Date: Tue, 06 Dec 2011 03:41:14 -0000
Subject: [Lldb-commits] [lldb] r145914 - in /lldb/trunk:
include/lldb/Expression/ASTResultSynthesizer.h
include/lldb/Expression/ClangASTSource.h
include/lldb/Symbol/ClangASTImporter.h
source/Expression/ASTResultSynthesizer.cpp
source/Expression/ClangASTSource.cpp
source/Expression/ClangExpressionDeclMap.cpp
source/Expression/ClangUserExpression.cpp
source/Symbol/ClangASTImporter.cpp
Message-ID: <20111206034114.BBC022A6C12C@llvm.org>
Author: spyffe
Date: Mon Dec 5 21:41:14 2011
New Revision: 145914
URL: http://llvm.org/viewvc/llvm-project?rev=145914&view=rev
Log:
As part of the work to make Objective-C type information
from symbols more accessible, I have added a second
map to the ClangASTImporter: the ObjCInterfaceMetaMap.
This map keeps track of all type definitions found for
a particular Objective-C interface, allowing the
ClangASTSource to refer to all possible sources when
looking for method definitions.
There is a bug in lookup that I still need to figure out,
but after that we should be able to report full method
information for Objective-C classes shown in symbols.
Also fixed some errors I ran into when enabling the maps
for the persistent type store. The persistent type store
previously did not use the ClangASTImporter to import
types, instead using ASTImporters that got allocated each
time a type needed copying. To support the requirements
of the persistent type store -- namely, that types must be
copied, completed, and then completely severed from their
origin in the parser's AST context (which will go away) --
I added a new function called DeportType which severs all
these connections.
Modified:
lldb/trunk/include/lldb/Expression/ASTResultSynthesizer.h
lldb/trunk/include/lldb/Expression/ClangASTSource.h
lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Symbol/ClangASTImporter.cpp
Modified: lldb/trunk/include/lldb/Expression/ASTResultSynthesizer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ASTResultSynthesizer.h?rev=145914&r1=145913&r2=145914&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ASTResultSynthesizer.h (original)
+++ lldb/trunk/include/lldb/Expression/ASTResultSynthesizer.h Mon Dec 5 21:41:14 2011
@@ -45,14 +45,13 @@
/// The type that the result should have. May be initialized with a
/// NULL type, in which case the type is inferred.
///
- /// @param[in] scratch_ast_context
- /// If non-NULL, an AST context to populate with the persistent types
- /// found in the expression.
+ /// @param[in] target
+ /// The target, which contains the persistent variable store and the
+ /// AST importer.
//----------------------------------------------------------------------
ASTResultSynthesizer(clang::ASTConsumer *passthrough,
TypeFromUser desired_type,
- clang::ASTContext &scratch_ast_context,
- ClangPersistentVariables &persistent_vars);
+ Target &target);
//----------------------------------------------------------------------
/// Destructor
@@ -181,8 +180,7 @@
clang::ASTContext *m_ast_context; ///< The AST context to use for identifiers and types.
clang::ASTConsumer *m_passthrough; ///< The ASTConsumer down the chain, for passthrough. NULL if it's a SemaConsumer.
clang::SemaConsumer *m_passthrough_sema; ///< The SemaConsumer down the chain, for passthrough. NULL if it's an ASTConsumer.
- clang::ASTContext &m_scratch_ast_context; ///< The AST context to install persistent types into.
- ClangPersistentVariables &m_persistent_vars;///< The persistent variable manager to register persistent types with.
+ Target &m_target; ///< The target, which contains the persistent variable store and the
clang::Sema *m_sema; ///< The Sema to use.
TypeFromUser m_desired_type; ///< If non-NULL, the type to coerce the result to.
};
Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=145914&r1=145913&r2=145914&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Mon Dec 5 21:41:14 2011
@@ -32,13 +32,13 @@
//----------------------------------------------------------------------
class ClangASTSource :
public ClangExternalASTSourceCommon,
- public ClangASTImporter::NamespaceMapCompleter
+ public ClangASTImporter::MapCompleter
{
public:
//------------------------------------------------------------------
/// Constructor
///
- /// Initializes class variabes.
+ /// Initializes class variables.
///
/// @param[in] declMap
/// A reference to the LLDB object that handles entity lookup.
@@ -73,6 +73,7 @@
void InstallASTContext (clang::ASTContext *ast_context)
{
m_ast_context = ast_context;
+ m_ast_importer->InstallMapCompleter(ast_context, *this);
}
//
@@ -169,6 +170,24 @@
const ConstString &name,
ClangASTImporter::NamespaceMapSP &parent_map) const;
+ //------------------------------------------------------------------
+ /// Look up all instances of a given Objective-C interface in all
+ /// symbol files and put the appropriate entries in the namespace
+ /// map.
+ ///
+ /// @param[in] namespace_map
+ /// The map to be completed.
+ ///
+ /// @param[in] name
+ /// The name of the namespace to be found.
+ ///
+ /// @param[in] parent_map
+ /// The map for the namespace's parent namespace, if there is
+ /// one.
+ //------------------------------------------------------------------
+ void CompleteObjCInterfaceMap (ClangASTImporter::ObjCInterfaceMapSP &objc_interface_map,
+ const ConstString &name) const;
+
//
// Helper APIs
//
Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=145914&r1=145913&r2=145914&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Mon Dec 5 21:41:14 2011
@@ -47,6 +47,11 @@
CopyDecl (clang::ASTContext *dst_ctx,
clang::ASTContext *src_ctx,
clang::Decl *decl);
+
+ clang::Decl *
+ DeportDecl (clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx,
+ clang::Decl *decl);
void
CompleteTagDecl (clang::TagDecl *decl);
@@ -68,23 +73,49 @@
return origin.Valid();
}
+ //
+ // Namespace maps
+ //
+
typedef std::vector < std::pair > NamespaceMap;
typedef lldb::SharedPtr::Type NamespaceMapSP;
void RegisterNamespaceMap (const clang::NamespaceDecl *decl,
NamespaceMapSP &namespace_map);
+
+ NamespaceMapSP GetNamespaceMap (const clang::NamespaceDecl *decl);
+
+ void BuildNamespaceMap (const clang::NamespaceDecl *decl);
+
+ //
+ // Objective-C interface maps
+ //
+
+ typedef std::vector ObjCInterfaceMap;
+ typedef lldb::SharedPtr::Type ObjCInterfaceMapSP;
+
+ void BuildObjCInterfaceMap (const clang::ObjCInterfaceDecl *decl);
+
+ ObjCInterfaceMapSP GetObjCInterfaceMap (const clang::ObjCInterfaceDecl *decl);
- class NamespaceMapCompleter
+ //
+ // Completers for the namespace and Objective-C interface maps
+ //
+
+ class MapCompleter
{
public:
- virtual ~NamespaceMapCompleter ();
+ virtual ~MapCompleter ();
virtual void CompleteNamespaceMap (NamespaceMapSP &namespace_map,
const ConstString &name,
NamespaceMapSP &parent_map) const = 0;
+
+ virtual void CompleteObjCInterfaceMap (ObjCInterfaceMapSP &objc_interface_map,
+ const ConstString &name) const = 0;
};
- void InstallMapCompleter (clang::ASTContext *dst_ctx, NamespaceMapCompleter &completer)
+ void InstallMapCompleter (clang::ASTContext *dst_ctx, MapCompleter &completer)
{
ASTContextMetadataSP context_md;
ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
@@ -98,13 +129,9 @@
{
context_md = context_md_iter->second;
}
-
+
context_md->m_map_completer = &completer;
}
-
- NamespaceMapSP GetNamespaceMap (const clang::NamespaceDecl *decl);
-
- void BuildNamespaceMap (const clang::NamespaceDecl *decl);
void ForgetDestination (clang::ASTContext *dst_ctx);
void ForgetSource (clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
@@ -170,11 +197,10 @@
clang::ASTContext *m_source_ctx;
};
- typedef lldb::SharedPtr::Type MinionSP;
-
- typedef std::map MinionMap;
-
- typedef std::map NamespaceMetaMap;
+ typedef lldb::SharedPtr::Type MinionSP;
+ typedef std::map MinionMap;
+ typedef std::map NamespaceMetaMap;
+ typedef std::map ObjCInterfaceMetaMap;
struct ASTContextMetadata
{
@@ -183,16 +209,19 @@
m_minions (),
m_origins (),
m_namespace_maps (),
+ m_objc_interface_maps (),
m_map_completer (NULL)
{
}
- clang::ASTContext *m_dst_ctx;
- MinionMap m_minions;
- OriginMap m_origins;
+ clang::ASTContext *m_dst_ctx;
+ MinionMap m_minions;
+ OriginMap m_origins;
+
+ NamespaceMetaMap m_namespace_maps;
+ MapCompleter *m_map_completer;
- NamespaceMetaMap m_namespace_maps;
- NamespaceMapCompleter *m_map_completer;
+ ObjCInterfaceMetaMap m_objc_interface_maps;
};
typedef lldb::SharedPtr::Type ASTContextMetadataSP;
Modified: lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ASTResultSynthesizer.cpp?rev=145914&r1=145913&r2=145914&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ASTResultSynthesizer.cpp (original)
+++ lldb/trunk/source/Expression/ASTResultSynthesizer.cpp Mon Dec 5 21:41:14 2011
@@ -22,6 +22,8 @@
#include "lldb/Expression/ClangPersistentVariables.h"
#include "lldb/Expression/ASTResultSynthesizer.h"
#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/ClangASTImporter.h"
+#include "lldb/Target/Target.h"
using namespace llvm;
using namespace clang;
@@ -29,13 +31,11 @@
ASTResultSynthesizer::ASTResultSynthesizer(ASTConsumer *passthrough,
TypeFromUser desired_type,
- ASTContext &scratch_ast_context,
- ClangPersistentVariables &persistent_vars) :
+ Target &target) :
m_ast_context (NULL),
m_passthrough (passthrough),
m_passthrough_sema (NULL),
- m_scratch_ast_context (scratch_ast_context),
- m_persistent_vars (persistent_vars),
+ m_target (target),
m_sema (NULL),
m_desired_type (desired_type)
{
@@ -442,14 +442,12 @@
if (log)
log->Printf ("Recording persistent type %s\n", name_cs.GetCString());
- Decl *D_scratch = ClangASTContext::CopyDecl(&m_scratch_ast_context,
- m_ast_context,
- D);
+ Decl *D_scratch = m_target.GetClangASTImporter()->DeportDecl(m_target.GetScratchClangASTContext()->getASTContext(),
+ m_ast_context,
+ D);
- TypeDecl *TD_scratch = dyn_cast(D_scratch);
-
- if (TD_scratch)
- m_persistent_vars.RegisterPersistentType(name_cs, TD_scratch);
+ if (TypeDecl *TypeDecl_scratch = dyn_cast(D_scratch))
+ m_target.GetPersistentVariables().RegisterPersistentType(name_cs, TypeDecl_scratch);
}
void
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=145914&r1=145913&r2=145914&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Mon Dec 5 21:41:14 2011
@@ -463,29 +463,11 @@
SymbolContext null_sc;
if (module_sp && namespace_decl)
- {
module_sp->FindTypes(null_sc, name, &namespace_decl, true, 1, types);
- }
else if(name != id_name && name != Class_name)
- {
- m_target->GetImages().FindTypes (null_sc, name, true, 1, types);
-
- if (!types.GetSize())
- {
- lldb::ProcessSP process = m_target->GetProcessSP();
-
- if (process && process->GetObjCLanguageRuntime())
- {
- SymbolVendor *objc_symbol_vendor = process->GetObjCLanguageRuntime()->GetSymbolVendor();
-
- objc_symbol_vendor->FindTypes(null_sc, name, NULL, true, 1, types);
- }
- }
- }
+ m_target->GetImages().FindTypes(null_sc, name, true, 1, types);
else
- {
break;
- }
if (types.GetSize())
{
@@ -501,13 +483,15 @@
(name_string ? name_string : ""));
}
+
void *copied_type = GuardedCopyType(m_ast_context, type_sp->GetClangAST(), type_sp->GetClangFullType());
-
+
if (!copied_type)
{
if (log)
- log->Printf("ClangExpressionDeclMap::BuildIntegerVariable - Couldn't export the type for a constant integer result");
-
+ log->Printf(" CAS::FEVD[%u] - Couldn't export the type for a constant integer result",
+ current_id);
+
break;
}
@@ -534,6 +518,7 @@
return;
StreamString ss;
+
if (decl_name.isObjCZeroArgSelector())
{
ss.Printf("%s", decl_name.getAsString().c_str());
@@ -565,6 +550,90 @@
interface_decl->getNameAsString().c_str(),
selector_name.AsCString());
+ ClangASTImporter::ObjCInterfaceMapSP interface_map = m_ast_importer->GetObjCInterfaceMap(interface_decl);
+
+ if (interface_map)
+ {
+ for (ClangASTImporter::ObjCInterfaceMap::iterator i = interface_map->begin(), e = interface_map->end();
+ i != e;
+ ++i)
+ {
+ lldb::clang_type_t backing_type = i->GetOpaqueQualType();
+
+ if (!backing_type)
+ continue;
+
+ QualType backing_qual_type = QualType::getFromOpaquePtr(backing_type);
+
+ const ObjCInterfaceType *backing_interface_type = dyn_cast(backing_qual_type.getTypePtr());
+
+ if (!backing_interface_type)
+ continue;
+
+ const ObjCInterfaceDecl *backing_interface_decl = backing_interface_type->getDecl();
+
+ if (!backing_interface_decl)
+ continue;
+
+ if (backing_interface_decl->decls_begin() == backing_interface_decl->decls_end())
+ continue; // don't waste time creating a DeclarationName here
+
+ clang::ASTContext &backing_ast_context = backing_interface_decl->getASTContext();
+
+ llvm::SmallVector selector_components;
+
+ if (decl_name.isObjCZeroArgSelector())
+ {
+ selector_components.push_back (&backing_ast_context.Idents.get(decl_name.getAsString().c_str()));
+ }
+ else if (decl_name.isObjCOneArgSelector())
+ {
+ selector_components.push_back (&backing_ast_context.Idents.get(decl_name.getAsString().c_str()));
+ }
+ else
+ {
+ clang::Selector sel = decl_name.getObjCSelector();
+
+ for (unsigned i = 0, e = sel.getNumArgs();
+ i != e;
+ ++i)
+ {
+ llvm::StringRef r = sel.getNameForSlot(i);
+
+ selector_components.push_back (&backing_ast_context.Idents.get(r.str().c_str()));
+ }
+ }
+
+ Selector backing_selector = backing_interface_decl->getASTContext().Selectors.getSelector(selector_components.size(), selector_components.data());
+ DeclarationName backing_decl_name = DeclarationName(backing_selector);
+
+ DeclContext::lookup_const_result lookup_result = backing_interface_decl->lookup(backing_decl_name);
+
+ if (lookup_result.first == lookup_result.second)
+ continue;
+
+ ObjCMethodDecl *method_decl = dyn_cast(*lookup_result.first);
+
+ if (!method_decl)
+ continue;
+
+ Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &backing_ast_context, *lookup_result.first);
+
+ ObjCMethodDecl *copied_method_decl = dyn_cast (copied_decl);
+
+ if (!copied_method_decl)
+ continue;
+
+ if (log)
+ {
+ ASTDumper dumper((Decl*)copied_method_decl);
+ log->Printf(" CAS::FOMD[%d] found (in symbols) %s", current_id, dumper.GetCString());
+ }
+
+ context.AddNamedDecl(copied_method_decl);
+ }
+ }
+
SymbolContextList sc_list;
const bool include_symbols = false;
@@ -614,7 +683,7 @@
if (log)
{
ASTDumper dumper((Decl*)copied_method_decl);
- log->Printf(" CAS::FOMD[%d] found %s", current_id, dumper.GetCString());
+ log->Printf(" CAS::FOMD[%d] found (in debug info) %s", current_id, dumper.GetCString());
}
context.AddNamedDecl(copied_method_decl);
@@ -777,6 +846,29 @@
}
}
+void
+ClangASTSource::CompleteObjCInterfaceMap (ClangASTImporter::ObjCInterfaceMapSP &objc_interface_map,
+ const ConstString &name) const
+{
+ SymbolContext null_sc;
+
+ TypeList types;
+
+ m_target->GetImages().FindTypes(null_sc, name, true, UINT32_MAX, types);
+
+ for (uint32_t i = 0, e = types.GetSize();
+ i != e;
+ ++i)
+ {
+ lldb::TypeSP mapped_type_sp = types.GetTypeAtIndex(i);
+
+ if (!mapped_type_sp || !mapped_type_sp->GetClangFullType())
+ continue;
+
+ objc_interface_map->push_back (ClangASTType(mapped_type_sp->GetClangAST(), mapped_type_sp->GetClangFullType()));
+ }
+}
+
NamespaceDecl *
ClangASTSource::AddNamespace (NameSearchContext &context, ClangASTImporter::NamespaceMapSP &namespace_decls)
{
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=145914&r1=145913&r2=145914&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Mon Dec 5 21:41:14 2011
@@ -895,8 +895,12 @@
return err.Success();
}
case Value::eValueTypeHostAddress:
- memcpy ((void *)value.GetScalar().ULongLong(), data, length);
- return true;
+ {
+ if (value.GetScalar().ULongLong() == 0 || data == NULL)
+ return false;
+ memcpy ((void *)value.GetScalar().ULongLong(), data, length);
+ return true;
+ }
case Value::eValueTypeScalar:
return false;
}
@@ -2474,7 +2478,7 @@
if (!ptype_type_decl)
break;
- Decl *parser_ptype_decl = ClangASTContext::CopyDecl(m_ast_context, scratch_ast_context, ptype_type_decl);
+ Decl *parser_ptype_decl = m_ast_importer->CopyDecl(m_ast_context, scratch_ast_context, ptype_type_decl);
if (!parser_ptype_decl)
break;
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=145914&r1=145913&r2=145914&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Mon Dec 5 21:41:14 2011
@@ -92,8 +92,7 @@
if (!m_result_synthesizer.get())
m_result_synthesizer.reset(new ASTResultSynthesizer(passthrough,
m_desired_type,
- *m_target->GetScratchClangASTContext()->getASTContext(),
- m_target->GetPersistentVariables()));
+ *m_target));
return m_result_synthesizer.get();
}
Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=145914&r1=145913&r2=145914&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Mon Dec 5 21:41:14 2011
@@ -71,6 +71,30 @@
return NULL;
}
+clang::Decl *
+ClangASTImporter::DeportDecl (clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx,
+ clang::Decl *decl)
+{
+ clang::Decl *result = CopyDecl(dst_ctx, src_ctx, decl);
+
+ if (!result)
+ return NULL;
+
+ ClangASTContext::GetCompleteDecl (src_ctx, decl);
+
+ MinionSP minion_sp (GetMinion (dst_ctx, src_ctx));
+
+ if (minion_sp && isa(decl))
+ minion_sp->ImportDefinition(decl);
+
+ ASTContextMetadataSP to_context_md = GetContextMetadata(dst_ctx);
+
+ to_context_md->m_origins.erase(result);
+
+ return result;
+}
+
void
ClangASTImporter::CompleteTagDecl (clang::TagDecl *decl)
{
@@ -175,7 +199,7 @@
context_md->m_map_completer->CompleteNamespaceMap (new_map, ConstString(namespace_string.c_str()), parent_map);
}
- RegisterNamespaceMap (decl, new_map);
+ context_md->m_namespace_maps[decl] = new_map;
}
void
@@ -205,11 +229,43 @@
}
}
-ClangASTImporter::NamespaceMapCompleter::~NamespaceMapCompleter ()
+ClangASTImporter::MapCompleter::~MapCompleter ()
{
return;
}
+ClangASTImporter::ObjCInterfaceMapSP
+ClangASTImporter::GetObjCInterfaceMap (const clang::ObjCInterfaceDecl *decl)
+{
+ ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
+
+ ObjCInterfaceMetaMap &objc_interface_maps = context_md->m_objc_interface_maps;
+
+ ObjCInterfaceMetaMap::iterator iter = objc_interface_maps.find(decl);
+
+ if (iter != objc_interface_maps.end())
+ return iter->second;
+ else
+ return ObjCInterfaceMapSP();
+}
+
+void
+ClangASTImporter::BuildObjCInterfaceMap (const clang::ObjCInterfaceDecl *decl)
+{
+ ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
+
+ ObjCInterfaceMapSP new_map(new ObjCInterfaceMap);
+
+ if (context_md->m_map_completer)
+ {
+ std::string namespace_string = decl->getDeclName().getAsString();
+
+ context_md->m_map_completer->CompleteObjCInterfaceMap(new_map, ConstString(namespace_string.c_str()));
+ }
+
+ context_md->m_objc_interface_maps[decl] = new_map;
+}
+
clang::Decl
*ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to)
{
@@ -256,6 +312,8 @@
}
else
{
+ to_context_md->m_origins[to] = DeclOrigin(m_source_ctx, from);
+
if (log)
log->Printf(" [ClangASTImporter] Decl has no origin information in (ASTContext*)%p",
&from->getASTContext());
@@ -313,6 +371,8 @@
{
ObjCInterfaceDecl *to_interface_decl = dyn_cast(to);
+ m_master.BuildObjCInterfaceMap(to_interface_decl);
+
to_interface_decl->setHasExternalLexicalStorage();
to_interface_decl->setHasExternalVisibleStorage();
@@ -320,7 +380,7 @@
to_interface_decl->completedForwardDecl();
to_interface_decl->setExternallyCompleted();
-
+
if (log)
log->Printf(" [ClangASTImporter] To is an ObjCInterfaceDecl - attributes %s%s%s",
(to_interface_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
From jmolenda at apple.com Mon Dec 5 22:21:20 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Tue, 06 Dec 2011 04:21:20 -0000
Subject: [Lldb-commits] [lldb] r145917 - in /lldb/trunk:
lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist
Message-ID: <20111206042120.E20852A6C12C@llvm.org>
Author: jmolenda
Date: Mon Dec 5 22:21:20 2011
New Revision: 145917
URL: http://llvm.org/viewvc/llvm-project?rev=145917&view=rev
Log:
Skip over lldb-93.
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/resources/LLDB-Info.plist
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=145917&r1=145916&r2=145917&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Dec 5 22:21:20 2011
@@ -3736,9 +3736,9 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 92;
+ CURRENT_PROJECT_VERSION = 93;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 92;
+ DYLIB_CURRENT_VERSION = 93;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3797,10 +3797,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 92;
+ CURRENT_PROJECT_VERSION = 93;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 92;
+ DYLIB_CURRENT_VERSION = 93;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3857,8 +3857,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 92;
- DYLIB_CURRENT_VERSION = 92;
+ CURRENT_PROJECT_VERSION = 93;
+ DYLIB_CURRENT_VERSION = 93;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3887,8 +3887,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 92;
- DYLIB_CURRENT_VERSION = 92;
+ CURRENT_PROJECT_VERSION = 93;
+ DYLIB_CURRENT_VERSION = 93;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3917,8 +3917,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 92;
- DYLIB_CURRENT_VERSION = 92;
+ CURRENT_PROJECT_VERSION = 93;
+ DYLIB_CURRENT_VERSION = 93;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3995,7 +3995,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 92;
+ CURRENT_PROJECT_VERSION = 93;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4025,10 +4025,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 92;
+ CURRENT_PROJECT_VERSION = 93;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 92;
+ DYLIB_CURRENT_VERSION = 93;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4272,7 +4272,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 92;
+ CURRENT_PROJECT_VERSION = 93;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4303,7 +4303,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 92;
+ CURRENT_PROJECT_VERSION = 93;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
Modified: lldb/trunk/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=145917&r1=145916&r2=145917&view=diff
==============================================================================
--- lldb/trunk/resources/LLDB-Info.plist (original)
+++ lldb/trunk/resources/LLDB-Info.plist Mon Dec 5 22:21:20 2011
@@ -17,7 +17,7 @@
CFBundleSignature
????
CFBundleVersion
- 92
+ 93
CFBundleName
${EXECUTABLE_NAME}
From gclayton at apple.com Mon Dec 5 22:51:14 2011
From: gclayton at apple.com (Greg Clayton)
Date: Tue, 06 Dec 2011 04:51:14 -0000
Subject: [Lldb-commits] [lldb] r145920 - in
/lldb/trunk/source/Plugins/Process/gdb-remote: ProcessGDBRemote.cpp
ProcessGDBRemote.h
Message-ID: <20111206045114.E00132A6C12C@llvm.org>
Author: gclayton
Date: Mon Dec 5 22:51:14 2011
New Revision: 145920
URL: http://llvm.org/viewvc/llvm-project?rev=145920&view=rev
Log:
Protect a member variable from being modified by multiple threads.
Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=145920&r1=145919&r2=145920&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Dec 5 22:51:14 2011
@@ -123,6 +123,7 @@
m_gdb_comm(false),
m_debugserver_pid (LLDB_INVALID_PROCESS_ID),
m_last_stop_packet (),
+ m_last_stop_packet_mutex (Mutex::eMutexTypeNormal),
m_register_info (),
m_async_broadcaster ("lldb.process.gdb-remote.async-broadcaster"),
m_async_thread (LLDB_INVALID_HOST_THREAD),
@@ -1548,7 +1549,7 @@
if (packet_cmd == 'W' || packet_cmd == 'X')
{
- m_last_stop_packet = response;
+ SetLastStopPacket (response);
SetExitStatus(response.GetHexU8(), NULL);
}
}
@@ -2353,12 +2354,12 @@
case eStateStopped:
case eStateCrashed:
case eStateSuspended:
- process->m_last_stop_packet = response;
+ process->SetLastStopPacket (response);
process->SetPrivateState (stop_state);
break;
case eStateExited:
- process->m_last_stop_packet = response;
+ process->SetLastStopPacket (response);
response.SetFilePos(1);
process->SetExitStatus(response.GetHexU8(), NULL);
done = true;
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=145920&r1=145919&r2=145920&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Mon Dec 5 22:51:14 2011
@@ -271,6 +271,12 @@
return m_gdb_comm;
}
+ void
+ SetLastStopPacket (const StringExtractorGDBRemote &response)
+ {
+ lldb_private::Mutex::Locker locker (m_last_stop_packet_mutex);
+ m_last_stop_packet = response;
+ }
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
@@ -284,6 +290,7 @@
GDBRemoteCommunicationClient m_gdb_comm;
lldb::pid_t m_debugserver_pid;
StringExtractorGDBRemote m_last_stop_packet;
+ lldb_private::Mutex m_last_stop_packet_mutex;
GDBRemoteDynamicRegisterInfo m_register_info;
lldb_private::Broadcaster m_async_broadcaster;
lldb::thread_t m_async_thread;
From johnny.chen at apple.com Tue Dec 6 16:19:10 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 06 Dec 2011 22:19:10 -0000
Subject: [Lldb-commits] [lldb] r145978 - in
/lldb/trunk/tools/debugserver/source/MacOSX/arm: DNBArchImpl.cpp
DNBArchImpl.h
Message-ID: <20111206221910.281B01BE003@llvm.org>
Author: johnny
Date: Tue Dec 6 16:19:09 2011
New Revision: 145978
URL: http://llvm.org/viewvc/llvm-project?rev=145978&view=rev
Log:
Add a typedef for arm_debug_state_t as DBG. Plus some minor comment changes.
Modified:
lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
Modified: lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=145978&r1=145977&r2=145978&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Tue Dec 6 16:19:09 2011
@@ -252,7 +252,7 @@
}
static void
-DumpDBGState(const arm_debug_state_t& dbg)
+DumpDBGState(const DBG& dbg)
{
uint32_t i = 0;
for (i=0; i<16; i++)
@@ -2284,9 +2284,8 @@
return INVALID_NUB_HW_INDEX;
// We can only watch up to four bytes that follow a 4 byte aligned address
- // per watchpoint register pair. Since we have at most so we can only watch
- // until the next 4 byte boundary and we need to make sure we can properly
- // encode this.
+ // per watchpoint register pair. Since we can only watch until the next 4
+ // byte boundary, we need to make sure we can properly encode this.
uint32_t addr_word_offset = addr % 4;
DNBLogThreadedIf(LOG_WATCHPOINTS, "DNBArchMachARM::EnableHardwareWatchpoint() - addr_word_offset = 0x%8.8x", addr_word_offset);
@@ -2315,8 +2314,8 @@
// Make the byte_mask into a valid Byte Address Select mask
uint32_t byte_address_select = byte_mask << 5;
// Make sure bits 1:0 are clear in our address
- m_state.dbg.__wvr[i] = addr & ~((nub_addr_t)3);
- m_state.dbg.__wcr[i] = byte_address_select | // Which bytes that follow the IMVA that we will watch
+ m_state.dbg.__wvr[i] = addr & ~((nub_addr_t)3); // DVA (Data Virtual Address)
+ m_state.dbg.__wcr[i] = byte_address_select | // Which bytes that follow the DVA that we will watch
S_USER | // Stop only in user mode
(read ? WCR_LOAD : 0) | // Stop on read access?
(write ? WCR_STORE : 0) | // Stop on write access?
Modified: lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h?rev=145978&r1=145977&r2=145978&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h Tue Dec 6 16:19:09 2011
@@ -109,6 +109,7 @@
typedef arm_thread_state_t GPR;
typedef arm_vfp_state_t FPU;
typedef arm_exception_state_t EXC;
+ typedef arm_debug_state_t DBG;
static const DNBRegisterInfo g_gpr_registers[];
static const DNBRegisterInfo g_vfp_registers[];
@@ -131,7 +132,7 @@
struct State
{
Context context;
- arm_debug_state_t dbg;
+ DBG dbg;
kern_return_t gpr_errs[2]; // Read/Write errors
kern_return_t vfp_errs[2]; // Read/Write errors
kern_return_t exc_errs[2]; // Read/Write errors
From jmolenda at apple.com Tue Dec 6 16:48:52 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Tue, 06 Dec 2011 22:48:52 -0000
Subject: [Lldb-commits] [lldb] r145982 -
/lldb/trunk/lldb.xcodeproj/project.pbxproj
Message-ID: <20111206224853.0C46D1BE003@llvm.org>
Author: jmolenda
Date: Tue Dec 6 16:48:52 2011
New Revision: 145982
URL: http://llvm.org/viewvc/llvm-project?rev=145982&view=rev
Log:
Use the shorter form of the LLDB framework binary path.
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=145982&r1=145981&r2=145982&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Dec 6 16:48:52 2011
@@ -3751,7 +3751,7 @@
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "resources/LLDB-Info.plist";
INSTALL_PATH = /System/Library/PrivateFrameworks;
- LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB";
+ LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/LLDB";
LIBRARY_SEARCH_PATHS = (
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
"$(inherited)",
@@ -3812,7 +3812,7 @@
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "resources/LLDB-Info.plist";
INSTALL_PATH = /System/Library/PrivateFrameworks;
- LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB";
+ LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/LLDB";
LIBRARY_SEARCH_PATHS = (
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
"$(inherited)",
@@ -4040,7 +4040,7 @@
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "resources/LLDB-Info.plist";
INSTALL_PATH = /System/Library/PrivateFrameworks;
- LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/Versions/A/LLDB";
+ LD_DYLIB_INSTALL_NAME = "@rpath/LLDB.framework/LLDB";
LIBRARY_SEARCH_PATHS = (
"$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)",
"$(inherited)",
From johnny.chen at apple.com Wed Dec 7 13:27:06 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 07 Dec 2011 19:27:06 -0000
Subject: [Lldb-commits] [lldb] r146050 -
/lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
Message-ID: <20111207192706.8D36D2A6C12C@llvm.org>
Author: johnny
Date: Wed Dec 7 13:27:06 2011
New Revision: 146050
URL: http://llvm.org/viewvc/llvm-project?rev=146050&view=rev
Log:
Modified the script to have the flexibility of specifying the gdb executable path
for use in the benchmark against lldb's disassembly speed. Note that the lldb
executable path can already be specified using the LLDB_EXEC env variable.
rdar://problem/7511194
Modified:
lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
Modified: lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py?rev=146050&r1=146049&r2=146050&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py (original)
+++ lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py Wed Dec 7 13:27:06 2011
@@ -6,12 +6,33 @@
import pexpect
from lldbbench import *
+def is_exe(fpath):
+ """Returns true if fpath is an executable."""
+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
class DisassembleDriverMainLoop(BenchBase):
mydir = os.path.join("benchmarks", "disassembly")
def setUp(self):
+ """
+ Note that lldbExec can be specified with the LLDB_EXEC env variable (see
+ dotest.py), and gdbExec can be specified with the GDB_EXEC env variable.
+ This provides a flexibility in specifying different versions of gdb for
+ comparison purposes.
+ """
BenchBase.setUp(self)
+ # If env var GDB_EXEC is specified, use it; otherwise, use gdb in your
+ # PATH env var.
+ if "GDB_EXEC" in os.environ and is_exe(os.environ["GDB_EXEC"]):
+ self.gdbExec = os.environ["GDB_EXEC"]
+ else:
+ self.gdbExec = "gdb"
+
+ print
+ print "lldb path: %s" % self.lldbExec
+ print "gdb path: %s" % self.gdbExec
+
self.exe = self.lldbHere
self.function = 'Driver::MainLoop()'
self.lldb_avg = None
@@ -86,7 +107,7 @@
prompt = self.child_prompt
# So that the child gets torn down after the test.
- self.child = pexpect.spawn('gdb --nx %s' % exe)
+ self.child = pexpect.spawn('%s --nx %s' % (self.gdbExec, exe))
child = self.child
# Turn on logging for what the child sends back.
From jingham at apple.com Wed Dec 7 14:10:58 2011
From: jingham at apple.com (Jim Ingham)
Date: Wed, 07 Dec 2011 20:10:58 -0000
Subject: [Lldb-commits] [lldb] r146061 -
/lldb/trunk/source/Expression/DWARFExpression.cpp
Message-ID: <20111207201058.823A22A6C12C@llvm.org>
Author: jingham
Date: Wed Dec 7 14:10:58 2011
New Revision: 146061
URL: http://llvm.org/viewvc/llvm-project?rev=146061&view=rev
Log:
Fix assert string to be more informative.
Modified:
lldb/trunk/source/Expression/DWARFExpression.cpp
Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=146061&r1=146060&r2=146061&view=diff
==============================================================================
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Wed Dec 7 14:10:58 2011
@@ -994,7 +994,7 @@
default:
{
Host::SetCrashDescriptionWithFormat ("Unhandled DW_OP_XXX opcode: %d, add support for it.", op);
- assert (!"Unhandled DW_OP_XXX opcode: %d, add support for it.");
+ assert (!"Unhandled DW_OP_XXX opcode - look for actual value in Crash Description string.");
}
break;
}
From scallanan at apple.com Wed Dec 7 14:41:47 2011
From: scallanan at apple.com (Sean Callanan)
Date: Wed, 07 Dec 2011 20:41:47 -0000
Subject: [Lldb-commits] [lldb] r146066 -
/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Message-ID: <20111207204147.BEA712A6C12C@llvm.org>
Author: spyffe
Date: Wed Dec 7 14:41:47 2011
New Revision: 146066
URL: http://llvm.org/viewvc/llvm-project?rev=146066&view=rev
Log:
Fixed a potential crasher if the frame is not
avalable when a global variable is looked up.
In ClangExpressionDeclMap, a frame should usually
be available.
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=146066&r1=146065&r2=146066&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Dec 7 14:41:47 2011
@@ -2539,7 +2539,7 @@
return;
}
}
- else if (target)
+ else if (frame && target)
{
var = FindGlobalVariable (*target,
module_sp,
From eli.friedman at gmail.com Wed Dec 7 16:09:44 2011
From: eli.friedman at gmail.com (Eli Friedman)
Date: Wed, 07 Dec 2011 22:09:44 -0000
Subject: [Lldb-commits] [lldb] r146085 - /lldb/trunk/www/lldb-gdb.html
Message-ID: <20111207220944.1BB482A6C12C@llvm.org>
Author: efriedma
Date: Wed Dec 7 16:09:43 2011
New Revision: 146085
URL: http://llvm.org/viewvc/llvm-project?rev=146085&view=rev
Log:
Fix on webpage.
Modified:
lldb/trunk/www/lldb-gdb.html
Modified: lldb/trunk/www/lldb-gdb.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/lldb-gdb.html?rev=146085&r1=146084&r2=146085&view=diff
==============================================================================
--- lldb/trunk/www/lldb-gdb.html (original)
+++ lldb/trunk/www/lldb-gdb.html Wed Dec 7 16:09:43 2011
@@ -3,7 +3,7 @@
-LLDB Goals
+LLDB to GDB Command Map
From scallanan at apple.com Wed Dec 7 16:39:40 2011
From: scallanan at apple.com (Sean Callanan)
Date: Wed, 07 Dec 2011 22:39:40 -0000
Subject: [Lldb-commits] [lldb] r146089 -
/lldb/trunk/source/Expression/ClangASTSource.cpp
Message-ID: <20111207223940.1F29C2A6C12C@llvm.org>
Author: spyffe
Date: Wed Dec 7 16:39:39 2011
New Revision: 146089
URL: http://llvm.org/viewvc/llvm-project?rev=146089&view=rev
Log:
Fixed a few details of method lookup in Objective-C
symbols. Now we find the correct method.
Unfortunately we don't get the superclass from the
runtime yet so the method doesn't import correctly
(and I added a check to make sure that doesn't hurt
us) but once we get that information right we will
report methods correctly to the parser as well.
Getting superclass information requires a common AST
context for all Objective-C runtime information,
meaning that the superclass and the subclass are in
the same AST context in all cases. That is the next
thing that needs to be done here.
Modified:
lldb/trunk/source/Expression/ClangASTSource.cpp
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=146089&r1=146088&r2=146089&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Wed Dec 7 16:39:39 2011
@@ -581,6 +581,7 @@
clang::ASTContext &backing_ast_context = backing_interface_decl->getASTContext();
llvm::SmallVector selector_components;
+ int num_arguments = 0;
if (decl_name.isObjCZeroArgSelector())
{
@@ -589,6 +590,7 @@
else if (decl_name.isObjCOneArgSelector())
{
selector_components.push_back (&backing_ast_context.Idents.get(decl_name.getAsString().c_str()));
+ num_arguments = 1;
}
else
{
@@ -601,10 +603,11 @@
llvm::StringRef r = sel.getNameForSlot(i);
selector_components.push_back (&backing_ast_context.Idents.get(r.str().c_str()));
+ num_arguments++;
}
}
- Selector backing_selector = backing_interface_decl->getASTContext().Selectors.getSelector(selector_components.size(), selector_components.data());
+ Selector backing_selector = backing_interface_decl->getASTContext().Selectors.getSelector(num_arguments, selector_components.data());
DeclarationName backing_decl_name = DeclarationName(backing_selector);
DeclContext::lookup_const_result lookup_result = backing_interface_decl->lookup(backing_decl_name);
@@ -619,6 +622,12 @@
Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, &backing_ast_context, *lookup_result.first);
+ if (!copied_decl)
+ {
+ log->Printf(" CAS::FOMD[%d] couldn't import method from symbols", current_id);
+ continue;
+ }
+
ObjCMethodDecl *copied_method_decl = dyn_cast (copied_decl);
if (!copied_method_decl)
From gclayton at apple.com Wed Dec 7 19:32:28 2011
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 08 Dec 2011 01:32:28 -0000
Subject: [Lldb-commits] [lldb] r146126 -
/lldb/trunk/source/Expression/ClangASTSource.cpp
Message-ID: <20111208013228.CEC6D2A6C12C@llvm.org>
Author: gclayton
Date: Wed Dec 7 19:32:28 2011
New Revision: 146126
URL: http://llvm.org/viewvc/llvm-project?rev=146126&view=rev
Log:
Don't crash due to not checking log shared pointer.
Modified:
lldb/trunk/source/Expression/ClangASTSource.cpp
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=146126&r1=146125&r2=146126&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Wed Dec 7 19:32:28 2011
@@ -624,7 +624,8 @@
if (!copied_decl)
{
- log->Printf(" CAS::FOMD[%d] couldn't import method from symbols", current_id);
+ if (log)
+ log->Printf(" CAS::FOMD[%d] couldn't import method from symbols", current_id);
continue;
}
From jmolenda at apple.com Wed Dec 7 19:59:17 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Thu, 08 Dec 2011 01:59:17 -0000
Subject: [Lldb-commits] [lldb] r146128 - in
/lldb/trunk/tools/debugserver/source/MacOSX/arm: DNBArchImpl.cpp
DNBArchImpl.h
Message-ID: <20111208015917.F211B2A6C12C@llvm.org>
Author: jmolenda
Date: Wed Dec 7 19:59:17 2011
New Revision: 146128
URL: http://llvm.org/viewvc/llvm-project?rev=146128&view=rev
Log:
Expose the DNBArchMachARM::DBG typedef, specify the type with the
class scoping in DumpDBGState()'s definiton.
Modified:
lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
Modified: lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=146128&r1=146127&r2=146128&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Wed Dec 7 19:59:17 2011
@@ -252,7 +252,7 @@
}
static void
-DumpDBGState(const DBG& dbg)
+DumpDBGState(const DNBArchMachARM::DBG& dbg)
{
uint32_t i = 0;
for (i=0; i<16; i++)
Modified: lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h?rev=146128&r1=146127&r2=146128&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h Wed Dec 7 19:59:17 2011
@@ -76,6 +76,8 @@
virtual bool DisableHardwareWatchpoint (uint32_t hw_break_index);
virtual bool StepNotComplete ();
+ typedef arm_debug_state_t DBG;
+
protected:
@@ -109,7 +111,6 @@
typedef arm_thread_state_t GPR;
typedef arm_vfp_state_t FPU;
typedef arm_exception_state_t EXC;
- typedef arm_debug_state_t DBG;
static const DNBRegisterInfo g_gpr_registers[];
static const DNBRegisterInfo g_vfp_registers[];
From scallanan at apple.com Wed Dec 7 20:08:41 2011
From: scallanan at apple.com (Sean Callanan)
Date: Thu, 08 Dec 2011 02:08:41 -0000
Subject: [Lldb-commits] [lldb] r146129 -
/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
Message-ID: <20111208020841.409852A6C12C@llvm.org>
Author: spyffe
Date: Wed Dec 7 20:08:40 2011
New Revision: 146129
URL: http://llvm.org/viewvc/llvm-project?rev=146129&view=rev
Log:
Removed function information from the symbol table
for now to fix testcases. Once we have a valid use
for the function information (i.e., once properties
returning UnknownAnyTy are allowed, once we read
return type information from the runtime, among
other uses) I will re-enable this.
Modified:
lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=146129&r1=146128&r2=146129&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Wed Dec 7 20:08:40 2011
@@ -383,7 +383,7 @@
{
if (!append)
types.Clear();
-
+
if (!m_objc_class_name_to_index.IsEmpty())
{
TypeMap::iterator iter = m_objc_class_types.find(name);
@@ -399,7 +399,7 @@
if (match == NULL)
return 0;
- const bool isForwardDecl = true;
+ const bool isForwardDecl = false;
const bool isInternal = true;
ClangASTContext &ast = GetClangASTContext();
@@ -408,59 +408,10 @@
ast.GetTranslationUnitDecl(),
isForwardDecl,
isInternal);
-
- ast.StartTagDeclarationDefinition (objc_object_type);
-
- std::string regex_str("^[-+]\\["); // Make sure it starts with "+[" or "-["
- regex_str.append(name.AsCString()); // Followed by the class name
- regex_str.append("[ \\(]"); // Followed by a space or '(' (for a category)
- RegularExpression regex(regex_str.c_str());
- Symtab::IndexCollection indices;
-
- lldb::clang_type_t unknown_type = ast.GetUnknownAnyType();
- std::vector arg_types;
-
- if (m_obj_file->GetSymtab()->FindAllSymbolsMatchingRexExAndType (regex, eSymbolTypeCode, Symtab::eDebugNo, Symtab::eVisibilityAny, indices) != 0)
- {
- for (Symtab::IndexCollection::iterator pos = indices.begin(), end = indices.end();
- pos != end;
- ++pos)
- {
- Symbol *symbol = m_obj_file->GetSymtab()->SymbolAtIndex(*pos);
-
- if (!symbol)
- continue;
-
- const char *signature = symbol->GetName().AsCString();
-
- //printf ("%s: adding '%s'\n", name.GetCString(), signature);
- int num_args = CountMethodArgs(signature);
-
- while (arg_types.size() < num_args)
- arg_types.push_back(unknown_type);
-
- bool is_variadic = false;
- unsigned type_quals = 0;
-
- lldb::clang_type_t method_type = ast.CreateFunctionType (unknown_type,
- arg_types.data(),
- num_args,
- is_variadic,
- type_quals);
-
- ast.AddMethodToObjCObjectType (objc_object_type,
- signature,
- method_type,
- eAccessPublic);
- }
- }
-
- ast.CompleteTagDeclarationDefinition (objc_object_type);
-
Declaration decl;
- lldb::TypeSP type(new Type (indices[0],
+ lldb::TypeSP type(new Type (iter->second,
this,
name,
0, // byte_size
From gclayton at apple.com Wed Dec 7 20:13:17 2011
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 08 Dec 2011 02:13:17 -0000
Subject: [Lldb-commits] [lldb] r146130 - in /lldb/trunk:
include/lldb/Core/MappedHash.h include/lldb/Symbol/Type.h
include/lldb/Symbol/Variable.h include/lldb/lldb-forward-rtti.h
include/lldb/lldb-forward.h source/Commands/CommandObjectTarget.cpp
source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/Type.cpp
source/Symbol/Variable.cpp source/Target/Target.cpp
Message-ID: <20111208021317.89C702A6C12C@llvm.org>
Author: gclayton
Date: Wed Dec 7 20:13:16 2011
New Revision: 146130
URL: http://llvm.org/viewvc/llvm-project?rev=146130&view=rev
Log:
Added a new class called lldb_private::SymbolFileType which is designed to
take a SymbolFile reference and a lldb::user_id_t and be used in objects
which represent things in debug symbols that have types where we don't need
to know the true type yet, such as in lldb_private::Variable objects. This
allows us to defer resolving the type until something is used. More specifically
this allows us to get 1000 local variables from the current function, and if
the user types "frame variable argc", we end up _only_ resolving the type for
"argc" and not for the 999 other local variables. We can expand the use of this
as needed in the future.
Modified the DWARFMappedHash class to be able to read the HashData that has
more than just the DIE offset. It currently will read the atoms in the header
definition and read the data correctly. Currently only the DIE offset and
type flags are supported. This is needed for adding type flags to the
.apple_types hash accelerator tables.
Fixed a assertion crash that would happen if we have a variable that had a
DW_AT_const_value instead of a location where "location.LocationContains_DW_OP_addr()"
would end up asserting when it tried to parse the variable location as a
DWARF opcode list.
Decreased the amount of memory that LLDB would use when evaluating an expression
by 3x - 4x for clang. There was a place in the namespace lookup code that was
parsing all namespaces with a certain name in a DWARF file instead of stopping
when it found the first match. This was causing all of the compile units with
a matching namespace to get parsed into memory and causing unnecessary memory
bloat.
Improved "Target::EvaluateExpression(...)" to not try and find a variable
when the expression contains characters that would certainly cause an expression
to need to be evaluated by the debugger.
Modified:
lldb/trunk/include/lldb/Core/MappedHash.h
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/include/lldb/Symbol/Variable.h
lldb/trunk/include/lldb/lldb-forward-rtti.h
lldb/trunk/include/lldb/lldb-forward.h
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/Type.cpp
lldb/trunk/source/Symbol/Variable.cpp
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/include/lldb/Core/MappedHash.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/MappedHash.h?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/MappedHash.h (original)
+++ lldb/trunk/include/lldb/Core/MappedHash.h Wed Dec 7 20:13:16 2011
@@ -508,6 +508,12 @@
uint32_t* hash_data_offset_ptr,
Pair &pair) const = 0;
+ const HeaderType &
+ GetHeader()
+ {
+ return m_header;
+ }
+
protected:
// Implementation agnostic information
HeaderType m_header;
Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Wed Dec 7 20:13:16 2011
@@ -19,6 +19,35 @@
#include
namespace lldb_private {
+
+class SymbolFileType :
+ public ReferenceCountedBaseVirtual,
+ public UserID
+ {
+ public:
+ SymbolFileType (SymbolFile &symbol_file, lldb::user_id_t uid) :
+ UserID (uid),
+ m_symbol_file (symbol_file)
+ {
+ }
+
+ ~SymbolFileType ()
+ {
+ }
+
+ Type *
+ operator->()
+ {
+ return GetType ();
+ }
+
+ Type *
+ GetType ();
+
+ protected:
+ SymbolFile &m_symbol_file;
+ lldb::TypeSP m_type_sp;
+ };
class Type :
public ReferenceCountedBaseVirtual,
Modified: lldb/trunk/include/lldb/Symbol/Variable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Variable.h?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Variable.h (original)
+++ lldb/trunk/include/lldb/Symbol/Variable.h Wed Dec 7 20:13:16 2011
@@ -30,7 +30,7 @@
Variable (lldb::user_id_t uid,
const char *name,
const char *mangled, // The mangled variable name for variables in namespaces
- Type *type,
+ const lldb::SymbolFileTypeSP &symfile_type_sp,
lldb::ValueType scope,
SymbolContextScope *owner_scope,
Declaration* decl,
@@ -81,16 +81,7 @@
NameMatches (const RegularExpression& regex) const;
Type *
- GetType()
- {
- return m_type;
- }
-
- const Type *
- GetType() const
- {
- return m_type;
- }
+ GetType();
lldb::ValueType
GetScope() const
@@ -169,7 +160,7 @@
protected:
ConstString m_name; // The basename of the variable (no namespaces)
Mangled m_mangled; // The mangled name of hte variable
- Type *m_type; // The type pointer of the variable (int, struct, class, etc)
+ lldb::SymbolFileTypeSP m_symfile_type_sp; // The type pointer of the variable (int, struct, class, etc)
lldb::ValueType m_scope; // global, parameter, local
SymbolContextScope *m_owner_scope; // The symbol file scope that this variable was defined in
Declaration m_declaration; // Declaration location for this item.
Modified: lldb/trunk/include/lldb/lldb-forward-rtti.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward-rtti.h?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward-rtti.h (original)
+++ lldb/trunk/include/lldb/lldb-forward-rtti.h Wed Dec 7 20:13:16 2011
@@ -70,6 +70,7 @@
typedef SharedPtr::Type StringSummaryFormatSP;
typedef SharedPtr::Type SummaryFormatSP;
typedef SharedPtr::Type SymbolFileSP;
+ typedef IntrusiveSharedPtr::Type SymbolFileTypeSP;
typedef SharedPtr::Type SymbolContextSpecifierSP;
typedef SharedPtr::Type SyntheticChildrenSP;
typedef SharedPtr::Type SyntheticChildrenFrontEndSP;
Modified: lldb/trunk/include/lldb/lldb-forward.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward.h (original)
+++ lldb/trunk/include/lldb/lldb-forward.h Wed Dec 7 20:13:16 2011
@@ -158,6 +158,7 @@
class SymbolContextScope;
class SymbolContextSpecifier;
class SymbolFile;
+class SymbolFileType;
class SymbolVendor;
class Symtab;
class SyntheticChildren;
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Wed Dec 7 20:13:16 2011
@@ -1524,47 +1524,35 @@
{
if (module && name_cstr && name_cstr[0])
{
- /*SymbolContextList sc_list;
-
- SymbolVendor *symbol_vendor = module->GetSymbolVendor();
- if (symbol_vendor)
- {*/
- TypeList type_list;
- uint32_t num_matches = 0;
- SymbolContext sc;
- // if (name_is_regex)
- // {
- // RegularExpression name_regex (name_cstr);
- // num_matches = symbol_vendor->FindFunctions(sc, name_regex, true, UINT32_MAX, type_list);
- // }
- // else
- // {
- ConstString name(name_cstr);
- num_matches = module->FindTypes(sc, name, NULL, true, UINT32_MAX, type_list);
- // }
-
- if (num_matches)
- {
- strm.Indent ();
- strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : "");
- DumpFullpath (strm, &module->GetFileSpec(), 0);
- strm.PutCString(":\n");
- const uint32_t num_types = type_list.GetSize();
- for (uint32_t i=0; iGetClangFullType ();
- type_sp->GetDescription (&strm, eDescriptionLevelFull, true);
- }
- strm.EOL();
+ TypeList type_list;
+ const uint32_t max_num_matches = 1;
+ uint32_t num_matches = 0;
+ SymbolContext sc;
+
+ ConstString name(name_cstr);
+ num_matches = module->FindTypes(sc, name, NULL, true, max_num_matches, type_list);
+
+ if (num_matches)
+ {
+ strm.Indent ();
+ strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : "");
+ DumpFullpath (strm, &module->GetFileSpec(), 0);
+ strm.PutCString(":\n");
+ const uint32_t num_types = type_list.GetSize();
+ for (uint32_t i=0; iGetClangFullType ();
+ type_sp->GetDescription (&strm, eDescriptionLevelFull, true);
}
+ strm.EOL();
}
- return num_matches;
- //}
+ }
+ return num_matches;
}
return 0;
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Wed Dec 7 20:13:16 2011
@@ -472,6 +472,27 @@
return die_offset;
}
+uint64_t
+DWARFFormValue::Reference (dw_offset_t base_offset) const
+{
+ uint64_t die_offset = m_value.value.uval;
+ switch (m_form)
+ {
+ case DW_FORM_ref1:
+ case DW_FORM_ref2:
+ case DW_FORM_ref4:
+ case DW_FORM_ref8:
+ case DW_FORM_ref_udata:
+ die_offset += base_offset;
+ break;
+
+ default:
+ break;
+ }
+
+ return die_offset;
+}
+
//----------------------------------------------------------------------
// Resolve any compile unit specific references so that we don't need
// the compile unit at a later time in order to work with the form
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h Wed Dec 7 20:13:16 2011
@@ -10,9 +10,10 @@
#ifndef SymbolFileDWARF_DWARFFormValue_h_
#define SymbolFileDWARF_DWARFFormValue_h_
-#include "SymbolFileDWARF.h"
#include // for NULL
+class DWARFCompileUnit;
+
class DWARFFormValue
{
public:
@@ -52,6 +53,7 @@
bool IsInlinedCStr() const { return (m_value.data != NULL) && m_value.data == (uint8_t*)m_value.value.cstr; }
const uint8_t* BlockData() const;
uint64_t Reference(const DWARFCompileUnit* cu) const;
+ uint64_t Reference (dw_offset_t offset) const;
bool ResolveCompileUnitReferences(const DWARFCompileUnit* cu);
uint64_t Unsigned() const { return m_value.value.uval; }
void SetUnsigned(uint64_t uval) { m_value.value.uval = uval; }
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h Wed Dec 7 20:13:16 2011
@@ -11,17 +11,55 @@
#define SymbolFileDWARF_HashedNameToDIE_h_
#include
+
+#include "DWARFFormValue.h"
+
#include "lldb/lldb-defines.h"
#include "lldb/Core/dwarf.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/MappedHash.h"
+
class SymbolFileDWARF;
+class DWARFCompileUnit;
+class DWARFDebugInfoEntry;
struct DWARFMappedHash
{
+ struct DIEInfo
+ {
+ dw_offset_t offset; // The DIE offset
+ uint32_t type_flags; // Any flags for this DIEInfo
+
+ DIEInfo (dw_offset_t _offset = DW_INVALID_OFFSET,
+ uint32_t _type_flags = 0) :
+ offset(_offset),
+ type_flags (_type_flags)
+ {
+ }
+
+ void
+ Clear()
+ {
+ offset = DW_INVALID_OFFSET;
+ type_flags = 0;
+ }
+ };
+
+ typedef std::vector DIEInfoArray;
typedef std::vector DIEArray;
+ static void
+ ExtractDIEArray (const DIEInfoArray &die_info_array,
+ DIEArray &die_offsets)
+ {
+ const size_t count = die_info_array.size();
+ for (size_t i=0; i AtomArray;
+ static uint32_t
+ GetTypeFlags (SymbolFileDWARF *dwarf2Data,
+ const DWARFCompileUnit* cu,
+ const DWARFDebugInfoEntry* die);
+
static const char *
GetAtomTypeName (uint16_t atom)
{
@@ -66,14 +140,18 @@
// DIE offset base so die offsets in hash_data can be CU relative
dw_offset_t die_base_offset;
AtomArray atoms;
+ size_t min_hash_data_byte_size;
Prologue (dw_offset_t _die_base_offset = 0) :
- die_base_offset (_die_base_offset)
+ die_base_offset (_die_base_offset),
+ atoms(),
+ min_hash_data_byte_size(0)
{
// Define an array of DIE offsets by first defining an array,
// and then define the atom type for the array, in this case
// we have an array of DIE offsets
- atoms.push_back (Atom(eAtomTypeDIEOffset, DW_FORM_data4));
+ AppendAtom (eAtomTypeDIEOffset, DW_FORM_data4);
+ min_hash_data_byte_size = 4;
}
virtual ~Prologue()
@@ -87,12 +165,60 @@
atoms.clear();
}
+ void
+ AppendAtom (AtomType type, dw_form_t form)
+ {
+ atoms.push_back (Atom(type, form));
+ switch (form)
+ {
+ case DW_FORM_indirect:
+ case DW_FORM_exprloc:
+ case DW_FORM_flag_present:
+ case DW_FORM_ref_sig8:
+ assert (!"Unhandled atom form");
+ break;
+
+ case DW_FORM_string:
+ case DW_FORM_block:
+ case DW_FORM_block1:
+ case DW_FORM_flag:
+ case DW_FORM_data1:
+ case DW_FORM_ref1:
+ case DW_FORM_sdata:
+ case DW_FORM_udata:
+ case DW_FORM_sec_offset:
+ case DW_FORM_ref_udata:
+ min_hash_data_byte_size += 1;
+ break;
+ case DW_FORM_block2:
+ case DW_FORM_data2:
+ case DW_FORM_ref2:
+ min_hash_data_byte_size += 2;
+ break;
+ case DW_FORM_block4:
+ case DW_FORM_data4:
+ case DW_FORM_ref4:
+ case DW_FORM_addr:
+ case DW_FORM_ref_addr:
+ case DW_FORM_strp:
+ min_hash_data_byte_size += 4;
+ break;
+ case DW_FORM_data8:
+ case DW_FORM_ref8:
+ min_hash_data_byte_size += 8;
+ break;
+
+ }
+ }
+
// void
// Dump (std::ostream* ostrm_ptr);
uint32_t
Read (const lldb_private::DataExtractor &data, uint32_t offset)
{
+ atoms.clear();
+
die_base_offset = data.GetU32 (&offset);
const uint32_t atom_count = data.GetU32 (&offset);
@@ -103,16 +229,15 @@
/* do nothing */;
// Hardcode to the only know value for now.
- atoms.push_back (Atom(eAtomTypeDIEOffset, DW_FORM_data4));
+ AppendAtom (eAtomTypeDIEOffset, DW_FORM_data4);
}
else
{
- Atom atom;
for (uint32_t i=0; i
@@ -147,6 +279,11 @@
return header_data.GetByteSize();
}
+ size_t
+ GetHashDataByteSize ()
+ {
+ return header_data.GetHashDataByteSize();
+ }
// virtual void
// Dump (std::ostream* ostrm_ptr);
@@ -161,9 +298,89 @@
}
return offset;
}
- //
- // virtual void
- // Write (BinaryStreamBuf &s);
+
+ bool
+ Read (const lldb_private::DataExtractor &data,
+ uint32_t *offset_ptr,
+ DIEInfo &hash_data) const
+ {
+ const size_t num_atoms = header_data.atoms.size();
+ if (num_atoms == 0)
+ return false;
+
+ for (size_t i=0; i 0)
+ strm.PutCString (", ");
+
+ DWARFFormValue form_value (header_data.atoms[i].form);
+ switch (header_data.atoms[i].type)
+ {
+ case eAtomTypeDIEOffset: // DIE offset, check form for encoding
+ strm.Printf ("0x%8.8x", hash_data.offset);
+ break;
+
+ case eAtomTypeTypeFlags: // Flags from enum TypeFlags
+ strm.Printf ("0x%2.2x ( type = ", hash_data.type_flags);
+ switch (hash_data.type_flags & eTypeFlagClassMask)
+ {
+ case eTypeClassInvalid: strm.PutCString ("invalid"); break;
+ case eTypeClassOther: strm.PutCString ("other"); break;
+ case eTypeClassBuiltIn: strm.PutCString ("built-in"); break;
+ case eTypeClassClassOrStruct: strm.PutCString ("class-struct"); break;
+ case eTypeClassClassOBJC: strm.PutCString ("class-objc"); break;
+ case eTypeClassEnum: strm.PutCString ("enum"); break;
+ case eTypeClassTypedef: strm.PutCString ("typedef"); break;
+ case eTypeClassUnion: strm.PutCString ("union"); break;
+ default: strm.PutCString ("???"); break;
+ }
+
+ if (hash_data.type_flags & ~eTypeFlagClassMask)
+ {
+ strm.PutCString (", flags =");
+ if (hash_data.type_flags & eTypeFlagNameIsFullyQualified)
+ strm.PutCString (" qualified");
+
+ if (hash_data.type_flags & eTypeFlagClassIsImplementation)
+ strm.PutCString (" implementation");
+ }
+ strm.PutCString (" )");
+ break;
+
+ default:
+ strm.Printf ("AtomType(0x%x)", header_data.atoms[i].type);
+ break;
+ }
+ }
+ }
+
};
// class ExportTable
@@ -210,7 +427,7 @@
// };
//
// // Map uniqued .debug_str offset to the corresponding DIE offsets
-// typedef std::map NameInfo;
+// typedef std::map NameInfo;
// // Map a name hash to one or more name infos
// typedef std::map BucketEntry;
//
@@ -226,14 +443,14 @@
// A class for reading and using a saved hash table from a block of data
// in memory
- class MemoryTable : public MappedHash::MemoryTable
+ class MemoryTable : public MappedHash::MemoryTable
{
public:
MemoryTable (lldb_private::DataExtractor &table_data,
const lldb_private::DataExtractor &string_table,
const char *name) :
- MappedHash::MemoryTable (table_data),
+ MappedHash::MemoryTable (table_data),
m_data (table_data),
m_string_table (string_table),
m_name (name)
@@ -270,14 +487,18 @@
return eResultError;
const uint32_t count = m_data.GetU32 (hash_data_offset_ptr);
- const uint32_t data_size = count * sizeof(uint32_t);
+ const uint32_t data_size = count * m_header.header_data.GetHashDataByteSize();
if (count > 0 && m_data.ValidOffsetForDataOfSize (*hash_data_offset_ptr, data_size))
{
if (strcmp (name, strp_cstr) == 0)
{
pair.value.clear();
for (uint32_t i=0; i 0 && m_data.ValidOffsetForDataOfSize (*hash_data_offset_ptr, data_size))
{
if (regex.Execute(strp_cstr))
{
for (uint32_t i=0; iAppendAllDIEsThatMatchingRegex (regex, die_offsets);
+ {
+ DWARFMappedHash::DIEInfoArray hash_data_array;
+ if (m_apple_names_ap->AppendAllDIEsThatMatchingRegex (regex, hash_data_array))
+ DWARFMappedHash::ExtractDIEArray (hash_data_array, die_offsets);
+ }
}
else
{
@@ -2556,8 +2560,10 @@
SymbolContextList& sc_list)
{
DIEArray die_offsets;
- if (memory_table.AppendAllDIEsThatMatchingRegex (regex, die_offsets))
+ DWARFMappedHash::DIEInfoArray hash_data_array;
+ if (memory_table.AppendAllDIEsThatMatchingRegex (regex, hash_data_array))
{
+ DWARFMappedHash::ExtractDIEArray (hash_data_array, die_offsets);
ParseFunctions (die_offsets, sc_list);
}
}
@@ -2965,7 +2971,12 @@
}
uint32_t
-SymbolFileDWARF::FindTypes(const SymbolContext& sc, const ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types)
+SymbolFileDWARF::FindTypes (const SymbolContext& sc,
+ const ConstString &name,
+ const lldb_private::ClangNamespaceDecl *namespace_decl,
+ bool append,
+ uint32_t max_matches,
+ TypeList& types)
{
DWARFDebugInfo* info = DebugInfo();
if (info == NULL)
@@ -3113,6 +3124,7 @@
{
namespace_decl.SetASTContext (GetClangASTContext().getASTContext());
namespace_decl.SetNamespaceDecl (clang_namespace_decl);
+ break;
}
}
else
@@ -3929,8 +3941,18 @@
{
if (m_apple_types_ap.get())
{
- const char *name_cstr = type_name.GetCString();
- m_apple_types_ap->FindByName (name_cstr, die_offsets);
+ if (m_apple_types_ap->GetHeader().header_data.atoms.size() > 1)
+ {
+ std::string qualified_name;
+ const char *qualified_cstr = die->GetQualifiedName(this, cu, qualified_name);
+ DWARFMappedHash::DIEInfoArray hash_data_array;
+ m_apple_types_ap->FindByName (qualified_cstr, hash_data_array);
+ DWARFMappedHash::ExtractDIEArray (hash_data_array, die_offsets);
+ }
+ else
+ {
+ m_apple_types_ap->FindByName (type_name.GetCString(), die_offsets);
+ }
}
}
else
@@ -5308,9 +5330,15 @@
if (m_using_apple_tables)
{
if (m_apple_names_ap.get())
- m_apple_names_ap->AppendAllDIEsInRange (dwarf_cu->GetOffset(),
- dwarf_cu->GetNextCompileUnitOffset(),
- die_offsets);
+ {
+ DWARFMappedHash::DIEInfoArray hash_data_array;
+ if (m_apple_names_ap->AppendAllDIEsInRange (dwarf_cu->GetOffset(),
+ dwarf_cu->GetNextCompileUnitOffset(),
+ hash_data_array))
+ {
+ DWARFMappedHash::ExtractDIEArray (hash_data_array, die_offsets);
+ }
+ }
}
else
{
@@ -5387,7 +5415,7 @@
const char *mangled = NULL;
Declaration decl;
uint32_t i;
- Type *var_type = NULL;
+ lldb::user_id_t type_uid = LLDB_INVALID_UID;
DWARFExpression location;
bool is_external = false;
bool is_artificial = false;
@@ -5407,7 +5435,7 @@
case DW_AT_decl_column: decl.SetColumn(form_value.Unsigned()); break;
case DW_AT_name: name = form_value.AsCString(&get_debug_str_data()); break;
case DW_AT_MIPS_linkage_name: mangled = form_value.AsCString(&get_debug_str_data()); break;
- case DW_AT_type: var_type = ResolveTypeUID(form_value.Reference(dwarf_cu)); break;
+ case DW_AT_type: type_uid = form_value.Reference(dwarf_cu); break;
case DW_AT_external: is_external = form_value.Unsigned() != 0; break;
case DW_AT_const_value:
location_is_const_value_data = true;
@@ -5457,8 +5485,6 @@
if (location.IsValid())
{
- assert(var_type != DIE_IS_BEING_PARSED);
-
ValueType scope = eValueTypeInvalid;
const DWARFDebugInfoEntry *sc_parent_die = GetParentSymbolContextDIE(die);
@@ -5477,64 +5503,74 @@
// then we can correctly classify our variables.
if (tag == DW_TAG_formal_parameter)
scope = eValueTypeVariableArgument;
- else if (location.LocationContains_DW_OP_addr ())
+ else
{
- if (is_external)
- {
- if (m_debug_map_symfile)
- {
- // When leaving the DWARF in the .o files on darwin,
- // when we have a global variable that wasn't initialized,
- // the .o file might not have allocated a virtual
- // address for the global variable. In this case it will
- // have created a symbol for the global variable
- // that is undefined and external and the value will
- // be the byte size of the variable. When we do the
- // address map in SymbolFileDWARFDebugMap we rely on
- // having an address, we need to do some magic here
- // so we can get the correct address for our global
- // variable. The address for all of these entries
- // will be zero, and there will be an undefined symbol
- // in this object file, and the executable will have
- // a matching symbol with a good address. So here we
- // dig up the correct address and replace it in the
- // location for the variable, and set the variable's
- // symbol context scope to be that of the main executable
- // so the file address will resolve correctly.
- if (location.LocationContains_DW_OP_addr (0))
- {
-
- // we have a possible uninitialized extern global
- Symtab *symtab = m_obj_file->GetSymtab();
- if (symtab)
+ // Check if the location has a DW_OP_addr with any address value...
+ addr_t location_has_op_addr = false;
+ if (!location_is_const_value_data)
+ location_has_op_addr = location.LocationContains_DW_OP_addr ();
+
+ if (location_has_op_addr)
+ {
+ if (is_external)
+ {
+ scope = eValueTypeVariableGlobal;
+
+ if (m_debug_map_symfile)
+ {
+ // When leaving the DWARF in the .o files on darwin,
+ // when we have a global variable that wasn't initialized,
+ // the .o file might not have allocated a virtual
+ // address for the global variable. In this case it will
+ // have created a symbol for the global variable
+ // that is undefined and external and the value will
+ // be the byte size of the variable. When we do the
+ // address map in SymbolFileDWARFDebugMap we rely on
+ // having an address, we need to do some magic here
+ // so we can get the correct address for our global
+ // variable. The address for all of these entries
+ // will be zero, and there will be an undefined symbol
+ // in this object file, and the executable will have
+ // a matching symbol with a good address. So here we
+ // dig up the correct address and replace it in the
+ // location for the variable, and set the variable's
+ // symbol context scope to be that of the main executable
+ // so the file address will resolve correctly.
+ if (location.LocationContains_DW_OP_addr (0))
{
- ConstString const_name(name);
- Symbol *undefined_symbol = symtab->FindFirstSymbolWithNameAndType (const_name,
- eSymbolTypeUndefined,
- Symtab::eDebugNo,
- Symtab::eVisibilityExtern);
- if (undefined_symbol)
+ // we have a possible uninitialized extern global
+ Symtab *symtab = m_obj_file->GetSymtab();
+ if (symtab)
{
- ObjectFile *debug_map_objfile = m_debug_map_symfile->GetObjectFile();
- if (debug_map_objfile)
+ ConstString const_name(name);
+ Symbol *undefined_symbol = symtab->FindFirstSymbolWithNameAndType (const_name,
+ eSymbolTypeUndefined,
+ Symtab::eDebugNo,
+ Symtab::eVisibilityExtern);
+
+ if (undefined_symbol)
{
- Symtab *debug_map_symtab = debug_map_objfile->GetSymtab();
- Symbol *defined_symbol = debug_map_symtab->FindFirstSymbolWithNameAndType (const_name,
- eSymbolTypeData,
- Symtab::eDebugYes,
- Symtab::eVisibilityExtern);
- if (defined_symbol)
+ ObjectFile *debug_map_objfile = m_debug_map_symfile->GetObjectFile();
+ if (debug_map_objfile)
{
- const AddressRange *defined_range = defined_symbol->GetAddressRangePtr();
- if (defined_range)
+ Symtab *debug_map_symtab = debug_map_objfile->GetSymtab();
+ Symbol *defined_symbol = debug_map_symtab->FindFirstSymbolWithNameAndType (const_name,
+ eSymbolTypeData,
+ Symtab::eDebugYes,
+ Symtab::eVisibilityExtern);
+ if (defined_symbol)
{
- const addr_t defined_addr = defined_range->GetBaseAddress().GetFileAddress();
- if (defined_addr != LLDB_INVALID_ADDRESS)
+ const AddressRange *defined_range = defined_symbol->GetAddressRangePtr();
+ if (defined_range)
{
- if (location.Update_DW_OP_addr (defined_addr))
+ const addr_t defined_addr = defined_range->GetBaseAddress().GetFileAddress();
+ if (defined_addr != LLDB_INVALID_ADDRESS)
{
- symbol_context_scope = defined_symbol;
+ if (location.Update_DW_OP_addr (defined_addr))
+ {
+ symbol_context_scope = defined_symbol;
+ }
}
}
}
@@ -5544,13 +5580,16 @@
}
}
}
- scope = eValueTypeVariableGlobal;
+ else
+ {
+ scope = eValueTypeVariableStatic;
+ }
}
else
- scope = eValueTypeVariableStatic;
+ {
+ scope = eValueTypeVariableLocal;
+ }
}
- else
- scope = eValueTypeVariableLocal;
if (symbol_context_scope == NULL)
{
@@ -5578,7 +5617,7 @@
var_sp.reset (new Variable (MakeUserID(die->GetOffset()),
name,
mangled,
- var_type,
+ SymbolFileTypeSP (new SymbolFileType(*this, type_uid)),
scope,
symbol_context_scope,
&decl,
Modified: lldb/trunk/source/Symbol/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Type.cpp?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Type.cpp (original)
+++ lldb/trunk/source/Symbol/Type.cpp Wed Dec 7 20:13:16 2011
@@ -30,6 +30,15 @@
using namespace lldb;
using namespace lldb_private;
+Type *
+SymbolFileType::GetType ()
+{
+ if (!m_type_sp)
+ m_type_sp = m_symbol_file.ResolveTypeUID (GetID());
+ return m_type_sp.get();
+}
+
+
Type::Type
(
lldb::user_id_t uid,
Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Wed Dec 7 20:13:16 2011
@@ -36,7 +36,7 @@
lldb::user_id_t uid,
const char *name,
const char *mangled, // The mangled variable name for variables in namespaces
- Type *type,
+ const lldb::SymbolFileTypeSP &symfile_type_sp,
ValueType scope,
SymbolContextScope *context,
Declaration* decl_ptr,
@@ -47,7 +47,7 @@
UserID(uid),
m_name(name),
m_mangled (mangled, true),
- m_type(type),
+ m_symfile_type_sp(symfile_type_sp),
m_scope(scope),
m_owner_scope(context),
m_declaration(decl_ptr),
@@ -81,6 +81,14 @@
return m_mangled.NameMatches (regex);
}
+Type *
+Variable::GetType()
+{
+ if (m_symfile_type_sp)
+ return m_symfile_type_sp->GetType();
+ return NULL;
+}
+
void
Variable::Dump(Stream *s, bool show_context) const
{
@@ -91,11 +99,15 @@
if (m_name)
*s << ", name = \"" << m_name << "\"";
- if (m_type != NULL)
+ if (m_symfile_type_sp)
{
- *s << ", type = {" << m_type->GetID() << "} " << (void*)m_type << " (";
- m_type->DumpTypeName(s);
- s->PutChar(')');
+ Type *type = m_symfile_type_sp->GetType();
+ if (type)
+ {
+ *s << ", type = {" << type->GetID() << "} " << (void*)type << " (";
+ type->DumpTypeName(s);
+ s->PutChar(')');
+ }
}
if (m_scope != eValueTypeInvalid)
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=146130&r1=146129&r2=146130&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed Dec 7 20:13:16 2011
@@ -1471,13 +1471,19 @@
ExecutionResults execution_results = eExecutionSetupError;
result_valobj_sp.reset();
-
+
+ if (expr_cstr == NULL || expr_cstr[0] == '\0')
+ return execution_results;
+
// We shouldn't run stop hooks in expressions.
// Be sure to reset this if you return anywhere within this function.
bool old_suppress_value = m_suppress_stop_hooks;
m_suppress_stop_hooks = true;
ExecutionContext exe_ctx;
+
+ const size_t expr_cstr_len = ::strlen (expr_cstr);
+
if (frame)
{
frame->CalculateExecutionContext(exe_ctx);
@@ -1486,11 +1492,17 @@
StackFrame::eExpressionPathOptionsNoFragileObjcIvar |
StackFrame::eExpressionPathOptionsNoSyntheticChildren;
lldb::VariableSP var_sp;
- result_valobj_sp = frame->GetValueForVariableExpressionPath (expr_cstr,
- use_dynamic,
- expr_path_options,
- var_sp,
- error);
+
+ // Make sure we don't have any things that we know a variable expression
+ // won't be able to deal with before calling into it
+ if (::strcspn (expr_cstr, "()+*&|!~<=/^%,?") == expr_cstr_len)
+ {
+ result_valobj_sp = frame->GetValueForVariableExpressionPath (expr_cstr,
+ use_dynamic,
+ expr_path_options,
+ var_sp,
+ error);
+ }
}
else if (m_process_sp)
{
From scallanan at apple.com Wed Dec 7 20:51:25 2011
From: scallanan at apple.com (Sean Callanan)
Date: Thu, 08 Dec 2011 02:51:25 -0000
Subject: [Lldb-commits] [lldb] r146133 -
/lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h
Message-ID: <20111208025125.4D6032A6C12C@llvm.org>
Author: spyffe
Date: Wed Dec 7 20:51:25 2011
New Revision: 146133
URL: http://llvm.org/viewvc/llvm-project?rev=146133&view=rev
Log:
Tightened up the variable list to deal with
variables that might not have valid names.
Modified:
lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h
Modified: lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h?rev=146133&r1=146132&r2=146133&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h Wed Dec 7 20:51:25 2011
@@ -315,6 +315,8 @@
{
var_sp = GetVariableAtIndex(index);
const char *var_name_cstr = var_sp->GetName().GetCString();
+ if (!var_name_cstr || !name)
+ continue;
if (::strcmp (var_name_cstr, name) == 0)
return var_sp;
}
From jingham at apple.com Wed Dec 7 20:53:11 2011
From: jingham at apple.com (Jim Ingham)
Date: Thu, 08 Dec 2011 02:53:11 -0000
Subject: [Lldb-commits] [lldb] r146134 - in /lldb/trunk:
source/Symbol/ClangASTContext.cpp
test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
test/lang/objc/objc-ivar-offsets/main.m
test/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h
Message-ID: <20111208025311.255B02A6C12C@llvm.org>
Author: jingham
Date: Wed Dec 7 20:53:10 2011
New Revision: 146134
URL: http://llvm.org/viewvc/llvm-project?rev=146134&view=rev
Log:
Get the bit-field offset & size for ObjC ivars that are bitfields.
lldb expression evaluation doesn't handle bit fields in ObjC classes properly
Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
lldb/trunk/test/lang/objc/objc-ivar-offsets/main.m
lldb/trunk/test/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=146134&r1=146133&r2=146134&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Wed Dec 7 20:53:10 2011
@@ -3458,7 +3458,7 @@
{
if (child_idx == idx)
{
- const ObjCIvarDecl* ivar_decl = *ivar_pos;
+ ObjCIvarDecl* ivar_decl = *ivar_pos;
QualType ivar_qual_type(ivar_decl->getType());
@@ -3487,12 +3487,26 @@
}
}
+ // Setting this to UINT32_MAX to make sure we don't compute it twice...
+ bit_offset = UINT32_MAX;
+
if (child_byte_offset == LLDB_INVALID_IVAR_OFFSET)
{
bit_offset = interface_layout.getFieldOffset (child_idx - superclass_idx);
child_byte_offset = bit_offset / 8;
}
-
+
+ // Note, the ObjC Ivar Byte offset is just that, it doesn't account for the bit offset
+ // of a bitfield within its containing object. So regardless of where we get the byte
+ // offset from, we still need to get the bit offset for bitfields from the layout.
+
+ if (ClangASTContext::FieldIsBitfield (ast, ivar_decl, child_bitfield_bit_size))
+ {
+ if (bit_offset == UINT32_MAX)
+ bit_offset = interface_layout.getFieldOffset (child_idx - superclass_idx);
+
+ child_bitfield_bit_offset = bit_offset % 8;
+ }
return ivar_qual_type.getAsOpaquePtr();
}
++child_idx;
Modified: lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py?rev=146134&r1=146133&r2=146134&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py (original)
+++ lldb/trunk/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py Wed Dec 7 20:53:10 2011
@@ -56,18 +56,34 @@
# Test the value object value for BaseClass->_backed_int
+ error = lldb.SBError()
+
mine_backed_int = mine.GetChildMemberWithName ("_backed_int")
self.assertTrue(mine_backed_int, "Found mine->backed_int local variable.")
- backed_value = int (mine_backed_int.GetValue (), 0)
+ backed_value = mine_backed_int.GetValueAsSigned (error)
+ self.assertTrue (error.Success())
self.assertTrue (backed_value == 1111)
# Test the value object value for DerivedClass->_derived_backed_int
mine_derived_backed_int = mine.GetChildMemberWithName ("_derived_backed_int")
self.assertTrue(mine_derived_backed_int, "Found mine->derived_backed_int local variable.")
- derived_backed_value = int (mine_derived_backed_int.GetValue (), 0)
+ derived_backed_value = mine_derived_backed_int.GetValueAsSigned (error)
+ self.assertTrue (error.Success())
self.assertTrue (derived_backed_value == 3333)
-
+
+ # Make sure we also get bit-field offsets correct:
+
+ mine_flag2 = mine.GetChildMemberWithName ("flag2")
+ self.assertTrue(mine_flag2, "Found mine->flag2 local variable.")
+ flag2_value = int (mine_flag2.GetValue (), 0)
+ self.assertTrue (flag2_value == 7)
+
+ # GetValueAsUnsigned fails for bit-fields:
+# flag2_value = mine_flag2.GetValueAsUnsigned (error)
+# self.assertTrue (error.Success())
+# self.assertTrue (flag2_value == 7)
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
Modified: lldb/trunk/test/lang/objc/objc-ivar-offsets/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-ivar-offsets/main.m?rev=146134&r1=146133&r2=146134&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/objc-ivar-offsets/main.m (original)
+++ lldb/trunk/test/lang/objc/objc-ivar-offsets/main.m Wed Dec 7 20:53:10 2011
@@ -8,6 +8,8 @@
mine.unbacked_int = 2222;
mine.derived_backed_int = 3333;
mine.derived_unbacked_int = 4444;
+ mine->flag1 = 1;
+ mine->flag2 = 7;
return 0; // Set breakpoint here.
}
Modified: lldb/trunk/test/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h?rev=146134&r1=146133&r2=146134&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h (original)
+++ lldb/trunk/test/lang/objc/objc-ivar-offsets/objc-ivar-offsets.h Wed Dec 7 20:53:10 2011
@@ -17,7 +17,11 @@
#if !__OBJC2__
int _derived_unbacked_int;
#endif
+ @public
+ uint32_t flag1 : 1;
+ uint32_t flag2 : 3;
}
+
@property int derived_backed_int;
@property int derived_unbacked_int;
@end
From gclayton at apple.com Wed Dec 7 21:19:36 2011
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 08 Dec 2011 03:19:36 -0000
Subject: [Lldb-commits] [lldb] r146135 - in
/lldb/trunk/tools/debugserver/source/MacOSX: i386/DNBArchImplI386.cpp
i386/DNBArchImplI386.h x86_64/DNBArchImplX86_64.cpp
x86_64/DNBArchImplX86_64.h
Message-ID: <20111208031936.D1CDA2A6C12C@llvm.org>
Author: gclayton
Date: Wed Dec 7 21:19:36 2011
New Revision: 146135
URL: http://llvm.org/viewvc/llvm-project?rev=146135&view=rev
Log:
Fixed detection of AVX on darwin now that our kernel supports it.
Modified:
lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
Modified: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=146135&r1=146134&r2=146135&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Wed Dec 7 21:19:36 2011
@@ -27,6 +27,8 @@
debugStateOn
};
+extern "C" bool CPUHasAVX(); // Defined over in DNBArchImplX86_64.cpp
+
static debugState sFPUDebugState = debugStateUnknown;
static debugState sAVXForceState = debugStateUnknown;
@@ -252,9 +254,6 @@
gdb_ymm7 = gdb_xmm7
};
-// AVX support isn't working at all from user space, so disable it for now.
-enum DNBArchImplI386::AVXPresence DNBArchImplI386::s_has_avx = DNBArchImplI386::kAVXNotPresent;
-
uint64_t
DNBArchImplI386::GetPC(uint64_t failValue)
{
Modified: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h?rev=146135&r1=146134&r2=146135&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h Wed Dec 7 21:19:36 2011
@@ -223,15 +223,6 @@
static const DNBRegisterSetInfo *
GetRegisterSetInfo(nub_size_t *num_reg_sets);
- static bool
- CPUHasAVX()
- {
- if (s_has_avx == kAVXUnknown)
- s_has_avx = (::HasAVX() ? kAVXPresent : kAVXNotPresent);
-
- return (s_has_avx == kAVXPresent);
- }
-
// Helper functions for watchpoint manipulations.
static void SetWatchpoint(DBG &debug_state, uint32_t hw_index, nub_addr_t addr, nub_size_t size, bool read, bool write);
static void ClearWatchpoint(DBG &debug_state, uint32_t hw_index);
@@ -242,12 +233,6 @@
MachThread *m_thread;
State m_state;
-
- static enum AVXPresence {
- kAVXPresent,
- kAVXNotPresent,
- kAVXUnknown
- } s_has_avx;
};
#endif // #if defined (__i386__) || defined (__x86_64__)
Modified: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=146135&r1=146134&r2=146135&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Wed Dec 7 21:19:36 2011
@@ -14,6 +14,8 @@
#if defined (__i386__) || defined (__x86_64__)
#include
+#include
+#include
#include "MacOSX/x86_64/DNBArchImplX86_64.h"
#include "DNBLog.h"
@@ -65,7 +67,54 @@
#define FORCE_AVX_REGS (0)
#endif
-enum DNBArchImplX86_64::AVXPresence DNBArchImplX86_64::s_has_avx = DNBArchImplX86_64::kAVXNotPresent;
+
+extern "C" bool
+CPUHasAVX()
+{
+ enum AVXPresence
+ {
+ eAVXUnknown = -1,
+ eAVXNotPresent = 0,
+ eAVXPresent = 1
+ };
+
+ static AVXPresence g_has_avx = eAVXUnknown;
+ if (g_has_avx == eAVXUnknown)
+ {
+ g_has_avx = eAVXNotPresent;
+
+ // Only xnu-2020 or later has AVX support, any versions before
+ // this have a busted thread_get_state RPC where it would truncate
+ // the thread state buffer (). So we need to
+ // verify the kernel version number manually or disable AVX support.
+ int mib[2];
+ char buffer[1024];
+ size_t length = sizeof(buffer);
+ uint64_t xnu_version = 0;
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_VERSION;
+ int err = ::sysctl(mib, 2, &buffer, &length, NULL, 0);
+ if (err == 0)
+ {
+ const char *xnu = strstr (buffer, "xnu-");
+ if (xnu)
+ {
+ const char *xnu_version_cstr = xnu + 4;
+ xnu_version = strtoull (xnu_version_cstr, NULL, 0);
+ if (xnu_version >= 2020 && xnu_version != ULLONG_MAX)
+ {
+ if (::HasAVX())
+ {
+ g_has_avx = eAVXPresent;
+ }
+ }
+ }
+ }
+ DNBLogThreadedIf (LOG_THREAD, "CPUHasAVX(): g_has_avx = %i (err = %i, errno = %i, xnu_version = %llu)\n", g_has_avx, err, errno, xnu_version);
+ }
+
+ return (g_has_avx == eAVXPresent);
+}
uint64_t
DNBArchImplX86_64::GetPC(uint64_t failValue)
Modified: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h?rev=146135&r1=146134&r2=146135&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h Wed Dec 7 21:19:36 2011
@@ -230,15 +230,6 @@
static const DNBRegisterSetInfo *
GetRegisterSetInfo(nub_size_t *num_reg_sets);
- static bool
- CPUHasAVX()
- {
- if (s_has_avx == kAVXUnknown)
- s_has_avx = (::HasAVX() ? kAVXPresent : kAVXNotPresent);
-
- return (s_has_avx == kAVXPresent);
- }
-
// Helper functions for watchpoint manipulations.
static void SetWatchpoint(DBG &debug_state, uint32_t hw_index, nub_addr_t addr, nub_size_t size, bool read, bool write);
static void ClearWatchpoint(DBG &debug_state, uint32_t hw_index);
@@ -248,13 +239,7 @@
static nub_addr_t GetWatchAddress(const DBG &debug_state, uint32_t hw_index);
MachThread *m_thread;
- State m_state;
-
- static enum AVXPresence {
- kAVXPresent,
- kAVXNotPresent,
- kAVXUnknown
- } s_has_avx;
+ State m_state;
};
#endif // #if defined (__i386__) || defined (__x86_64__)
From gclayton at apple.com Wed Dec 7 23:16:30 2011
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 08 Dec 2011 05:16:30 -0000
Subject: [Lldb-commits] [lldb] r146141 - in
/lldb/trunk/source/Plugins/SymbolFile/DWARF: SymbolFileDWARF.cpp
SymbolFileDWARF.h
Message-ID: <20111208051630.CA6C52A6C12C@llvm.org>
Author: gclayton
Date: Wed Dec 7 23:16:30 2011
New Revision: 146141
URL: http://llvm.org/viewvc/llvm-project?rev=146141&view=rev
Log:
Fixed an issue where we are asking to get the decl context for a function
that is in a class from the expression parser, and it was causing an
assertion. There is now a function that will correctly resolve a type
even if it is in a class.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=146141&r1=146140&r2=146141&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Dec 7 23:16:30 2011
@@ -1614,23 +1614,42 @@
{
DWARFCompileUnitSP cu_sp;
const DWARFDebugInfoEntry* type_die = debug_info->GetDIEPtr(type_uid, &cu_sp);
- if (type_die != NULL)
+ const bool assert_not_being_parsed = true;
+ return ResolveTypeUID (cu_sp.get(), type_die, assert_not_being_parsed);
+ }
+ }
+ return NULL;
+}
+
+Type*
+SymbolFileDWARF::ResolveTypeUID (DWARFCompileUnit* cu, const DWARFDebugInfoEntry* die, bool assert_not_being_parsed)
+{
+ if (die != NULL)
+ {
+ // We might be coming in in the middle of a type tree (a class
+ // withing a class, an enum within a class), so parse any needed
+ // parent DIEs before we get to this one...
+ const DWARFDebugInfoEntry *decl_ctx_die = GetDeclContextDIEContainingDIE (cu, die);
+ switch (decl_ctx_die->Tag())
+ {
+ case DW_TAG_structure_type:
+ case DW_TAG_union_type:
+ case DW_TAG_class_type:
{
- // We might be coming in in the middle of a type tree (a class
- // withing a class, an enum within a class), so parse any needed
- // parent DIEs before we get to this one...
- const DWARFDebugInfoEntry *decl_ctx_die = GetDeclContextDIEContainingDIE (cu_sp.get(), type_die);
- switch (decl_ctx_die->Tag())
- {
- case DW_TAG_structure_type:
- case DW_TAG_union_type:
- case DW_TAG_class_type:
- ResolveType(cu_sp.get(), decl_ctx_die);
- break;
- }
- return ResolveType (cu_sp.get(), type_die);
+ // Get the type, which could be a forward declaration
+ Type *parent_type = ResolveTypeUID (cu, decl_ctx_die, assert_not_being_parsed);
+ // Now ask the type to complete itself if it already hasn't.
+ // This will make the call to ResolveType below just use the
+ // cached value that is already parsed for "die"
+ if (parent_type)
+ parent_type->GetClangFullType();
}
+ break;
+
+ default:
+ break;
}
+ return ResolveType (cu, die);
}
return NULL;
}
@@ -1858,8 +1877,10 @@
if (type_die != NULL)
{
Type *type = m_die_to_type.lookup (type_die);
+
if (type == NULL)
type = GetTypeForDIE (curr_cu, type_die).get();
+
if (assert_not_being_parsed)
assert (type != DIE_IS_BEING_PARSED);
return type;
@@ -3650,25 +3671,25 @@
}
clang::DeclContext *
-SymbolFileDWARF::GetClangDeclContextForDIE (const SymbolContext &sc, DWARFCompileUnit *curr_cu, const DWARFDebugInfoEntry *die)
+SymbolFileDWARF::GetClangDeclContextForDIE (const SymbolContext &sc, DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die)
{
clang::DeclContext *clang_decl_ctx = GetCachedClangDeclContextForDIE (die);
if (clang_decl_ctx)
return clang_decl_ctx;
// If this DIE has a specification, or an abstract origin, then trace to those.
- dw_offset_t die_offset = die->GetAttributeValueAsReference(this, curr_cu, DW_AT_specification, DW_INVALID_OFFSET);
+ dw_offset_t die_offset = die->GetAttributeValueAsReference(this, cu, DW_AT_specification, DW_INVALID_OFFSET);
if (die_offset != DW_INVALID_OFFSET)
return GetClangDeclContextForDIEOffset (sc, die_offset);
- die_offset = die->GetAttributeValueAsReference(this, curr_cu, DW_AT_abstract_origin, DW_INVALID_OFFSET);
+ die_offset = die->GetAttributeValueAsReference(this, cu, DW_AT_abstract_origin, DW_INVALID_OFFSET);
if (die_offset != DW_INVALID_OFFSET)
return GetClangDeclContextForDIEOffset (sc, die_offset);
// This is the DIE we want. Parse it, then query our map.
-
- ParseType(sc, curr_cu, die, NULL);
-
+ bool assert_not_being_parsed = true;
+ ResolveTypeUID (cu, die, assert_not_being_parsed);
+
clang_decl_ctx = GetCachedClangDeclContextForDIE (die);
return clang_decl_ctx;
@@ -4544,6 +4565,7 @@
m_forward_decl_clang_type_to_die[ClangASTType::RemoveFastQualifiers (clang_type)] = die;
ClangASTContext::SetHasExternalStorage (clang_type, true);
}
+
}
break;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=146141&r1=146140&r2=146141&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Wed Dec 7 23:16:30 2011
@@ -279,6 +279,7 @@
uint32_t depth);
size_t ParseTypes (const lldb_private::SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, bool parse_siblings, bool parse_children);
lldb::TypeSP ParseType (const lldb_private::SymbolContext& sc, DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry *die, bool *type_is_new);
+ lldb_private::Type* ResolveTypeUID (DWARFCompileUnit* cu, const DWARFDebugInfoEntry* die, bool assert_not_being_parsed);
lldb::VariableSP ParseVariableDIE(
const lldb_private::SymbolContext& sc,
From peter at pcc.me.uk Thu Dec 8 04:43:04 2011
From: peter at pcc.me.uk (Peter Collingbourne)
Date: Thu, 08 Dec 2011 10:43:04 -0000
Subject: [Lldb-commits] [lldb] r146148 - /lldb/trunk/lib/Makefile
Message-ID: <20111208104304.948492A6C12C@llvm.org>
Author: pcc
Date: Thu Dec 8 04:43:04 2011
New Revision: 146148
URL: http://llvm.org/viewvc/llvm-project?rev=146148&view=rev
Log:
libEnhancedDisassembly.a is gone from recent LLVM.
Modified:
lldb/trunk/lib/Makefile
Modified: lldb/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=146148&r1=146147&r2=146148&view=diff
==============================================================================
--- lldb/trunk/lib/Makefile (original)
+++ lldb/trunk/lib/Makefile Thu Dec 8 04:43:04 2011
@@ -61,7 +61,6 @@
clangParse.a \
clangSema.a \
clangSerialization.a \
- EnhancedDisassembly.a \
LLVMMCDisassembler.a
include $(LLDB_LEVEL)/../../Makefile.config
From scallanan at apple.com Thu Dec 8 13:04:35 2011
From: scallanan at apple.com (Sean Callanan)
Date: Thu, 08 Dec 2011 19:04:35 -0000
Subject: [Lldb-commits] [lldb] r146164 - in /lldb/trunk:
source/Expression/ASTResultSynthesizer.cpp
source/Expression/IRForTarget.cpp
test/lang/objc/foundation/TestObjCMethods2.py
Message-ID: <20111208190435.45F5F2A6C12C@llvm.org>
Author: spyffe
Date: Thu Dec 8 13:04:34 2011
New Revision: 146164
URL: http://llvm.org/viewvc/llvm-project?rev=146164&view=rev
Log:
Added the ability to dereference an Objective-C object
pointer to make the result of an expression. LLDB now
dumps the ivars of the Objective-C object and all of
its parents. This just required fixing a bug where we
didn't distinguish between Objective-C object pointers
and regular C-style pointers.
Also added a testcase to verify that this continues to
work.
Modified:
lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
lldb/trunk/source/Expression/IRForTarget.cpp
lldb/trunk/test/lang/objc/foundation/TestObjCMethods2.py
Modified: lldb/trunk/source/Expression/ASTResultSynthesizer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ASTResultSynthesizer.cpp?rev=146164&r1=146163&r2=146164&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ASTResultSynthesizer.cpp (original)
+++ lldb/trunk/source/Expression/ASTResultSynthesizer.cpp Thu Dec 8 13:04:34 2011
@@ -331,7 +331,12 @@
else
result_ptr_id = &Ctx.Idents.get("$__lldb_expr_result_ptr");
- QualType ptr_qual_type = Ctx.getPointerType(expr_qual_type);
+ QualType ptr_qual_type;
+
+ if (isa(expr_qual_type))
+ ptr_qual_type = Ctx.getObjCObjectPointerType(expr_qual_type);
+ else
+ ptr_qual_type = Ctx.getPointerType(expr_qual_type);
result_decl = VarDecl::Create(Ctx,
DC,
Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=146164&r1=146163&r2=146164&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Thu Dec 8 13:04:34 2011
@@ -631,9 +631,25 @@
{
clang::QualType pointer_qual_type = result_var->getType();
const clang::Type *pointer_type = pointer_qual_type.getTypePtr();
+
const clang::PointerType *pointer_pointertype = dyn_cast(pointer_type);
+ const clang::ObjCObjectPointerType *pointer_objcobjpointertype = dyn_cast(pointer_type);
- if (!pointer_pointertype)
+ if (pointer_pointertype)
+ {
+ clang::QualType element_qual_type = pointer_pointertype->getPointeeType();
+
+ m_result_type = lldb_private::TypeFromParser(element_qual_type.getAsOpaquePtr(),
+ &result_decl->getASTContext());
+ }
+ else if (pointer_objcobjpointertype)
+ {
+ clang::QualType element_qual_type = clang::QualType(pointer_objcobjpointertype->getObjectType(), 0);
+
+ m_result_type = lldb_private::TypeFromParser(element_qual_type.getAsOpaquePtr(),
+ &result_decl->getASTContext());
+ }
+ else
{
if (log)
log->PutCString("Expected result to have pointer type, but it did not");
@@ -643,11 +659,6 @@
return false;
}
-
- clang::QualType element_qual_type = pointer_pointertype->getPointeeType();
-
- m_result_type = lldb_private::TypeFromParser(element_qual_type.getAsOpaquePtr(),
- &result_decl->getASTContext());
}
else
{
Modified: lldb/trunk/test/lang/objc/foundation/TestObjCMethods2.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/foundation/TestObjCMethods2.py?rev=146164&r1=146163&r2=146164&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/foundation/TestObjCMethods2.py (original)
+++ lldb/trunk/test/lang/objc/foundation/TestObjCMethods2.py Thu Dec 8 13:04:34 2011
@@ -42,6 +42,16 @@
self.buildDwarf()
self.NSString_expr()
+ def test_MyString_dump_with_dsym(self):
+ """Test dump of a known Objective-C object by dereferencing it."""
+ self.buildDsym()
+ self.MyString_dump()
+
+ def test_MyString_dump_with_dwarf(self):
+ """Test dump of a known Objective-C object by dereferencing it."""
+ self.buildDwarf()
+ self.MyString_dump()
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -51,7 +61,8 @@
self.lines.append(line_number('main.m', '// Expressions to test here for NSArray:'))
self.lines.append(line_number('main.m', '// Expressions to test here for NSString:'))
self.lines.append(line_number('main.m', "// Set a breakpoint on '-[MyString description]' and test expressions:"))
-
+ self.lines.append(line_number('main.m', '// Set break point at this line'))
+
def more_expr_objc(self):
"""More expression commands for objective-c."""
exe = os.path.join(os.getcwd(), "a.out")
@@ -149,6 +160,22 @@
self.expect('expression str = [NSString stringWithFormat: @"%cew", \'N\']')
self.runCmd("process continue")
+ def MyString_dump(self):
+ """Test dump of a known Objective-C object by dereferencing it."""
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ line = self.lines[4]
+
+ self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
+ substrs = ["Breakpoint created:",
+ "file ='main.m', line = %d, locations = 1" % line])
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ self.expect("expression *my",
+ patterns = ["\(MyString\) \$.* = ", "\(MyBase\)", "\(NSObject\)", "\(Class\)"])
+ self.runCmd("process continue")
if __name__ == '__main__':
import atexit
From jingham at apple.com Thu Dec 8 13:44:08 2011
From: jingham at apple.com (Jim Ingham)
Date: Thu, 08 Dec 2011 19:44:08 -0000
Subject: [Lldb-commits] [lldb] r146173 - in /lldb/trunk:
include/lldb/API/SBValue.h include/lldb/Core/ValueObject.h
include/lldb/Core/ValueObjectDynamicValue.h
scripts/Python/interface/SBValue.i source/API/SBValue.cpp
source/Core/ValueObject.cpp test/lang/cpp/dynamic-value/TestDynamicValue.py
Message-ID: <20111208194409.198E72A6C12C@llvm.org>
Author: jingham
Date: Thu Dec 8 13:44:08 2011
New Revision: 146173
URL: http://llvm.org/viewvc/llvm-project?rev=146173&view=rev
Log:
Add SBValue::GetDynamicValue and SBValue::GetStaticValue API's.
Modified:
lldb/trunk/include/lldb/API/SBValue.h
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
lldb/trunk/scripts/Python/interface/SBValue.i
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py
Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Thu Dec 8 13:44:08 2011
@@ -84,6 +84,15 @@
const char *
GetObjectDescription ();
+
+ lldb::SBValue
+ GetDynamicValue (lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValue
+ GetStaticValue ();
+
+ bool
+ IsDynamic();
const char *
GetLocation ();
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Thu Dec 8 13:44:08 2011
@@ -725,6 +725,9 @@
lldb::ValueObjectSP
GetDynamicValue (lldb::DynamicValueType valueType);
+ virtual lldb::ValueObjectSP
+ GetStaticValue ();
+
lldb::ValueObjectSP
GetSyntheticValue (lldb::SyntheticValueType use_synthetic);
Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Thu Dec 8 13:44:08 2011
@@ -73,6 +73,12 @@
return NULL;
}
+ virtual lldb::ValueObjectSP
+ GetStaticValue ()
+ {
+ return m_parent->GetSP();
+ }
+
void
SetOwningSP (lldb::ValueObjectSP &owning_sp)
{
Modified: lldb/trunk/scripts/Python/interface/SBValue.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBValue.i (original)
+++ lldb/trunk/scripts/Python/interface/SBValue.i Thu Dec 8 13:44:08 2011
@@ -118,6 +118,15 @@
const char *
GetObjectDescription ();
+ lldb::SBValue
+ GetDynamicValue (lldb::DynamicValueType use_dynamic);
+
+ lldb::SBValue
+ GetStaticValue ();
+
+ bool
+ IsDynamic();
+
const char *
GetLocation ();
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Thu Dec 8 13:44:08 2011
@@ -597,6 +597,50 @@
}
lldb::SBValue
+SBValue::GetDynamicValue (lldb::DynamicValueType use_dynamic)
+{
+ if (m_opaque_sp)
+ {
+ if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ return SBValue (m_opaque_sp->GetDynamicValue(use_dynamic));
+ }
+ }
+
+ return SBValue();
+}
+
+lldb::SBValue
+SBValue::GetStaticValue ()
+{
+ if (m_opaque_sp)
+ {
+ if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ return SBValue(m_opaque_sp->GetStaticValue());
+ }
+ }
+
+ return SBValue();
+}
+
+bool
+SBValue::IsDynamic()
+{
+ if (m_opaque_sp)
+ {
+ if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ return m_opaque_sp->IsDynamic();
+ }
+ }
+ return false;
+}
+
+lldb::SBValue
SBValue::GetValueForExpressionPath(const char* expr_path)
{
lldb::ValueObjectSP child_sp;
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Thu Dec 8 13:44:08 2011
@@ -1920,6 +1920,12 @@
return ValueObjectSP();
}
+ValueObjectSP
+ValueObject::GetStaticValue()
+{
+ return GetSP();
+}
+
// GetDynamicValue() returns a NULL SharedPointer if the object is not dynamic
// or we do not really want a dynamic VO. this method instead returns this object
// itself when making it synthetic has no meaning. this makes it much simpler
Modified: lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py?rev=146173&r1=146172&r2=146173&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py (original)
+++ lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py Thu Dec 8 13:44:08 2011
@@ -153,6 +153,15 @@
this_dynamic = frame.FindVariable ('this', use_dynamic)
self.examine_value_object_of_this_ptr (this_static, this_dynamic, myB_loc)
+ # Now make sure that the "GetDynamicValue" works:
+ # This doesn't work currently because we can't get dynamic values from ConstResult objects.
+ fetched_dynamic_value = this_static.GetDynamicValue(use_dynamic)
+ self.examine_value_object_of_this_ptr (this_static, fetched_dynamic_value, myB_loc)
+
+ # And conversely that the GetDynamicValue() interface also works:
+ fetched_static_value = this_dynamic.GetStaticValue()
+ self.examine_value_object_of_this_ptr (fetched_static_value, this_dynamic, myB_loc)
+
# Get "this" using FindValue, make sure that works too:
this_static = frame.FindValue ('this', lldb.eValueTypeVariableArgument, no_dynamic)
this_dynamic = frame.FindValue ('this', lldb.eValueTypeVariableArgument, use_dynamic)
From jmolenda at apple.com Thu Dec 8 16:36:41 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Thu, 08 Dec 2011 22:36:41 -0000
Subject: [Lldb-commits] [lldb] r146198 -
/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
Message-ID: <20111208223641.6A5692A6C12C@llvm.org>
Author: jmolenda
Date: Thu Dec 8 16:36:41 2011
New Revision: 146198
URL: http://llvm.org/viewvc/llvm-project?rev=146198&view=rev
Log:
Move CPUHasAVX() prototype out of an #ifdef block of code.
Modified:
lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
Modified: lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp?rev=146198&r1=146197&r2=146198&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.cpp Thu Dec 8 16:36:41 2011
@@ -20,6 +20,8 @@
#include "MachThread.h"
#include "MachProcess.h"
+extern "C" bool CPUHasAVX(); // Defined over in DNBArchImplX86_64.cpp
+
#if defined (LLDB_DEBUGSERVER_RELEASE) || defined (LLDB_DEBUGSERVER_DEBUG)
enum debugState {
debugStateUnknown,
@@ -27,8 +29,6 @@
debugStateOn
};
-extern "C" bool CPUHasAVX(); // Defined over in DNBArchImplX86_64.cpp
-
static debugState sFPUDebugState = debugStateUnknown;
static debugState sAVXForceState = debugStateUnknown;
From scallanan at apple.com Thu Dec 8 17:45:45 2011
From: scallanan at apple.com (Sean Callanan)
Date: Thu, 08 Dec 2011 23:45:45 -0000
Subject: [Lldb-commits] [lldb] r146204 - in /lldb/trunk:
include/lldb/Symbol/ClangASTImporter.h source/Expression/ClangASTSource.cpp
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
source/Symbol/ClangASTImporter.cpp test/lang/c/shared_lib/
test/lang/c/shared_lib/Makefile test/lang/c/shared_lib/TestSharedLib.py
test/lang/c/shared_lib/foo.c test/lang/c/shared_lib/foo.h
test/lang/c/shared_lib/main.c
Message-ID: <20111208234546.0FBBA2A6C12C@llvm.org>
Author: spyffe
Date: Thu Dec 8 17:45:45 2011
New Revision: 146204
URL: http://llvm.org/viewvc/llvm-project?rev=146204&view=rev
Log:
If the expression parser is unable to complete a TagDecl
in the context in which it was originally found, the
expression parser now goes hunting for it in all modules
(in the appropriate namespace, if applicable). This means
that forward-declared types that exist in another shared
library will now be resolved correctly.
Added a test case to cover this. The test case also tests
"frame variable," which does not have this functionality
yet.
Added:
lldb/trunk/test/lang/c/shared_lib/
lldb/trunk/test/lang/c/shared_lib/Makefile
lldb/trunk/test/lang/c/shared_lib/TestSharedLib.py
lldb/trunk/test/lang/c/shared_lib/foo.c
lldb/trunk/test/lang/c/shared_lib/foo.h
lldb/trunk/test/lang/c/shared_lib/main.c
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Symbol/ClangASTImporter.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=146204&r1=146203&r2=146204&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Thu Dec 8 17:45:45 2011
@@ -53,10 +53,13 @@
clang::ASTContext *src_ctx,
clang::Decl *decl);
- void
+ bool
CompleteTagDecl (clang::TagDecl *decl);
- void
+ bool
+ CompleteTagDeclWithOrigin (clang::TagDecl *decl, clang::TagDecl *origin);
+
+ bool
CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl);
bool
Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=146204&r1=146203&r2=146204&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Thu Dec 8 17:45:45 2011
@@ -149,15 +149,127 @@
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+ static unsigned int invocation_id = 0;
+ unsigned int current_id = invocation_id++;
+
if (log)
{
- log->Printf(" [CompleteTagDecl] on (ASTContext*)%p Completing a TagDecl named %s", m_ast_context, tag_decl->getName().str().c_str());
- log->Printf(" [CTD] Before:");
+ log->Printf(" CompleteTagDecl[%u] on (ASTContext*)%p Completing a TagDecl named %s",
+ invocation_id,
+ m_ast_context,
+ tag_decl->getName().str().c_str());
+
+ log->Printf(" CTD[%u] Before:", current_id);
ASTDumper dumper((Decl*)tag_decl);
dumper.ToLog(log, " [CTD] ");
}
- m_ast_importer->CompleteTagDecl (tag_decl);
+ if (!m_ast_importer->CompleteTagDecl (tag_decl))
+ {
+ // We couldn't complete the type. Maybe there's a definition
+ // somewhere else that can be completed.
+
+ if (log)
+ log->Printf(" CTD[%u] Type could not be completed in the module in which it was first found.", current_id);
+
+ bool found = false;
+
+ DeclContext *decl_ctx = tag_decl->getDeclContext();
+
+ if (const NamespaceDecl *namespace_context = dyn_cast(decl_ctx))
+ {
+ ClangASTImporter::NamespaceMapSP namespace_map = m_ast_importer->GetNamespaceMap(namespace_context);
+
+ if (log && log->GetVerbose())
+ log->Printf(" CTD[%u] Inspecting namespace map %p (%d entries)",
+ current_id,
+ namespace_map.get(),
+ (int)namespace_map->size());
+
+ if (!namespace_map)
+ return;
+
+ for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(), e = namespace_map->end();
+ i != e && !found;
+ ++i)
+ {
+ if (log)
+ log->Printf(" CTD[%u] Searching namespace %s in module %s",
+ current_id,
+ i->second.GetNamespaceDecl()->getNameAsString().c_str(),
+ i->first->GetFileSpec().GetFilename().GetCString());
+
+ TypeList types;
+
+ SymbolContext null_sc;
+ ConstString name(tag_decl->getName().str().c_str());
+
+ i->first->FindTypes(null_sc, name, &i->second, true, UINT32_MAX, types);
+
+ for (uint32_t ti = 0, te = types.GetSize();
+ ti != te && !found;
+ ++ti)
+ {
+ lldb::TypeSP type = types.GetTypeAtIndex(ti);
+
+ if (!type)
+ continue;
+
+ lldb::clang_type_t opaque_type = type->GetClangFullType();
+
+ if (!opaque_type)
+ continue;
+
+ const TagType *tag_type = dyn_cast(QualType::getFromOpaquePtr(opaque_type).getTypePtr());
+
+ if (!tag_type)
+ continue;
+
+ TagDecl *candidate_tag_decl = const_cast(tag_type->getDecl());
+
+ if (m_ast_importer->CompleteTagDeclWithOrigin (tag_decl, candidate_tag_decl))
+ found = true;
+ }
+ }
+ }
+ else
+ {
+ TypeList types;
+
+ SymbolContext null_sc;
+ ConstString name(tag_decl->getName().str().c_str());
+ ClangNamespaceDecl namespace_decl;
+
+ ModuleList &module_list = m_target->GetImages();
+
+ module_list.FindTypes(null_sc, name, true, UINT32_MAX, types);
+
+ for (uint32_t ti = 0, te = types.GetSize();
+ ti != te && !found;
+ ++ti)
+ {
+ lldb::TypeSP type = types.GetTypeAtIndex(ti);
+
+ if (!type)
+ continue;
+
+ lldb::clang_type_t opaque_type = type->GetClangFullType();
+
+ if (!opaque_type)
+ continue;
+
+ const TagType *tag_type = dyn_cast(QualType::getFromOpaquePtr(opaque_type).getTypePtr());
+
+ if (!tag_type)
+ continue;
+
+ TagDecl *candidate_tag_decl = const_cast(tag_type->getDecl());
+
+ if (m_ast_importer->CompleteTagDeclWithOrigin (tag_decl, candidate_tag_decl))
+ found = true;
+ }
+ }
+ }
if (log)
{
@@ -249,7 +361,7 @@
external_source->CompleteType (original_tag_decl);
}
- DeclContext *original_decl_context = dyn_cast(original_decl);
+ const DeclContext *original_decl_context = dyn_cast(original_decl);
if (!original_decl_context)
return ELR_Failure;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=146204&r1=146203&r2=146204&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Dec 8 17:45:45 2011
@@ -4548,22 +4548,25 @@
GetUniqueDWARFASTTypeMap().Insert (type_name_const_str,
unique_ast_entry);
- if (die->HasChildren() == false && is_forward_declaration == false)
- {
- // No children for this struct/union/class, lets finish it
- ast.StartTagDeclarationDefinition (clang_type);
- ast.CompleteTagDeclarationDefinition (clang_type);
- }
- else if (clang_type_was_created)
- {
- // Leave this as a forward declaration until we need
- // to know the details of the type. lldb_private::Type
- // will automatically call the SymbolFile virtual function
- // "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition(Type *)"
- // When the definition needs to be defined.
- m_forward_decl_die_to_clang_type[die] = clang_type;
- m_forward_decl_clang_type_to_die[ClangASTType::RemoveFastQualifiers (clang_type)] = die;
- ClangASTContext::SetHasExternalStorage (clang_type, true);
+ if (!is_forward_declaration)
+ {
+ if (die->HasChildren() == false)
+ {
+ // No children for this struct/union/class, lets finish it
+ ast.StartTagDeclarationDefinition (clang_type);
+ ast.CompleteTagDeclarationDefinition (clang_type);
+ }
+ else if (clang_type_was_created)
+ {
+ // Leave this as a forward declaration until we need
+ // to know the details of the type. lldb_private::Type
+ // will automatically call the SymbolFile virtual function
+ // "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition(Type *)"
+ // When the definition needs to be defined.
+ m_forward_decl_die_to_clang_type[die] = clang_type;
+ m_forward_decl_clang_type_to_die[ClangASTType::RemoveFastQualifiers (clang_type)] = die;
+ ClangASTContext::SetHasExternalStorage (clang_type, true);
+ }
}
}
Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=146204&r1=146203&r2=146204&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Thu Dec 8 17:45:45 2011
@@ -95,28 +95,48 @@
return result;
}
-void
+bool
ClangASTImporter::CompleteTagDecl (clang::TagDecl *decl)
-{
- lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-
+{
DeclOrigin decl_origin = GetDeclOrigin(decl);
if (!decl_origin.Valid())
- return;
+ return false;
if (!ClangASTContext::GetCompleteDecl(decl_origin.ctx, decl_origin.decl))
- return;
+ return false;
MinionSP minion_sp (GetMinion(&decl->getASTContext(), decl_origin.ctx));
if (minion_sp)
minion_sp->ImportDefinition(decl_origin.decl);
- return;
+ return true;
}
-void
+bool
+ClangASTImporter::CompleteTagDeclWithOrigin(clang::TagDecl *decl, clang::TagDecl *origin_decl)
+{
+ clang::ASTContext *origin_ast_ctx = &origin_decl->getASTContext();
+
+ if (!ClangASTContext::GetCompleteDecl(origin_ast_ctx, origin_decl))
+ return false;
+
+ MinionSP minion_sp (GetMinion(&decl->getASTContext(), origin_ast_ctx));
+
+ if (minion_sp)
+ minion_sp->ImportDefinition(origin_decl);
+
+ ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
+
+ OriginMap &origins = context_md->m_origins;
+
+ origins[decl] = DeclOrigin(origin_ast_ctx, origin_decl);
+
+ return true;
+}
+
+bool
ClangASTImporter::CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl)
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -124,17 +144,17 @@
DeclOrigin decl_origin = GetDeclOrigin(interface_decl);
if (!decl_origin.Valid())
- return;
+ return false;
if (!ClangASTContext::GetCompleteDecl(decl_origin.ctx, decl_origin.decl))
- return;
+ return false;
MinionSP minion_sp (GetMinion(&interface_decl->getASTContext(), decl_origin.ctx));
if (minion_sp)
minion_sp->ImportDefinition(decl_origin.decl);
- return;
+ return true;
}
ClangASTImporter::DeclOrigin
Added: lldb/trunk/test/lang/c/shared_lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/shared_lib/Makefile?rev=146204&view=auto
==============================================================================
--- lldb/trunk/test/lang/c/shared_lib/Makefile (added)
+++ lldb/trunk/test/lang/c/shared_lib/Makefile Thu Dec 8 17:45:45 2011
@@ -0,0 +1,7 @@
+LEVEL = ../../../make
+
+DYLIB_NAME := libfoo
+DYLIB_C_SOURCES := foo.c
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules
Added: lldb/trunk/test/lang/c/shared_lib/TestSharedLib.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/shared_lib/TestSharedLib.py?rev=146204&view=auto
==============================================================================
--- lldb/trunk/test/lang/c/shared_lib/TestSharedLib.py (added)
+++ lldb/trunk/test/lang/c/shared_lib/TestSharedLib.py Thu Dec 8 17:45:45 2011
@@ -0,0 +1,79 @@
+"""Test that types defined in shared libraries work correctly."""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+
+class SharedLibTestCase(TestBase):
+
+ mydir = os.path.join("lang", "c", "shared_lib")
+
+ def test_expr_with_dsym(self):
+ """Test that types work when defined in a shared library and forward-declared in the main executable"""
+ self.buildDsym()
+ self.expr()
+
+ def test_expr_with_dwarf(self):
+ """Test that types work when defined in a shared library and forward-declared in the main executable"""
+ self.buildDwarf()
+ self.expr()
+
+ def test_frame_variable_with_dsym(self):
+ """Test that types work when defined in a shared library and forward-declared in the main executable"""
+ self.buildDsym()
+ self.frame_var()
+
+ def test_frame_variable_with_dwarf(self):
+ """Test that types work when defined in a shared library and forward-declared in the main executable"""
+ self.buildDwarf()
+ self.frame_var()
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ # Find the line number to break inside main().
+ self.line = line_number('main.c', '// Set breakpoint 0 here.')
+
+ def common_setup(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Break inside the foo function which takes a bar_ptr argument.
+ self.expect("breakpoint set -f main.c -l %d" % self.line, BREAKPOINT_CREATED,
+ startstr = "Breakpoint created")
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # The breakpoint should have a hit count of 1.
+ self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+ substrs = [' resolved, hit count = 1'])
+
+ def expr(self):
+ """Test that types work when defined in a shared library and forward-declared in the main executable"""
+ self.common_setup()
+
+ # This should display correctly.
+ self.expect("expression *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
+
+ @unittest2.expectedFailure
+ # rdar://problem/10381325
+ def frame_var(self):
+ """Test that types work when defined in a shared library and forward-declared in the main executable"""
+ self.common_setup()
+
+ # This should display correctly.
+ self.expect("frame variable *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
Added: lldb/trunk/test/lang/c/shared_lib/foo.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/shared_lib/foo.c?rev=146204&view=auto
==============================================================================
--- lldb/trunk/test/lang/c/shared_lib/foo.c (added)
+++ lldb/trunk/test/lang/c/shared_lib/foo.c Thu Dec 8 17:45:45 2011
@@ -0,0 +1,22 @@
+#include "foo.h"
+#include
+
+struct foo
+{
+ struct sub_foo sub_element;
+ int other_element;
+};
+
+struct foo *
+GetMeAFoo()
+{
+ struct foo *ret_val = (struct foo *) malloc (sizeof (struct foo));
+ ret_val->other_element = 3;
+ return ret_val;
+}
+
+struct sub_foo *
+GetMeASubFoo (struct foo *in_foo)
+{
+ return &(in_foo->sub_element);
+}
Added: lldb/trunk/test/lang/c/shared_lib/foo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/shared_lib/foo.h?rev=146204&view=auto
==============================================================================
--- lldb/trunk/test/lang/c/shared_lib/foo.h (added)
+++ lldb/trunk/test/lang/c/shared_lib/foo.h Thu Dec 8 17:45:45 2011
@@ -0,0 +1,12 @@
+struct foo;
+
+struct sub_foo
+{
+ int sub_1;
+ char *sub_2;
+};
+
+struct foo *GetMeAFoo();
+struct sub_foo *GetMeASubFoo (struct foo *in_foo);
+
+
Added: lldb/trunk/test/lang/c/shared_lib/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/shared_lib/main.c?rev=146204&view=auto
==============================================================================
--- lldb/trunk/test/lang/c/shared_lib/main.c (added)
+++ lldb/trunk/test/lang/c/shared_lib/main.c Thu Dec 8 17:45:45 2011
@@ -0,0 +1,13 @@
+#include
+#include "foo.h"
+
+int
+main ()
+{
+ struct foo *my_foo_ptr;
+ my_foo_ptr = GetMeAFoo();
+ // Set breakpoint 0 here.
+ printf ("My sub foo has: %d.\n", GetMeASubFoo(my_foo_ptr)->sub_1);
+
+ return 0;
+}
From gclayton at apple.com Thu Dec 8 18:58:34 2011
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 09 Dec 2011 00:58:34 -0000
Subject: [Lldb-commits] [lldb] r146216 - in
/lldb/trunk/test/lang/objc/real-definition: Bar.m Foo.m
TestRealDefinition.py main.m
Message-ID: <20111209005834.1D0242A6C12C@llvm.org>
Author: gclayton
Date: Thu Dec 8 18:58:33 2011
New Revision: 146216
URL: http://llvm.org/viewvc/llvm-project?rev=146216&view=rev
Log:
We now have a test case for stopping within a module in a place where the
translation unit has a interface for a class "Bar" that contains hidden ivars
in the implementation and we make sure we can see these hidden ivars. We also
test the case where we stop in translation unit that contains the
implementation first. So the test runs two tests:
1 - run and stop where we have an interface, run to main and print and make
sure we find the hidden ivar
2 - run and stop where we have an implementation, run to main and print and make
sure we find the hidden ivar
Added:
lldb/trunk/test/lang/objc/real-definition/TestRealDefinition.py
Modified:
lldb/trunk/test/lang/objc/real-definition/Bar.m
lldb/trunk/test/lang/objc/real-definition/Foo.m
lldb/trunk/test/lang/objc/real-definition/main.m
Modified: lldb/trunk/test/lang/objc/real-definition/Bar.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/real-definition/Bar.m?rev=146216&r1=146215&r2=146216&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/real-definition/Bar.m (original)
+++ lldb/trunk/test/lang/objc/real-definition/Bar.m Thu Dec 8 18:58:33 2011
@@ -25,7 +25,7 @@
if (self) {
_hidden_ivar = [NSString stringWithFormat:@"%p: @Bar", self];
}
- return self;
+ return self; // Set breakpoint where Bar is an implementation
}
- (void)dealloc
Modified: lldb/trunk/test/lang/objc/real-definition/Foo.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/real-definition/Foo.m?rev=146216&r1=146215&r2=146216&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/real-definition/Foo.m (original)
+++ lldb/trunk/test/lang/objc/real-definition/Foo.m Thu Dec 8 18:58:33 2011
@@ -8,7 +8,7 @@
if (self) {
_bar = [[Bar alloc] init];
}
- return self;
+ return self; // Set breakpoint where Bar is an interface
}
- (void)dealloc
Added: lldb/trunk/test/lang/objc/real-definition/TestRealDefinition.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/real-definition/TestRealDefinition.py?rev=146216&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/real-definition/TestRealDefinition.py (added)
+++ lldb/trunk/test/lang/objc/real-definition/TestRealDefinition.py Thu Dec 8 18:58:33 2011
@@ -0,0 +1,102 @@
+"""Test that types defined in shared libraries work correctly."""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+
+class TestRealDefinition(TestBase):
+
+ mydir = os.path.join("lang", "objc", "real-definition")
+
+ def test_expr_with_dsym(self):
+ """Test that we can find the implementation for an objective C type"""
+ self.buildDsym()
+ self.stop_at_interface()
+
+ def test_expr_with_dwarf(self):
+ """Test that we can find the implementation for an objective C type"""
+ self.buildDwarf()
+ self.stop_at_interface()
+
+ def test_frame_variable_with_dsym(self):
+ """Test that we can find the implementation for an objective C type"""
+ self.buildDsym()
+ self.stop_at_implementation()
+
+ def test_frame_variable_with_dwarf(self):
+ """Test that we can find the implementation for an objective C type"""
+ self.buildDwarf()
+ self.stop_at_implementation()
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ def common_setup(self):
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Break inside the foo function which takes a bar_ptr argument.
+ self.expect("breakpoint set -f main.m -l %d" % line_number('main.m', '// Set breakpoint in main'), BREAKPOINT_CREATED, startstr = "Breakpoint created")
+
+ def stop_at_interface(self):
+ """Test that we can find the implementation for an objective C type when we stop in the interface"""
+ self.common_setup()
+
+ self.expect("breakpoint set -f Foo.m -l %d" % line_number('Foo.m', '// Set breakpoint where Bar is an interface'), BREAKPOINT_CREATED, startstr = "Breakpoint created")
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # Run and stop at Foo
+ self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+ substrs = [' resolved, hit count = 1'])
+
+ self.runCmd("continue", RUN_SUCCEEDED)
+
+ # Run at stop at main
+ self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+ substrs = [' resolved, hit count = 1'])
+
+ # This should display correctly.
+ self.expect("frame variable foo->_bar->_hidden_ivar", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ["(NSString *)", "foo->_bar->_hidden_ivar = 0x"])
+
+ def stop_at_implementation(self):
+ """Test that we can find the implementation for an objective C type when we stop in the implementation"""
+ self.common_setup()
+
+ self.expect("breakpoint set -f Bar.m -l %d" % line_number('Bar.m', '// Set breakpoint where Bar is an implementation'), BREAKPOINT_CREATED, startstr = "Breakpoint created")
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # Run and stop at Foo
+ self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+ substrs = [' resolved, hit count = 1'])
+
+ self.runCmd("continue", RUN_SUCCEEDED)
+
+ # Run at stop at main
+ self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+ substrs = [' resolved, hit count = 1'])
+
+ # This should display correctly.
+ self.expect("frame variable foo->_bar->_hidden_ivar", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ["(NSString *)", "foo->_bar->_hidden_ivar = 0x"])
+
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
Modified: lldb/trunk/test/lang/objc/real-definition/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/real-definition/main.m?rev=146216&r1=146215&r2=146216&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/real-definition/main.m (original)
+++ lldb/trunk/test/lang/objc/real-definition/main.m Thu Dec 8 18:58:33 2011
@@ -7,7 +7,7 @@
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Foo *foo = [[Foo alloc] init];
- NSLog (@"foo is %@", foo);
+ NSLog (@"foo is %@", foo); // Set breakpoint in main
[pool release];
return 0;
}
From jingham at apple.com Thu Dec 8 22:17:31 2011
From: jingham at apple.com (Jim Ingham)
Date: Fri, 09 Dec 2011 04:17:31 -0000
Subject: [Lldb-commits] [lldb] r146242 -
/lldb/trunk/source/Target/StopInfo.cpp
Message-ID: <20111209041731.923692A6C12C@llvm.org>
Author: jingham
Date: Thu Dec 8 22:17:31 2011
New Revision: 146242
URL: http://llvm.org/viewvc/llvm-project?rev=146242&view=rev
Log:
Rework how the breakpoint conditions & callbacks are handled. We now iterate over all the locations at the site
that got hit, and first check the condition, and if that location's condition says we should stop, then we
run the callback. In the end if any location's condition and callback say we should stop, then we stop.
Modified:
lldb/trunk/source/Target/StopInfo.cpp
Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=146242&r1=146241&r2=146242&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Thu Dec 8 22:17:31 2011
@@ -172,79 +172,50 @@
m_should_perform_action = false;
LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
- // We're going to calculate whether we should stop or not in some way during the course of
- // this code. So set the valid flag here. Also by default we're going to stop, so
- // set that here too.
- // m_should_stop_is_valid = true;
- m_should_stop = true;
BreakpointSiteSP bp_site_sp (m_thread.GetProcess().GetBreakpointSiteList().FindByID (m_value));
+
if (bp_site_sp)
{
size_t num_owners = bp_site_sp->GetNumberOfOwners();
-
- // We only continue from the callbacks if ALL the callbacks want us to continue.
- // However we want to run all the callbacks, except of course if one of them actually
- // resumes the target.
- // So we use stop_requested to track what we're were asked to do.
- bool stop_requested = false;
- for (size_t j = 0; j < num_owners; j++)
+
+ if (num_owners == 0)
+ {
+ m_should_stop = true;
+ }
+ else
{
- lldb::BreakpointLocationSP bp_loc_sp = bp_site_sp->GetOwnerAtIndex(j);
+ // We go through each location, and test first its condition. If the condition says to stop,
+ // then we run the callback for that location. If that callback says to stop as well, then
+ // we set m_should_stop to true; we are going to stop.
+ // But we still want to give all the breakpoints whose conditions say we are going to stop a
+ // chance to run their callbacks.
+ // Of course if any callback restarts the target by putting "continue" in the callback, then
+ // we're going to restart, without running the rest of the callbacks. And in this case we will
+ // end up not stopping even if another location said we should stop. But that's better than not
+ // running all the callbacks.
+
+ m_should_stop = false;
+
StoppointCallbackContext context (event_ptr,
&m_thread.GetProcess(),
&m_thread,
m_thread.GetStackFrameAtIndex(0).get(),
false);
- bool callback_return;
-
- // FIXME: For now the callbacks have to run in async mode - the first time we restart we need
- // to get out of there. So set it here.
- // When we figure out how to stack breakpoint hits then this will change.
-
- Debugger &debugger = m_thread.GetProcess().GetTarget().GetDebugger();
- bool old_async = debugger.GetAsyncExecution();
- debugger.SetAsyncExecution (true);
-
- callback_return = bp_loc_sp->InvokeCallback (&context);
-
- debugger.SetAsyncExecution (old_async);
-
- if (callback_return)
- stop_requested = true;
-
- // Also make sure that the callback hasn't continued the target.
- // If it did, when we'll set m_should_start to false and get out of here.
- if (HasTargetRunSinceMe ())
- {
- m_should_stop = false;
- break;
- }
- }
-
- if (m_should_stop && !stop_requested)
- {
- m_should_stop_is_valid = true;
- m_should_stop = false;
- }
- // Okay, so now if all the callbacks say we should stop, let's try the Conditions:
- if (m_should_stop)
- {
- size_t num_owners = bp_site_sp->GetNumberOfOwners();
for (size_t j = 0; j < num_owners; j++)
{
lldb::BreakpointLocationSP bp_loc_sp = bp_site_sp->GetOwnerAtIndex(j);
+
+ // First run the condition for the breakpoint. If that says we should stop, then we'll run
+ // the callback for the breakpoint. If the callback says we shouldn't stop that will win.
+
+ bool condition_says_stop = true;
if (bp_loc_sp->GetConditionText() != NULL)
{
// We need to make sure the user sees any parse errors in their condition, so we'll hook the
// constructor errors up to the debugger's Async I/O.
- StoppointCallbackContext context (event_ptr,
- &m_thread.GetProcess(),
- &m_thread,
- m_thread.GetStackFrameAtIndex(0).get(),
- false);
ValueObjectSP result_valobj_sp;
ExecutionResults result_code;
@@ -267,16 +238,16 @@
if (result_value_sp->ResolveValue (scalar_value))
{
if (scalar_value.ULongLong(1) == 0)
- m_should_stop = false;
+ condition_says_stop = false;
else
- m_should_stop = true;
+ condition_says_stop = true;
if (log)
log->Printf("Condition successfully evaluated, result is %s.\n",
m_should_stop ? "true" : "false");
}
else
{
- m_should_stop = true;
+ condition_says_stop = true;
if (log)
log->Printf("Failed to get an integer result from the expression.");
}
@@ -299,19 +270,49 @@
error_sp->EOL();
error_sp->Flush();
// If the condition fails to be parsed or run, we should stop.
- m_should_stop = true;
+ condition_says_stop = true;
}
}
- // If any condition says we should stop, then we're going to stop, so we don't need
- // to evaluate the others.
- if (m_should_stop)
+ // If this location's condition says we should aren't going to stop,
+ // then don't run the callback for this location.
+ if (!condition_says_stop)
+ continue;
+
+ bool callback_says_stop;
+
+ // FIXME: For now the callbacks have to run in async mode - the first time we restart we need
+ // to get out of there. So set it here.
+ // When we figure out how to nest breakpoint hits then this will change.
+
+ Debugger &debugger = m_thread.GetProcess().GetTarget().GetDebugger();
+ bool old_async = debugger.GetAsyncExecution();
+ debugger.SetAsyncExecution (true);
+
+ callback_says_stop = bp_loc_sp->InvokeCallback (&context);
+
+ debugger.SetAsyncExecution (old_async);
+
+ if (callback_says_stop)
+ m_should_stop = true;
+
+ // Also make sure that the callback hasn't continued the target.
+ // If it did, when we'll set m_should_start to false and get out of here.
+ if (HasTargetRunSinceMe ())
+ {
+ m_should_stop = false;
break;
+ }
}
}
+ // We've figured out what this stop wants to do, so mark it as valid so we don't compute it again.
+ m_should_stop_is_valid = true;
+
}
else
{
+ m_should_stop = true;
+ m_should_stop_is_valid = true;
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
From jmolenda at apple.com Fri Dec 9 01:50:50 2011
From: jmolenda at apple.com (Jason Molenda)
Date: Fri, 09 Dec 2011 07:50:50 -0000
Subject: [Lldb-commits] [lldb] r146249 - in /lldb/trunk:
lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist
source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
source/Plugins/Platform/MacOSX/PlatformDarwin.h
source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
Message-ID: <20111209075050.AC83A2A6C12C@llvm.org>
Author: jmolenda
Date: Fri Dec 9 01:50:50 2011
New Revision: 146249
URL: http://llvm.org/viewvc/llvm-project?rev=146249&view=rev
Log:
Move the ARM specific arch picker from PlatformRemoteiOS.cpp to
PlatformDarwin.cpp -- call it from both PlatformRemoteiOS.cpp
and the native process PlatformDarwin.cpp when running on an arm
system.
Bump lldb version number to 94.
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/resources/LLDB-Info.plist
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=146249&r1=146248&r2=146249&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Dec 9 01:50:50 2011
@@ -3736,9 +3736,9 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 93;
+ CURRENT_PROJECT_VERSION = 94;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 93;
+ DYLIB_CURRENT_VERSION = 94;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3797,10 +3797,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 93;
+ CURRENT_PROJECT_VERSION = 94;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 93;
+ DYLIB_CURRENT_VERSION = 94;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3857,8 +3857,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 93;
- DYLIB_CURRENT_VERSION = 93;
+ CURRENT_PROJECT_VERSION = 94;
+ DYLIB_CURRENT_VERSION = 94;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3887,8 +3887,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 93;
- DYLIB_CURRENT_VERSION = 93;
+ CURRENT_PROJECT_VERSION = 94;
+ DYLIB_CURRENT_VERSION = 94;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3917,8 +3917,8 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 93;
- DYLIB_CURRENT_VERSION = 93;
+ CURRENT_PROJECT_VERSION = 94;
+ DYLIB_CURRENT_VERSION = 94;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3995,7 +3995,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 93;
+ CURRENT_PROJECT_VERSION = 94;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4025,10 +4025,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 93;
+ CURRENT_PROJECT_VERSION = 94;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 93;
+ DYLIB_CURRENT_VERSION = 94;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4272,7 +4272,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 93;
+ CURRENT_PROJECT_VERSION = 94;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4303,7 +4303,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 93;
+ CURRENT_PROJECT_VERSION = 94;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
Modified: lldb/trunk/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=146249&r1=146248&r2=146249&view=diff
==============================================================================
--- lldb/trunk/resources/LLDB-Info.plist (original)
+++ lldb/trunk/resources/LLDB-Info.plist Fri Dec 9 01:50:50 2011
@@ -17,7 +17,7 @@
CFBundleSignature
????
CFBundleVersion
- 93
+ 94
CFBundleName
${EXECUTABLE_NAME}
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=146249&r1=146248&r2=146249&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Fri Dec 9 01:50:50 2011
@@ -501,3 +501,114 @@
else
return false;
}
+
+
+// The architecture selection rules for arm processors
+// These cpu subtypes have distinct names (e.g. armv7f) but armv7 binaries run fine on an armv7f processor.
+
+bool
+PlatformDarwin::ARMGetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
+{
+ ArchSpec system_arch (GetSystemArchitecture());
+ const ArchSpec::Core system_core = system_arch.GetCore();
+ switch (system_core)
+ {
+ default:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv7-apple-darwin", NULL); return true;
+ case 1: arch.SetTriple ("armv7f-apple-darwin", NULL); return true;
+ case 2: arch.SetTriple ("armv7k-apple-darwin", NULL); return true;
+ case 3: arch.SetTriple ("armv7s-apple-darwin", NULL); return true;
+ case 4: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
+ case 5: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
+ case 6: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
+ case 7: arch.SetTriple ("arm-apple-darwin", NULL); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv7f:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv7f-apple-darwin", NULL); return true;
+ case 1: arch.SetTriple ("armv7-apple-darwin", NULL); return true;
+ case 2: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
+ case 3: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
+ case 4: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
+ case 5: arch.SetTriple ("arm-apple-darwin", NULL); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv7k:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv7k-apple-darwin", NULL); return true;
+ case 1: arch.SetTriple ("armv7-apple-darwin", NULL); return true;
+ case 2: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
+ case 3: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
+ case 4: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
+ case 5: arch.SetTriple ("arm-apple-darwin", NULL); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv7s:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv7s-apple-darwin", NULL); return true;
+ case 1: arch.SetTriple ("armv7-apple-darwin", NULL); return true;
+ case 2: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
+ case 3: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
+ case 4: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
+ case 5: arch.SetTriple ("arm-apple-darwin", NULL); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv7:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv7-apple-darwin", NULL); return true;
+ case 1: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
+ case 2: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
+ case 3: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
+ case 4: arch.SetTriple ("arm-apple-darwin", NULL); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv6:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
+ case 1: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
+ case 2: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
+ case 3: arch.SetTriple ("arm-apple-darwin", NULL); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv5:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
+ case 1: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
+ case 2: arch.SetTriple ("arm-apple-darwin", NULL); return true;
+ default: break;
+ }
+ break;
+
+ case ArchSpec::eCore_arm_armv4:
+ switch (idx)
+ {
+ case 0: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
+ case 1: arch.SetTriple ("arm-apple-darwin", NULL); return true;
+ default: break;
+ }
+ break;
+ }
+ arch.Clear();
+ return false;
+}
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h?rev=146249&r1=146248&r2=146249&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h Fri Dec 9 01:50:50 2011
@@ -88,6 +88,8 @@
virtual bool
ModuleIsExcludedForNonModuleSpecificSearches (lldb_private::Target &target, const lldb::ModuleSP &module_sp);
+ bool ARMGetSupportedArchitectureAtIndex (uint32_t idx, lldb_private::ArchSpec &arch);
+
protected:
lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote darwin OS
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=146249&r1=146248&r2=146249&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Fri Dec 9 01:50:50 2011
@@ -178,6 +178,10 @@
bool
PlatformMacOSX::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
{
+#if defined (__arm__)
+ return ARMGetSupportedArchitectureAtIndex (idx, arch);
+#endif
+
if (idx == 0)
{
arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
@@ -199,4 +203,3 @@
return false;
}
-
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=146249&r1=146248&r2=146249&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Fri Dec 9 01:50:50 2011
@@ -485,106 +485,5 @@
bool
PlatformRemoteiOS::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
{
- ArchSpec system_arch (GetSystemArchitecture());
- const ArchSpec::Core system_core = system_arch.GetCore();
- switch (system_core)
- {
- default:
- switch (idx)
- {
- case 0: arch.SetTriple ("armv7-apple-darwin", NULL); return true;
- case 1: arch.SetTriple ("armv7f-apple-darwin", NULL); return true;
- case 2: arch.SetTriple ("armv7k-apple-darwin", NULL); return true;
- case 3: arch.SetTriple ("armv7s-apple-darwin", NULL); return true;
- case 4: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
- case 5: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
- case 6: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
- case 7: arch.SetTriple ("arm-apple-darwin", NULL); return true;
- default: break;
- }
- break;
-
- case ArchSpec::eCore_arm_armv7f:
- switch (idx)
- {
- case 0: arch.SetTriple ("armv7f-apple-darwin", NULL); return true;
- case 1: arch.SetTriple ("armv7-apple-darwin", NULL); return true;
- case 2: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
- case 3: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
- case 4: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
- case 5: arch.SetTriple ("arm-apple-darwin", NULL); return true;
- default: break;
- }
- break;
-
- case ArchSpec::eCore_arm_armv7k:
- switch (idx)
- {
- case 0: arch.SetTriple ("armv7k-apple-darwin", NULL); return true;
- case 1: arch.SetTriple ("armv7-apple-darwin", NULL); return true;
- case 2: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
- case 3: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
- case 4: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
- case 5: arch.SetTriple ("arm-apple-darwin", NULL); return true;
- default: break;
- }
- break;
-
- case ArchSpec::eCore_arm_armv7s:
- switch (idx)
- {
- case 0: arch.SetTriple ("armv7s-apple-darwin", NULL); return true;
- case 1: arch.SetTriple ("armv7-apple-darwin", NULL); return true;
- case 2: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
- case 3: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
- case 4: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
- case 5: arch.SetTriple ("arm-apple-darwin", NULL); return true;
- default: break;
- }
- break;
-
- case ArchSpec::eCore_arm_armv7:
- switch (idx)
- {
- case 0: arch.SetTriple ("armv7-apple-darwin", NULL); return true;
- case 1: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
- case 2: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
- case 3: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
- case 4: arch.SetTriple ("arm-apple-darwin", NULL); return true;
- default: break;
- }
- break;
-
- case ArchSpec::eCore_arm_armv6:
- switch (idx)
- {
- case 0: arch.SetTriple ("armv6-apple-darwin", NULL); return true;
- case 1: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
- case 2: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
- case 3: arch.SetTriple ("arm-apple-darwin", NULL); return true;
- default: break;
- }
- break;
-
- case ArchSpec::eCore_arm_armv5:
- switch (idx)
- {
- case 0: arch.SetTriple ("armv5-apple-darwin", NULL); return true;
- case 1: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
- case 2: arch.SetTriple ("arm-apple-darwin", NULL); return true;
- default: break;
- }
- break;
-
- case ArchSpec::eCore_arm_armv4:
- switch (idx)
- {
- case 0: arch.SetTriple ("armv4-apple-darwin", NULL); return true;
- case 1: arch.SetTriple ("arm-apple-darwin", NULL); return true;
- default: break;
- }
- break;
- }
- arch.Clear();
- return false;
+ return ARMGetSupportedArchitectureAtIndex (idx, arch);
}
From gclayton at apple.com Fri Dec 9 02:48:30 2011
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 09 Dec 2011 08:48:30 -0000
Subject: [Lldb-commits] [lldb] r146250 - in
/lldb/trunk/source/Plugins/SymbolFile/DWARF: DWARFCompileUnit.h
HashedNameToDIE.h SymbolFileDWARF.cpp SymbolFileDWARF.h
Message-ID: <20111209084832.A9D642A6C12D@llvm.org>
Author: gclayton
Date: Fri Dec 9 02:48:30 2011
New Revision: 146250
URL: http://llvm.org/viewvc/llvm-project?rev=146250&view=rev
Log:
Tested a theory on the where when we lookup things in the accelerator tables
that if we prefer the current compile unit, followed by any compile units that
already had their DIEs parsed, followed by the rest of the matches, that we
might save some memory. This turned out not to help much. The code is commented
out, but I want to check it in so I don't lose the code in case it could help
later.
Added the ability to efficiently find the objective C class implementation
when using the new .apple_types acclerator tables with the type flags. If the
type flags are not available, we default back to what we were doing before.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h?rev=146250&r1=146249&r2=146250&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h Fri Dec 9 02:48:30 2011
@@ -90,6 +90,12 @@
m_die_array.push_back(die);
}
+ bool
+ HasDIEsParsed () const
+ {
+ return m_die_array.size() > 1;
+ }
+
DWARFDebugInfoEntry*
GetDIEAtIndexUnchecked (uint32_t idx)
{
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h?rev=146250&r1=146249&r2=146250&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h Fri Dec 9 02:48:30 2011
@@ -60,6 +60,20 @@
}
}
+ static void
+ ExtractTypesFromDIEArray (const DIEInfoArray &die_info_array,
+ uint32_t type_flag_mask,
+ uint32_t type_flag_value,
+ DIEArray &die_offsets)
+ {
+ const size_t count = die_info_array.size();
+ for (size_t i=0; iGetID()) : NULL, die_offsets);
const size_t num_matches = die_offsets.size();
@@ -3124,6 +3125,8 @@
m_namespace_index.Find (name, die_offsets);
}
+ //OptimizeDIEOffsetsOrder (sc.comp_unit ? GetDWARFCompileUnitForUID(sc.comp_unit->GetID()) : NULL, die_offsets);
+
DWARFCompileUnit* dwarf_cu = NULL;
const DWARFDebugInfoEntry* die = NULL;
const size_t num_matches = die_offsets.size();
@@ -3842,7 +3845,7 @@
if (m_apple_types_ap.get())
{
const char *name_cstr = type_name.GetCString();
- m_apple_types_ap->FindByName (name_cstr, die_offsets);
+ m_apple_types_ap->FindCompleteObjCClassByName (name_cstr, die_offsets);
}
}
else
@@ -3853,6 +3856,7 @@
m_type_index.Find (type_name, die_offsets);
}
+ //OptimizeDIEOffsetsOrder (cu, die_offsets);
const size_t num_matches = die_offsets.size();
@@ -3943,7 +3947,101 @@
return type_sp;
}
-
+//void
+//SymbolFileDWARF::OptimizeDIEOffsetsOrder (DWARFCompileUnit* cu, DIEArray &die_offsets)
+//{
+// // Make sure we at least have a few matches before we do anthing
+// const size_t num_die_offsets = die_offsets.size();
+// if (num_die_offsets > 1)
+// {
+// // Make sure we at least have more than one compie unit
+// DWARFDebugInfo* debug_info = DebugInfo();
+// if (debug_info->GetNumCompileUnits() > 1)
+// {
+// DIEArray optimized_die_offsets;
+// optimized_die_offsets.reserve (num_die_offsets);
+// dw_offset_t cu_lo_offset, cu_hi_offset;
+// size_t i;
+//
+// // Since we might find many types in many compile units,
+// // we should prefer ones that are in the current compile unit
+// // first if one is supplied
+// if (cu)
+// {
+// cu_lo_offset = cu->GetOffset();
+// cu_hi_offset = cu->GetNextCompileUnitOffset();
+//
+// // Use matches from the current compile unit first
+// for (i=0; i 0)
+// {
+// if (die_offset >= cu_hi_offset || die_offset <= cu_lo_offset)
+// {
+// DWARFCompileUnit* curr_cu = debug_info->GetCompileUnitContainingDIE(die_offset).get();
+// if (curr_cu)
+// {
+// cu_lo_offset = curr_cu->GetOffset();
+// cu_hi_offset = curr_cu->GetNextCompileUnitOffset();
+// cu_has_dies = curr_cu->HasDIEsParsed ();
+// }
+// else
+// continue;
+// }
+//
+// if (cu_has_dies)
+// {
+// optimized_die_offsets.push_back (die_offset);
+// die_offsets[i] = 0;
+// }
+// }
+// }
+//
+// // We didn't re-order anything...
+// if (optimized_die_offsets.empty())
+// return;
+//
+// // We did re-order some DIEs, so copy any remaining
+// // die offsets
+// if (optimized_die_offsets.size() < die_offsets.size())
+// {
+// for (i=0; iTag();
@@ -5953,7 +6052,23 @@
DWARFCompileUnit* dwarf_cu = NULL;
const DWARFDebugInfoEntry* die = NULL;
- size_t num_matches = m_type_index.Find (ConstString(name), die_offsets);
+
+ if (m_using_apple_tables)
+ {
+ if (m_apple_types_ap.get())
+ m_apple_types_ap->FindByName (name, die_offsets);
+ }
+ else
+ {
+ if (!m_indexed)
+ Index ();
+
+ m_type_index.Find (ConstString(name), die_offsets);
+ }
+
+ //OptimizeDIEOffsetsOrder (NULL, die_offsets);
+
+ const size_t num_matches = die_offsets.size();
if (num_matches)
{
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=146250&r1=146249&r2=146250&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Dec 9 02:48:30 2011
@@ -430,6 +430,10 @@
return high_uid == GetID();
return true;
}
+
+// void
+// OptimizeDIEOffsetsOrder (DWARFCompileUnit* cu,
+// DIEArray &die_offsets);
lldb::user_id_t
MakeUserID (dw_offset_t die_offset) const
From jingham at apple.com Fri Dec 9 13:48:23 2011
From: jingham at apple.com (Jim Ingham)
Date: Fri, 09 Dec 2011 19:48:23 -0000
Subject: [Lldb-commits] [lldb] r146271 -
/lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp
Message-ID: <20111209194823.3433C1BE003@llvm.org>
Author: jingham
Date: Fri Dec 9 13:48:22 2011
New Revision: 146271
URL: http://llvm.org/viewvc/llvm-project?rev=146271&view=rev
Log:
Don't spam warnings about not being able to read memory at 0x0.
Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp?rev=146271&r1=146270&r2=146271&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp Fri Dec 9 13:48:22 2011
@@ -85,7 +85,10 @@
mach_msg_type_number_t curr_bytes_read = 0;
vm_offset_t vm_memory = NULL;
m_err = ::mach_vm_read (task, curr_addr, curr_size, &vm_memory, &curr_bytes_read);
- if (DNBLogCheckLogBit(LOG_MEMORY) || m_err.Fail())
+
+ // We end up being asked to read memory at 0x0 a lot without that being a real error, so that ends up just
+ // causing a lot of useless log spam. Only complain on failing reads if the address is not 0x0.
+ if (DNBLogCheckLogBit(LOG_MEMORY) || (m_err.Fail() && curr_addr != 0))
m_err.LogThreaded("::mach_vm_read ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt => %i )", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read);
if (m_err.Success())
From scallanan at apple.com Fri Dec 9 17:24:27 2011
From: scallanan at apple.com (Sean Callanan)
Date: Fri, 09 Dec 2011 23:24:27 -0000
Subject: [Lldb-commits] [lldb] r146295 -
/lldb/trunk/source/Symbol/ClangASTContext.cpp
Message-ID: <20111209232427.3AA091BE003@llvm.org>
Author: spyffe
Date: Fri Dec 9 17:24:26 2011
New Revision: 146295
URL: http://llvm.org/viewvc/llvm-project?rev=146295&view=rev
Log:
Fixed a problem with properties where LLDB was not
creating appropriate setter/getter methods for
property definitions.
Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=146295&r1=146294&r2=146295&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Dec 9 17:24:26 2011
@@ -2148,7 +2148,7 @@
uint32_t property_attributes
)
{
- if (class_opaque_type == NULL)
+ if (class_opaque_type == NULL || property_name == NULL || property_name[0] == '\0')
return false;
IdentifierTable *identifier_table = &ast->Idents;
@@ -2166,8 +2166,15 @@
{
ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
+ clang_type_t property_opaque_type_to_access;
+
+ if (property_opaque_type)
+ property_opaque_type_to_access = property_opaque_type;
+ else if (ivar_decl)
+ property_opaque_type_to_access = ivar_decl->getType().getAsOpaquePtr();
+
// FIXME: For now, we don't know how to add properties if we don't have their associated ivar.
- if (class_interface_decl && ivar_decl)
+ if (class_interface_decl && property_opaque_type_to_access)
{
clang::TypeSourceInfo *prop_type_source;
if (ivar_decl)
@@ -2182,25 +2189,40 @@
SourceLocation(), //Source Location for AT
prop_type_source
);
- if (property_decl)
- {
+ if (property_decl)
+ {
class_interface_decl->addDecl (property_decl);
+
+ Selector setter_sel, getter_sel;
+
if (property_setter_name != NULL)
{
std::string property_setter_no_colon(property_setter_name, strlen(property_setter_name) - 1);
clang::IdentifierInfo *setter_ident = &identifier_table->get(property_setter_no_colon.c_str());
- Selector setter_sel = ast->Selectors.getSelector(1, &setter_ident);
+ setter_sel = ast->Selectors.getSelector(1, &setter_ident);
property_decl->setSetterName(setter_sel);
property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_setter);
}
+ else if (!(property_attributes & DW_APPLE_PROPERTY_readonly))
+ {
+ std::string setter_sel_string("set");
+ setter_sel_string.push_back(::toupper(property_name[0]));
+ setter_sel_string.append(&property_name[1]);
+ clang::IdentifierInfo *setter_ident = &identifier_table->get(setter_sel_string.c_str());
+ setter_sel = ast->Selectors.getSelector(1, &setter_ident);
+ }
if (property_getter_name != NULL)
{
clang::IdentifierInfo *getter_ident = &identifier_table->get(property_getter_name);
- Selector getter_sel = ast->Selectors.getSelector(0, &getter_ident);
+ getter_sel = ast->Selectors.getSelector(0, &getter_ident);
property_decl->setGetterName(getter_sel);
property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_getter);
-
+ }
+ else
+ {
+ clang::IdentifierInfo *getter_ident = &identifier_table->get(property_name);
+ getter_sel = ast->Selectors.getSelector(0, &getter_ident);
}
if (ivar_decl)
@@ -2218,9 +2240,86 @@
property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_copy);
if (property_attributes & DW_APPLE_PROPERTY_nonatomic)
property_decl->setPropertyAttributes (clang::ObjCPropertyDecl::OBJC_PR_nonatomic);
+
+ if (!getter_sel.isNull() && !class_interface_decl->lookupInstanceMethod(getter_sel))
+ {
+ QualType result_type = QualType::getFromOpaquePtr(property_opaque_type_to_access);
+
+ const bool isInstance = true;
+ const bool isVariadic = false;
+ const bool isSynthesized = false;
+ const bool isImplicitlyDeclared = true;
+ const bool isDefined = false;
+ const ObjCMethodDecl::ImplementationControl impControl = ObjCMethodDecl::None;
+ const bool HasRelatedResultType = false;
+
+ ObjCMethodDecl *getter = ObjCMethodDecl::Create(*ast,
+ SourceLocation(),
+ SourceLocation(),
+ getter_sel,
+ result_type,
+ NULL,
+ class_interface_decl,
+ isInstance,
+ isVariadic,
+ isSynthesized,
+ isImplicitlyDeclared,
+ isDefined,
+ impControl,
+ HasRelatedResultType);
+
+ getter->setMethodParams(*ast, ArrayRef(), ArrayRef());
+
+ class_interface_decl->addDecl(getter);
+ }
+
+ if (!setter_sel.isNull() && !class_interface_decl->lookupInstanceMethod(setter_sel))
+ {
+ QualType result_type = ast->VoidTy;
+
+ const bool isInstance = true;
+ const bool isVariadic = false;
+ const bool isSynthesized = false;
+ const bool isImplicitlyDeclared = true;
+ const bool isDefined = false;
+ const ObjCMethodDecl::ImplementationControl impControl = ObjCMethodDecl::None;
+ const bool HasRelatedResultType = false;
+
+ ObjCMethodDecl *setter = ObjCMethodDecl::Create(*ast,
+ SourceLocation(),
+ SourceLocation(),
+ setter_sel,
+ result_type,
+ NULL,
+ class_interface_decl,
+ isInstance,
+ isVariadic,
+ isSynthesized,
+ isImplicitlyDeclared,
+ isDefined,
+ impControl,
+ HasRelatedResultType);
+
+ llvm::SmallVector params;
+
+ params.push_back (ParmVarDecl::Create (*ast,
+ setter,
+ SourceLocation(),
+ SourceLocation(),
+ NULL, // anonymous
+ QualType::getFromOpaquePtr(property_opaque_type_to_access),
+ NULL,
+ SC_Auto,
+ SC_Auto,
+ NULL));
+
+ setter->setMethodParams(*ast, ArrayRef(params), ArrayRef());
+
+ class_interface_decl->addDecl(setter);
+ }
return true;
- }
+ }
}
}
}
From jingham at apple.com Fri Dec 9 19:49:43 2011
From: jingham at apple.com (Jim Ingham)
Date: Sat, 10 Dec 2011 01:49:43 -0000
Subject: [Lldb-commits] [lldb] r146309 - in /lldb/trunk:
include/lldb/Core/ValueObject.h source/Core/ValueObject.cpp
Message-ID: <20111210014943.D90871BE003@llvm.org>
Author: jingham
Date: Fri Dec 9 19:49:43 2011
New Revision: 146309
URL: http://llvm.org/viewvc/llvm-project?rev=146309&view=rev
Log:
Don't try to cache the ExecutionContextScope in the ValueObject::EvaluationPoint, it is too
hard to ensure it doesn't get invalidated out from under us. Instead look it up from the ThreadID
and StackID when asked for it.
Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/source/Core/ValueObject.cpp
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=146309&r1=146308&r2=146309&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Fri Dec 9 19:49:43 2011
@@ -445,10 +445,15 @@
private:
bool
- SyncWithProcessState ();
+ SyncWithProcessState ()
+ {
+ ExecutionContextScope *exe_scope;
+ return SyncWithProcessState(exe_scope);
+ }
+
+ bool
+ SyncWithProcessState (ExecutionContextScope *&exe_scope);
- ExecutionContextScope *m_exe_scope; // This is not the way to store the evaluation point state, it is just
- // a cache of the lookup, and gets thrown away when we update.
bool m_needs_update;
bool m_first_update;
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=146309&r1=146308&r2=146309&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Dec 9 19:49:43 2011
@@ -3441,8 +3441,7 @@
{
ExecutionContext exe_ctx;
- ExecutionContextScope *computed_exe_scope = exe_scope; // If use_selected is true, we may find a better scope,
- // and if so we want to cache that not the original.
+
if (exe_scope)
exe_scope->CalculateExecutionContext(exe_ctx);
Target *target = exe_ctx.GetTargetPtr();
@@ -3462,11 +3461,7 @@
if (thread == NULL)
{
if (use_selected)
- {
thread = m_process_sp->GetThreadList().GetSelectedThread().get();
- if (thread)
- computed_exe_scope = thread;
- }
}
if (thread != NULL)
@@ -3480,10 +3475,7 @@
{
frame = thread->GetSelectedFrame().get();
if (frame)
- {
m_stack_id = frame->GetStackID();
- computed_exe_scope = frame;
- }
}
}
else
@@ -3491,11 +3483,9 @@
}
}
}
- m_exe_scope = computed_exe_scope;
}
ValueObject::EvaluationPoint::EvaluationPoint (const ValueObject::EvaluationPoint &rhs) :
- m_exe_scope (rhs.m_exe_scope),
m_needs_update(true),
m_first_update(true),
m_target_sp (rhs.m_target_sp),
@@ -3513,10 +3503,11 @@
ExecutionContextScope *
ValueObject::EvaluationPoint::GetExecutionContextScope ()
{
- // We have to update before giving out the scope, or we could be handing out stale pointers.
- SyncWithProcessState();
+ // We have to update before giving out the scope, or we could be handing out stale pointers.
+ ExecutionContextScope *exe_scope;
+ SyncWithProcessState(exe_scope);
- return m_exe_scope;
+ return exe_scope;
}
// This function checks the EvaluationPoint against the current process state. If the current
@@ -3524,14 +3515,15 @@
// false, meaning "no change". If the current state is different, we update our state, and return
// true meaning "yes, change". If we did see a change, we also set m_needs_update to true, so
// future calls to NeedsUpdate will return true.
+// exe_scope will be set to the current execution context scope.
bool
-ValueObject::EvaluationPoint::SyncWithProcessState()
+ValueObject::EvaluationPoint::SyncWithProcessState(ExecutionContextScope *&exe_scope)
{
// If we don't have a process nothing can change.
if (!m_process_sp)
{
- m_exe_scope = m_target_sp.get();
+ exe_scope = m_target_sp.get();
return false;
}
@@ -3542,22 +3534,28 @@
// In either case, we aren't going to be able to sync with the process state.
if (current_mod_id.GetStopID() == 0)
{
- m_exe_scope = m_target_sp.get();
+ exe_scope = m_target_sp.get();
return false;
}
-
+
+ bool changed;
+
if (m_mod_id.IsValid())
{
if (m_mod_id == current_mod_id)
{
// Everything is already up to date in this object, no need do
// update the execution context scope.
- return false;
+ changed = false;
}
- m_mod_id = current_mod_id;
- m_needs_update = true;
+ else
+ {
+ m_mod_id = current_mod_id;
+ m_needs_update = true;
+ changed = true;
+ }
}
- m_exe_scope = m_process_sp.get();
+ exe_scope = m_process_sp.get();
// Something has changed, so we will return true. Now make sure the thread & frame still exist, and if either
// doesn't, mark ourselves as invalid.
@@ -3571,7 +3569,7 @@
}
else
{
- m_exe_scope = our_thread;
+ exe_scope = our_thread;
if (m_stack_id.IsValid())
{
@@ -3579,18 +3577,18 @@
if (our_frame == NULL)
SetInvalid();
else
- m_exe_scope = our_frame;
+ exe_scope = our_frame;
}
}
}
- return true;
+ return changed;
}
void
ValueObject::EvaluationPoint::SetUpdated ()
{
- // this will update the execution context scope and the m_mod_id
- SyncWithProcessState();
+ if (m_process_sp)
+ m_mod_id = m_process_sp->GetModID();
m_first_update = false;
m_needs_update = false;
}
@@ -3603,7 +3601,6 @@
return false;
bool needs_update = false;
- m_exe_scope = NULL;
// The target has to be non-null, and the
Target *target = exe_scope->CalculateTarget();
From gclayton at apple.com Fri Dec 9 20:15:28 2011
From: gclayton at apple.com (Greg Clayton)
Date: Sat, 10 Dec 2011 02:15:28 -0000
Subject: [Lldb-commits] [lldb] r146310 - in /lldb/trunk:
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h test/make/Makefile.rules
Message-ID: <20111210021528.650B11BE003@llvm.org>
Author: gclayton
Date: Fri Dec 9 20:15:28 2011
New Revision: 146310
URL: http://llvm.org/viewvc/llvm-project?rev=146310&view=rev
Log:
An assertion was firing when parsing types due to trying to complete parent
class decl contenxt types too often.
Also, relax where "dsymutil" binary can come from in the Makefile.rules.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/test/make/Makefile.rules
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=146310&r1=146309&r2=146310&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Dec 9 20:15:28 2011
@@ -78,6 +78,11 @@
using namespace lldb;
using namespace lldb_private;
+static inline bool
+DW_TAG_is_function_tag (dw_tag_t tag)
+{
+ return tag == DW_TAG_subprogram || tag == DW_TAG_inlined_subroutine;
+}
static AccessType
DW_ACCESS_to_AccessType (uint32_t dwarf_accessibility)
@@ -1626,6 +1631,13 @@
{
if (die != NULL)
{
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+ if (log)
+ LogMessage (log.get(), "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s'",
+ die->GetOffset(),
+ DW_TAG_value_to_name(die->Tag()),
+ die->GetName(this, cu));
+
// We might be coming in in the middle of a type tree (a class
// withing a class, an enum within a class), so parse any needed
// parent DIEs before we get to this one...
@@ -1637,12 +1649,28 @@
case DW_TAG_class_type:
{
// Get the type, which could be a forward declaration
+ if (log)
+ LogMessage (log.get(), "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s' resolve parent forward type for 0x%8.8x",
+ die->GetOffset(),
+ DW_TAG_value_to_name(die->Tag()),
+ die->GetName(this, cu),
+ decl_ctx_die->GetOffset());
+
Type *parent_type = ResolveTypeUID (cu, decl_ctx_die, assert_not_being_parsed);
- // Now ask the type to complete itself if it already hasn't.
- // This will make the call to ResolveType below just use the
- // cached value that is already parsed for "die"
- if (parent_type)
- parent_type->GetClangFullType();
+ if (DW_TAG_is_function_tag(die->Tag()))
+ {
+ if (log)
+ LogMessage (log.get(), "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s' resolve parent full type for 0x%8.8x since die is a function",
+ die->GetOffset(),
+ DW_TAG_value_to_name(die->Tag()),
+ die->GetName(this, cu),
+ decl_ctx_die->GetOffset());
+ // Ask the type to complete itself if it already hasn't since if we
+ // want a function (method or static) from a class, the class must
+ // create itself and add it's own methods and class functions.
+ if (parent_type)
+ parent_type->GetClangFullType();
+ }
}
break;
@@ -1695,10 +1723,13 @@
const dw_tag_t tag = die->Tag();
- DEBUG_PRINTF ("0x%8.8llx: %s (\"%s\") - resolve forward declaration...\n",
- MakeUserID(die->GetOffset()),
- DW_TAG_value_to_name(tag),
- type->GetName().AsCString());
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+ if (log)
+ LogMessage (log.get(),
+ "0x%8.8llx: %s '%s' resolving forward declaration...\n",
+ MakeUserID(die->GetOffset()),
+ DW_TAG_value_to_name(tag),
+ type->GetName().AsCString());
assert (clang_type);
DWARFDebugInfoEntry::Attributes attributes;
@@ -3039,8 +3070,6 @@
m_type_index.Find (name, die_offsets);
}
- //OptimizeDIEOffsetsOrder (sc.comp_unit ? GetDWARFCompileUnitForUID(sc.comp_unit->GetID()) : NULL, die_offsets);
-
const size_t num_matches = die_offsets.size();
if (num_matches)
@@ -3125,8 +3154,6 @@
m_namespace_index.Find (name, die_offsets);
}
- //OptimizeDIEOffsetsOrder (sc.comp_unit ? GetDWARFCompileUnitForUID(sc.comp_unit->GetID()) : NULL, die_offsets);
-
DWARFCompileUnit* dwarf_cu = NULL;
const DWARFDebugInfoEntry* die = NULL;
const size_t num_matches = die_offsets.size();
@@ -3689,6 +3716,9 @@
if (die_offset != DW_INVALID_OFFSET)
return GetClangDeclContextForDIEOffset (sc, die_offset);
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+ if (log)
+ LogMessage(log.get(), "SymbolFileDWARF::GetClangDeclContextForDIE (die = 0x%8.8x) %s '%s'", die->GetOffset(), DW_TAG_value_to_name(die->Tag()), die->GetName(this, cu));
// This is the DIE we want. Parse it, then query our map.
bool assert_not_being_parsed = true;
ResolveTypeUID (cu, die, assert_not_being_parsed);
@@ -3856,8 +3886,6 @@
m_type_index.Find (type_name, die_offsets);
}
- //OptimizeDIEOffsetsOrder (cu, die_offsets);
-
const size_t num_matches = die_offsets.size();
const dw_tag_t die_tag = die->Tag();
@@ -3947,100 +3975,6 @@
return type_sp;
}
-//void
-//SymbolFileDWARF::OptimizeDIEOffsetsOrder (DWARFCompileUnit* cu, DIEArray &die_offsets)
-//{
-// // Make sure we at least have a few matches before we do anthing
-// const size_t num_die_offsets = die_offsets.size();
-// if (num_die_offsets > 1)
-// {
-// // Make sure we at least have more than one compie unit
-// DWARFDebugInfo* debug_info = DebugInfo();
-// if (debug_info->GetNumCompileUnits() > 1)
-// {
-// DIEArray optimized_die_offsets;
-// optimized_die_offsets.reserve (num_die_offsets);
-// dw_offset_t cu_lo_offset, cu_hi_offset;
-// size_t i;
-//
-// // Since we might find many types in many compile units,
-// // we should prefer ones that are in the current compile unit
-// // first if one is supplied
-// if (cu)
-// {
-// cu_lo_offset = cu->GetOffset();
-// cu_hi_offset = cu->GetNextCompileUnitOffset();
-//
-// // Use matches from the current compile unit first
-// for (i=0; i 0)
-// {
-// if (die_offset >= cu_hi_offset || die_offset <= cu_lo_offset)
-// {
-// DWARFCompileUnit* curr_cu = debug_info->GetCompileUnitContainingDIE(die_offset).get();
-// if (curr_cu)
-// {
-// cu_lo_offset = curr_cu->GetOffset();
-// cu_hi_offset = curr_cu->GetNextCompileUnitOffset();
-// cu_has_dies = curr_cu->HasDIEsParsed ();
-// }
-// else
-// continue;
-// }
-//
-// if (cu_has_dies)
-// {
-// optimized_die_offsets.push_back (die_offset);
-// die_offsets[i] = 0;
-// }
-// }
-// }
-//
-// // We didn't re-order anything...
-// if (optimized_die_offsets.empty())
-// return;
-//
-// // We did re-order some DIEs, so copy any remaining
-// // die offsets
-// if (optimized_die_offsets.size() < die_offsets.size())
-// {
-// for (i=0; iTag();
@@ -4180,13 +4112,20 @@
if (die != NULL)
{
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
- if (log && dwarf_cu)
- {
- StreamString s;
- die->DumpLocation (this, dwarf_cu, s);
- LogMessage (log.get(), "SymbolFileDwarf::%s %s", __FUNCTION__, s.GetData());
-
- }
+ if (log)
+ LogMessage (log.get(), "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s'",
+ die->GetOffset(),
+ DW_TAG_value_to_name(die->Tag()),
+ die->GetName(this, dwarf_cu));
+//
+// LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+// if (log && dwarf_cu)
+// {
+// StreamString s;
+// die->DumpLocation (this, dwarf_cu, s);
+// LogMessage (log.get(), "SymbolFileDwarf::%s %s", __FUNCTION__, s.GetData());
+//
+// }
Type *type_ptr = m_die_to_type.lookup (die);
TypeList* type_list = GetTypeList();
@@ -6066,8 +6005,6 @@
m_type_index.Find (ConstString(name), die_offsets);
}
- //OptimizeDIEOffsetsOrder (NULL, die_offsets);
-
const size_t num_matches = die_offsets.size();
if (num_matches)
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=146310&r1=146309&r2=146310&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Dec 9 20:15:28 2011
@@ -431,10 +431,6 @@
return true;
}
-// void
-// OptimizeDIEOffsetsOrder (DWARFCompileUnit* cu,
-// DIEArray &die_offsets);
-
lldb::user_id_t
MakeUserID (dw_offset_t die_offset) const
{
Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=146310&r1=146309&r2=146310&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Fri Dec 9 20:15:28 2011
@@ -45,7 +45,7 @@
CFLAGS += $(FRAMEWORK_INCLUDES)
ifeq "$(OS)" "Darwin"
CFLAGS += -arch $(ARCH)
- DS := /usr/bin/dsymutil
+ DS := dsymutil
DSFLAGS =
DSYM = $(EXE).dSYM
endif
From scallanan at apple.com Fri Dec 9 21:12:34 2011
From: scallanan at apple.com (Sean Callanan)
Date: Sat, 10 Dec 2011 03:12:34 -0000
Subject: [Lldb-commits] [lldb] r146315 -
/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Message-ID: <20111210031234.6FF5C1BE003@llvm.org>
Author: spyffe
Date: Fri Dec 9 21:12:34 2011
New Revision: 146315
URL: http://llvm.org/viewvc/llvm-project?rev=146315&view=rev
Log:
Two fixes for file variables:
- Even if a frame isn't present, we always try
to use FindGlobalVariable to find variables.
Instead of using frame->TrackGlobalVariable()
to promote the VariableSP into a ValueObject,
we now simply use ValueObjectVariable.
- When requesting the value of a variable, we
allow returning of the "live version" of the
variable -- that is, the variable in the
target instead of a pointer to its freeze
dried version in LLDB -- even if there is no
process present.
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=146315&r1=146314&r2=146315&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Dec 9 21:12:34 2011
@@ -22,6 +22,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Expression/ASTDumper.h"
#include "lldb/Expression/ClangASTSource.h"
#include "lldb/Expression/ClangPersistentVariables.h"
@@ -411,8 +412,7 @@
const size_t pvar_byte_size = pvar_sp->GetByteSize();
uint8_t *pvar_data = pvar_sp->GetValueBytes();
- if (!ReadTarget(pvar_data, value, pvar_byte_size))
- return false;
+ ReadTarget(pvar_data, value, pvar_byte_size);
pvar_sp->m_flags &= ~(ClangExpressionVariable::EVNeedsFreezeDry);
}
@@ -1031,8 +1031,10 @@
if ((persistent_var_sp->m_flags & ClangExpressionVariable::EVIsProgramReference ||
persistent_var_sp->m_flags & ClangExpressionVariable::EVIsLLDBAllocated) &&
persistent_var_sp->m_live_sp &&
- m_parser_vars->m_exe_ctx->GetProcessSP() &&
- m_parser_vars->m_exe_ctx->GetProcessSP()->IsAlive())
+ ((persistent_var_sp->m_live_sp->GetValue().GetValueType() == Value::eValueTypeLoadAddress &&
+ m_parser_vars->m_exe_ctx->GetProcessSP() &&
+ m_parser_vars->m_exe_ctx->GetProcessSP()->IsAlive()) ||
+ (persistent_var_sp->m_live_sp->GetValue().GetValueType() == Value::eValueTypeFileAddress)))
{
return persistent_var_sp->m_live_sp->GetValue();
}
@@ -2539,7 +2541,7 @@
return;
}
}
- else if (frame && target)
+ else if (target)
{
var = FindGlobalVariable (*target,
module_sp,
@@ -2549,7 +2551,7 @@
if (var)
{
- valobj = frame->TrackGlobalVariable(var, eNoDynamicValues);
+ valobj = ValueObjectVariable::Create(target, var);
AddOneVariable(context, var, valobj, current_id);
context.m_found.variable = true;
}
From scallanan at apple.com Fri Dec 9 22:03:38 2011
From: scallanan at apple.com (Sean Callanan)
Date: Sat, 10 Dec 2011 04:03:38 -0000
Subject: [Lldb-commits] [lldb] r146317 -
/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Message-ID: <20111210040338.4B9651BE003@llvm.org>
Author: spyffe
Date: Fri Dec 9 22:03:38 2011
New Revision: 146317
URL: http://llvm.org/viewvc/llvm-project?rev=146317&view=rev
Log:
Fixed a problem where if a frame was present the
expression parser would never try getting typed
variables from the target.
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=146317&r1=146316&r2=146317&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Dec 9 22:03:38 2011
@@ -2541,7 +2541,8 @@
return;
}
}
- else if (target)
+
+ if (target)
{
var = FindGlobalVariable (*target,
module_sp,
@@ -2554,6 +2555,7 @@
valobj = ValueObjectVariable::Create(target, var);
AddOneVariable(context, var, valobj, current_id);
context.m_found.variable = true;
+ return;
}
}
From johnny.chen at apple.com Sat Dec 10 01:18:12 2011
From: johnny.chen at apple.com (Johnny Chen)
Date: Sat, 10 Dec 2011 07:18:12 -0000
Subject: [Lldb-commits] [lldb] r146320 -
/lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
Message-ID: <20111210071812.1CE931BE003@llvm.org>
Author: johnny
Date: Sat Dec 10 01:18:11 2011
New Revision: 146320
URL: http://llvm.org/viewvc/llvm-project?rev=146320&view=rev
Log:
Move some print stmts to the test method, where they get printed only if the test is qualified to run
under the current test driver run configuration.
Modified:
lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
Modified: lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py?rev=146320&r1=146319&r2=146320&view=diff
==============================================================================
--- lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py (original)
+++ lldb/trunk/test/benchmarks/disassembly/TestDisassembly.py Sat Dec 10 01:18:11 2011
@@ -29,10 +29,6 @@
else:
self.gdbExec = "gdb"
- print
- print "lldb path: %s" % self.lldbExec
- print "gdb path: %s" % self.gdbExec
-
self.exe = self.lldbHere
self.function = 'Driver::MainLoop()'
self.lldb_avg = None
@@ -45,6 +41,10 @@
def test_run_lldb_then_gdb(self):
"""Test disassembly on a large function with lldb vs. gdb."""
print
+ print "lldb path: %s" % self.lldbExec
+ print "gdb path: %s" % self.gdbExec
+
+ print
self.run_lldb_disassembly(self.exe, self.function, self.count)
print "lldb benchmark:", self.stopwatch
self.run_gdb_disassembly(self.exe, self.function, self.count)
@@ -55,6 +55,10 @@
def test_run_gdb_then_lldb(self):
"""Test disassembly on a large function with lldb vs. gdb."""
print
+ print "lldb path: %s" % self.lldbExec
+ print "gdb path: %s" % self.gdbExec
+
+ print
self.run_gdb_disassembly(self.exe, self.function, self.count)
print "gdb benchmark:", self.stopwatch
self.run_lldb_disassembly(self.exe, self.function, self.count)
From gclayton at apple.com Sat Dec 10 15:05:27 2011
From: gclayton at apple.com (Greg Clayton)
Date: Sat, 10 Dec 2011 21:05:27 -0000
Subject: [Lldb-commits] [lldb] r146330 - in /lldb/trunk:
include/lldb/Core/Address.h source/Core/Address.cpp
source/Core/SourceManager.cpp
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Message-ID: <20111210210527.3A0AB2A6C12C@llvm.org>
Author: gclayton
Date: Sat Dec 10 15:05:26 2011
New Revision: 146330
URL: http://llvm.org/viewvc/llvm-project?rev=146330&view=rev
Log:
Stopped the SymbolFileDWARF::FindFunctions (...) from always calculating
the line table entry for all functions that were found. This can slow down
the expression parser if it ends up finding a bunch of matches. Fixed the
places that were relying on the line table entry being filled in.
Discovered a recursive stack blowout that happened when "main" didn't have
line info for it and there was no line information for "main"
Modified:
lldb/trunk/include/lldb/Core/Address.h
lldb/trunk/source/Core/Address.cpp
lldb/trunk/source/Core/SourceManager.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Modified: lldb/trunk/include/lldb/Core/Address.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=146330&r1=146329&r2=146330&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Sat Dec 10 15:05:26 2011
@@ -498,25 +498,25 @@
//------------------------------------------------------------------
uint32_t
CalculateSymbolContext (SymbolContext *sc,
- uint32_t resolve_scope = lldb::eSymbolContextEverything);
+ uint32_t resolve_scope = lldb::eSymbolContextEverything) const;
Module *
- CalculateSymbolContextModule ();
+ CalculateSymbolContextModule () const;
CompileUnit *
- CalculateSymbolContextCompileUnit ();
+ CalculateSymbolContextCompileUnit () const;
Function *
- CalculateSymbolContextFunction ();
+ CalculateSymbolContextFunction () const;
Block *
- CalculateSymbolContextBlock ();
+ CalculateSymbolContextBlock () const;
Symbol *
- CalculateSymbolContextSymbol ();
+ CalculateSymbolContextSymbol () const;
bool
- CalculateSymbolContextLineEntry (LineEntry &line_entry);
+ CalculateSymbolContextLineEntry (LineEntry &line_entry) const;
protected:
//------------------------------------------------------------------
Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=146330&r1=146329&r2=146330&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Sat Dec 10 15:05:26 2011
@@ -729,7 +729,7 @@
}
uint32_t
-Address::CalculateSymbolContext (SymbolContext *sc, uint32_t resolve_scope)
+Address::CalculateSymbolContext (SymbolContext *sc, uint32_t resolve_scope) const
{
sc->Clear();
// Absolute addresses don't have enough information to reconstruct even their target.
@@ -747,7 +747,7 @@
}
Module *
-Address::CalculateSymbolContextModule ()
+Address::CalculateSymbolContextModule () const
{
if (m_section)
return m_section->GetModule();
@@ -755,7 +755,7 @@
}
CompileUnit *
-Address::CalculateSymbolContextCompileUnit ()
+Address::CalculateSymbolContextCompileUnit () const
{
if (m_section)
{
@@ -771,7 +771,7 @@
}
Function *
-Address::CalculateSymbolContextFunction ()
+Address::CalculateSymbolContextFunction () const
{
if (m_section)
{
@@ -787,7 +787,7 @@
}
Block *
-Address::CalculateSymbolContextBlock ()
+Address::CalculateSymbolContextBlock () const
{
if (m_section)
{
@@ -803,7 +803,7 @@
}
Symbol *
-Address::CalculateSymbolContextSymbol ()
+Address::CalculateSymbolContextSymbol () const
{
if (m_section)
{
@@ -819,7 +819,7 @@
}
bool
-Address::CalculateSymbolContextLineEntry (LineEntry &line_entry)
+Address::CalculateSymbolContextLineEntry (LineEntry &line_entry) const
{
if (m_section)
{
Modified: lldb/trunk/source/Core/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SourceManager.cpp?rev=146330&r1=146329&r2=146330&view=diff
==============================================================================
--- lldb/trunk/source/Core/SourceManager.cpp (original)
+++ lldb/trunk/source/Core/SourceManager.cpp Sat Dec 10 15:05:26 2011
@@ -250,19 +250,22 @@
{
SymbolContext sc;
sc_list.GetContextAtIndex(idx, sc);
- if (sc.line_entry.file)
+ if (sc.function)
{
- SetDefaultFileAndLine(sc.line_entry.file, sc.line_entry.line);
- break;
+ lldb_private::LineEntry line_entry;
+ if (sc.function->GetAddressRange().GetBaseAddress().CalculateSymbolContextLineEntry (line_entry))
+ {
+ SetDefaultFileAndLine (line_entry.file,
+ line_entry.line);
+ file_spec = m_last_file_sp->GetFileSpec();
+ line = m_last_file_line;
+ return true;
+ }
}
}
- return GetDefaultFileAndLine (file_spec, line);
}
- else
- return false;
}
- else
- return false;
+ return false;
}
void
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=146330&r1=146329&r2=146330&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Sat Dec 10 15:05:26 2011
@@ -1997,11 +1997,6 @@
if (resolve_scope & eSymbolContextLineEntry)
{
LineTable *line_table = sc.comp_unit->GetLineTable();
- if (line_table == NULL)
- {
- if (ParseCompileUnitLineTable(sc))
- line_table = sc.comp_unit->GetLineTable();
- }
if (line_table != NULL)
{
if (so_addr.IsLinkedAddress())
@@ -2560,18 +2555,6 @@
if (addr.IsValid())
{
-
- // We found the function, so we should find the line table
- // and line table entry as well
- LineTable *line_table = sc.comp_unit->GetLineTable();
- if (line_table == NULL)
- {
- if (ParseCompileUnitLineTable(sc))
- line_table = sc.comp_unit->GetLineTable();
- }
- if (line_table != NULL)
- line_table->FindLineEntryByAddress (addr, sc.line_entry);
-
sc_list.Append(sc);
return true;
}