2003-02-20 03:12:46 +00:00
|
|
|
|
/* Read the export table symbols from a portable executable and
|
|
|
|
|
convert to internal format, for GDB. Used as a last resort if no
|
|
|
|
|
debugging symbols recognized.
|
|
|
|
|
|
2022-01-01 18:56:03 +04:00
|
|
|
|
Copyright (C) 2003-2022 Free Software Foundation, Inc.
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 18:08:50 +00:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2003-02-20 03:12:46 +00:00
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 18:08:50 +00:00
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2010-12-31 22:59:52 +00:00
|
|
|
|
Contributed by Raoul M. Gough (RaoulGough@yahoo.co.uk). */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2012-11-07 20:10:13 +00:00
|
|
|
|
#include "defs.h"
|
|
|
|
|
|
2019-04-06 13:38:10 -06:00
|
|
|
|
#include "coff-pe-read.h"
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2011-11-04 14:04:06 +00:00
|
|
|
|
#include "bfd.h"
|
2019-04-06 13:38:10 -06:00
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
#include "command.h"
|
|
|
|
|
#include "gdbcmd.h"
|
2019-04-02 20:04:24 -06:00
|
|
|
|
#include "symtab.h"
|
2019-04-06 13:38:10 -06:00
|
|
|
|
#include "symfile.h"
|
|
|
|
|
#include "objfiles.h"
|
Rename common to gdbsupport
This is the next patch in the ongoing series to move gdbsever to the
top level.
This patch just renames the "common" directory. The idea is to do
this move in two parts: first rename the directory (this patch), then
move the directory to the top. This approach makes the patches a bit
more tractable.
I chose the name "gdbsupport" for the directory. However, as this
patch was largely written by sed, we could pick a new name without too
much difficulty.
Tested by the buildbot.
gdb/ChangeLog
2019-07-09 Tom Tromey <tom@tromey.com>
* contrib/ari/gdb_ari.sh: Change common to gdbsupport.
* configure: Rebuild.
* configure.ac: Change common to gdbsupport.
* gdbsupport: Rename from common.
* acinclude.m4: Change common to gdbsupport.
* Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES)
(HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to
gdbsupport.
* aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c,
amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c,
amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c,
amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c,
amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c,
arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c,
arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c,
arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c,
arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c,
auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h,
btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c,
charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c,
cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c,
coff-pe-read.c, command.h, compile/compile-c-support.c,
compile/compile-c.h, compile/compile-cplus-symbols.c,
compile/compile-cplus-types.c, compile/compile-cplus.h,
compile/compile-loc2c.c, compile/compile.c, completer.c,
completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c,
cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c,
darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c,
disasm.h, dtrace-probe.c, dwarf-index-cache.c,
dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c,
dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c,
event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c,
features/aarch64-core.c, features/aarch64-fpu.c,
features/aarch64-pauth.c, features/aarch64-sve.c,
features/i386/32bit-avx.c, features/i386/32bit-avx512.c,
features/i386/32bit-core.c, features/i386/32bit-linux.c,
features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c,
features/i386/32bit-segments.c, features/i386/32bit-sse.c,
features/i386/64bit-avx.c, features/i386/64bit-avx512.c,
features/i386/64bit-core.c, features/i386/64bit-linux.c,
features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c,
features/i386/64bit-segments.c, features/i386/64bit-sse.c,
features/i386/x32-core.c, features/riscv/32bit-cpu.c,
features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c,
features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c,
features/riscv/64bit-fpu.c, features/tic6x-c6xp.c,
features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h,
findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h,
gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c,
gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c,
go32-nat.c, guile/guile.c, guile/scm-ports.c,
guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c,
i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c,
i386-linux-tdep.c, i386-tdep.c, i387-tdep.c,
ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c,
inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h,
inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h,
inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c,
linux-tdep.c, linux-thread-db.c, location.c, machoread.c,
macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h,
mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c,
mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h,
minsyms.c, mips-linux-tdep.c, namespace.h,
nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h,
nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c,
nat/amd64-linux-siginfo.c, nat/fork-inferior.c,
nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c,
nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c,
nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h,
nat/linux-waitpid.c, nat/mips-linux-watch.c,
nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c,
nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c,
nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h,
obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c,
parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c,
procfs.c, producer.c, progspace.h, psymtab.h,
python/py-framefilter.c, python/py-inferior.c, python/py-ref.h,
python/py-type.c, python/python.c, record-btrace.c, record-full.c,
record.c, record.h, regcache-dump.c, regcache.c, regcache.h,
remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c,
riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c,
selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c,
ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c,
source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c,
stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h,
symtab.c, symtab.h, target-descriptions.c, target-descriptions.h,
target-memory.c, target.c, target.h, target/waitstatus.c,
target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c,
top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c,
tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h,
unittests/array-view-selftests.c,
unittests/child-path-selftests.c, unittests/cli-utils-selftests.c,
unittests/common-utils-selftests.c,
unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c,
unittests/format_pieces-selftests.c,
unittests/function-view-selftests.c,
unittests/lookup_name_info-selftests.c,
unittests/memory-map-selftests.c, unittests/memrange-selftests.c,
unittests/mkdir-recursive-selftests.c,
unittests/observable-selftests.c,
unittests/offset-type-selftests.c, unittests/optional-selftests.c,
unittests/parse-connection-spec-selftests.c,
unittests/ptid-selftests.c, unittests/rsp-low-selftests.c,
unittests/scoped_fd-selftests.c,
unittests/scoped_mmap-selftests.c,
unittests/scoped_restore-selftests.c,
unittests/string_view-selftests.c, unittests/style-selftests.c,
unittests/tracepoint-selftests.c, unittests/unpack-selftests.c,
unittests/utils-selftests.c, unittests/xml-utils-selftests.c,
utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c,
value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c,
xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c,
xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport.
gdb/gdbserver/ChangeLog
2019-07-09 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Change common to gdbsupport.
* acinclude.m4: Change common to gdbsupport.
* Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS)
(version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change
common to gdbsupport.
* ax.c, event-loop.c, fork-child.c, gdb_proc_service.h,
gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c,
inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c,
linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c,
linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c,
linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h,
nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c,
server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h,
thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change
common to gdbsupport.
2019-05-05 20:29:24 -06:00
|
|
|
|
#include "gdbsupport/common-utils.h"
|
2019-04-06 13:38:10 -06:00
|
|
|
|
#include "coff/internal.h"
|
|
|
|
|
|
|
|
|
|
#include <ctype.h>
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
/* Internal section information */
|
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
/* Coff PE read debugging flag:
|
|
|
|
|
default value is 0,
|
|
|
|
|
value 1 outputs problems encountered while parsing PE file,
|
|
|
|
|
value above 1 also lists all generated minimal symbols. */
|
|
|
|
|
static unsigned int debug_coff_pe_read;
|
|
|
|
|
|
2003-02-20 03:12:46 +00:00
|
|
|
|
struct read_pe_section_data
|
|
|
|
|
{
|
2010-12-31 22:59:52 +00:00
|
|
|
|
CORE_ADDR vma_offset; /* Offset to loaded address of section. */
|
|
|
|
|
unsigned long rva_start; /* Start offset within the pe. */
|
|
|
|
|
unsigned long rva_end; /* End offset within the pe. */
|
|
|
|
|
enum minimal_symbol_type ms_type; /* Type to assign symbols in
|
|
|
|
|
section. */
|
2014-01-08 00:31:50 +01:00
|
|
|
|
unsigned int index; /* BFD section number. */
|
2018-05-24 22:32:24 -06:00
|
|
|
|
std::string section_name; /* Recorded section name. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
};
|
|
|
|
|
|
2012-12-13 14:58:26 +00:00
|
|
|
|
#define IMAGE_SCN_CNT_CODE 0x20
|
|
|
|
|
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x40
|
|
|
|
|
#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x80
|
2003-02-20 03:12:46 +00:00
|
|
|
|
#define PE_SECTION_INDEX_TEXT 0
|
|
|
|
|
#define PE_SECTION_INDEX_DATA 1
|
|
|
|
|
#define PE_SECTION_INDEX_BSS 2
|
|
|
|
|
#define PE_SECTION_TABLE_SIZE 3
|
|
|
|
|
#define PE_SECTION_INDEX_INVALID -1
|
|
|
|
|
|
|
|
|
|
/* Get the index of the named section in our own array, which contains
|
2010-12-31 22:59:52 +00:00
|
|
|
|
text, data and bss in that order. Return PE_SECTION_INDEX_INVALID
|
|
|
|
|
if passed an unrecognised section name. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
read_pe_section_index (const char *section_name)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp (section_name, ".text") == 0)
|
|
|
|
|
{
|
|
|
|
|
return PE_SECTION_INDEX_TEXT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (strcmp (section_name, ".data") == 0)
|
|
|
|
|
{
|
|
|
|
|
return PE_SECTION_INDEX_DATA;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (strcmp (section_name, ".bss") == 0)
|
|
|
|
|
{
|
|
|
|
|
return PE_SECTION_INDEX_BSS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return PE_SECTION_INDEX_INVALID;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-08 00:31:50 +01:00
|
|
|
|
/* Get the index of the named section in our own full array.
|
2012-12-13 10:44:45 +00:00
|
|
|
|
text, data and bss in that order. Return PE_SECTION_INDEX_INVALID
|
|
|
|
|
if passed an unrecognised section name. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
get_pe_section_index (const char *section_name,
|
2022-04-19 07:27:48 -06:00
|
|
|
|
const std::vector<read_pe_section_data> §ions)
|
2012-12-13 10:44:45 +00:00
|
|
|
|
{
|
2022-04-19 07:27:48 -06:00
|
|
|
|
for (int i = 0; i < sections.size (); i++)
|
2018-05-24 22:32:24 -06:00
|
|
|
|
if (sections[i].section_name == section_name)
|
2012-12-13 10:44:45 +00:00
|
|
|
|
return i;
|
|
|
|
|
return PE_SECTION_INDEX_INVALID;
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
/* Create a minimal symbol entry for an exported symbol.
|
|
|
|
|
SYM_NAME contains the exported name or NULL if exported by ordinal,
|
|
|
|
|
FUNC_RVA contains the Relative Virtual Address of the symbol,
|
|
|
|
|
ORDINAL is the ordinal index value of the symbol,
|
|
|
|
|
SECTION_DATA contains information about the section in which the
|
|
|
|
|
symbol is declared,
|
|
|
|
|
DLL_NAME is the internal name of the DLL file,
|
|
|
|
|
OBJFILE is the objfile struct of DLL_NAME. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
static void
|
Record minimal symbols directly in reader.
This patch changes minimal symbol creation in two ways. First, it
removes global variables in favor of members of minimal_symbol_reader.
Second, it changes functions like prim_record_minimal_symbol to be
member functions of minimal_symbol_reader.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add
"reader" argument. Update.
(xcoff_initial_scan): Update.
* symfile.h (mdebug_build_psymtabs): Add "reader" argument.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Add "reader" argument. Update.
* minsyms.h (minimal_symbol_reader) <record, record_full>:
Declare.
<m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members.
<record_with_info>: New function, renamed from
prim_record_minimal_symbol_and_info.
* minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove
globals.
(minimal_symbol_reader): Initialize new members.
(minimal_symbol_reader::record): Renamed from
prim_record_minimal_symbol.
(minimal_symbol_reader::record_full): Renamed from
prim_record_minimal_symbol_full.
(prim_record_minimal_symbol_and_info): Move to minsyms.h; rename.
* mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols)
(record_minimal_symbol): Add "reader" argument. Update.
(elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add
"reader" argument. Update.
(macho_symfile_read): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read): Add "reader" argument. Update.
(elf_read_minimal_symbols): Update.
* dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab)
(read_dbx_symtab): Add "reader" argument. Update.
(dbx_symfile_read): Update.
* coffread.c (record_minimal_symbol, coff_symtab_read): Add
"reader" argument. Update.
(coff_symfile_read): Update.
* coff-pe-read.h (read_pe_exported_syms): Add "reader" argument.
* coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym)
(read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 14:25:08 -06:00
|
|
|
|
add_pe_exported_sym (minimal_symbol_reader &reader,
|
|
|
|
|
const char *sym_name,
|
2003-02-20 03:12:46 +00:00
|
|
|
|
unsigned long func_rva,
|
2012-12-13 10:44:45 +00:00
|
|
|
|
int ordinal,
|
2003-02-20 03:12:46 +00:00
|
|
|
|
const struct read_pe_section_data *section_data,
|
|
|
|
|
const char *dll_name, struct objfile *objfile)
|
|
|
|
|
{
|
2010-12-31 22:59:52 +00:00
|
|
|
|
/* Add the stored offset to get the loaded address of the symbol. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
CORE_ADDR vma = func_rva + section_data->vma_offset;
|
|
|
|
|
|
|
|
|
|
/* Generate a (hopefully unique) qualified name using the first part
|
2010-12-31 22:59:52 +00:00
|
|
|
|
of the dll name, e.g. KERNEL32!AddAtomA. This matches the style
|
|
|
|
|
used by windbg from the "Microsoft Debugging Tools for Windows". */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2018-08-07 17:43:08 -04:00
|
|
|
|
std::string bare_name;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if (sym_name == NULL || *sym_name == '\0')
|
2018-08-07 17:43:08 -04:00
|
|
|
|
bare_name = string_printf ("#%d", ordinal);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
else
|
2018-08-07 17:43:08 -04:00
|
|
|
|
bare_name = sym_name;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
2018-08-07 17:43:08 -04:00
|
|
|
|
std::string qualified_name
|
|
|
|
|
= string_printf ("%s!%s", dll_name, bare_name.c_str ());
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if ((section_data->ms_type == mst_unknown) && debug_coff_pe_read)
|
2022-01-02 11:46:15 -07:00
|
|
|
|
gdb_printf (gdb_stdlog , _("Unknown section type for \"%s\""
|
|
|
|
|
" for entry \"%s\" in dll \"%s\"\n"),
|
|
|
|
|
section_data->section_name.c_str (), sym_name,
|
|
|
|
|
dll_name);
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2018-08-07 17:43:08 -04:00
|
|
|
|
reader.record_with_info (qualified_name.c_str (), vma, section_data->ms_type,
|
Record minimal symbols directly in reader.
This patch changes minimal symbol creation in two ways. First, it
removes global variables in favor of members of minimal_symbol_reader.
Second, it changes functions like prim_record_minimal_symbol to be
member functions of minimal_symbol_reader.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add
"reader" argument. Update.
(xcoff_initial_scan): Update.
* symfile.h (mdebug_build_psymtabs): Add "reader" argument.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Add "reader" argument. Update.
* minsyms.h (minimal_symbol_reader) <record, record_full>:
Declare.
<m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members.
<record_with_info>: New function, renamed from
prim_record_minimal_symbol_and_info.
* minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove
globals.
(minimal_symbol_reader): Initialize new members.
(minimal_symbol_reader::record): Renamed from
prim_record_minimal_symbol.
(minimal_symbol_reader::record_full): Renamed from
prim_record_minimal_symbol_full.
(prim_record_minimal_symbol_and_info): Move to minsyms.h; rename.
* mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols)
(record_minimal_symbol): Add "reader" argument. Update.
(elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add
"reader" argument. Update.
(macho_symfile_read): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read): Add "reader" argument. Update.
(elf_read_minimal_symbols): Update.
* dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab)
(read_dbx_symtab): Add "reader" argument. Update.
(dbx_symfile_read): Update.
* coffread.c (record_minimal_symbol, coff_symtab_read): Add
"reader" argument. Update.
(coff_symfile_read): Update.
* coff-pe-read.h (read_pe_exported_syms): Add "reader" argument.
* coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym)
(read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 14:25:08 -06:00
|
|
|
|
section_data->index);
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
/* Enter the plain name as well, which might not be unique. */
|
2018-08-07 17:43:08 -04:00
|
|
|
|
reader.record_with_info (bare_name.c_str (), vma, section_data->ms_type,
|
Record minimal symbols directly in reader.
This patch changes minimal symbol creation in two ways. First, it
removes global variables in favor of members of minimal_symbol_reader.
Second, it changes functions like prim_record_minimal_symbol to be
member functions of minimal_symbol_reader.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add
"reader" argument. Update.
(xcoff_initial_scan): Update.
* symfile.h (mdebug_build_psymtabs): Add "reader" argument.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Add "reader" argument. Update.
* minsyms.h (minimal_symbol_reader) <record, record_full>:
Declare.
<m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members.
<record_with_info>: New function, renamed from
prim_record_minimal_symbol_and_info.
* minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove
globals.
(minimal_symbol_reader): Initialize new members.
(minimal_symbol_reader::record): Renamed from
prim_record_minimal_symbol.
(minimal_symbol_reader::record_full): Renamed from
prim_record_minimal_symbol_full.
(prim_record_minimal_symbol_and_info): Move to minsyms.h; rename.
* mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols)
(record_minimal_symbol): Add "reader" argument. Update.
(elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add
"reader" argument. Update.
(macho_symfile_read): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read): Add "reader" argument. Update.
(elf_read_minimal_symbols): Update.
* dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab)
(read_dbx_symtab): Add "reader" argument. Update.
(dbx_symfile_read): Update.
* coffread.c (record_minimal_symbol, coff_symtab_read): Add
"reader" argument. Update.
(coff_symfile_read): Update.
* coff-pe-read.h (read_pe_exported_syms): Add "reader" argument.
* coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym)
(read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 14:25:08 -06:00
|
|
|
|
section_data->index);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if (debug_coff_pe_read > 1)
|
2022-01-02 11:46:15 -07:00
|
|
|
|
gdb_printf (gdb_stdlog, _("Adding exported symbol \"%s\""
|
|
|
|
|
" in dll \"%s\"\n"), sym_name, dll_name);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create a minimal symbol entry for an exported forward symbol.
|
|
|
|
|
Return 1 if the forwarded function was found 0 otherwise.
|
|
|
|
|
SYM_NAME contains the exported name or NULL if exported by ordinal,
|
|
|
|
|
FORWARD_DLL_NAME is the name of the DLL in which the target symobl resides,
|
|
|
|
|
FORWARD_FUNC_NAME is the name of the target symbol in that DLL,
|
|
|
|
|
ORDINAL is the ordinal index value of the symbol,
|
|
|
|
|
DLL_NAME is the internal name of the DLL file,
|
|
|
|
|
OBJFILE is the objfile struct of DLL_NAME. */
|
|
|
|
|
|
|
|
|
|
static int
|
Record minimal symbols directly in reader.
This patch changes minimal symbol creation in two ways. First, it
removes global variables in favor of members of minimal_symbol_reader.
Second, it changes functions like prim_record_minimal_symbol to be
member functions of minimal_symbol_reader.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add
"reader" argument. Update.
(xcoff_initial_scan): Update.
* symfile.h (mdebug_build_psymtabs): Add "reader" argument.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Add "reader" argument. Update.
* minsyms.h (minimal_symbol_reader) <record, record_full>:
Declare.
<m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members.
<record_with_info>: New function, renamed from
prim_record_minimal_symbol_and_info.
* minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove
globals.
(minimal_symbol_reader): Initialize new members.
(minimal_symbol_reader::record): Renamed from
prim_record_minimal_symbol.
(minimal_symbol_reader::record_full): Renamed from
prim_record_minimal_symbol_full.
(prim_record_minimal_symbol_and_info): Move to minsyms.h; rename.
* mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols)
(record_minimal_symbol): Add "reader" argument. Update.
(elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add
"reader" argument. Update.
(macho_symfile_read): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read): Add "reader" argument. Update.
(elf_read_minimal_symbols): Update.
* dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab)
(read_dbx_symtab): Add "reader" argument. Update.
(dbx_symfile_read): Update.
* coffread.c (record_minimal_symbol, coff_symtab_read): Add
"reader" argument. Update.
(coff_symfile_read): Update.
* coff-pe-read.h (read_pe_exported_syms): Add "reader" argument.
* coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym)
(read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 14:25:08 -06:00
|
|
|
|
add_pe_forwarded_sym (minimal_symbol_reader &reader,
|
|
|
|
|
const char *sym_name, const char *forward_dll_name,
|
2012-12-13 10:44:45 +00:00
|
|
|
|
const char *forward_func_name, int ordinal,
|
|
|
|
|
const char *dll_name, struct objfile *objfile)
|
|
|
|
|
{
|
2013-10-15 13:28:57 -06:00
|
|
|
|
CORE_ADDR vma, baseaddr;
|
* minsyms.h (struct bound_minimal_symbol): New.
(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol.
Remove objfile argument.
(lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc):
Return bound_minimal_symbol.
* minsyms.c (lookup_minimal_symbol_by_pc_1)
(lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc):
Return bound_minimal_symbol.
(in_gnu_ifunc_stub): Update.
(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol.
Remove 'objfile_p' argument.
(lookup_solib_trampoline_symbol_by_pc): Update.
* ada-tasks.c, amd64-windows-tdep.c, arm-tdep.c,
arm-wince-tdep.c, block.c, blockframe.c, breakpoint.c, btrace.c,
c-valprint.c, dwarf2loc.c, elfread.c, frame.c, frv-tdep.c,
glibc-tdep.c, gnu-v2-abi.c, gnu-v3-abi.c, hppa-hpux-tdep.c,
i386-tdep.c, ia64-tdep.c, infcall.c, infcmd.c, jit.c,
linux-fork.c, m32c-tdep.c, m68hc11-tdep.c, maint.c,
mips-tdep.c, p-valprint.c, parse.c, ppc-linux-tdep.c,
ppc-sysv-tdep.c, printcmd.c, rs6000-tdep.c, sh64-tdep.c,
stack.c, symtab.c, tui/tui-disasm.c: Update.
2013-04-08 19:59:09 +00:00
|
|
|
|
struct bound_minimal_symbol msymbol;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
enum minimal_symbol_type msymtype;
|
|
|
|
|
int forward_dll_name_len = strlen (forward_dll_name);
|
2014-01-08 00:31:50 +01:00
|
|
|
|
short section;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
2022-04-19 07:33:09 -06:00
|
|
|
|
std::string forward_qualified_name = string_printf ("%s!%s",
|
|
|
|
|
forward_dll_name,
|
|
|
|
|
forward_func_name);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
2022-04-19 07:33:09 -06:00
|
|
|
|
msymbol = lookup_bound_minimal_symbol (forward_qualified_name.c_str ());
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
* minsyms.h (struct bound_minimal_symbol): New.
(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol.
Remove objfile argument.
(lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc):
Return bound_minimal_symbol.
* minsyms.c (lookup_minimal_symbol_by_pc_1)
(lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc):
Return bound_minimal_symbol.
(in_gnu_ifunc_stub): Update.
(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol.
Remove 'objfile_p' argument.
(lookup_solib_trampoline_symbol_by_pc): Update.
* ada-tasks.c, amd64-windows-tdep.c, arm-tdep.c,
arm-wince-tdep.c, block.c, blockframe.c, breakpoint.c, btrace.c,
c-valprint.c, dwarf2loc.c, elfread.c, frame.c, frv-tdep.c,
glibc-tdep.c, gnu-v2-abi.c, gnu-v3-abi.c, hppa-hpux-tdep.c,
i386-tdep.c, ia64-tdep.c, infcall.c, infcmd.c, jit.c,
linux-fork.c, m32c-tdep.c, m68hc11-tdep.c, maint.c,
mips-tdep.c, p-valprint.c, parse.c, ppc-linux-tdep.c,
ppc-sysv-tdep.c, printcmd.c, rs6000-tdep.c, sh64-tdep.c,
stack.c, symtab.c, tui/tui-disasm.c: Update.
2013-04-08 19:59:09 +00:00
|
|
|
|
if (!msymbol.minsym)
|
2012-12-13 10:44:45 +00:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < forward_dll_name_len; i++)
|
|
|
|
|
forward_qualified_name[i] = tolower (forward_qualified_name[i]);
|
2022-04-19 07:33:09 -06:00
|
|
|
|
msymbol = lookup_bound_minimal_symbol (forward_qualified_name.c_str ());
|
2012-12-13 10:44:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
* minsyms.h (struct bound_minimal_symbol): New.
(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol.
Remove objfile argument.
(lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc):
Return bound_minimal_symbol.
* minsyms.c (lookup_minimal_symbol_by_pc_1)
(lookup_minimal_symbol_by_pc_section, lookup_minimal_symbol_by_pc):
Return bound_minimal_symbol.
(in_gnu_ifunc_stub): Update.
(lookup_minimal_symbol_and_objfile): Return bound_minimal_symbol.
Remove 'objfile_p' argument.
(lookup_solib_trampoline_symbol_by_pc): Update.
* ada-tasks.c, amd64-windows-tdep.c, arm-tdep.c,
arm-wince-tdep.c, block.c, blockframe.c, breakpoint.c, btrace.c,
c-valprint.c, dwarf2loc.c, elfread.c, frame.c, frv-tdep.c,
glibc-tdep.c, gnu-v2-abi.c, gnu-v3-abi.c, hppa-hpux-tdep.c,
i386-tdep.c, ia64-tdep.c, infcall.c, infcmd.c, jit.c,
linux-fork.c, m32c-tdep.c, m68hc11-tdep.c, maint.c,
mips-tdep.c, p-valprint.c, parse.c, ppc-linux-tdep.c,
ppc-sysv-tdep.c, printcmd.c, rs6000-tdep.c, sh64-tdep.c,
stack.c, symtab.c, tui/tui-disasm.c: Update.
2013-04-08 19:59:09 +00:00
|
|
|
|
if (!msymbol.minsym)
|
2012-12-13 10:44:45 +00:00
|
|
|
|
{
|
|
|
|
|
if (debug_coff_pe_read)
|
2022-01-02 11:46:15 -07:00
|
|
|
|
gdb_printf (gdb_stdlog, _("Unable to find function \"%s\" in"
|
|
|
|
|
" dll \"%s\", forward of \"%s\" in dll \"%s\"\n"),
|
|
|
|
|
forward_func_name, forward_dll_name, sym_name,
|
|
|
|
|
dll_name);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (debug_coff_pe_read > 1)
|
2022-01-02 11:46:15 -07:00
|
|
|
|
gdb_printf (gdb_stdlog, _("Adding forwarded exported symbol"
|
|
|
|
|
" \"%s\" in dll \"%s\", pointing to \"%s\"\n"),
|
2022-04-22 09:28:10 -06:00
|
|
|
|
sym_name, dll_name, forward_qualified_name.c_str ());
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
2022-01-28 08:09:50 -05:00
|
|
|
|
vma = msymbol.value_address ();
|
2022-01-28 10:28:57 -05:00
|
|
|
|
msymtype = msymbol.minsym->type ();
|
2021-02-07 21:15:12 +00:00
|
|
|
|
section = msymbol.minsym->section_index ();
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
|
|
|
|
/* Generate a (hopefully unique) qualified name using the first part
|
|
|
|
|
of the dll name, e.g. KERNEL32!AddAtomA. This matches the style
|
|
|
|
|
used by windbg from the "Microsoft Debugging Tools for Windows". */
|
|
|
|
|
|
2018-08-07 17:43:08 -04:00
|
|
|
|
std::string bare_name;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if (sym_name == NULL || *sym_name == '\0')
|
2018-08-07 17:43:08 -04:00
|
|
|
|
bare_name = string_printf ("#%d", ordinal);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
else
|
2018-08-07 17:43:08 -04:00
|
|
|
|
bare_name = sym_name;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
2018-08-07 17:43:08 -04:00
|
|
|
|
std::string qualified_name
|
|
|
|
|
= string_printf ("%s!%s", dll_name, bare_name.c_str ());
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
2013-10-15 13:28:57 -06:00
|
|
|
|
/* Note that this code makes a minimal symbol whose value may point
|
|
|
|
|
outside of any section in this objfile. These symbols can't
|
|
|
|
|
really be relocated properly, but nevertheless we make a stab at
|
|
|
|
|
it, choosing an approach consistent with the history of this
|
|
|
|
|
code. */
|
2020-01-23 17:55:35 -05:00
|
|
|
|
baseaddr = objfile->text_section_offset ();
|
2013-10-15 13:28:57 -06:00
|
|
|
|
|
2018-08-07 17:43:08 -04:00
|
|
|
|
reader.record_with_info (qualified_name.c_str (), vma - baseaddr, msymtype,
|
|
|
|
|
section);
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2010-12-31 22:59:52 +00:00
|
|
|
|
/* Enter the plain name as well, which might not be unique. */
|
2018-08-07 17:43:08 -04:00
|
|
|
|
reader.record_with_info (bare_name.c_str(), vma - baseaddr, msymtype,
|
|
|
|
|
section);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
|
|
|
|
return 1;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
/* Truncate a dll_name at the last dot character. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
read_pe_truncate_name (char *dll_name)
|
|
|
|
|
{
|
2012-12-13 10:44:45 +00:00
|
|
|
|
char *last_point = strrchr (dll_name, '.');
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if (last_point != NULL)
|
|
|
|
|
*last_point = '\0';
|
2003-02-20 03:12:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-31 22:59:52 +00:00
|
|
|
|
/* Low-level support functions, direct from the ld module pe-dll.c. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
static unsigned int
|
|
|
|
|
pe_get16 (bfd *abfd, int where)
|
|
|
|
|
{
|
|
|
|
|
unsigned char b[2];
|
|
|
|
|
|
|
|
|
|
bfd_seek (abfd, (file_ptr) where, SEEK_SET);
|
|
|
|
|
bfd_bread (b, (bfd_size_type) 2, abfd);
|
|
|
|
|
return b[0] + (b[1] << 8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static unsigned int
|
|
|
|
|
pe_get32 (bfd *abfd, int where)
|
|
|
|
|
{
|
|
|
|
|
unsigned char b[4];
|
|
|
|
|
|
|
|
|
|
bfd_seek (abfd, (file_ptr) where, SEEK_SET);
|
|
|
|
|
bfd_bread (b, (bfd_size_type) 4, abfd);
|
|
|
|
|
return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
static unsigned int
|
|
|
|
|
pe_as16 (void *ptr)
|
|
|
|
|
{
|
Add some more casts (1/2)
Note: I needed to split this patch in two, otherwise it's too big for
the mailing list.
This patch adds explicit casts to situations where a void pointer is
assigned to a pointer to the "real" type. Building in C++ mode requires
those assignments to use an explicit cast. This includes, for example:
- callback arguments (cleanups, comparison functions, ...)
- data attached to some object (objfile, program space, etc) in the form
of a void pointer
- "user data" passed to some function
This patch comes from the commit "(mostly) auto-generated patch to insert
casts needed for C++", taken from Pedro's C++ branch.
Only files built on x86 with --enable-targets=all are modified, so the
native files for other arches will need to be dealt with separately.
I built-tested this with --enable-targets=all and reg-tested. To my
surprise, a test case (selftest.exp) had to be adjusted.
Here's the ChangeLog entry. Again, this was relatively quick to make
despite the length, thanks to David Malcom's script, although I don't
believe it's very useful information in that particular case...
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s).
(aarch64_make_stub_cache): Likewise.
(value_of_aarch64_user_reg): Likewise.
* ada-lang.c (ada_inferior_data_cleanup): Likewise.
(get_ada_inferior_data): Likewise.
(get_ada_pspace_data): Likewise.
(ada_pspace_data_cleanup): Likewise.
(ada_complete_symbol_matcher): Likewise.
(ada_exc_search_name_matches): Likewise.
* ada-tasks.c (get_ada_tasks_pspace_data): Likewise.
(get_ada_tasks_inferior_data): Likewise.
* addrmap.c (addrmap_mutable_foreach_worker): Likewise.
(splay_obstack_alloc): Likewise.
(splay_obstack_free): Likewise.
* alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise.
(alpha_linux_collect_gregset): Likewise.
(alpha_linux_supply_fpregset): Likewise.
(alpha_linux_collect_fpregset): Likewise.
* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
* alpha-tdep.c (alpha_lds): Likewise.
(alpha_sts): Likewise.
(alpha_sigtramp_frame_unwind_cache): Likewise.
(alpha_heuristic_frame_unwind_cache): Likewise.
(alpha_supply_int_regs): Likewise.
(alpha_fill_int_regs): Likewise.
(alpha_supply_fp_regs): Likewise.
(alpha_fill_fp_regs): Likewise.
* alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise.
(alphanbsd_aout_supply_gregset): Likewise.
(alphanbsd_supply_gregset): Likewise.
* amd64-linux-tdep.c (amd64_linux_init_abi): Likewise.
(amd64_x32_linux_init_abi): Likewise.
* amd64-nat.c (amd64_supply_native_gregset): Likewise.
(amd64_collect_native_gregset): Likewise.
* amd64-tdep.c (amd64_frame_cache): Likewise.
(amd64_sigtramp_frame_cache): Likewise.
(amd64_epilogue_frame_cache): Likewise.
(amd64_supply_fxsave): Likewise.
(amd64_supply_xsave): Likewise.
(amd64_collect_fxsave): Likewise.
(amd64_collect_xsave): Likewise.
* amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise.
* amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise.
* arm-linux-tdep.c (arm_linux_supply_gregset): Likewise.
(arm_linux_collect_gregset): Likewise.
(arm_linux_supply_nwfpe): Likewise.
(arm_linux_collect_nwfpe): Likewise.
(arm_linux_supply_vfp): Likewise.
(arm_linux_collect_vfp): Likewise.
* arm-tdep.c (arm_find_mapping_symbol): Likewise.
(arm_prologue_unwind_stop_reason): Likewise.
(arm_prologue_this_id): Likewise.
(arm_prologue_prev_register): Likewise.
(arm_exidx_data_free): Likewise.
(arm_find_exidx_entry): Likewise.
(arm_stub_this_id): Likewise.
(arm_m_exception_this_id): Likewise.
(arm_m_exception_prev_register): Likewise.
(arm_normal_frame_base): Likewise.
(gdb_print_insn_arm): Likewise.
(arm_objfile_data_free): Likewise.
(arm_record_special_symbol): Likewise.
(value_of_arm_user_reg): Likewise.
* armbsd-tdep.c (armbsd_supply_fpregset): Likewise.
(armbsd_supply_gregset): Likewise.
* auto-load.c (auto_load_pspace_data_cleanup): Likewise.
(get_auto_load_pspace_data): Likewise.
(hash_loaded_script_entry): Likewise.
(eq_loaded_script_entry): Likewise.
(clear_section_scripts): Likewise.
(collect_matching_scripts): Likewise.
* auxv.c (auxv_inferior_data_cleanup): Likewise.
(get_auxv_inferior_data): Likewise.
* avr-tdep.c (avr_frame_unwind_cache): Likewise.
* ax-general.c (do_free_agent_expr_cleanup): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
(target_bfd_xclose): Likewise.
(target_bfd_get_section_table): Likewise.
* bfin-tdep.c (bfin_frame_cache): Likewise.
* block.c (find_block_in_blockvector): Likewise.
(call_site_for_pc): Likewise.
(block_find_non_opaque_type_preferred): Likewise.
* break-catch-sig.c (signal_catchpoint_insert_location): Likewise.
(signal_catchpoint_remove_location): Likewise.
(signal_catchpoint_breakpoint_hit): Likewise.
(signal_catchpoint_print_one): Likewise.
(signal_catchpoint_print_mention): Likewise.
(signal_catchpoint_print_recreate): Likewise.
* break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise.
* breakpoint.c (do_cleanup_counted_command_line): Likewise.
(bp_location_compare_addrs): Likewise.
(get_first_locp_gte_addr): Likewise.
(check_tracepoint_command): Likewise.
(do_map_commands_command): Likewise.
(get_breakpoint_objfile_data): Likewise.
(free_breakpoint_probes): Likewise.
(do_captured_breakpoint_query): Likewise.
(compare_breakpoints): Likewise.
(bp_location_compare): Likewise.
(bpstat_remove_breakpoint_callback): Likewise.
(do_delete_breakpoint_cleanup): Likewise.
* bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise.
(bsd_uthread_set_collect_uthread): Likewise.
(bsd_uthread_activate): Likewise.
(bsd_uthread_fetch_registers): Likewise.
(bsd_uthread_store_registers): Likewise.
* btrace.c (check_xml_btrace_version): Likewise.
(parse_xml_btrace_block): Likewise.
(parse_xml_btrace_pt_config_cpu): Likewise.
(parse_xml_btrace_pt_raw): Likewise.
(parse_xml_btrace_pt): Likewise.
(parse_xml_btrace_conf_bts): Likewise.
(parse_xml_btrace_conf_pt): Likewise.
(do_btrace_data_cleanup): Likewise.
* c-typeprint.c (find_typedef_for_canonicalize): Likewise.
* charset.c (cleanup_iconv): Likewise.
(do_cleanup_iterator): Likewise.
* cli-out.c (cli_uiout_dtor): Likewise.
(cli_table_begin): Likewise.
(cli_table_body): Likewise.
(cli_table_end): Likewise.
(cli_table_header): Likewise.
(cli_begin): Likewise.
(cli_end): Likewise.
(cli_field_int): Likewise.
(cli_field_skip): Likewise.
(cli_field_string): Likewise.
(cli_field_fmt): Likewise.
(cli_spaces): Likewise.
(cli_text): Likewise.
(cli_message): Likewise.
(cli_wrap_hint): Likewise.
(cli_flush): Likewise.
(cli_redirect): Likewise.
(out_field_fmt): Likewise.
(field_separator): Likewise.
(cli_out_set_stream): Likewise.
* cli/cli-cmds.c (compare_symtabs): Likewise.
* cli/cli-dump.c (call_dump_func): Likewise.
(restore_section_callback): Likewise.
* cli/cli-script.c (clear_hook_in_cleanup): Likewise.
(do_restore_user_call_depth): Likewise.
(do_free_command_lines_cleanup): Likewise.
* coff-pe-read.c (get_section_vmas): Likewise.
(pe_as16): Likewise.
(pe_as32): Likewise.
* coffread.c (coff_symfile_read): Likewise.
* common/agent.c (agent_look_up_symbols): Likewise.
* common/filestuff.c (do_close_cleanup): Likewise.
* common/format.c (free_format_pieces_cleanup): Likewise.
* common/vec.c (vec_o_reserve): Likewise.
* compile/compile-c-support.c (print_one_macro): Likewise.
* compile/compile-c-symbols.c (hash_symbol_error): Likewise.
(eq_symbol_error): Likewise.
(del_symbol_error): Likewise.
(error_symbol_once): Likewise.
(gcc_convert_symbol): Likewise.
(gcc_symbol_address): Likewise.
(hash_symname): Likewise.
(eq_symname): Likewise.
* compile/compile-c-types.c (hash_type_map_instance): Likewise.
(eq_type_map_instance): Likewise.
(insert_type): Likewise.
(convert_type): Likewise.
* compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise.
(setup_sections): Likewise.
(link_hash_table_free): Likewise.
(copy_sections): Likewise.
* compile/compile-object-run.c (do_module_cleanup): Likewise.
* compile/compile.c (compile_print_value): Likewise.
(do_rmdir): Likewise.
(cleanup_compile_instance): Likewise.
(cleanup_unlink_file): Likewise.
* completer.c (free_completion_tracker): Likewise.
* corelow.c (add_to_spuid_list): Likewise.
* cp-namespace.c (reset_directive_searched): Likewise.
* cp-support.c (reset_directive_searched): Likewise.
* cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise.
(cris_frame_unwind_cache): Likewise.
* d-lang.c (builtin_d_type): Likewise.
* d-namespace.c (reset_directive_searched): Likewise.
* dbxread.c (dbx_free_symfile_info): Likewise.
(do_free_bincl_list_cleanup): Likewise.
* disasm.c (hash_dis_line_entry): Likewise.
(eq_dis_line_entry): Likewise.
(dis_asm_print_address): Likewise.
(fprintf_disasm): Likewise.
(do_ui_file_delete): Likewise.
* doublest.c (convert_floatformat_to_doublest): Likewise.
* dummy-frame.c (pop_dummy_frame_bpt): Likewise.
(dummy_frame_prev_register): Likewise.
(dummy_frame_this_id): Likewise.
* dwarf2-frame-tailcall.c (cache_hash): Likewise.
(cache_eq): Likewise.
(cache_find): Likewise.
(tailcall_frame_this_id): Likewise.
(dwarf2_tailcall_prev_register_first): Likewise.
(tailcall_frame_prev_register): Likewise.
(tailcall_frame_dealloc_cache): Likewise.
(tailcall_frame_prev_arch): Likewise.
* dwarf2-frame.c (dwarf2_frame_state_free): Likewise.
(dwarf2_frame_set_init_reg): Likewise.
(dwarf2_frame_init_reg): Likewise.
(dwarf2_frame_set_signal_frame_p): Likewise.
(dwarf2_frame_signal_frame_p): Likewise.
(dwarf2_frame_set_adjust_regnum): Likewise.
(dwarf2_frame_adjust_regnum): Likewise.
(clear_pointer_cleanup): Likewise.
(dwarf2_frame_cache): Likewise.
(find_cie): Likewise.
(dwarf2_frame_find_fde): Likewise.
* dwarf2expr.c (dwarf_expr_address_type): Likewise.
(free_dwarf_expr_context_cleanup): Likewise.
* dwarf2loc.c (locexpr_find_frame_base_location): Likewise.
(locexpr_get_frame_base): Likewise.
(loclist_find_frame_base_location): Likewise.
(loclist_get_frame_base): Likewise.
(dwarf_expr_dwarf_call): Likewise.
(dwarf_expr_get_base_type): Likewise.
(dwarf_expr_push_dwarf_reg_entry_value): Likewise.
(dwarf_expr_get_obj_addr): Likewise.
(entry_data_value_coerce_ref): Likewise.
(entry_data_value_copy_closure): Likewise.
(entry_data_value_free_closure): Likewise.
(get_frame_address_in_block_wrapper): Likewise.
(dwarf2_evaluate_property): Likewise.
(dwarf2_compile_property_to_c): Likewise.
(needs_frame_read_addr_from_reg): Likewise.
(needs_frame_get_reg_value): Likewise.
(needs_frame_frame_base): Likewise.
(needs_frame_frame_cfa): Likewise.
(needs_frame_tls_address): Likewise.
(needs_frame_dwarf_call): Likewise.
(needs_dwarf_reg_entry_value): Likewise.
(get_ax_pc): Likewise.
(locexpr_read_variable): Likewise.
(locexpr_read_variable_at_entry): Likewise.
(locexpr_read_needs_frame): Likewise.
(locexpr_describe_location): Likewise.
(locexpr_tracepoint_var_ref): Likewise.
(locexpr_generate_c_location): Likewise.
(loclist_read_variable): Likewise.
(loclist_read_variable_at_entry): Likewise.
(loclist_describe_location): Likewise.
(loclist_tracepoint_var_ref): Likewise.
(loclist_generate_c_location): Likewise.
* dwarf2read.c (line_header_hash_voidp): Likewise.
(line_header_eq_voidp): Likewise.
(dwarf2_has_info): Likewise.
(dwarf2_get_section_info): Likewise.
(locate_dwz_sections): Likewise.
(hash_file_name_entry): Likewise.
(eq_file_name_entry): Likewise.
(delete_file_name_entry): Likewise.
(dw2_setup): Likewise.
(dw2_get_file_names_reader): Likewise.
(dw2_find_pc_sect_compunit_symtab): Likewise.
(hash_signatured_type): Likewise.
(eq_signatured_type): Likewise.
(add_signatured_type_cu_to_table): Likewise.
(create_debug_types_hash_table): Likewise.
(lookup_dwo_signatured_type): Likewise.
(lookup_dwp_signatured_type): Likewise.
(lookup_signatured_type): Likewise.
(hash_type_unit_group): Likewise.
(eq_type_unit_group): Likewise.
(get_type_unit_group): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(sort_tu_by_abbrev_offset): Likewise.
(process_skeletonless_type_unit): Likewise.
(psymtabs_addrmap_cleanup): Likewise.
(dwarf2_read_symtab): Likewise.
(psymtab_to_symtab_1): Likewise.
(die_hash): Likewise.
(die_eq): Likewise.
(load_full_comp_unit_reader): Likewise.
(reset_die_in_process): Likewise.
(free_cu_line_header): Likewise.
(handle_DW_AT_stmt_list): Likewise.
(hash_dwo_file): Likewise.
(eq_dwo_file): Likewise.
(hash_dwo_unit): Likewise.
(eq_dwo_unit): Likewise.
(create_dwo_cu_reader): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(dwarf2_locate_dwo_sections): Likewise.
(dwarf2_locate_common_dwp_sections): Likewise.
(dwarf2_locate_v2_dwp_sections): Likewise.
(hash_dwp_loaded_cutus): Likewise.
(eq_dwp_loaded_cutus): Likewise.
(lookup_dwo_cutu): Likewise.
(abbrev_table_free_cleanup): Likewise.
(dwarf2_free_abbrev_table): Likewise.
(find_partial_die_in_comp_unit): Likewise.
(free_line_header_voidp): Likewise.
(follow_die_offset): Likewise.
(follow_die_sig_1): Likewise.
(free_heap_comp_unit): Likewise.
(free_stack_comp_unit): Likewise.
(dwarf2_free_objfile): Likewise.
(per_cu_offset_and_type_hash): Likewise.
(per_cu_offset_and_type_eq): Likewise.
(get_die_type_at_offset): Likewise.
(partial_die_hash): Likewise.
(partial_die_eq): Likewise.
(dwarf2_per_objfile_free): Likewise.
(hash_strtab_entry): Likewise.
(eq_strtab_entry): Likewise.
(add_string): Likewise.
(hash_symtab_entry): Likewise.
(eq_symtab_entry): Likewise.
(delete_symtab_entry): Likewise.
(cleanup_mapped_symtab): Likewise.
(add_indices_to_cpool): Likewise.
(hash_psymtab_cu_index): Likewise.
(eq_psymtab_cu_index): Likewise.
(add_address_entry_worker): Likewise.
(unlink_if_set): Likewise.
(write_one_signatured_type): Likewise.
(save_gdb_index_command): Likewise.
* elfread.c (elf_symtab_read): Likewise.
(elf_gnu_ifunc_cache_hash): Likewise.
(elf_gnu_ifunc_cache_eq): Likewise.
(elf_gnu_ifunc_record_cache): Likewise.
(elf_gnu_ifunc_resolve_by_cache): Likewise.
(elf_get_probes): Likewise.
(probe_key_free): Likewise.
* f-lang.c (builtin_f_type): Likewise.
* frame-base.c (frame_base_append_sniffer): Likewise.
(frame_base_set_default): Likewise.
(frame_base_find_by_frame): Likewise.
* frame-unwind.c (frame_unwind_prepend_unwinder): Likewise.
(frame_unwind_append_unwinder): Likewise.
(frame_unwind_find_by_frame): Likewise.
* frame.c (frame_addr_hash): Likewise.
(frame_addr_hash_eq): Likewise.
(frame_stash_find): Likewise.
(do_frame_register_read): Likewise.
(unwind_to_current_frame): Likewise.
(frame_cleanup_after_sniffer): Likewise.
* frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise.
* frv-tdep.c (frv_frame_unwind_cache): Likewise.
* ft32-tdep.c (ft32_frame_cache): Likewise.
* gcore.c (do_bfd_delete_cleanup): Likewise.
(gcore_create_callback): Likewise.
* gdb_bfd.c (hash_bfd): Likewise.
(eq_bfd): Likewise.
(gdb_bfd_open): Likewise.
(free_one_bfd_section): Likewise.
(gdb_bfd_ref): Likewise.
(gdb_bfd_unref): Likewise.
(get_section_descriptor): Likewise.
(gdb_bfd_map_section): Likewise.
(gdb_bfd_crc): Likewise.
(gdb_bfd_mark_parent): Likewise.
(gdb_bfd_record_inclusion): Likewise.
(gdb_bfd_requires_relocations): Likewise.
(print_one_bfd): Likewise.
* gdbtypes.c (type_pair_hash): Likewise.
(type_pair_eq): Likewise.
(builtin_type): Likewise.
(objfile_type): Likewise.
* gnu-v3-abi.c (vtable_ptrdiff_type): Likewise.
(vtable_address_point_offset): Likewise.
(gnuv3_get_vtable): Likewise.
(hash_value_and_voffset): Likewise.
(eq_value_and_voffset): Likewise.
(compare_value_and_voffset): Likewise.
(compute_vtable_size): Likewise.
(gnuv3_get_typeid_type): Likewise.
* go-lang.c (builtin_go_type): Likewise.
* guile/scm-block.c (bkscm_hash_block_smob): Likewise.
(bkscm_eq_block_smob): Likewise.
(bkscm_objfile_block_map): Likewise.
(bkscm_del_objfile_blocks): Likewise.
* guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise.
* guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise.
(gdbscm_disasm_print_address): Likewise.
* guile/scm-frame.c (frscm_hash_frame_smob): Likewise.
(frscm_eq_frame_smob): Likewise.
(frscm_inferior_frame_map): Likewise.
(frscm_del_inferior_frames): Likewise.
* guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise.
* guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise.
(ofscm_objfile_smob_from_objfile): Likewise.
* guile/scm-ports.c (ioscm_write): Likewise.
(ioscm_file_port_delete): Likewise.
(ioscm_file_port_rewind): Likewise.
(ioscm_file_port_put): Likewise.
(ioscm_file_port_write): Likewise.
* guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise.
(psscm_pspace_smob_from_pspace): Likewise.
* guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise.
(scscm_recording_unwind_handler): Likewise.
(gdbscm_with_catch): Likewise.
(scscm_call_0_body): Likewise.
(scscm_call_1_body): Likewise.
(scscm_call_2_body): Likewise.
(scscm_call_3_body): Likewise.
(scscm_call_4_body): Likewise.
(scscm_apply_1_body): Likewise.
(scscm_eval_scheme_string): Likewise.
(gdbscm_safe_eval_string): Likewise.
(scscm_source_scheme_script): Likewise.
(gdbscm_safe_source_script): Likewise.
* guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise.
(gdbscm_call_scm_from_stringn): Likewise.
* guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise.
(syscm_eq_symbol_smob): Likewise.
(syscm_get_symbol_map): Likewise.
(syscm_del_objfile_symbols): Likewise.
* guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise.
(stscm_eq_symtab_smob): Likewise.
(stscm_objfile_symtab_map): Likewise.
(stscm_del_objfile_symtabs): Likewise.
* guile/scm-type.c (tyscm_hash_type_smob): Likewise.
(tyscm_eq_type_smob): Likewise.
(tyscm_type_map): Likewise.
(tyscm_copy_type_recursive): Likewise.
(save_objfile_types): Likewise.
* guile/scm-utils.c (extract_arg): Likewise.
* h8300-tdep.c (h8300_frame_cache): Likewise.
* hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise.
* hppa-tdep.c (compare_unwind_entries): Likewise.
(find_unwind_entry): Likewise.
(hppa_frame_cache): Likewise.
(hppa_stub_frame_unwind_cache): Likewise.
* hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise.
* hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise.
(hppaobsd_supply_fpregset): Likewise.
* i386-cygwin-tdep.c (core_process_module_section): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Likewise.
* i386-tdep.c (i386_frame_cache): Likewise.
(i386_epilogue_frame_cache): Likewise.
(i386_sigtramp_frame_cache): Likewise.
(i386_supply_gregset): Likewise.
(i386_collect_gregset): Likewise.
(i386_gdbarch_init): Likewise.
* i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise.
(i386obsd_trapframe_cache): Likewise.
* i387-tdep.c (i387_supply_fsave): Likewise.
(i387_collect_fsave): Likewise.
(i387_supply_fxsave): Likewise.
(i387_collect_fxsave): Likewise.
(i387_supply_xsave): Likewise.
(i387_collect_xsave): Likewise.
* ia64-tdep.c (ia64_frame_cache): Likewise.
(ia64_sigtramp_frame_cache): Likewise.
* infcmd.c (attach_command_continuation): Likewise.
(attach_command_continuation_free_args): Likewise.
* inferior.c (restore_inferior): Likewise.
(delete_thread_of_inferior): Likewise.
* inflow.c (inflow_inferior_data_cleanup): Likewise.
(get_inflow_inferior_data): Likewise.
(inflow_inferior_exit): Likewise.
* infrun.c (displaced_step_clear_cleanup): Likewise.
(restore_current_uiout_cleanup): Likewise.
(release_stop_context_cleanup): Likewise.
(do_restore_infcall_suspend_state_cleanup): Likewise.
(do_restore_infcall_control_state_cleanup): Likewise.
(restore_inferior_ptid): Likewise.
* inline-frame.c (block_starting_point_at): Likewise.
* iq2000-tdep.c (iq2000_frame_cache): Likewise.
* jit.c (get_jit_objfile_data): Likewise.
(get_jit_program_space_data): Likewise.
(jit_object_close_impl): Likewise.
(jit_find_objf_with_entry_addr): Likewise.
(jit_breakpoint_deleted): Likewise.
(jit_unwind_reg_set_impl): Likewise.
(jit_unwind_reg_get_impl): Likewise.
(jit_dealloc_cache): Likewise.
(jit_frame_sniffer): Likewise.
(jit_frame_prev_register): Likewise.
(jit_prepend_unwinder): Likewise.
(jit_inferior_exit_hook): Likewise.
(free_objfile_data): Likewise.
* jv-lang.c (jv_per_objfile_free): Likewise.
(get_dynamics_objfile): Likewise.
(get_java_class_symtab): Likewise.
(builtin_java_type): Likewise.
* language.c (language_string_char_type): Likewise.
(language_bool_type): Likewise.
(language_lookup_primitive_type): Likewise.
(language_lookup_primitive_type_as_symbol): Likewise.
* linespec.c (hash_address_entry): Likewise.
(eq_address_entry): Likewise.
(iterate_inline_only): Likewise.
(iterate_name_matcher): Likewise.
(decode_line_2_compare_items): Likewise.
(collect_one_symbol): Likewise.
(compare_symbols): Likewise.
(compare_msymbols): Likewise.
(add_symtabs_to_list): Likewise.
(collect_symbols): Likewise.
(compare_msyms): Likewise.
(add_minsym): Likewise.
(cleanup_linespec_result): Likewise.
* linux-fork.c (inferior_call_waitpid_cleanup): Likewise.
* linux-nat.c (delete_lwp_cleanup): Likewise.
(count_events_callback): Likewise.
(select_event_lwp_callback): Likewise.
(resume_stopped_resumed_lwps): Likewise.
* linux-tdep.c (get_linux_gdbarch_data): Likewise.
(invalidate_linux_cache_inf): Likewise.
(get_linux_inferior_data): Likewise.
(linux_find_memory_regions_thunk): Likewise.
(linux_make_mappings_callback): Likewise.
(linux_corefile_thread_callback): Likewise.
(find_mapping_size): Likewise.
* linux-thread-db.c (find_new_threads_callback): Likewise.
* lm32-tdep.c (lm32_frame_cache): Likewise.
* m2-lang.c (builtin_m2_type): Likewise.
* m32c-tdep.c (m32c_analyze_frame_prologue): Likewise.
* m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise.
(m32r_linux_supply_gregset): Likewise.
(m32r_linux_collect_gregset): Likewise.
* m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
* m68k-tdep.c (m68k_frame_cache): Likewise.
* m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise.
(m68kbsd_supply_gregset): Likewise.
* m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise.
* m88k-tdep.c (m88k_frame_cache): Likewise.
(m88k_supply_gregset): Likewise.
gdb/gdbserver/ChangeLog:
* dll.c (match_dll): Add cast(s).
(unloaded_dll): Likewise.
* linux-low.c (second_thread_of_pid_p): Likewise.
(delete_lwp_callback): Likewise.
(count_events_callback): Likewise.
(select_event_lwp_callback): Likewise.
(linux_set_resume_request): Likewise.
* server.c (accumulate_file_name_length): Likewise.
(emit_dll_description): Likewise.
(handle_qxfer_threads_worker): Likewise.
(visit_actioned_threads): Likewise.
* thread-db.c (any_thread_of): Likewise.
* tracepoint.c (same_process_p): Likewise.
(match_blocktype): Likewise.
(build_traceframe_info_xml): Likewise.
gdb/testsuite/ChangeLog:
* gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected
source line.
2015-09-25 14:08:07 -04:00
|
|
|
|
unsigned char *b = (unsigned char *) ptr;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
|
|
|
|
return b[0] + (b[1] << 8);
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-20 03:12:46 +00:00
|
|
|
|
static unsigned int
|
|
|
|
|
pe_as32 (void *ptr)
|
|
|
|
|
{
|
Add some more casts (1/2)
Note: I needed to split this patch in two, otherwise it's too big for
the mailing list.
This patch adds explicit casts to situations where a void pointer is
assigned to a pointer to the "real" type. Building in C++ mode requires
those assignments to use an explicit cast. This includes, for example:
- callback arguments (cleanups, comparison functions, ...)
- data attached to some object (objfile, program space, etc) in the form
of a void pointer
- "user data" passed to some function
This patch comes from the commit "(mostly) auto-generated patch to insert
casts needed for C++", taken from Pedro's C++ branch.
Only files built on x86 with --enable-targets=all are modified, so the
native files for other arches will need to be dealt with separately.
I built-tested this with --enable-targets=all and reg-tested. To my
surprise, a test case (selftest.exp) had to be adjusted.
Here's the ChangeLog entry. Again, this was relatively quick to make
despite the length, thanks to David Malcom's script, although I don't
believe it's very useful information in that particular case...
gdb/ChangeLog:
* aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s).
(aarch64_make_stub_cache): Likewise.
(value_of_aarch64_user_reg): Likewise.
* ada-lang.c (ada_inferior_data_cleanup): Likewise.
(get_ada_inferior_data): Likewise.
(get_ada_pspace_data): Likewise.
(ada_pspace_data_cleanup): Likewise.
(ada_complete_symbol_matcher): Likewise.
(ada_exc_search_name_matches): Likewise.
* ada-tasks.c (get_ada_tasks_pspace_data): Likewise.
(get_ada_tasks_inferior_data): Likewise.
* addrmap.c (addrmap_mutable_foreach_worker): Likewise.
(splay_obstack_alloc): Likewise.
(splay_obstack_free): Likewise.
* alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise.
(alpha_linux_collect_gregset): Likewise.
(alpha_linux_supply_fpregset): Likewise.
(alpha_linux_collect_fpregset): Likewise.
* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise.
* alpha-tdep.c (alpha_lds): Likewise.
(alpha_sts): Likewise.
(alpha_sigtramp_frame_unwind_cache): Likewise.
(alpha_heuristic_frame_unwind_cache): Likewise.
(alpha_supply_int_regs): Likewise.
(alpha_fill_int_regs): Likewise.
(alpha_supply_fp_regs): Likewise.
(alpha_fill_fp_regs): Likewise.
* alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise.
(alphanbsd_aout_supply_gregset): Likewise.
(alphanbsd_supply_gregset): Likewise.
* amd64-linux-tdep.c (amd64_linux_init_abi): Likewise.
(amd64_x32_linux_init_abi): Likewise.
* amd64-nat.c (amd64_supply_native_gregset): Likewise.
(amd64_collect_native_gregset): Likewise.
* amd64-tdep.c (amd64_frame_cache): Likewise.
(amd64_sigtramp_frame_cache): Likewise.
(amd64_epilogue_frame_cache): Likewise.
(amd64_supply_fxsave): Likewise.
(amd64_supply_xsave): Likewise.
(amd64_collect_fxsave): Likewise.
(amd64_collect_xsave): Likewise.
* amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise.
* amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise.
* arm-linux-tdep.c (arm_linux_supply_gregset): Likewise.
(arm_linux_collect_gregset): Likewise.
(arm_linux_supply_nwfpe): Likewise.
(arm_linux_collect_nwfpe): Likewise.
(arm_linux_supply_vfp): Likewise.
(arm_linux_collect_vfp): Likewise.
* arm-tdep.c (arm_find_mapping_symbol): Likewise.
(arm_prologue_unwind_stop_reason): Likewise.
(arm_prologue_this_id): Likewise.
(arm_prologue_prev_register): Likewise.
(arm_exidx_data_free): Likewise.
(arm_find_exidx_entry): Likewise.
(arm_stub_this_id): Likewise.
(arm_m_exception_this_id): Likewise.
(arm_m_exception_prev_register): Likewise.
(arm_normal_frame_base): Likewise.
(gdb_print_insn_arm): Likewise.
(arm_objfile_data_free): Likewise.
(arm_record_special_symbol): Likewise.
(value_of_arm_user_reg): Likewise.
* armbsd-tdep.c (armbsd_supply_fpregset): Likewise.
(armbsd_supply_gregset): Likewise.
* auto-load.c (auto_load_pspace_data_cleanup): Likewise.
(get_auto_load_pspace_data): Likewise.
(hash_loaded_script_entry): Likewise.
(eq_loaded_script_entry): Likewise.
(clear_section_scripts): Likewise.
(collect_matching_scripts): Likewise.
* auxv.c (auxv_inferior_data_cleanup): Likewise.
(get_auxv_inferior_data): Likewise.
* avr-tdep.c (avr_frame_unwind_cache): Likewise.
* ax-general.c (do_free_agent_expr_cleanup): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
(target_bfd_xclose): Likewise.
(target_bfd_get_section_table): Likewise.
* bfin-tdep.c (bfin_frame_cache): Likewise.
* block.c (find_block_in_blockvector): Likewise.
(call_site_for_pc): Likewise.
(block_find_non_opaque_type_preferred): Likewise.
* break-catch-sig.c (signal_catchpoint_insert_location): Likewise.
(signal_catchpoint_remove_location): Likewise.
(signal_catchpoint_breakpoint_hit): Likewise.
(signal_catchpoint_print_one): Likewise.
(signal_catchpoint_print_mention): Likewise.
(signal_catchpoint_print_recreate): Likewise.
* break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise.
* breakpoint.c (do_cleanup_counted_command_line): Likewise.
(bp_location_compare_addrs): Likewise.
(get_first_locp_gte_addr): Likewise.
(check_tracepoint_command): Likewise.
(do_map_commands_command): Likewise.
(get_breakpoint_objfile_data): Likewise.
(free_breakpoint_probes): Likewise.
(do_captured_breakpoint_query): Likewise.
(compare_breakpoints): Likewise.
(bp_location_compare): Likewise.
(bpstat_remove_breakpoint_callback): Likewise.
(do_delete_breakpoint_cleanup): Likewise.
* bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise.
(bsd_uthread_set_collect_uthread): Likewise.
(bsd_uthread_activate): Likewise.
(bsd_uthread_fetch_registers): Likewise.
(bsd_uthread_store_registers): Likewise.
* btrace.c (check_xml_btrace_version): Likewise.
(parse_xml_btrace_block): Likewise.
(parse_xml_btrace_pt_config_cpu): Likewise.
(parse_xml_btrace_pt_raw): Likewise.
(parse_xml_btrace_pt): Likewise.
(parse_xml_btrace_conf_bts): Likewise.
(parse_xml_btrace_conf_pt): Likewise.
(do_btrace_data_cleanup): Likewise.
* c-typeprint.c (find_typedef_for_canonicalize): Likewise.
* charset.c (cleanup_iconv): Likewise.
(do_cleanup_iterator): Likewise.
* cli-out.c (cli_uiout_dtor): Likewise.
(cli_table_begin): Likewise.
(cli_table_body): Likewise.
(cli_table_end): Likewise.
(cli_table_header): Likewise.
(cli_begin): Likewise.
(cli_end): Likewise.
(cli_field_int): Likewise.
(cli_field_skip): Likewise.
(cli_field_string): Likewise.
(cli_field_fmt): Likewise.
(cli_spaces): Likewise.
(cli_text): Likewise.
(cli_message): Likewise.
(cli_wrap_hint): Likewise.
(cli_flush): Likewise.
(cli_redirect): Likewise.
(out_field_fmt): Likewise.
(field_separator): Likewise.
(cli_out_set_stream): Likewise.
* cli/cli-cmds.c (compare_symtabs): Likewise.
* cli/cli-dump.c (call_dump_func): Likewise.
(restore_section_callback): Likewise.
* cli/cli-script.c (clear_hook_in_cleanup): Likewise.
(do_restore_user_call_depth): Likewise.
(do_free_command_lines_cleanup): Likewise.
* coff-pe-read.c (get_section_vmas): Likewise.
(pe_as16): Likewise.
(pe_as32): Likewise.
* coffread.c (coff_symfile_read): Likewise.
* common/agent.c (agent_look_up_symbols): Likewise.
* common/filestuff.c (do_close_cleanup): Likewise.
* common/format.c (free_format_pieces_cleanup): Likewise.
* common/vec.c (vec_o_reserve): Likewise.
* compile/compile-c-support.c (print_one_macro): Likewise.
* compile/compile-c-symbols.c (hash_symbol_error): Likewise.
(eq_symbol_error): Likewise.
(del_symbol_error): Likewise.
(error_symbol_once): Likewise.
(gcc_convert_symbol): Likewise.
(gcc_symbol_address): Likewise.
(hash_symname): Likewise.
(eq_symname): Likewise.
* compile/compile-c-types.c (hash_type_map_instance): Likewise.
(eq_type_map_instance): Likewise.
(insert_type): Likewise.
(convert_type): Likewise.
* compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise.
(setup_sections): Likewise.
(link_hash_table_free): Likewise.
(copy_sections): Likewise.
* compile/compile-object-run.c (do_module_cleanup): Likewise.
* compile/compile.c (compile_print_value): Likewise.
(do_rmdir): Likewise.
(cleanup_compile_instance): Likewise.
(cleanup_unlink_file): Likewise.
* completer.c (free_completion_tracker): Likewise.
* corelow.c (add_to_spuid_list): Likewise.
* cp-namespace.c (reset_directive_searched): Likewise.
* cp-support.c (reset_directive_searched): Likewise.
* cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise.
(cris_frame_unwind_cache): Likewise.
* d-lang.c (builtin_d_type): Likewise.
* d-namespace.c (reset_directive_searched): Likewise.
* dbxread.c (dbx_free_symfile_info): Likewise.
(do_free_bincl_list_cleanup): Likewise.
* disasm.c (hash_dis_line_entry): Likewise.
(eq_dis_line_entry): Likewise.
(dis_asm_print_address): Likewise.
(fprintf_disasm): Likewise.
(do_ui_file_delete): Likewise.
* doublest.c (convert_floatformat_to_doublest): Likewise.
* dummy-frame.c (pop_dummy_frame_bpt): Likewise.
(dummy_frame_prev_register): Likewise.
(dummy_frame_this_id): Likewise.
* dwarf2-frame-tailcall.c (cache_hash): Likewise.
(cache_eq): Likewise.
(cache_find): Likewise.
(tailcall_frame_this_id): Likewise.
(dwarf2_tailcall_prev_register_first): Likewise.
(tailcall_frame_prev_register): Likewise.
(tailcall_frame_dealloc_cache): Likewise.
(tailcall_frame_prev_arch): Likewise.
* dwarf2-frame.c (dwarf2_frame_state_free): Likewise.
(dwarf2_frame_set_init_reg): Likewise.
(dwarf2_frame_init_reg): Likewise.
(dwarf2_frame_set_signal_frame_p): Likewise.
(dwarf2_frame_signal_frame_p): Likewise.
(dwarf2_frame_set_adjust_regnum): Likewise.
(dwarf2_frame_adjust_regnum): Likewise.
(clear_pointer_cleanup): Likewise.
(dwarf2_frame_cache): Likewise.
(find_cie): Likewise.
(dwarf2_frame_find_fde): Likewise.
* dwarf2expr.c (dwarf_expr_address_type): Likewise.
(free_dwarf_expr_context_cleanup): Likewise.
* dwarf2loc.c (locexpr_find_frame_base_location): Likewise.
(locexpr_get_frame_base): Likewise.
(loclist_find_frame_base_location): Likewise.
(loclist_get_frame_base): Likewise.
(dwarf_expr_dwarf_call): Likewise.
(dwarf_expr_get_base_type): Likewise.
(dwarf_expr_push_dwarf_reg_entry_value): Likewise.
(dwarf_expr_get_obj_addr): Likewise.
(entry_data_value_coerce_ref): Likewise.
(entry_data_value_copy_closure): Likewise.
(entry_data_value_free_closure): Likewise.
(get_frame_address_in_block_wrapper): Likewise.
(dwarf2_evaluate_property): Likewise.
(dwarf2_compile_property_to_c): Likewise.
(needs_frame_read_addr_from_reg): Likewise.
(needs_frame_get_reg_value): Likewise.
(needs_frame_frame_base): Likewise.
(needs_frame_frame_cfa): Likewise.
(needs_frame_tls_address): Likewise.
(needs_frame_dwarf_call): Likewise.
(needs_dwarf_reg_entry_value): Likewise.
(get_ax_pc): Likewise.
(locexpr_read_variable): Likewise.
(locexpr_read_variable_at_entry): Likewise.
(locexpr_read_needs_frame): Likewise.
(locexpr_describe_location): Likewise.
(locexpr_tracepoint_var_ref): Likewise.
(locexpr_generate_c_location): Likewise.
(loclist_read_variable): Likewise.
(loclist_read_variable_at_entry): Likewise.
(loclist_describe_location): Likewise.
(loclist_tracepoint_var_ref): Likewise.
(loclist_generate_c_location): Likewise.
* dwarf2read.c (line_header_hash_voidp): Likewise.
(line_header_eq_voidp): Likewise.
(dwarf2_has_info): Likewise.
(dwarf2_get_section_info): Likewise.
(locate_dwz_sections): Likewise.
(hash_file_name_entry): Likewise.
(eq_file_name_entry): Likewise.
(delete_file_name_entry): Likewise.
(dw2_setup): Likewise.
(dw2_get_file_names_reader): Likewise.
(dw2_find_pc_sect_compunit_symtab): Likewise.
(hash_signatured_type): Likewise.
(eq_signatured_type): Likewise.
(add_signatured_type_cu_to_table): Likewise.
(create_debug_types_hash_table): Likewise.
(lookup_dwo_signatured_type): Likewise.
(lookup_dwp_signatured_type): Likewise.
(lookup_signatured_type): Likewise.
(hash_type_unit_group): Likewise.
(eq_type_unit_group): Likewise.
(get_type_unit_group): Likewise.
(process_psymtab_comp_unit_reader): Likewise.
(sort_tu_by_abbrev_offset): Likewise.
(process_skeletonless_type_unit): Likewise.
(psymtabs_addrmap_cleanup): Likewise.
(dwarf2_read_symtab): Likewise.
(psymtab_to_symtab_1): Likewise.
(die_hash): Likewise.
(die_eq): Likewise.
(load_full_comp_unit_reader): Likewise.
(reset_die_in_process): Likewise.
(free_cu_line_header): Likewise.
(handle_DW_AT_stmt_list): Likewise.
(hash_dwo_file): Likewise.
(eq_dwo_file): Likewise.
(hash_dwo_unit): Likewise.
(eq_dwo_unit): Likewise.
(create_dwo_cu_reader): Likewise.
(create_dwo_unit_in_dwp_v1): Likewise.
(create_dwo_unit_in_dwp_v2): Likewise.
(lookup_dwo_unit_in_dwp): Likewise.
(dwarf2_locate_dwo_sections): Likewise.
(dwarf2_locate_common_dwp_sections): Likewise.
(dwarf2_locate_v2_dwp_sections): Likewise.
(hash_dwp_loaded_cutus): Likewise.
(eq_dwp_loaded_cutus): Likewise.
(lookup_dwo_cutu): Likewise.
(abbrev_table_free_cleanup): Likewise.
(dwarf2_free_abbrev_table): Likewise.
(find_partial_die_in_comp_unit): Likewise.
(free_line_header_voidp): Likewise.
(follow_die_offset): Likewise.
(follow_die_sig_1): Likewise.
(free_heap_comp_unit): Likewise.
(free_stack_comp_unit): Likewise.
(dwarf2_free_objfile): Likewise.
(per_cu_offset_and_type_hash): Likewise.
(per_cu_offset_and_type_eq): Likewise.
(get_die_type_at_offset): Likewise.
(partial_die_hash): Likewise.
(partial_die_eq): Likewise.
(dwarf2_per_objfile_free): Likewise.
(hash_strtab_entry): Likewise.
(eq_strtab_entry): Likewise.
(add_string): Likewise.
(hash_symtab_entry): Likewise.
(eq_symtab_entry): Likewise.
(delete_symtab_entry): Likewise.
(cleanup_mapped_symtab): Likewise.
(add_indices_to_cpool): Likewise.
(hash_psymtab_cu_index): Likewise.
(eq_psymtab_cu_index): Likewise.
(add_address_entry_worker): Likewise.
(unlink_if_set): Likewise.
(write_one_signatured_type): Likewise.
(save_gdb_index_command): Likewise.
* elfread.c (elf_symtab_read): Likewise.
(elf_gnu_ifunc_cache_hash): Likewise.
(elf_gnu_ifunc_cache_eq): Likewise.
(elf_gnu_ifunc_record_cache): Likewise.
(elf_gnu_ifunc_resolve_by_cache): Likewise.
(elf_get_probes): Likewise.
(probe_key_free): Likewise.
* f-lang.c (builtin_f_type): Likewise.
* frame-base.c (frame_base_append_sniffer): Likewise.
(frame_base_set_default): Likewise.
(frame_base_find_by_frame): Likewise.
* frame-unwind.c (frame_unwind_prepend_unwinder): Likewise.
(frame_unwind_append_unwinder): Likewise.
(frame_unwind_find_by_frame): Likewise.
* frame.c (frame_addr_hash): Likewise.
(frame_addr_hash_eq): Likewise.
(frame_stash_find): Likewise.
(do_frame_register_read): Likewise.
(unwind_to_current_frame): Likewise.
(frame_cleanup_after_sniffer): Likewise.
* frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise.
* frv-tdep.c (frv_frame_unwind_cache): Likewise.
* ft32-tdep.c (ft32_frame_cache): Likewise.
* gcore.c (do_bfd_delete_cleanup): Likewise.
(gcore_create_callback): Likewise.
* gdb_bfd.c (hash_bfd): Likewise.
(eq_bfd): Likewise.
(gdb_bfd_open): Likewise.
(free_one_bfd_section): Likewise.
(gdb_bfd_ref): Likewise.
(gdb_bfd_unref): Likewise.
(get_section_descriptor): Likewise.
(gdb_bfd_map_section): Likewise.
(gdb_bfd_crc): Likewise.
(gdb_bfd_mark_parent): Likewise.
(gdb_bfd_record_inclusion): Likewise.
(gdb_bfd_requires_relocations): Likewise.
(print_one_bfd): Likewise.
* gdbtypes.c (type_pair_hash): Likewise.
(type_pair_eq): Likewise.
(builtin_type): Likewise.
(objfile_type): Likewise.
* gnu-v3-abi.c (vtable_ptrdiff_type): Likewise.
(vtable_address_point_offset): Likewise.
(gnuv3_get_vtable): Likewise.
(hash_value_and_voffset): Likewise.
(eq_value_and_voffset): Likewise.
(compare_value_and_voffset): Likewise.
(compute_vtable_size): Likewise.
(gnuv3_get_typeid_type): Likewise.
* go-lang.c (builtin_go_type): Likewise.
* guile/scm-block.c (bkscm_hash_block_smob): Likewise.
(bkscm_eq_block_smob): Likewise.
(bkscm_objfile_block_map): Likewise.
(bkscm_del_objfile_blocks): Likewise.
* guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise.
* guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise.
(gdbscm_disasm_print_address): Likewise.
* guile/scm-frame.c (frscm_hash_frame_smob): Likewise.
(frscm_eq_frame_smob): Likewise.
(frscm_inferior_frame_map): Likewise.
(frscm_del_inferior_frames): Likewise.
* guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise.
* guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise.
(ofscm_objfile_smob_from_objfile): Likewise.
* guile/scm-ports.c (ioscm_write): Likewise.
(ioscm_file_port_delete): Likewise.
(ioscm_file_port_rewind): Likewise.
(ioscm_file_port_put): Likewise.
(ioscm_file_port_write): Likewise.
* guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise.
(psscm_pspace_smob_from_pspace): Likewise.
* guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise.
(scscm_recording_unwind_handler): Likewise.
(gdbscm_with_catch): Likewise.
(scscm_call_0_body): Likewise.
(scscm_call_1_body): Likewise.
(scscm_call_2_body): Likewise.
(scscm_call_3_body): Likewise.
(scscm_call_4_body): Likewise.
(scscm_apply_1_body): Likewise.
(scscm_eval_scheme_string): Likewise.
(gdbscm_safe_eval_string): Likewise.
(scscm_source_scheme_script): Likewise.
(gdbscm_safe_source_script): Likewise.
* guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise.
(gdbscm_call_scm_from_stringn): Likewise.
* guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise.
(syscm_eq_symbol_smob): Likewise.
(syscm_get_symbol_map): Likewise.
(syscm_del_objfile_symbols): Likewise.
* guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise.
(stscm_eq_symtab_smob): Likewise.
(stscm_objfile_symtab_map): Likewise.
(stscm_del_objfile_symtabs): Likewise.
* guile/scm-type.c (tyscm_hash_type_smob): Likewise.
(tyscm_eq_type_smob): Likewise.
(tyscm_type_map): Likewise.
(tyscm_copy_type_recursive): Likewise.
(save_objfile_types): Likewise.
* guile/scm-utils.c (extract_arg): Likewise.
* h8300-tdep.c (h8300_frame_cache): Likewise.
* hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise.
* hppa-tdep.c (compare_unwind_entries): Likewise.
(find_unwind_entry): Likewise.
(hppa_frame_cache): Likewise.
(hppa_stub_frame_unwind_cache): Likewise.
* hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise.
* hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise.
(hppaobsd_supply_fpregset): Likewise.
* i386-cygwin-tdep.c (core_process_module_section): Likewise.
* i386-linux-tdep.c (i386_linux_init_abi): Likewise.
* i386-tdep.c (i386_frame_cache): Likewise.
(i386_epilogue_frame_cache): Likewise.
(i386_sigtramp_frame_cache): Likewise.
(i386_supply_gregset): Likewise.
(i386_collect_gregset): Likewise.
(i386_gdbarch_init): Likewise.
* i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise.
(i386obsd_trapframe_cache): Likewise.
* i387-tdep.c (i387_supply_fsave): Likewise.
(i387_collect_fsave): Likewise.
(i387_supply_fxsave): Likewise.
(i387_collect_fxsave): Likewise.
(i387_supply_xsave): Likewise.
(i387_collect_xsave): Likewise.
* ia64-tdep.c (ia64_frame_cache): Likewise.
(ia64_sigtramp_frame_cache): Likewise.
* infcmd.c (attach_command_continuation): Likewise.
(attach_command_continuation_free_args): Likewise.
* inferior.c (restore_inferior): Likewise.
(delete_thread_of_inferior): Likewise.
* inflow.c (inflow_inferior_data_cleanup): Likewise.
(get_inflow_inferior_data): Likewise.
(inflow_inferior_exit): Likewise.
* infrun.c (displaced_step_clear_cleanup): Likewise.
(restore_current_uiout_cleanup): Likewise.
(release_stop_context_cleanup): Likewise.
(do_restore_infcall_suspend_state_cleanup): Likewise.
(do_restore_infcall_control_state_cleanup): Likewise.
(restore_inferior_ptid): Likewise.
* inline-frame.c (block_starting_point_at): Likewise.
* iq2000-tdep.c (iq2000_frame_cache): Likewise.
* jit.c (get_jit_objfile_data): Likewise.
(get_jit_program_space_data): Likewise.
(jit_object_close_impl): Likewise.
(jit_find_objf_with_entry_addr): Likewise.
(jit_breakpoint_deleted): Likewise.
(jit_unwind_reg_set_impl): Likewise.
(jit_unwind_reg_get_impl): Likewise.
(jit_dealloc_cache): Likewise.
(jit_frame_sniffer): Likewise.
(jit_frame_prev_register): Likewise.
(jit_prepend_unwinder): Likewise.
(jit_inferior_exit_hook): Likewise.
(free_objfile_data): Likewise.
* jv-lang.c (jv_per_objfile_free): Likewise.
(get_dynamics_objfile): Likewise.
(get_java_class_symtab): Likewise.
(builtin_java_type): Likewise.
* language.c (language_string_char_type): Likewise.
(language_bool_type): Likewise.
(language_lookup_primitive_type): Likewise.
(language_lookup_primitive_type_as_symbol): Likewise.
* linespec.c (hash_address_entry): Likewise.
(eq_address_entry): Likewise.
(iterate_inline_only): Likewise.
(iterate_name_matcher): Likewise.
(decode_line_2_compare_items): Likewise.
(collect_one_symbol): Likewise.
(compare_symbols): Likewise.
(compare_msymbols): Likewise.
(add_symtabs_to_list): Likewise.
(collect_symbols): Likewise.
(compare_msyms): Likewise.
(add_minsym): Likewise.
(cleanup_linespec_result): Likewise.
* linux-fork.c (inferior_call_waitpid_cleanup): Likewise.
* linux-nat.c (delete_lwp_cleanup): Likewise.
(count_events_callback): Likewise.
(select_event_lwp_callback): Likewise.
(resume_stopped_resumed_lwps): Likewise.
* linux-tdep.c (get_linux_gdbarch_data): Likewise.
(invalidate_linux_cache_inf): Likewise.
(get_linux_inferior_data): Likewise.
(linux_find_memory_regions_thunk): Likewise.
(linux_make_mappings_callback): Likewise.
(linux_corefile_thread_callback): Likewise.
(find_mapping_size): Likewise.
* linux-thread-db.c (find_new_threads_callback): Likewise.
* lm32-tdep.c (lm32_frame_cache): Likewise.
* m2-lang.c (builtin_m2_type): Likewise.
* m32c-tdep.c (m32c_analyze_frame_prologue): Likewise.
* m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise.
(m32r_linux_supply_gregset): Likewise.
(m32r_linux_collect_gregset): Likewise.
* m32r-tdep.c (m32r_frame_unwind_cache): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise.
* m68k-tdep.c (m68k_frame_cache): Likewise.
* m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise.
(m68kbsd_supply_gregset): Likewise.
* m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise.
* m88k-tdep.c (m88k_frame_cache): Likewise.
(m88k_supply_gregset): Likewise.
gdb/gdbserver/ChangeLog:
* dll.c (match_dll): Add cast(s).
(unloaded_dll): Likewise.
* linux-low.c (second_thread_of_pid_p): Likewise.
(delete_lwp_callback): Likewise.
(count_events_callback): Likewise.
(select_event_lwp_callback): Likewise.
(linux_set_resume_request): Likewise.
* server.c (accumulate_file_name_length): Likewise.
(emit_dll_description): Likewise.
(handle_qxfer_threads_worker): Likewise.
(visit_actioned_threads): Likewise.
* thread-db.c (any_thread_of): Likewise.
* tracepoint.c (same_process_p): Likewise.
(match_blocktype): Likewise.
(build_traceframe_info_xml): Likewise.
gdb/testsuite/ChangeLog:
* gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected
source line.
2015-09-25 14:08:07 -04:00
|
|
|
|
unsigned char *b = (unsigned char *) ptr;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Read the (non-debug) export symbol table from a portable
|
2010-12-31 22:59:52 +00:00
|
|
|
|
executable. Code originally lifted from the ld function
|
|
|
|
|
pe_implied_import_dll in pe-dll.c. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
void
|
Record minimal symbols directly in reader.
This patch changes minimal symbol creation in two ways. First, it
removes global variables in favor of members of minimal_symbol_reader.
Second, it changes functions like prim_record_minimal_symbol to be
member functions of minimal_symbol_reader.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add
"reader" argument. Update.
(xcoff_initial_scan): Update.
* symfile.h (mdebug_build_psymtabs): Add "reader" argument.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Add "reader" argument. Update.
* minsyms.h (minimal_symbol_reader) <record, record_full>:
Declare.
<m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members.
<record_with_info>: New function, renamed from
prim_record_minimal_symbol_and_info.
* minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove
globals.
(minimal_symbol_reader): Initialize new members.
(minimal_symbol_reader::record): Renamed from
prim_record_minimal_symbol.
(minimal_symbol_reader::record_full): Renamed from
prim_record_minimal_symbol_full.
(prim_record_minimal_symbol_and_info): Move to minsyms.h; rename.
* mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols)
(record_minimal_symbol): Add "reader" argument. Update.
(elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add
"reader" argument. Update.
(macho_symfile_read): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read): Add "reader" argument. Update.
(elf_read_minimal_symbols): Update.
* dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab)
(read_dbx_symtab): Add "reader" argument. Update.
(dbx_symfile_read): Update.
* coffread.c (record_minimal_symbol, coff_symtab_read): Add
"reader" argument. Update.
(coff_symfile_read): Update.
* coff-pe-read.h (read_pe_exported_syms): Add "reader" argument.
* coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym)
(read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 14:25:08 -06:00
|
|
|
|
read_pe_exported_syms (minimal_symbol_reader &reader,
|
|
|
|
|
struct objfile *objfile)
|
2003-02-20 03:12:46 +00:00
|
|
|
|
{
|
2022-08-02 09:55:32 -06:00
|
|
|
|
bfd *dll = objfile->obfd.get ();
|
2012-12-13 10:44:45 +00:00
|
|
|
|
unsigned long nbnormal, nbforward;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
unsigned long export_opthdrrva, export_opthdrsize;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
unsigned long export_rva, export_size, nsections, secptr, expptr;
|
|
|
|
|
unsigned long exp_funcbase;
|
|
|
|
|
unsigned char *expdata, *erva;
|
|
|
|
|
unsigned long name_rvas, ordinals, nexp, ordbase;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
int otherix = PE_SECTION_TABLE_SIZE;
|
2009-01-08 20:53:32 +00:00
|
|
|
|
int is_pe64 = 0;
|
|
|
|
|
int is_pe32 = 0;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2022-08-02 09:55:32 -06:00
|
|
|
|
char const *target = bfd_get_target (objfile->obfd.get ());
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2018-05-24 22:32:24 -06:00
|
|
|
|
std::vector<struct read_pe_section_data> section_data
|
|
|
|
|
(PE_SECTION_TABLE_SIZE);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
|
|
|
|
for (i=0; i < PE_SECTION_TABLE_SIZE; i++)
|
|
|
|
|
{
|
|
|
|
|
section_data[i].vma_offset = 0;
|
|
|
|
|
section_data[i].rva_start = 1;
|
|
|
|
|
section_data[i].rva_end = 0;
|
|
|
|
|
};
|
|
|
|
|
section_data[PE_SECTION_INDEX_TEXT].ms_type = mst_text;
|
|
|
|
|
section_data[PE_SECTION_INDEX_TEXT].section_name = ".text";
|
|
|
|
|
section_data[PE_SECTION_INDEX_DATA].ms_type = mst_data;
|
|
|
|
|
section_data[PE_SECTION_INDEX_DATA].section_name = ".data";
|
|
|
|
|
section_data[PE_SECTION_INDEX_BSS].ms_type = mst_bss;
|
|
|
|
|
section_data[PE_SECTION_INDEX_BSS].section_name = ".bss";
|
|
|
|
|
|
2009-07-05 22:02:39 +00:00
|
|
|
|
is_pe64 = (strcmp (target, "pe-x86-64") == 0
|
|
|
|
|
|| strcmp (target, "pei-x86-64") == 0);
|
|
|
|
|
is_pe32 = (strcmp (target, "pe-i386") == 0
|
|
|
|
|
|| strcmp (target, "pei-i386") == 0
|
|
|
|
|
|| strcmp (target, "pe-arm-wince-little") == 0
|
|
|
|
|
|| strcmp (target, "pei-arm-wince-little") == 0);
|
2009-01-08 20:53:32 +00:00
|
|
|
|
if (!is_pe32 && !is_pe64)
|
2003-02-20 03:12:46 +00:00
|
|
|
|
{
|
2009-07-05 22:02:39 +00:00
|
|
|
|
/* This is not a recognized PE format file. Abort now, because
|
|
|
|
|
the code is untested on anything else. *FIXME* test on
|
2010-12-31 22:59:52 +00:00
|
|
|
|
further architectures and loosen or remove this test. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get pe_header, optional header and numbers of export entries. */
|
|
|
|
|
pe_header_offset = pe_get32 (dll, 0x3c);
|
|
|
|
|
opthdr_ofs = pe_header_offset + 4 + 20;
|
2009-01-08 20:53:32 +00:00
|
|
|
|
if (is_pe64)
|
2009-01-09 09:33:31 +00:00
|
|
|
|
num_entries = pe_get32 (dll, opthdr_ofs + 108);
|
2009-01-08 20:53:32 +00:00
|
|
|
|
else
|
|
|
|
|
num_entries = pe_get32 (dll, opthdr_ofs + 92);
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
if (num_entries < 1) /* No exports. */
|
2018-05-24 22:32:24 -06:00
|
|
|
|
return;
|
2009-01-08 20:53:32 +00:00
|
|
|
|
if (is_pe64)
|
|
|
|
|
{
|
2012-12-13 10:44:45 +00:00
|
|
|
|
export_opthdrrva = pe_get32 (dll, opthdr_ofs + 112);
|
|
|
|
|
export_opthdrsize = pe_get32 (dll, opthdr_ofs + 116);
|
2009-01-08 20:53:32 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2012-12-13 10:44:45 +00:00
|
|
|
|
export_opthdrrva = pe_get32 (dll, opthdr_ofs + 96);
|
|
|
|
|
export_opthdrsize = pe_get32 (dll, opthdr_ofs + 100);
|
2009-01-08 20:53:32 +00:00
|
|
|
|
}
|
2003-02-20 03:12:46 +00:00
|
|
|
|
nsections = pe_get16 (dll, pe_header_offset + 4 + 2);
|
|
|
|
|
secptr = (pe_header_offset + 4 + 20 +
|
|
|
|
|
pe_get16 (dll, pe_header_offset + 4 + 16));
|
|
|
|
|
expptr = 0;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
export_size = 0;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
/* Get the rva and size of the export section. */
|
|
|
|
|
for (i = 0; i < nsections; i++)
|
|
|
|
|
{
|
|
|
|
|
char sname[8];
|
|
|
|
|
unsigned long secptr1 = secptr + 40 * i;
|
|
|
|
|
unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
|
|
|
|
|
unsigned long vsize = pe_get32 (dll, secptr1 + 16);
|
|
|
|
|
unsigned long fptr = pe_get32 (dll, secptr1 + 20);
|
|
|
|
|
|
|
|
|
|
bfd_seek (dll, (file_ptr) secptr1, SEEK_SET);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
bfd_bread (sname, (bfd_size_type) sizeof (sname), dll);
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if ((strcmp (sname, ".edata") == 0)
|
|
|
|
|
|| (vaddr <= export_opthdrrva && export_opthdrrva < vaddr + vsize))
|
2003-02-20 03:12:46 +00:00
|
|
|
|
{
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if (strcmp (sname, ".edata") != 0)
|
|
|
|
|
{
|
|
|
|
|
if (debug_coff_pe_read)
|
2022-01-02 11:46:15 -07:00
|
|
|
|
gdb_printf (gdb_stdlog, _("Export RVA for dll "
|
|
|
|
|
"\"%s\" is in section \"%s\"\n"),
|
2022-04-19 07:30:08 -06:00
|
|
|
|
bfd_get_filename (dll), sname);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
}
|
|
|
|
|
else if (export_opthdrrva != vaddr && debug_coff_pe_read)
|
2022-01-02 11:46:15 -07:00
|
|
|
|
gdb_printf (gdb_stdlog, _("Wrong value of export RVA"
|
|
|
|
|
" for dll \"%s\": 0x%lx instead of 0x%lx\n"),
|
2022-04-19 07:30:08 -06:00
|
|
|
|
bfd_get_filename (dll), export_opthdrrva, vaddr);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
expptr = fptr + (export_opthdrrva - vaddr);
|
2003-02-20 03:12:46 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-02 00:25:56 +00:00
|
|
|
|
if (expptr == 0)
|
|
|
|
|
{
|
|
|
|
|
/* no section contains export table rva */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
export_rva = export_opthdrrva;
|
|
|
|
|
export_size = export_opthdrsize;
|
|
|
|
|
|
2003-02-20 03:12:46 +00:00
|
|
|
|
if (export_size == 0)
|
|
|
|
|
{
|
2010-12-31 22:59:52 +00:00
|
|
|
|
/* Empty export table. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-31 22:59:52 +00:00
|
|
|
|
/* Scan sections and store the base and size of the relevant
|
|
|
|
|
sections. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
for (i = 0; i < nsections; i++)
|
|
|
|
|
{
|
|
|
|
|
unsigned long secptr1 = secptr + 40 * i;
|
|
|
|
|
unsigned long vsize = pe_get32 (dll, secptr1 + 8);
|
|
|
|
|
unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
unsigned long characteristics = pe_get32 (dll, secptr1 + 36);
|
2012-12-13 15:11:36 +00:00
|
|
|
|
char sec_name[SCNNMLEN + 1];
|
2003-02-20 03:12:46 +00:00
|
|
|
|
int sectix;
|
2014-01-08 00:31:50 +01:00
|
|
|
|
unsigned int bfd_section_index;
|
|
|
|
|
asection *section;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
bfd_seek (dll, (file_ptr) secptr1 + 0, SEEK_SET);
|
2012-12-13 15:11:36 +00:00
|
|
|
|
bfd_bread (sec_name, (bfd_size_type) SCNNMLEN, dll);
|
|
|
|
|
sec_name[SCNNMLEN] = '\0';
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
sectix = read_pe_section_index (sec_name);
|
2014-01-08 00:31:50 +01:00
|
|
|
|
section = bfd_get_section_by_name (dll, sec_name);
|
|
|
|
|
if (section)
|
|
|
|
|
bfd_section_index = section->index;
|
|
|
|
|
else
|
|
|
|
|
bfd_section_index = -1;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
if (sectix != PE_SECTION_INDEX_INVALID)
|
|
|
|
|
{
|
|
|
|
|
section_data[sectix].rva_start = vaddr;
|
|
|
|
|
section_data[sectix].rva_end = vaddr + vsize;
|
2014-01-08 00:31:50 +01:00
|
|
|
|
section_data[sectix].index = bfd_section_index;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
}
|
2012-12-13 10:44:45 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2018-05-24 22:32:24 -06:00
|
|
|
|
section_data.resize (otherix + 1);
|
|
|
|
|
section_data[otherix].section_name = sec_name;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
section_data[otherix].rva_start = vaddr;
|
|
|
|
|
section_data[otherix].rva_end = vaddr + vsize;
|
|
|
|
|
section_data[otherix].vma_offset = 0;
|
2014-01-08 00:31:50 +01:00
|
|
|
|
section_data[otherix].index = bfd_section_index;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if (characteristics & IMAGE_SCN_CNT_CODE)
|
|
|
|
|
section_data[otherix].ms_type = mst_text;
|
|
|
|
|
else if (characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA)
|
|
|
|
|
section_data[otherix].ms_type = mst_data;
|
|
|
|
|
else if (characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
|
|
|
|
|
section_data[otherix].ms_type = mst_bss;
|
|
|
|
|
else
|
|
|
|
|
section_data[otherix].ms_type = mst_unknown;
|
|
|
|
|
otherix++;
|
|
|
|
|
}
|
2003-02-20 03:12:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-05-24 22:32:24 -06:00
|
|
|
|
gdb::def_vector<unsigned char> expdata_storage (export_size);
|
|
|
|
|
expdata = expdata_storage.data ();
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
bfd_seek (dll, (file_ptr) expptr, SEEK_SET);
|
|
|
|
|
bfd_bread (expdata, (bfd_size_type) export_size, dll);
|
|
|
|
|
erva = expdata - export_rva;
|
|
|
|
|
|
|
|
|
|
nexp = pe_as32 (expdata + 24);
|
|
|
|
|
name_rvas = pe_as32 (expdata + 32);
|
|
|
|
|
ordinals = pe_as32 (expdata + 36);
|
|
|
|
|
ordbase = pe_as32 (expdata + 16);
|
|
|
|
|
exp_funcbase = pe_as32 (expdata + 28);
|
|
|
|
|
|
2010-12-31 22:59:52 +00:00
|
|
|
|
/* Use internal dll name instead of full pathname. */
|
2022-04-19 07:30:08 -06:00
|
|
|
|
char *dll_name = (char *) (pe_as32 (expdata + 12) + erva);
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2022-04-19 07:27:48 -06:00
|
|
|
|
for (asection *sectp : gdb_bfd_sections (dll))
|
|
|
|
|
{
|
|
|
|
|
int sectix = get_pe_section_index (sectp->name, section_data);
|
|
|
|
|
if (sectix != PE_SECTION_INDEX_INVALID)
|
|
|
|
|
{
|
|
|
|
|
/* Data within the section start at rva_start in the pe and at
|
|
|
|
|
bfd_get_section_vma() within memory. Store the offset. */
|
|
|
|
|
section_data[sectix].vma_offset
|
|
|
|
|
= bfd_section_vma (sectp) - section_data[sectix].rva_start;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
/* Truncate name at first dot. Should maybe also convert to all
|
2010-12-31 22:59:52 +00:00
|
|
|
|
lower case for convenience on Windows. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
read_pe_truncate_name (dll_name);
|
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if (debug_coff_pe_read)
|
2022-01-02 11:46:15 -07:00
|
|
|
|
gdb_printf (gdb_stdlog, _("DLL \"%s\" has %ld export entries,"
|
|
|
|
|
" base=%ld\n"), dll_name, nexp, ordbase);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
nbforward = 0;
|
|
|
|
|
nbnormal = 0;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
/* Iterate through the list of symbols. */
|
|
|
|
|
for (i = 0; i < nexp; i++)
|
|
|
|
|
{
|
|
|
|
|
/* Pointer to the names vector. */
|
|
|
|
|
unsigned long name_rva = pe_as32 (erva + name_rvas + i * 4);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
/* Retrieve ordinal value. */
|
|
|
|
|
|
|
|
|
|
unsigned long ordinal = pe_as16 (erva + ordinals + i * 2);
|
|
|
|
|
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
|
|
|
|
/* Pointer to the function address vector. */
|
2019-10-18 02:48:08 +02:00
|
|
|
|
/* This is relative to ordinal value. */
|
2012-12-13 10:44:45 +00:00
|
|
|
|
unsigned long func_rva = pe_as32 (erva + exp_funcbase +
|
gdb, gdbserver, gdbsupport: fix leading space vs tabs issues
Many spots incorrectly use only spaces for indentation (for example,
there are a lot of spots in ada-lang.c). I've always found it awkward
when I needed to edit one of these spots: do I keep the original wrong
indentation, or do I fix it? What if the lines around it are also
wrong, do I fix them too? I probably don't want to fix them in the same
patch, to avoid adding noise to my patch.
So I propose to fix as much as possible once and for all (hopefully).
One typical counter argument for this is that it makes code archeology
more difficult, because git-blame will show this commit as the last
change for these lines. My counter counter argument is: when
git-blaming, you often need to do "blame the file at the parent commit"
anyway, to go past some other refactor that touched the line you are
interested in, but is not the change you are looking for. So you
already need a somewhat efficient way to do this.
Using some interactive tool, rather than plain git-blame, makes this
trivial. For example, I use "tig blame <file>", where going back past
the commit that changed the currently selected line is one keystroke.
It looks like Magit in Emacs does it too (though I've never used it).
Web viewers of Github and Gitlab do it too. My point is that it won't
really make archeology more difficult.
The other typical counter argument is that it will cause conflicts with
existing patches. That's true... but it's a one time cost, and those
are not conflicts that are difficult to resolve. I have also tried "git
rebase --ignore-whitespace", it seems to work well. Although that will
re-introduce the faulty indentation, so one needs to take care of fixing
the indentation in the patch after that (which is easy).
gdb/ChangeLog:
* aarch64-linux-tdep.c: Fix indentation.
* aarch64-ravenscar-thread.c: Fix indentation.
* aarch64-tdep.c: Fix indentation.
* aarch64-tdep.h: Fix indentation.
* ada-lang.c: Fix indentation.
* ada-lang.h: Fix indentation.
* ada-tasks.c: Fix indentation.
* ada-typeprint.c: Fix indentation.
* ada-valprint.c: Fix indentation.
* ada-varobj.c: Fix indentation.
* addrmap.c: Fix indentation.
* addrmap.h: Fix indentation.
* agent.c: Fix indentation.
* aix-thread.c: Fix indentation.
* alpha-bsd-nat.c: Fix indentation.
* alpha-linux-tdep.c: Fix indentation.
* alpha-mdebug-tdep.c: Fix indentation.
* alpha-nbsd-tdep.c: Fix indentation.
* alpha-obsd-tdep.c: Fix indentation.
* alpha-tdep.c: Fix indentation.
* amd64-bsd-nat.c: Fix indentation.
* amd64-darwin-tdep.c: Fix indentation.
* amd64-linux-nat.c: Fix indentation.
* amd64-linux-tdep.c: Fix indentation.
* amd64-nat.c: Fix indentation.
* amd64-obsd-tdep.c: Fix indentation.
* amd64-tdep.c: Fix indentation.
* amd64-windows-tdep.c: Fix indentation.
* annotate.c: Fix indentation.
* arc-tdep.c: Fix indentation.
* arch-utils.c: Fix indentation.
* arch/arm-get-next-pcs.c: Fix indentation.
* arch/arm.c: Fix indentation.
* arm-linux-nat.c: Fix indentation.
* arm-linux-tdep.c: Fix indentation.
* arm-nbsd-tdep.c: Fix indentation.
* arm-pikeos-tdep.c: Fix indentation.
* arm-tdep.c: Fix indentation.
* arm-tdep.h: Fix indentation.
* arm-wince-tdep.c: Fix indentation.
* auto-load.c: Fix indentation.
* auxv.c: Fix indentation.
* avr-tdep.c: Fix indentation.
* ax-gdb.c: Fix indentation.
* ax-general.c: Fix indentation.
* bfin-linux-tdep.c: Fix indentation.
* block.c: Fix indentation.
* block.h: Fix indentation.
* blockframe.c: Fix indentation.
* bpf-tdep.c: Fix indentation.
* break-catch-sig.c: Fix indentation.
* break-catch-syscall.c: Fix indentation.
* break-catch-throw.c: Fix indentation.
* breakpoint.c: Fix indentation.
* breakpoint.h: Fix indentation.
* bsd-uthread.c: Fix indentation.
* btrace.c: Fix indentation.
* build-id.c: Fix indentation.
* buildsym-legacy.h: Fix indentation.
* buildsym.c: Fix indentation.
* c-typeprint.c: Fix indentation.
* c-valprint.c: Fix indentation.
* c-varobj.c: Fix indentation.
* charset.c: Fix indentation.
* cli/cli-cmds.c: Fix indentation.
* cli/cli-decode.c: Fix indentation.
* cli/cli-decode.h: Fix indentation.
* cli/cli-script.c: Fix indentation.
* cli/cli-setshow.c: Fix indentation.
* coff-pe-read.c: Fix indentation.
* coffread.c: Fix indentation.
* compile/compile-cplus-types.c: Fix indentation.
* compile/compile-object-load.c: Fix indentation.
* compile/compile-object-run.c: Fix indentation.
* completer.c: Fix indentation.
* corefile.c: Fix indentation.
* corelow.c: Fix indentation.
* cp-abi.h: Fix indentation.
* cp-namespace.c: Fix indentation.
* cp-support.c: Fix indentation.
* cp-valprint.c: Fix indentation.
* cris-linux-tdep.c: Fix indentation.
* cris-tdep.c: Fix indentation.
* darwin-nat-info.c: Fix indentation.
* darwin-nat.c: Fix indentation.
* darwin-nat.h: Fix indentation.
* dbxread.c: Fix indentation.
* dcache.c: Fix indentation.
* disasm.c: Fix indentation.
* dtrace-probe.c: Fix indentation.
* dwarf2/abbrev.c: Fix indentation.
* dwarf2/attribute.c: Fix indentation.
* dwarf2/expr.c: Fix indentation.
* dwarf2/frame.c: Fix indentation.
* dwarf2/index-cache.c: Fix indentation.
* dwarf2/index-write.c: Fix indentation.
* dwarf2/line-header.c: Fix indentation.
* dwarf2/loc.c: Fix indentation.
* dwarf2/macro.c: Fix indentation.
* dwarf2/read.c: Fix indentation.
* dwarf2/read.h: Fix indentation.
* elfread.c: Fix indentation.
* eval.c: Fix indentation.
* event-top.c: Fix indentation.
* exec.c: Fix indentation.
* exec.h: Fix indentation.
* expprint.c: Fix indentation.
* f-lang.c: Fix indentation.
* f-typeprint.c: Fix indentation.
* f-valprint.c: Fix indentation.
* fbsd-nat.c: Fix indentation.
* fbsd-tdep.c: Fix indentation.
* findvar.c: Fix indentation.
* fork-child.c: Fix indentation.
* frame-unwind.c: Fix indentation.
* frame-unwind.h: Fix indentation.
* frame.c: Fix indentation.
* frv-linux-tdep.c: Fix indentation.
* frv-tdep.c: Fix indentation.
* frv-tdep.h: Fix indentation.
* ft32-tdep.c: Fix indentation.
* gcore.c: Fix indentation.
* gdb_bfd.c: Fix indentation.
* gdbarch.sh: Fix indentation.
* gdbarch.c: Re-generate
* gdbarch.h: Re-generate.
* gdbcore.h: Fix indentation.
* gdbthread.h: Fix indentation.
* gdbtypes.c: Fix indentation.
* gdbtypes.h: Fix indentation.
* glibc-tdep.c: Fix indentation.
* gnu-nat.c: Fix indentation.
* gnu-nat.h: Fix indentation.
* gnu-v2-abi.c: Fix indentation.
* gnu-v3-abi.c: Fix indentation.
* go32-nat.c: Fix indentation.
* guile/guile-internal.h: Fix indentation.
* guile/scm-cmd.c: Fix indentation.
* guile/scm-frame.c: Fix indentation.
* guile/scm-iterator.c: Fix indentation.
* guile/scm-math.c: Fix indentation.
* guile/scm-ports.c: Fix indentation.
* guile/scm-pretty-print.c: Fix indentation.
* guile/scm-value.c: Fix indentation.
* h8300-tdep.c: Fix indentation.
* hppa-linux-nat.c: Fix indentation.
* hppa-linux-tdep.c: Fix indentation.
* hppa-nbsd-nat.c: Fix indentation.
* hppa-nbsd-tdep.c: Fix indentation.
* hppa-obsd-nat.c: Fix indentation.
* hppa-tdep.c: Fix indentation.
* hppa-tdep.h: Fix indentation.
* i386-bsd-nat.c: Fix indentation.
* i386-darwin-nat.c: Fix indentation.
* i386-darwin-tdep.c: Fix indentation.
* i386-dicos-tdep.c: Fix indentation.
* i386-gnu-nat.c: Fix indentation.
* i386-linux-nat.c: Fix indentation.
* i386-linux-tdep.c: Fix indentation.
* i386-nto-tdep.c: Fix indentation.
* i386-obsd-tdep.c: Fix indentation.
* i386-sol2-nat.c: Fix indentation.
* i386-tdep.c: Fix indentation.
* i386-tdep.h: Fix indentation.
* i386-windows-tdep.c: Fix indentation.
* i387-tdep.c: Fix indentation.
* i387-tdep.h: Fix indentation.
* ia64-libunwind-tdep.c: Fix indentation.
* ia64-libunwind-tdep.h: Fix indentation.
* ia64-linux-nat.c: Fix indentation.
* ia64-linux-tdep.c: Fix indentation.
* ia64-tdep.c: Fix indentation.
* ia64-tdep.h: Fix indentation.
* ia64-vms-tdep.c: Fix indentation.
* infcall.c: Fix indentation.
* infcmd.c: Fix indentation.
* inferior.c: Fix indentation.
* infrun.c: Fix indentation.
* iq2000-tdep.c: Fix indentation.
* language.c: Fix indentation.
* linespec.c: Fix indentation.
* linux-fork.c: Fix indentation.
* linux-nat.c: Fix indentation.
* linux-tdep.c: Fix indentation.
* linux-thread-db.c: Fix indentation.
* lm32-tdep.c: Fix indentation.
* m2-lang.c: Fix indentation.
* m2-typeprint.c: Fix indentation.
* m2-valprint.c: Fix indentation.
* m32c-tdep.c: Fix indentation.
* m32r-linux-tdep.c: Fix indentation.
* m32r-tdep.c: Fix indentation.
* m68hc11-tdep.c: Fix indentation.
* m68k-bsd-nat.c: Fix indentation.
* m68k-linux-nat.c: Fix indentation.
* m68k-linux-tdep.c: Fix indentation.
* m68k-tdep.c: Fix indentation.
* machoread.c: Fix indentation.
* macrocmd.c: Fix indentation.
* macroexp.c: Fix indentation.
* macroscope.c: Fix indentation.
* macrotab.c: Fix indentation.
* macrotab.h: Fix indentation.
* main.c: Fix indentation.
* mdebugread.c: Fix indentation.
* mep-tdep.c: Fix indentation.
* mi/mi-cmd-catch.c: Fix indentation.
* mi/mi-cmd-disas.c: Fix indentation.
* mi/mi-cmd-env.c: Fix indentation.
* mi/mi-cmd-stack.c: Fix indentation.
* mi/mi-cmd-var.c: Fix indentation.
* mi/mi-cmds.c: Fix indentation.
* mi/mi-main.c: Fix indentation.
* mi/mi-parse.c: Fix indentation.
* microblaze-tdep.c: Fix indentation.
* minidebug.c: Fix indentation.
* minsyms.c: Fix indentation.
* mips-linux-nat.c: Fix indentation.
* mips-linux-tdep.c: Fix indentation.
* mips-nbsd-tdep.c: Fix indentation.
* mips-tdep.c: Fix indentation.
* mn10300-linux-tdep.c: Fix indentation.
* mn10300-tdep.c: Fix indentation.
* moxie-tdep.c: Fix indentation.
* msp430-tdep.c: Fix indentation.
* namespace.h: Fix indentation.
* nat/fork-inferior.c: Fix indentation.
* nat/gdb_ptrace.h: Fix indentation.
* nat/linux-namespaces.c: Fix indentation.
* nat/linux-osdata.c: Fix indentation.
* nat/netbsd-nat.c: Fix indentation.
* nat/x86-dregs.c: Fix indentation.
* nbsd-nat.c: Fix indentation.
* nbsd-tdep.c: Fix indentation.
* nios2-linux-tdep.c: Fix indentation.
* nios2-tdep.c: Fix indentation.
* nto-procfs.c: Fix indentation.
* nto-tdep.c: Fix indentation.
* objfiles.c: Fix indentation.
* objfiles.h: Fix indentation.
* opencl-lang.c: Fix indentation.
* or1k-tdep.c: Fix indentation.
* osabi.c: Fix indentation.
* osabi.h: Fix indentation.
* osdata.c: Fix indentation.
* p-lang.c: Fix indentation.
* p-typeprint.c: Fix indentation.
* p-valprint.c: Fix indentation.
* parse.c: Fix indentation.
* ppc-linux-nat.c: Fix indentation.
* ppc-linux-tdep.c: Fix indentation.
* ppc-nbsd-nat.c: Fix indentation.
* ppc-nbsd-tdep.c: Fix indentation.
* ppc-obsd-nat.c: Fix indentation.
* ppc-ravenscar-thread.c: Fix indentation.
* ppc-sysv-tdep.c: Fix indentation.
* ppc64-tdep.c: Fix indentation.
* printcmd.c: Fix indentation.
* proc-api.c: Fix indentation.
* producer.c: Fix indentation.
* producer.h: Fix indentation.
* prologue-value.c: Fix indentation.
* prologue-value.h: Fix indentation.
* psymtab.c: Fix indentation.
* python/py-arch.c: Fix indentation.
* python/py-bpevent.c: Fix indentation.
* python/py-event.c: Fix indentation.
* python/py-event.h: Fix indentation.
* python/py-finishbreakpoint.c: Fix indentation.
* python/py-frame.c: Fix indentation.
* python/py-framefilter.c: Fix indentation.
* python/py-inferior.c: Fix indentation.
* python/py-infthread.c: Fix indentation.
* python/py-objfile.c: Fix indentation.
* python/py-prettyprint.c: Fix indentation.
* python/py-registers.c: Fix indentation.
* python/py-signalevent.c: Fix indentation.
* python/py-stopevent.c: Fix indentation.
* python/py-stopevent.h: Fix indentation.
* python/py-threadevent.c: Fix indentation.
* python/py-tui.c: Fix indentation.
* python/py-unwind.c: Fix indentation.
* python/py-value.c: Fix indentation.
* python/py-xmethods.c: Fix indentation.
* python/python-internal.h: Fix indentation.
* python/python.c: Fix indentation.
* ravenscar-thread.c: Fix indentation.
* record-btrace.c: Fix indentation.
* record-full.c: Fix indentation.
* record.c: Fix indentation.
* reggroups.c: Fix indentation.
* regset.h: Fix indentation.
* remote-fileio.c: Fix indentation.
* remote.c: Fix indentation.
* reverse.c: Fix indentation.
* riscv-linux-tdep.c: Fix indentation.
* riscv-ravenscar-thread.c: Fix indentation.
* riscv-tdep.c: Fix indentation.
* rl78-tdep.c: Fix indentation.
* rs6000-aix-tdep.c: Fix indentation.
* rs6000-lynx178-tdep.c: Fix indentation.
* rs6000-nat.c: Fix indentation.
* rs6000-tdep.c: Fix indentation.
* rust-lang.c: Fix indentation.
* rx-tdep.c: Fix indentation.
* s12z-tdep.c: Fix indentation.
* s390-linux-tdep.c: Fix indentation.
* score-tdep.c: Fix indentation.
* ser-base.c: Fix indentation.
* ser-mingw.c: Fix indentation.
* ser-uds.c: Fix indentation.
* ser-unix.c: Fix indentation.
* serial.c: Fix indentation.
* sh-linux-tdep.c: Fix indentation.
* sh-nbsd-tdep.c: Fix indentation.
* sh-tdep.c: Fix indentation.
* skip.c: Fix indentation.
* sol-thread.c: Fix indentation.
* solib-aix.c: Fix indentation.
* solib-darwin.c: Fix indentation.
* solib-frv.c: Fix indentation.
* solib-svr4.c: Fix indentation.
* solib.c: Fix indentation.
* source.c: Fix indentation.
* sparc-linux-tdep.c: Fix indentation.
* sparc-nbsd-tdep.c: Fix indentation.
* sparc-obsd-tdep.c: Fix indentation.
* sparc-ravenscar-thread.c: Fix indentation.
* sparc-tdep.c: Fix indentation.
* sparc64-linux-tdep.c: Fix indentation.
* sparc64-nbsd-tdep.c: Fix indentation.
* sparc64-obsd-tdep.c: Fix indentation.
* sparc64-tdep.c: Fix indentation.
* stabsread.c: Fix indentation.
* stack.c: Fix indentation.
* stap-probe.c: Fix indentation.
* stubs/ia64vms-stub.c: Fix indentation.
* stubs/m32r-stub.c: Fix indentation.
* stubs/m68k-stub.c: Fix indentation.
* stubs/sh-stub.c: Fix indentation.
* stubs/sparc-stub.c: Fix indentation.
* symfile-mem.c: Fix indentation.
* symfile.c: Fix indentation.
* symfile.h: Fix indentation.
* symmisc.c: Fix indentation.
* symtab.c: Fix indentation.
* symtab.h: Fix indentation.
* target-float.c: Fix indentation.
* target.c: Fix indentation.
* target.h: Fix indentation.
* tic6x-tdep.c: Fix indentation.
* tilegx-linux-tdep.c: Fix indentation.
* tilegx-tdep.c: Fix indentation.
* top.c: Fix indentation.
* tracefile-tfile.c: Fix indentation.
* tracepoint.c: Fix indentation.
* tui/tui-disasm.c: Fix indentation.
* tui/tui-io.c: Fix indentation.
* tui/tui-regs.c: Fix indentation.
* tui/tui-stack.c: Fix indentation.
* tui/tui-win.c: Fix indentation.
* tui/tui-winsource.c: Fix indentation.
* tui/tui.c: Fix indentation.
* typeprint.c: Fix indentation.
* ui-out.h: Fix indentation.
* unittests/copy_bitwise-selftests.c: Fix indentation.
* unittests/memory-map-selftests.c: Fix indentation.
* utils.c: Fix indentation.
* v850-tdep.c: Fix indentation.
* valarith.c: Fix indentation.
* valops.c: Fix indentation.
* valprint.c: Fix indentation.
* valprint.h: Fix indentation.
* value.c: Fix indentation.
* value.h: Fix indentation.
* varobj.c: Fix indentation.
* vax-tdep.c: Fix indentation.
* windows-nat.c: Fix indentation.
* windows-tdep.c: Fix indentation.
* xcoffread.c: Fix indentation.
* xml-syscall.c: Fix indentation.
* xml-tdesc.c: Fix indentation.
* xstormy16-tdep.c: Fix indentation.
* xtensa-config.c: Fix indentation.
* xtensa-linux-nat.c: Fix indentation.
* xtensa-linux-tdep.c: Fix indentation.
* xtensa-tdep.c: Fix indentation.
gdbserver/ChangeLog:
* ax.cc: Fix indentation.
* dll.cc: Fix indentation.
* inferiors.h: Fix indentation.
* linux-low.cc: Fix indentation.
* linux-nios2-low.cc: Fix indentation.
* linux-ppc-ipa.cc: Fix indentation.
* linux-ppc-low.cc: Fix indentation.
* linux-x86-low.cc: Fix indentation.
* linux-xtensa-low.cc: Fix indentation.
* regcache.cc: Fix indentation.
* server.cc: Fix indentation.
* tracepoint.cc: Fix indentation.
gdbsupport/ChangeLog:
* common-exceptions.h: Fix indentation.
* event-loop.cc: Fix indentation.
* fileio.cc: Fix indentation.
* filestuff.cc: Fix indentation.
* gdb-dlfcn.cc: Fix indentation.
* gdb_string_view.h: Fix indentation.
* job-control.cc: Fix indentation.
* signals.cc: Fix indentation.
Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-11-02 10:26:14 -05:00
|
|
|
|
ordinal * 4);
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2010-12-31 22:59:52 +00:00
|
|
|
|
/* Find this symbol's section in our own array. */
|
2003-02-20 03:12:46 +00:00
|
|
|
|
int sectix = 0;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
int section_found = 0;
|
|
|
|
|
|
|
|
|
|
/* First handle forward cases. */
|
|
|
|
|
if (func_rva >= export_rva && func_rva < export_rva + export_size)
|
|
|
|
|
{
|
2022-04-19 07:41:44 -06:00
|
|
|
|
const char *forward_name = (const char *) (erva + func_rva);
|
|
|
|
|
const char *funcname = (const char *) (erva + name_rva);
|
|
|
|
|
const char *forward_dll_name = forward_name;
|
|
|
|
|
const char *forward_func_name = forward_name;
|
|
|
|
|
const char *sep = strrchr (forward_name, '.');
|
|
|
|
|
|
|
|
|
|
std::string name_storage;
|
|
|
|
|
if (sep != nullptr)
|
2012-12-13 10:44:45 +00:00
|
|
|
|
{
|
|
|
|
|
int len = (int) (sep - forward_name);
|
2003-02-20 03:12:46 +00:00
|
|
|
|
|
2022-04-19 07:41:44 -06:00
|
|
|
|
name_storage = std::string (forward_name, len);
|
|
|
|
|
forward_dll_name = name_storage.c_str ();
|
|
|
|
|
forward_func_name = sep + 1;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
}
|
Record minimal symbols directly in reader.
This patch changes minimal symbol creation in two ways. First, it
removes global variables in favor of members of minimal_symbol_reader.
Second, it changes functions like prim_record_minimal_symbol to be
member functions of minimal_symbol_reader.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add
"reader" argument. Update.
(xcoff_initial_scan): Update.
* symfile.h (mdebug_build_psymtabs): Add "reader" argument.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Add "reader" argument. Update.
* minsyms.h (minimal_symbol_reader) <record, record_full>:
Declare.
<m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members.
<record_with_info>: New function, renamed from
prim_record_minimal_symbol_and_info.
* minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove
globals.
(minimal_symbol_reader): Initialize new members.
(minimal_symbol_reader::record): Renamed from
prim_record_minimal_symbol.
(minimal_symbol_reader::record_full): Renamed from
prim_record_minimal_symbol_full.
(prim_record_minimal_symbol_and_info): Move to minsyms.h; rename.
* mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols)
(record_minimal_symbol): Add "reader" argument. Update.
(elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add
"reader" argument. Update.
(macho_symfile_read): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read): Add "reader" argument. Update.
(elf_read_minimal_symbols): Update.
* dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab)
(read_dbx_symtab): Add "reader" argument. Update.
(dbx_symfile_read): Update.
* coffread.c (record_minimal_symbol, coff_symtab_read): Add
"reader" argument. Update.
(coff_symfile_read): Update.
* coff-pe-read.h (read_pe_exported_syms): Add "reader" argument.
* coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym)
(read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 14:25:08 -06:00
|
|
|
|
if (add_pe_forwarded_sym (reader, funcname, forward_dll_name,
|
2012-12-13 10:44:45 +00:00
|
|
|
|
forward_func_name, ordinal,
|
|
|
|
|
dll_name, objfile) != 0)
|
|
|
|
|
++nbforward;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (sectix = 0; sectix < otherix; ++sectix)
|
2003-02-20 03:12:46 +00:00
|
|
|
|
{
|
|
|
|
|
if ((func_rva >= section_data[sectix].rva_start)
|
|
|
|
|
&& (func_rva < section_data[sectix].rva_end))
|
|
|
|
|
{
|
2022-04-19 07:41:44 -06:00
|
|
|
|
const char *sym_name = (const char *) (erva + name_rva);
|
2013-04-19 15:33:29 +00:00
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
section_found = 1;
|
Record minimal symbols directly in reader.
This patch changes minimal symbol creation in two ways. First, it
removes global variables in favor of members of minimal_symbol_reader.
Second, it changes functions like prim_record_minimal_symbol to be
member functions of minimal_symbol_reader.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add
"reader" argument. Update.
(xcoff_initial_scan): Update.
* symfile.h (mdebug_build_psymtabs): Add "reader" argument.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Add "reader" argument. Update.
* minsyms.h (minimal_symbol_reader) <record, record_full>:
Declare.
<m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members.
<record_with_info>: New function, renamed from
prim_record_minimal_symbol_and_info.
* minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove
globals.
(minimal_symbol_reader): Initialize new members.
(minimal_symbol_reader::record): Renamed from
prim_record_minimal_symbol.
(minimal_symbol_reader::record_full): Renamed from
prim_record_minimal_symbol_full.
(prim_record_minimal_symbol_and_info): Move to minsyms.h; rename.
* mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols)
(record_minimal_symbol): Add "reader" argument. Update.
(elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add
"reader" argument. Update.
(macho_symfile_read): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read): Add "reader" argument. Update.
(elf_read_minimal_symbols): Update.
* dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab)
(read_dbx_symtab): Add "reader" argument. Update.
(dbx_symfile_read): Update.
* coffread.c (record_minimal_symbol, coff_symtab_read): Add
"reader" argument. Update.
(coff_symfile_read): Update.
* coff-pe-read.h (read_pe_exported_syms): Add "reader" argument.
* coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym)
(read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 14:25:08 -06:00
|
|
|
|
add_pe_exported_sym (reader, sym_name, func_rva, ordinal,
|
2018-05-24 22:32:24 -06:00
|
|
|
|
§ion_data[sectix], dll_name, objfile);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
++nbnormal;
|
2003-02-20 03:12:46 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if (!section_found)
|
|
|
|
|
{
|
2022-04-19 07:41:44 -06:00
|
|
|
|
const char *funcname = (const char *) (erva + name_rva);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
|
|
|
|
if (name_rva == 0)
|
|
|
|
|
{
|
Record minimal symbols directly in reader.
This patch changes minimal symbol creation in two ways. First, it
removes global variables in favor of members of minimal_symbol_reader.
Second, it changes functions like prim_record_minimal_symbol to be
member functions of minimal_symbol_reader.
2016-10-21 Tom Tromey <tom@tromey.com>
* xcoffread.c (record_minimal_symbol, scan_xcoff_symtab): Add
"reader" argument. Update.
(xcoff_initial_scan): Update.
* symfile.h (mdebug_build_psymtabs): Add "reader" argument.
* mipsread.c (mipscoff_symfile_read): Update.
(read_alphacoff_dynamic_symtab): Add "reader" argument. Update.
* minsyms.h (minimal_symbol_reader) <record, record_full>:
Declare.
<m_msym_bunch, m_msym_bunch_index, m_msym_count>: New members.
<record_with_info>: New function, renamed from
prim_record_minimal_symbol_and_info.
* minsyms.c (msym_bunch, msym_bunch_index, msym_count): Remove
globals.
(minimal_symbol_reader): Initialize new members.
(minimal_symbol_reader::record): Renamed from
prim_record_minimal_symbol.
(minimal_symbol_reader::record_full): Renamed from
prim_record_minimal_symbol_full.
(prim_record_minimal_symbol_and_info): Move to minsyms.h; rename.
* mdebugread.c (mdebug_build_psymtabs, parse_partial_symbols)
(record_minimal_symbol): Add "reader" argument. Update.
(elfmdebug_build_psymtabs): Update.
* machoread.c (macho_symtab_add_minsym, macho_symtab_read): Add
"reader" argument. Update.
(macho_symfile_read): Update.
* elfread.c (record_minimal_symbol, elf_symtab_read)
(elf_rel_plt_read): Add "reader" argument. Update.
(elf_read_minimal_symbols): Update.
* dbxread.c (record_minimal_symbol, read_dbx_dynamic_symtab)
(read_dbx_symtab): Add "reader" argument. Update.
(dbx_symfile_read): Update.
* coffread.c (record_minimal_symbol, coff_symtab_read): Add
"reader" argument. Update.
(coff_symfile_read): Update.
* coff-pe-read.h (read_pe_exported_syms): Add "reader" argument.
* coff-pe-read.c (add_pe_exported_sym, add_pe_forwarded_sym)
(read_pe_exported_syms): Add "reader" argument. Update.
2016-09-22 14:25:08 -06:00
|
|
|
|
add_pe_exported_sym (reader, NULL, func_rva, ordinal,
|
2018-05-24 22:32:24 -06:00
|
|
|
|
§ion_data[0], dll_name, objfile);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
++nbnormal;
|
|
|
|
|
}
|
|
|
|
|
else if (debug_coff_pe_read)
|
2022-01-02 11:46:15 -07:00
|
|
|
|
gdb_printf (gdb_stdlog, _("Export name \"%s\" ord. %lu,"
|
|
|
|
|
" RVA 0x%lx in dll \"%s\" not handled\n"),
|
|
|
|
|
funcname, ordinal, func_rva, dll_name);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
}
|
2003-02-20 03:12:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if (debug_coff_pe_read)
|
2022-01-02 11:46:15 -07:00
|
|
|
|
gdb_printf (gdb_stdlog, _("Finished reading \"%s\", exports %ld,"
|
|
|
|
|
" forwards %ld, total %ld/%ld.\n"), dll_name, nbnormal,
|
|
|
|
|
nbforward, nbnormal + nbforward, nexp);
|
2003-02-20 03:12:46 +00:00
|
|
|
|
}
|
2012-12-13 10:44:45 +00:00
|
|
|
|
|
|
|
|
|
/* Extract from ABFD the offset of the .text section.
|
|
|
|
|
This offset is mainly related to the offset within the file.
|
|
|
|
|
The value was previously expected to be 0x1000 for all files,
|
2019-10-26 09:55:32 +02:00
|
|
|
|
but some Windows OS core DLLs seem to use 0x10000 section alignment
|
2012-12-13 10:44:45 +00:00
|
|
|
|
which modified the return value of that function.
|
|
|
|
|
Still return default 0x1000 value if ABFD is NULL or
|
|
|
|
|
if '.text' section is not found, but that should not happen... */
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_COFF_PE_TEXT_SECTION_OFFSET 0x1000
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
pe_text_section_offset (struct bfd *abfd)
|
|
|
|
|
|
|
|
|
|
{
|
Fix coff-pe-read.c to compile with Wunused.
* coff-pe-read.c (add_pe_exported_sym): Remove unused 'dll_name_len'.
(add_pe_forwarded_sym): Remove unused 'section', 'dll_name_len'.
(read_pe_exported_syms): Remove unused 'exportix'.
(pe_text_section_offset): Remove unused 'opthdr_ofs', 'num_entries',
'export_rva', 'export_size', 'expptr', 'exp_funcbase', 'expdata',
'erva', 'name_rvas', 'ordinals', 'nexp', 'ordbase', 'dll_name'.
Reference: http://sourceware.org/ml/gdb-patches/2013-03/msg01081.html
2013-04-01 12:53:01 +00:00
|
|
|
|
unsigned long pe_header_offset, i;
|
|
|
|
|
unsigned long nsections, secptr;
|
2012-12-13 10:44:45 +00:00
|
|
|
|
int is_pe64 = 0;
|
|
|
|
|
int is_pe32 = 0;
|
|
|
|
|
char const *target;
|
|
|
|
|
|
|
|
|
|
if (!abfd)
|
|
|
|
|
return DEFAULT_COFF_PE_TEXT_SECTION_OFFSET;
|
|
|
|
|
|
|
|
|
|
target = bfd_get_target (abfd);
|
|
|
|
|
|
|
|
|
|
is_pe64 = (strcmp (target, "pe-x86-64") == 0
|
|
|
|
|
|| strcmp (target, "pei-x86-64") == 0);
|
|
|
|
|
is_pe32 = (strcmp (target, "pe-i386") == 0
|
|
|
|
|
|| strcmp (target, "pei-i386") == 0
|
|
|
|
|
|| strcmp (target, "pe-arm-wince-little") == 0
|
|
|
|
|
|| strcmp (target, "pei-arm-wince-little") == 0);
|
|
|
|
|
|
|
|
|
|
if (!is_pe32 && !is_pe64)
|
|
|
|
|
{
|
|
|
|
|
/* This is not a recognized PE format file. Abort now, because
|
|
|
|
|
the code is untested on anything else. *FIXME* test on
|
|
|
|
|
further architectures and loosen or remove this test. */
|
|
|
|
|
return DEFAULT_COFF_PE_TEXT_SECTION_OFFSET;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get pe_header, optional header and numbers of sections. */
|
|
|
|
|
pe_header_offset = pe_get32 (abfd, 0x3c);
|
|
|
|
|
nsections = pe_get16 (abfd, pe_header_offset + 4 + 2);
|
|
|
|
|
secptr = (pe_header_offset + 4 + 20 +
|
|
|
|
|
pe_get16 (abfd, pe_header_offset + 4 + 16));
|
|
|
|
|
|
|
|
|
|
/* Get the rva and size of the export section. */
|
|
|
|
|
for (i = 0; i < nsections; i++)
|
|
|
|
|
{
|
2012-12-13 17:08:07 +00:00
|
|
|
|
char sname[SCNNMLEN + 1];
|
2012-12-13 10:44:45 +00:00
|
|
|
|
unsigned long secptr1 = secptr + 40 * i;
|
|
|
|
|
unsigned long vaddr = pe_get32 (abfd, secptr1 + 12);
|
|
|
|
|
|
|
|
|
|
bfd_seek (abfd, (file_ptr) secptr1, SEEK_SET);
|
2012-12-13 17:08:07 +00:00
|
|
|
|
bfd_bread (sname, (bfd_size_type) SCNNMLEN, abfd);
|
|
|
|
|
sname[SCNNMLEN] = '\0';
|
2012-12-13 10:44:45 +00:00
|
|
|
|
if (strcmp (sname, ".text") == 0)
|
|
|
|
|
return vaddr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DEFAULT_COFF_PE_TEXT_SECTION_OFFSET;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Implements "show debug coff_pe_read" command. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
show_debug_coff_pe_read (struct ui_file *file, int from_tty,
|
|
|
|
|
struct cmd_list_element *c, const char *value)
|
|
|
|
|
{
|
2022-01-02 11:46:15 -07:00
|
|
|
|
gdb_printf (file, _("Coff PE read debugging is %s.\n"), value);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Adds "Set/show debug coff_pe_read" commands. */
|
|
|
|
|
|
2020-01-13 14:01:38 -05:00
|
|
|
|
void _initialize_coff_pe_read ();
|
2012-12-13 10:44:45 +00:00
|
|
|
|
void
|
2020-01-13 14:01:38 -05:00
|
|
|
|
_initialize_coff_pe_read ()
|
2012-12-13 10:44:45 +00:00
|
|
|
|
{
|
2013-03-27 09:47:41 +00:00
|
|
|
|
add_setshow_zuinteger_cmd ("coff-pe-read", class_maintenance,
|
2013-03-26 18:40:46 +00:00
|
|
|
|
&debug_coff_pe_read,
|
|
|
|
|
_("Set coff PE read debugging."),
|
|
|
|
|
_("Show coff PE read debugging."),
|
|
|
|
|
_("When set, debugging messages for coff reading "
|
|
|
|
|
"of exported symbols are displayed."),
|
|
|
|
|
NULL, show_debug_coff_pe_read,
|
|
|
|
|
&setdebuglist, &showdebuglist);
|
2012-12-13 10:44:45 +00:00
|
|
|
|
}
|