OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [remote-rdp.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/* Remote debugging for the ARM RDP interface.
2
 
3
   Copyright 1994, 1995, 1998, 1999, 2000, 2001, 2002 Free Software
4
   Foundation, Inc.
5
 
6
   This file is part of GDB.
7
 
8
   This program is free software; you can redistribute it and/or modify
9
   it under the terms of the GNU General Public License as published by
10
   the Free Software Foundation; either version 2 of the License, or
11
   (at your option) any later version.
12
 
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
 
18
   You should have received a copy of the GNU General Public License
19
   along with this program; if not, write to the Free Software
20
   Foundation, Inc., 59 Temple Place - Suite 330,
21
   Boston, MA 02111-1307, USA.
22
 
23
 
24
 */
25
 
26
 
27
/*
28
   Much of this file (in particular the SWI stuff) is based on code by
29
   David Taylor (djt1000@uk.ac.cam.hermes).
30
 
31
   I hacked on and simplified it by removing a lot of sexy features he
32
   had added, and some of the (unix specific) workarounds he'd done
33
   for other GDB problems - which if they still exist should be fixed
34
   in GDB, not in a remote-foo thing .  I also made it conform more to
35
   the doc I have; which may be wrong.
36
 
37
   Steve Chamberlain (sac@cygnus.com).
38
 */
39
 
40
 
41
#include "defs.h"
42
#include "inferior.h"
43
#include "value.h"
44
#include "gdb/callback.h"
45
#include "command.h"
46
#include <ctype.h>
47
#include <fcntl.h>
48
#include "symfile.h"
49
#include "remote-utils.h"
50
#include "gdb_string.h"
51
#include "gdbcore.h"
52
#include "regcache.h"
53
#include "serial.h"
54
 
55
#include "arm-tdep.h"
56
 
57
#ifdef HAVE_TIME_H
58
#include <time.h>
59
#endif
60
 
61
extern struct target_ops remote_rdp_ops;
62
static struct serial *io;
63
static host_callback *callback = &default_callback;
64
 
65
struct
66
  {
67
    int step_info;
68
    int break_info;
69
    int model_info;
70
    int target_info;
71
    int can_step;
72
    char command_line[10];
73
    int rdi_level;
74
    int rdi_stopped_status;
75
  }
76
ds;
77
 
78
 
79
 
80
/* Definitions for the RDP protocol. */
81
 
82
#define RDP_MOUTHFULL                   (1<<6)
83
#define FPU_COPRO_NUMBER                1
84
 
85
#define RDP_OPEN                        0
86
#define RDP_OPEN_TYPE_COLD              0
87
#define RDP_OPEN_TYPE_WARM              1
88
#define RDP_OPEN_TYPE_BAUDRATE          2
89
 
90
#define RDP_OPEN_BAUDRATE_9600          1
91
#define RDP_OPEN_BAUDRATE_19200         2
92
#define RDP_OPEN_BAUDRATE_38400         3
93
 
94
#define RDP_OPEN_TYPE_RETURN_SEX        (1<<3)
95
 
96
#define RDP_CLOSE                       1
97
 
98
#define RDP_MEM_READ                    2
99
 
100
#define RDP_MEM_WRITE                   3
101
 
102
#define RDP_CPU_READ                    4
103
#define RDP_CPU_WRITE                   5
104
#define RDP_CPU_READWRITE_MODE_CURRENT 255
105
#define RDP_CPU_READWRITE_MASK_PC       (1<<16)
106
#define RDP_CPU_READWRITE_MASK_CPSR     (1<<17)
107
#define RDP_CPU_READWRITE_MASK_SPSR     (1<<18)
108
 
109
#define RDP_COPRO_READ                  6
110
#define RDP_COPRO_WRITE                 7
111
#define RDP_FPU_READWRITE_MASK_FPS      (1<<8)
112
 
113
#define RDP_SET_BREAK                   0xa
114
#define RDP_SET_BREAK_TYPE_PC_EQUAL     0
115
#define RDP_SET_BREAK_TYPE_GET_HANDLE   (0x10)
116
 
117
#define RDP_CLEAR_BREAK                 0xb
118
 
119
#define RDP_EXEC                        0x10
120
#define RDP_EXEC_TYPE_SYNC              0
121
 
122
#define RDP_STEP                        0x11
123
 
124
#define RDP_INFO                        0x12
125
#define RDP_INFO_ABOUT_STEP             2
126
#define RDP_INFO_ABOUT_STEP_GT_1        1
127
#define RDP_INFO_ABOUT_STEP_TO_JMP      2
128
#define RDP_INFO_ABOUT_STEP_1           4
129
#define RDP_INFO_ABOUT_TARGET           0
130
#define RDP_INFO_ABOUT_BREAK            1
131
#define RDP_INFO_ABOUT_BREAK_COMP       1
132
#define RDP_INFO_ABOUT_BREAK_RANGE      2
133
#define RDP_INFO_ABOUT_BREAK_BYTE_READ  4
134
#define RDP_INFO_ABOUT_BREAK_HALFWORD_READ 8
135
#define RDP_INFO_ABOUT_BREAK_WORD_READ (1<<4)
136
#define RDP_INFO_ABOUT_BREAK_BYTE_WRITE (1<<5)
137
#define RDP_INFO_ABOUT_BREAK_HALFWORD_WRITE (1<<6)
138
#define RDP_INFO_ABOUT_BREAK_WORD_WRITE (1<<7)
139
#define RDP_INFO_ABOUT_BREAK_MASK       (1<<8)
140
#define RDP_INFO_ABOUT_BREAK_THREAD_BREAK (1<<9)
141
#define RDP_INFO_ABOUT_BREAK_THREAD_WATCH (1<<10)
142
#define RDP_INFO_ABOUT_BREAK_COND       (1<<11)
143
#define RDP_INFO_VECTOR_CATCH           (0x180)
144
#define RDP_INFO_ICEBREAKER             (7)
145
#define RDP_INFO_SET_CMDLINE            (0x300)
146
 
147
#define RDP_SELECT_CONFIG               (0x16)
148
#define RDI_ConfigCPU                   0
149
#define RDI_ConfigSystem                1
150
#define RDI_MatchAny                    0
151
#define RDI_MatchExactly                1
152
#define RDI_MatchNoEarlier              2
153
 
154
#define RDP_RESET                       0x7f
155
 
156
/* Returns from RDP */
157
#define RDP_RES_STOPPED                 0x20
158
#define RDP_RES_SWI                     0x21
159
#define RDP_RES_FATAL                   0x5e
160
#define RDP_RES_VALUE                   0x5f
161
#define RDP_RES_VALUE_LITTLE_ENDIAN     240
162
#define RDP_RES_VALUE_BIG_ENDIAN        241
163
#define RDP_RES_RESET                   0x7f
164
#define RDP_RES_AT_BREAKPOINT           143
165
#define RDP_RES_IDUNNO                  0xe6
166
#define RDP_OSOpReply                   0x13
167
#define RDP_OSOpWord                    2
168
#define RDP_OSOpNothing                 0
169
 
170
static int timeout = 2;
171
 
172
static char *commandline = NULL;
173
 
174
static int
175
remote_rdp_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
176
                                 int write,
177
                                 struct mem_attrib *attrib,
178
                                 struct target_ops *target);
