Date: Sun, 29 Aug 1999 14:42:53 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: "Mark E." cc: djgpp-workers AT delorie DOT com Subject: Re: Changes in Binutils 2.9.1 In-Reply-To: <199908270010.AAA76202@out5.ibm.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk A user complained (a long time ago) that -E and -e options in Gprof don't work, so I looked into it. The problem seems to be that these options (and also all the newer options that accept SYMSPECS as arguments) expect the user to prepend the underscore to the function names. This is inconsistent with the output printed by Gprof, where the underscores are removed, so I think this is a bug. Is this corrected in the Binutils CVS tree? I looked around, and it seems it isn't, except for the manual that tells the user to add the underscores by hand. A patch that corrects that for me is attached below. Does anybody think that this patch is wrong? 1999-08-28 Eli Zaretskii * sym_ids.c (parse_spec): Prepend an underscore to the name of the function if the compiler does that. *** gprof/sym_ids.c~0 Fri May 1 18:49:44 1998 --- gprof/sym_ids.c Sat Aug 28 12:55:40 1999 *************** static void *** 84,89 **** --- 84,90 ---- DEFUN (parse_spec, (spec, sym), char *spec AND Sym * sym) { char *colon; + int len = strlen (spec); sym_init (sym); colon = strrchr (spec, ':'); *************** DEFUN (parse_spec, (spec, sym), char *sp *** 99,105 **** } } spec = colon + 1; ! if (strlen (spec)) { if (isdigit ((unsigned char) spec[0])) { --- 100,106 ---- } } spec = colon + 1; ! if (len) { if (isdigit ((unsigned char) spec[0])) { *************** DEFUN (parse_spec, (spec, sym), char *sp *** 107,117 **** } else { ! sym->name = spec; } } } ! else if (strlen (spec)) { /* no colon: spec is a filename if it contains a dot: */ if (strchr (spec, '.')) --- 108,129 ---- } else { ! /* If the compiler prepends underscores, we should ! prepend it as well. */ ! if (discard_underscores) ! { ! char *name = (char *) xmalloc (len + 2); ! ! name[0] = '_'; ! strcpy (name + 1, spec); ! sym->name = name; ! } ! else ! sym->name = spec; } } } ! else if (len) { /* no colon: spec is a filename if it contains a dot: */ if (strchr (spec, '.')) *************** DEFUN (parse_spec, (spec, sym), char *sp *** 126,134 **** { sym->line_num = atoi (spec); } ! else if (strlen (spec)) { ! sym->name = spec; } } } --- 138,157 ---- { sym->line_num = atoi (spec); } ! else if (len) { ! /* If the compiler prepends underscores, we should prepend ! it as well. */ ! if (discard_underscores) ! { ! char *name = (char *) xmalloc (len + 2); ! ! name[0] = '_'; ! strcpy (name + 1, spec); ! sym->name = name; ! } ! else ! sym->name = spec; } } }