1 /* Copyright (C) 2012-2016 Free Software Foundation, Inc.
3 This file is part of GDB.
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.
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.
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/>. */
23 init_target_desc (struct target_desc
*tdesc
)
28 for (i
= 0; i
< tdesc
->num_registers
; i
++)
30 tdesc
->reg_defs
[i
].offset
= offset
;
31 offset
+= tdesc
->reg_defs
[i
].size
;
34 tdesc
->registers_size
= offset
/ 8;
36 /* Make sure PBUFSIZ is large enough to hold a full register
38 gdb_assert (2 * tdesc
->registers_size
+ 32 <= PBUFSIZ
);
41 #ifndef IN_PROCESS_AGENT
43 static const struct target_desc default_description
= { 0 };
46 copy_target_description (struct target_desc
*dest
,
47 const struct target_desc
*src
)
49 dest
->reg_defs
= src
->reg_defs
;
50 dest
->num_registers
= src
->num_registers
;
51 dest
->expedite_regs
= src
->expedite_regs
;
52 dest
->registers_size
= src
->registers_size
;
53 dest
->xmltarget
= src
->xmltarget
;
56 const struct target_desc
*
57 current_target_desc (void)
59 if (current_thread
== NULL
)
60 return &default_description
;
62 return current_process ()->tdesc
;