179
 
180
 
181
/* Stuff for talking to the serial layer. */
182
 
183
static unsigned char
184
get_byte (void)
185
{
186
  int c = serial_readchar (io, timeout);
187
 
188
  if (remote_debug)
189
    fprintf_unfiltered (gdb_stdlog, "[%02x]\n", c);
190
 
191
  if (c == SERIAL_TIMEOUT)
192
    {
193
      if (timeout == 0)
194
        return (unsigned char) c;
195
 
196
      error ("Timeout reading from remote_system");
197
    }
198
 
199
  return c;
200
}
201
 
202
/* Note that the target always speaks little-endian to us,
203
   even if it's a big endian machine. */
204
static unsigned int
205
get_word (void)
206
{
207
  unsigned int val = 0;
208
  unsigned int c;
209
  int n;
210
  for (n = 0; n < 4; n++)
211
    {
212
      c = get_byte ();
213
      val |= c << (n * 8);
214
    }
215
  return val;
216
}
217
 
218
static void
219
put_byte (char val)
220
{
221
  if (remote_debug)
222
    fprintf_unfiltered (gdb_stdlog, "(%02x)\n", val);
223
  serial_write (io, &val, 1);
224
}
225
 
226
static void
227
put_word (int val)
228
{
229
  /* We always send in little endian */
230
  unsigned char b[4];
231
  b[0] = val;
232
  b[1] = val >> 8;
233
  b[2] = val >> 16;
234
  b[3] = val >> 24;
235
 
236
  if (remote_debug)
237
    fprintf_unfiltered (gdb_stdlog, "(%04x)", val);
238
 
239
  serial_write (io, b, 4);
240
}
241
 
242
 
243
 
244
/* Stuff for talking to the RDP layer. */
245
 
246
/* This is a bit more fancy that need be so that it syncs even in nasty cases.
247
 
248
   I'be been unable to make it reliably sync up with the change
249
   baudrate open command.  It likes to sit and say it's been reset,
250
   with no more action.  So I took all that code out.  I'd rather sync
251
   reliably at 9600 than wait forever for a possible 19200 connection.
252
 
253
 */
254
static void
255
rdp_init (int cold, int tty)
256
{
257
  int sync = 0;
258
  int type = cold ? RDP_OPEN_TYPE_COLD : RDP_OPEN_TYPE_WARM;
259
  int baudtry = 9600;
260
 
261
  time_t now = time (0);
262
  time_t stop_time = now + 10;  /* Try and sync for 10 seconds, then give up */
263
 
264
 
265
  while (time (0) < stop_time && !sync)
266
    {
267
      int restype;
268
      QUIT;
269
 
270
      serial_flush_input (io);
271
      serial_flush_output (io);
272
 
273
      if (tty)
274
        printf_unfiltered ("Trying to connect at %d baud.\n", baudtry);
275
 
276
      /*
277
         ** It seems necessary to reset an EmbeddedICE to get it going.
278
         ** This has the side benefit of displaying the startup banner.
279
       */
280
      if (cold)
281
        {
282
          put_byte (RDP_RESET);
283
          while ((restype = serial_readchar (io, 1)) > 0)
284
            {
285
              switch (restype)
286
                {
287
                case SERIAL_TIMEOUT:
288
                  break;
289
                case RDP_RESET:
290
                  /* Sent at start of reset process: ignore */
291
                  break;
292
                default:
293
                  printf_unfiltered ("%c", isgraph (restype) ? restype : ' ');
294
                  break;
295
                }
296
            }
297
 
298
          if (restype == 0)
299
            {
300
              /* Got end-of-banner mark */
301
              printf_filtered ("\n");
302
            }
303
        }
304
 
305
      put_byte (RDP_OPEN);
306
 
307
      put_byte (type | RDP_OPEN_TYPE_RETURN_SEX);
308
      put_word (0);
309
 
310
      while (!sync && (restype = serial_readchar (io, 1)) > 0)
311
        {
312
          if (remote_debug)
313
            fprintf_unfiltered (gdb_stdlog, "[%02x]\n", restype);
314
 
315
          switch (restype)
316
            {
317
            case SERIAL_TIMEOUT:
318
              break;
319
 
320
            case RDP_RESET:
321
              while ((restype = serial_readchar (io, 1)) == RDP_RESET)
322
                ;
323
              do
324
                {
325
                  printf_unfiltered ("%c", isgraph (restype) ? restype : ' ');
326
                }
327
              while ((restype = serial_readchar (io, 1)) > 0);
328
 
329
              if (tty)
330
                {
331
                  printf_unfiltered ("\nThe board has sent notification that it was reset.\n");
332
                  printf_unfiltered ("Waiting for it to settle down...\n");
333
                }
334
              sleep (3);
335
              if (tty)
336
                printf_unfiltered ("\nTrying again.\n");
337
              cold = 0;
338
              break;
339
 
340
            default:
341
              break;
342
 
343
            case RDP_RES_VALUE:
344
              {
345
                int resval = serial_readchar (io, 1);
346
 
347
                if (remote_debug)
348
                  fprintf_unfiltered (gdb_stdlog, "[%02x]\n", resval);
349
 
350
                switch (resval)
351
                  {
352
                  case SERIAL_TIMEOUT:
353
                    break;
354
                  case RDP_RES_VALUE_LITTLE_ENDIAN:
355
                    target_byte_order = BFD_ENDIAN_LITTLE;
356
                    sync = 1;
357
                    break;
358
                  case RDP_RES_VALUE_BIG_ENDIAN:
359
                    target_byte_order = BFD_ENDIAN_BIG;
360
                    sync = 1;
361
                    break;
362
                  default:
363
                    break;
364
                  }
365
              }
366
            }
367
        }
368
    }
369
 
370
  if (!sync)
371
    {
372
      error ("Couldn't reset the board, try pressing the reset button");
373
    }
374
}
375
 
