#include "coff-pe-read.h"
#include "psymtab.h"
+#include "build-id.h"
extern void _initialize_coffread (void);
csi->textaddr = bfd_section_vma (abfd, sectp);
csi->textsize += bfd_section_size (abfd, sectp);
}
- else if (strncmp (name, ".text", sizeof ".text" - 1) == 0)
+ else if (startswith (name, ".text"))
{
csi->textsize += bfd_section_size (abfd, sectp);
}
{
csi->stabstrsect = sectp;
}
- else if (strncmp (name, ".stab", sizeof ".stab" - 1) == 0)
+ else if (startswith (name, ".stab"))
{
const char *s;
return 0;
/* The name must start with "__fu<digits>__". */
- if (strncmp (cs->c_name, "__fu", 4) != 0)
+ if (!startswith (cs->c_name, "__fu"))
return 0;
if (! isdigit (cs->c_name[4]))
return 0;
FIXME: We should use BFD to read the symbol table, and thus avoid
this problem. */
pe_file =
- strncmp (bfd_get_target (objfile->obfd), "pe", 2) == 0
- || strncmp (bfd_get_target (objfile->obfd), "epoc-pe", 7) == 0;
+ startswith (bfd_get_target (objfile->obfd), "pe")
+ || startswith (bfd_get_target (objfile->obfd), "epoc-pe");
/* End of warning. */
or "_imp_", get rid of the prefix, and search the minimal
symbol in OBJFILE. Note that 'maintenance print msymbols'
shows that type of these "_imp_XXXX" symbols is mst_data. */
- if (MSYMBOL_TYPE (msym) == mst_data
- && (strncmp (name, "__imp_", 6) == 0
- || strncmp (name, "_imp_", 5) == 0))
+ if (MSYMBOL_TYPE (msym) == mst_data)
{
- const char *name1 = (name[1] == '_' ? &name[7] : &name[6]);
- struct bound_minimal_symbol found;
-
- found = lookup_minimal_symbol (name1, NULL, objfile);
- /* If found, there are symbols named "_imp_foo" and "foo"
- respectively in OBJFILE. Set the type of symbol "foo"
- as 'mst_solib_trampoline'. */
- if (found.minsym != NULL
- && MSYMBOL_TYPE (found.minsym) == mst_text)
- MSYMBOL_TYPE (found.minsym) = mst_solib_trampoline;
+ const char *name1 = NULL;
+
+ if (startswith (name, "_imp_"))
+ name1 = name + 5;
+ else if (startswith (name, "__imp_"))
+ name1 = name + 6;
+ if (name1 != NULL)
+ {
+ int lead = bfd_get_symbol_leading_char (objfile->obfd);
+ struct bound_minimal_symbol found;
+
+ if (lead != '\0' && *name1 == lead)
+ name1 += 1;
+
+ found = lookup_minimal_symbol (name1, NULL, objfile);
+
+ /* If found, there are symbols named "_imp_foo" and "foo"
+ respectively in OBJFILE. Set the type of symbol "foo"
+ as 'mst_solib_trampoline'. */
+ if (found.minsym != NULL
+ && MSYMBOL_TYPE (found.minsym) == mst_text)
+ MSYMBOL_TYPE (found.minsym) = mst_solib_trampoline;
+ }
}
}
}
{
char *debugfile;
- debugfile = find_separate_debug_file_by_debuglink (objfile);
+ debugfile = find_separate_debug_file_by_buildid (objfile);
+
+ if (debugfile == NULL)
+ debugfile = find_separate_debug_file_by_debuglink (objfile);
make_cleanup (xfree, debugfile);
if (debugfile)
}
else if (!SDB_TYPE (cs->c_type)
&& cs->c_name[0] == 'L'
- && (strncmp (cs->c_name, "LI%", 3) == 0
- || strncmp (cs->c_name, "LF%", 3) == 0
- || strncmp (cs->c_name, "LC%", 3) == 0
- || strncmp (cs->c_name, "LP%", 3) == 0
- || strncmp (cs->c_name, "LPB%", 4) == 0
- || strncmp (cs->c_name, "LBB%", 4) == 0
- || strncmp (cs->c_name, "LBE%", 4) == 0
- || strncmp (cs->c_name, "LPBX%", 5) == 0))
+ && (startswith (cs->c_name, "LI%")
+ || startswith (cs->c_name, "LF%")
+ || startswith (cs->c_name, "LC%")
+ || startswith (cs->c_name, "LP%")
+ || startswith (cs->c_name, "LPB%")
+ || startswith (cs->c_name, "LBB%")
+ || startswith (cs->c_name, "LBE%")
+ || startswith (cs->c_name, "LPBX%")))
/* At least on a 3b1, gcc generates swbeg and string labels
that look like this. Ignore them. */
break;