Wed Sep 14 12:19:07 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
+ * objdump.c (disassemble_data): Initialize prevline to 0. Make
+ prev_function non const. Copy functionname into an malloc buffer
+ when setting prev_function, instead of assuming that the string
+ will last forever.
+
* nm.c: Include libiberty.h.
(sort_by_size): New static variable.
(long_options): Add --size-sort.
struct disassemble_info disasm_info;
struct objdump_disasm_info aux;
- int prevline;
- CONST char *prev_function = "";
+ int prevline = 0;
+ char *prev_function = NULL;
asection *section;
&functionname,
&line))
{
- if (functionname && *functionname
- && strcmp(functionname, prev_function))
+ if (functionname
+ && *functionname != '\0'
+ && (prev_function == NULL
+ || strcmp (functionname, prev_function) != 0))
{
printf ("%s():\n", functionname);
- prev_function = functionname;
+ if (prev_function != NULL)
+ free (prev_function);
+ prev_function = xmalloc (strlen (functionname) + 1);
+ strcpy (prev_function, functionname);
}
if (!filename)
filename = "???";