376
 
377
void
378
send_rdp (char *template,...)
379
{
380
  char buf[200];
381
  char *dst = buf;
382
  va_list alist;
383
  va_start (alist, template);
384
 
385
  while (*template)
386
    {
387
      unsigned int val;
388
      int *pi;
389
      int *pstat;
390
      char *pc;
391
      int i;
392
      switch (*template++)
393
        {
394
        case 'b':
395
          val = va_arg (alist, int);
396
          *dst++ = val;
397
          break;
398
        case 'w':
399
          val = va_arg (alist, int);
400
          *dst++ = val;
401
          *dst++ = val >> 8;
402
          *dst++ = val >> 16;
403
          *dst++ = val >> 24;
404
          break;
405
        case 'S':
406
          val = get_byte ();
407
          if (val != RDP_RES_VALUE)
408
            {
409
              printf_unfiltered ("got bad res value of %d, %x\n", val, val);
410
            }
411
          break;
412
        case 'V':
413
          pstat = va_arg (alist, int *);
414
          pi = va_arg (alist, int *);
415
 
416
          *pstat = get_byte ();
417
          /* Check the result was zero, if not read the syndrome */
418
          if (*pstat)
419
            {
420
              *pi = get_word ();
421
            }
422
          break;
423
        case 'Z':
424
          /* Check the result code */
425
          switch (get_byte ())
426
            {
427
            case 0:
428
              /* Success */
429
              break;
430
            case 253:
431
              /* Target can't do it; never mind */
432
              printf_unfiltered ("RDP: Insufficient privilege\n");
433
              return;
434
            case 254:
435
              /* Target can't do it; never mind */
436
              printf_unfiltered ("RDP: Unimplemented message\n");
437
              return;
438
            case 255:
439
              error ("Command garbled");
440
              break;
441
            default:
442
              error ("Corrupt reply from target");
443
              break;
444
            }
445
          break;
446
        case 'W':
447
          /* Read a word from the target */
448
          pi = va_arg (alist, int *);
449
          *pi = get_word ();
450
          break;
451
        case 'P':
452
          /* Read in some bytes from the target. */
453
          pc = va_arg (alist, char *);
454
          val = va_arg (alist, int);
455
          for (i = 0; i < val; i++)
456
            {
457
              pc[i] = get_byte ();
458
            }
459
          break;
460
        case 'p':
461
          /* send what's being pointed at */
462
          pc = va_arg (alist, char *);
463
          val = va_arg (alist, int);
464
          dst = buf;
465
          serial_write (io, pc, val);
466
          break;
467
        case '-':
468
          /* Send whats in the queue */
469
          if (dst != buf)
470
            {
471
              serial_write (io, buf, dst - buf);
472
              dst = buf;
473
            }
474
          break;
475
        case 'B':
476
          pi = va_arg (alist, int *);
477
          *pi = get_byte ();
478
          break;
479
        default:
480
          internal_error (__FILE__, __LINE__, "failed internal consistency check");
481
        }
482
    }
483
  va_end (alist);
484
 
485
  if (dst != buf)
486
    internal_error (__FILE__, __LINE__, "failed internal consistency check");
487
}
488
 
489
 
490
static int
491
rdp_write (CORE_ADDR memaddr, char *buf, int len)
492
{
493
  int res;
494
  int val;
495
 
496
  send_rdp ("bww-p-SV", RDP_MEM_WRITE, memaddr, len, buf, len, &res, &val);
497
 
498
  if (res)
499
    {
500
      return val;
501
    }
502
  return len;
503
}
504
 
505
 
506
static int
507
rdp_read (CORE_ADDR memaddr, char *buf, int len)
508
{
509
  int res;
510
  int val;
511
  send_rdp ("bww-S-P-V",
512
            RDP_MEM_READ, memaddr, len,
513
            buf, len,
514
            &res, &val);
515
  if (res)
516
    {
517
      return val;
518
    }
519
  return len;
520
}
521
 
522
static void
523
rdp_fetch_one_register (int mask, char *buf)
524
{
525
  int val;
526
  send_rdp ("bbw-SWZ", RDP_CPU_READ, RDP_CPU_READWRITE_MODE_CURRENT, mask, &val);
527
  store_signed_integer (buf, 4, val);
528
}
529
 
530
static void
531
rdp_fetch_one_fpu_register (int mask, char *buf)
532
{
533
#if 0
534
  /* !!! Since the PIE board doesn't work as documented,
535
     and it doesn't have FPU hardware anyway and since it
536
     slows everything down, I've disabled this. */
537
  int val;
538
  if (mask == RDP_FPU_READWRITE_MASK_FPS)
539
    {
540
      /* this guy is only a word */
541
      send_rdp ("bbw-SWZ", RDP_COPRO_READ, FPU_COPRO_NUMBER, mask, &val);
542
      store_signed_integer (buf, 4, val);
543
    }
544
  else
545
    {
546
      /* There are 12 bytes long
547
         !! fixme about endianness
548
       */
549
      int dummy;                /* I've seen these come back as four words !! */
550
      send_rdp ("bbw-SWWWWZ", RDP_COPRO_READ, FPU_COPRO_NUMBER, mask, buf + 0, buf + 4, buf + 8, &dummy);
551
    }
552
#endif
553
  memset (buf, 0, MAX_REGISTER_RAW_SIZE);
554
}
555
 
556
 
557
static void
558
rdp_store_one_register (int mask, char *buf)
559
{
560
  int val = extract_unsigned_integer (buf, 4);
561
 
562
  send_rdp ("bbww-SZ",
563
            RDP_CPU_WRITE, RDP_CPU_READWRITE_MODE_CURRENT, mask, val);
564
}
565
 
566
 
567
static void
568
rdp_store_one_fpu_register (int mask, char *buf)
569
{
570
#if 0
571
  /* See comment in fetch_one_fpu_register */
572
  if (mask == RDP_FPU_READWRITE_MASK_FPS)
573
    {
574
      int val = extract_unsigned_integer (buf, 4);
575
      /* this guy is only a word */
576
      send_rdp ("bbww-SZ", RDP_COPRO_WRITE,
577
                FPU_COPRO_NUMBER,
578
                mask, val);
579
    }
580
  else
581
    {
582
      /* There are 12 bytes long
583
         !! fixme about endianness
584
       */
585
      int dummy = 0;
586
      /* I've seen these come as four words, not the three advertized !! */
587
      printf ("Sending mask %x\n", mask);
588
      send_rdp ("bbwwwww-SZ",
589
                RDP_COPRO_WRITE,
590
                FPU_COPRO_NUMBER,
591
                mask,
592
                *(int *) (buf + 0),
593
                *(int *) (buf + 4),
594
                *(int *) (buf + 8),
595
                0);
596
 
597
      printf ("done mask %x\n", mask);
598
    }
599
#endif
600
}
601
 
