Index: CrashLogger.cpp
===================================================================
--- CrashLogger.cpp	(revision 47623017a2217e9514cfa12d5cf3eb3a2488a5bb)
+++ CrashLogger.cpp	(revision 17f28a1bb89a812d2cd7066a709e7ac1a3885616)
@@ -145,5 +145,5 @@
 
    size_t funcnamesize = 1024;
-   char funcname[1024];
+   char* funcname = (char*)malloc(sizeof(char) * funcnamesize);
 
    // iterate over the returned symbol lines
@@ -164,5 +164,6 @@
       }
 
-      if (begin_name && begin_offset && (begin_name < begin_offset )) {
+      write(fd_out, "  ", 2);
+      if (begin_name && begin_offset && (begin_name < begin_offset)) {
          *begin_name++ = '\0';
          *begin_offset++ = '\0';
@@ -176,5 +177,4 @@
          if (status == 0)  {
             funcname = ret; // use possibly realloc()-ed string
-            write(fd_out, "  ", 2);
             write(fd_out, symbollist[i], strlen(symbollist[i]));
             write(fd_out, " ", 1);
@@ -183,5 +183,4 @@
          } else {
             // demangling failed. Output function name as a C function with no arguments.
-            write(fd_out, "  ", 2);
             write(fd_out, symbollist[i], strlen(symbollist[i]));
             write(fd_out, " ", 1);
@@ -190,9 +189,9 @@
          }
          write(fd_out, begin_offset, strlen(begin_offset));
-         write(fd_out, "\n", 1);
-      } else {`
+      } else {
          // couldn't parse the line? print the whole line.
          write(fd_out, symbollist[i], strlen(symbollist[i]));
       }
+      write(fd_out, "\n", 1);
 #else
       for (char *p = symbollist[i]; *p; p++) {
@@ -206,4 +205,5 @@
       }
 
+      write(fd_out, "  ", 2);
       if (begin_name && end_offset && (begin_name < end_offset)) {
          *begin_name++ = '\0';
@@ -219,5 +219,4 @@
          char* ret = abi::__cxa_demangle(begin_name, funcname, &funcnamesize, &status);
 
-         write(fd_out, "  ", 2);
          write(fd_out, symbollist[i], strlen(symbollist[i]));
          write(fd_out, " ( ", 3);
@@ -226,5 +225,6 @@
          } else {
             write(fd_out, begin_name, strlen(begin_name));
-	 }
+         }
+
          if (begin_offset) {
             write(fd_out, " + ", 3);
@@ -235,12 +235,13 @@
          write(fd_out, ") ", 1);
          write(fd_out, end_offset, strlen(end_offset));
-         write(fd_out, "\n", 1);
       } else {
          // couldn't parse the line? print the whole line.
          write(fd_out, symbollist[i], strlen(symbollist[i]));
       }
+      write(fd_out, "\n", 1);
 #endif
    }
 
+   free(funcname);
    free(symbollist);
 
Index: makefile
===================================================================
--- makefile	(revision 47623017a2217e9514cfa12d5cf3eb3a2488a5bb)
+++ makefile	(revision 17f28a1bb89a812d2cd7066a709e7ac1a3885616)
@@ -2,4 +2,9 @@
 CC = g++
 CFLAGS = -std=c++0x -Wall -pedantic -rdynamic
+# -rdynamic is to generate debug info for dynamic symbols on debian-based 
+# systems (tested on Linux Mint)
+# for OSX, using -g generates a newgame.dSYS directory which has debug symbols.
+# However, this has no effect on the stack trace, so there must be a way to specify a *.dSYS directory when running ./newgame
+# or to instead put thos symbols directly into the executable, like -rdynamic does for Linux
 #-Wextra -fno-inline
 
