mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-10 23:57:03 +08:00
* corefile.c (parse_error): New function.
(read_function_mappings): Check calls to fscanf and report any errors in parsing the mapping file.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2007-01-16 Ben Elliston <bje@au.ibm.com>
|
||||||
|
|
||||||
|
* corefile.c (parse_error): New function.
|
||||||
|
(read_function_mappings): Check calls to fscanf and report any
|
||||||
|
errors in parsing the mapping file.
|
||||||
|
|
||||||
2006-12-12 Daniel Jacobowitz <dan@codesourcery.com>
|
2006-12-12 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
* Makefile.am (gprof_TEXINFOS): Set.
|
* Makefile.am (gprof_TEXINFOS): Set.
|
||||||
|
@ -52,6 +52,13 @@ extern void tahoe_find_call (Sym *, bfd_vma, bfd_vma);
|
|||||||
extern void sparc_find_call (Sym *, bfd_vma, bfd_vma);
|
extern void sparc_find_call (Sym *, bfd_vma, bfd_vma);
|
||||||
extern void mips_find_call (Sym *, bfd_vma, bfd_vma);
|
extern void mips_find_call (Sym *, bfd_vma, bfd_vma);
|
||||||
|
|
||||||
|
static void
|
||||||
|
parse_error (const char *filename)
|
||||||
|
{
|
||||||
|
fprintf (stderr, _("%s: unable to parse mapping file %s.\n"), whoami, filename);
|
||||||
|
done (1);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_function_mappings (const char *filename)
|
read_function_mappings (const char *filename)
|
||||||
{
|
{
|
||||||
@ -74,21 +81,21 @@ read_function_mappings (const char *filename)
|
|||||||
|
|
||||||
matches = fscanf (file, "%[^\n:]", dummy);
|
matches = fscanf (file, "%[^\n:]", dummy);
|
||||||
if (!matches)
|
if (!matches)
|
||||||
{
|
parse_error (filename);
|
||||||
fprintf (stderr, _("%s: unable to parse mapping file %s.\n"),
|
|
||||||
whoami, filename);
|
|
||||||
done (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Just skip messages about files with no symbols. */
|
/* Just skip messages about files with no symbols. */
|
||||||
if (!strncmp (dummy, "No symbols in ", 14))
|
if (!strncmp (dummy, "No symbols in ", 14))
|
||||||
{
|
{
|
||||||
fscanf (file, "\n");
|
matches = fscanf (file, "\n");
|
||||||
|
if (matches == EOF)
|
||||||
|
parse_error (filename);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't care what else is on this line at this point. */
|
/* Don't care what else is on this line at this point. */
|
||||||
fscanf (file, "%[^\n]\n", dummy);
|
matches = fscanf (file, "%[^\n]\n", dummy);
|
||||||
|
if (!matches)
|
||||||
|
parse_error (filename);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,16 +115,14 @@ read_function_mappings (const char *filename)
|
|||||||
|
|
||||||
matches = fscanf (file, "%[^\n:]", dummy);
|
matches = fscanf (file, "%[^\n:]", dummy);
|
||||||
if (!matches)
|
if (!matches)
|
||||||
{
|
parse_error (filename);
|
||||||
fprintf (stderr, _("%s: unable to parse mapping file %s.\n"),
|
|
||||||
whoami, filename);
|
|
||||||
done (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Just skip messages about files with no symbols. */
|
/* Just skip messages about files with no symbols. */
|
||||||
if (!strncmp (dummy, "No symbols in ", 14))
|
if (!strncmp (dummy, "No symbols in ", 14))
|
||||||
{
|
{
|
||||||
fscanf (file, "\n");
|
matches = fscanf (file, "\n");
|
||||||
|
if (matches == EOF)
|
||||||
|
parse_error (filename);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +131,9 @@ read_function_mappings (const char *filename)
|
|||||||
strcpy (symbol_map[count].file_name, dummy);
|
strcpy (symbol_map[count].file_name, dummy);
|
||||||
|
|
||||||
/* Now we need the function name. */
|
/* Now we need the function name. */
|
||||||
fscanf (file, "%[^\n]\n", dummy);
|
matches = fscanf (file, "%[^\n]\n", dummy);
|
||||||
|
if (!matches)
|
||||||
|
parse_error (filename);
|
||||||
tmp = strrchr (dummy, ' ') + 1;
|
tmp = strrchr (dummy, ' ') + 1;
|
||||||
symbol_map[count].function_name = xmalloc (strlen (tmp) + 1);
|
symbol_map[count].function_name = xmalloc (strlen (tmp) + 1);
|
||||||
strcpy (symbol_map[count].function_name, tmp);
|
strcpy (symbol_map[count].function_name, tmp);
|
||||||
|
Reference in New Issue
Block a user