1 /* Target-dependent, architecture-independent code for DICOS, for GDB.
3 Copyright (C) 2009-2012 Free Software Foundation, Inc.
5 This file is part of GDB.
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
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 #include "gdb_string.h"
24 #include "solib-target.h"
26 #include "dicos-tdep.h"
29 dicos_init_abi (struct gdbarch
*gdbarch
)
31 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
33 set_solib_ops (gdbarch
, &solib_target_so_ops
);
35 /* Every process, although has its own address space, sees the same
36 list of shared libraries. There's no "main executable" in DICOS,
37 so this accounts for all code. */
38 set_gdbarch_has_global_solist (gdbarch
, 1);
40 /* The DICOS breakpoint API takes care of magically making
41 breakpoints visible to all inferiors. */
42 set_gdbarch_has_global_breakpoints (gdbarch
, 1);
44 /* There's no (standard definition of) entry point or a guaranteed
45 text location with a symbol where to place the call dummy, so we
46 need it on the stack. Rely on i386_gdbarch_init used also for
47 amd64 to set up ON_STACK inferior calls. */
49 /* DICOS rewinds the PC itself. */
50 set_gdbarch_decr_pc_after_break (gdbarch
, 0);
53 /* Return true if ABFD is a dicos load module. HEADER_SIZE is the
54 expected size of the "header" section in bytes. */
57 dicos_load_module_p (bfd
*abfd
, int header_size
)
61 asymbol
**symbol_table
= NULL
;
62 const char *symname
= "Dicos_loadModuleInfo";
65 /* DICOS files don't have a .note.ABI-tag marker or something
66 similar. We do know there's always a "header" section of
67 HEADER_SIZE bytes (size depends on architecture), and there's
68 always a "Dicos_loadModuleInfo" symbol defined. Look for the
69 section first, as that should be cheaper. */
71 section
= bfd_get_section_by_name (abfd
, "header");
75 if (bfd_section_size (abfd
, section
) != header_size
)
78 /* Dicos LMs always have a "Dicos_loadModuleInfo" symbol
79 defined. Look for it. */
81 storage_needed
= bfd_get_symtab_upper_bound (abfd
);
82 if (storage_needed
< 0)
84 warning (_("Can't read elf symbols from %s: %s"),
85 bfd_get_filename (abfd
),
86 bfd_errmsg (bfd_get_error ()));
90 if (storage_needed
> 0)
94 symbol_table
= xmalloc (storage_needed
);
95 symcount
= bfd_canonicalize_symtab (abfd
, symbol_table
);
98 warning (_("Can't read elf symbols from %s: %s"),
99 bfd_get_filename (abfd
),
100 bfd_errmsg (bfd_get_error ()));
103 for (i
= 0; i
< symcount
; i
++)
105 asymbol
*sym
= symbol_table
[i
];
106 if (sym
->name
!= NULL
107 && symname
[0] == sym
->name
[0]
108 && strcmp (symname
+ 1, sym
->name
+ 1) == 0)
117 xfree (symbol_table
);
This page took 0.032024 seconds and 4 git commands to generate.