GDBserver
|
00001 /* Copyright (C) 2012-2013 Free Software Foundation, Inc. 00002 00003 This file is part of GDB. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00017 00018 #include "server.h" 00019 #include "tdesc.h" 00020 #include "regdef.h" 00021 00022 void 00023 init_target_desc (struct target_desc *tdesc) 00024 { 00025 int offset, i; 00026 00027 offset = 0; 00028 for (i = 0; i < tdesc->num_registers; i++) 00029 { 00030 tdesc->reg_defs[i].offset = offset; 00031 offset += tdesc->reg_defs[i].size; 00032 } 00033 00034 tdesc->registers_size = offset / 8; 00035 00036 /* Make sure PBUFSIZ is large enough to hold a full register 00037 packet. */ 00038 if (2 * tdesc->registers_size + 32 > PBUFSIZ) 00039 fatal ("Register packet size exceeds PBUFSIZ."); 00040 } 00041 00042 #ifndef IN_PROCESS_AGENT 00043 00044 static const struct target_desc default_description; 00045 00046 void 00047 copy_target_description (struct target_desc *dest, 00048 const struct target_desc *src) 00049 { 00050 dest->reg_defs = src->reg_defs; 00051 dest->num_registers = src->num_registers; 00052 dest->expedite_regs = src->expedite_regs; 00053 dest->registers_size = src->registers_size; 00054 dest->xmltarget = src->xmltarget; 00055 } 00056 00057 const struct target_desc * 00058 current_target_desc (void) 00059 { 00060 if (current_inferior == NULL) 00061 return &default_description; 00062 00063 return current_process ()->tdesc; 00064 } 00065 00066 #endif