summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2011-12-16 00:05:58 +0000
committerJim Ingham <jingham@apple.com>2011-12-16 00:05:58 +0000
commit918533bcfe3c2fbf5a3c935c463225f265d7142c (patch)
treeb6501445d58b3b71f17e1fe6fa5721fd06de4810
parent30a89761276fc25ec595af6a79b004361caf974c (diff)
downloadbcm5719-llvm-918533bcfe3c2fbf5a3c935c463225f265d7142c.tar.gz
bcm5719-llvm-918533bcfe3c2fbf5a3c935c463225f265d7142c.zip
Fix a bug where when debugging with .o files, we end up with two symbols for each real OBJC_CLASS_$_whatever, one of which is correctly classified as an ObjCClass symbol, and the other is just a data symbol. This was messing up the ObjC dynamic type detection.
<rdar://problem/10589527> llvm-svn: 146712
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 60b94cd7173..133bcd6b68d 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -876,10 +876,26 @@ ObjectFileMachO::ParseSymtab (bool minimize)
case StabGlobalSymbol:
// N_GSYM -- global symbol: name,,NO_SECT,type,0
// Sometimes the N_GSYM value contains the address.
- sym[sym_idx].SetExternal(true);
- if (nlist.n_value != 0)
- symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
- type = eSymbolTypeData;
+
+ // FIXME: In the .o files, we have a GSYM and a debug symbol for all the ObjC data. They
+ // have the same address, but we want to ensure that we always find only the real symbol,
+ // 'cause we don't currently correctly attribute the GSYM one to the ObjCClass/Ivar/MetaClass
+ // symbol type. This is a temporary hack to make sure the ObjectiveC symbols get treated
+ // correctly. To do this right, we should coalesce all the GSYM & global symbols that have the
+ // same address.
+
+ if (symbol_name && symbol_name[0] == '_' && symbol_name[1] == 'O'
+ && (strncmp (symbol_name, "_OBJC_IVAR_$_", strlen ("_OBJC_IVAR_$_")) == 0
+ || strncmp (symbol_name, "_OBJC_CLASS_$_", strlen ("_OBJC_CLASS_$_")) == 0
+ || strncmp (symbol_name, "_OBJC_METACLASS_$_", strlen ("_OBJC_METACLASS_$_")) == 0))
+ add_nlist = false;
+ else
+ {
+ sym[sym_idx].SetExternal(true);
+ if (nlist.n_value != 0)
+ symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
+ type = eSymbolTypeData;
+ }
break;
case StabFunctionName:
OpenPOWER on IntegriCloud