[Lldb-commits] [lldb] r157712 - /lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Greg Clayton gclayton at apple.com
Wed May 30 13:20:34 PDT 2012


Author: gclayton
Date: Wed May 30 15:20:34 2012
New Revision: 157712

URL: http://llvm.org/viewvc/llvm-project?rev=157712&view=rev
Log:
<rdar://problem/11537498>

Fixed an issue with the symbol table parsing of files that have STAB entries in them where there are two N_SO entries where the first has a directory, and the second contains a full path:

[     0] 00000002 64 (N_SO         ) 00     0000   0000000000000000 '/Volumes/data/src/'
[     1] 0000001e 64 (N_SO         ) 00     0000   0000000000000000 '/Volumes/data/src/Source/main.m'
[     2] 00000047 66 (N_OSO        ) 09     0001   000000004fc642d2 '/tmp/main.o'
[     3] 00000001 2e (N_BNSYM      ) 01     0000   0000000000003864
[     4] 000000bd 24 (N_FUN        ) 01     0000   0000000000003864 '_main'
[     5] 00000001 24 (N_FUN        ) 00     0000   00000000000000ae
[     6] 00000001 4e (N_ENSYM      ) 01     0000   00000000000000ae
[     7] 00000001 64 (N_SO         ) 01     0000   0000000000000000

We now correctly combine entries 0 and 1 into a single entry.


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=157712&r1=157711&r2=157712&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed May 30 15:20:34 2012
@@ -1665,10 +1665,28 @@
                     {
                         // We use the current number of symbols in the symbol table in lieu of
                         // using nlist_idx in case we ever start trimming entries out
-                        if (symbol_name[0] == '/')
-                            N_SO_index = sym_idx;
+                        const bool N_SO_has_full_path = symbol_name[0] == '/';
+                        if (N_SO_has_full_path)
+                        {
+                            if (minimize && (N_SO_index == sym_idx - 1) && ((sym_idx - 1) < num_syms))
+                            {
+                                // We have two consecutive N_SO entries where the first contains a directory
+                                // and the second contains a full path.
+                                sym[sym_idx - 1].GetMangled().SetValue(symbol_name, false);
+                                m_nlist_idx_to_sym_idx[nlist_idx] = sym_idx - 1;
+                                add_nlist = false;
+                            }
+                            else
+                            {
+                                // This is the first entry in a N_SO that contains a directory or
+                                // a full path to the source file
+                                N_SO_index = sym_idx;
+                            }
+                        }
                         else if (minimize && (N_SO_index == sym_idx - 1) && ((sym_idx - 1) < num_syms))
                         {
+                            // This is usually the second N_SO entry that contains just the filename,
+                            // so here we combine it with the first one if we are minimizing the symbol table
                             const char *so_path = sym[sym_idx - 1].GetMangled().GetDemangledName().AsCString();
                             if (so_path && so_path[0])
                             {





More information about the lldb-commits mailing list