1 /*
2 * Copyright (C) 2009, Mukesh Rathor, Oracle Corp. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public
6 * License v2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public
14 * License along with this program; If not, see <http://www.gnu.org/licenses/>.
15 */
16 #include <stdio.h>
17 #include <stddef.h>
18 #include <stdarg.h>
19 #include <stdint.h>
20 #include <unistd.h>
21
22 #include "gx.h"
23 #include "../xg/xg_public.h"
24
25 int xgtrc_on = 1;
26
27 /* This file is NOT part of gdbsx binary, but a dummy so gdbsx bin can be built
28 * and used to learn/test "gdb <-> gdbserver" protocol */
29
30 void
xgtrc(const char * fn,const char * fmt,...)31 xgtrc(const char *fn, const char *fmt, ...)
32 {
33 char buf[2048];
34 va_list args;
35
36 fprintf(stderr, "%s:", fn);
37 va_start(args, fmt);
38 (void)vsnprintf(buf, sizeof(buf), fmt, args);
39 va_end(args);
40 fprintf(stderr, "%s", buf);
41 fflush (stderr);
42 }
43
44 void
xgprt(const char * fn,const char * fmt,...)45 xgprt(const char *fn, const char *fmt, ...)
46 {
47 char buf[2048];
48 va_list args;
49
50 fprintf(stderr, "%s:", fn);
51 va_start(args, fmt);
52 (void)vsnprintf(buf, sizeof(buf), fmt, args);
53 va_end(args);
54 fprintf (stderr, "%s", buf);
55 fflush (stderr);
56 }
57
58 int
xg_init()59 xg_init()
60 {
61 return 0;
62 }
63
64 void
xg_deinit()65 xg_deinit()
66 {
67 /* reset debugging info in guest */
68 /* unpause the guest */
69 }
70
71 int
xg_attach(domid_t domid)72 xg_attach(domid_t domid)
73 {
74 return 2;
75 }
76
77 int
xg_step(vcpuid_t which_vcpu,int guest_bitness)78 xg_step(vcpuid_t which_vcpu, int guest_bitness)
79 {
80 return 0;
81 }
82
83 int
xg_resume(int guest_bitness)84 xg_resume(int guest_bitness)
85 {
86 return 0;
87 }
88
89 int
xg_regs_read(regstype_t which_regs,vcpuid_t which_vcpu,struct xg_gdb_regs * regsp,int guest_bitness)90 xg_regs_read(regstype_t which_regs, vcpuid_t which_vcpu,
91 struct xg_gdb_regs *regsp, int guest_bitness)
92 {
93 return 0;
94 }
95
96 int
xg_regs_write(regstype_t which_regs,vcpuid_t which_vcpu,struct xg_gdb_regs * regsp,int guest_bitness)97 xg_regs_write(regstype_t which_regs, vcpuid_t which_vcpu,
98 struct xg_gdb_regs *regsp, int guest_bitness)
99 {
100 return 0;
101 }
102
103 int
xg_read_mem(uint64_t guestva,char * tobuf,int len)104 xg_read_mem(uint64_t guestva, char *tobuf, int len)
105 {
106 return 0;
107 }
108
109 int
xg_write_mem(uint64_t guestva,char * frombuf,int len)110 xg_write_mem(uint64_t guestva, char *frombuf, int len)
111 {
112 return 0;
113 }
114
115 int
xg_wait_domain(vcpuid_t * vcpu_p,int guest_bitness)116 xg_wait_domain(vcpuid_t *vcpu_p, int guest_bitness)
117 {
118 return 0;
119 }
120
121