File: gdbhost.c

package info (click to toggle)
gdb 7.4.1%2Bdfsg-0.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 161,344 kB
  • sloc: ansic: 1,781,883; asm: 272,786; exp: 100,392; makefile: 48,884; sh: 20,028; yacc: 10,676; cpp: 9,314; xml: 5,207; perl: 4,960; python: 1,477; pascal: 1,436; ada: 1,283; lex: 593; lisp: 504; sed: 228; awk: 138; objc: 134; f90: 112; java: 69; fortran: 43
file content (113 lines) | stat: -rw-r--r-- 2,914 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*  gdbhost.c -- ARMulator RDP to gdb comms code:  ARM6 Instruction Emulator.
    Copyright (C) 1994 Advanced RISC Machines Ltd.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */

/***********************************************************/
/* Functions that communicate info back to the debugger... */
/***********************************************************/

#include <stdio.h>
#include <stdarg.h>
#include "armdefs.h"
#include "communicate.h"
#include "dbg_rdi.h"
#include "armos.h"

#define OS_SendNothing 0x0
#define OS_SendChar 0x1
#define OS_SendWord 0x2
#define OS_SendString 0x3

/* Defined in kid.c */
extern int wait_for_osreply (ARMword * reply);

/* A pipe for handling SWI return values that goes straight from the */
/* parent to the ARMulator host interface, bypassing the childs RDP */
/* to RDI interpreter */
int DebuggerARMul[2];

/* The pipes between the two processes */
int mumkid[2];
int kidmum[2];

void
myprint (void *arg, const char *format, va_list ap)
{
#ifdef DEBUG
  fprintf (stderr, "Host: myprint\n");
#endif
  vfprintf (stderr, format, ap);
}


/* Waits for a keypress on the debuggers' keyboard */
void
mypause (void *arg)
{
#ifdef DEBUG
  fprintf (stderr, "Host: mypause\n");
#endif
}				/* I do love exciting functions */

void
mywritec (void *arg, int c)
{
#ifdef DEBUG
  fprintf (stderr, "Mywrite : %c\n", c);
#endif
  MYwrite_char (kidmum[1], RDP_OSOp);	/* OS Operation Request Message */
  MYwrite_word (kidmum[1], SWI_WriteC);	/* Print... */
  MYwrite_char (kidmum[1], OS_SendChar);	/*  ...a single character */
  MYwrite_char (kidmum[1], (unsigned char) c);

  wait_for_osreply ((ARMword *) 0);
}

int
myreadc (void *arg)
{
  char c;
  ARMword x;

#ifdef DEBUG
  fprintf (stderr, "Host: myreadc\n");
#endif
  MYwrite_char (kidmum[1], RDP_OSOp);	/* OS Operation Request Message */
  MYwrite_word (kidmum[1], SWI_ReadC);	/* Read... */
  MYwrite_char (kidmum[1], OS_SendNothing);

  c = wait_for_osreply (&x);
  return (x);
}


int
mywrite (void *arg, char const *buffer, int len)
{
#ifdef DEBUG
  fprintf (stderr, "Host: mywrite\n");
#endif
  return 0;
}

char *
mygets (void *arg, char *buffer, int len)
{
#ifdef DEBUG
  fprintf (stderr, "Host: mygets\n");
#endif
  return buffer;
}