[ros-diffs] [jmorlan] 35020: In rsym, allow a stabs entry to be longer than 256 characters, so that ROS may be compiled with -feliminate-unused-debug-symbols which reduces the needed disk space a lot.

jmorlan at svn.reactos.org jmorlan at svn.reactos.org
Fri Aug 1 23:48:55 CEST 2008


Author: jmorlan
Date: Fri Aug  1 16:48:54 2008
New Revision: 35020

URL: http://svn.reactos.org/svn/reactos?rev=35020&view=rev
Log:
In rsym, allow a stabs entry to be longer than 256 characters, so that ROS may be compiled with -feliminate-unused-debug-symbols which reduces the needed disk space a lot.

Modified:
    trunk/reactos/tools/rsym.c

Modified: trunk/reactos/tools/rsym.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rsym.c?rev=35020&r1=35019&r2=35020&view=diff
==============================================================================
--- trunk/reactos/tools/rsym.c [iso-8859-1] (original)
+++ trunk/reactos/tools/rsym.c [iso-8859-1] Fri Aug  1 16:48:54 2008
@@ -143,6 +143,7 @@
   ULONG_PTR Address, LastFunctionAddress;
   int First = 1;
   char *Name;
+  ULONG NameLen;
   char FuncName[256];
   PROSSYM_ENTRY Current;
 
@@ -220,18 +221,16 @@
                 Current->Address = Address;
                 Current->FileOffset = Current[-1].FileOffset;
               }
-            if (sizeof(FuncName) <= strlen((char *) StabStringsBase + StabEntry[i].n_strx))
+            Name = (char *) StabStringsBase + StabEntry[i].n_strx;
+            NameLen = strcspn(Name, ":");
+            if (sizeof(FuncName) <= NameLen)
               {
                 free(*SymbolsBase);
                 fprintf(stderr, "Function name too long\n");
                 return 1;
               }
-            strcpy(FuncName, (char *) StabStringsBase + StabEntry[i].n_strx);
-            Name = strchr(FuncName, ':');
-            if (NULL != Name)
-              {
-                *Name = '\0';
-              }
+            memcpy(FuncName, Name, NameLen);
+            FuncName[NameLen] = '\0';
             Current->FunctionOffset = FindOrAddString(FuncName,
                                                       StringsLength,
                                                       StringsBase);



More information about the Ros-diffs mailing list