602
 
603
/* Convert between GDB requests and the RDP layer. */
604
 
605
static void
606
remote_rdp_fetch_register (int regno)
607
{
608
  if (regno == -1)
609
    {
610
      for (regno = 0; regno < NUM_REGS; regno++)
611
        remote_rdp_fetch_register (regno);
612
    }
613
  else
614
    {
615
      char buf[ARM_MAX_REGISTER_RAW_SIZE];
616
      if (regno < 15)
617
        rdp_fetch_one_register (1 << regno, buf);
618
      else if (regno == ARM_PC_REGNUM)
619
        rdp_fetch_one_register (RDP_CPU_READWRITE_MASK_PC, buf);
620
      else if (regno == ARM_PS_REGNUM)
621
        rdp_fetch_one_register (RDP_CPU_READWRITE_MASK_CPSR, buf);
622
      else if (regno == ARM_FPS_REGNUM)
623
        rdp_fetch_one_fpu_register (RDP_FPU_READWRITE_MASK_FPS, buf);
624
      else if (regno >= ARM_F0_REGNUM && regno <= ARM_F7_REGNUM)
625
        rdp_fetch_one_fpu_register (1 << (regno - ARM_F0_REGNUM), buf);
626
      else
627
        {
628
          printf ("Help me with fetch reg %d\n", regno);
629
        }
630
      supply_register (regno, buf);
631
    }
632
}
633
 
634
 
635
static void
636
remote_rdp_store_register (int regno)
637
{
638
  if (regno == -1)
639
    {
640
      for (regno = 0; regno < NUM_REGS; regno++)
641
        remote_rdp_store_register (regno);
642
    }
643
  else
644
    {
645
      char tmp[ARM_MAX_REGISTER_RAW_SIZE];
646
      read_register_gen (regno, tmp);
647
      if (regno < 15)
648
        rdp_store_one_register (1 << regno, tmp);
649
      else if (regno == ARM_PC_REGNUM)
650
        rdp_store_one_register (RDP_CPU_READWRITE_MASK_PC, tmp);
651
      else if (regno == ARM_PS_REGNUM)
652
        rdp_store_one_register (RDP_CPU_READWRITE_MASK_CPSR, tmp);
653
      else if (regno >= ARM_F0_REGNUM && regno <= ARM_F7_REGNUM)
654
        rdp_store_one_fpu_register (1 << (regno - ARM_F0_REGNUM), tmp);
655
      else
656
        {
657
          printf ("Help me with reg %d\n", regno);
658
        }
659
    }
660
}
661
 
662
static void
663
remote_rdp_kill (void)
664
{
665
  callback->shutdown (callback);
666
}
667
 
668
 
669
static void
670
rdp_info (void)
671
{
672
  send_rdp ("bw-S-W-Z", RDP_INFO, RDP_INFO_ABOUT_STEP,
673
            &ds.step_info);
674
  send_rdp ("bw-S-W-Z", RDP_INFO, RDP_INFO_ABOUT_BREAK,
675
            &ds.break_info);
676
  send_rdp ("bw-S-WW-Z", RDP_INFO, RDP_INFO_ABOUT_TARGET,
677
            &ds.target_info,
678
            &ds.model_info);
679
 
680
  ds.can_step = ds.step_info & RDP_INFO_ABOUT_STEP_1;
681
 
682
  ds.rdi_level = (ds.target_info >> 5) & 3;
683
}
684
 
685
 
686
static void
687
rdp_execute_start (void)
688
{
689
  /* Start it off, but don't wait for it */
690
  send_rdp ("bb-", RDP_EXEC, RDP_EXEC_TYPE_SYNC);
691
}
692
 
693
 
694
static void
695
rdp_set_command_line (char *command, char *args)
696
{
697
  /*
698
     ** We could use RDP_INFO_SET_CMDLINE to send this, but EmbeddedICE systems
699
     ** don't implement that, and get all confused at the unexpected text.
700
     ** Instead, just keep a copy, and send it when the target does a SWI_GetEnv
701
   */
702
 
703
  if (commandline != NULL)
704
    xfree (commandline);
705
 
706
  xasprintf (&commandline, "%s %s", command, args);
707
}
708
 
709
static void
710
rdp_catch_vectors (void)
711
{
712
  /*
713
     ** We want the target monitor to intercept the abort vectors
714
     ** i.e. stop the program if any of these are used.
715
   */
716
  send_rdp ("bww-SZ", RDP_INFO, RDP_INFO_VECTOR_CATCH,
717
  /*
718
     ** Specify a bitmask including
719
     **  the reset vector
720
     **  the undefined instruction vector
721
     **  the prefetch abort vector
722
     **  the data abort vector
723
     **  the address exception vector
724
   */
725
            (1 << 0) | (1 << 1) | (1 << 3) | (1 << 4) | (1 << 5)
726
    );
727
}
728
 
729
 
730
 
731
#define a_byte 1
732
#define a_word 2
733
#define a_string 3
734
 
735
 
736
typedef struct
737
{
738
  CORE_ADDR n;
739
  const char *s;
740
}
741
argsin;
742
 
743
#define ABYTE 1
744
#define AWORD 2
745
#define ASTRING 3
746
#define ADDRLEN 4
747
 
748
#define SWI_WriteC                      0x0
749
#define SWI_Write0                      0x2
750
#define SWI_ReadC                       0x4
751
#define SWI_CLI                         0x5
752
#define SWI_GetEnv                      0x10
753
#define SWI_Exit                        0x11
754
#define SWI_EnterOS                     0x16
755
 
756
#define SWI_GetErrno                    0x60
757
#define SWI_Clock                       0x61
758
 
759
#define SWI_Time                        0x63
760
#define SWI_Remove                      0x64
761
#define SWI_Rename                      0x65
762
#define SWI_Open                        0x66
763
 
764
#define SWI_Close                       0x68
765
#define SWI_Write                       0x69
766
#define SWI_Read                        0x6a
767
#define SWI_Seek                        0x6b
768
#define SWI_Flen                        0x6c
769
 
