#include <sys/file.h>
#endif
#include <sys/stat.h>
+#include <algorithm>
#include "coff/internal.h"
#include "libcoff.h" /* FIXME, internal data from BFD */
static void add_stab_to_list (char *, struct pending_stabs **);
#endif
-static int compare_lte (const void *, const void *);
-
static struct linetable *arrange_linetable (struct linetable *);
static void record_include_end (struct coff_symbol *);
/* *INDENT-ON* */
-
-/* compare line table entry addresses. */
-
-static int
-compare_lte (const void *lte1p, const void *lte2p)
-{
- struct linetable_entry *lte1 = (struct linetable_entry *) lte1p;
- struct linetable_entry *lte2 = (struct linetable_entry *) lte2p;
-
- return lte1->pc - lte2->pc;
-}
-
/* Given a line table with function entries are marked, arrange its
functions in ascending order and strip off function entry markers
and return it in a newly created table. If the old one is good
return oldLineTb;
}
else if (function_count > 1)
- qsort (fentry, function_count,
- sizeof (struct linetable_entry), compare_lte);
+ std::sort (fentry, fentry + function_count,
+ [] (const linetable_entry <e1, const linetable_entry& lte2)
+ { return lte1.pc < lte2.pc; });
/* Allocate a new line table. */
newLineTb = (struct linetable *)
c_type value of main symbol table will be set only in case of
C_EXT/C_HIDEEXT/C_WEAKEXT storage class symbols.
Bit 10 of type is set if symbol is a function, ie the value is set
- to 32(0x20). So we need to read the first function auxiliay entry
+ to 32(0x20). So we need to read the first function auxiliary entry
which contains the size. */
if (cs->c_naux > 1 && ISFCN (cs->c_type))
{
continue;
}
/* Read the csect auxiliary header, which is always the last by
- onvention. */
+ convention. */
bfd_coff_swap_aux_in (abfd,
raw_auxptr
+ ((coff_data (abfd)->local_symesz)
namestring = gdbarch_static_transform_name
(gdbarch, namestring);
- add_psymbol_to_list (namestring, p - namestring, true,
- VAR_DOMAIN, LOC_STATIC,
+ add_psymbol_to_list (gdb::string_view (namestring,
+ p - namestring),
+ true, VAR_DOMAIN, LOC_STATIC,
SECT_OFF_DATA (objfile),
psymbol_placement::STATIC,
symbol.n_value,
case 'G':
/* The addresses in these entries are reported to be
wrong. See the code that reads 'G's for symtabs. */
- add_psymbol_to_list (namestring, p - namestring, true,
- VAR_DOMAIN, LOC_STATIC,
+ add_psymbol_to_list (gdb::string_view (namestring,
+ p - namestring),
+ true, VAR_DOMAIN, LOC_STATIC,
SECT_OFF_DATA (objfile),
psymbol_placement::GLOBAL,
symbol.n_value,
|| (p == namestring + 1
&& namestring[0] != ' '))
{
- add_psymbol_to_list (namestring, p - namestring, true,
- STRUCT_DOMAIN, LOC_TYPEDEF, -1,
+ add_psymbol_to_list (gdb::string_view (namestring,
+ p - namestring),
+ true, STRUCT_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
0, psymtab_language, objfile);
if (p[2] == 't')
{
/* Also a typedef with the same name. */
- add_psymbol_to_list (namestring, p - namestring, true,
- VAR_DOMAIN, LOC_TYPEDEF, -1,
+ add_psymbol_to_list (gdb::string_view (namestring,
+ p - namestring),
+ true, VAR_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
0, psymtab_language, objfile);
p += 1;
case 't':
if (p != namestring) /* a name is there, not just :T... */
{
- add_psymbol_to_list (namestring, p - namestring, true,
- VAR_DOMAIN, LOC_TYPEDEF, -1,
+ add_psymbol_to_list (gdb::string_view (namestring,
+ p - namestring),
+ true, VAR_DOMAIN, LOC_TYPEDEF, -1,
psymbol_placement::STATIC,
0, psymtab_language, objfile);
}
;
/* Note that the value doesn't matter for
enum constants in psymtabs, just in symtabs. */
- add_psymbol_to_list (p, q - p, true,
+ add_psymbol_to_list (gdb::string_view (p, q - p), true,
VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC,
0, psymtab_language, objfile);
case 'c':
/* Constant, e.g. from "const" in Pascal. */
- add_psymbol_to_list (namestring, p - namestring, true,
- VAR_DOMAIN, LOC_CONST, -1,
+ add_psymbol_to_list (gdb::string_view (namestring,
+ p - namestring),
+ true, VAR_DOMAIN, LOC_CONST, -1,
psymbol_placement::STATIC,
0, psymtab_language, objfile);
continue;
function_outside_compilation_unit_complaint (name);
xfree (name);
}
- add_psymbol_to_list (namestring, p - namestring, true,
- VAR_DOMAIN, LOC_BLOCK,
+ add_psymbol_to_list (gdb::string_view (namestring,
+ p - namestring),
+ true, VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
psymbol_placement::STATIC,
symbol.n_value,
if (startswith (namestring, "@FIX"))
continue;
- add_psymbol_to_list (namestring, p - namestring, true,
- VAR_DOMAIN, LOC_BLOCK,
+ add_psymbol_to_list (gdb::string_view (namestring,
+ p - namestring),
+ true, VAR_DOMAIN, LOC_BLOCK,
SECT_OFF_TEXT (objfile),
psymbol_placement::GLOBAL,
symbol.n_value,