Shadow SIM's debug_printf function
[deliverable/binutils-gdb.git] / gdb / gdbserver / tdesc.c
CommitLineData
ecd75fc8 1/* Copyright (C) 2012-2014 Free Software Foundation, Inc.
3aee8918
PA
2
3 This file is part of GDB.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18#include "server.h"
19#include "tdesc.h"
20#include "regdef.h"
21
22void
23init_target_desc (struct target_desc *tdesc)
24{
25 int offset, i;
26
27 offset = 0;
28 for (i = 0; i < tdesc->num_registers; i++)
29 {
30 tdesc->reg_defs[i].offset = offset;
31 offset += tdesc->reg_defs[i].size;
32 }
33
34 tdesc->registers_size = offset / 8;
35
36 /* Make sure PBUFSIZ is large enough to hold a full register
37 packet. */
38 if (2 * tdesc->registers_size + 32 > PBUFSIZ)
39 fatal ("Register packet size exceeds PBUFSIZ.");
40}
41
42#ifndef IN_PROCESS_AGENT
43
44static const struct target_desc default_description;
45
46void
47copy_target_description (struct target_desc *dest,
48 const struct target_desc *src)
49{
50 dest->reg_defs = src->reg_defs;
51 dest->num_registers = src->num_registers;
52 dest->expedite_regs = src->expedite_regs;
53 dest->registers_size = src->registers_size;
54 dest->xmltarget = src->xmltarget;
55}
56
57const struct target_desc *
58current_target_desc (void)
59{
60 if (current_inferior == NULL)
61 return &default_description;
62
63 return current_process ()->tdesc;
64}
65
66#endif
This page took 0.124706 seconds and 4 git commands to generate.