770
#define SWI_IsTTY                       0x6e
771
#define SWI_TmpNam                      0x6f
772
#define SWI_InstallHandler              0x70
773
#define SWI_GenerateError               0x71
774
 
775
 
776
#ifndef O_BINARY
777
#define O_BINARY 0
778
#endif
779
 
780
static int translate_open_mode[] =
781
{
782
  O_RDONLY,                     /* "r"   */
783
  O_RDONLY + O_BINARY,          /* "rb"  */
784
  O_RDWR,                       /* "r+"  */
785
  O_RDWR + O_BINARY,            /* "r+b" */
786
  O_WRONLY + O_CREAT + O_TRUNC, /* "w"   */
787
  O_WRONLY + O_BINARY + O_CREAT + O_TRUNC,      /* "wb"  */
788
  O_RDWR + O_CREAT + O_TRUNC,   /* "w+"  */
789
  O_RDWR + O_BINARY + O_CREAT + O_TRUNC,        /* "w+b" */
790
  O_WRONLY + O_APPEND + O_CREAT,        /* "a"   */
791
  O_WRONLY + O_BINARY + O_APPEND + O_CREAT,     /* "ab"  */
792
  O_RDWR + O_APPEND + O_CREAT,  /* "a+"  */
793
  O_RDWR + O_BINARY + O_APPEND + O_CREAT        /* "a+b" */
794
};
795
 
796
static int
797
exec_swi (int swi, argsin *args)
798
{
799
  int i;
800
  char c;
801
  switch (swi)
802
    {
803
    case SWI_WriteC:
804
      callback->write_stdout (callback, &c, 1);
805
      return 0;
806
    case SWI_Write0:
807
      for (i = 0; i < args->n; i++)
808
        callback->write_stdout (callback, args->s, strlen (args->s));
809
      return 0;
810
    case SWI_ReadC:
811
      callback->read_stdin (callback, &c, 1);
812
      args->n = c;
813
      return 1;
814
    case SWI_CLI:
815
      args->n = callback->system (callback, args->s);
816
      return 1;
817
    case SWI_GetErrno:
818
      args->n = callback->get_errno (callback);
819
      return 1;
820
    case SWI_Time:
821
      args->n = callback->time (callback, NULL);
822
      return 1;
823
 
824
    case SWI_Clock:
825
      /* return number of centi-seconds... */
826
      args->n =
827
#ifdef CLOCKS_PER_SEC
828
        (CLOCKS_PER_SEC >= 100)
829
        ? (clock () / (CLOCKS_PER_SEC / 100))
830
        : ((clock () * 100) / CLOCKS_PER_SEC);
831
#else
832
      /* presume unix... clock() returns microseconds */
833
        clock () / 10000;
834
#endif
835
      return 1;
836
 
837
    case SWI_Remove:
838
      args->n = callback->unlink (callback, args->s);
839
      return 1;
840
    case SWI_Rename:
841
      args->n = callback->rename (callback, args[0].s, args[1].s);
842
      return 1;
843
 
844
    case SWI_Open:
845
      /* Now we need to decode the Demon open mode */
846
      i = translate_open_mode[args[1].n];
847
 
848
      /* Filename ":tt" is special: it denotes stdin/out */
849
      if (strcmp (args->s, ":tt") == 0)
850
        {
851
          if (i == O_RDONLY)    /* opening tty "r" */
852
            args->n = 0 /* stdin */ ;
853
          else
854
            args->n = 1 /* stdout */ ;
855
        }
856
      else
857
        args->n = callback->open (callback, args->s, i);
858
      return 1;
859
 
860
    case SWI_Close:
861
      args->n = callback->close (callback, args->n);
862
      return 1;
863
 
864
    case SWI_Write:
865
      /* Return the number of bytes *not* written */
866
      args->n = args[1].n -
867
        callback->write (callback, args[0].n, args[1].s, args[1].n);
868
      return 1;
869
 
870
    case SWI_Read:
871
      {
872
        char *copy = alloca (args[2].n);
873
        int done = callback->read (callback, args[0].n, copy, args[2].n);
874
        if (done > 0)
875
          remote_rdp_xfer_inferior_memory (args[1].n, copy, done, 1, 0, 0);
876
        args->n = args[2].n - done;
877
        return 1;
878
      }
879
 
880
    case SWI_Seek:
881
      /* Return non-zero on failure */
882
      args->n = callback->lseek (callback, args[0].n, args[1].n, 0) < 0;
883
      return 1;
884
 
885
    case SWI_Flen:
886
      {
887
        long old = callback->lseek (callback, args->n, 0, SEEK_CUR);
888
        args->n = callback->lseek (callback, args->n, 0, SEEK_END);
889
        callback->lseek (callback, args->n, old, 0);
890
        return 1;
891
      }
892
 
893
    case SWI_IsTTY:
894
      args->n = callback->isatty (callback, args->n);
895
      return 1;
896
 
897
    case SWI_GetEnv:
898
      if (commandline != NULL)
899
        {
900
          int len = strlen (commandline);
901
          if (len > 255)
902
            {
903
              len = 255;
904
              commandline[255] = '\0';
905
            }
906
          remote_rdp_xfer_inferior_memory (args[0].n,
907
                                           commandline, len + 1, 1, 0, 0);
908
        }
909
      else
910
        remote_rdp_xfer_inferior_memory (args[0].n, "", 1, 1, 0, 0);
911
      return 1;
912
 
913
    default:
914
      return 0;
915
    }
916
}
917
 
918
 
