Author: enrico
Date: Wed May 4 20:15:57 2016
New Revision: 268587
URL: http://llvm.org/viewvc/llvm-project?rev=268587&view=rev
Log:
Make the functions that fetch data from the ObjC runtime choose whether or not
to log depending on whether the types log is enabled
This can prove helpful in debugging issues with that retrieval even if LLDB
wasn't compiled with the magic macros defined
Modified:
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
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=268587&r1=268586&r2=268587&view=diff
==============================================================================
---
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
(original)
+++
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
Wed May 4 20:15:57 2016
@@ -80,12 +80,7 @@ extern "C"
char *strncpy (char * s1, const char * s2, size_t n);
int printf(const char * format, ...);
}
-//#define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN
-#ifdef ENABLE_DEBUG_PRINTF
-#define DEBUG_PRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)
-#else
-#define DEBUG_PRINTF(fmt, ...)
-#endif
+#define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
typedef struct _NXMapTable {
void *prototype;
@@ -111,7 +106,8 @@ struct ClassInfo
uint32_t
__lldb_apple_objc_v2_get_dynamic_class_info (void
*gdb_objc_realized_classes_ptr,
void *class_infos_ptr,
- uint32_t class_infos_byte_size)
+ uint32_t class_infos_byte_size,
+ uint32_t should_log)
{
DEBUG_PRINTF ("gdb_objc_realized_classes_ptr = %p\n",
gdb_objc_realized_classes_ptr);
DEBUG_PRINTF ("class_infos_ptr = %p\n", class_infos_ptr);
@@ -169,12 +165,7 @@ extern "C"
int printf(const char * format, ...);
}
-// #define ENABLE_DEBUG_PRINTF // COMMENT THIS LINE OUT PRIOR TO CHECKIN
-#ifdef ENABLE_DEBUG_PRINTF
-#define DEBUG_PRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)
-#else
-#define DEBUG_PRINTF(fmt, ...)
-#endif
+#define DEBUG_PRINTF(fmt, ...) if (should_log) printf(fmt, ## __VA_ARGS__)
struct objc_classheader_t {
@@ -223,7 +214,8 @@ struct ClassInfo
uint32_t
__lldb_apple_objc_v2_get_shared_cache_class_info (void *objc_opt_ro_ptr,
void *class_infos_ptr,
- uint32_t
class_infos_byte_size)
+ uint32_t
class_infos_byte_size,
+ uint32_t should_log)
{
uint32_t idx = 0;
DEBUG_PRINTF ("objc_opt_ro_ptr = %p\n", objc_opt_ro_ptr);
@@ -1451,6 +1443,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
value.SetValueType (Value::eValueTypeScalar);
value.SetCompilerType (clang_uint32_t_type);
arguments.PushValue (value);
+ arguments.PushValue (value);
get_class_info_function =
m_get_class_info_code->MakeFunctionCaller(clang_uint32_t_type,
arguments,
@@ -1492,12 +1485,14 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
return false;
Mutex::Locker locker(m_get_class_info_args_mutex);
-
+
// Fill in our function argument values
arguments.GetValueAtIndex(0)->GetScalar() =
hash_table.GetTableLoadAddress();
arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
+ arguments.GetValueAtIndex(3)->GetScalar() =
(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES) == nullptr ? 0 : 1);
+
bool success = false;
diagnostics.Clear();
@@ -1711,6 +1706,7 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
//value.SetContext (Value::eContextTypeClangType, clang_uint32_t_type);
value.SetCompilerType (clang_uint32_t_type);
arguments.PushValue (value);
+ arguments.PushValue (value);
get_shared_cache_class_info_function =
m_get_shared_cache_class_info_code->MakeFunctionCaller(clang_uint32_t_type,
arguments,
@@ -1746,6 +1742,8 @@ AppleObjCRuntimeV2::UpdateISAToDescripto
arguments.GetValueAtIndex(0)->GetScalar() = objc_opt_ptr;
arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
+ arguments.GetValueAtIndex(3)->GetScalar() =
(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES) == nullptr ? 0 : 1);
+
bool success = false;
bool any_found = false;
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits