(Fix date for):
[deliverable/binutils-gdb.git] / gdb / bfd-target.c
CommitLineData
bba2d28d
AC
1/* Very simple "bfd" target, for GDB, the GNU debugger.
2
0fb0cc75 3 Copyright (C) 2003, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
bba2d28d
AC
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
bba2d28d
AC
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
bba2d28d
AC
19
20#include "defs.h"
21#include "target.h"
22#include "bfd-target.h"
348f8c02 23#include "exec.h"
bba2d28d 24
2c0b251b 25static LONGEST
bba2d28d
AC
26target_bfd_xfer_partial (struct target_ops *ops,
27 enum target_object object,
961cb7b5
MK
28 const char *annex, gdb_byte *readbuf,
29 const gdb_byte *writebuf,
30 ULONGEST offset, LONGEST len)
bba2d28d
AC
31{
32 switch (object)
33 {
34 case TARGET_OBJECT_MEMORY:
348f8c02
PA
35 return section_table_xfer_memory_partial (readbuf, writebuf, offset, len,
36 ops->to_sections,
37 ops->to_sections_end);
bba2d28d
AC
38 default:
39 return -1;
40 }
41}
42
2c0b251b 43static void
bba2d28d
AC
44target_bfd_xclose (struct target_ops *t, int quitting)
45{
46 bfd_close (t->to_data);
47 xfree (t->to_sections);
48 xfree (t);
49}
50
51struct target_ops *
52target_bfd_reopen (struct bfd *bfd)
53{
54 struct target_ops *t = XZALLOC (struct target_ops);
55 t->to_shortname = "bfd";
3d263c1d
BI
56 t->to_longname = _("BFD backed target");
57 t->to_doc = _("You should never see this");
bba2d28d
AC
58 t->to_xfer_partial = target_bfd_xfer_partial;
59 t->to_xclose = target_bfd_xclose;
60 t->to_data = bfd;
348f8c02
PA
61
62 build_section_table (bfd,
63 &t->to_sections,
64 &t->to_sections_end);
bba2d28d
AC
65 return t;
66}
This page took 0.35665 seconds and 4 git commands to generate.