919
static void
920
handle_swi (void)
921
{
922
  argsin args[3];
923
  char *buf;
924
  int len;
925
  int count = 0;
926
 
927
  int swino = get_word ();
928
  int type = get_byte ();
929
  while (type != 0)
930
    {
931
      switch (type & 0x3)
932
        {
933
        case ABYTE:
934
          args[count].n = get_byte ();
935
          break;
936
 
937
        case AWORD:
938
          args[count].n = get_word ();
939
          break;
940
 
941
        case ASTRING:
942
          /* If the word is under 32 bytes it will be sent otherwise
943
             an address to it is passed. Also: Special case of 255 */
944
 
945
          len = get_byte ();
946
          if (len > 32)
947
            {
948
              if (len == 255)
949
                {
950
                  len = get_word ();
951
                }
952
              buf = alloca (len);
953
              remote_rdp_xfer_inferior_memory (get_word (),
954
                                               buf,
955
                                               len,
956
                                               0,
957
                                               0,
958
                                               0);
959
            }
960
          else
961
            {
962
              int i;
963
              buf = alloca (len + 1);
964
              for (i = 0; i < len; i++)
965
                buf[i] = get_byte ();
966
              buf[i] = 0;
967
            }
968
          args[count].n = len;
969
          args[count].s = buf;
970
          break;
971
 
972
        default:
973
          error ("Unimplemented SWI argument");
974
        }
975
 
976
      type = type >> 2;
977
      count++;
978
    }
979
 
980
  if (exec_swi (swino, args))
981
    {
982
      /* We have two options here reply with either a byte or a word
983
         which is stored in args[0].n. There is no harm in replying with
984
         a word all the time, so thats what I do! */
985
      send_rdp ("bbw-", RDP_OSOpReply, RDP_OSOpWord, args[0].n);
986
    }
987
  else
988
    {
989
      send_rdp ("bb-", RDP_OSOpReply, RDP_OSOpNothing);
990
    }
991
}
992
 
993
static void
994
rdp_execute_finish (void)
995
{
996
  int running = 1;
997
 
998
  while (running)
999
    {
1000
      int res;
1001
      res = serial_readchar (io, 1);
1002
      while (res == SERIAL_TIMEOUT)
1003
        {
1004
          QUIT;
1005
          printf_filtered ("Waiting for target..\n");
1006
          res = serial_readchar (io, 1);
1007
        }
1008
 
1009
      switch (res)
1010
        {
1011
        case RDP_RES_SWI:
1012
          handle_swi ();
1013
          break;
1014
        case RDP_RES_VALUE:
1015
          send_rdp ("B", &ds.rdi_stopped_status);
1016
          running = 0;
1017
          break;
1018
        case RDP_RESET:
1019
          printf_filtered ("Target reset\n");
1020
          running = 0;
1021
          break;
1022
        default:
1023
          printf_filtered ("Ignoring %x\n", res);
1024
          break;
1025
        }
1026
    }
1027
}
1028
 
1029
 
1030
static void
1031
rdp_execute (void)
1032
{
1033
  rdp_execute_start ();
1034
  rdp_execute_finish ();
1035
}
1036
 
1037
static int
1038
remote_rdp_insert_breakpoint (CORE_ADDR addr, char *save)
1039
{
1040
  int res;
1041
  if (ds.rdi_level > 0)
1042
    {
1043
      send_rdp ("bwb-SWB",
1044
                RDP_SET_BREAK,
1045
                addr,
1046
                RDP_SET_BREAK_TYPE_PC_EQUAL | RDP_SET_BREAK_TYPE_GET_HANDLE,
1047
                save,
1048
                &res);
1049
    }
1050
  else
1051
    {
1052
      send_rdp ("bwb-SB",
1053
                RDP_SET_BREAK,
1054
                addr,
1055
                RDP_SET_BREAK_TYPE_PC_EQUAL,
1056
                &res);
1057
    }
1058
  return res;
1059
}
1060
 
1061
static int
1062
remote_rdp_remove_breakpoint (CORE_ADDR addr, char *save)
1063
{
1064
  int res;
1065
  if (ds.rdi_level > 0)
1066
    {
1067
      send_rdp ("b-p-S-B",
1068
                RDP_CLEAR_BREAK,
1069
                save, 4,
1070
                &res);
1071
    }
1072
  else
1073
    {
1074
      send_rdp ("bw-S-B",
1075
                RDP_CLEAR_BREAK,
1076
                addr,
1077
                &res);
1078
    }
1079
  return res;
1080
}
1081
 
1082
static void
1083
rdp_step (void)
1084
{
1085
  if (ds.can_step && 0)
1086
    {
1087
      /* The pie board can't do steps so I can't test this, and
1088
         the other code will always work. */
1089
      int status;
1090
      send_rdp ("bbw-S-B",
1091
                RDP_STEP, 0, 1,
1092
                &status);
1093
    }
1094
  else
1095
    {
1096
      char handle[4];
1097
      CORE_ADDR pc = read_register (ARM_PC_REGNUM);
1098
      pc = arm_get_next_pc (pc);
1099
      remote_rdp_insert_breakpoint (pc, handle);
1100
      rdp_execute ();
1101
      remote_rdp_remove_breakpoint (pc, handle);
1102
    }
1103
}
1104
 
1105
static void
1106
remote_rdp_open (char *args, int from_tty)
1107
{
1108
  int not_icebreaker;
1109
 
1110
  if (!args)
1111
    error_no_arg ("serial port device name");
1112
 
1113
  baud_rate = 9600;
1114
 
1115
  target_preopen (from_tty);
1116
 
1117
  io = serial_open (args);
1118
 
1119
  if (!io)
1120
    perror_with_name (args);
1121
 
1122
  serial_raw (io);
1123
 
1124
  rdp_init (1, from_tty);
1125
 
1126
 
1127
  if (from_tty)
1128
    {
1129
      printf_unfiltered ("Remote RDP debugging using %s at %d baud\n", args, baud_rate);
1130
    }
1131
 
1132
  rdp_info ();
1133
 
1134
  /* Need to set up the vector interception state */
1135
  rdp_catch_vectors ();
1136
 
1137
  /*
1138
     ** If it's an EmbeddedICE, we need to set the processor config.
1139
     ** Assume we can always have ARM7TDI...
1140
   */
1141
  send_rdp ("bw-SB", RDP_INFO, RDP_INFO_ICEBREAKER, &not_icebreaker);
1142
  if (!not_icebreaker)
1143
    {
1144
      const char *CPU = "ARM7TDI";
1145
      int ICEversion;
1146
      int len = strlen (CPU);
1147
 
1148
      send_rdp ("bbbbw-p-SWZ",
1149
                RDP_SELECT_CONFIG,
1150
                RDI_ConfigCPU,  /* Aspect: set the CPU */
1151
                len,            /* The number of bytes in the name */
1152
                RDI_MatchAny,   /* We'll take whatever we get */
1153
                0,               /* We'll take whatever version's there */
1154
                CPU, len,
1155
                &ICEversion);
1156
    }
1157
 
1158
  /* command line initialised on 'run' */
1159
 
1160
  push_target (&remote_rdp_ops);
1161
 
1162
  callback->init (callback);
1163
  flush_cached_frames ();
1164
  registers_changed ();
1165
  stop_pc = read_pc ();
1166
  set_current_frame (create_new_frame (read_fp (), stop_pc));
1167
  select_frame (get_current_frame ());
1168
  print_stack_frame (selected_frame, -1, 1);
1169
}
1170
 
