3 Copyright 1998, 2000, 2002 Red Hat, Inc.
5 This file is part of RDA, the Red Hat Debug Agent (and library).
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 2 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, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
22 Alternative licenses for RDA may be arranged by contacting Red Hat,
34 /* Return the ASCII equivalent of C (C>=0 && C<=15). The result will be
37 extern unsigned char gdbserv_to_hex (int c);
38 extern int gdbserv_hex_to (unsigned char c);
40 extern unsigned int gdbserv_ulong_to_hex (char *ptr, unsigned long val, int num_bits);
43 extern unsigned int gdbserv_raw_to_hex (char **ptr, char *mem, int nr_bytes);
45 /* Convert between a REG and the native unsigned long/long-long. */
47 extern void gdbserv_reg_to_ulong (struct gdbserv *gdbserv,
48 const struct gdbserv_reg *reg,
51 extern void gdbserv_reg_to_ulonglong (struct gdbserv *gdbserv,
52 const struct gdbserv_reg *reg,
53 unsigned long long *val);
55 extern void gdbserv_ulong_to_reg (struct gdbserv *gdbserv,
57 struct gdbserv_reg *reg);
59 extern void gdbserv_ulonglong_to_reg (struct gdbserv *gdbserv,
60 unsigned long long val,
61 struct gdbserv_reg *reg);
63 /* Convert between a REG and a buffer representing a numeric type.
64 Handle big endian and little endian cases explicitly. */
66 extern void gdbserv_be_bytes_to_reg (struct gdbserv *gdbserv,
69 struct gdbserv_reg *reg);
71 extern void gdbserv_le_bytes_to_reg (struct gdbserv *gdbserv,
74 struct gdbserv_reg *reg);
76 extern void gdbserv_be_bytes_from_reg (struct gdbserv *gdbserv,
79 const struct gdbserv_reg *reg);
81 extern void gdbserv_le_bytes_from_reg (struct gdbserv *gdbserv,
84 const struct gdbserv_reg *reg);
86 /* Convert between a REG and a buffer representing a native numeric
87 type. These are just wrappers for the routines above, but are
88 useful nonetheless since they free the caller from having to
89 worry about byte order issues. */
91 extern void gdbserv_host_bytes_to_reg (struct gdbserv *gdbserv,
94 struct gdbserv_reg *reg);
96 extern void gdbserv_host_bytes_from_reg (struct gdbserv *gdbserv,
99 const struct gdbserv_reg *reg);