Files
bfd
binutils
config
cpu
elfcpp
etc
gas
gdb
cli
common
config
data-directory
doc
features
gdbserver
gnulib
mi
osf-share
po
python
regformats
syscalls
testsuite
tui
.gitignore
CONTRIBUTE
COPYING
ChangeLog
ChangeLog-1990
ChangeLog-1991
ChangeLog-1992
ChangeLog-1993
ChangeLog-1994
ChangeLog-1995
ChangeLog-1996
ChangeLog-1997
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-3.x
MAINTAINERS
Makefile.in
NEWS
PROBLEMS
README
acinclude.m4
aclocal.m4
ada-exp.y
ada-lang.c
ada-lang.h
ada-lex.l
ada-operator.def
ada-tasks.c
ada-typeprint.c
ada-valprint.c
addrmap.c
addrmap.h
aix-thread.c
alpha-linux-nat.c
alpha-linux-tdep.c
alpha-mdebug-tdep.c
alpha-nat.c
alpha-osf1-tdep.c
alpha-tdep.c
alpha-tdep.h
alphabsd-nat.c
alphabsd-tdep.c
alphabsd-tdep.h
alphafbsd-tdep.c
alphanbsd-tdep.c
alphaobsd-tdep.c
amd64-darwin-tdep.c
amd64-darwin-tdep.h
amd64-dicos-tdep.c
amd64-linux-nat.c
amd64-linux-tdep.c
amd64-linux-tdep.h
amd64-nat.c
amd64-nat.h
amd64-sol2-tdep.c
amd64-tdep.c
amd64-tdep.h
amd64-windows-nat.c
amd64-windows-tdep.c
amd64bsd-nat.c
amd64fbsd-nat.c
amd64fbsd-tdep.c
amd64nbsd-nat.c
amd64nbsd-tdep.c
amd64obsd-nat.c
amd64obsd-tdep.c
annotate.c
annotate.h
arch-utils.c
arch-utils.h
arm-linux-nat.c
arm-linux-tdep.c
arm-linux-tdep.h
arm-symbian-tdep.c
arm-tdep.c
arm-tdep.h
arm-wince-tdep.c
armbsd-tdep.c
armnbsd-nat.c
armnbsd-tdep.c
armobsd-tdep.c
auxv.c
auxv.h
avr-tdep.c
ax-gdb.c
ax-gdb.h
ax-general.c
ax.h
bcache.c
bcache.h
bfd-target.c
bfd-target.h
bfin-linux-tdep.c
bfin-tdep.c
bfin-tdep.h
block.c
block.h
blockframe.c
breakpoint.c
breakpoint.h
bsd-kvm.c
bsd-kvm.h
bsd-uthread.c
bsd-uthread.h
buildsym.c
buildsym.h
c-exp.y
c-lang.c
c-lang.h
c-typeprint.c
c-valprint.c
call-cmds.h
cc-with-index.sh
charset-list.h
charset.c
charset.h
cli-out.c
cli-out.h
coff-pe-read.c
coff-pe-read.h
coffread.c
command.h
complaints.c
complaints.h
completer.c
completer.h
config.in
configure
configure.ac
configure.host
configure.tgt
copying.awk
copying.c
copyright.py
copyright.sh
core-regset.c
corefile.c
corelow.c
cp-abi.c
cp-abi.h
cp-name-parser.y
cp-namespace.c
cp-support.c
cp-support.h
cp-valprint.c
cris-tdep.c
d-lang.c
d-lang.h
d-valprint.c
darwin-nat-info.c
darwin-nat.c
darwin-nat.h
dbug-rom.c
dbxread.c
dcache.c
dcache.h
dec-thread.c
defs.h
demangle.c
dfp.c
dfp.h
dicos-tdep.c
dicos-tdep.h
dictionary.c
dictionary.h
dink32-rom.c
disasm.c
disasm.h
doublest.c
doublest.h
dsrec.c
dummy-frame.c
dummy-frame.h
dwarf2-frame.c
dwarf2-frame.h
dwarf2expr.c
dwarf2expr.h
dwarf2loc.c
dwarf2loc.h
dwarf2read.c
elfread.c
environ.c
environ.h
eval.c
event-loop.c
event-loop.h
event-top.c
event-top.h
exc_request.defs
exceptions.c
exceptions.h
exec.c
exec.h
expprint.c
expression.h
f-exp.y
f-lang.c
f-lang.h
f-typeprint.c
f-valprint.c
fbsd-nat.c
fbsd-nat.h
filesystem.c
filesystem.h
findcmd.c
findvar.c
fork-child.c
frame-base.c
frame-base.h
frame-unwind.c
frame-unwind.h
frame.c
frame.h
frv-linux-tdep.c
frv-tdep.c
frv-tdep.h
gcore.c
gcore.h
gdb-gdb.py
gdb-stabs.h
gdb.1
gdb.c
gdb.gdb
gdb.h
gdb_assert.h
gdb_buildall.sh
gdb_curses.h
gdb_dirent.h
gdb_expat.h
gdb_gcore.sh
gdb_indent.sh
gdb_locale.h
gdb_mbuild.sh
gdb_obstack.h
gdb_proc_service.h
gdb_ptrace.h
gdb_regex.h
gdb_select.h
gdb_stat.h
gdb_string.h
gdb_thread_db.h
gdb_usleep.c
gdb_usleep.h
gdb_vfork.h
gdb_wait.h
gdb_wchar.h
gdbarch.c
gdbarch.h
gdbarch.sh
gdbcmd.h
gdbcore.h
gdbinit.in
gdbthread.h
gdbtypes.c
gdbtypes.h
glibc-tdep.c
glibc-tdep.h
gnu-nat.c
gnu-nat.h
gnu-v2-abi.c
gnu-v3-abi.c
go32-nat.c
gregset.h
h8300-tdep.c
hppa-hpux-nat.c
hppa-hpux-tdep.c
hppa-linux-nat.c
hppa-linux-offsets.h
hppa-linux-tdep.c
hppa-tdep.c
hppa-tdep.h
hppabsd-nat.c
hppabsd-tdep.c
hppabsd-tdep.h
hppanbsd-nat.c
hppanbsd-tdep.c
hppaobsd-tdep.c
i386-cygwin-tdep.c
i386-darwin-nat.c
i386-darwin-tdep.c
i386-darwin-tdep.h
i386-dicos-tdep.c
i386-linux-nat.c
i386-linux-tdep.c
i386-linux-tdep.h
i386-nat.c
i386-nat.h
i386-nto-tdep.c
i386-sol2-nat.c
i386-sol2-tdep.c
i386-stub.c
i386-tdep.c
i386-tdep.h
i386-windows-nat.c
i386bsd-nat.c
i386bsd-nat.h
i386bsd-tdep.c
i386fbsd-nat.c
i386fbsd-tdep.c
i386gnu-nat.c
i386gnu-tdep.c
i386nbsd-nat.c
i386nbsd-tdep.c
i386obsd-nat.c
i386obsd-tdep.c
i386v4-nat.c
i387-tdep.c
i387-tdep.h
ia64-hpux-nat.c
ia64-hpux-tdep.c
ia64-hpux-tdep.h
ia64-linux-nat.c
ia64-linux-tdep.c
ia64-tdep.c
ia64-tdep.h
inf-child.c
inf-child.h
inf-loop.c
inf-loop.h
inf-ptrace.c
inf-ptrace.h
inf-ttrace.c
inf-ttrace.h
infcall.c
infcall.h
infcmd.c
inferior.c
inferior.h
inflow.c
inflow.h
infrun.c
inline-frame.c
inline-frame.h
interps.c
interps.h
iq2000-tdep.c
irix5-nat.c
jit.c
jit.h
jv-exp.y
jv-lang.c
jv-lang.h
jv-typeprint.c
jv-valprint.c
language.c
language.h
libunwind-frame.c
libunwind-frame.h
linespec.c
linespec.h
linux-fork.c
linux-fork.h
linux-nat.c
linux-nat.h
linux-record.c
linux-record.h
linux-tdep.c
linux-tdep.h
linux-thread-db.c
lm32-tdep.c
m2-exp.y
m2-lang.c
m2-lang.h
m2-typeprint.c
m2-valprint.c
m32c-tdep.c
m32r-linux-nat.c
m32r-linux-tdep.c
m32r-rom.c
m32r-stub.c
m32r-tdep.c
m32r-tdep.h
m68hc11-tdep.c
m68k-stub.c
m68k-tdep.c
m68k-tdep.h
m68kbsd-nat.c
m68kbsd-tdep.c
m68klinux-nat.c
m68klinux-tdep.c
m88k-tdep.c
m88k-tdep.h
m88kbsd-nat.c
machoread.c
macrocmd.c
macroexp.c
macroexp.h
macroscope.c
macroscope.h
macrotab.c
macrotab.h
main.c
main.h
maint.c
mdebugread.c
mdebugread.h
mem-break.c
memattr.c
memattr.h
memory-map.c
memory-map.h
memrange.c
memrange.h
mep-tdep.c
microblaze-linux-tdep.c
microblaze-rom.c
microblaze-tdep.c
microblaze-tdep.h
mingw-hdep.c
minsyms.c
mips-irix-tdep.c
mips-linux-nat.c
mips-linux-tdep.c
mips-linux-tdep.h
mips-tdep.c
mips-tdep.h
mips64obsd-nat.c
mips64obsd-tdep.c
mipsnbsd-nat.c
mipsnbsd-tdep.c
mipsnbsd-tdep.h
mipsread.c
mn10300-linux-tdep.c
mn10300-tdep.c
mn10300-tdep.h
monitor.c
monitor.h
moxie-tdep.c
moxie-tdep.h
msg.defs
msg_reply.defs
mt-tdep.c
nbsd-nat.c
nbsd-nat.h
nbsd-tdep.c
nbsd-tdep.h
notify.defs
nto-procfs.c
nto-tdep.c
nto-tdep.h
objc-exp.y
objc-lang.c
objc-lang.h
objfiles.c
objfiles.h
obsd-tdep.c
obsd-tdep.h
observer.c
observer.sh
opencl-lang.c
osabi.c
osabi.h
osdata.c
osdata.h
p-exp.y
p-lang.c
p-lang.h
p-typeprint.c
p-valprint.c
parse.c
parser-defs.h
posix-hdep.c
ppc-linux-nat.c
ppc-linux-tdep.c
ppc-linux-tdep.h
ppc-sysv-tdep.c
ppc-tdep.h
ppcbug-rom.c
ppcnbsd-nat.c
ppcnbsd-tdep.c
ppcnbsd-tdep.h
ppcobsd-nat.c
ppcobsd-tdep.c
ppcobsd-tdep.h
printcmd.c
proc-api.c
proc-events.c
proc-flags.c
proc-service.c
proc-service.list
proc-utils.h
proc-why.c
process_reply.defs
procfs.c
procfs.h
progspace.c
progspace.h
prologue-value.c
prologue-value.h
psympriv.h
psymtab.c
psymtab.h
ravenscar-sparc-thread.c
ravenscar-thread.c
ravenscar-thread.h
record.c
record.h
regcache.c
regcache.h
reggroups.c
reggroups.h
regset.c
regset.h
remote-fileio.c
remote-fileio.h
remote-m32r-sdi.c
remote-mips.c
remote-sim.c
remote.c
remote.h
reply_mig_hack.awk
reverse.c
rs6000-aix-tdep.c
rs6000-nat.c
rs6000-tdep.c
rs6000-tdep.h
rx-tdep.c
s390-nat.c
s390-tdep.c
s390-tdep.h
score-tdep.c
score-tdep.h
sentinel-frame.c
sentinel-frame.h
ser-base.c
ser-base.h
ser-go32.c
ser-mingw.c
ser-pipe.c
ser-tcp.c
ser-tcp.h
ser-unix.c
ser-unix.h
serial.c
serial.h
sh-linux-tdep.c
sh-stub.c
sh-tdep.c
sh-tdep.h
sh64-tdep.c
shnbsd-nat.c
shnbsd-tdep.c
sim-regno.h
sol-thread.c
sol2-tdep.c
sol2-tdep.h
solib-darwin.c
solib-darwin.h
solib-frv.c
solib-ia64-hpux.c
solib-ia64-hpux.h
solib-irix.c
solib-irix.h
solib-osf.c
solib-pa64.c
solib-pa64.h
solib-som.c
solib-som.h
solib-spu.c
solib-spu.h
solib-sunos.c
solib-svr4.c
solib-svr4.h
solib-target.c
solib-target.h
solib.c
solib.h
solist.h
somread.c
source.c
source.h
sparc-linux-nat.c
sparc-linux-tdep.c
sparc-nat.c
sparc-nat.h
sparc-sol2-nat.c
sparc-sol2-tdep.c
sparc-stub.c
sparc-tdep.c
sparc-tdep.h
sparc64-linux-nat.c
sparc64-linux-tdep.c
sparc64-nat.c
sparc64-sol2-tdep.c
sparc64-tdep.c
sparc64-tdep.h
sparc64fbsd-nat.c
sparc64fbsd-tdep.c
sparc64nbsd-nat.c
sparc64nbsd-tdep.c
sparc64obsd-tdep.c
sparcnbsd-nat.c
sparcnbsd-tdep.c
sparcobsd-tdep.c
spu-linux-nat.c
spu-multiarch.c
spu-tdep.c
spu-tdep.h
srec.h
stabsread.c
stabsread.h
stack.c
stack.h
std-operator.def
std-regs.c
symfile-mem.c
symfile.c
symfile.h
symmisc.c
symtab.c
symtab.h
target-descriptions.c
target-descriptions.h
target-memory.c
target.c
target.h
terminal.h
thread.c
top.c
top.h
tracepoint.c
tracepoint.h
trad-frame.c
trad-frame.h
tramp-frame.c
tramp-frame.h
typeprint.c
typeprint.h
ui-file.c
ui-file.h
ui-out.c
ui-out.h
user-regs.c
user-regs.h
utils.c
v850-tdep.c
valarith.c
valops.c
valprint.c
valprint.h
value.c
value.h
varobj.c
varobj.h
vax-nat.c
vax-tdep.c
vax-tdep.h
vaxbsd-nat.c
vaxnbsd-tdep.c
vaxobsd-tdep.c
vec.c
vec.h
version.h
version.in
windows-nat.c
windows-nat.h
windows-tdep.c
windows-tdep.h
windows-termcap.c
wrapper.c
wrapper.h
xcoffread.c
xcoffread.h
xcoffsolib.c
xcoffsolib.h
xml-support.c
xml-support.h
xml-syscall.c
xml-syscall.h
xml-tdesc.c
xml-tdesc.h
xstormy16-tdep.c
xtensa-config.c
xtensa-linux-nat.c
xtensa-linux-tdep.c
xtensa-tdep.c
xtensa-tdep.h
xtensa-xtregs.c
gold
gprof
include
intl
ld
libdecnumber
libiberty
opcodes
readline
sim
texinfo
.cvsignore
.gitignore
COPYING
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
COPYING3
COPYING3.LIB
ChangeLog
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
README
README-maintainer-mode
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
depcomp
djunpack.bat
install-sh
libtool.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
setup.com
src-release
symlink-tree
ylwrap
binutils-gdb/gdb/bfd-target.c
2011-01-01 15:34:07 +00:00

101 lines
2.7 KiB
C

/* Very simple "bfd" target, for GDB, the GNU debugger.
Copyright (C) 2003, 2005, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
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
the Free Software Foundation; either version 3 of the License, or
(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
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "target.h"
#include "bfd-target.h"
#include "exec.h"
/* The object that is stored in the target_ops->to_data field has this
type. */
struct target_bfd_data
{
/* The BFD we're wrapping. */
struct bfd *bfd;
/* The section table build from the ALLOC sections in BFD. Note
that we can't rely on extracting the BFD from a random section in
the table, since the table can be legitimately empty. */
struct target_section_table table;
};
static LONGEST
target_bfd_xfer_partial (struct target_ops *ops,
enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
ULONGEST offset, LONGEST len)
{
switch (object)
{
case TARGET_OBJECT_MEMORY:
{
struct target_bfd_data *data = ops->to_data;
return section_table_xfer_memory_partial (readbuf, writebuf,
offset, len,
data->table.sections,
data->table.sections_end,
NULL);
}
default:
return -1;
}
}
static struct target_section_table *
target_bfd_get_section_table (struct target_ops *ops)
{
struct target_bfd_data *data = ops->to_data;
return &data->table;
}
static void
target_bfd_xclose (struct target_ops *t, int quitting)
{
struct target_bfd_data *data = t->to_data;
bfd_close (data->bfd);
xfree (data->table.sections);
xfree (data);
xfree (t);
}
struct target_ops *
target_bfd_reopen (struct bfd *bfd)
{
struct target_ops *t;
struct target_bfd_data *data;
data = XZALLOC (struct target_bfd_data);
data->bfd = bfd;
build_section_table (bfd, &data->table.sections, &data->table.sections_end);
t = XZALLOC (struct target_ops);
t->to_shortname = "bfd";
t->to_longname = _("BFD backed target");
t->to_doc = _("You should never see this");
t->to_get_section_table = target_bfd_get_section_table;
t->to_xfer_partial = target_bfd_xfer_partial;
t->to_xclose = target_bfd_xclose;
t->to_data = data;
return t;
}