1171
 
1172
 
1173
/* Close out all files and local state before this target loses control. */
1174
 
1175
static void
1176
remote_rdp_close (int quitting)
1177
{
1178
  callback->shutdown (callback);
1179
  if (io)
1180
    serial_close (io);
1181
  io = 0;
1182
}
1183
 
1184
 
1185
/* Resume execution of the target process.  STEP says whether to single-step
1186
   or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given
1187
   to the target, or zero for no signal.  */
1188
 
1189
static void
1190
remote_rdp_resume (ptid_t ptid, int step, enum target_signal siggnal)
1191
{
1192
  if (step)
1193
    rdp_step ();
1194
  else
1195
    rdp_execute ();
1196
}
1197
 
1198
/* Wait for inferior process to do something.  Return pid of child,
1199
   or -1 in case of error; store status through argument pointer STATUS,
1200
   just as `wait' would.  */
1201
 
1202
static ptid_t
1203
remote_rdp_wait (ptid_t ptid, struct target_waitstatus *status)
1204
{
1205
  switch (ds.rdi_stopped_status)
1206
    {
1207
    default:
1208
    case RDP_RES_RESET:
1209
    case RDP_RES_SWI:
1210
      status->kind = TARGET_WAITKIND_EXITED;
1211
      status->value.integer = read_register (0);
1212
      break;
1213
    case RDP_RES_AT_BREAKPOINT:
1214
      status->kind = TARGET_WAITKIND_STOPPED;
1215
      /* The signal in sigrc is a host signal.  That probably
1216
         should be fixed.  */
1217
      status->value.sig = TARGET_SIGNAL_TRAP;
1218
      break;
1219
#if 0
1220
    case rdp_signalled:
1221
      status->kind = TARGET_WAITKIND_SIGNALLED;
1222
      /* The signal in sigrc is a host signal.  That probably
1223
         should be fixed.  */
1224
      status->value.sig = target_signal_from_host (sigrc);
1225
      break;
1226
#endif
1227
    }
1228
 
1229
  return inferior_ptid;
1230
}
1231
 
1232
/* Get ready to modify the registers array.  On machines which store
1233
   individual registers, this doesn't need to do anything.  On machines
1234
   which store all the registers in one fell swoop, this makes sure
1235
   that registers contains all the registers from the program being
1236
   debugged.  */
1237
 
1238
static void
1239
remote_rdp_prepare_to_store (void)
1240
{
1241
  /* Do nothing, since we can store individual regs */
1242
}
1243
 
1244
/* Transfer LEN bytes between GDB address MYADDR and target address
1245
   MEMADDR.  If WRITE is non-zero, transfer them to the target,
1246
   otherwise transfer them from the target.  TARGET is unused.
1247
 
1248
   Returns the number of bytes transferred. */
1249
 
1250
static int
1251
remote_rdp_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
1252
                                 int write, struct mem_attrib *attrib,
1253
                                 struct target_ops *target)
1254
{
1255
  /* I infer from D Taylor's code that there's a limit on the amount
1256
     we can transfer in one chunk.. */
1257
  int done = 0;
1258
  while (done < len)
1259
    {
1260
      int justdone;
1261
      int thisbite = len - done;
1262
      if (thisbite > RDP_MOUTHFULL)
1263
        thisbite = RDP_MOUTHFULL;
1264
 
1265
      QUIT;
1266
 
1267
      if (write)
1268
        {
1269
          justdone = rdp_write (memaddr + done, myaddr + done, thisbite);
1270
        }
1271
      else
1272
        {
1273
          justdone = rdp_read (memaddr + done, myaddr + done, thisbite);
1274
        }
1275
 
1276
      done += justdone;
1277
 
1278
      if (justdone != thisbite)
1279
        break;
1280
    }
1281
  return done;
1282
}
1283
 
1284
 
1285
 
1286
struct yn
1287
{
1288
  const char *name;
1289
  int bit;
1290
};
1291
static struct yn stepinfo[] =
1292
{
1293
  {"Step more than one instruction", RDP_INFO_ABOUT_STEP_GT_1},
1294
  {"Step to jump", RDP_INFO_ABOUT_STEP_TO_JMP},
1295
  {"Step one instruction", RDP_INFO_ABOUT_STEP_1},
1296
  {0}
1297
};
1298
 
1299
static struct yn breakinfo[] =
1300
{
1301
  {"comparison breakpoints supported", RDP_INFO_ABOUT_BREAK_COMP},
1302
  {"range breakpoints supported", RDP_INFO_ABOUT_BREAK_RANGE},
1303
  {"watchpoints for byte reads supported", RDP_INFO_ABOUT_BREAK_BYTE_READ},
1304
  {"watchpoints for half-word reads supported", RDP_INFO_ABOUT_BREAK_HALFWORD_READ},
1305
  {"watchpoints for word reads supported", RDP_INFO_ABOUT_BREAK_WORD_READ},
1306
  {"watchpoints for byte writes supported", RDP_INFO_ABOUT_BREAK_BYTE_WRITE},
1307
  {"watchpoints for half-word writes supported", RDP_INFO_ABOUT_BREAK_HALFWORD_WRITE},
1308
  {"watchpoints for word writes supported", RDP_INFO_ABOUT_BREAK_WORD_WRITE},
1309
  {"mask break/watch-points supported", RDP_INFO_ABOUT_BREAK_MASK},
1310
{"thread-specific breakpoints supported", RDP_INFO_ABOUT_BREAK_THREAD_BREAK},
1311
{"thread-specific watchpoints supported", RDP_INFO_ABOUT_BREAK_THREAD_WATCH},
1312
  {"conditional breakpoints supported", RDP_INFO_ABOUT_BREAK_COND},
1313
  {0}
1314
};
1315
 
1316
 
1317
static void
1318
dump_bits (struct yn *t, int info)
1319
{
1320
  while (t->name)
1321
    {
1322
      printf_unfiltered ("  %-45s : %s\n", t->name, (info & t->bit) ? "Yes" : "No");
1323
      t++;
1324
    }
1325
}
1326
 
1327
static void
1328
remote_rdp_files_info (struct target_ops *target)
1329
{
1330
  printf_filtered ("Target capabilities:\n");
1331
  dump_bits (stepinfo, ds.step_info);
1332
  dump_bits (breakinfo, ds.break_info);
1333
  printf_unfiltered ("target level RDI %x\n", (ds.target_info >> 5) & 3);
1334
}
1335
 
