Changeset 17f28a1 in opengl-game


Ignore:
Timestamp:
Jun 19, 2019, 7:22:38 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
9d4456b, f024d59
Parents:
4762301
Message:

Improve the formatting for the crash log on OSX

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CrashLogger.cpp

    r4762301 r17f28a1  
    145145
    146146   size_t funcnamesize = 1024;
    147    char funcname[1024];
     147   char* funcname = (char*)malloc(sizeof(char) * funcnamesize);
    148148
    149149   // iterate over the returned symbol lines
     
    164164      }
    165165
    166       if (begin_name && begin_offset && (begin_name < begin_offset )) {
     166      write(fd_out, "  ", 2);
     167      if (begin_name && begin_offset && (begin_name < begin_offset)) {
    167168         *begin_name++ = '\0';
    168169         *begin_offset++ = '\0';
     
    176177         if (status == 0)  {
    177178            funcname = ret; // use possibly realloc()-ed string
    178             write(fd_out, "  ", 2);
    179179            write(fd_out, symbollist[i], strlen(symbollist[i]));
    180180            write(fd_out, " ", 1);
     
    183183         } else {
    184184            // demangling failed. Output function name as a C function with no arguments.
    185             write(fd_out, "  ", 2);
    186185            write(fd_out, symbollist[i], strlen(symbollist[i]));
    187186            write(fd_out, " ", 1);
     
    190189         }
    191190         write(fd_out, begin_offset, strlen(begin_offset));
    192          write(fd_out, "\n", 1);
    193       } else {`
     191      } else {
    194192         // couldn't parse the line? print the whole line.
    195193         write(fd_out, symbollist[i], strlen(symbollist[i]));
    196194      }
     195      write(fd_out, "\n", 1);
    197196#else
    198197      for (char *p = symbollist[i]; *p; p++) {
     
    206205      }
    207206
     207      write(fd_out, "  ", 2);
    208208      if (begin_name && end_offset && (begin_name < end_offset)) {
    209209         *begin_name++ = '\0';
     
    219219         char* ret = abi::__cxa_demangle(begin_name, funcname, &funcnamesize, &status);
    220220
    221          write(fd_out, "  ", 2);
    222221         write(fd_out, symbollist[i], strlen(symbollist[i]));
    223222         write(fd_out, " ( ", 3);
     
    226225         } else {
    227226            write(fd_out, begin_name, strlen(begin_name));
    228          }
     227         }
     228
    229229         if (begin_offset) {
    230230            write(fd_out, " + ", 3);
     
    235235         write(fd_out, ") ", 1);
    236236         write(fd_out, end_offset, strlen(end_offset));
    237          write(fd_out, "\n", 1);
    238237      } else {
    239238         // couldn't parse the line? print the whole line.
    240239         write(fd_out, symbollist[i], strlen(symbollist[i]));
    241240      }
     241      write(fd_out, "\n", 1);
    242242#endif
    243243   }
    244244
     245   free(funcname);
    245246   free(symbollist);
    246247
  • makefile

    r4762301 r17f28a1  
    22CC = g++
    33CFLAGS = -std=c++0x -Wall -pedantic -rdynamic
     4# -rdynamic is to generate debug info for dynamic symbols on debian-based
     5# systems (tested on Linux Mint)
     6# for OSX, using -g generates a newgame.dSYS directory which has debug symbols.
     7# However, this has no effect on the stack trace, so there must be a way to specify a *.dSYS directory when running ./newgame
     8# or to instead put thos symbols directly into the executable, like -rdynamic does for Linux
    49#-Wextra -fno-inline
    510
Note: See TracChangeset for help on using the changeset viewer.