--- hatari/src/debug/symbols.c 2019/04/09 08:49:26 1.1.1.2 +++ hatari/src/debug/symbols.c 2019/04/09 08:52:00 1.1.1.4 @@ -12,7 +12,8 @@ * Symbol/address file contents are identical to "nm" output i.e. composed * of a hexadecimal addresses followed by a space, letter indicating symbol * type (T = text/code, D = data, B = BSS), space and the symbol name. - * Empty lines and lines starting with '#' are ignored. + * Empty lines and lines starting with '#' are ignored. AHCC SYM output + * compatible. */ const char Symbols_fileid[] = "Hatari symbols.c : " __DATE__ " " __TIME__; @@ -83,7 +84,8 @@ static int symbols_by_name(const void *s ret = strcmp(name1, name2); if (!ret) { - fprintf(stderr, "WARNING: symbol '%s' listed twice.\n", name1); + fprintf(stderr, "WARNING: addresses 0x%x & 0x%x have the same '%s' name.\n", + ((const symbol_t*)s1)->address, ((const symbol_t*)s2)->address, name1); } return ret; } @@ -97,7 +99,7 @@ static int symbols_by_name(const void *s static symbol_list_t* Symbols_Load(const char *filename, Uint32 offset, Uint32 maxaddr, symtype_t gettype) { symbol_list_t *list; - char symchar, buffer[80], name[MAX_SYM_SIZE+1], *buf; + char symchar, buffer[128], name[MAX_SYM_SIZE+1], *buf; int count, line, symbols; symtype_t symtype; Uint32 address; @@ -111,8 +113,8 @@ static symbol_list_t* Symbols_Load(const /* count content lines */ symbols = 0; while (fgets(buffer, sizeof(buffer), fp)) { - /* skip comments */ - if (*buffer == '#') { + /* skip comments (AHCC SYM file comments start with '*') */ + if (*buffer == '#' || *buffer == '*') { continue; } /* skip empty lines */ @@ -139,8 +141,8 @@ static symbol_list_t* Symbols_Load(const /* read symbols */ count = 0; for (line = 1; fgets(buffer, sizeof(buffer), fp); line++) { - /* skip comments */ - if (*buffer == '#') { + /* skip comments (AHCC SYM file comments start with '*') */ + if (*buffer == '#' || *buffer == '*') { continue; } /* skip empty lines */ @@ -149,7 +151,7 @@ static symbol_list_t* Symbols_Load(const continue; } assert(count < symbols); /* file not modified in meanwhile? */ - if (sscanf(buffer, "%x %c %32[0-9A-Za-z_]s", &address, &symchar, name) != 3) { + if (sscanf(buffer, "%x %c %32[0-9A-Za-z_.]s", &address, &symchar, name) != 3) { fprintf(stderr, "WARNING: syntax error in '%s' on line %d, skipping.\n", filename, line); continue; } @@ -160,6 +162,7 @@ static symbol_list_t* Symbols_Load(const } switch (toupper(symchar)) { case 'T': symtype = SYMTYPE_TEXT; break; + case 'O': symtype = SYMTYPE_DATA; break; /* AHCC type for _StkSize etc */ case 'D': symtype = SYMTYPE_DATA; break; case 'B': symtype = SYMTYPE_BSS; break; default: