* libaout.h (struct aoutdata): Add line_buf field.
* aoutx.h (NAME(aout,find_nearest_line)): Remove statics buffer and filename_buffer. Instead, use a malloc buffer stored in the new line_buf field. Remove length restrictions.
This commit is contained in:
parent
f0500a41d0
commit
f1c6dd5d16
|
@ -5,6 +5,11 @@ Mon Sep 25 16:04:09 1995 Michael Meissner <meissner@tiktok.cygnus.com>
|
||||||
|
|
||||||
Mon Sep 25 11:48:02 1995 Ian Lance Taylor <ian@cygnus.com>
|
Mon Sep 25 11:48:02 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
* libaout.h (struct aoutdata): Add line_buf field.
|
||||||
|
* aoutx.h (NAME(aout,find_nearest_line)): Remove statics buffer
|
||||||
|
and filename_buffer. Instead, use a malloc buffer stored in the
|
||||||
|
new line_buf field. Remove length restrictions.
|
||||||
|
|
||||||
* coffgen.c (string_size): Remove static variable.
|
* coffgen.c (string_size): Remove static variable.
|
||||||
(debug_string_size, debug_string_section): Likewise.
|
(debug_string_size, debug_string_section): Likewise.
|
||||||
(coff_fix_symbol_name): Add string_size_p, debug_string_section_p,
|
(coff_fix_symbol_name): Add string_size_p, debug_string_section_p,
|
||||||
|
|
66
bfd/aoutx.h
66
bfd/aoutx.h
|
@ -2637,8 +2637,6 @@ NAME(aout,find_nearest_line)
|
||||||
{
|
{
|
||||||
/* Run down the file looking for the filename, function and linenumber */
|
/* Run down the file looking for the filename, function and linenumber */
|
||||||
asymbol **p;
|
asymbol **p;
|
||||||
static char buffer[100];
|
|
||||||
static char filename_buffer[200];
|
|
||||||
CONST char *directory_name = NULL;
|
CONST char *directory_name = NULL;
|
||||||
CONST char *main_file_name = NULL;
|
CONST char *main_file_name = NULL;
|
||||||
CONST char *current_file_name = NULL;
|
CONST char *current_file_name = NULL;
|
||||||
|
@ -2646,6 +2644,9 @@ NAME(aout,find_nearest_line)
|
||||||
bfd_vma low_line_vma = 0;
|
bfd_vma low_line_vma = 0;
|
||||||
bfd_vma low_func_vma = 0;
|
bfd_vma low_func_vma = 0;
|
||||||
asymbol *func = 0;
|
asymbol *func = 0;
|
||||||
|
size_t filelen, funclen;
|
||||||
|
char *buf;
|
||||||
|
|
||||||
*filename_ptr = abfd->filename;
|
*filename_ptr = abfd->filename;
|
||||||
*functionname_ptr = 0;
|
*functionname_ptr = 0;
|
||||||
*line_ptr = 0;
|
*line_ptr = 0;
|
||||||
|
@ -2705,39 +2706,68 @@ NAME(aout,find_nearest_line)
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (*line_ptr)
|
if (*line_ptr != 0)
|
||||||
main_file_name = line_file_name;
|
main_file_name = line_file_name;
|
||||||
if (main_file_name) {
|
|
||||||
|
if (main_file_name == NULL
|
||||||
|
|| main_file_name[0] == '/'
|
||||||
|
|| directory_name == NULL)
|
||||||
|
filelen = 0;
|
||||||
|
else
|
||||||
|
filelen = strlen (directory_name) + strlen (main_file_name);
|
||||||
|
if (func == NULL)
|
||||||
|
funclen = 0;
|
||||||
|
else
|
||||||
|
funclen = strlen (bfd_asymbol_name (func));
|
||||||
|
|
||||||
|
if (adata (abfd).line_buf != NULL)
|
||||||
|
free (adata (abfd).line_buf);
|
||||||
|
if (filelen + funclen == 0)
|
||||||
|
adata (abfd).line_buf = buf = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
adata (abfd).line_buf = buf = (char *) malloc (filelen + funclen + 2);
|
||||||
|
if (adata (abfd).line_buf == NULL)
|
||||||
|
{
|
||||||
|
bfd_set_error (bfd_error_no_memory);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (main_file_name != NULL)
|
||||||
|
{
|
||||||
if (main_file_name[0] == '/' || directory_name == NULL)
|
if (main_file_name[0] == '/' || directory_name == NULL)
|
||||||
*filename_ptr = main_file_name;
|
*filename_ptr = main_file_name;
|
||||||
else {
|
else
|
||||||
sprintf(filename_buffer, "%.140s%.50s",
|
{
|
||||||
directory_name, main_file_name);
|
sprintf (buf, "%s%s", directory_name, main_file_name);
|
||||||
*filename_ptr = filename_buffer;
|
*filename_ptr = buf;
|
||||||
}
|
buf += filelen + 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (func)
|
if (func)
|
||||||
{
|
{
|
||||||
CONST char *function = func->name;
|
const char *function = func->name;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
/* The caller expects a symbol name. We actually have a
|
/* The caller expects a symbol name. We actually have a
|
||||||
function name, without the leading underscore. Put the
|
function name, without the leading underscore. Put the
|
||||||
underscore back in, so that the caller gets a symbol name. */
|
underscore back in, so that the caller gets a symbol name. */
|
||||||
if (bfd_get_symbol_leading_char (abfd) == '\0')
|
if (bfd_get_symbol_leading_char (abfd) == '\0')
|
||||||
strncpy (buffer, function, sizeof (buffer) - 1);
|
strcpy (buf, function);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer[0] = bfd_get_symbol_leading_char (abfd);
|
buf[0] = bfd_get_symbol_leading_char (abfd);
|
||||||
strncpy (buffer + 1, function, sizeof (buffer) - 2);
|
strcpy (buf + 1, function);
|
||||||
}
|
}
|
||||||
buffer[sizeof(buffer)-1] = 0;
|
|
||||||
/* Have to remove : stuff */
|
/* Have to remove : stuff */
|
||||||
p = strchr(buffer,':');
|
p = strchr (buf, ':');
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
*functionname_ptr = buffer;
|
*functionname_ptr = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue