--- trunk/src/symbol.c 2007/10/08 16:18:38 12 +++ trunk/src/symbol.c 2007/10/08 16:21:17 34 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2005 Anders Gavare. All rights reserved. + * Copyright (C) 2003-2007 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,21 +25,18 @@ * SUCH DAMAGE. * * - * $Id: symbol.c,v 1.29 2005/08/09 17:18:22 debug Exp $ + * $Id: symbol.c,v 1.37 2006/12/30 13:30:52 debug Exp $ * * Address to symbol translation routines. * - * This module is (probably) independant from the rest of the emulator. - * symbol_init() must be called before any other function in this - * file is used. + * This module is (probably) independent from the rest of the emulator. + * symbol_init() must be called before any other function in this file is used. */ #include #include #include -#include "misc.h" - #include "symbol.h" @@ -227,6 +224,9 @@ exit(1); } + if (addr == 0 && strcmp(name, "_DYNAMIC_LINK") == 0) + return; + if (name[0] == '\0') return; @@ -242,6 +242,12 @@ n_args = 2; if (strcmp(name, "strcpy") == 0) n_args = 2; + if (strcmp(name, "strncpy") == 0) + n_args = 3; + if (strcmp(name, "strlcpy") == 0) + n_args = 3; + if (strcmp(name, "strlcat") == 0) + n_args = 3; if (strcmp(name, "strncmp") == 0) n_args = 3; if (strcmp(name, "memset") == 0) @@ -263,11 +269,18 @@ exit(1); } - s->name = strdup(name); + memset(s, 0, sizeof(struct symbol)); + + s->name = symbol_demangle_cplusplus(name); + if (s->name == NULL) { - fprintf(stderr, "out of memory\n"); - exit(1); + s->name = strdup(name); + if (s->name == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } } + s->addr = addr; s->len = len; s->type = type;