1336
 
1337
static void
1338
remote_rdp_create_inferior (char *exec_file, char *allargs, char **env)
1339
{
1340
  CORE_ADDR entry_point;
1341
 
1342
  if (exec_file == 0 || exec_bfd == 0)
1343
    error ("No executable file specified.");
1344
 
1345
  entry_point = (CORE_ADDR) bfd_get_start_address (exec_bfd);
1346
 
1347
  remote_rdp_kill ();
1348
  remove_breakpoints ();
1349
  init_wait_for_inferior ();
1350
 
1351
  /* This gives us a chance to set up the command line */
1352
  rdp_set_command_line (exec_file, allargs);
1353
 
1354
  inferior_ptid = pid_to_ptid (42);
1355
  insert_breakpoints ();        /* Needed to get correct instruction in cache */
1356
 
1357
  /*
1358
     ** RDP targets don't provide any facility to set the top of memory,
1359
     ** so we don't bother to look for MEMSIZE in the environment.
1360
   */
1361
 
1362
  /* Let's go! */
1363
  proceed (entry_point, TARGET_SIGNAL_DEFAULT, 0);
1364
}
1365
 
1366
/* Attach doesn't need to do anything */
1367
static void
1368
remote_rdp_attach (char *args, int from_tty)
1369
{
1370
  return;
1371
}
1372
 
1373
/* Define the target subroutine names */
1374
 
1375
struct target_ops remote_rdp_ops;
1376
 
1377
static void
1378
init_remote_rdp_ops (void)
1379
{
1380
  remote_rdp_ops.to_shortname = "rdp";
1381
  remote_rdp_ops.to_longname = "Remote Target using the RDProtocol";
1382
  remote_rdp_ops.to_doc = "Use a remote ARM system which uses the ARM Remote Debugging Protocol";
1383
  remote_rdp_ops.to_open = remote_rdp_open;
1384
  remote_rdp_ops.to_close = remote_rdp_close;
1385
  remote_rdp_ops.to_attach = remote_rdp_attach;
1386
  remote_rdp_ops.to_post_attach = NULL;
1387
  remote_rdp_ops.to_require_attach = NULL;
1388
  remote_rdp_ops.to_detach = NULL;
1389
  remote_rdp_ops.to_require_detach = NULL;
1390
  remote_rdp_ops.to_resume = remote_rdp_resume;
1391
  remote_rdp_ops.to_wait = remote_rdp_wait;
1392
  remote_rdp_ops.to_post_wait = NULL;
1393
  remote_rdp_ops.to_fetch_registers = remote_rdp_fetch_register;
1394
  remote_rdp_ops.to_store_registers = remote_rdp_store_register;
1395
  remote_rdp_ops.to_prepare_to_store = remote_rdp_prepare_to_store;
1396
  remote_rdp_ops.to_xfer_memory = remote_rdp_xfer_inferior_memory;
1397
  remote_rdp_ops.to_files_info = remote_rdp_files_info;
1398
  remote_rdp_ops.to_insert_breakpoint = remote_rdp_insert_breakpoint;
1399
  remote_rdp_ops.to_remove_breakpoint = remote_rdp_remove_breakpoint;
1400
  remote_rdp_ops.to_terminal_init = NULL;
1401
  remote_rdp_ops.to_terminal_inferior = NULL;
1402
  remote_rdp_ops.to_terminal_ours_for_output = NULL;
1403
  remote_rdp_ops.to_terminal_ours = NULL;
1404
  remote_rdp_ops.to_terminal_info = NULL;
1405
  remote_rdp_ops.to_kill = remote_rdp_kill;
1406
  remote_rdp_ops.to_load = generic_load;
1407
  remote_rdp_ops.to_lookup_symbol = NULL;
1408
  remote_rdp_ops.to_create_inferior = remote_rdp_create_inferior;
1409
  remote_rdp_ops.to_post_startup_inferior = NULL;
1410
  remote_rdp_ops.to_acknowledge_created_inferior = NULL;
1411
  remote_rdp_ops.to_clone_and_follow_inferior = NULL;
1412
  remote_rdp_ops.to_post_follow_inferior_by_clone = NULL;
1413
  remote_rdp_ops.to_insert_fork_catchpoint = NULL;
1414
  remote_rdp_ops.to_remove_fork_catchpoint = NULL;
1415
  remote_rdp_ops.to_insert_vfork_catchpoint = NULL;
1416
  remote_rdp_ops.to_remove_vfork_catchpoint = NULL;
1417
  remote_rdp_ops.to_has_forked = NULL;
1418
  remote_rdp_ops.to_has_vforked = NULL;
1419
  remote_rdp_ops.to_can_follow_vfork_prior_to_exec = NULL;
1420
  remote_rdp_ops.to_post_follow_vfork = NULL;
1421
  remote_rdp_ops.to_insert_exec_catchpoint = NULL;
1422
  remote_rdp_ops.to_remove_exec_catchpoint = NULL;
1423
  remote_rdp_ops.to_has_execd = NULL;
1424
  remote_rdp_ops.to_reported_exec_events_per_exec_call = NULL;
1425
  remote_rdp_ops.to_has_exited = NULL;
1426
  remote_rdp_ops.to_mourn_inferior = generic_mourn_inferior;
1427
  remote_rdp_ops.to_can_run = NULL;
1428
  remote_rdp_ops.to_notice_signals = 0;
1429
  remote_rdp_ops.to_thread_alive = 0;
1430
  remote_rdp_ops.to_stop = 0;
1431
  remote_rdp_ops.to_pid_to_exec_file = NULL;
1432
  remote_rdp_ops.to_stratum = process_stratum;
1433
  remote_rdp_ops.DONT_USE = NULL;
1434
  remote_rdp_ops.to_has_all_memory = 1;
1435
  remote_rdp_ops.to_has_memory = 1;
1436
  remote_rdp_ops.to_has_stack = 1;
1437
  remote_rdp_ops.to_has_registers = 1;
1438
  remote_rdp_ops.to_has_execution = 1;
1439
  remote_rdp_ops.to_sections = NULL;
1440
  remote_rdp_ops.to_sections_end = NULL;
1441
  remote_rdp_ops.to_magic = OPS_MAGIC;
1442
}
1443
 
1444
void
1445
_initialize_remote_rdp (void)
1446
{
1447
  init_remote_rdp_ops ();
1448
  add_target (&remote_rdp_ops);
1449
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.