[Lldb-commits] [lldb] r146712 - /lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Jim Ingham
jingham at apple.com
Thu Dec 15 16:05:58 PST 2011
Author: jingham
Date: Thu Dec 15 18:05:58 2011
New Revision: 146712
URL: http://llvm.org/viewvc/llvm-project?rev=146712&view=rev
Log:
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>
Modified:
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=146712&r1=146711&r2=146712&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Dec 15 18:05:58 2011
@@ -876,10 +876,26 @@
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:
More information about the lldb-commits
mailing list