[Lldb-commits] [PATCH] D38153: Inhibit global lookups for symbols in the IR dynamic checks

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 21 14:03:29 PDT 2017


clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.


================
Comment at: source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp:651-652
     return;
+  if (name_unique_cstr[0] == '_' && name_unique_cstr[1] == '$')
+    return;
 
----------------
Should we use a function or macro here? This code is duped below.


================
Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp:812-814
+  if (name_unique_cstr[0] == '_' && name_unique_cstr[1] == '$')
+    return;
+
----------------
Should we use a function or macro here? This code is duped above


================
Comment at: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp:815-831
+                     "extern \"C\" void *gdb_object_getClass(void *);        \n"
+                     "extern \"C\"  int printf(const char *format, ...);     \n"
+                     "extern \"C\" void                                      \n"
+                     "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) {\n"
+                     "  if ($__lldb_arg_obj == (void *)0)                    \n"
+                     "    return; // nil is ok                               \n"
+                     "  if (!gdb_object_getClass($__lldb_arg_obj)) {         \n"
----------------
Since you are modifying this string switch to R"( to make it much clearer:

```
R"(
extern "C" void *gdb_object_getClass(void *);
extern "C"  int printf(const char *format, ...);
extern "C" void
%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector)
  if ($__lldb_arg_obj == (void *)0)
    return; // nil is ok
  if (!gdb_object_getClass($__lldb_arg_obj)) {
    *((volatile int *)0) = 'ocgc';
  } else if ($__lldb_arg_selector != (void *)0) {
    signed char $responds = (signed char)
        [(id)$__lldb_arg_obj respondsToSelector:
            (void *) $__lldb_arg_selector];
    if ($responds == (signed char) 0)
      *((volatile int *)0) = 'ocgc';
  }
})";
```


================
Comment at: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp:834-852
+                     "extern \"C\" void *gdb_class_getClass(void *);         \n"
+                     "extern \"C\"  int printf(const char *format, ...);     \n"
+                     "extern \"C\"  void                                     \n"
+                     "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) {\n"
+                     "  if ($__lldb_arg_obj == (void *)0)                    \n"
+                     "    return; // nil is ok                               \n"
+                     "  void **$isa_ptr = (void **)$__lldb_arg_obj;          \n"
----------------
Use R"( as above.


Repository:
  rL LLVM

https://reviews.llvm.org/D38153





More information about the lldb-commits mailing list